/* TalkyPro design tokens — two themes toggleable via data-theme on <html> */

:root {
  /* Type */
  --f-display: 'Fraunces', 'Instrument Serif', Georgia, serif;
  --f-ui: 'Inter Tight', 'Inter', system-ui, -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  /* Spacing scale */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 72px;

  /* Radii */
  --r-1: 4px; --r-2: 6px; --r-3: 8px; --r-4: 12px; --r-5: 16px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(.2,.7,.2,1);
  --t-med:  220ms cubic-bezier(.2,.7,.2,1);
}

/* Track A — Ops Terminal (default) */
:root,
:root[data-theme="ops"] {
  --bg: #0a0b0f;
  --bg-1: #0f1116;         /* slightly raised */
  --bg-2: #14171e;         /* card */
  --bg-3: #1a1e27;         /* hover */
  --bg-inset: #07080b;     /* recessed */
  --line: rgba(255,255,255,.06);
  --line-strong: rgba(255,255,255,.11);

  --fg: #ecedef;
  --fg-1: #b8bcc5;
  --fg-2: #7d838e;
  --fg-3: #525862;

  --accent: oklch(0.68 0.17 290);        /* muted violet */
  --accent-soft: oklch(0.68 0.17 290 / .14);
  --accent-fg: #fff;

  --good:  oklch(0.72 0.13 155);
  --warn:  oklch(0.80 0.14 80);
  --bad:   oklch(0.68 0.19 27);
  --info:  oklch(0.72 0.11 220);

  --good-soft: oklch(0.72 0.13 155 / .12);
  --warn-soft: oklch(0.80 0.14 80  / .12);
  --bad-soft:  oklch(0.68 0.19 27  / .14);
  --info-soft: oklch(0.72 0.11 220 / .12);

  --shadow-card: 0 1px 0 rgba(255,255,255,.02) inset, 0 0 0 1px var(--line);
  --shadow-pop: 0 10px 40px rgba(0,0,0,.5), 0 0 0 1px var(--line-strong);
  --card-radius: 8px;
}

/* Track B — Dim (intermediate, softer dark) */
:root[data-theme="dim"],
:root[data-theme="soft"] {
  --bg: #161a23;
  --bg-1: #1b1f2a;
  --bg-2: #212634;
  --bg-3: #2a2f3f;
  --bg-inset: #121620;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.13);

  --fg: #eef0f5;
  --fg-1: #bcc1cd;
  --fg-2: #868c9c;
  --fg-3: #565c6c;

  --accent: oklch(0.72 0.14 240);
  --accent-soft: oklch(0.72 0.14 240 / .16);
  --accent-fg: #fff;

  --good:  oklch(0.74 0.13 155);
  --warn:  oklch(0.82 0.14 80);
  --bad:   oklch(0.70 0.19 27);
  --info:  oklch(0.74 0.12 220);

  --good-soft: oklch(0.74 0.13 155 / .14);
  --warn-soft: oklch(0.82 0.14 80  / .14);
  --bad-soft:  oklch(0.70 0.19 27  / .16);
  --info-soft: oklch(0.74 0.12 220 / .14);

  --shadow-card: 0 1px 0 rgba(255,255,255,.03) inset, 0 0 0 1px var(--line);
  --shadow-pop: 0 16px 48px rgba(0,0,0,.45), 0 0 0 1px var(--line-strong);
  --card-radius: 10px;
}

/* Track C — Light (blue-white pastel, mirrors operator comfort) */
:root[data-theme="light"] {
  --bg: #eef4fb;              /* pale blue-white */
  --bg-1: #f5f9fd;            /* card surface */
  --bg-2: #ffffff;            /* elevated card */
  --bg-3: #e4ecf5;            /* hover / chip */
  --bg-inset: #e9f0f8;        /* recessed */
  --line: rgba(14, 36, 68, .08);
  --line-strong: rgba(14, 36, 68, .16);

  --fg: #0f1b2d;
  --fg-1: #354a66;
  --fg-2: #6b7d94;
  --fg-3: #9aabc1;

  --accent: oklch(0.58 0.20 248);            /* saturated brand blue */
  --accent-soft: oklch(0.58 0.20 248 / .12);
  --accent-fg: #fff;

  --good:  oklch(0.58 0.15 155);
  --warn:  oklch(0.68 0.16 60);
  --bad:   oklch(0.58 0.22 27);
  --info:  oklch(0.58 0.16 220);

  --good-soft: oklch(0.58 0.15 155 / .12);
  --warn-soft: oklch(0.68 0.16 60  / .14);
  --bad-soft:  oklch(0.58 0.22 27  / .12);
  --info-soft: oklch(0.58 0.16 220 / .12);

  --shadow-card: 0 1px 0 rgba(255,255,255,.8) inset, 0 0 0 1px var(--line), 0 1px 3px rgba(14,36,68,.04);
  --shadow-pop: 0 24px 56px rgba(14,36,68,.12), 0 0 0 1px var(--line-strong);
  --card-radius: 10px;
}

