:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #17202a;
  --muted: #687385;
  --line: #dfe5ec;
  --accent: #146c5f;
  --accent-dark: #0f544a;
  --danger: #a33a3a;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hero {
  padding: 40px 24px 34px;
  background: linear-gradient(135deg, #10231f, #146c5f);
  color: white;
}

.hero > div,
.layout,
.app-footer {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
  opacity: .85;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(34px, 4vw, 54px); line-height: 1.05; }
h2 { margin-bottom: 16px; font-size: 22px; }

.layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.45fr) minmax(340px, .85fr);
  gap: 22px;
  padding: 24px 0 18px;
  align-items: start;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(20, 34, 45, .07);
}

.privacy {
  grid-column: 1 / -1;
  color: var(--muted);
  padding: 18px 22px;
}
.compact-privacy {
  padding: 14px 18px;
}
.compact-privacy h2 { margin-bottom: 6px; font-size: 18px; }
.compact-privacy p { margin: 0; font-size: 14px; line-height: 1.45; }

.privacy h2 { margin-bottom: 10px; font-size: 20px; }
.privacy p { margin-bottom: 8px; }
.privacy p:last-child { margin-bottom: 0; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slots-legend {
  margin: 14px 0 8px;
  font-weight: 650;
  color: #334155;
  font-size: 14px;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-weight: 650;
  font-size: 14px;
}

input, select, button {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
}

input, select {
  padding: 0 12px;
  background: white;
  color: var(--text);
}

button {
  padding: 0 16px;
  border: 0;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }

#todayButton {
  width: auto;
  min-height: 38px;
}

.form { display: grid; gap: 8px; }
.form button { margin-top: 12px; }
.rule-banner {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f0f8ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 14px;
  font-weight: 650;
}
.help-box {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fbfdff;
  color: #475569;
  font-size: 13px;
}
.help-box summary {
  cursor: pointer;
  font-weight: 800;
  color: #334155;
}
.help-box ol {
  margin: 10px 0 8px 20px;
  padding: 0;
}
.help-box li { margin: 3px 0; }
.help-box p {
  margin: 6px 0 0;
  line-height: 1.4;
}
.selected-turno {
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #0f172a;
  font-weight: 700;
}

