/* Mind Studio — paleta de marca: 433 C #1D252D · 4140 C #393D47 · 2270 C #2CC84D · 2200 C #05A9C7 · 2727 C #307FE2 · 4277 C #8F8B90 · 656 C #DDE5ED */
:root {
  --green: #2CC84D; --teal: #05A9C7; --blue: #307FE2;
  --grad: linear-gradient(100deg, var(--green), var(--teal) 50%, var(--blue));
  --bg: #1D252D; --surface: #252E38; --surface-2: #2E3742; --line: #3B4552;
  --text: #EEF2F6; --muted: #A3AEBB; --accent: #4DA3F5; --accent-ink: #0B1620;
  --ok: #3BD661; --warn: #F2B544; --danger: #FF7B72;
  --ok-bg: rgba(44, 200, 77, .14); --warn-bg: rgba(242, 181, 68, .14); --danger-bg: rgba(255, 123, 114, .14); --info-bg: rgba(5, 169, 199, .16);
  --shadow: 0 12px 32px -18px rgba(0, 0, 0, .7);
  --radius: 16px;
  --font: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Archivo', var(--font);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #F2F5F8; --surface: #FFFFFF; --surface-2: #EDF1F5; --line: #DDE5ED;
    --text: #1D252D; --muted: #5F6873; --accent: #2468C7; --accent-ink: #FFFFFF;
    --ok: #178A34; --warn: #96630A; --danger: #C2362C;
    --ok-bg: #E3F6E8; --warn-bg: #FBF0D9; --danger-bg: #FCE6E4; --info-bg: #E0F3F8;
    --shadow: 0 12px 30px -20px rgba(29, 37, 45, .35);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--font); min-height: 100dvh; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.96); } }

/* ---------- Estructura ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad); opacity: .85; }
.logo { height: 30px; width: auto; display: block; }
.logo.on-light { display: none; }
@media (prefers-color-scheme: light) { .logo.on-dark { display: none; } .logo.on-light { display: block; } }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 16px 110px; }
.main.wide { max-width: 1080px; }
.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.tab { flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; position: relative; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--text); }
.tab.active svg { stroke: var(--teal); }
.tab .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #06210D; font-size: .7rem; display: grid; place-items: center; }
@media (min-width: 900px) {
  .shell.has-tabs { grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .shell.has-tabs .topbar { grid-column: 1 / -1; }
  .tabs { position: sticky; top: 58px; align-self: start; height: calc(100dvh - 58px); flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line); padding: 16px 10px; background: transparent; }
  .tab { max-width: none; flex: none; grid-auto-flow: column; justify-content: start; justify-items: start; align-items: center; gap: 12px; padding: 10px 12px; font-size: .95rem; }
  .tab.active { background: var(--surface); }
  .tab .dot { position: static; margin-left: auto; }
  .main { padding-bottom: 48px; }
}

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.hero { position: relative; overflow: hidden; border-color: transparent; background:
  linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.eyebrow { font-family: var(--display); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
.big { font-family: var(--display); font-size: 1.45rem; font-weight: 600; line-height: 1.2; }
.page-head { display: grid; gap: 4px; margin-bottom: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn.primary { border: 0; background: var(--grad); color: #04141C; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--teal); }
@media (prefers-color-scheme: light) { .badge.info { color: #056F84; } .eyebrow { color: #057C93; } }

.notice { border-radius: 12px; padding: 12px 14px; background: var(--info-bg); font-size: .95rem; }
.notice.warn { background: var(--warn-bg); }
.notice.danger { background: var(--danger-bg); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

.list { display: grid; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; }
a.item:hover, button.item:hover { border-color: var(--teal); }
button.item { width: 100%; text-align: left; cursor: pointer; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item.unread { border-left: 3px solid var(--green); }
.datebox { flex: none; width: 54px; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; }
.datebox b { display: block; font-family: var(--display); font-size: 1.3rem; line-height: 1.1; }
.datebox span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- Formularios ---------- */
label.field { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: transparent; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 .span-2 { grid-column: 1 / -1; } }
.doc .row h2 { margin: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--teal); }
.radios { display: flex; gap: 10px; flex-wrap: wrap; }
.radios label { display: inline-flex; gap: 8px; align-items: center; padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--bg); font-weight: 400; }
.radios input { accent-color: var(--teal); width: 18px; height: 18px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--line); border-radius: 13px; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- Login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; inset: -20%; background:
  radial-gradient(40% 35% at 20% 15%, rgba(44, 200, 77, .16), transparent 70%),
  radial-gradient(45% 40% at 85% 85%, rgba(48, 127, 226, .2), transparent 70%); pointer-events: none; }
.auth-card { position: relative; width: 100%; max-width: 400px; }
.auth-card .logo { height: 46px; margin: 0 auto 26px; }

/* ---------- Consentimiento ---------- */
.doc h2 { display: flex; gap: 10px; align-items: baseline; margin: 26px 0 10px; }
.doc h2 .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #04141C; font-size: .85rem; display: grid; place-items: center; align-self: center; }
.doc p, .doc li { margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 22px; }
.doc h3 { margin: 14px 0 6px; }
.progress { position: sticky; top: 57px; z-index: 10; height: 4px; background: var(--line); border-radius: 2px; margin: 0 0 16px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); }
.sigpad { border: 1.5px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; width: 100%; height: 180px; display: block; cursor: crosshair; }
.qr { display: block; margin: 0 auto; border-radius: 12px; background: #fff; padding: 8px; width: 220px; height: 220px; }
.sigpad.filled { border-style: solid; border-color: var(--teal); }

/* ---------- Selector de horario ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.day { flex: none; width: 64px; padding: 8px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); text-align: center; cursor: pointer; }
.day b { display: block; font-family: var(--display); font-size: 1.2rem; }
.day span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.day.sel { border-color: transparent; background: var(--grad); color: #04141C; }
.day.sel span { color: #04141C; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.time { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 600; }
.time.sel { border-color: var(--teal); background: var(--info-bg); }

/* ---------- Diálogo y avisos ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 16, .6); display: grid; align-items: end; justify-items: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); }
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 20px; } }
#toast { position: fixed; z-index: 80; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--danger); color: #1D0906; }

/* ---------- Administración ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-family: var(--display); font-size: 1.8rem; line-height: 1.15; }
.stat span { color: var(--muted); font-size: .88rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.copybox { display: flex; gap: 8px; }
.copybox input { font-size: .85rem; }
.avail-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.avail-row:last-child { border-bottom: 0; }
.block { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.block input { width: 122px; min-height: 40px; }
details.card > summary { cursor: pointer; font-family: var(--display); font-weight: 600; }
details.card[open] > summary { margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