/* Light-theme scrollbar tweak */
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--bg-3); }

/* Light-theme shimmer + perfil stripe tweak */
:root[data-theme="light"] .sk {
  background: linear-gradient(90deg, var(--bg-3) 0%, var(--bg-1) 50%, var(--bg-3) 100%);
  background-size: 200% 100%;
}
:root[data-theme="light"] .perfil-ph {
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    rgba(14,36,68,.04) 10px 20px
  );
}

/* density */
:root[data-density="compact"] {
  --row-h: 32px;
  --pad-card: 16px;
}
:root,
:root[data-density="comfortable"] {
  --row-h: 44px;
  --pad-card: 24px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01','cv01','cv03';
}
body { min-height: 100vh; }

/* Type utilities */
.t-display { font-family: var(--f-display); font-weight: 400; letter-spacing: -0.02em; }
.t-ui      { font-family: var(--f-ui); }
.t-mono    { font-family: var(--f-mono); font-feature-settings: 'tnum' 1, 'zero' 1; }
.t-num     { font-variant-numeric: tabular-nums; }

.t-xs  { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); }
.t-sm  { font-size: 12px; color: var(--fg-1); }
.t-md  { font-size: 14px; }
.t-lg  { font-size: 16px; }
.t-xl  { font-size: 20px; }
.t-2xl { font-size: 28px; }
.t-3xl { font-size: 42px; line-height: 1; }
.t-4xl { font-size: 64px; line-height: 0.95; }
.t-5xl { font-size: 96px; line-height: 0.9; }

.t-dim   { color: var(--fg-2); }
.t-dimmer{ color: var(--fg-3); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* Common building blocks */
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  padding: var(--pad-card);
}
.card-inset {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 999px;
  background: var(--bg-3); color: var(--fg-1);
  border: 1px solid var(--line);
  letter-spacing: .02em;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-good   { background: var(--good-soft);   color: var(--good);   border-color: transparent; }
.pill-warn   { background: var(--warn-soft);   color: var(--warn);   border-color: transparent; }
.pill-bad    { background: var(--bad-soft);    color: var(--bad);    border-color: transparent; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-good { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-bad  { background: var(--bad); }
.dot-info { background: var(--info); }
.dot-accent { background: var(--accent); }
.dot-dim { background: var(--fg-3); }

.pulse {
  position: relative;
}
.pulse::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  background: currentColor; opacity: .35;
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(.6); opacity: .5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  background: var(--bg-3); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.btn:hover { background: var(--bg-2); border-color: var(--line-strong); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-1); }
.btn-ghost:hover { background: var(--bg-2); color: var(--fg); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 12px; }

/* Input */
.input {
  height: 32px; background: var(--bg-inset); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
  font: inherit; font-size: 13px; outline: none;
  transition: border-color var(--t-fast);
}
.input:focus { border-color: var(--accent); }

/* Monogram avatar */
.mono-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--fg-1);
  font: 600 11px var(--f-ui); letter-spacing: .04em;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.mono-av.sm { width: 22px; height: 22px; font-size: 10px; }
.mono-av.lg { width: 40px; height: 40px; font-size: 14px; }
.mono-av.xl { width: 64px; height: 64px; font-size: 20px; }

/* Striped perfil placeholder */
.perfil-ph {
  background-color: var(--bg-3);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0 10px,
    rgba(255,255,255,.025) 10px 20px
  );
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 10px;
  color: var(--fg-3);
  font: 10px var(--f-mono);
  text-transform: lowercase;
  letter-spacing: .05em;
}

/* Focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Toast */
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sparkline SVG reset */
svg { overflow: visible; }

/* Table reset */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl th {
  font: 600 11px var(--f-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-2);
  padding-top: 14px; padding-bottom: 10px;
  background: var(--bg-inset);
  position: sticky; top: 0; z-index: 1;
}
.tbl tr:hover td { background: var(--bg-3); }
.tbl td.num { font-variant-numeric: tabular-nums; font-family: var(--f-mono); }

/* Utilities */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.ai-c { align-items: center; }  .ai-s { align-items: flex-start; } .ai-e { align-items: flex-end; }
.jc-sb{ justify-content: space-between; } .jc-c { justify-content: center; }
.flex1 { flex: 1; } .wrap { flex-wrap: wrap; }

