/* ============================================================================
   PELISTAFF — sistema de diseño v2 (SaaS)
   Tipografía: Plus Jakarta Sans (interfaz) + JetBrains Mono (códigos, cifras).
   Paleta: azul marino como color de marca (botones principales, foco), acento
   azul para enlaces y estados activos. Los colores de estado y de turno son
   independientes del acento para que los datos destaquen sobre el cromo.
   Todo por tokens: ningún color suelto en los componentes.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --ground: #F6F8FB;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --surface-3: #E6EBF3;
  --text: #0B1220;
  --text-soft: #475467;
  --text-faint: #7B8799;
  --line: #E3E8EF;
  --line-soft: #EDF1F6;

  --brand: #0F172A;          /* marino: botones principales */
  --brand-hover: #1E293B;
  --on-brand: #FFFFFF;
  --accent: #0F5FD1;         /* azul: enlaces, activo, foco */
  --accent-hover: #0B4CAB;
  --accent-soft: #E8F0FD;
  --ring: rgba(15, 95, 209, .35);

  --ok: #067647;  --ok-soft: #E3F5EC;
  --warn: #9A5806; --warn-soft: #FDF1DE;
  --danger: #B42318; --danger-soft: #FCE8E6;
  --info: #175CD3; --info-soft: #E6EFFC;

  --tarde: #2563EB; --noche: #7C3AED;

  --shadow-xs: 0 1px 2px rgba(11, 18, 32, .05);
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .06), 0 1px 3px rgba(11, 18, 32, .06);
  --shadow: 0 2px 4px -1px rgba(11, 18, 32, .06), 0 8px 24px -8px rgba(11, 18, 32, .14);
  --shadow-lg: 0 16px 48px -12px rgba(11, 18, 32, .28);

  --r-sm: 6px; --r: 10px; --r-lg: 14px; --r-xl: 18px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --sidebar-w: 240px; --topbar-h: 56px;
  --t-fast: 120ms; --t: 180ms; --ease: cubic-bezier(.2, .8, .3, 1);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0B1119; --surface: #121A26; --surface-2: #182234; --surface-3: #212D41;
    --text: #E9EEF6; --text-soft: #A9B6C9; --text-faint: #7B8799;
    --line: #26324A; --line-soft: #1E2839;
    --brand: #E9EEF6; --brand-hover: #FFFFFF; --on-brand: #0B1119;
    --accent: #6AA1FF; --accent-hover: #8AB6FF; --accent-soft: #14243D; --ring: rgba(106, 161, 255, .4);
    --ok: #4FD69C; --ok-soft: #0E2A21; --warn: #F0B457; --warn-soft: #2C2010;
    --danger: #FF8C82; --danger-soft: #331816; --info: #79B0FF; --info-soft: #12253D;
    --tarde: #6C9CFF; --noche: #A78BFA;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5); --shadow-sm: 0 1px 3px rgba(0,0,0,.55);
    --shadow: 0 8px 24px -8px rgba(0,0,0,.7); --shadow-lg: 0 16px 48px -12px rgba(0,0,0,.85);
  }
}
:root[data-theme="dark"] {
  --ground: #0B1119; --surface: #121A26; --surface-2: #182234; --surface-3: #212D41;
  --text: #E9EEF6; --text-soft: #A9B6C9; --text-faint: #7B8799;
  --line: #26324A; --line-soft: #1E2839;
  --brand: #E9EEF6; --brand-hover: #FFFFFF; --on-brand: #0B1119;
  --accent: #6AA1FF; --accent-hover: #8AB6FF; --accent-soft: #14243D; --ring: rgba(106, 161, 255, .4);
  --ok: #4FD69C; --ok-soft: #0E2A21; --warn: #F0B457; --warn-soft: #2C2010;
  --danger: #FF8C82; --danger-soft: #331816; --info: #79B0FF; --info-soft: #12253D;
  --tarde: #6C9CFF; --noche: #A78BFA;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.5); --shadow-sm: 0 1px 3px rgba(0,0,0,.55);
  --shadow: 0 8px 24px -8px rgba(0,0,0,.7); --shadow-lg: 0 16px 48px -12px rgba(0,0,0,.85);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5; font-weight: 450;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.015em; margin: 0; text-wrap: balance; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, code, kbd, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-faint); } .soft { color: var(--text-soft); }
.small { font-size: .8rem; } .xs { font-size: .72rem; }
.grow { flex: 1; } .row { display: flex; align-items: center; gap: var(--s2); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
kbd {
  display: inline-block; padding: 1px 6px; font-size: .7rem; line-height: 1.4;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface-2); color: var(--text-soft);
}

/* ══ Estructura ══════════════════════════════════════════════════ */
.app { display: grid; grid-template-rows: var(--topbar-h) 1fr; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s4); background: var(--surface); border-bottom: 1px solid var(--line);
  position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.02rem; color: var(--text); min-width: calc(var(--sidebar-w) - var(--s4)); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; }
