/* ==========================================================================
   Mesa de Servicios — sistema de diseño
   Petróleo + ámbar · Archivo (títulos) · Instrument Sans (texto) · Martian Mono (códigos)
   Elemento distintivo: el talón de ticket perforado.
   ========================================================================== */

:root {
  color-scheme: light;
  --font-display: "Archivo", "Instrument Sans", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #EEF1F0;
  --surface: #FFFFFF;
  --surface-2: #F7F9F8;
  --surface-3: #EFF3F2;
  --ink: #13232A;
  --ink-2: #3D5057;
  --muted: #687A80;
  --faint: #97A5AA;
  --line: #DFE5E3;
  --line-2: #CAD4D1;

  --brand: #0F4C5C;
  --brand-hover: #0B3C49;
  --brand-ink: #FFFFFF;
  --brand-soft: #E1EDEF;
  --link: #0F5F72;
  --accent: #F2A93B;
  --accent-soft: #FFF3DC;
  --accent-ink: #7A4A00;

  --side: #0E2C34;
  --side-2: #143841;
  --band: #0E2C34;
  --side-ink: #D5E4E6;
  --side-muted: #85A3A9;
  --side-line: rgba(255, 255, 255, .08);

  --danger: #BF3530;
  --danger-soft: #FCEBEA;
  --success: #1B7A4C;
  --success-soft: #E4F3EA;
  --warning-ink: #855600;
  --warning-soft: #FFF4DA;
  --info-soft: #E6F0FB;

  --st-new: #2A78D6;
  --st-open: #1BAF7A;
  --st-in_progress: #6250D6;
  --st-on_hold: #EDA100;
  --st-resolved: #008300;
  --st-closed: #8A989D;
  --pr-high: #EC835A;
  --pr-urgent: #D03B3B;
  --series-1: #2A78D6;
  --series-2: #1BAF7A;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 40, 48, .06);
  --shadow: 0 1px 2px rgba(15, 40, 48, .05), 0 6px 20px rgba(15, 40, 48, .06);
  --shadow-lg: 0 18px 50px rgba(9, 30, 36, .22);
  --focus: 0 0 0 3px rgba(242, 169, 59, .55);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A161A;
  --surface: #11222A;
  --surface-2: #142830;
  --surface-3: #1A3039;
  --ink: #E6EEEF;
  --ink-2: #B7C8CB;
  --muted: #88A0A6;
  --faint: #5F767C;
  --line: #20363E;
  --line-2: #2C4650;

  --brand: #1E7A8F;
  --brand-hover: #238BA2;
  --brand-ink: #FFFFFF;
  --brand-soft: #15363F;
  --link: #6CC6D8;
  --accent: #F2A93B;
  --accent-soft: #33280F;
  --accent-ink: #F5C46F;

  --side: #081317;
  --side-2: #0F232A;
  --band: #0F3640;
  --side-ink: #CFDEE0;
  --side-muted: #6F8B91;
  --side-line: rgba(255, 255, 255, .06);

  --danger: #E66767;
  --danger-soft: #3A1A1C;
  --success: #4CC38A;
  --success-soft: #12301F;
  --warning-ink: #F2C063;
  --warning-soft: #33280F;
  --info-soft: #132A40;

  --st-new: #3987E5;
  --st-open: #199E70;
  --st-in_progress: #9085E9;
  --st-on_hold: #C98500;
  --st-resolved: #2FA046;
  --st-closed: #6F8489;
  --series-1: #3987E5;
  --series-2: #199E70;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: radial-gradient(900px 420px at 85% -140px, color-mix(in srgb, var(--brand) 9%, transparent), transparent 70%) no-repeat, var(--bg);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.2; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, pre { font-family: var(--font-mono); font-size: .82em; }
code { background: var(--surface-3); padding: .1em .4em; border-radius: 4px; }
pre { background: var(--surface-3); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; line-height: 1.6; }
pre code { background: none; padding: 0; }
::selection { background: var(--accent); color: #13232A; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.i { flex: none; }
.i.inline { display: inline; vertical-align: -2px; }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -.01em; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.eyebrow {
  font: 600 11px/1.3 var(--font-body);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.display {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 700;
  letter-spacing: -.015em;
}

/* --------------------------------------------------------------------------
   Estructura de la aplicación
   -------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--side); color: var(--side-ink);
  padding: 18px 14px 14px;
  overflow-x: hidden; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #13232A;
}
.brand-name { font: 700 15.5px/1.15 var(--font-display); font-stretch: 112%; letter-spacing: -.01em; }
.brand-sub { display: block; font: 500 11px/1.3 var(--font-body); color: var(--side-muted); letter-spacing: .02em; }
/* El encabezado del menú es el talón: perforación con huecos y muescas en ambos bordes */
.sidebar .brand { position: relative; padding-bottom: 22px; margin-bottom: 16px; }
.sidebar .brand::after { content: ""; position: absolute; left: 6px; right: 0; bottom: 0; height: 6px; background: radial-gradient(circle 2px, var(--bg) 92%, transparent) 0 50% / 11px 6px repeat-x; opacity: .9; }
.sidebar .brand::before { content: ""; position: absolute; right: -23px; bottom: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); box-shadow: -256px 0 0 var(--bg); }
.side-circuit { position: absolute; left: 0; bottom: 0; width: 100%; max-width: none; height: auto; pointer-events: none; fill: none; stroke: rgba(255, 255, 255, .11); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.side-circuit circle { fill: var(--side); }
.side-circuit .side-pulse { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 200; stroke-dashoffset: 4; animation: trace-pulse 7s linear infinite 1s; }

.nav-group { margin-bottom: 18px; }
.nav-title { padding: 0 10px 6px; font: 600 10.5px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--side-muted); }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 1px 0;
  border-radius: 8px;
  color: var(--side-ink); text-decoration: none; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link .i { color: var(--side-muted); transition: color .15s; }
.nav-link:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.nav-link:hover .i { color: var(--side-ink); }
.nav-link.is-active { background: var(--side-2); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-link.is-active .i { color: var(--accent); }
.nav-count {
  margin-left: auto; min-width: 24px; padding: 1px 7px;
  border-radius: 999px; text-align: center;
  font: 500 11px/18px var(--font-mono);
  background: rgba(255, 255, 255, .07); color: var(--side-ink);
}
.nav-count.is-alert { background: rgba(230, 103, 103, .22); color: #FFB3B0; }
.sidebar-foot { position: relative; margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--side-line); font-size: 12px; color: var(--side-muted); }
.sidebar-foot kbd { font: 500 10.5px/1 var(--font-mono); padding: 2px 5px; border: 1px solid var(--side-line); border-radius: 4px; color: var(--side-ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 62px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-toggle { display: none; }
.search {
  position: relative; flex: 1; max-width: 460px;
}
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 44px 0 38px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font: 500 11px/1 var(--font-mono); color: var(--muted);
  padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar .search-mobile { display: none; }

.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 28px 28px 64px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: 27px; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.crumbs a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border: 1px solid transparent; border-radius: 9px;
  font: 600 13.5px/1 var(--font-body);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s var(--ease), border-color .15s, color .15s, transform .1s var(--ease);
  -webkit-user-select: none; user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn-accent { background: var(--accent); color: #13232A; }
.btn-accent:hover { background: #E89B26; color: #13232A; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--faint); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.dot-count {
  position: absolute; top: 4px; right: 3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; border: 2px solid var(--bg);
  background: var(--danger); color: #fff;
  font: 600 10px/13px var(--font-body); text-align: center;
}

/* --------------------------------------------------------------------------
   Tarjetas, insignias y piezas pequeñas
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card-head h2, .card-title { font: 650 15px/1.3 var(--font-body); letter-spacing: -.005em; }
.card-head .link { font-size: 13px; font-weight: 500; text-decoration: none; }
.card-body { padding: 16px 20px 20px; }
.section-title { font: 650 15px/1.3 var(--font-body); margin-bottom: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px 0 8px;
  border-radius: 999px;
  font: 600 12px/1 var(--font-body); white-space: nowrap;
  color: var(--ink);
  background: color-mix(in srgb, var(--st, var(--faint)) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--st, var(--faint)) 30%, transparent);
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--st, var(--faint)); }
.st-new { --st: var(--st-new); }
.st-open { --st: var(--st-open); }
.st-in_progress { --st: var(--st-in_progress); }
.st-on_hold { --st: var(--st-on_hold); }
.st-resolved { --st: var(--st-resolved); }
.st-closed { --st: var(--st-closed); }
.st-in_progress i { box-shadow: 0 0 0 0 var(--st); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 5px transparent; } }

/* Prioridad: barras tipo señal + etiqueta (nunca solo color) */
.prio { display: inline-flex; align-items: flex-end; gap: 2px; font: 500 12.5px/1 var(--font-body); color: var(--ink-2); white-space: nowrap; }
.prio b { width: 3px; border-radius: 1px; background: var(--line-2); }
.prio b:nth-child(1) { height: 5px; } .prio b:nth-child(2) { height: 8px; } .prio b:nth-child(3) { height: 11px; } .prio b:nth-child(4) { height: 14px; margin-right: 6px; }
.pr-low b:nth-child(-n+1) { background: var(--muted); }
.pr-normal b:nth-child(-n+2) { background: var(--ink-2); }
.pr-high b:nth-child(-n+3) { background: var(--pr-high); }
.pr-high { color: var(--ink); }
.pr-urgent b { background: var(--pr-urgent); }
.pr-urgent { color: var(--pr-urgent); font-weight: 650; }

/* Código del ticket: un pequeño talón con muescas */
.code {
  --n: 4px;
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 10px;
  font: 500 11px/1 var(--font-mono); letter-spacing: .01em; white-space: nowrap;
  color: var(--accent-ink); background: var(--accent-soft);
  -webkit-mask: radial-gradient(circle var(--n) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--n) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle var(--n) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--n) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
  text-decoration: none;
}
a.code:hover { text-decoration: none; filter: brightness(.97); }

.cat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.cat::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--faint)); transform: rotate(45deg); }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font: 600 11.5px/1 var(--font-body); background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .tag-brand { color: #8FD3E0; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

.due { display: inline-flex; align-items: center; gap: 5px; font: 500 12px/1.2 var(--font-body); white-space: nowrap; }
.due-ok { color: var(--muted); }
.due-soon { color: var(--warning-ink); }
.due-over { color: var(--danger); font-weight: 600; }

/* Avatares */
.av {
  --av: 30px;
  display: inline-grid; place-items: center; flex: none;
  width: var(--av); height: var(--av); border-radius: 50%;
  font: 650 calc(var(--av) * .38)/1 var(--font-body); letter-spacing: .01em;
  color: #fff; background: #5B7279;
  -webkit-user-select: none; user-select: none;
}
.av-sm { --av: 24px; }
.av-lg { --av: 44px; }
.av-xl { --av: 64px; }
.av-empty { background: transparent; border: 1.5px dashed var(--line-2); }
.av-c0 { background: #0F6B7D; } .av-c1 { background: #B4582F; } .av-c2 { background: #5B4BC4; } .av-c3 { background: #217A52; }
.av-c4 { background: #A23D63; } .av-c5 { background: #7A6516; } .av-c6 { background: #2C5DA8; } .av-c7 { background: #4E5F66; }
.who { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.who-name { font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------------------
   Formularios
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font: 600 13px/1.3 var(--font-body); color: var(--ink); }
.label-opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.field-error { font-size: 12.5px; color: var(--danger); margin: 0; font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font: 400 14.5px/1.4 var(--font-body);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--danger); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23687A80' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select-sm, .input-sm { min-height: 34px; padding-top: 6px; padding-bottom: 6px; font-size: 13.5px; border-radius: 8px; }
.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-foot .spacer { margin-right: auto; }
.input-group { display: flex; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-3); }
input[type="color"].input { padding: 4px; height: 40px; width: 64px; cursor: pointer; }

/* Selector segmentado (prioridad al crear) */
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.segmented label:hover { border-color: var(--faint); }
.segmented label small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.segmented input:checked + label { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.segmented input:focus-visible + label { box-shadow: var(--focus); }

/* Zona de adjuntos */
.dropzone {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border: 1.5px dashed var(--line-2); border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--ink-2); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--ink); font-weight: 600; }
.file-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-list:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 28px; padding: 0 4px 0 9px; border-radius: 7px; background: var(--surface-3); font-size: 12.5px; color: var(--ink-2); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip em { font-style: normal; color: var(--muted); font-size: 11.5px; }
.file-chip button { width: 22px; height: 22px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 5px; display: grid; place-items: center; }
.file-chip button:hover { background: var(--line); color: var(--ink); }

/* --------------------------------------------------------------------------
   Mensajes flash, alertas y estados vacíos
   -------------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--ink); color: #F2F6F6;
  border-radius: 11px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; line-height: 1.45;
  animation: toast-in .35s var(--ease) both;
}
[data-theme="dark"] .toast { background: #E6EEEF; color: #13232A; }
.toast .i { margin-top: 1px; }
.toast-success .i { color: #5BD39A; } .toast-error .i { color: #FF8C86; } .toast-warning .i { color: var(--accent); } .toast-info .i { color: #8CC8FF; }
[data-theme="dark"] .toast-success .i { color: #1B7A4C; } [data-theme="dark"] .toast-error .i { color: #BF3530; } [data-theme="dark"] .toast-info .i { color: #2A78D6; }
.toast button { margin-left: auto; border: 0; background: none; color: inherit; opacity: .6; cursor: pointer; padding: 0 2px; }
.toast button:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out .25s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; margin-bottom: 16px; }
.alert .i { margin-top: 2px; }
.alert-info { background: var(--info-soft); color: var(--ink); }
.alert-warning { background: var(--warning-soft); color: var(--ink); }
.alert-warning .i { color: var(--warning-ink); }
.alert-error { background: var(--danger-soft); color: var(--ink); }
.alert-error .i { color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--ink); }
.alert-success .i { color: var(--success); }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-mark { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--surface-3); color: var(--muted); }
.empty h3 { font: 650 16px/1.3 var(--font-body); color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 380px; margin: 0 auto 16px; }

/* --------------------------------------------------------------------------
   Desplegables
   -------------------------------------------------------------------------- */
.dropdown { position: relative; }
.menu {
  position: absolute; z-index: 50; top: calc(100% + 8px); right: 0;
  min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top right;
  transition: opacity .14s var(--ease), transform .14s var(--ease), visibility 0s .14s;
}
.dropdown.is-open > .menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.menu-left { left: 0; right: auto; transform-origin: top left; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); text-align: left; text-decoration: none;
  font: 500 13.5px/1.3 var(--font-body); cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-3); text-decoration: none; }
.menu .i { color: var(--muted); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-head { padding: 10px 10px 8px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head span { font-size: 12.5px; color: var(--muted); }

.notif-menu { width: 360px; padding: 0; overflow: hidden; }
.notif-menu .menu-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-menu .menu-top strong { font-size: 14px; }
.notif-list { max-height: 380px; overflow-y: auto; padding: 4px; }
.notif {
  display: flex !important; gap: 10px; align-items: flex-start;
  padding: 10px !important;
}
.notif-text { min-width: 0; flex: 1; }
.notif-text b { display: block; font-weight: 550; font-size: 13px; line-height: 1.4; }
.notif-text span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-text time { font-size: 11.5px; color: var(--faint); }
.notif.is-unread { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.notif.is-unread .notif-text b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.notif-menu .menu-foot { display: block; padding: 10px; text-align: center; font-size: 13px; font-weight: 600; border-top: 1px solid var(--line); text-decoration: none; }

/* --------------------------------------------------------------------------
   Lista de tickets
   -------------------------------------------------------------------------- */
.views { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.views::-webkit-scrollbar { display: none; }
.views a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 12px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.views a:hover { color: var(--ink); }
.views a.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.views .n { font: 500 11px/1 var(--font-mono); color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-inline { position: relative; flex: 1 1 260px; max-width: 360px; }
.toolbar .search-inline .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search-inline .input { padding-left: 34px; min-height: 36px; }
.filters { display: none; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 14px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filters.is-open { display: grid; }
.filters .field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filters-foot { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip-remove { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: 999px; background: var(--brand-soft); color: var(--ink); font-size: 12.5px; font-weight: 500; text-decoration: none; }
.chip-remove:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.chip-remove .i { color: var(--muted); }

.tlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tlist-head, .trow {
  display: grid;
  grid-template-columns: 34px 112px minmax(0, 1fr) 130px 118px 150px 120px;
  align-items: center; gap: 14px;
  padding: 0 18px 0 14px;
}
.tlist.no-select .tlist-head, .tlist.no-select .trow { grid-template-columns: 112px minmax(0, 1fr) 130px 118px 150px 120px; padding-left: 18px; }
/* Cada fila es un ticket del talonario: talón con el código, perforación y muesca entre filas */
.t-stub { position: relative; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 5px; margin: -12px 0; padding: 12px 0; }
.t-stub::after { content: ""; position: absolute; right: -9px; top: 0; bottom: 0; width: 4px; background: radial-gradient(circle 1.6px, var(--line-2) 92%, transparent) 50% 2px / 4px 8px repeat-y; }
.t-stub::before { content: ""; position: absolute; right: -13px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.trow:first-child .t-stub::before, .tlist-head + .trow .t-stub::before { display: none; }
.t-code { font: 500 12px/1 var(--font-mono); letter-spacing: -.01em; color: var(--accent-ink); white-space: nowrap; }
.t-code::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 2px; background: var(--c, var(--accent)); vertical-align: 1px; }
.t-opened { font: 500 10px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.tlist-head { height: 40px; background: var(--surface-2); border-bottom: 1px solid var(--line); font: 600 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tlist-head a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tlist-head a:hover, .tlist-head a.is-sorted { color: var(--ink); }
.trow {
  position: relative; min-height: 70px; padding-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-2); }
.trow::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.trow.pr-high::before { background: var(--pr-high); }
.trow.pr-urgent::before { background: var(--pr-urgent); }
.trow.is-selected { background: var(--brand-soft); }
.t-main { min-width: 0; }
.t-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.t-subject { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-subject::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.t-subject:hover { text-decoration: none; color: var(--link); }
.trow .row-check, .trow .t-meta a, .trow .code { position: relative; z-index: 1; }
.trow.is-unread .t-subject { font-weight: 700; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.t-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.t-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.t-meta .i { display: inline; vertical-align: -2px; margin-right: 3px; }
.t-col-assignee { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.t-col-assignee span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-col-time { font-size: 12.5px; color: var(--muted); text-align: right; }
.t-col-time .due { display: flex; justify-content: flex-end; margin-top: 3px; }
.due .i { display: inline-block; }
.row-check { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; margin: 0; }

.bulkbar {
  position: sticky; bottom: 16px; z-index: 20;
  display: none; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 12px;
  background: var(--ink); color: #F2F6F6; border-radius: 12px; box-shadow: var(--shadow-lg);
}
.bulkbar.is-visible { display: flex; animation: toast-in .25s var(--ease) both; }
.bulkbar strong { font-weight: 600; margin-right: 6px; padding-left: 4px; }
.bulkbar .select { width: auto; min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; background-color: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }
.bulkbar .select option { color: #13232A; }
[data-theme="dark"] .bulkbar { background: #E6EEEF; color: #13232A; }
[data-theme="dark"] .bulkbar .select { background-color: #fff; color: #13232A; border-color: #CAD4D1; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 13px; color: var(--muted); }
.pages { display: flex; gap: 4px; }
.pages a, .pages span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.pages a:hover { background: var(--surface-3); }
.pages .is-current { background: var(--ink); color: var(--bg); }
.pages .gap { color: var(--faint); }

/* Tablas genéricas (administración) */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font: 600 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.row-inactive td { opacity: .55; }

/* --------------------------------------------------------------------------
   Detalle del ticket
   -------------------------------------------------------------------------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ticket-head { margin-bottom: 20px; }
.ticket-head h1 { font-family: var(--font-display); font-stretch: 108%; font-weight: 700; font-size: 25px; letter-spacing: -.02em; line-height: 1.25; margin: 10px 0 10px; overflow-wrap: anywhere; }
.ticket-head .meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: 13px; }

.timeline { position: relative; display: flex; flex-direction: column; gap: 14px; }
/* La caja de respuesta va arriba y el historial debajo, del más reciente al más antiguo */
.ticket-thread > :first-child { margin-top: 0; }
.ticket-thread > .history { margin-top: 24px; }
/* «Más antiguos primero»: el historial sube y la caja de respuesta queda al final, como un chat */
.ticket-thread.is-asc { display: flex; flex-direction: column; }
.ticket-thread.is-asc > .history { order: -2; margin-top: 0; margin-bottom: 4px; }
.ticket-thread.is-asc > .typing { order: -1; }
.timeline > [hidden] { display: none !important; }
.timeline.is-empty::before { display: none; }
.history-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.history-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.history-filter button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 600 12.5px/1 var(--font-body); cursor: pointer; }
.history-filter button:hover { color: var(--ink); background: var(--surface-2); }
.history-filter button.is-active { background: var(--ink); color: var(--bg); }
.history-filter button span { font: 500 11px/1 var(--font-mono); opacity: .75; }
.history-order { color: var(--ink-2); }
.history-empty { margin: 0 0 12px; padding: 22px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); text-align: center; color: var(--muted); font-size: 13.5px; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 24px; bottom: 24px; width: 2px; background: repeating-linear-gradient(to bottom, var(--line-2) 0 4px, transparent 4px 9px); }
.msg { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; }
.msg > .av { position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--bg); }
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; scroll-margin-top: 90px; }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px 0; font-size: 13px; color: var(--muted); }
.msg-head strong { color: var(--ink); font-weight: 650; font-size: 14px; }
.msg-head time { margin-left: auto; }
.msg-body { padding: 8px 16px 14px; overflow-wrap: anywhere; }
.msg-body p:last-child, .msg-body ul:last-child, .msg-body ol:last-child { margin-bottom: 0; }
.msg-body ul, .msg-body ol { margin: 0 0 .8em; padding-left: 1.3em; }
.msg-body li { margin: .2em 0; }
.msg.is-staff .msg-card { background: var(--surface); }
.msg.is-internal .msg-card { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.msg.is-internal .msg-head .tag { background: var(--accent); color: #13232A; }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.file-card { display: flex; align-items: center; gap: 10px; max-width: 280px; padding: 7px 12px 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); text-decoration: none; color: var(--ink); }
.file-card:hover { border-color: var(--line-2); text-decoration: none; background: var(--surface-3); }
.file-card .ficon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); flex: none; }
.file-card b { display: block; font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.file-card small { color: var(--muted); font-size: 11.5px; }
.thumb { display: block; width: 132px; height: 92px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s var(--ease); }
.thumb:hover img { transform: scale(1.04); }
.msg-foot { display: flex; gap: 12px; padding: 0 16px 12px; font-size: 12px; color: var(--muted); }

/* Los cambios del historial van en el mismo recuadro que los mensajes, con un ícono en lugar del avatar */
.event { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.event-dot { position: relative; z-index: 1; justify-self: center; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); box-shadow: 0 0 0 4px var(--bg); }
.event-body { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; min-width: 0; padding: 11px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.event-text { flex: 1; min-width: 0; line-height: 1.6; overflow-wrap: anywhere; }
.event strong { color: var(--ink); font-weight: 650; }
.event time { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.event .badge { height: 20px; font-size: 11px; padding: 0 7px; }

/* Caja de respuesta */
.composer { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; scroll-margin-top: 90px; }
.composer.is-internal { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.composer-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.composer-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 0; border-radius: 8px 8px 0 0; background: none; color: var(--muted); font: 600 13px/1 var(--font-body); cursor: pointer; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.composer-tabs button:hover { color: var(--ink); }
.composer-tabs button.is-active { color: var(--ink); background: var(--surface); border-bottom-color: var(--brand); }
.composer-tabs button[data-mode="internal"].is-active { border-bottom-color: var(--accent); }
.composer .textarea { border: 0; border-radius: 0; min-height: 150px; box-shadow: none; padding: 14px 16px; background: transparent; }
.composer.is-internal .textarea { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.composer-tools { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.composer-tools .dropzone { padding: 6px 10px; border-width: 1px; font-size: 12.5px; gap: 7px; }
.composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.composer-foot .spacer { margin-right: auto; font-size: 12px; color: var(--muted); }
.composer-foot .select { width: auto; }
.composer .file-list { padding: 0 12px 10px; margin: 0; }
.time-input { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.time-input .input { width: 76px; min-height: 32px; padding: 5px 8px; font-size: 13px; }
.composer-locked { margin-top: 18px; padding: 18px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--radius); }

/* El talón: panel lateral del ticket */
.stub-wrap { filter: drop-shadow(0 0 .5px rgba(19, 35, 42, .35)) drop-shadow(0 6px 14px rgba(15, 40, 48, .07)); }
[data-theme="dark"] .stub-wrap { filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .25)) drop-shadow(0 8px 18px rgba(0, 0, 0, .35)); }
/* Talón oscuro arriba (código, barras, estado) y cuerpo claro abajo, separados por una perforación real */
.stub {
  --perf: 162px; --n: 12px;
  background: var(--surface); border-radius: 16px;
  -webkit-mask:
    radial-gradient(circle var(--n) at 0 var(--perf), #0000 98%, #000),
    radial-gradient(circle var(--n) at 100% var(--perf), #0000 98%, #000),
    radial-gradient(circle 3px, #0000 92%, #000) 0 calc(var(--perf) - 5px) / 14px 10px repeat-x,
    linear-gradient(180deg, #000 calc(var(--perf) - 5px), #0000 0 calc(var(--perf) + 5px), #000 0);
  -webkit-mask-composite: source-in, source-in, source-over;
  mask:
    radial-gradient(circle var(--n) at 0 var(--perf), #0000 98%, #000),
    radial-gradient(circle var(--n) at 100% var(--perf), #0000 98%, #000),
    radial-gradient(circle 3px, #0000 92%, #000) 0 calc(var(--perf) - 5px) / 14px 10px repeat-x,
    linear-gradient(180deg, #000 calc(var(--perf) - 5px), #0000 0 calc(var(--perf) + 5px), #000 0);
  mask-composite: intersect, intersect, add;
}
.stub-top { height: var(--perf); padding: 20px 22px 0; display: flex; flex-direction: column; justify-content: space-between; position: relative; background: var(--band); color: #DCE8EA; }
.stub-top .eyebrow { color: #7FA0A6; font-family: var(--font-mono); font-weight: 500; letter-spacing: .12em; }
.stub-code { font: 500 21px/1 var(--font-mono); letter-spacing: -.02em; color: var(--accent); }
.stub-top .barcode { height: 26px; fill: rgba(220, 232, 234, .55); }
.stub-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 20px; }
.stub-top .due-ok { color: #A9C3C7; }
.stub-top .due-soon { color: var(--accent); }
.stub-top .due-over { color: #FF9C97; }
.stub-body { padding: 18px 22px 22px; }
.props { display: grid; gap: 14px; }
.prop { display: grid; gap: 6px; }
.prop > .label, .prop > label { font: 600 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prop .select, .prop .input { min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: 13.5px; }
.prop-value { font-size: 14px; display: flex; align-items: center; gap: 8px; min-height: 24px; }
.props-save { display: flex; gap: 8px; margin-top: 4px; }
.js .props-save { display: none; }
.js .props.is-dirty + .props-save { display: flex; animation: toast-in .2s var(--ease) both; }
.sla { margin-top: 2px; }
.sla-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.sla-bar span { display: block; height: 100%; border-radius: 99px; background: var(--st-open); }
.sla-bar.is-soon span { background: var(--accent); }
.sla-bar.is-over span { background: var(--pr-urgent); }
.side-card { margin-top: 16px; }
.side-card .card-body { padding: 16px 20px 18px; }
.quick-actions { display: grid; gap: 8px; margin-top: 16px; }
.quick-actions form { display: contents; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.mini-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.mini-list a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; }
.mini-list a:hover { background: var(--surface-3); text-decoration: none; }
.mini-list a > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calificación */
.rating-box { margin-top: 18px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 90px; }
.stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { cursor: pointer; color: var(--line-2); transition: color .12s, transform .12s var(--ease); }
.stars label svg { width: 30px; height: 30px; fill: currentColor; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: var(--accent); }
.stars label:hover { transform: scale(1.08); }
.stars input:focus-visible + label { box-shadow: var(--focus); border-radius: 6px; }
.stars-static { display: inline-flex; gap: 2px; color: var(--accent); }
.stars-static svg { fill: currentColor; }
.stars-static .off { color: var(--line-2); }

/* --------------------------------------------------------------------------
   Panel (dashboard)
   -------------------------------------------------------------------------- */
.queues-wrap { margin-bottom: 22px; filter: drop-shadow(0 0 .5px rgba(19, 35, 42, .35)) drop-shadow(0 6px 14px rgba(15, 40, 48, .07)); }
[data-theme="dark"] .queues-wrap { filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .25)) drop-shadow(0 8px 18px rgba(0, 0, 0, .35)); }
.queues { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border-radius: 14px; overflow: hidden; }
/* En escritorio la franja es una tira de 4 tickets: muescas y perforación entre cada uno */
@media (min-width: 1025px) {
  .queues {
    --n: 10px;
    -webkit-mask:
      radial-gradient(circle var(--n) at 25% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 25% 100%, #0000 98%, #000),
      radial-gradient(circle var(--n) at 50% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 50% 100%, #0000 98%, #000),
      radial-gradient(circle var(--n) at 75% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 75% 100%, #0000 98%, #000),
      radial-gradient(circle 2.5px, #0000 92%, #000) calc(25% - 2px) 0 / 8px 12px repeat-y,
      radial-gradient(circle 2.5px, #0000 92%, #000) 50% 0 / 8px 12px repeat-y,
      radial-gradient(circle 2.5px, #0000 92%, #000) calc(75% + 2px) 0 / 8px 12px repeat-y,
      linear-gradient(90deg, #000 calc(25% - 4px), #0000 0 calc(25% + 4px), #000 0 calc(50% - 4px), #0000 0 calc(50% + 4px), #000 0 calc(75% - 4px), #0000 0 calc(75% + 4px), #000 0);
    -webkit-mask-composite: source-in, source-in, source-in, source-in, source-in, source-in, source-over, source-over, source-over;
    mask:
      radial-gradient(circle var(--n) at 25% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 25% 100%, #0000 98%, #000),
      radial-gradient(circle var(--n) at 50% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 50% 100%, #0000 98%, #000),
      radial-gradient(circle var(--n) at 75% 0, #0000 98%, #000), radial-gradient(circle var(--n) at 75% 100%, #0000 98%, #000),
      radial-gradient(circle 2.5px, #0000 92%, #000) calc(25% - 2px) 0 / 8px 12px repeat-y,
      radial-gradient(circle 2.5px, #0000 92%, #000) 50% 0 / 8px 12px repeat-y,
      radial-gradient(circle 2.5px, #0000 92%, #000) calc(75% + 2px) 0 / 8px 12px repeat-y,
      linear-gradient(90deg, #000 calc(25% - 4px), #0000 0 calc(25% + 4px), #000 0 calc(50% - 4px), #0000 0 calc(50% + 4px), #000 0 calc(75% - 4px), #0000 0 calc(75% + 4px), #000 0);
    mask-composite: intersect, intersect, intersect, intersect, intersect, intersect, add, add, add;
  }
  .queues .queue { border-right: 0; }
}
.queue {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px 16px; text-decoration: none; color: var(--ink);
  border-right: 1px dashed var(--line-2);
  transition: background .15s;
}
.queue:last-child { border-right: 0; }
.queue:hover { background: var(--surface-2); text-decoration: none; }
.queue-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.queue-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.queue-label .i { color: var(--muted); }
.queue-num { font: 700 34px/1 var(--font-display); font-stretch: 112%; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.queue-note { font-size: 12.5px; color: var(--muted); }
.queue.is-alert .queue-num { color: var(--danger); }
.queue-num.is-good { color: var(--success); }
div.queue:hover { background: transparent; }
/* Métricas del cliente */
.metrics-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; margin: 6px 0 12px; }
.metrics-head h2 { font: 700 19px/1.2 var(--font-display); font-stretch: 106%; letter-spacing: -.01em; }
.metrics-scope { font: 500 11px/1.4 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.metrics-head > div { display: grid; gap: 4px; }
/* Filtro de periodo: atajo «Últimos 6 meses» + año + mes */
.period { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period-chip { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 600 12.5px/1 var(--font-body); text-decoration: none; white-space: nowrap; }
.period-chip:hover { text-decoration: none; border-color: var(--faint); color: var(--ink); }
.period-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.period .select { width: auto; min-width: 104px; }
.period .select.is-set { border-color: var(--ink); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ink); }
.chart .now { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 180px; margin-top: 12px; border: 1.5px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: 13.5px; text-align: center; padding: 16px; }
.prio-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.prio-list li { display: grid; grid-template-columns: 88px minmax(0, 1fr) 32px; align-items: center; gap: 10px; }
.prio-list .hbar-track { display: block; }
.prio-list b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13px; }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.queue.is-alert .queue-label .i { color: var(--danger); }
.queue .go { color: var(--faint); transition: transform .15s var(--ease), color .15s; }
.queue:hover .go { transform: translateX(3px); color: var(--ink); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; }
.grid-2-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stack { display: grid; gap: 20px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.mini-list, .queue-list, .legend-list, .feed, .props, .timeline { grid-template-columns: minmax(0, 1fr); }
.grid-2 > *, .grid-2-even > *, .ticket-layout > *, .settings-layout > * { min-width: 0; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.metric { padding: 14px 20px; border-top: 1px solid var(--line); }
.metric:nth-child(odd) { border-right: 1px solid var(--line); }
.metric-label { font-size: 12.5px; color: var(--muted); }
.metric-value { margin-top: 4px; font: 650 20px/1.2 var(--font-display); font-stretch: 105%; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.metric-value small { font: 500 12px var(--font-body); color: var(--muted); margin-left: 4px; }

.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chart-legend b { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart { position: relative; margin-top: 12px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font: 500 10.5px var(--font-body); }
.chart .bar-1 { fill: var(--series-1); }
.chart .bar-2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit.is-hover { fill: color-mix(in srgb, var(--ink) 5%, transparent); }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  padding: 8px 10px; border-radius: 8px;
  background: var(--ink); color: var(--bg);
  font-size: 12px; line-height: 1.5; white-space: nowrap;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, -100%); transition: opacity .12s;
}
.tooltip.is-visible { opacity: 1; }
.tooltip b { font-weight: 650; }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }

.stackbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin: 6px 0 16px; background: var(--surface-3); }
.stackbar a { display: block; height: 100%; background: var(--st); transition: filter .15s; min-width: 4px; }
.stackbar a:hover { filter: brightness(1.1); }
.legend-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.legend-list a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13.5px; }
.legend-list a:hover { background: var(--surface-3); text-decoration: none; }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; background: var(--st, var(--c)); flex: none; }
.legend-list b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; }
.legend-list small { color: var(--muted); width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.hbar-track { height: 8px; border-radius: 0 4px 4px 0; background: var(--surface-3); overflow: hidden; }
.hbar-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--c, var(--series-1)); }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 13px; }

.workload th, .workload td { padding: 10px 12px; }
.workload th:first-child, .workload td:first-child { padding-left: 20px; }
.workload .hbar { min-width: 80px; }
.workload .who-name { max-width: 150px; }

.queue-list { display: grid; }
.qitem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.qitem:hover { background: var(--surface-2); text-decoration: none; }
.qitem-main { min-width: 0; }
.qitem-main b { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem-main span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.qitem .due { font-size: 12px; }

.feed { display: grid; margin: 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.feed li a { color: var(--ink); font-weight: 550; text-decoration: none; }
.feed li a:hover { text-decoration: underline; }
.feed time { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* Bienvenida del panel: un ticket con talón a la derecha (mismo lenguaje que el ingreso) */
.greeting {
  --s: 240px; --n: 14px;
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--s);
  margin-bottom: 22px; border-radius: 18px; color: #E7F0F1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='440' height='200' fill='none' stroke='rgba(255,255,255,.07)' stroke-width='1.5' stroke-linejoin='round'%3E%3Cpath d='M0 150 H90 L130 110 H260 L300 70 H440'/%3E%3Cpath d='M160 200 V160 L190 130 H340 L370 160 H440'/%3E%3Cpath d='M220 0 V40 L250 70 H300'/%3E%3Cpath d='M380 0 V30 L410 60 H440'/%3E%3Ccircle cx='260' cy='110' r='4'/%3E%3Ccircle cx='340' cy='130' r='4'/%3E%3Ccircle cx='300' cy='70' r='4'/%3E%3C/svg%3E") right var(--s) center / auto 100% no-repeat, var(--band);
  -webkit-mask:
    radial-gradient(circle var(--n) at calc(100% - var(--s)) 0, #0000 98%, #000),
    radial-gradient(circle var(--n) at calc(100% - var(--s)) 100%, #0000 98%, #000),
    radial-gradient(circle 3px, #0000 92%, #000) right calc(var(--s) - 5px) top 0 / 10px 14px repeat-y,
    linear-gradient(90deg, #000 calc(100% - var(--s) - 5px), #0000 0 calc(100% - var(--s) + 5px), #000 0);
  -webkit-mask-composite: source-in, source-in, source-over;
  mask:
    radial-gradient(circle var(--n) at calc(100% - var(--s)) 0, #0000 98%, #000),
    radial-gradient(circle var(--n) at calc(100% - var(--s)) 100%, #0000 98%, #000),
    radial-gradient(circle 3px, #0000 92%, #000) right calc(var(--s) - 5px) top 0 / 10px 14px repeat-y,
    linear-gradient(90deg, #000 calc(100% - var(--s) - 5px), #0000 0 calc(100% - var(--s) + 5px), #000 0);
  mask-composite: intersect, intersect, add;
}
.greeting-main { padding: 26px 32px 26px; min-width: 0; }
.greeting-date { font: 500 11px/1.4 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.greeting h1 { margin-top: 8px; color: #fff; font-family: var(--font-display); font-stretch: 108%; font-weight: 700; font-size: 29px; letter-spacing: -.02em; }
.greeting p { margin: 8px 0 0; color: #A9C3C7; max-width: 560px; }
.greeting .project-switch { margin-top: 18px; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); }
.greeting .project-switch a { color: #A9C3C7; }
.greeting .project-switch a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.greeting .project-switch a.is-active { background: #fff; color: #13232A; }
.greeting .project-fixed { margin-top: 16px; color: #CFE0E3; }
.greeting-stub { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 22px 28px; background: rgba(255, 255, 255, .03); }
.greeting-stub strong { font: 500 16px/1.2 var(--font-mono); color: var(--accent); }
.greeting-stub .barcode { height: 34px; margin: 6px 0 2px; }
.stub-k { font: 500 10.5px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: #7FA0A6; }
.greeting-stats { display: flex; gap: 26px; }
.greeting-stats div { text-align: left; }
.greeting-stats b { display: block; font: 700 30px/1 var(--font-display); font-stretch: 112%; color: var(--accent); }
.greeting-stats span { font-size: 12px; color: #A9C3C7; }
.notice { display: flex; gap: 10px; padding: 12px 16px; margin-bottom: 20px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); font-size: 13.5px; }
.notice .i { color: var(--accent-ink); margin-top: 2px; }

/* --------------------------------------------------------------------------
   Pantallas de acceso: la tarjeta es un ticket
   -------------------------------------------------------------------------- */
.auth-body {
  position: relative; min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; overflow-x: hidden;
  background: radial-gradient(ellipse 62% 58% at 50% 50%, color-mix(in srgb, var(--band) 11%, transparent), transparent 72%), var(--bg);
}
.auth-body > main { position: relative; z-index: 1; }
.theme-float { z-index: 2; }

/* Fondo: pistas de circuito que llegan al ticket; los pulsos son solicitudes entrando a la mesa */
.auth-circuit { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; --trace: color-mix(in srgb, var(--band) 22%, transparent); }
[data-theme="dark"] .auth-circuit { --trace: color-mix(in srgb, #9CC7CF 14%, transparent); }
.auth-circuit .tr, .auth-circuit .chip { fill: none; stroke: var(--trace); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.auth-circuit .pad { fill: var(--bg); stroke: var(--trace); stroke-width: 1.5; }
.auth-circuit .via { fill: var(--trace); }
.auth-circuit .pulse { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 4 200; stroke-dashoffset: 4; animation: trace-pulse 10s linear infinite; animation-delay: var(--d, 0s); }
.auth-circuit .pad.is-hot { animation: pad-hot 10s linear infinite; animation-delay: var(--d, 0s); }
@keyframes trace-pulse { 0% { stroke-dashoffset: 4; } 32%, 100% { stroke-dashoffset: -100; } }
@keyframes pad-hot { 0%, 30% { fill: var(--bg); stroke: var(--trace); } 33% { fill: var(--accent); stroke: var(--accent); } 50%, 100% { fill: var(--bg); stroke: var(--trace); } }

.ticket-card-wrap { width: 100%; max-width: 880px; margin: 0 auto; filter: drop-shadow(0 0 .5px rgba(19, 35, 42, .35)) drop-shadow(0 26px 44px rgba(14, 44, 52, .2)); animation: card-in .6s var(--ease) both; }
[data-theme="dark"] .ticket-card-wrap { filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .25)) drop-shadow(0 26px 44px rgba(0, 0, 0, .55)); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) rotate(-.6deg); } }
/* Forma de ticket: muescas arriba y abajo + línea de perforación con huecos reales entre talón y cuerpo */
.ticket-card {
  --x: 340px; --n: 18px;
  display: grid; grid-template-columns: var(--x) minmax(0, 1fr);
  border-radius: 20px; overflow: hidden; background: var(--surface);
  -webkit-mask:
    radial-gradient(circle var(--n) at var(--x) 0, #0000 98%, #000),
    radial-gradient(circle var(--n) at var(--x) 100%, #0000 98%, #000),
    radial-gradient(circle 3.5px, #0000 92%, #000) calc(var(--x) - 5px) 0 / 10px 15px repeat-y,
    linear-gradient(90deg, #000 calc(var(--x) - 5px), #0000 0 calc(var(--x) + 5px), #000 0);
  -webkit-mask-composite: source-in, source-in, source-over;
  mask:
    radial-gradient(circle var(--n) at var(--x) 0, #0000 98%, #000),
    radial-gradient(circle var(--n) at var(--x) 100%, #0000 98%, #000),
    radial-gradient(circle 3.5px, #0000 92%, #000) calc(var(--x) - 5px) 0 / 10px 15px repeat-y,
    linear-gradient(90deg, #000 calc(var(--x) - 5px), #0000 0 calc(var(--x) + 5px), #000 0);
  mask-composite: intersect, intersect, add;
}
.ticket-card.is-single { --x: 0px; grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; -webkit-mask: none; mask: none; }
.ticket-side {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  padding: 34px 46px 30px 34px; background: var(--band); color: #DCE8EA;
}
.ticket-side .brand { padding: 0; }
.ticket-side h1 { color: #fff; font-family: var(--font-display); font-stretch: 106%; font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; margin: 26px 0 14px; overflow-wrap: anywhere; text-wrap: balance; }
.ticket-side p { color: #A9C3C7; font-size: 14.5px; line-height: 1.6; margin: 0; }
.stub-label { position: absolute; right: 15px; top: 50%; transform: translateY(-50%) rotate(180deg); writing-mode: vertical-rl; font: 500 10px/1 var(--font-mono); letter-spacing: .3em; text-transform: uppercase; white-space: nowrap; color: rgba(220, 232, 234, .3); }
.barcode { display: block; width: 100%; height: 36px; margin-bottom: 14px; fill: rgba(220, 232, 234, .62); }
.ticket-stamp { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; font: 500 10.5px/1.6 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: #7FA0A6; }
.ticket-stamp strong { display: block; color: var(--accent); font-size: 13px; letter-spacing: 0; }
.ticket-main { padding: 40px 44px 34px; }
.ticket-main.is-wide { padding: 36px 40px; }
.ticket-main h2 { font-family: var(--font-display); font-stretch: 108%; font-weight: 700; font-size: 23px; letter-spacing: -.02em; margin-bottom: 6px; }
.ticket-main .lead { color: var(--muted); margin-bottom: 24px; }
.auth-form { display: grid; gap: 16px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.auth-foot { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-2); font-size: 13.5px; color: var(--muted); text-align: center; }
.theme-float { position: fixed; top: 14px; right: 14px; }

/* Página de error */
.error-code { font: 500 13px/1 var(--font-mono); color: var(--accent-ink); background: var(--accent-soft); display: inline-block; padding: 6px 10px; border-radius: 6px; margin-bottom: 16px; }

/* Perfil */
.profile-head { display: flex; align-items: center; gap: 16px; }
.settings-nav { position: sticky; top: 84px; display: grid; gap: 2px; }
.settings-nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 13.5px; }
.settings-nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-section { scroll-margin-top: 84px; margin-bottom: 20px; }
.settings-section .card-pad > h2 { font: 650 16px/1.3 var(--font-body); margin-bottom: 4px; }
.settings-section .card-pad > .hint { margin-bottom: 18px; }
.sla-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; background: var(--c); }

/* --------------------------------------------------------------------------
   Ticket en vivo
   -------------------------------------------------------------------------- */
.ticket-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 38px; }
.crumb-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.crumb-back:hover { color: var(--ink); text-decoration: none; }
.ticket-tools { display: flex; align-items: center; gap: 10px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px 0 9px; border-radius: 999px;
  background: var(--success-soft); color: var(--success);
  font: 650 12px/1 var(--font-body); letter-spacing: .02em;
  transition: background .3s, color .3s;
}
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: live-ring 2s var(--ease) infinite; }
@keyframes live-ring { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }
.live-pill.is-off { background: var(--surface-3); color: var(--muted); }
.live-pill.is-off .live-dot::after { animation: none; }
.viewers { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.viewers:empty { display: none; }
.viewer-stack { display: inline-flex; }
.viewer-stack .av { box-shadow: 0 0 0 2px var(--bg); animation: pop-in .35s var(--ease) both; }
.viewer-stack .av + .av { margin-left: -7px; }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }

.ticket-head h1 { font-size: 28px; margin: 12px 0 10px; }
.ticket-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meta-line strong { color: var(--ink); font-weight: 600; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* Recorrido: Recibido → Asignado → En progreso → Resuelto → Cerrado */
.journey-card { margin-bottom: 24px; padding: 20px 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.journey { --progress: 0%; position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.journey::before, .journey::after { content: ""; position: absolute; top: 12px; left: 10%; height: 3px; border-radius: 3px; }
.journey::before { right: 10%; background: var(--surface-3); }
.journey::after { width: calc(var(--progress) * .8); background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, var(--accent))); transition: width .8s var(--ease); }
.j-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 0 6px; text-align: center; }
.j-dot { display: grid; place-items: center; width: 27px; height: 27px; margin-bottom: 6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); color: #fff; transition: background .3s, border-color .3s; }
.j-step.is-done .j-dot { background: var(--brand); border-color: var(--brand); }
[data-theme="dark"] .j-step.is-done .j-dot { background: #2A8FA6; border-color: #2A8FA6; }
.j-step.is-current .j-dot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.j-step.is-current .j-dot i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: beat 1.6s var(--ease) infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(.65); } }
.j-label { font: 600 13px/1.25 var(--font-body); color: var(--ink-2); }
.j-step.is-todo .j-label { color: var(--muted); font-weight: 500; }
.j-step.is-current .j-label { color: var(--ink); font-weight: 700; }
.j-sub { max-width: 100%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.j-step.is-todo .j-sub { color: var(--faint); }
.j-step.is-current .j-sub { color: var(--accent-ink); font-weight: 500; }

/* Separadores de día y elementos nuevos */
.day-sep { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin: 4px 0; font: 650 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-sep::before { margin-left: 56px; }
.day-sep span { padding: 5px 10px; border-radius: 999px; background: var(--surface-3); }
.event.is-key .event-dot { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.is-new { animation: item-in .55s var(--ease) both; }
.msg.is-new .msg-card { animation: glow 2.4s var(--ease) both; }
@keyframes item-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes glow { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); } }

/* Indicador «escribiendo…» */
.typing { display: flex; align-items: center; gap: 10px; margin: 14px 0 0 58px; font-size: 13px; color: var(--muted); animation: item-in .3s var(--ease) both; }
.typing[hidden] { display: none; }
.typing strong { color: var(--ink-2); }
.typing-dots { display: inline-flex; gap: 4px; padding: 9px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
.typing.is-internal .typing-dots { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Caja de respuesta: barra de formato */
.composer-tabs { align-items: flex-end; }
.composer-title { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; font: 600 13px/1 var(--font-body); color: var(--ink); }
.md-tools { display: flex; gap: 2px; margin: 0 2px 6px auto; }
.composer-tabs .md-tools button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; margin: 0; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; }
.composer-tabs .md-tools button:hover { background: var(--surface-3); color: var(--ink); }
.composer-foot kbd { font: 500 10.5px/1 var(--font-mono); padding: 2px 5px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.composer.is-sending { opacity: .75; }
.composer.is-sending .btn-primary, .composer.is-sending .btn-accent { pointer-events: none; }

/* Panel lateral */
.props-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .2s; }
.save-state.is-visible { opacity: 1; }
.save-state.is-saved { color: var(--success); }
.save-state.is-error { color: var(--danger); }
.prop-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-lg { height: 46px; font-size: 14.5px; border-radius: 10px; }
.quick-actions:empty { display: none; }
.rating-box.is-invite { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }

/* Política de datos personales */
.doc-wrap { max-width: 820px; }
.ticket-card.is-doc { max-width: 820px; }
.policy-text { padding: 0; font-size: 15px; line-height: 1.7; }
.policy-text p { margin-bottom: 1em; }
.policy-text mark { padding: 0 3px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.policy-box { max-height: 280px; overflow-y: auto; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.6; }
.policy-box:focus-visible { box-shadow: var(--focus); }
.policy-link { margin: 16px 0 0; text-align: center; font-size: 12.5px; }
.policy-link a { color: var(--muted); }
.sidebar-policy { display: block; margin-top: 8px; color: var(--side-muted); font-size: 11.5px; text-decoration: none; }
.sidebar-policy:hover { color: var(--side-ink); text-decoration: underline; }

/* Solución aplicada */
/* Ticket cerrado por duplicado: aviso arriba con enlace al original */
.dup-banner { display: flex; align-items: center; gap: 14px; margin: -4px 0 18px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--st-closed); box-shadow: var(--shadow-sm); }
.dup-banner > div { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13.5px; }
.dup-banner > div span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.dup-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-3); color: var(--ink-2); flex: none; }
/* Tickets relacionados */
.link-list { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.link-list li { position: relative; display: flex; align-items: flex-start; gap: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); transition: border-color .15s; }
.link-list li:hover { border-color: var(--line-2); }
.link-list li.is-duplicate_by, .link-list li.is-duplicate_of { border-style: dashed; }
.link-item { flex: 1; min-width: 0; display: grid; gap: 6px; padding: 10px 4px 10px 12px; color: var(--ink); text-decoration: none; }
.link-item:hover { text-decoration: none; }
.link-item:hover .link-subject { color: var(--link); }
.link-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.link-top .badge { height: 20px; font-size: 11px; padding: 0 7px; margin-left: auto; }
.link-rel { font: 500 10px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.link-subject { font-size: 13px; font-weight: 550; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-remove { width: 30px; height: 30px; margin: 6px 6px 0 0; color: var(--faint); }
.link-remove:hover { color: var(--danger); background: var(--danger-soft); }
.link-form { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.link-list:empty + .link-form, .hint + .link-form { padding-top: 0; border-top: 0; }
.link-form .input, .link-form .select { min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: 13.5px; }
.link-hint { min-height: 1.4em; }
.link-form.is-duplicate .link-hint { color: var(--warning-ink); }
/* Historial: cambios seguidos plegados */
.event-group > summary { list-style: none; cursor: pointer; }
.event-group > summary::-webkit-details-marker { display: none; }
.event-group-more { margin-left: auto; color: var(--link); font-weight: 600; font-size: 12.5px; }
.event-group[open] > summary .event-group-more { display: none; }
.event-group > .event { margin-top: 14px; }
.event-group:not([open]) > summary:hover .event-group-more { text-decoration: underline; }
/* Ticket cerrado: la caja de respuesta queda plegada */
.composer-closed { margin-top: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); }
.composer-closed > summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; list-style: none; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.composer-closed > summary::-webkit-details-marker { display: none; }
.composer-closed > summary > span:nth-child(2) { flex: 1; min-width: 0; }
.composer-closed > summary strong { color: var(--ink); }
.composer-closed[open] { border-style: solid; }
.composer-closed[open] > summary .btn { display: none; }
.composer-closed .composer { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
/* Veredicto del ANS en tickets resueltos */
.sla-verdict { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.sla-verdict.is-ok { color: var(--success); }
.sla-verdict.is-over { color: var(--danger); }
.solution-box { margin-top: 18px; padding: 18px 20px; border-radius: var(--radius); background: var(--success-soft); border: 1px solid color-mix(in srgb, var(--success) 35%, transparent); scroll-margin-top: 90px; }
.solution-box.is-missing { background: var(--warning-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.solution-head { display: flex; gap: 12px; align-items: flex-start; }
.solution-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--success); color: #fff; flex: none; }
.solution-box.is-missing .solution-icon { background: var(--accent); color: #13232A; }
.solution-head h2 { font: 650 15px/1.3 var(--font-body); }
.solution-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.solution-text { padding: 12px 0 0 46px; }
.solution-edit { margin: 12px 0 0 46px; }
.solution-edit summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--link); }
.solution-edit .textarea { background: var(--surface); }

/* Diálogos */
.dialog { width: min(580px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(8, 20, 24, .5); backdrop-filter: blur(2px); }
.dialog[open] { animation: card-in .25s var(--ease) both; }
.dialog-body { padding: 22px 24px 8px; }
.dialog-body h2 { font: 700 19px/1.3 var(--font-display); font-stretch: 108%; margin-bottom: 6px; }
.dialog-body p { margin: 0 0 14px; font-size: 13.5px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; }

/* --------------------------------------------------------------------------
   Informe de gestión
   -------------------------------------------------------------------------- */
.report-controls {
  display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(140px, 1fr)) auto; gap: 12px 14px; align-items: end;
  padding: 16px 18px; margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.report-controls .field > label { font-size: 12px; color: var(--muted); }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.report-quick a { padding: 5px 11px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.report-quick a:hover { background: var(--brand-soft); color: var(--ink); text-decoration: none; }
.report-quick a.is-active { background: var(--ink); color: var(--bg); }

.report-sheet {
  max-width: 1000px; margin: 0 auto; padding: 0 0 34px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden;
}
.rs-head { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 26px 34px 24px; border-bottom: 2px dashed var(--line-2); }
.rs-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--c); }
.rs-brand { display: flex; align-items: center; gap: 10px; }
.rs-brand b { display: block; font: 700 14px/1.2 var(--font-display); font-stretch: 108%; }
.rs-brand small { display: block; font-size: 11.5px; color: var(--muted); }
.rs-title { padding-left: 22px; border-left: 1px solid var(--line); }
.rs-title h2 { margin: 6px 0 4px; font: 700 24px/1.15 var(--font-display); font-stretch: 110%; letter-spacing: -.02em; }
.rs-title p { margin: 0; color: var(--ink-2); font-weight: 500; }
.rs-contract { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.rs-contract > div { padding: 12px 34px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rs-contract > div:nth-child(3n) { border-right: 0; }
.rs-contract .rs-wide { grid-column: 1 / -1; border-right: 0; }
.rs-contract dt { font: 650 10.5px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rs-contract dd { margin: 4px 0 0; font-size: 13.5px; color: var(--ink); }
.rs-section { padding: 24px 34px 4px; }
.rs-section h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font: 650 16px/1.3 var(--font-body); }
.rs-section h3 > span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: var(--ink); font: 600 12px/1 var(--font-mono); }
.rs-section h3 small { font: 500 12px var(--font-mono); color: var(--muted); }
.rs-lead { font-size: 15px; line-height: 1.6; color: var(--ink-2); margin-bottom: 16px; }
.rs-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rs-kpis > div { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rs-kpis > div:nth-child(4n) { border-right: 0; }
.rs-kpis > div:nth-last-child(-n+4) { border-bottom: 0; }
.rs-kpis b { display: block; font: 700 24px/1.15 var(--font-display); font-stretch: 108%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rs-kpis span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.rs-kpis .is-key { background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.rs-kpis .is-key b { color: var(--success); }
.rs-note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.rs-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rs-table th { padding: 8px 10px; text-align: left; font: 650 10.5px/1.2 var(--font-body); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); border-bottom: 1.5px solid var(--line-2); }
.rs-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rs-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rs-table td b { display: block; font-weight: 600; }
.rs-table td small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.rs-detail td:nth-child(2) { width: 34%; }
.rs-solution { color: var(--ink-2); line-height: 1.5; }
.rs-ok { font-weight: 650; color: var(--success); }
.rs-bad { font-weight: 650; color: var(--danger); }
.rs-csat { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: center; }
.rs-csat-score b { display: block; font: 700 40px/1 var(--font-display); color: var(--accent-ink); }
.rs-csat-score span { font-size: 12.5px; color: var(--muted); }
.rs-csat-bars { display: grid; gap: 6px; }
.rs-csat-bars .hbar { grid-template-columns: 42px minmax(0, 1fr) 30px; }
.rs-star { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rs-comments { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rs-comments li { padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13.5px; }
.rs-comments small { color: var(--muted); }
.rs-notes { min-height: 90px; padding: 12px 14px; border: 1.5px dashed var(--line-2); border-radius: 10px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; outline: none; }
.rs-notes:focus { border-color: var(--brand); background: var(--surface-2); }
.rs-notes:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rs-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 60px; padding: 56px 34px 0; }
.rs-sign > div { text-align: center; }
.rs-line { display: block; height: 1px; margin-bottom: 8px; background: var(--ink); opacity: .55; }
.rs-sign b { display: block; font-size: 14px; }
.rs-sign small { font-size: 12px; color: var(--muted); }

/* Barra de progreso al cambiar de página */
.nav-progress {
  position: fixed; z-index: 300; top: 0; left: 0;
  width: 0; height: 3px; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), #FFD27A);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 0 3px 3px 0;
  transition: width .3s var(--ease), opacity .2s;
}
.nav-progress.is-start { opacity: 1; width: 35%; }
.nav-progress.is-slow { width: 88%; transition: width 8s cubic-bezier(.1, .6, .2, 1), opacity .2s; }

/* --------------------------------------------------------------------------
   Proyectos
   -------------------------------------------------------------------------- */
[hidden] { display: none !important; }
.proj {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px 0 7px; border-radius: 6px;
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .02em; white-space: nowrap;
  color: var(--ink); background: color-mix(in srgb, var(--c, var(--brand)) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c, var(--brand)) 35%, transparent);
}
.proj::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--brand)); }
.proj-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.project-fixed { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); }

.project-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.project-switch a { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px; font: 600 12.5px/1 var(--font-mono); color: var(--muted); text-decoration: none; }
.project-switch a i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.project-switch a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.project-switch a.is-active { background: var(--ink); color: var(--bg); }
.project-switch a:first-child { font-family: var(--font-body); }

.nav-project .nav-dot { width: 9px; height: 9px; margin: 0 4px; border-radius: 3px; background: var(--c); flex: none; }
.nav-project span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-code { margin-left: auto; font: 500 10.5px/1 var(--font-mono); color: var(--side-muted); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 20px 20px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.project-card::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--c); }
.project-card:hover { text-decoration: none; border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card.is-archived { opacity: .65; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-code { display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 8px; font: 600 14px/1 var(--font-mono); letter-spacing: .02em; color: var(--ink); background: color-mix(in srgb, var(--c) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.project-code-lg { height: 52px; padding: 0 16px; font-size: 20px; border-radius: 12px; }
.project-name { font: 700 18px/1.25 var(--font-display); font-stretch: 108%; letter-spacing: -.01em; }
.project-desc { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.project-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 11.5px; color: var(--muted); }
.project-stats b { display: block; font: 700 18px/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.project-foot { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }

.project-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.project-picker input { position: absolute; opacity: 0; pointer-events: none; }
.project-picker label { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 500; transition: border-color .15s, background .15s, box-shadow .15s; }
.project-picker label:hover { border-color: var(--faint); }
.project-picker input:checked + label { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c); }
.project-picker input:focus-visible + label { box-shadow: var(--focus); }

.project-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.project-check { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.project-check:hover { border-color: var(--faint); }
.project-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.project-check:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.project-check.is-archived { opacity: .7; }
.project-check small { color: var(--muted); }

.pick-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pick-search { position: relative; padding: 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pick-search .i { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pick-search .input { padding-left: 32px; }
.pick-items { max-height: 340px; overflow-y: auto; }
.pick-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-item:has(input:checked) { background: var(--brand-soft); }
.pick-item input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.pick-main { min-width: 0; }
.pick-main b { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-main small, .pick-meta small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }

.member-group { padding: 14px 20px 6px; font: 650 11px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 20px; border-top: 1px solid var(--line); }
.member-row.is-inactive { opacity: .6; }
.member-row form { margin-left: auto; }

/* --------------------------------------------------------------------------
   Adaptación a pantallas pequeñas
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .tlist-head, .trow { grid-template-columns: 34px 104px minmax(0, 1fr) 120px 112px 110px; }
  .tlist.no-select .tlist-head, .tlist.no-select .trow { grid-template-columns: 104px minmax(0, 1fr) 120px 112px 110px; }
  .t-col-assignee span { display: none; }
  .col-prio { display: none !important; }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .nav-open .topbar { z-index: 0; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 20, 24, .45); }
  .topbar .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 22px 16px 56px; }
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-aside { order: -1; }
  .stub-wrap { position: static; }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
  .queues { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue:nth-child(2) { border-right: 0; }
  .queue:nth-child(-n+2) { border-bottom: 1px dashed var(--line-2); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .qitem { grid-template-columns: auto minmax(0, 1fr); padding: 11px 16px; }
  .qitem > :last-child:not(.qitem-main) { grid-column: 2; justify-self: start; text-align: left !important; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .qitem > :last-child .due { margin-top: 0 !important; }
  .search kbd, .hide-sm { display: none !important; }
  .topbar .search { display: none; }
  .topbar .search-mobile { display: inline-grid; }
  .page-head h1 { font-size: 23px; }
  .tlist-head { display: none; }
  .trow, .tlist.no-select .trow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px 14px 12px 16px; }
  .trow .row-check { display: none; }
  .trow .t-main { grid-column: 1 / -1; }
  .trow .t-stub { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; margin: 0; padding: 0; }
  .trow .t-stub::before, .trow .t-stub::after { display: none; }
  .trow .t-col-status { grid-column: 1; grid-row: 3; }
  .trow .t-col-assignee { display: none; }
  .trow .t-col-time { grid-column: 2; grid-row: 3; }
  .form-grid { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sla-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .greeting { grid-template-columns: 1fr; -webkit-mask: none; mask: none; background-position: right -120px center; }
  .greeting-main { padding: 22px 22px 18px; }
  .greeting h1 { font-size: 25px; }
  .greeting-stub { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 14px 22px; border-top: 2px dashed rgba(255, 255, 255, .14); }
  .greeting-stub .barcode { display: none; }
  .notif-menu { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .ticket-card { --x: 0px; grid-template-columns: 1fr; -webkit-mask: none; mask: none; }
  .ticket-side { padding: 26px 24px 22px; gap: 14px; }
  .ticket-side::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: -1px; border-bottom: 2px dashed rgba(255, 255, 255, .22); }
  .ticket-side h1 { font-size: 24px; margin: 16px 0 8px; }
  .ticket-side p, .stub-foot, .stub-label { display: none; }
  .ticket-main, .ticket-main.is-wide { padding: 26px 22px; }
  .msg { grid-template-columns: 1fr; }
  .msg > .av { display: none; }
  .timeline::before { display: none; }
  .event { grid-template-columns: 1fr; }
  .event-dot { display: none; }
  .metrics { grid-template-columns: 1fr; }
  .metric:nth-child(odd) { border-right: 0; }
  .composer-foot .select { width: 100%; }
  .ticket-head h1 { font-size: 23px; }
  .report-controls { grid-template-columns: 1fr 1fr; }
  .report-controls > .field:first-child, .report-actions { grid-column: 1 / -1; }
  .rs-head { grid-template-columns: 1fr; padding: 22px 18px; }
  .rs-title { padding-left: 0; border-left: 0; }
  .rs-contract { grid-template-columns: 1fr; }
  .rs-contract > div { padding: 10px 18px; border-right: 0; }
  .rs-section { padding: 20px 18px 4px; }
  .rs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-kpis > div:nth-child(2n) { border-right: 0; }
  .rs-two, .rs-csat, .rs-sign { grid-template-columns: 1fr; }
  .rs-detail { display: block; overflow-x: auto; }
  .journey-card { padding: 16px 4px 14px; }
  .j-label { font-size: 11.5px; }
  .j-sub { display: none; }
  .j-step.is-current .j-sub { display: block; font-size: 11px; }
  .day-sep::before { margin-left: 0; }
  .typing { margin-left: 0; }
  .live-pill { padding: 0 9px; }
  .md-tools { display: none; }
}
@media (max-width: 460px) {
  .queues { grid-template-columns: 1fr 1fr; }
  .queue { padding: 14px; }
  .queue-num { font-size: 28px; }
  .topbar .btn-new span { display: none; }
  .topbar .btn-new { width: 38px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  @page { size: A4; margin: 12mm 11mm; }
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff; --surface: #fff; --surface-2: #F7F9F8; --surface-3: #EFF3F2;
    --ink: #13232A; --ink-2: #3D5057; --muted: #5E6F75; --faint: #97A5AA; --line: #DFE5E3; --line-2: #CAD4D1;
    --brand: #0F4C5C; --brand-soft: #E1EDEF; --link: #0F5F72; --success: #1B7A4C; --danger: #BF3530;
    --accent-ink: #7A4A00; --accent-soft: #FFF3DC; --series-1: #2A78D6; --series-2: #1BAF7A;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .topbar, .composer, .quick-actions, .toasts, .page-actions, .ticket-tools, .typing, .no-print, .nav-progress, .crumbs { display: none !important; }
  .shell { display: block; }
  body { background: #fff; font-size: 12px; }
  .content { max-width: none; padding: 0; }
  .report-sheet { max-width: none; border: 0; border-radius: 0; box-shadow: none; padding-bottom: 0; }
  .rs-head, .rs-kpis, .rs-csat, .rs-sign, .rs-table tr, .rs-comments li { break-inside: avoid; }
  .rs-section h3 { break-after: avoid; }
  .rs-section:has(.rs-notes:empty) { display: none; }
  .rs-notes { border: 0; padding: 0; min-height: 0; }
  .rs-sign { padding-top: 54px; }
  .chart svg { max-height: 190px; }
}

/* --------------------------------------------------------------------------
   Importar tickets desde otra plataforma
   -------------------------------------------------------------------------- */
.tag-migrated { gap: 4px; background: color-mix(in srgb, var(--st-in_progress) 12%, var(--surface)); color: color-mix(in srgb, var(--st-in_progress) 80%, var(--ink)); }
.import-steps { display: flex; gap: 0; margin: 0 0 20px; padding: 0; list-style: none; flex-wrap: wrap; }
.import-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 0; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.import-steps li + li::before { content: ""; width: 28px; height: 2px; margin-right: 8px; background: var(--line-2); }
.import-steps b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); font: 600 12px/1 var(--font-mono); color: var(--muted); }
.import-steps .is-current { color: var(--ink); }
.import-steps .is-current b { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.import-steps .is-done b { border-color: var(--success); background: var(--success); color: #fff; }
.import-drop { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.import-drop:hover, .import-drop.has-file { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.import-drop span { display: grid; gap: 3px; }
.import-drop strong { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.import-drop small { font-size: 12.5px; color: var(--muted); }
.import-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-tips { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--ink-2); }
.import-tips li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.import-tips .i { color: var(--success); margin-top: 3px; }
.map-list { display: grid; margin-top: 12px; }
.map-row { display: grid; grid-template-columns: 190px minmax(0, 220px) minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 20px; border-top: 1px solid var(--line); }
.map-row label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.map-row .req { color: var(--danger); }
.map-row.is-empty label { color: var(--muted); font-weight: 500; }
.map-sample { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.translate-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.translate-list li { display: grid; grid-template-columns: minmax(0, 1fr) 14px auto 36px; align-items: center; gap: 8px; font-size: 13px; }
.translate-list .i { color: var(--faint); }
.translate-from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-family: var(--font-mono); font-size: 12px; }
.translate-list small { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.import-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 20px -28px -64px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.import-log { display: grid; margin: 12px 0 0; padding: 0; list-style: none; max-height: 520px; overflow-y: auto; }
.import-log li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.import-line { font: 500 11px/1 var(--font-mono); color: var(--muted); min-width: 58px; }
@media (max-width: 760px) {
  .map-row { grid-template-columns: 1fr; gap: 6px; padding: 12px 16px; }
  .import-actions { margin: 20px -16px -48px; padding: 12px 16px; }
  .import-steps li { padding-right: 10px; }
  .import-steps li + li::before { width: 14px; }
}

/* --------------------------------------------------------------------------
   Horas extras, descansos y vacaciones
   -------------------------------------------------------------------------- */
.to-tabs { margin-bottom: 18px; }
.to-tabs a .i { opacity: .8; }
.to-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font: 600 11px/1 var(--font-mono); }
.section-title .to-count { margin-left: 4px; vertical-align: 1px; }

.rule-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line-2); font-size: 13px; color: var(--ink-2); }
.rule-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ink); margin-right: 4px; }
.rule-title .i { color: var(--accent-ink); }
.rule-item { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-3); }
.rule-item b, .tag-x15, .tag-x2 { font-family: var(--font-mono); font-weight: 600; letter-spacing: -.02em; }
.rule-item b { display: inline-grid; place-items: center; min-width: 38px; height: 22px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; }
.is-x15, .tag-x15 { background: var(--accent-soft); color: var(--accent-ink); }
.is-x2, .tag-x2 { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: color-mix(in srgb, var(--danger) 85%, var(--ink)); }
.tag-holiday { background: var(--brand-soft); color: var(--brand); }
:root[data-theme="dark"] .tag-holiday { color: var(--link); }

.to-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 14px; align-items: end; padding: 16px 18px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.to-filters .field > label { font-size: 12px; color: var(--muted); }
.to-filters-inline { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 12px 20px 4px; padding: 0; border: 0; background: none; }

.to-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.to-kpi { display: grid; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.to-kpi-label { font-size: 12.5px; color: var(--muted); }
.to-kpi-value { font: 700 26px/1.15 var(--font-display); font-stretch: 106%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.to-kpi-value.is-accent { color: var(--brand); }
:root[data-theme="dark"] .to-kpi-value.is-accent { color: var(--link); }
.to-kpi-period { font-size: 17px; line-height: 1.3; }
.to-kpi-sub { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }

.to-table td { vertical-align: top; }
.to-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.to-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.to-ticket { min-width: 220px; max-width: 380px; }
.to-ticket .code { margin-right: 6px; }
.to-subject { color: var(--ink); }
.to-desc { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.to-pos { color: var(--success); }

/* Panel del ticket */
.ot-list { display: grid; gap: 0; margin: 0 0 6px; padding: 0; list-style: none; }
.ot-list li { display: flex; align-items: flex-start; gap: 9px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ot-list li:first-child { padding-top: 0; }
.ot-list li form { margin-left: auto; }
.ot-main { display: grid; gap: 3px; min-width: 0; flex: 1; font-size: 12.5px; }
.ot-when { font-weight: 600; color: var(--ink); font-size: 13px; }
.ot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--ink-2); }
.ot-meta .tag { height: 19px; font-size: 11px; }
.ot-desc { color: var(--muted); overflow-wrap: anywhere; }
.ot-add summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--link); list-style: none; padding: 4px 0; }
.ot-add summary::-webkit-details-marker { display: none; }
.ot-add[open] summary { margin-bottom: 10px; }
.ot-form { display: grid; gap: 10px; }
.ot-form .field > label { font-size: 12px; color: var(--muted); }
.ot-preview { margin: 0; padding: 9px 11px; border-radius: var(--radius-sm); background: var(--surface-3); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.ot-preview strong { color: var(--ink); }
.ot-preview.is-ok { background: var(--success-soft); }
.ot-preview.is-bad { background: var(--danger-soft); color: var(--ink); }

/* Solicitudes */
.lv-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 999px; font: 600 11.5px/1 var(--font-body); white-space: nowrap; color: var(--ink); background: color-mix(in srgb, var(--lv) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--lv) 30%, transparent); }
.lv-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--lv); }
.lv-pending { --lv: var(--st-on_hold); }
.lv-approved { --lv: var(--st-resolved); }
.lv-rejected { --lv: var(--danger); }
.lv-cancelled { --lv: var(--st-closed); }

.to-decide { margin-bottom: 22px; }
.to-decide .section-title { display: flex; align-items: center; gap: 7px; }
.to-decide .section-title .i { color: var(--st-on_hold); }
.to-decide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.to-request { padding: 16px 18px; display: grid; gap: 10px; align-content: start; border-left: 3px solid var(--st-on_hold); scroll-margin-top: 90px; }
.to-request:target { box-shadow: var(--focus); }
.to-request-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.to-request-when strong { display: block; font: 650 16px/1.3 var(--font-display); font-stretch: 104%; }
.to-request-when span { font-size: 13px; color: var(--ink-2); }
.to-request-note { display: flex; gap: 7px; margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.to-request-note .i { flex: none; margin-top: 2px; color: var(--muted); }
.to-reason { margin: 0; padding: 9px 12px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; color: var(--ink-2); }
.to-decide-form { display: grid; gap: 8px; }
.to-decide-form .textarea { min-height: 60px; }
.to-decide-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.to-history { margin: 8px 0 0; padding: 0; list-style: none; }
.to-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); scroll-margin-top: 90px; transition: background .4s; }
.to-row:target { background: var(--accent-soft); }
.to-row-main { display: grid; gap: 4px; min-width: 0; flex: 1; }
.to-row-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.to-row-when { font-size: 14.5px; color: var(--ink); }
.to-row-meta { font-size: 12.5px; color: var(--muted); }
.to-row-reason { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.to-row-decision { display: flex; gap: 6px; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.to-row-decision .i { flex: none; margin-top: 2px; }
.to-row.is-approved .to-row-decision .i { color: var(--success); }
.to-row.is-rejected .to-row-decision .i { color: var(--danger); }
.to-row.is-cancelled .to-row-when, .to-row.is-rejected .to-row-when { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }

.to-form { scroll-margin-top: 90px; }
.to-form:target { box-shadow: var(--focus); }
.to-balance { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--ink-2); font-size: 13px; }
.to-balance strong { font: 700 20px/1 var(--font-display); color: var(--brand); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .to-balance strong { color: var(--link); }
.to-summary { margin: 0; font-size: 13px; color: var(--ink-2); min-height: 1.2em; }
.to-summary:empty { display: none; }
.to-summary.is-bad { color: var(--danger); font-weight: 550; }
.to-approver-hint { display: flex; gap: 6px; margin: 12px 0 0; color: var(--warning-ink); }
.to-approver-hint[hidden] { display: none; }
.to-approver-hint .i { flex: none; margin-top: 1px; }

.to-upcoming { margin: 10px 0 6px; padding: 0; list-style: none; }
.to-upcoming li { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); }
.to-upcoming li .tag { margin-left: auto; }
.to-cal { display: grid; place-items: center; flex: none; width: 42px; height: 44px; border-radius: 9px; background: var(--surface-3); border-top: 3px solid var(--accent); line-height: 1; }
.to-cal b { font: 700 16px/1 var(--font-display); }
.to-cal small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.to-info h3 { display: flex; align-items: center; gap: 7px; font: 650 14px/1.3 var(--font-body); margin-bottom: 8px; }
.to-info ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 5px; }

.member-row .approver-form + form { margin-left: 0; }
.member-note { margin: 0; padding: 0 20px 8px; font-size: 12.5px; color: var(--muted); }
.approver-toggle { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--line-2); background: transparent; color: var(--muted); font: 600 12px/1 var(--font-body); cursor: pointer; white-space: nowrap; }
.approver-toggle:hover { border-color: var(--brand); color: var(--ink); }
.approver-toggle.is-on { border-style: solid; border-color: transparent; background: var(--success-soft); color: var(--success); }
.approver-toggle:focus-visible { outline: none; box-shadow: var(--focus); }

@media (max-width: 760px) {
  .to-kpis { grid-template-columns: 1fr; }
  .to-decide-list { grid-template-columns: 1fr; }
  .to-row { padding: 12px 16px; flex-wrap: wrap; }
  .to-filters-inline { margin: 12px 16px 4px; }
  .rule-strip { padding: 12px; }
}

/* Registrar horas extras desde el módulo */
.to-register { margin-bottom: 18px; scroll-margin-top: 90px; }
.to-register > summary { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; padding: 16px 20px; cursor: pointer; list-style: none; }
.to-register > summary::-webkit-details-marker { display: none; }
.to-register > summary .muted { font-size: 12.5px; }
.to-register-title { display: inline-flex; align-items: center; gap: 7px; font: 650 15px/1.3 var(--font-body); color: var(--link); }
.to-register[open] > summary { border-bottom: 1px solid var(--line); }
.to-register-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; padding: 16px 20px 20px; align-items: end; }
.to-register-form .field > label { font-size: 12px; color: var(--muted); }
.to-reg-ticket { grid-column: span 3; }
.to-reg-desc { grid-column: span 2; }
.to-reg-preview { grid-column: 1 / -1; }
.to-reg-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
@media (max-width: 900px) { .to-register-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .to-reg-ticket, .to-reg-desc { grid-column: 1 / -1; } }

/* --------------------------------------------------------------------------
   Listas desplegables con diseño propio (reemplazan la lista del navegador)
   -------------------------------------------------------------------------- */
.xs { position: relative; width: 100%; min-width: 0; }
.xs.hidden { display: none; }
.xs .xs-native.select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; border: 0; }
.xs-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.xs-btn:disabled { cursor: not-allowed; opacity: .6; }
.xs-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xs-btn.is-placeholder .xs-val { color: var(--muted); }
.xs.is-open .xs-btn { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.xs.is-invalid .xs-btn { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.period .xs, .composer-foot .xs, .bulkbar .xs { width: auto; }
.period .xs .xs-btn { min-width: 104px; }

.xs-pop {
  position: fixed; z-index: 300; display: flex; flex-direction: column;
  padding: 6px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: xs-in .14s var(--ease) both; transform-origin: top center;
}
.xs-pop.is-up { transform-origin: bottom center; }
.xs-pop[hidden] { display: none; }
@keyframes xs-in { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
.xs-pop.is-up { animation-name: xs-in-up; }
@keyframes xs-in-up { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }

.xs-search { position: relative; flex: none; margin-bottom: 6px; }
.xs-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.xs-search input {
  width: 100%; height: 36px; padding: 0 10px 0 32px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface-2); color: var(--ink); font: 400 13.5px/1 var(--font-body);
}
.xs-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
.xs-search input::-webkit-search-cancel-button { display: none; }

.xs-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.xs-group { padding: 10px 10px 4px; font: 650 10.5px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.xs-group:first-child { padding-top: 4px; }
.xs-opt {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 10px;
  border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--ink); cursor: pointer;
  transition: background-color .08s;
}
.xs-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.xs-tick { flex: none; color: var(--brand); opacity: 0; }
:root[data-theme="dark"] .xs-tick { color: var(--link); }
.xs-opt.is-active { background: var(--surface-3); }
.xs-opt[aria-selected="true"] { font-weight: 600; }
.xs-opt[aria-selected="true"] .xs-tick { opacity: 1; }
.xs-opt[aria-disabled="true"] { opacity: .4; cursor: default; }
.xs-opt.is-empty-value .xs-text { color: var(--muted); }
.xs-none { padding: 14px 10px; text-align: center; font-size: 13px; color: var(--muted); }
.xs-suggest .xs-text { display: grid; gap: 1px; }
.xs-suggest b { font-weight: 600; font-family: var(--font-mono); font-size: 12.5px; }
.xs-suggest small { font-size: 12.5px; color: var(--muted); }
.xs-suggest small:empty { display: none; }

/* Barra oscura de acciones masivas: el botón conserva su estilo claro sobre fondo oscuro */
.bulkbar .xs-btn { min-height: 34px; }

/* --------------------------------------------------------------------------
   Retoques generales
   -------------------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
.sidebar ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, .14); }

/* Campos de fecha y hora: ícono con el color de la plataforma */
.input[type="date"], .input[type="time"], .input[type="datetime-local"] { cursor: pointer; }
.input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; border-radius: 4px; padding: 2px; transition: opacity .15s, background-color .15s; }
.input::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--surface-3); }
:root[data-theme="dark"] .input::-webkit-calendar-picker-indicator { filter: invert(.85); }
.input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.input::-webkit-datetime-edit-text { color: var(--muted); padding: 0 1px; }

/* Casillas y opciones con el estilo de la plataforma */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center;
  width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 5px; background: var(--surface);
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
input[type="checkbox"]::before {
  content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform .12s var(--ease);
  background: var(--brand-ink);
  clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 22%, 86% 8%, 39% 70%);
}
input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"]:checked::before { transform: scale(1); }
input[type="checkbox"]:indeterminate { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"]:indeterminate::before { transform: scale(1); clip-path: inset(40% 10% 40% 10%); }
input[type="checkbox"]:hover { border-color: var(--brand); }
input[type="checkbox"]:focus-visible { outline: none; box-shadow: var(--focus); }
.check input[type="radio"] {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center;
  width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 50%; background: var(--surface);
}
.check input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); transform: scale(0); transition: transform .12s var(--ease); }
.check input[type="radio"]:checked { border-color: var(--brand); }
.check input[type="radio"]:checked::before { transform: scale(1); }
.check input[type="radio"]:focus-visible { outline: none; box-shadow: var(--focus); }

@media (prefers-reduced-motion: reduce) {
  .xs-pop { animation: none; }
}

/* --------------------------------------------------------------------------
   Calendario y selector de hora propios
   -------------------------------------------------------------------------- */
.xd { position: relative; width: 100%; min-width: 0; }
.xd.hidden { display: none; }
.xd .xd-native.input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; pointer-events: none; border: 0; }
.xd-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.xd-btn:disabled { cursor: not-allowed; opacity: .6; }
.xd-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.xd-btn.is-placeholder .xd-val { color: var(--faint); }
.xd-ico { flex: none; color: var(--muted); }
.xd-btn:hover .xd-ico { color: var(--ink-2); }
.xd.is-open .xd-btn { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.xd.is-open .xd-ico { color: var(--brand); }
.xd.is-invalid .xd-btn { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.xd-pop { padding: 12px; overflow: visible; }
.xd-body.is-dual { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 14px; }
.xd-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.xd-nav { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; }
.xd-nav:hover { background: var(--surface-3); color: var(--ink); }
.xd-title { border: 0; background: transparent; padding: 5px 10px; border-radius: 8px; font: 650 14px/1.2 var(--font-body); color: var(--ink); cursor: pointer; text-transform: capitalize; }
.xd-title:hover { background: var(--surface-3); }
.xd-title.is-static { cursor: default; }
.xd-title.is-static:hover { background: transparent; }
.xd-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.xd-wd { display: grid; place-items: center; height: 26px; font: 600 11px/1 var(--font-body); color: var(--faint); letter-spacing: .04em; }
.xd-day {
  position: relative; display: grid; place-items: center; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font: 500 13px/1 var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color .08s, color .08s;
}
.xd-day:hover { background: var(--surface-3); }
.xd-day.is-weekend { color: var(--ink-2); }
.xd-day.is-other { color: var(--faint); }
.xd-day.is-holiday { color: var(--danger); }
.xd-day.is-holiday::after { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--danger); }
.xd-day.is-today { box-shadow: inset 0 0 0 1.5px var(--line-2); font-weight: 700; }
.xd-day.is-selected, .xd-day.is-selected:hover { background: var(--brand); color: var(--brand-ink); font-weight: 650; box-shadow: none; }
.xd-day.is-selected::after { background: var(--brand-ink); }
.xd-day.is-disabled { color: var(--faint); opacity: .45; cursor: not-allowed; background: transparent; text-decoration: line-through; text-decoration-color: var(--line-2); }
.xd-day:focus-visible, .xd-cell:focus-visible, .xd-month:focus-visible, .xd-nav:focus-visible, .xd-title:focus-visible, .xd-link:focus-visible { outline: none; box-shadow: var(--focus); }
.xd-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px 0; }
.xd-month { height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 500 13.5px/1 var(--font-body); text-transform: capitalize; cursor: pointer; }
.xd-month:hover { background: var(--surface-3); }
.xd-month.is-selected { background: var(--brand); color: var(--brand-ink); font-weight: 650; }

.xd-timebox { display: flex; flex-direction: column; min-width: 0; }
.xd-time-title { font: 650 14px/30px var(--font-body); margin-bottom: 8px; padding-left: 4px; }
.xd-time { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; height: 248px; }
.xd-col { overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); }
.xd-col::-webkit-scrollbar { display: none; }
.xd-cell { flex: none; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font: 500 13px/1 var(--font-body); font-variant-numeric: tabular-nums; cursor: pointer; }
.xd-cell:hover { background: var(--surface-3); }
.xd-cell.is-selected { background: var(--brand); color: var(--brand-ink); font-weight: 650; }
.xd-ap .xd-cell { font-size: 12px; }

.xd-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.xd-spacer { flex: 1; }
.xd-link { border: 0; background: transparent; padding: 6px 8px; border-radius: 7px; font: 600 12.5px/1 var(--font-body); color: var(--link); cursor: pointer; }
.xd-link:hover { background: var(--surface-3); }
.xd-link[data-act="clear"] { color: var(--muted); }

@media (max-width: 520px) {
  .xd-body.is-dual { grid-template-columns: 1fr; }
  .xd-time { height: 180px; }
}

/* Resumen mensual de horas extras */
.sm-filters { grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); }
.sm-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sm-totals > div { display: grid; gap: 4px; padding: 16px 20px; border-left: 1px solid var(--line); }
.sm-totals > div:first-child { border-left: 0; }
.sm-totals span { font-size: 12.5px; color: var(--muted); }
.sm-totals strong { font: 700 24px/1.1 var(--font-display); font-stretch: 106%; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sm-totals small { font-size: 12px; color: var(--ink-2); }
.sm-totals .is-key strong { color: var(--brand); }
:root[data-theme="dark"] .sm-totals .is-key strong { color: var(--link); }

.sm-card { padding-top: 4px; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 12px 20px 10px; font-size: 12.5px; color: var(--ink-2); }
.sm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sm-dot { width: 8px; height: 8px; border-radius: 2px; }
.sm-dot.is-earned { background: var(--brand); }
.sm-dot.is-rested { background: var(--accent); }
.sm-wrap { border-top: 1px solid var(--line); }
.sm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.sm-table th, .sm-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: top; }
.sm-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font: 600 11px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 12px; padding-bottom: 12px; }
.sm-table thead th.is-now { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.sm-table .sm-who { position: sticky; left: 0; z-index: 2; text-align: left; min-width: 170px; padding-left: 20px; background: var(--surface); }
.sm-table thead .sm-who { z-index: 3; background: var(--surface-2); }
.sm-table tbody tr:hover td, .sm-table tbody tr:hover .sm-who { background: var(--surface-2); }
.sm-cell { min-width: 52px; }
.sm-cell.is-now { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.sm-cell.is-future .sm-zero { opacity: .35; }
.sm-cell > span { display: block; line-height: 1.35; }
.sm-earned { font-weight: 650; color: var(--brand); }
:root[data-theme="dark"] .sm-earned { color: var(--link); }
.sm-rested { font-weight: 600; color: var(--accent-ink); }
.sm-worked { font-size: 11px; color: var(--faint); }
.sm-zero { color: var(--faint); }
.sm-sum { min-width: 74px; border-left: 1px solid var(--line); }
.sm-table td.sm-sum + td.sm-sum, .sm-table th.sm-sum + th.sm-sum { border-left: 0; }
.sm-sum.is-key strong { font-size: 14px; }
.sm-sum.is-key small { display: block; font-size: 11px; color: var(--muted); }
.sm-table td:last-child, .sm-table th:last-child { padding-right: 20px; }
.sm-table tfoot th, .sm-table tfoot td { background: var(--surface-2); border-bottom: 0; font-weight: 650; }
.sm-table tfoot .sm-who { background: var(--surface-2); font-size: 12.5px; }
.sm-note { margin: 0; padding: 12px 20px 16px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 900px) {
  .sm-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm-totals > div:nth-child(3) { border-left: 0; }
  .sm-totals > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .sm-table .sm-who { min-width: 150px; padding-left: 14px; }
}
.sm-table thead th.sm-sum { white-space: normal; line-height: 1.25; vertical-align: bottom; }

/* ==========================================================================
   Refinamiento visual: más sobrio y profesional
   - Sin el motivo de «talón» (muescas, perforaciones, códigos de barras, circuitos).
   - Títulos en ancho normal, monoespaciada del sistema solo para códigos.
   - Fondos planos, bordes finos, color de marca reservado para lo importante.
   ========================================================================== */
:root {
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 40, 48, .04), 0 2px 8px rgba(15, 40, 48, .04);
}
:root[data-theme="dark"] { --shadow: 0 1px 2px rgba(0, 0, 0, .3); }
* { font-stretch: 100% !important; }
body { background: var(--bg); }

/* Títulos */
.page-head h1 { font-size: 24px; font-weight: 650; letter-spacing: -.015em; }
.page-head p { font-size: 14px; }
.section-title, .card-head h2 { font-weight: 620; letter-spacing: -.005em; }
.eyebrow { letter-spacing: .06em; font-weight: 600; }

/* Menú lateral: encabezado sin perforación */
.sidebar .brand { padding-bottom: 18px; margin-bottom: 12px; border-bottom: 1px solid var(--side-line); }
.sidebar .brand::before, .sidebar .brand::after { display: none; }
.brand-mark { border-radius: 8px; }
.nav-title { letter-spacing: .07em; }
.nav-code, .nav-count { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-weight: 600; }
.sidebar-foot kbd { font-family: var(--font-body); }

/* Código del ticket: etiqueta neutra, sin muescas */
.code {
  -webkit-mask: none; mask: none;
  height: 20px; padding: 0 7px; border-radius: 5px;
  font: 600 11.5px/1 var(--font-mono); letter-spacing: 0;
  color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line);
}
a.code:hover { color: var(--ink); border-color: var(--line-2); filter: none; }
.views .n, .history-filter button span { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-weight: 600; }

/* Lista de tickets: sin perforación entre código y asunto */
.t-stub::before, .t-stub::after { display: none; }
.t-code { font: 600 12px/1 var(--font-mono); color: var(--ink-2); }
.t-code::before { width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; }
.t-opened { font: 400 12px/1 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.tlist-head, .table th, .prop > .label, .prop > label { letter-spacing: .05em; }

/* Panel del equipo: encabezado claro en lugar del banner oscuro */
.greeting {
  -webkit-mask: none; mask: none;
  display: block; margin-bottom: 20px; padding: 0; border-radius: 0;
  background: none; color: var(--ink);
}
.greeting-main { padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: end; }
.greeting-main > :not(.project-switch):not(.project-fixed):not(.btn) { grid-column: 1; }
.greeting-date { font: 500 13px/1.4 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--muted); }
.greeting-date::first-letter { text-transform: uppercase; }
.greeting h1 { margin-top: 2px; color: var(--ink); font-size: 26px; font-weight: 650; letter-spacing: -.015em; }
.greeting p { margin: 6px 0 0; color: var(--muted); }
.greeting .project-switch { grid-column: 2; grid-row: 1 / span 3; align-self: end; margin-top: 0; background: var(--surface); border-color: var(--line); }
.greeting .project-switch a { color: var(--ink-2); }
.greeting .project-switch a:hover { color: var(--ink); background: var(--surface-3); }
.greeting .project-switch a.is-active { background: var(--ink); color: var(--bg); }
.greeting .project-fixed { grid-column: 2; grid-row: 1 / span 3; align-self: end; margin-top: 0; color: var(--ink-2); }
.greeting .btn { grid-column: 2; grid-row: 1 / span 3; align-self: end; margin-top: 0 !important; }
.greeting-stub {
  grid-column: 1 / -1; display: flex; flex-direction: row; align-items: center; gap: 28px;
  margin-top: 18px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.greeting-stats { gap: 36px; }
.greeting-stats b { font-size: 26px; font-weight: 700; color: var(--ink); }
.greeting-stats span { color: var(--muted); font-size: 13px; }
.greeting-stub .barcode, .greeting-stub .stub-k { display: none; }
@media (max-width: 760px) {
  .greeting-main { grid-template-columns: 1fr; }
  .greeting .project-switch, .greeting .project-fixed, .greeting .btn { grid-column: 1; grid-row: auto; margin-top: 14px !important; justify-self: start; }
}

/* Indicadores del panel: tarjetas separadas, sin perforaciones */
.queues-wrap { filter: none; }
[data-theme="dark"] .queues-wrap { filter: none; }
.queues { -webkit-mask: none !important; mask: none !important; gap: 12px; background: none; border-radius: 0; overflow: visible; }
.queue, .queues .queue { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.queue:hover { background: var(--surface); border-color: var(--line-2); }
.queue-num { font-size: 30px; font-weight: 700; }
.metrics-scope { font: 500 12.5px/1.4 var(--font-body); letter-spacing: 0; text-transform: none; }
.metrics-head h2 { font-size: 17px; font-weight: 650; }

/* Ticket: el talón pasa a ser una tarjeta de detalles normal */
.stub-wrap, [data-theme="dark"] .stub-wrap { filter: none; }
.stub { -webkit-mask: none; mask: none; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.stub-top { height: auto; gap: 12px; padding: 16px 20px; background: var(--surface-2); color: var(--ink); border-bottom: 1px solid var(--line); }
.stub-top .eyebrow { color: var(--muted); font-family: var(--font-body); font-weight: 600; letter-spacing: .06em; }
.stub-code { font: 650 17px/1 var(--font-mono); letter-spacing: 0; color: var(--ink); margin-top: 6px !important; }
.stub-row { padding-bottom: 0; }
.stub-top .due-ok { color: var(--muted); }
.stub-top .due-soon { color: var(--warning-ink); }
.stub-top .due-over { color: var(--danger); }
.stub-body { padding: 16px 20px 20px; }

/* Historial: línea continua y discreta */
.timeline::before { background: var(--line); width: 1px; left: 21.5px; }

/* Pantallas de acceso: tarjeta limpia con panel de marca */
.auth-body { background: var(--bg); }
.ticket-card-wrap { filter: none; animation: auth-in .35s var(--ease) both; }
[data-theme="dark"] .ticket-card-wrap { filter: none; }
@keyframes auth-in { from { opacity: 0; transform: translateY(8px); } }
.ticket-card { -webkit-mask: none; mask: none; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 40, 48, .04), 0 12px 32px rgba(15, 40, 48, .08); }
.ticket-side { padding: 34px 36px 30px; }
.ticket-side h1 { font-size: 28px; font-weight: 700; }
.auth-points { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; color: #B7CDD1; }
.auth-points li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.45; }
.auth-points .i { flex: none; margin-top: 1px; color: var(--accent); }
.auth-foot { border-top-style: solid; }

/* Botones: menos brillo, más firmeza */
.btn { font-weight: 600; letter-spacing: 0; }
.btn-primary { box-shadow: 0 1px 0 rgba(0, 0, 0, .06); }
.btn-accent { box-shadow: none; }

/* Tarjetas: bordes finos y sombra mínima */
.card { box-shadow: var(--shadow-sm); }

/* Insignias de estado: más planas */
.badge { height: 22px; font-size: 11.5px; padding: 0 8px 0 7px; }
.badge i { width: 6px; height: 6px; }

/* Etiquetas de contrato en la letra del texto */
.proj, .project-switch a, .project-code, .nav-code { font-family: var(--font-body) !important; font-weight: 650; letter-spacing: .02em; }
.proj { height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; }

/* Ajustes → Marca y correos */
.brand-logo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand-logo-box { display: grid; place-items: center; width: 220px; height: 72px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.brand-logo-box img { max-width: 100%; max-height: 52px; object-fit: contain; }
.brand-logo-actions { display: grid; gap: 8px; justify-items: start; }
.brand-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.brand-swatch { position: relative; cursor: pointer; }
.brand-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.brand-swatch span:first-of-type { display: block; width: 30px; height: 30px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: box-shadow .12s, transform .12s; }
.brand-swatch:hover span:first-of-type { transform: translateY(-1px); }
.brand-swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.brand-swatch input:focus-visible + span { box-shadow: var(--focus); }
.brand-hex { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); }
.brand-hex-dot { width: 22px; height: 22px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.brand-hex .input { width: 108px; font-family: var(--font-mono); text-transform: uppercase; }
.brand-hex .input.is-invalid { border-color: var(--danger); }

/* --------------------------------------------------------------------------
   Estados con color propio: asignado azul, en progreso morado, resuelto verde…
   -------------------------------------------------------------------------- */
:root {
  --st-new: #64748B;        /* nuevo, sin asignar: gris pizarra */
  --st-open: #2563EB;       /* abierto / asignado: azul */
  --st-in_progress: #7C3AED;/* en progreso: morado */
  --st-on_hold: #D97706;    /* en espera: ámbar */
  --st-resolved: #16A34A;   /* resuelto: verde */
  --st-closed: #475569;     /* cerrado: gris oscuro */
  --st-migrated: #BE185D;   /* migrado: vino */
}
:root[data-theme="dark"] {
  --st-new: #94A3B8;
  --st-open: #60A5FA;
  --st-in_progress: #A78BFA;
  --st-on_hold: #FBBF24;
  --st-resolved: #4ADE80;
  --st-closed: #94A3B8;
  --st-migrated: #F472B6;
}

/* Filas de la lista de tickets: fondo suave y franja del color del estado */
.trow { --tone: var(--st-new); background: color-mix(in srgb, var(--tone) 4%, var(--surface)); }
.trow.tone-unassigned { --tone: var(--st-new); }
.trow.tone-assigned { --tone: var(--st-open); }
.trow.tone-in_progress { --tone: var(--st-in_progress); }
.trow.tone-on_hold { --tone: var(--st-on_hold); }
.trow.tone-resolved { --tone: var(--st-resolved); }
.trow.tone-closed { --tone: var(--st-closed); }
.trow.tone-migrated { --tone: var(--st-migrated); }
.trow.tone-unassigned { background: var(--surface); }
.trow.tone-assigned, .trow.tone-in_progress, .trow.tone-on_hold, .trow.tone-resolved, .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 5.5%, var(--surface)); }
.trow.tone-closed { background: color-mix(in srgb, var(--tone) 4%, var(--surface)); }
.trow:hover { background: color-mix(in srgb, var(--tone) 10%, var(--surface)); }
.trow::before, .trow.pr-high::before, .trow.pr-urgent::before { top: 0; bottom: 0; width: 3px; border-radius: 0; background: var(--tone); }
.trow.tone-unassigned::before { background: var(--line-2); }
.trow.is-selected { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
:root[data-theme="dark"] .trow.tone-assigned, :root[data-theme="dark"] .trow.tone-in_progress, :root[data-theme="dark"] .trow.tone-on_hold,
:root[data-theme="dark"] .trow.tone-resolved, :root[data-theme="dark"] .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 8%, var(--surface)); }

/* Etiqueta «Migrado» con su propio color */
.tag-migrated { background: color-mix(in srgb, var(--st-migrated) 12%, var(--surface)); color: color-mix(in srgb, var(--st-migrated) 85%, var(--ink)); }

/* Leyenda de colores encima de la lista */
.tone-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: -4px 0 12px; font-size: 12.5px; color: var(--ink-2); }
.tone-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tone-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* Tonos más visibles en la lista de tickets */
.trow.tone-unassigned { background: var(--surface); }
.trow.tone-assigned, .trow.tone-in_progress, .trow.tone-on_hold, .trow.tone-resolved, .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 9%, var(--surface)); }
.trow.tone-closed { background: color-mix(in srgb, var(--tone) 6%, var(--surface)); }
.trow:hover { background: color-mix(in srgb, var(--tone) 14%, var(--surface)); }
.trow.tone-unassigned:hover { background: var(--surface-2); }
.trow::before, .trow.pr-high::before, .trow.pr-urgent::before { width: 4px; }
.trow { border-bottom-color: color-mix(in srgb, var(--tone) 14%, var(--line)); }
:root[data-theme="dark"] .trow.tone-assigned, :root[data-theme="dark"] .trow.tone-in_progress, :root[data-theme="dark"] .trow.tone-on_hold, :root[data-theme="dark"] .trow.tone-resolved, :root[data-theme="dark"] .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 12%, var(--surface)); }
:root[data-theme="dark"] .trow.tone-closed { background: color-mix(in srgb, var(--tone) 7%, var(--surface)); }

/* ==========================================================================
   Paleta de estados armonizada con la marca (petróleo + ámbar)
   Tonos apagados de saturación y luminosidad parecidas, para que convivan
   con el petróleo sin pelear entre sí.
   ========================================================================== */
:root {
  --st-new: #8A979C;          /* sin asignar: gris frío */
  --st-open: #3B6E9E;         /* asignado: azul acero */
  --st-in_progress: #6A5E9C;  /* en progreso: violeta grisáceo */
  --st-on_hold: #B98A3E;      /* en espera: ámbar tostado (familia del acento) */
  --st-resolved: #3F8A6E;     /* resuelto: verde salvia */
  --st-closed: #6F7F84;       /* cerrado: gris petróleo */
  --st-migrated: #8C5B6E;     /* migrado: ciruela apagado */
}
:root[data-theme="dark"] {
  --st-new: #8FA0A6;
  --st-open: #7BA6CF;
  --st-in_progress: #A196CC;
  --st-on_hold: #D6AE68;
  --st-resolved: #74BB9E;
  --st-closed: #93A4A9;
  --st-migrated: #C08FA2;
}

/* Insignias de estado: fondo tenue y texto en el mismo tono, más oscuro */
.badge {
  color: color-mix(in srgb, var(--st, var(--faint)) 70%, var(--ink));
  background: color-mix(in srgb, var(--st, var(--faint)) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--st, var(--faint)) 22%, transparent);
  font-weight: 600;
}
:root[data-theme="dark"] .badge { color: color-mix(in srgb, var(--st, var(--faint)) 75%, #fff); background: color-mix(in srgb, var(--st, var(--faint)) 16%, var(--surface)); }

/* Filas: tinte muy suave (se percibe el estado sin «pintar» la tabla) y franja fina */
.trow.tone-assigned, .trow.tone-in_progress, .trow.tone-on_hold, .trow.tone-resolved, .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 6%, var(--surface)); }
.trow.tone-closed { background: color-mix(in srgb, var(--tone) 4%, var(--surface)); }
.trow.tone-unassigned { background: var(--surface); }
.trow:hover { background: color-mix(in srgb, var(--tone) 10%, var(--surface)); }
.trow.tone-unassigned:hover { background: var(--surface-2); }
.trow { border-bottom-color: var(--line); }
.trow::before, .trow.pr-high::before, .trow.pr-urgent::before { width: 3px; }
:root[data-theme="dark"] .trow.tone-assigned, :root[data-theme="dark"] .trow.tone-in_progress, :root[data-theme="dark"] .trow.tone-on_hold,
:root[data-theme="dark"] .trow.tone-resolved, :root[data-theme="dark"] .trow.tone-migrated { background: color-mix(in srgb, var(--tone) 9%, var(--surface)); }
:root[data-theme="dark"] .trow.tone-closed { background: color-mix(in srgb, var(--tone) 5%, var(--surface)); }

/* Menos puntos de color sueltos */
.unread-dot { width: 7px; height: 7px; background: var(--brand); box-shadow: none; }
:root[data-theme="dark"] .unread-dot { background: var(--link); }
.cat::before { width: 7px; height: 7px; border-radius: 50%; transform: none; background: color-mix(in srgb, var(--c, var(--faint)) 55%, var(--muted)); }
.t-code::before { background: color-mix(in srgb, var(--c, var(--faint)) 70%, var(--muted)); }
.tag-migrated { background: color-mix(in srgb, var(--st-migrated) 10%, var(--surface)); color: color-mix(in srgb, var(--st-migrated) 75%, var(--ink)); }
.tone-legend { color: var(--muted); }
.tone-legend i { width: 9px; height: 9px; border-radius: 50%; }

/* Filas blancas: el color vive en la franja y en la insignia de estado (sólida) */
.trow, .trow.tone-unassigned, .trow.tone-assigned, .trow.tone-in_progress, .trow.tone-on_hold, .trow.tone-resolved, .trow.tone-closed, .trow.tone-migrated,
:root[data-theme="dark"] .trow.tone-assigned, :root[data-theme="dark"] .trow.tone-in_progress, :root[data-theme="dark"] .trow.tone-on_hold, :root[data-theme="dark"] .trow.tone-resolved, :root[data-theme="dark"] .trow.tone-migrated, :root[data-theme="dark"] .trow.tone-closed { background: var(--surface); }
.trow:hover, .trow.tone-unassigned:hover { background: var(--surface-2); }
.trow.is-selected { background: var(--brand-soft); }
.trow::before, .trow.pr-high::before, .trow.pr-urgent::before { width: 4px; top: 8px; bottom: 8px; border-radius: 0 3px 3px 0; }
.trow.tone-unassigned::before { background: var(--line-2); }

/* Insignia de estado sólida: se lee de un vistazo */
.badge { height: 23px; padding: 0 10px; gap: 6px; border: 0; color: #fff; background: color-mix(in srgb, var(--st, var(--faint)) 88%, #0B1A1F); font-weight: 600; letter-spacing: .01em; }
.badge i { width: 6px; height: 6px; background: rgba(255, 255, 255, .85); }
:root[data-theme="dark"] .badge { color: #0B1A1F; background: var(--st, var(--faint)); }
:root[data-theme="dark"] .badge i { background: rgba(11, 26, 31, .7); }

/* Lista de tickets: menos ruido */
.t-cat { color: var(--ink-2); }
.t-migrated { margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--st-migrated); white-space: nowrap; }
.trow.is-unread .t-subject { font-weight: 700; color: var(--ink); }
.trow:not(.is-unread) .t-subject { font-weight: 550; }
.tone-legend i { width: 3px; height: 12px; border-radius: 2px; }
.t-meta > span + span::before { content: "·"; margin-right: 6px; color: var(--faint); font-weight: 400; }
.t-meta > span[title]::before { content: ""; margin: 0; }

/* Franja = color del estado; código más grande; fecha de apertura legible */
.trow.tone-new { --tone: var(--st-new); }
.trow.tone-open { --tone: var(--st-open); }
.trow.tone-new::before { background: var(--st-new); }
@media (min-width: 1181px) {
  .tlist-head, .trow { grid-template-columns: 34px 168px minmax(0, 1fr) 130px 118px 150px 120px; }
  .tlist.no-select .tlist-head, .tlist.no-select .trow { grid-template-columns: 168px minmax(0, 1fr) 130px 118px 150px 120px; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .tlist-head, .trow { grid-template-columns: 34px 150px minmax(0, 1fr) 120px 112px 110px; }
  .tlist.no-select .tlist-head, .tlist.no-select .trow { grid-template-columns: 150px minmax(0, 1fr) 120px 112px 110px; }
}
.t-stub { gap: 6px; }
.t-code { font-size: 13.5px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.t-code::before { width: 7px; height: 7px; }
.t-opened { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.t-opened b { font-weight: 600; color: var(--ink-2); }
.t-opened-label { color: var(--muted); }
.t-opened-date { font-weight: 600; color: var(--ink-2); }

/* Diálogo de confirmación propio */
.confirm-dialog { width: min(440px, calc(100vw - 32px)); }
.confirm-dialog .dialog-body { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 22px 22px 6px; }
.confirm-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
:root[data-theme="dark"] .confirm-icon { color: var(--link); }
.confirm-dialog.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-dialog h2 { font-size: 16.5px; font-weight: 650; line-height: 1.35; margin: 2px 0 6px; }
.confirm-text { margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.confirm-dialog .dialog-foot { padding: 14px 22px 20px; }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); color: #fff; }
.confirm-dialog[open] { animation: confirm-in .16s var(--ease) both; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.confirm-dialog::backdrop { background: rgba(8, 20, 24, .45); backdrop-filter: blur(2px); }

/* Panel: filas parejas (todas las tarjetas de una fila con la misma altura) */
.dash-row { display: grid; gap: 18px; margin-bottom: 18px; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.dash-row > .card { margin: 0; height: 100%; }
.dash-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
@media (max-width: 1024px) { .dash-2-1 { grid-template-columns: minmax(0, 1fr); } }
.dash-row .metrics { height: calc(100% - 44px); align-content: stretch; grid-auto-rows: 1fr; }

/* Próximas ausencias */
.absences-card { display: flex; flex-direction: column; }
.absences-pending { display: flex; align-items: center; gap: 8px; margin: 12px 20px 0; padding: 9px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--st-on_hold) 12%, var(--surface)); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; }
.absences-pending:hover { text-decoration: none; background: color-mix(in srgb, var(--st-on_hold) 18%, var(--surface)); }
.absences-pending .i:first-child { color: var(--st-on_hold); }
.absences-pending span { flex: 1; }
.absences { margin: 10px 0 8px; padding: 0; list-style: none; }
.absences li { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); }
.absences li:first-child { border-top: 0; }
.absence-date { display: grid; place-items: center; flex: none; width: 42px; height: 44px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1; }
.absence-date b { font-size: 16px; font-weight: 700; }
.absence-date small { margin-top: 2px; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.absences li.is-now .absence-date { background: color-mix(in srgb, var(--st-on_hold) 14%, var(--surface)); border-color: color-mix(in srgb, var(--st-on_hold) 35%, transparent); }
.absence-main { display: grid; gap: 2px; min-width: 0; flex: 1; }
.absence-who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink); }
.absence-now { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; color: #fff; background: color-mix(in srgb, var(--st-on_hold) 88%, #0B1A1F); }
.absence-what { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.absences-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 28px 24px; text-align: center; color: var(--muted); }
.absences-empty p { margin: 0; max-width: 260px; font-size: 13px; }
.dash-row .metric-value { font-size: 19px; white-space: nowrap; }
.dash-row .metric-value small { display: block; margin: 2px 0 0; white-space: normal; }
.hbar-track span { background: color-mix(in srgb, var(--c, var(--brand)) 72%, var(--muted)) !important; }
.dash-row .metric { display: flex; flex-direction: column; justify-content: center; }

/* Mini banner de ausencias (panel) */
.ab-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 10px 12px 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--st-on_hold);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.ab-head { display: flex; align-items: center; gap: 10px; flex: none; padding-right: 6px; }
.ab-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--st-on_hold) 14%, var(--surface)); color: color-mix(in srgb, var(--st-on_hold) 85%, var(--ink)); }
.ab-title { display: grid; line-height: 1.25; }
.ab-title b { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.ab-title small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ab-arrow {
  display: none; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: background .12s, opacity .12s;
}
.ab-banner.has-overflow .ab-arrow { display: grid; }
.ab-arrow:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.ab-arrow:disabled { opacity: .35; cursor: default; }
.ab-arrow:focus-visible, .ab-track:focus-visible { outline: none; box-shadow: var(--focus); }
.ab-track { display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; border-radius: 8px; padding: 2px; }
.ab-track::-webkit-scrollbar { display: none; }
.ab-item {
  display: flex; align-items: center; gap: 10px; flex: none; scroll-snap-align: start;
  padding: 6px 12px 6px 6px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line);
}
.ab-item.is-now { background: color-mix(in srgb, var(--st-on_hold) 10%, var(--surface)); border-color: color-mix(in srgb, var(--st-on_hold) 30%, transparent); }
.ab-date { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 7px; background: var(--surface); border: 1px solid var(--line); line-height: 1; }
.ab-date b { font-size: 14px; font-weight: 700; color: var(--ink); }
.ab-date small { margin-top: 1px; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ab-text { display: grid; gap: 1px; line-height: 1.25; }
.ab-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ab-what { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ab-what em { font-style: normal; font-weight: 650; color: color-mix(in srgb, var(--st-on_hold) 85%, var(--ink)); }
.ab-none { align-self: center; font-size: 13px; color: var(--muted); padding: 0 4px; }
.ab-actions { display: flex; align-items: center; gap: 10px; flex: none; padding-left: 4px; }
.ab-pending { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; color: #fff; background: color-mix(in srgb, var(--st-on_hold) 88%, #0B1A1F); text-decoration: none; white-space: nowrap; }
.ab-pending:hover { text-decoration: none; filter: brightness(1.06); }
.ab-link { font-size: 12.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
@media (max-width: 760px) {
  .ab-banner { flex-wrap: wrap; }
  .ab-head { flex: 1 1 auto; }
  .ab-actions { order: 2; }
  .ab-track { order: 3; flex-basis: 100%; }
  .ab-arrow { display: none !important; }
}

/* ==========================================================================
   Horas extras, descansos y vacaciones · saldo, registro y bandeja de aprobación
   ========================================================================== */
.av-xs { --av: 20px; }
:root { --to-used: color-mix(in srgb, var(--ink-2) 55%, var(--surface)); --to-reserved: var(--st-on_hold); --to-free: var(--st-resolved); }

/* Saldo de un vistazo */
.tb { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tb-card { display: grid; gap: 6px; align-content: start; min-width: 0; padding: 15px 18px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; }
.tb-card.is-focus { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow: inset 0 3px 0 var(--brand), var(--shadow-sm); }
a.tb-card:hover { text-decoration: none; border-color: var(--line-2); }
.tb-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.tb-label .i { color: var(--ink-2); opacity: .8; }
.tb-value { font: 700 26px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tb-value small { font: 500 13px/1 var(--font-body); color: var(--muted); letter-spacing: 0; }
.tb-value.is-pos { color: var(--brand); }
:root[data-theme="dark"] .tb-value.is-pos { color: var(--link); }
.tb-bar { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-top: 2px; }
.tb-bar span { display: block; height: 100%; }
.tb-days { display: grid; gap: 3px; margin-top: 2px; }
.tb-days span { height: 7px; border-radius: 2px; background: var(--surface-3); }
.tb-bar .is-used, .tb-days .is-used, .tb-legend i.is-used { background: var(--to-used); }
.tb-bar .is-reserved, .tb-days .is-reserved, .tb-legend i.is-reserved { background: var(--to-reserved); }
.tb-bar .is-free, .tb-days .is-free { background: var(--to-free); }
.tb-legend { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--ink-2); }
.tb-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tb-legend i { width: 8px; height: 8px; border-radius: 2px; }
.tb-pending .tb-value { color: var(--muted); }
.tb-pending.is-wait .tb-value { color: var(--ink); }
.tb-pending.is-alert { border-color: color-mix(in srgb, var(--st-on_hold) 45%, var(--line)); background: color-mix(in srgb, var(--st-on_hold) 6%, var(--surface)); }
.tb-pending.is-alert .tb-value, .tb-pending.is-alert .tb-label .i { color: color-mix(in srgb, var(--st-on_hold) 80%, var(--ink)); }
.tb-go { margin-left: auto; font-weight: 650; color: var(--link); }

/* Registrar horas extras: campos + vista previa */
.otr { margin-bottom: 20px; scroll-margin-top: 90px; }
.otr:target { box-shadow: var(--focus); }
.otr-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
.otr-head h2 { display: inline-flex; align-items: center; gap: 7px; font: 650 15px/1.3 var(--font-body); }
.otr-head h2 .i { color: var(--brand); }
:root[data-theme="dark"] .otr-head h2 .i { color: var(--link); }
.otr-head .muted { font-size: 12.5px; }
.otr-none { margin: 0; padding: 16px 20px 18px; }
.otr-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.otr-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; padding: 16px 20px 20px; align-content: start; }
.otr-fields .field > label { font-size: 12px; color: var(--muted); }
.otr-ticket { grid-column: 1 / -1; }
.otr-fields:has(.otr-engineer) .otr-ticket { grid-column: span 2; }
.otr-desc { grid-column: 1 / -1; }
.otp { display: grid; gap: 12px; align-content: start; padding: 16px 18px 18px; border-left: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) 0; }
.otp-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); transition: border-color .2s; }
.otp-box.is-ok { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); }
.otp-box.is-bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.otp-label { font-size: 12px; color: var(--muted); }
.otp-value { font: 700 28px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--faint); }
.otp-box.is-ok .otp-value { color: var(--success); }
.otp-lines { display: grid; gap: 4px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.otp-line { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.otp-line b { display: inline-grid; place-items: center; min-width: 34px; height: 19px; margin-left: 4px; padding: 0 6px; border-radius: 999px; font: 600 11px/1 var(--font-mono); }
.otp-line.is-total { padding-top: 5px; margin-top: 2px; border-top: 1px dashed var(--line); font-weight: 650; color: var(--ink); }
.otp-hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.otp-hint.is-bad { color: var(--danger); font-weight: 550; }
.otp-rules { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.otp-rules li { display: flex; align-items: center; gap: 8px; }
.otp-rules b { flex: none; display: inline-grid; place-items: center; min-width: 36px; height: 20px; padding: 0 6px; border-radius: 999px; font: 600 11px/1 var(--font-mono); }

/* Registros del periodo */
.otl, .to-saldo { margin-bottom: 20px; }
.otl-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 16px 20px 0; }
.otl-head h2 { font: 650 15px/1.3 var(--font-body); }
.otl-period { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.otl-head .report-quick { grid-column: auto; }
.otl-filters { margin: 14px 20px 0; }
.otl-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 28px; margin: 16px 20px 0; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.otl-sum > div:not(.otl-sum-meta) { display: grid; gap: 2px; }
.otl-sum span { font-size: 12px; color: var(--muted); }
.otl-sum strong { font: 700 20px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.otl-sum strong.is-accent { color: var(--brand); }
:root[data-theme="dark"] .otl-sum strong.is-accent { color: var(--link); }
.otl-sum-meta { margin-left: auto; font-size: 12.5px; color: var(--ink-2); text-align: right; line-height: 1.5; }
.otl-list { margin: 12px 0 0; padding: 0; list-style: none; }
.otl-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 36px; gap: 14px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--line); }
.otl-row:hover { background: var(--surface-2); }
.otl-date, .lvh-date { display: grid; place-items: center; align-content: center; width: 48px; height: 52px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.05; }
.otl-date b, .lvh-date b { font: 700 18px/1.05 var(--font-display); color: var(--ink); }
.otl-date small, .lvh-date small { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.otl-main { display: grid; gap: 4px; min-width: 0; }
.otl-time { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.otl-time strong { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.otl-time .muted { font-size: 12.5px; }
.otl-ticket { font-size: 13px; overflow-wrap: anywhere; }
.otl-ticket .code { margin-right: 6px; }
.otl-who { margin-top: 2px; font-size: 12.5px; }
.otl-credit { display: grid; justify-items: end; gap: 5px; text-align: right; }
.otl-credit strong { font: 700 17px/1.1 var(--font-display); color: var(--success); font-variant-numeric: tabular-nums; white-space: nowrap; }
.otl-credit .to-tags { justify-content: flex-end; }
.otl-actions { display: flex; justify-content: flex-end; }

/* Bandeja del aprobador */
.lvi { margin-bottom: 20px; border-color: color-mix(in srgb, var(--st-on_hold) 40%, var(--line)); scroll-margin-top: 90px; }
.lvi-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 16px 20px 12px; }
.lvi-head h2 { display: inline-flex; align-items: center; gap: 6px; font: 650 15px/1.3 var(--font-body); }
.lvi-head .to-count { background: var(--st-on_hold); }
.lvi-head .muted { font-size: 12.5px; }
.lvi-list { margin: 0; padding: 0; list-style: none; }
.lvi-row { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) auto; gap: 10px 18px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.lvi-row:target { background: var(--accent-soft); }
.lvi-what { display: grid; gap: 3px; min-width: 0; }
.lvi-what strong { font-size: 14.5px; font-weight: 650; }
.lvi-meta { font-size: 12.5px; color: var(--ink-2); }
.lvi-meta b { color: var(--ink); }
.lvi-reason { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.lvi-form { display: grid; gap: 8px; justify-items: end; min-width: 0; }
.lvi-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.lvi-as { font-size: 11.5px; color: var(--muted); margin-right: 4px; }
.lvi-reject { color: var(--danger); }
.lvi-reject:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); background: var(--danger-soft); }
.lvi-note { width: 100%; min-width: 260px; }
.lvi-note.is-collapsed { display: none; }
.lvi-note .textarea { min-height: 54px; }
.lvi-need { margin: 4px 0 0; color: var(--danger); }
.lvi-need[hidden] { display: none; }
.lvi-row:has(.lvi-note.is-open) { grid-template-columns: minmax(170px, 230px) minmax(0, 1fr) minmax(280px, 340px); align-items: start; }

/* Historial de solicitudes */
.lvh { margin: 10px 0 0; padding: 0; list-style: none; }
.lvh-row { --lv: var(--st-closed); position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 20px 14px 22px; border-top: 1px solid var(--line); scroll-margin-top: 90px; transition: background .4s; }
.lvh-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lv); }
.lvh-row.is-pending { --lv: var(--st-on_hold); }
.lvh-row.is-approved { --lv: var(--st-resolved); }
.lvh-row.is-rejected { --lv: var(--danger); }
.lvh-row.is-cancelled { --lv: var(--st-closed); }
.lvh-row:target { background: var(--accent-soft); }
.lvh-main { display: grid; gap: 5px; min-width: 0; }
.lvh-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.lvh-when { font-size: 14.5px; font-weight: 650; color: var(--ink); }
.lvh-row.is-cancelled .lvh-when, .lvh-row.is-rejected .lvh-when { color: var(--muted); }
.lvh-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.lvh-who { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; }
.lvh-reason { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.lvh-decision { display: flex; gap: 6px; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.lvh-decision .i { flex: none; margin-top: 2px; }
.lvh-row.is-approved .lvh-decision .i { color: var(--success); }
.lvh-row.is-rejected .lvh-decision .i { color: var(--danger); }
.lvh-date { width: 44px; height: 48px; }
/* Estados: insignia sólida y legible, colores apagados de la marca */
.lv-status { color: #fff; background: var(--lv); border-color: transparent; }
.lv-status i { background: rgba(255, 255, 255, .85); }
.lv-pending { --lv: color-mix(in srgb, var(--st-on_hold) 92%, #2A1C00); }
.lv-approved { --lv: var(--st-resolved); }
.lv-rejected { --lv: color-mix(in srgb, var(--danger) 88%, #2A0000); }
.lv-cancelled { --lv: var(--st-closed); }

/* Disposición: historial a la izquierda, formulario a la derecha */
.lv-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.lv-layout > * { min-width: 0; }
.to-form .section-title { margin-bottom: 14px; }
.lvp { display: grid; gap: 7px; padding: 13px 15px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.lvp-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.lvp-row b { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.lvp-row.is-total { padding-top: 8px; border-top: 1px dashed var(--line-2); }
.lvp-row.is-total b { font: 700 20px/1 var(--font-display); color: var(--faint); }
.lvp.is-ready .lvp-row.is-total b { color: var(--success); }
.lvp.is-bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.lvp.is-bad .lvp-row.is-total b { color: var(--danger); }
.lvp .to-summary { font-size: 12.5px; }
.lvp-approver { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--muted); }
.lvp-approver[hidden] { display: none; }
.lvp-approver b { color: var(--ink-2); font-weight: 600; }
.to-info { padding: 0; }
.to-info > summary { display: flex; align-items: center; gap: 7px; padding: 14px 18px; cursor: pointer; list-style: none; font: 650 14px/1.3 var(--font-body); }
.to-info > summary::-webkit-details-marker { display: none; }
.to-info > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.to-info[open] > summary::after { transform: rotate(225deg); }
.to-info > ul { padding: 0 18px 16px 36px; }
.to-vacmeter { display: inline-block; width: 46px; height: 5px; margin-right: 8px; border-radius: 99px; background: var(--surface-3); vertical-align: 2px; overflow: hidden; }
.to-vacmeter i { display: block; height: 100%; background: var(--to-free); }

@media (max-width: 1100px) {
  .otr-body { grid-template-columns: minmax(0, 1fr); }
  .otp { border-left: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .otp .btn-block { grid-column: 1 / -1; }
  .lvi-row, .lvi-row:has(.lvi-note.is-open) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .lvi-form { grid-column: 1 / -1; }
  .lvi-note { min-width: 0; }
}
@media (max-width: 900px) {
  .tb { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-pending { grid-column: 1 / -1; }
  .lv-layout { grid-template-columns: minmax(0, 1fr); }
  .lv-side { display: contents; }
  .lv-side > * { order: 1; }
  .lv-side > .to-form { order: -1; }
}
@media (max-width: 760px) {
  .tb { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tb-card { padding: 13px 15px 12px; }
  .tb-value { font-size: 23px; }
  .otr-head, .otl-head { padding-left: 16px; padding-right: 16px; }
  .otr-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px 16px; }
  .otr-fields:has(.otr-engineer) .otr-ticket, .otr-engineer { grid-column: 1 / -1; }
  .otr-fields .field:has(#r-date) { grid-column: 1 / -1; }
  .otp { grid-template-columns: minmax(0, 1fr); padding: 14px 16px 16px; }
  .otl-filters { margin: 12px 16px 0; }
  .otl-sum { margin: 14px 16px 0; gap: 8px 20px; }
  .otl-sum-meta { margin-left: 0; text-align: left; flex-basis: 100%; }
  .otl-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px 12px; padding: 12px 16px; }
  .otl-date { width: 44px; height: 48px; }
  .otl-credit { grid-column: 2 / 3; grid-row: 2; display: flex; align-items: center; justify-content: flex-start; gap: 8px; text-align: left; }
  .otl-actions { grid-column: 3; grid-row: 1; }
  .lvi-head { padding: 14px 16px 10px; }
  .lvi-row, .lvi-row:has(.lvi-note.is-open) { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; gap: 8px; }
  .lvi-form { justify-items: stretch; }
  .lvi-actions .btn { flex: 1; justify-content: center; }
  .lvi-as { flex-basis: 100%; }
  .lvh-row { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 16px 12px 18px; gap: 10px 12px; }
  .lvh-date { width: 40px; height: 44px; }
  .lvh-actions { grid-column: 2; justify-self: start; margin-left: -8px; }
  .to-saldo-table thead { display: none; }
  .to-saldo-table, .to-saldo-table tbody, .to-saldo-table tr, .to-saldo-table td { display: block; width: 100%; }
  .to-saldo-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
  .to-saldo-table td { padding: 0 !important; border: 0 !important; text-align: left !important; }
  .to-saldo-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); }
}

/* Ticket atendido fuera de la jornada: aviso para registrar las horas extras (horario precargado) */
.ot-suggest { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; line-height: 1.45; }
.ot-suggest > .i { flex: none; margin-top: 2px; }
.ot-suggest strong { display: block; font-weight: 650; }
.ot-suggest span { color: var(--ink-2); }

/* Nuevo ticket: tipo (Incidente · Requerimiento · Desarrollo) */
.type-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker label { --c: var(--brand); display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: start; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.type-picker label.type-incident { --c: var(--danger); }
.type-picker label.type-development { --c: #534AB7; }
.type-picker .type-ico { grid-row: 1 / 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.type-picker strong { font-size: 14px; color: var(--ink); }
.type-picker small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.type-picker label:hover { border-color: var(--faint); }
.type-picker input:checked + label { border-color: var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface)); box-shadow: inset 0 0 0 1px var(--c); }
.type-picker input:focus-visible + label { box-shadow: var(--focus); }
.type-dev-note { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; padding: 9px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, #534AB7 9%, var(--surface)); color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.type-dev-note[hidden] { display: none; }
.type-dev-note .i { flex: none; margin-top: 2px; color: #534AB7; }
@media (max-width: 720px) { .type-picker { grid-template-columns: 1fr; } }

/* Etiqueta «Priorizada» en tickets */
.tag-prio { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent-ink); }
.prio-card { display: grid; gap: 8px; }
.prio-card p { margin: 0; font-size: 13px; color: var(--muted); }


/* Bienvenida del panel: franja de marca con pistas de circuito (como el ingreso).
   Sin el talón perforado: solo el fondo de circuito, con la tipografía sobria. */
.greeting {
  position: relative; overflow: hidden;
  margin-bottom: 20px; padding: 26px 32px; border-radius: 16px; color: #E7F0F1;
  background: var(--band);
}
.greeting::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='200' fill='none' stroke='rgba(255,255,255,.16)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 150 H90 L130 110 H260 L300 70 H560'/%3E%3Cpath d='M160 200 V160 L190 130 H340 L370 160 H560'/%3E%3Cpath d='M220 0 V40 L250 70 H300'/%3E%3Cpath d='M380 0 V30 L410 60 H560'/%3E%3Cpath d='M470 200 V180 L500 150 H560'/%3E%3Ccircle cx='260' cy='110' r='4'/%3E%3Ccircle cx='340' cy='130' r='4'/%3E%3Ccircle cx='300' cy='70' r='4'/%3E%3Ccircle cx='410' cy='60' r='4'/%3E%3Ccircle cx='500' cy='150' r='4'/%3E%3C/svg%3E") right center / auto 100% no-repeat;
}
.greeting::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 46%; pointer-events: none;
  background: linear-gradient(90deg, var(--band), transparent 22%);
}
.greeting-main { position: relative; z-index: 1; }
.greeting-date { color: var(--accent); }
.greeting h1 { color: #fff; }
.greeting p { color: #A9C3C7; }
.greeting .project-switch { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
.greeting .project-switch a { color: #A9C3C7; }
.greeting .project-switch a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.greeting .project-switch a.is-active { background: #fff; color: #13232A; }
.greeting .project-fixed { color: #CFE0E3; }
.greeting .project-fixed .proj, .greeting .project-fixed .project-code { background: rgba(255, 255, 255, .1); color: #fff; }
.greeting .btn-primary { background: var(--accent); border-color: var(--accent); color: #13232A; }
.greeting .btn-primary:hover { filter: brightness(1.05); }
@media (max-width: 760px) { .greeting { padding: 22px 20px; } .greeting::before { opacity: .6; } }

/* Menú lateral: pistas de circuito al fondo, con un pulso ámbar */
.sidebar > nav, .sidebar > .brand, .sidebar > .sidebar-foot { position: relative; z-index: 1; }
.side-circuit { z-index: 0; bottom: 64px; opacity: .9; }
.sidebar-foot { background: var(--side); }
@media (prefers-reduced-motion: reduce) { .side-circuit .side-pulse { animation: none; opacity: 0; } }
/* Logo de la marca (imagen): sin la cajita de color del ícono anterior */
.brand-mark.is-logo { background: none; border-radius: 0; width: 46px; height: 34px; }
.brand-mark.is-logo img { width: 46px; height: 34px; display: block; }
.brand-mark.is-logo.is-wide { width: 104px; height: 56px; }
.rs-logo { height: 52px; width: auto; display: block; }
.rs-brand { gap: 14px; }
/* Login: logo completo sobre una placa clara (las letras oscuras no se leen sobre el panel oscuro) */
.auth-logo { display: block; margin: -6px -8px 26px; padding: 0; overflow: hidden; background: #EEF2F4; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); }
.auth-logo img { display: block; width: 100%; height: auto; }
.auth-logo:hover { text-decoration: none; }
/* Logo del login a tamaño fijo (300 px) para que la imagen 1×/2×/3× calce exacta y se vea nítida */
.auth-logo { width: 480px; max-width: 100%; margin-left: 0; margin-right: 0; }
.auth-logo img { width: 480px; max-width: 100%; height: auto; image-rendering: auto; }
/* Login en escritorio: el panel verde (marca) es el ancho y el formulario el angosto, para que el logo se vea grande y nítido */
@media (min-width: 761px) {
  .ticket-card-wrap { max-width: 1040px; }
  .ticket-card:not(.is-single) { grid-template-columns: minmax(0, 1fr) 430px; }
  .ticket-side { padding: 44px 48px 38px; }
  .ticket-side h1 { font-size: 34px; }
  .ticket-main { padding: 44px 40px 36px; }
}
/* El logo nunca ensancha la tarjeta: se ajusta al ancho disponible (móvil) */
.ticket-side { min-width: 0; }
@media (max-width: 760px) {
  .auth-logo { width: auto; margin: 0 0 18px; }
  .auth-logo img { width: 100%; }
}
.auth-form .check { white-space: nowrap; }

/* ---------- Verificación en dos pasos ---------- */
.mfa-code { font: 600 20px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .32em; text-align: center; max-width: 220px; }
.auth-form .mfa-code { max-width: none; }
.mfa-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mfa-head .section-title { display: inline-flex; align-items: center; gap: 8px; }
.mfa-tag-warn { background: var(--warning-soft); color: var(--warning-ink); }
.mfa-steps { margin: 16px 0 0; padding-left: 20px; display: grid; gap: 16px; }
.mfa-steps > li { padding-left: 4px; line-height: 1.55; }
.mfa-qr-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.mfa-qr { padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; line-height: 0; }
.mfa-key { display: grid; gap: 8px; max-width: 320px; justify-items: start; }
.mfa-key small { color: var(--muted); }
.mfa-secret { font: 600 15px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; word-break: break-all; }
.mfa-confirm { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.mfa-codes-box { margin: 14px 0 4px; padding: 14px 16px; border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface-2); }
.mfa-codes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 16px; margin: 0 0 12px; padding: 0; list-style: none; }
.mfa-codes code { font: 600 14.5px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }
.mfa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mfa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mfa-box { display: grid; gap: 8px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.mfa-box .hint { margin: 0; }
.mfa-box .btn { justify-self: start; }
@media (max-width: 640px) { .mfa-codes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .mfa-codes-box { border: 1px solid #000; } }