.divider { height: 1px; background: var(--line); width: 100%; }
.divider-v { width: 1px; background: var(--line); align-self: stretch; }

/* Skeleton shimmer */
.sk {
  background: linear-gradient(90deg, var(--bg-3) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
  background-size: 200% 100%;
  animation: sk 1.4s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes sk { to { background-position: -200% 0; } }


/* ============================================================
   MOBILE RESPONSIVE - viewport <=768px o forzado
   ============================================================ */

html[data-force-mobile="1"] body {
  max-width: 390px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 100vh;
  background: var(--bg);
}

@media (max-width: 768px) {
  .tp-sidebar { display: none !important; }
  .tp-main { width: 100% !important; min-width: 0 !important; }
}

/* Mismas reglas via data-force-mobile (para preview desde desktop con viewport >768px) */
html[data-force-mobile="1"] .tp-sidebar { display: none !important; }
html[data-force-mobile="1"] .tp-main { width: 100% !important; min-width: 0 !important; }
html[data-force-mobile="1"] .tp-topbar { padding: 14px 14px !important; }
html[data-force-mobile="1"] .tp-topbar h1 { font-size: 20px !important; }
html[data-force-mobile="1"] .tp-topbar .t-dim,
html[data-force-mobile="1"] .tp-topbar .subtitle { display: none !important; }
html[data-force-mobile="1"] .card { padding: 14px !important; }
html[data-force-mobile="1"] .grid-2col,
html[data-force-mobile="1"] .grid-3col,
html[data-force-mobile="1"] .grid-4col { grid-template-columns: 1fr !important; }
html[data-force-mobile="1"] .tp-palette-hint { display: none !important; }
html[data-force-mobile="1"] .tp-floating-assistant { transform: scale(0.85); transform-origin: bottom right; }
html[data-force-mobile="1"] .tp-mobile-drawer .tp-sidebar { display: flex !important; }

@media (max-width: 768px) {
  /* RE-OPEN para no romper el resto del bloque */
  .tp-sidebar { display: none !important; }
  .tp-main { width: 100% !important; min-width: 0 !important; }
  .tp-topbar { padding: 14px 14px !important; }
  .tp-topbar h1 { font-size: 20px !important; }
  .tp-topbar .t-dim, .tp-topbar .subtitle { display: none !important; }
  .page-pad { padding: 14px !important; }
  .m-stack > * { grid-column: 1 / -1 !important; }
  .grid-2col, .grid-3col, .grid-4col { grid-template-columns: 1fr !important; }
  .card { padding: 14px !important; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 32px; }
  button, [role="button"], .btn { min-height: 40px; }
  input, textarea, select { font-size: 16px !important; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 560px; }
  .tbl th, .tbl td { padding: 8px 10px !important; font-size: 12px !important; }
  .tbl th:first-child, .tbl td:first-child {
    position: sticky; left: 0; background: var(--bg-1); z-index: 1;
  }
  .modal-shell, .modal-card {
    width: 100vw !important; max-width: 100vw !important;
    height: 100vh !important; max-height: 100vh !important;
    border-radius: 0 !important; margin: 0 !important;
  }
  .m-turno-sticky {
    position: sticky; top: 56px; z-index: 40;
    background: var(--bg-1); border-bottom: 1px solid var(--line);
    padding: 10px 14px;
  }
  .tp-palette-hint { display: none !important; }
  .tp-floating-assistant {
    bottom: 12px !important; right: 12px !important;
    transform: scale(0.85); transform-origin: bottom right;
  }
}

html[data-force-mobile="1"] .tp-sidebar { display: none !important; }
html[data-force-mobile="1"] .tp-topbar h1 { font-size: 20px !important; }
html[data-force-mobile="1"] .tp-topbar .t-dim,
html[data-force-mobile="1"] .tp-topbar .subtitle { display: none !important; }
html[data-force-mobile="1"] .grid-2col,
html[data-force-mobile="1"] .grid-3col,
html[data-force-mobile="1"] .grid-4col { grid-template-columns: 1fr !important; }
html[data-force-mobile="1"] input,
html[data-force-mobile="1"] textarea,
html[data-force-mobile="1"] select { font-size: 16px !important; }
html[data-force-mobile="1"] .tp-palette-hint { display: none !important; }

/* Override: el sidebar DENTRO del drawer mobile SI debe verse */
.tp-mobile-drawer .tp-sidebar { display: flex !important; position: static !important; height: auto !important; width: 100% !important; max-width: 100% !important; min-height: 100vh !important; border: none !important; }