.tenant {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); cursor: pointer; font: inherit; color: var(--text);
  max-width: 340px; transition: border-color var(--t-fast), background var(--t-fast);
}
.tenant:hover { border-color: var(--text-faint); background: var(--surface-2); }
.tenant .t-ico { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.tenant .t-txt { min-width: 0; text-align: left; line-height: 1.2; display: flex; flex-direction: column; overflow: hidden; }
.tenant .t-name { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tenant .t-sub { font-size: .72rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.searchbtn {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); color: var(--text-faint); cursor: pointer; font: inherit; min-width: 260px; font-size: .85rem;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.searchbtn:hover { border-color: var(--text-faint); color: var(--text-soft); }
.searchbtn kbd { margin-left: auto; }
.iconbtn {
  width: 36px; height: 36px; border-radius: var(--r); border: 1px solid transparent; background: none; color: var(--text-soft);
  display: grid; place-items: center; cursor: pointer; position: relative; transition: background var(--t-fast), color var(--t-fast);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn .dot-badge { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .64rem; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-size: .74rem; font-weight: 700; flex-shrink: 0; }

.sidebar { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; padding: var(--s3) var(--s2); gap: 2px; }
.nav-section { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); padding: var(--s4) var(--s3) var(--s1); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); border: none; background: none;
  color: var(--text-soft); font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; width: 100%; text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item svg { flex-shrink: 0; opacity: .9; }
.nav-item .badge-count { margin-left: auto; background: var(--danger-soft); color: var(--danger); font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-item kbd { margin-left: auto; opacity: 0; transition: opacity var(--t-fast); }
.nav-item:hover kbd { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: var(--s3) var(--s2) var(--s1); border-top: 1px solid var(--line-soft); font-size: .72rem; color: var(--text-faint); }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.page-head { padding: var(--s5) var(--s6) 0; display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.page-head .crumbs { font-size: .78rem; color: var(--text-faint); display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.page-head h1 { font-size: 1.35rem; }
.page-head .sub { color: var(--text-soft); font-size: .88rem; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.content { flex: 1; overflow-y: auto; padding: var(--s4) var(--s6) var(--s7); }

/* ══ Controles ═══════════════════════════════════════════════════ */
button, .btn {
  font: inherit; font-size: .86rem; font-weight: 600; padding: 7px 12px; min-height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: var(--shadow-xs);
}
button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-faint); }
button:active:not(:disabled) { transform: translateY(.5px); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
button.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
button.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
button.accent:hover:not(:disabled) { background: var(--accent-hover); }
button.ghost { border-color: transparent; background: none; box-shadow: none; color: var(--text-soft); }
button.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
button.danger { color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
button.sm { padding: 4px 9px; font-size: .78rem; min-height: 28px; }
button.icon { padding: 0; width: 34px; justify-content: center; }
button.icon.sm { width: 28px; }
button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.segmented button { border: none; background: none; box-shadow: none; padding: 4px 10px; min-height: 26px; font-size: .78rem; color: var(--text-soft); border-radius: 4px; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

select, input:not([type=checkbox]):not([type=radio]):not([type=color]), textarea {
  font: inherit; font-size: .86rem; padding: 7px 10px; min-height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); width: 100%; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
select:hover, input:hover { border-color: var(--text-faint); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder { color: var(--text-faint); }
input[type=color] { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.field { margin-bottom: var(--s4); }
.field > label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
.field .hint { font-size: .76rem; color: var(--text-faint); margin-top: 4px; }
.field .error { font-size: .78rem; color: var(--danger); margin-top: 4px; }
.field-row { display: flex; gap: var(--s3); } .field-row > * { flex: 1; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .85rem; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background var(--t); cursor: pointer; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t) var(--ease); }
.switch input:checked { background: var(--accent); } .switch input:checked::after { transform: translateX(16px); }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: .85rem; }
.check:hover { background: var(--surface-2); } .check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; }

/* ══ Superficies ═════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.card-head { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: var(--s3); min-height: 50px; }
.card-head h2 { font-size: .95rem; }
.card-body { padding: var(--s4); }
.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s3) 0; }
.toolbar select, .toolbar input { width: auto; min-width: 160px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.stat .k { font-size: .74rem; font-weight: 600; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat .d { font-size: .76rem; color: var(--text-faint); }
.stat.ok .v { color: var(--ok); } .stat.warn .v { color: var(--warn); } .stat.danger .v { color: var(--danger); } .stat.accent .v { color: var(--accent); }
.stat.clickable { cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.stat.clickable:hover { border-color: var(--text-faint); box-shadow: var(--shadow); }
.spark { position: absolute; right: 12px; bottom: 10px; display: flex; align-items: flex-end; gap: 3px; height: 26px; opacity: .55; }
.spark i { display: block; width: 6px; background: var(--accent); border-radius: 2px 2px 0 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--s4); }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--surface-3); color: var(--text-soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; border: 1px solid var(--line); font-size: .78rem; background: var(--surface); }
.chip .sw { width: 10px; height: 10px; border-radius: 3px; }

.banner { padding: var(--s3) var(--s4); border-radius: var(--r); font-size: .86rem; display: flex; gap: var(--s3); align-items: flex-start; border: 1px solid transparent; }
.banner.error { background: var(--danger-soft); color: var(--danger); } .banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--info-soft); color: var(--info); } .banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner svg { flex-shrink: 0; margin-top: 1px; }

/* ══ Tablas ══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th { text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); padding: 10px var(--s4); border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 2; }
table.data th.sortable { cursor: pointer; user-select: none; } table.data th.sortable:hover { color: var(--text); }
table.data th .arrow { opacity: .35; margin-left: 4px; } table.data th.sorted .arrow { opacity: 1; color: var(--accent); }
table.data td { padding: 10px var(--s4); border-bottom: 1px solid var(--line-soft); color: var(--text-soft); vertical-align: middle; }
table.data td.strong { color: var(--text); font-weight: 600; } table.data td.num, table.data th.num { text-align: right; }
table.data tbody tr { transition: background var(--t-fast); } table.data tbody tr:hover td { background: var(--surface-2); }
table.data tr.muted td { opacity: .55; } table.data tr.clickable { cursor: pointer; }
.dt-toolbar { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.dt-toolbar input { max-width: 260px; }
.dt-foot { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); border-top: 1px solid var(--line-soft); font-size: .78rem; color: var(--text-faint); }
.dt-foot .pages { margin-left: auto; display: flex; gap: 4px; }

/* ══ Menús, popovers, paleta de comandos ═════════════════════════ */
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu { position: absolute; z-index: 60; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px; animation: pop var(--t-fast) var(--ease); }
.menu button { display: flex; width: 100%; text-align: left; border: none; background: none; box-shadow: none; padding: 8px 10px; font-weight: 500; border-radius: var(--r-sm); gap: 10px; }
.menu button:hover { background: var(--surface-2); } .menu button.danger:hover { background: var(--danger-soft); }
.menu .sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.menu .lbl { padding: 6px 10px 2px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.menu kbd { margin-left: auto; }

.cmdk-bd { position: fixed; inset: 0; background: rgba(6, 10, 18, .5); backdrop-filter: blur(3px); z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 12vh var(--s4) var(--s4); animation: fade var(--t-fast); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; animation: pop var(--t) var(--ease); }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.cmdk-in input { border: none; box-shadow: none; padding: 4px 0; font-size: 1rem; background: none; }
.cmdk-in input:focus { box-shadow: none; }
.cmdk-list { max-height: 400px; overflow-y: auto; padding: 6px; }
.cmdk-grp { padding: 8px 10px 4px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: .9rem; }
.cmdk-item .ic { width: 28px; height: 28px; border-radius: 7px; background: var(--surface-2); color: var(--text-soft); display: grid; place-items: center; flex-shrink: 0; }
.cmdk-item .sub { font-size: .76rem; color: var(--text-faint); margin-left: 2px; }
.cmdk-item.on { background: var(--accent-soft); color: var(--accent); } .cmdk-item.on .ic { background: var(--accent); color: #fff; }
.cmdk-item kbd { margin-left: auto; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-faint); font-size: .88rem; }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--line-soft); font-size: .72rem; color: var(--text-faint); }

/* ══ Toasts, modal, panel lateral ════════════════════════════════ */
.toasts { position: fixed; bottom: var(--s4); right: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 300; max-width: min(400px, calc(100vw - 32px)); }
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--text-faint); border-radius: var(--r); padding: var(--s3) var(--s4); box-shadow: var(--shadow-lg); font-size: .86rem; display: flex; align-items: flex-start; gap: var(--s3); animation: slide-in var(--t) var(--ease); }
.toast.ok { border-left-color: var(--ok); } .toast.error { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warn); }
.toast.ok svg { color: var(--ok); } .toast.error svg { color: var(--danger); } .toast.warn svg { color: var(--warn); }
.toast .msg { flex: 1; } .toast button { margin-left: auto; }

.backdrop { position: fixed; inset: 0; background: rgba(6, 10, 18, .5); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 150; padding: var(--s4); animation: fade var(--t-fast); }
.modal { background: var(--surface); border-radius: var(--r-xl); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop var(--t) var(--ease); }
.modal.wide { max-width: 720px; }
.modal-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: var(--s3); }
.modal-head h3 { font-size: 1.02rem; flex: 1; }
.modal-body { padding: var(--s5); }
.modal-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line-soft); display: flex; gap: var(--s2); justify-content: flex-end; }