.slots {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.slot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.slot-info { flex: 1; }
.slot-time { display: block; font-size: 18px; }
.slot-status { display: block; margin-top: 4px; font-weight: 750; color: #1f2937; }
.slot-home { display: block; margin-top: 4px; color: #374151; }

.slot.is-free {
  background: #f6fbf9;
  border-color: #b7d8d0;
  cursor: pointer;
}

.slot.is-free:hover {
  background: #eef8f5;
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(20, 108, 95, .12);
  transform: translateY(-1px);
}

.slot.is-selected {
  background: #e8f1ff;
  border: 3px solid #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .16), 0 10px 24px rgba(37, 99, 235, .10);
}

.slot.is-booked {
  background: #fff3e6;
  border-color: #c47b3a;
  cursor: not-allowed;
}

.slot-cancel {
  width: auto;
  min-width: 128px;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 650;
}
.slot-cancel:hover {
  background: #cbd5e1;
}

.message {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 650;
}
.message:not(:empty) { padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; }
.message-success {
  background: linear-gradient(135deg, #edfdf5, #eef9ff);
  border-color: #99e2c3;
  color: #0f5132;
}
.message-error {
  background: linear-gradient(135deg, #fff7ed, #fff1f2);
  border-color: #f7c7b4;
  color: #8a2d1f;
}

.app-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 28px;
}

.admin-link {
  color: #64748b;
  font-size: 13px;
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
  color: #1f2937;
}

.admin-layout {
  grid-template-columns: minmax(280px, 560px);
  justify-content: center;
}

.admin-card { width: 100%; }

@media (min-width: 1280px) {
  .hero { padding-top: 46px; padding-bottom: 38px; }
  .layout { grid-template-columns: minmax(620px, 1.5fr) minmax(380px, .85fr); }
}

@media (max-width: 760px) {
  .hero { padding: 30px 18px 24px; }
  .hero > div,
  .layout,
  .app-footer {
    width: min(100% - 28px, 980px);
  }
  .layout {
    grid-template-columns: 1fr;
    padding-top: 16px;
  }
  .layout > .card:first-child { order: 1; }
  .layout > .card:nth-child(2) { order: 2; }
  .layout > .card:nth-child(3) { order: 3; }
  .card { padding: 18px; }
  .slot { align-items: stretch; flex-direction: column; }
  .slot-cancel { width: 100%; }
  button { min-height: 50px; }
  .app-footer { justify-content: center; }
}

/* Premium visual polish */
:root {
  --bg: #eef2f4;
  --radius: 22px;
}
body {
  background: radial-gradient(circle at top left, rgba(20, 108, 95, .08), transparent 32%), var(--bg);
}
.hero {
  padding-top: 44px;
  padding-bottom: 36px;
  background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.10), transparent 30%), linear-gradient(135deg, #0b1d1a, #176f61);
}
.hero p:not(.eyebrow) { max-width: 640px; font-size: 17px; opacity: .94; }
.eyebrow { letter-spacing: .11em; opacity: .78; }
h1 { letter-spacing: -.035em; }
.card {
  border-color: rgba(217,225,232,.85);
  box-shadow: 0 18px 45px rgba(16, 32, 40, .10);
}
.booking-card { position: sticky; top: 18px; }
.section-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 800;
}
.slots-legend {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #e3e9ef;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 13px;
}
input, select, button { min-height: 48px; border-radius: 14px; }
input, select { padding-inline: 14px; }
input:focus, select:focus {
  outline: none;
  border-color: rgba(20,108,95,.55);
  box-shadow: 0 0 0 3px rgba(20,108,95,.12);
}
button {
  background: linear-gradient(135deg, var(--accent), #1f7f70);
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(20,108,95,.18);
}
button:hover { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
button.is-cancel-mode {
  background: linear-gradient(135deg, #8a3a1f, #b45309);
  box-shadow: 0 10px 22px rgba(180, 83, 9, .22);
}
button.is-cancel-mode:hover {
  background: linear-gradient(135deg, #78350f, #92400e);
}
.rule-banner {
  border-radius: 14px;
  background: #f7fbff;
  color: #183b7a;
  font-weight: 750;
}
.help-box {
  background: #ffffff;
  border-color: #e5edf5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.selected-turno {
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #e8f1ff);
  font-weight: 800;
}
.slot {
  min-height: 84px;
  padding: 18px;
  border-radius: 18px;
}
.slot-time { font-size: 19px; }
.slot-status { font-weight: 800; }
.slot.is-free { background: linear-gradient(135deg, #fbfffd, #f3faf7); }
.slot.is-selected { background: linear-gradient(135deg, #edf5ff, #e8f1ff); }
.slot.is-booked { background: linear-gradient(135deg, #fff8ef, #fff1df); }
.slot.is-booked .slot-info {
  display: grid;
  gap: 8px;
}
.slot.is-booked .slot-home {
  display: block;
  width: fit-content;
  margin-top: 0;
  padding: 6px 0 6px 12px;
  border-left: 4px solid #c47b3a;
  border-radius: 0;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  background: transparent;
  color: #713f12;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.slot-cancel {
  min-width: 140px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  box-shadow: none;
}
.slot-cancel:hover { background: #e2e8f0; }
.compact-privacy {
  padding: 12px 16px;
  border-style: dashed;
  box-shadow: 0 10px 28px rgba(16,32,40,.06);
}
.compact-privacy h2 { margin-bottom: 4px; font-size: 15px; color: #64748b; }
.compact-privacy p { margin: 0; font-size: 13px; line-height: 1.4; }
.app-footer {
  justify-content: space-between;
  gap: 16px;
  color: #8a96a8;
  font-size: 13px;
}
.admin-help { color: var(--muted); margin-bottom: 16px; }
.admin-warning {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff8ef;
  border: 1px solid #f1d1aa;
  color: #7c3f12;
  font-weight: 700;
}
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: #64748b;
  text-decoration: none;
  font-weight: 700;
}
.back-link:hover { color: #1f2937; text-decoration: underline; }
@media (max-width: 760px) {
  .booking-card { position: static; }
  .slots-legend { border-radius: 14px; }
  .app-footer { flex-direction: column; text-align: center; }
}

/* UI refinements */
.slot-time { font-size: 20px; letter-spacing: -.01em; }
.slot-status {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}
.slot-home { margin-top: 8px; color: #64748b; font-size: 13px; }
.slot.is-free .slot-status { background: #ecfdf5; color: #116149; }
.slot.is-selected .slot-status { background: #dbeafe; color: #1d4ed8; }
.slot.is-booked .slot-status { background: #ffedd5; color: #9a3412; }
.selected-turno {
  padding: 12px 14px;
  border: 1px solid #bfd8ff;
  background: linear-gradient(135deg, #f8fbff, #eef5ff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1719;
    --card: #162224;
    --text: #edf5f3;
    --muted: #a9b8b7;
    --line: #2d3b3e;
    --accent: #2c8f7d;
    --accent-dark: #1f7567;
  }

  body {
    background: radial-gradient(circle at top left, rgba(44, 143, 125, .14), transparent 34%), var(--bg);
    color: var(--text);
  }

  .hero {
    background: radial-gradient(circle at 80% 0%, rgba(255,255,255,.08), transparent 30%), linear-gradient(135deg, #07110f, #10574c);
  }

  .card {
    background: linear-gradient(180deg, #182527, #141f21);
    border-color: #2b3a3d;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
  }

  input,
  select {
    background: #10191b;
    border-color: #344449;
    color: var(--text);
  }

  input::placeholder {
    color: #7f9191;
  }

  label,
  .privacy,
  .compact-privacy h2,
  .compact-privacy p,
  .slot-home,
  .app-footer,
  .admin-link,
  .admin-help {
    color: var(--muted);
  }

  .slots-legend,
  .help-box,
  .slot-cancel {
    background: #121d20;
    border-color: #2d3b3e;
    color: #d7e3e1;
  }

  .help-box summary {
    color: #edf5f3;
  }

  .rule-banner,
  .selected-turno {
    background: #122236;
    border-color: #315f91;
    color: #d8eaff;
  }

  .slot {
    background: #142023;
    border-color: #2d3b3e;
  }

  .slot.is-free {
    background: linear-gradient(135deg, #142421, #101f1d);
    border-color: #2d6d60;
  }

  .slot.is-free:hover {
    background: linear-gradient(135deg, #18312d, #112723);
    border-color: #46b39e;
  }

  .slot.is-selected {
    background: linear-gradient(135deg, #132642, #102038);
    border-color: #5b8dff;
    box-shadow: 0 0 0 2px rgba(91, 141, 255, .20), 0 10px 24px rgba(0, 0, 0, .22);
  }

  .slot.is-booked {
    background: linear-gradient(135deg, #2a2118, #211912);
    border-color: #b77942;
  }

  .slot-status {
    color: #edf5f3;
  }

  .slot.is-free .slot-status {
    background: #13332c;
    color: #9be4d1;
  }

  .slot.is-selected .slot-status {
    background: #183c78;
    color: #d8eaff;
  }

  .slot.is-booked .slot-status {
    background: #4a2c16;
    color: #ffd7a8;
  }

  .slot.is-booked .slot-home {
    background: transparent;
    border-color: #b77942;
    color: #ffd7a8;
  }

  .slot-cancel {
    background: #202b30;
    color: #d7e3e1;
  }

  .slot-cancel:hover {
    background: #2b3940;
  }

  .message-success {
    background: linear-gradient(135deg, #112a21, #10263a);
    border-color: #2c8067;
    color: #a8f0d4;
  }

  .message-error {
    background: linear-gradient(135deg, #321d16, #351b1f);
    border-color: #8b4a38;
    color: #ffc2b2;
  }

  .admin-warning {
    background: #2f2116;
    border-color: #8a5a2e;
    color: #ffd7a8;
  }
}