@keyframes slide-left { from { transform: translateX(100%); } to { transform: none; } }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6, 10, 18, .4); z-index: 140; animation: fade var(--t-fast); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 141; display: flex; flex-direction: column; animation: slide-left var(--t) var(--ease); }
.drawer-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: var(--s3); }
.drawer-head h3 { font-size: 1.05rem; } .drawer-head .sub { font-size: .8rem; color: var(--text-faint); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s5); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tab { padding: 8px 12px; border: none; background: none; box-shadow: none; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-soft); font-weight: 500; border-radius: 0; }
.tab:hover { color: var(--text); background: none; } .tab.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 700; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: var(--s2) var(--s3); font-size: .87rem; }
.kv dt { color: var(--text-faint); font-size: .8rem; } .kv dd { margin: 0; }
.tl { border-left: 2px solid var(--line); padding-left: var(--s4); margin-left: 5px; }
.tl-item { position: relative; padding-bottom: var(--s4); }
.tl-item::before { content: ''; position: absolute; left: calc(-1 * var(--s4) - 5px); top: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.tl-item.current::before { border-color: var(--accent); background: var(--accent); }
.tl-item .when { font-size: .74rem; color: var(--text-faint); font-family: var(--mono); } .tl-item .what { font-weight: 600; }

/* ══ Estados ═════════════════════════════════════════════════════ */
.empty { text-align: center; padding: var(--s7) var(--s4); }
.empty .ei { width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); color: var(--text-faint); display: grid; place-items: center; margin: 0 auto var(--s3); }
.empty h3 { font-size: 1rem; margin-bottom: var(--s2); } .empty p { color: var(--text-faint); font-size: .88rem; margin: 0 auto var(--s4); max-width: 42ch; }
@keyframes shimmer { 100% { background-position: -200% 0; } }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: var(--r-sm); height: 14px; }
.skel-row { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-soft); }
.skel-row .skel:nth-child(1) { flex: 2; } .skel-row .skel:nth-child(2), .skel-row .skel:nth-child(3) { flex: 1; }

.setup { display: grid; gap: 6px; }
.setup-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: .86rem; }
.setup-item .ck { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.setup-item.done .ck { background: var(--ok); border-color: var(--ok); } .setup-item.done { color: var(--text-faint); text-decoration: line-through; }
.setup-item:not(.done) { cursor: pointer; } .setup-item:not(.done):hover { background: var(--surface-2); }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width var(--t); }

/* ══ Cuadrante ═══════════════════════════════════════════════════ */
.cuad-bar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.week-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.week-nav button { border: none; box-shadow: none; }
.week-label { font-weight: 700; font-size: .88rem; min-width: 150px; text-align: center; font-variant-numeric: tabular-nums; }
.palette { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tpl { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 7px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; user-select: none; font-size: .8rem; font-weight: 600; transition: box-shadow var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.tpl:hover { border-color: var(--text-faint); } .tpl .sw { width: 12px; height: 12px; border-radius: 4px; }
.tpl kbd { margin-left: 2px; font-size: .62rem; padding: 0 4px; } .tpl .h { color: var(--text-faint); font-weight: 500; font-family: var(--mono); font-size: .72rem; }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.cuad-hint { font-size: .78rem; color: var(--text-faint); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: var(--s2); }

.grid-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); max-height: calc(100vh - 250px); position: relative; user-select: none; }
.grid-wrap.painting { cursor: crosshair; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; }
table.grid th, table.grid td { border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); padding: 0; }
table.grid thead th { background: var(--surface-2); padding: 8px 6px; text-align: center; position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--line); }
table.grid thead th .dow { display: block; font-size: .76rem; font-weight: 700; } table.grid thead th .date { display: block; font-size: .7rem; color: var(--text-faint); font-family: var(--mono); }
table.grid thead th .hc { display: inline-block; margin-top: 3px; font-size: .68rem; font-weight: 600; color: var(--text-soft); background: var(--surface-3); border-radius: 99px; padding: 0 7px; }
table.grid thead th.today { background: var(--accent-soft); } table.grid thead th.today .dow, table.grid thead th.today .date { color: var(--accent); }
table.grid thead th .col-act { display: none; gap: 2px; justify-content: center; margin-top: 4px; }
table.grid thead th:hover .col-act { display: flex; }
.emp-col { background: var(--surface); padding: 8px 10px !important; min-width: 210px; position: sticky; left: 0; z-index: 2; border-right: 2px solid var(--line) !important; text-align: left; }
thead .emp-col { z-index: 4; background: var(--surface-2); }
.emp-name { font-weight: 600; font-size: .86rem; display: flex; align-items: center; gap: 8px; }
.emp-meta { font-size: .7rem; color: var(--text-faint); font-family: var(--mono); }
.emp-load { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .72rem; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.emp-load .bar { flex: 1; max-width: 90px; height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; } .emp-load .bar i { display: block; height: 100%; background: var(--accent); }
.emp-col .row-act { display: none; gap: 2px; margin-top: 5px; } .emp-col:hover .row-act { display: flex; }
.gcell { min-width: 118px; height: 64px; padding: 3px !important; cursor: pointer; vertical-align: top; position: relative; transition: background var(--t-fast); }
.gcell:hover { background: var(--surface-2); } .gcell.weekend { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.gcell.focus { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; } .gcell.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.gcell .plus { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); opacity: 0; transition: opacity var(--t-fast); pointer-events: none; }
.gcell:hover .plus { opacity: .45; }
.shift { border-radius: 6px; padding: 4px 7px; margin-bottom: 3px; font-size: .76rem; line-height: 1.3; position: relative; color: #fff; font-weight: 600; box-shadow: var(--shadow-xs); transition: transform var(--t-fast), filter var(--t-fast); }
.shift:hover { filter: brightness(1.06); } .shift .h { font-family: var(--mono); font-size: .68rem; font-weight: 500; opacity: .9; display: block; }
.shift .st { font-size: .66rem; font-weight: 700; display: flex; align-items: center; gap: 3px; margin-top: 2px; opacity: .95; }
.shift .x { position: absolute; top: 2px; right: 3px; border: none; background: rgba(0,0,0,.18); color: inherit; width: 16px; height: 16px; min-height: 0; padding: 0; border-radius: 4px; font-size: .8rem; line-height: 1; opacity: 0; cursor: pointer; box-shadow: none; }
.shift:hover .x { opacity: 1; } .shift .x:hover { background: rgba(0,0,0,.35); }
.shift.pending { outline: 2px dashed rgba(255,255,255,.85); outline-offset: -2px; }
.shift.removed { opacity: .35; text-decoration: line-through; }
.sum-col { min-width: 90px; background: var(--surface-2); text-align: center; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-soft); padding: 8px !important; }
tfoot td { background: var(--surface-2); padding: 6px 4px !important; text-align: center; font-size: .72rem; color: var(--text-faint); font-weight: 600; position: sticky; bottom: 0; }

/* Leyenda de la rejilla y tarjeta de turno */
.tpl-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.tpl-card .sw { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; }
.tpl-card .n { font-weight: 700; } .tpl-card .m { font-size: .76rem; color: var(--text-faint); font-family: var(--mono); }
.tpl-card .acts { margin-left: auto; display: flex; gap: 4px; }

/* ══ Login ═══════════════════════════════════════════════════════ */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--ground); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--s6); width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s5); }
.login-brand span { font-size: 1.2rem; font-weight: 800; letter-spacing: -.02em; }

/* ══ Responsive ══════════════════════════════════════════════════ */
.mobile-only { display: none !important; }
.nav-ls { display: none; }
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--topbar-h) 1fr auto; }
  .topbar, .sidebar, .main { min-width: 0; max-width: 100vw; }
  .brand { min-width: 0; } .brand span { display: none; } .searchbtn { min-width: 0; } .searchbtn span, .searchbtn kbd { display: none; }
  .tenant { max-width: 200px; }
  .sidebar { grid-row: 3; flex-direction: row; border-right: none; border-top: 1px solid var(--line); overflow-x: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .nav-section, .sidebar-foot, .nav-item kbd { display: none; }
  .nav-item { flex-direction: column; gap: 3px; font-size: .64rem; padding: 6px 8px; min-width: 60px; min-height: 48px; justify-content: center; text-align: center; position: relative; }
  .nav-item .badge-count { position: absolute; top: 2px; right: 6px; margin: 0; }
  .main { grid-row: 2; } .page-head { padding: var(--s4) var(--s4) 0; } .content { padding: var(--s3) var(--s4) var(--s6); }
  .toolbar select, .toolbar input { width: 100%; min-width: 0; }
  .mobile-only { display: flex !important; }
  .grid-wrap { max-height: none; } table.grid { min-width: 0; } table.grid.one-day th.hide-m, table.grid.one-day td.hide-m { display: none; }
  table.grid.one-day { table-layout: fixed; } table.grid.one-day td, table.grid.one-day th { overflow: hidden; }
  .emp-col { width: 140px; min-width: 0; } .gcell { min-width: 0; height: auto; min-height: 56px; }
  .emp-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tenant .t-sub { display: none; }
  .searchbtn { padding: 8px; min-height: 36px; }
  .cuad-bar .palette { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
  .cuad-bar .tpl { flex-shrink: 0; }
  .week-label { min-width: 0; }
  .cuad-hint { display: none; }
  .nav-l { display: none; } .nav-ls { display: block; white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, 1fr); } .modal { max-width: none; } .kv { grid-template-columns: 100px 1fr; }
}
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } }

/* ══ Secciones: turnos, salarios y seguimiento ═══════════════════ */
.sw-lg { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; }
.sw-pick { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw-pick.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.tpl-item strong { font-size: .92rem; }
.sal-matrix { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sal-matrix th { font-weight: 600; color: var(--text-faint); padding: 1px 6px; text-align: left; font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; }
.sal-matrix td { padding: 1px 6px; text-align: right; color: var(--text-faint); min-width: 28px; font-size: .74rem; }
.sal-matrix td.has { color: var(--text); font-weight: 600; }
.sal-matrix td.cell { cursor: pointer; border-radius: 4px; }
/* Organizacion: los estilos .org-* estan al final del archivo. */
.rz-pill.principal { font-weight: 700; }

/* Cabecera de sociedad en la tabla de salarios (division por S.L.) */
.sal-cia td { background: var(--surface-2); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); padding: 8px 12px; border-top: 1px solid var(--line); }

/* Editor de semana completa: casillas de importe escribibles */
.sal-edit td { padding: 3px; }
.sal-edit input.sw-c { width: 74px; text-align: right; padding: 6px 8px; font-variant-numeric: tabular-nums; }
.sal-edit th { vertical-align: middle; font-size: .74rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.sal-matrix td.cell:hover, .sal-matrix td.cell:focus-visible { background: var(--accent-soft); color: var(--accent); outline: none; }
.vig-on td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.pill-check { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 5px; }
.dot.ok { background: #059669; } .dot.warn { background: #D97706; } .dot.err { background: #DC2626; } .dot.pend { background: #94A3B8; }
.pill.ok-soft { background: rgba(5, 150, 105, .12); color: #047857; }
.pill.warn-soft { background: rgba(217, 119, 6, .12); color: #B45309; }
/* 210 (empleado) + 7x150 se salia del ancho util y cortaba el domingo. Con
   los chips ya compactos caben los siete dias sin desplazar. */
.seg-grid .seg-cell { vertical-align: top; padding: 3px !important; min-width: 128px; }
.seg-grid .emp-col { min-width: 178px; }
.seg-chip { border-radius: 8px; padding: 5px 7px; margin-bottom: 3px; font-size: .74rem; background: var(--surface-2); border-left: 3px solid transparent; }
.seg-chip .sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.seg-chip.st-ok { border-left-color: #059669; background: rgba(5, 150, 105, .08); }
.seg-chip.st-warn { border-left-color: #D97706; background: rgba(217, 119, 6, .08); }
.seg-chip.st-err { border-left-color: #DC2626; background: rgba(220, 38, 38, .08); }
.seg-chip.st-pend { border-left-color: var(--line); }
/* Ajustado a mano: ni verde de "salio solo" ni rojo de problema. */
.seg-chip.st-adj { border-left-color: #2563EB; background: rgba(37, 99, 235, .08); }
.seg-imp { display: inline-block; margin-left: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Computa pero no genera importe: falta tarifa. Aviso, no error. */
/* Un importe 0 por falta de tarifa: el numero es correcto, la configuracion no. */
.warn-txt { color: #B45309; font-weight: 700; }
[data-theme="dark"] .warn-txt { color: #FBBF24; }
.seg-tarifa { margin-top: 3px; color: #B45309; font-weight: 600; font-size: .68rem; display: flex; align-items: center; gap: 3px; }
[data-theme="dark"] .seg-tarifa { color: #FBBF24; }
.seg-est { margin-top: 3px; color: var(--text-soft); font-size: .7rem; }
@media (max-width: 1023px) { .seg-grid .seg-cell { min-width: 120px; } .sal-matrix td { min-width: 22px; } }

/* ── Leyenda del Seguimiento ──────────────────────────────────────
   Una fila por estado, con la misma muestra de color que lleva la celda.
   Antes era una rejilla de píldoras dentro de un desplegable: había que
   abrirla para entender la pantalla, y las píldoras no se parecían a lo
   que pintaban las celdas. */
.leyenda {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.ley-item { display: flex; gap: 9px; align-items: flex-start; padding: 5px 0; }
.ley-sw {
  width: 4px;
  align-self: stretch;
  min-height: 30px;
  border-radius: 3px;
  flex: none;
  background: var(--line);
}
.ley-ok     .ley-sw { background: #059669; }
.ley-adj    .ley-sw { background: #2563EB; }
.ley-warn   .ley-sw { background: #D97706; }
.ley-err    .ley-sw { background: #DC2626; }
.ley-tarifa .ley-sw { background: repeating-linear-gradient(45deg, #D97706 0 4px, transparent 4px 8px); }
.ley-pend   .ley-sw { background: var(--line); }
.ley-t { font-size: .76rem; font-weight: 650; line-height: 1.3; }
.ley-d { font-size: .7rem; color: var(--muted); line-height: 1.35; }
.ley-no {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #B45309;
  background: rgba(217, 119, 6, .12);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 3px;
  vertical-align: 1px;
}
[data-theme="dark"] .ley-no { color: #FBBF24; background: rgba(251, 191, 36, .14); }
/* Una incidencia se puede resolver desde la propia rejilla. */
.seg-chip.seg-click { cursor: pointer; }
.seg-chip.seg-click:hover { filter: brightness(1.06); outline: 1px solid currentColor; outline-offset: -1px; }
.seg-chip.seg-click:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* La leyenda se aprende una vez; después estorba. Plegada por defecto. */
.leyenda-caja {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
}
.leyenda-caja > summary {
  cursor: pointer;
  padding: 9px 14px;
  font-size: .78rem;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  user-select: none;
}
.leyenda-caja > summary::-webkit-details-marker { display: none; }
.leyenda-caja > summary::after { content: '⌄'; margin-left: auto; opacity: .5; }
.leyenda-caja[open] > summary::after { content: '⌃'; }
.leyenda-caja > summary:hover { background: var(--surface-2); border-radius: 10px; }
.leyenda-caja .leyenda { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }

/* ── Marca de esquina en el Seguimiento ───────────────────────────
   Resume la celda sin leerla: aspa naranja = queda algo por hacer,
   tic verde = nada que hacer. Las jornadas sin calcular no llevan
   marca: no son un problema, pero tampoco están resueltas. */
.seg-chip { position: relative; padding-right: 20px; }
.seg-marca {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
  flex: none;
}
.seg-marca svg { width: 10px; height: 10px; stroke-width: 3.2; }
.seg-marca.ok { background: #059669; color: #fff; }
.seg-marca.aviso { background: #D97706; color: #fff; }
/* Lo pendiente late un poco: es lo único de la pantalla que pide una acción. */
.seg-chip.seg-click .seg-marca.aviso { box-shadow: 0 0 0 0 rgba(217, 119, 6, .5); animation: latido 2.4s ease-out infinite; }
@keyframes latido {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, .45); }
  70%  { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .seg-chip.seg-click .seg-marca.aviso { animation: none; }
}
[data-theme="dark"] .seg-marca.ok { background: #10B981; color: #06281D; }
[data-theme="dark"] .seg-marca.aviso { background: #F59E0B; color: #2E1A02; }

/* Secciones de turno: separan la paleta sin gritar. */
.tpl-sec { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tpl-sec + .tpl-sec { border-left: 1px solid var(--line); padding-left: 9px; margin-left: 3px; }
.tpl-sec-t {
  font-size: .62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin-right: 2px;
}
.sec-tit { font-size: .82rem; font-weight: 700; margin: 4px 0 8px; display: flex; gap: 6px; align-items: baseline; }

/* ── Organizacion: grupo, sociedades y establecimientos ───────────────
   Cada sociedad tiene un color (--soc, puesto en linea desde app.js) que
   se repite en su tarjeta, en la leyenda y en las pastillas de los locales
   donde opera: se ve de un vistazo quien esta en donde. */
.org-hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 22px 18px; box-shadow: var(--shadow-sm); margin-bottom: 8px; display: flex; flex-direction: column; gap: 16px; }
.org-hero::before { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 4px; background: linear-gradient(90deg, #2563EB, #7C3AED, #059669, #D97706, #DB2777, #0891B2); }
.org-hero-id { display: flex; gap: 14px; align-items: flex-start; }
.org-hero-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.org-hero-txt { min-width: 0; }
.org-hero-k { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); }
.org-hero-n { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; margin: 1px 0 5px; overflow-wrap: anywhere; }
.org-hero-t { margin: 0; color: var(--text-soft); font-size: .86rem; line-height: 1.5; max-width: 72ch; }
.org-hero-t strong { color: var(--text); }
.org-hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.org-kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.org-kpi-i { grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--accent); display: grid; place-items: center; }
.org-kpi-v { font-size: 1.32rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.org-kpi-k { font-size: .72rem; font-weight: 600; color: var(--text-faint); }
.org-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.org-sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--soc, var(--text-faint)); flex: none; }
button.org-legend-i { display: inline-flex; align-items: center; gap: 7px; min-height: 26px; padding: 2px 10px 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); box-shadow: none; font-size: .76rem; font-weight: 600; color: var(--text-soft); }
button.org-legend-i:hover:not(:disabled) { border-color: var(--soc); color: var(--text); background: color-mix(in srgb, var(--soc) 10%, var(--surface)); }

.org-sec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 24px 0 12px; }
.org-sec h2 { font-size: 1.02rem; margin: 0; display: inline-flex; align-items: center; gap: 7px; }
.org-sec-i { width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); color: var(--text-soft); display: grid; place-items: center; flex: none; }
.org-sec-n { font-size: .74rem; font-weight: 700; color: var(--text-faint); background: var(--surface-2); border-radius: 99px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.org-sec-h { font-size: .8rem; color: var(--text-faint); }

.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.org-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; transition: box-shadow var(--t-fast), border-color var(--t-fast); }
.org-card:hover { box-shadow: var(--shadow); }
.org-card.org-flash { border-color: var(--soc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--soc) 40%, transparent), var(--shadow); }
.org-card-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: .8rem; color: var(--text-soft); }
.org-fact, .org-facts span { display: inline-flex; align-items: center; gap: 5px; }
.org-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-soft); }

/* Sociedad: avatar con la inicial en su color y los locales donde esta. */
.org-soc { border-top: 4px solid var(--soc); }
.org-soc-head { display: flex; align-items: center; gap: 12px; }
.org-avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--soc); color: #fff; font-weight: 800; font-size: 1.1rem; display: grid; place-items: center; flex: none; }
.org-soc-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.org-soc-t strong { font-size: .98rem; line-height: 1.25; overflow-wrap: anywhere; }
.org-count { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--soc); background: color-mix(in srgb, var(--soc) 12%, var(--surface)); padding: 3px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.org-locs { display: flex; flex-wrap: wrap; gap: 6px; }
button.org-loc { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 9px 2px 7px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); box-shadow: none; font-size: .78rem; font-weight: 600; color: var(--text-soft); }
button.org-loc:hover:not(:disabled) { color: var(--text); border-color: var(--text-faint); background: var(--surface-2); }
button.org-loc.due { border-color: color-mix(in srgb, var(--soc) 45%, var(--line)); background: color-mix(in srgb, var(--soc) 10%, var(--surface)); color: var(--text); }
button.org-loc em { font-style: normal; font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--soc); }

/* Establecimiento: franja con los colores de las sociedades que operan,
   la dueña en pastilla solida y las demas en pastilla suave con su ×. */
.org-est { padding-top: 19px; }
.org-est.inactivo { opacity: .62; }
.org-stripe { position: absolute; left: 0; top: 0; width: 100%; height: 5px; display: flex; }
.org-stripe i { flex: 1; display: block; }
.org-est-head { display: flex; align-items: flex-start; gap: 12px; }
.org-est-ico { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--soc) 14%, var(--surface)); color: var(--soc); display: grid; place-items: center; flex: none; }
.org-est-t { min-width: 0; flex: 1; }
.org-est-t a { font-weight: 800; font-size: .98rem; color: var(--text); overflow-wrap: anywhere; }
.org-est-t a:hover { color: var(--accent); }
.org-est-socs { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: start; }
.org-lbl { font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); padding-top: 7px; }
.org-pills { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 26px; }
.org-est .rz-pill { gap: 6px; padding: 2px 8px 2px 7px; color: var(--soc); background: color-mix(in srgb, var(--soc) 11%, var(--surface)); border: 1px solid color-mix(in srgb, var(--soc) 32%, transparent); }
.org-est .rz-pill.principal { color: #fff; background: var(--soc); border-color: var(--soc); }
.org-est .rz-pill.principal .org-sw { background: rgba(255, 255, 255, .75); }
button.org-x { min-height: auto; width: 16px; height: 16px; padding: 0; margin: 0 -3px 0 1px; border: none; border-radius: 99px; background: none; box-shadow: none; color: inherit; opacity: .7; display: inline-grid; place-items: center; }
button.org-x:hover:not(:disabled) { opacity: 1; background: color-mix(in srgb, var(--soc) 22%, transparent); color: inherit; }
button.org-add { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 9px 2px 7px; border-radius: 99px; border: 1px dashed var(--line); background: none; box-shadow: none; font-size: .76rem; font-weight: 600; color: var(--text-faint); }
button.org-add:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .org-est .rz-pill, :root:not([data-theme="light"]) .org-count,
  :root:not([data-theme="light"]) button.org-loc em { color: color-mix(in srgb, var(--soc) 68%, #fff); }
  :root:not([data-theme="light"]) .org-est .rz-pill.principal { color: #fff; }
}
:root[data-theme="dark"] .org-est .rz-pill, :root[data-theme="dark"] .org-count,
:root[data-theme="dark"] button.org-loc em { color: color-mix(in srgb, var(--soc) 68%, #fff); }
:root[data-theme="dark"] .org-est .rz-pill.principal { color: #fff; }
@media (max-width: 560px) {
  .org-hero { padding: 18px 16px 14px; }
  .org-est-socs { grid-template-columns: 1fr; gap: 4px; }
  .org-est-socs .org-lbl + .org-pills { margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { .org-card { transition: none; } }

/* ── Cuadrante económico (personas × días) ───────────────────────── */
.mat-wrap { overflow: auto; max-height: 70vh; }
.mat th, .mat td { white-space: nowrap; }
.mat .mat-fijo { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 200px; box-shadow: 1px 0 0 var(--border); }
.mat thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mat thead th.mat-fijo { z-index: 3; }
.mat .mat-finde { background: var(--surface-2); }
.mat .mat-est { font-style: italic; color: var(--text-muted); }
.mat .mat-vacio { color: var(--text-faint); }
.mat .mat-total { border-left: 2px solid var(--border); }
.mat tr.mat-cia td { background: var(--surface-2); font-weight: 700; font-size: .8rem; }
.mat tr.mat-sub td, .mat tfoot td { font-weight: 600; background: var(--surface-2); }

/* Celda bloqueada: el turno seleccionado lo paga una sociedad con la que la persona no tiene contrato. */
.gcell.bloq { cursor: not-allowed; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--danger, #dc2626) 10%, transparent) 6px 8px); }
.gcell.bloq:hover { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--danger, #dc2626) 18%, transparent) 6px 8px); }
.gcell.bloq .plus { display: none; }

/* ══ Salarios (rediseño): resumen, una fila por persona con tira semanal ══
   El salario es por establecimiento: tarifa por dia y franja, o fijo mensual.
   Todo lo de esta pantalla lleva prefijo .sal- */
.sal-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
button.sal-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; white-space: normal; min-width: 0; min-height: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); font-weight: 500; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
button.sal-stat:hover:not(:disabled) { background: var(--surface); border-color: var(--text-faint); box-shadow: var(--shadow); }
button.sal-stat.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.sal-stat .k { font-size: .72rem; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.sal-stat .v { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; color: var(--text); }
.sal-stat .d { font-size: .74rem; color: var(--text-faint); }
.sal-stat.alerta .v { color: var(--warn); }
.sal-stat.alerta { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 55%, var(--surface)); }

.sal-bar { display: flex; align-items: center; gap: var(--s3); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.sal-todos { padding: 4px 6px; }
.sal-buscar { display: flex; align-items: center; gap: 6px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text-faint); }
.sal-buscar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.sal-buscar input[type=search] { border: none; box-shadow: none; background: none; min-height: 30px; width: 190px; padding: 0; }
.sal-buscar input[type=search]:focus { border: none; box-shadow: none; outline: none; }
.sal-filtros button { white-space: nowrap; }
.sal-lote { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sal-lote #selInfo { margin-right: 6px; white-space: nowrap; }
.sal-leyenda { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 14px; font-size: .72rem; color: var(--text-faint); border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.sal-leyenda > span { display: inline-flex; align-items: center; gap: 5px; }
.sal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; margin-right: 5px; vertical-align: middle; background: var(--text-faint); }
.sal-dot.tarde { background: var(--tarde); } .sal-dot.noche { background: var(--noche); }

/* Una fila por persona: seleccion | quien | tira semanal | fijo | acciones */
.sal-person { display: grid; grid-template-columns: 28px minmax(170px, 1fr) auto minmax(130px, 160px) auto; align-items: center; gap: var(--s4); padding: 10px 14px; border-bottom: 1px solid var(--line-soft); transition: background var(--t-fast); }
.sal-person:last-child { border-bottom: none; }
.sal-person:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.sal-person.sel { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.sal-person.sin { box-shadow: inset 3px 0 0 var(--warn); }
.sal-person[hidden], .sal-nada[hidden] { display: none; }
.sal-sel { display: grid; place-items: center; cursor: pointer; }
.sal-sel input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.sal-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sal-who-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sal-nom { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sal-meta { font-size: .7rem; color: var(--text-faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sal-aviso { margin-top: 2px; align-self: flex-start; font-size: .68rem; padding: 1px 7px; }

/* La tira semanal: 7 dias x 2 franjas, con color segun importe */
.sal-tira { border-collapse: separate; border-spacing: 3px 2px; margin: -2px -3px; }
.sal-tira th { padding: 0 4px; font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); text-align: center; font-weight: 700; }
.sal-tira th.finde { color: var(--text-soft); }
.sal-tira th.sal-fr { text-align: left; text-transform: none; letter-spacing: 0; font-size: .7rem; padding-right: 8px; white-space: nowrap; }
.sal-tira td.cell { min-width: 38px; height: 26px; padding: 0 5px; text-align: center; font-size: .76rem; font-weight: 600; color: var(--text-faint); background: var(--surface-2); border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-variant-numeric: tabular-nums; transition: transform var(--t-fast), box-shadow var(--t-fast); }
.sal-tira td.cell.has { color: var(--text); }
.sal-tira td.cell.finde:not(.has) { background: color-mix(in srgb, var(--surface-3) 70%, var(--surface-2)); }
.sal-tira td.cell:hover, .sal-tira td.cell:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--ring); transform: translateY(-1px); }

.sal-fijo { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; border-radius: var(--r); border: 1px dashed var(--line); min-width: 0; }
.sal-fijo.has { border-style: solid; border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok-soft) 60%, var(--surface)); }
.sal-fijo-k { font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.sal-fijo strong { font-size: .92rem; font-variant-numeric: tabular-nums; color: var(--text); }
.sal-fijo.has strong { color: var(--ok); }
.sal-fijo-d { font-size: .68rem; color: var(--text-faint); font-family: var(--mono); }
.sal-fijo-no { font-size: .78rem; color: var(--text-faint); }
.sal-acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.sal-acts button { white-space: nowrap; }
button.sal-semana { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
button.sal-semana:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: var(--accent); color: var(--accent); }
.sal-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; max-height: 96px; overflow: auto; }
.sal-dias-atajos { display: flex; gap: 2px; margin-top: 4px; flex-wrap: wrap; }
.sal-dias-atajos button { font-size: .72rem; min-height: 24px; padding: 2px 7px; color: var(--accent); }

/* Editor de la semana: rejilla grande, casillas cambiadas marcadas */
.sal-ed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sal-ed-head .avatar { width: 36px; height: 36px; font-size: .82rem; }
.sal-ed-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: var(--surface); }
.sal-edit { width: 100%; border-collapse: separate; border-spacing: 4px; }
.sal-edit th { text-align: center; font-size: .74rem; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text-faint); padding: 2px 0 4px; }
.sal-edit th.finde { color: var(--noche); }
.sal-edit th.sal-ed-corner { text-align: left; text-transform: none; letter-spacing: 0; font-size: .74rem; }
.sal-edit th.sal-ed-fr { text-align: left; text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--text); font-weight: 700; padding: 0 8px 0 4px; vertical-align: middle; white-space: nowrap; }
.sal-edit input.sw-fila { display: block; width: 118px; margin-top: 4px; font-size: .74rem; font-weight: 500; padding: 4px 7px; min-height: 26px; }
.sal-edit td { padding: 0; vertical-align: middle; border-radius: var(--r-sm); background: none; }
.sal-edit input.sw-c { width: 100%; min-width: 54px; text-align: center; font-weight: 700; font-size: .95rem; padding: 10px 4px; font-variant-numeric: tabular-nums; }
.sal-edit input.sw-c::placeholder { font-weight: 400; color: var(--text-faint); }
.sal-edit input[type=number], .sal-fijo-in input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.sal-edit input::-webkit-inner-spin-button, .sal-edit input::-webkit-outer-spin-button, .sal-fijo-in input::-webkit-inner-spin-button, .sal-fijo-in input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sal-edit td.chg input.sw-c, .sal-fijo-in.chg input { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sal-ed-hint { font-size: .76rem; color: var(--text-faint); margin: 8px 0 12px; }
.sal-ed-chg { display: inline-block; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sal-ed-foot { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.sal-ed-foot .field { margin-bottom: 0; }
.sal-fijo-in { display: flex; align-items: center; gap: 8px; }
.sal-fijo-in input { max-width: 170px; font-weight: 700; }
.sal-fijo-in span { font-size: .8rem; color: var(--text-faint); white-space: nowrap; }

/* Historico de una casilla y vigencias */
.sal-hist { margin-top: 12px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.sal-hist-t { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; margin-bottom: 6px; }
.sal-hist-r { display: flex; align-items: center; gap: 10px; font-size: .8rem; padding: 4px 8px; border-radius: var(--r-sm); color: var(--text-soft); }
.sal-hist-r.on { background: var(--surface-2); color: var(--text); }
.sal-hist-r strong { min-width: 70px; font-variant-numeric: tabular-nums; }
.sal-vig-add { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); margin-bottom: 12px; }
.sal-vig-add summary { cursor: pointer; padding: 10px 14px; font-size: .84rem; font-weight: 600; display: flex; align-items: center; gap: 6px; list-style: none; }
.sal-vig-add summary::-webkit-details-marker { display: none; }
.sal-vig-add summary:hover { color: var(--accent); }
.sal-vig-add[open] summary { border-bottom: 1px solid var(--line-soft); }
.sal-vig-add-b { padding: 12px 14px 10px; }
.sal-vig-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.sal-vig td:first-child { white-space: nowrap; color: var(--text); }
.sal-vig button { font-family: var(--font); }
.sal-vig tr.vig-on td { background: color-mix(in srgb, var(--ok-soft) 55%, transparent); }

@media (max-width: 1100px) {
  .sal-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sal-person { grid-template-columns: 28px 1fr auto; grid-template-areas: "sel who fijo" "sel strip strip" "sel acts acts"; gap: 8px var(--s3); }
  .sal-sel { grid-area: sel; align-self: start; padding-top: 8px; }
  .sal-who { grid-area: who; } .sal-fijo { grid-area: fijo; } .sal-strip { grid-area: strip; overflow-x: auto; } .sal-acts { grid-area: acts; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .sal-stats { gap: 8px; }
  button.sal-stat { padding: 10px 12px; } .sal-stat .v { font-size: 1.3rem; }
  .sal-bar { gap: 8px; padding: 8px 12px; } .sal-buscar { flex: 1; } .sal-buscar input[type=search] { width: 100%; }
  .sal-filtros { width: 100%; } .sal-filtros button { flex: 1; padding: 4px 6px; }
  .sal-lote { width: 100%; } .sal-lote #selInfo { flex: 1; }
  .sal-leyenda { display: none; }
  .sal-person { padding: 10px 12px; grid-template-areas: "sel who fijo" "strip strip strip" "acts acts acts"; }
  .sal-fijo { padding: 4px 8px; } .sal-fijo strong { font-size: .84rem; }
  .sal-tira td.cell { min-width: 32px; height: 24px; font-size: .7rem; padding: 0 3px; }
  .sal-ed-foot { grid-template-columns: 1fr; }
  .sal-edit input.sw-fila { width: 110px; }
}
@media (prefers-reduced-motion: reduce) { .sal-tira td.cell, button.sal-stat, .sal-person { transition: none; } .sal-tira td.cell:hover { transform: none; } }

/* ── Vacaciones y extras de salario ─────────────────────────────── */
.shift.vac { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.28) 0 5px, transparent 5px 11px); }
.shift .vac-tag { font-size: .64rem; opacity: .95; }
.tpl.vac { border-style: dashed; }
.tpl.vac.on { border-color: #0EA5E9; border-style: solid; background: rgba(14, 165, 233, .1); box-shadow: 0 0 0 3px rgba(14, 165, 233, .22); }
.extra-pill { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 99px; background: rgba(5, 150, 105, .14); color: #047857; font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 2px 0 0; cursor: pointer; white-space: nowrap; }
.extra-pill.neg { background: rgba(220, 38, 38, .12); color: #B91C1C; }
.extra-pill:hover { filter: brightness(.95); text-decoration: line-through; }
.seg-chip.st-vac { border-left-color: #0EA5E9; background: rgba(14, 165, 233, .09); }
.dot.vac { background: #0EA5E9; }
.ley-vac .ley-sw { background: #0EA5E9; }
.seg-extras { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 2px; min-height: 18px; }
.seg-extras .extra-add { opacity: 0; padding: 0 6px; min-height: 0; height: 18px; font-size: .66rem; }
.seg-cell:hover .extra-add, .seg-extras .extra-add:focus-visible { opacity: 1; }
.mat .mat-vac { background: rgba(14, 165, 233, .12); }
.mat .mat-extra { background: rgba(5, 150, 105, .12); }
.tpl.sin-cia { border-color: #D97706; border-style: dashed; }
select.falta { border-color: #D97706; }
.punch-pill { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 99px; background: rgba(217, 119, 6, .14); color: #B45309; font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 2px 0 0; cursor: pointer; white-space: nowrap; }
.punch-pill:hover { filter: brightness(.95); }

/* ── Revisar la importacion: rejilla semanal ─────────────────────── */
.modal.xwide { max-width: min(1180px, 96vw); }
.imp-wrap { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.imp-grid { min-width: 860px; }
.imp-grid th { position: sticky; top: 0; z-index: 2; }
.imp-grid td { vertical-align: top; padding: 6px; min-width: 96px; }
.imp-grid td.emp-col { min-width: 190px; font-weight: 600; }
.imp-grid td.weekend, .imp-grid th.weekend { background: var(--surface-2); }
.imp-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 3px 2px 0; padding: 3px 8px; border-radius: 6px; font-size: .74rem; font-weight: 700; line-height: 1.3; border: 1px solid transparent; --c: #64748B; }
.imp-chip.add { background: var(--c); color: #fff; box-shadow: var(--shadow-xs); }
.imp-chip.del { background: rgba(220, 38, 38, .1); color: #B91C1C; border-color: rgba(220, 38, 38, .35); text-decoration: line-through; }
.imp-chip.keep { background: var(--surface-3); color: var(--text-soft); font-weight: 500; border-left: 3px solid var(--c); }
.imp-chip.err { background: rgba(217, 119, 6, .12); color: #B45309; border-color: rgba(217, 119, 6, .4); font-weight: 600; white-space: nowrap; }
.imp-aviso { color: #B45309; margin-top: 2px; }
.imp-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 10px; font-size: .78rem; color: var(--text-soft); }
.imp-leyenda .imp-chip { margin: 0 2px 0 8px; }
.imp-leyenda .imp-chip:first-child { margin-left: 0; }
.imp-errores { margin-top: 12px; }
.imp-errores summary { cursor: pointer; font-weight: 600; font-size: .84rem; display: flex; align-items: center; gap: 6px; }
.mat .mat-inc { background: rgba(220, 38, 38, .10); color: #B91C1C; }
.mat-marca { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; font-size: .62rem; font-weight: 800; margin-right: 4px; vertical-align: middle; }
.mat-marca.si { background: rgba(5, 150, 105, .16); color: #047857; }
.mat-marca.no { background: rgba(220, 38, 38, .16); color: #B91C1C; }
.mat-marca.mix { background: rgba(217, 119, 6, .18); color: #B45309; }
.mat-resumen { margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ok-txt { color: #047857; font-weight: 600; } .danger-txt { color: #B91C1C; font-weight: 600; }
