/* Turno — sistema visual tomado del documento "Turno — Sistema de puestos".
   Tablet del puesto: oscuro. Administración: claro con barra superior oscura. */
:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --amber: #F5A524; --amber-hover: #FFB534; --amber-ink: #1B1306;
  --teal: #1F8F84;

  /* Administración */
  --bg: #F3F3F1; --card: #FFFFFF; --line: #E7E5E0; --line-2: #EFEDE9; --ink: #18191B; --ink-2: #3B3D41; --muted: #6B6E73;
  --nav: #17181B; --nav-hi: #2A2C31; --nav-ink: #D9DADC;
  --ok-t: #1E7A4C; --ok-bg: #E3F4EA; --ok-bar: #23A26A;
  --bad-t: #B3261E; --bad-bg: #FCEBEA; --bad-line: #F3C9C6; --bad-bar: #D2392F;
  --warn-t: #8A5A00; --warn-bg: #FDF3DC; --warn-line: #F2DFAE;
  --info-t: #2B4FB3; --info-bg: #E8EEFC; --info-line: #C9D6F7;
  --pur-t: #7B3FC4; --pur-bg: #F0E8FC;
  --gray-t: #4A4C50; --gray-bg: #EDEDEB;
  --row-hi: #FAF6EC;

  /* Tablet */
  --d-bg: #121316; --d-panel: #17191C; --d-card: #1C1F23; --d-card-2: #22262B; --d-line: #2C3036; --d-line-2: #353A41;
  --d-ink: #F2F2F0; --d-muted: #9AA0A8; --d-faint: #6D737B;
  --d-ok: #4FD18B; --d-ok-bg: #173826; --d-ok-line: #2C6E49;
  --d-bad: #FF8A80; --d-bad-bg: #3A1919; --d-bad-line: #7A2E2E;
  --d-warn: #F5C25A; --d-warn-bg: #3A2C10;
  --d-blue: #7FA6F8;

  --r: 12px; --r-sm: 8px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
.mono, .num { font-family: var(--mono); font-feature-settings: 'tnum'; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ───────── Botones comunes ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: #CFCCC6; background: #FBFAF8; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover:not(:disabled) { background: #2D2F33; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn.amber:hover:not(:disabled) { background: var(--amber-hover); }
.btn.danger { color: var(--bad-t); border-color: var(--bad-line); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.link { background: none; border: 0; padding: 0; font-weight: 600; color: #8A5A00; text-decoration: underline; text-underline-offset: 3px; }

/* ───────── Administración ───────── */
.topbar { background: var(--nav); color: #fff; height: 66px; display: flex; align-items: center; gap: 24px; padding: 0 max(16px, calc((100vw - 1290px) / 2)); position: sticky; top: 0; z-index: 20; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: #fff; text-decoration: none; flex: none; }
.logo .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--amber); color: var(--nav); display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 10px 14px; border-radius: 9px; color: var(--nav-ink); text-decoration: none; font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.nav a:hover { color: #fff; background: #222428; }
.nav a.on { background: var(--nav-hi); color: #fff; font-weight: 600; }
.who { position: relative; flex: none; }
.who > button { background: none; border: 0; color: var(--nav-ink); font-size: 14px; padding: 8px 4px; }
.who > button b { color: #fff; font-weight: 500; }
.menu { position: absolute; right: 0; top: 44px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); min-width: 220px; padding: 6px; z-index: 30; }
.menu button, .menu a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--bg); }
.menu .meta { padding: 8px 12px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; font-size: 12.5px; color: var(--muted); }

.page { max-width: 1322px; margin: 0 auto; padding: 28px 16px 64px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.head h1 { font-size: 32px; letter-spacing: -0.02em; margin: 0 0 4px; line-height: 1.1; }
.head p { margin: 0; color: var(--muted); font-size: 15px; max-width: 760px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 8px; }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok-bar); box-shadow: 0 0 0 3px rgba(35,162,106,.15); }
.live.off::before { background: #A3A6AA; box-shadow: none; }

.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.seg button:hover { background: var(--bg); }
.seg button.on { background: var(--ink); color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 16px; font-weight: 600; font-size: 14px; text-align: left; line-height: 1.25; }
.chip small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on small { color: #C9CACD; }
.chip.round { border-radius: 999px; padding: 7px 14px; font-weight: 500; }

.grid { display: grid; gap: 16px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 18px 16px; min-width: 0; }
.kpi .l { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.kpi .v { font-family: var(--mono); font-size: 26px; font-weight: 500; margin: 6px 0 4px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v.text { font-family: var(--font); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 10px 0 6px; }
.kpi .s { color: var(--muted); font-size: 12.5px; }
.up { color: var(--ok-t); font-weight: 600; } .down { color: var(--bad-t); font-weight: 600; }
.red { color: var(--bad-t); } .yellow { color: var(--warn-t); } .green { color: var(--ok-t); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; min-width: 0; }
.card h2 { font-size: 21px; margin: 0; letter-spacing: -0.01em; }
.card h3 { font-size: 17px; margin: 0; }
.card .ch { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card .hint { color: var(--muted); font-size: 12.5px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.foot { color: var(--muted); font-size: 13px; margin-top: 18px; }
.cols-main { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 336px; align-items: start; }
.cols-2 { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; }
@media (max-width: 1080px) { .cols-main, .cols-2 { grid-template-columns: 1fr; } }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13px; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; } .t .c { text-align: center; }
.t td.num, .t td .num { font-family: var(--mono); white-space: nowrap; }
.t .sub { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.t td b { font-weight: 600; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: #FBFAF7; }
.t tbody tr.sel td { background: var(--row-hi); }
.t tr.strong td { font-weight: 600; background: #F7F7F4; }
.t tr.total td { font-weight: 700; background: var(--ok-bg); }
.t td.ind { padding-left: 24px; }
.t td .q { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok-t); }
.b-bad { background: var(--bad-bg); color: var(--bad-t); }
.b-warn { background: var(--warn-bg); color: var(--warn-t); }
.b-info { background: var(--info-bg); color: var(--info-t); }
.b-pur { background: var(--pur-bg); color: var(--pur-t); }
.b-gray { background: var(--gray-bg); color: var(--gray-t); }

.note { border-radius: 12px; padding: 12px 14px; border: 1px solid; font-size: 13.5px; }
.note b { display: block; font-size: 15px; margin-bottom: 2px; }
.note.bad { background: var(--bad-bg); border-color: var(--bad-line); color: #5A1712; }
.note.bad b { color: var(--ink); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #5A3D00; }
.note.info { background: var(--info-bg); border-color: var(--info-line); color: #1E2F66; }
.note.ok { background: var(--ok-bg); border-color: #BFE5CF; color: #134D30; }
.notes { display: grid; gap: 10px; }
.finding b { font-size: 18px; }
.finding { font-size: 15px; padding: 14px 16px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 600; text-align: right; }

.bar { height: 8px; background: #EEEDEA; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--ok-bar); }
.bar.bad > i { background: var(--bad-bar); }
.bar.warn > i { background: var(--amber); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Gráfica de barras apiladas */
.chart { position: relative; touch-action: pan-y; display: flex; align-items: flex-end; gap: clamp(6px, 2vw, 22px); height: 280px; padding: 30px 0 0; border-bottom: 1px solid var(--line); }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; position: relative; }
.chart .stackbar { width: min(56px, 80%); display: flex; flex-direction: column-reverse; gap: 2px; }
.chart .stackbar i { display: block; border-radius: 3px; min-height: 0; transition: height .4s ease; }
.chart .col { cursor: default; }
.chart .col::before { content: ''; position: absolute; inset: 0 -6px; border-radius: 8px; background: transparent; transition: background .15s; }
.chart.hovering .col.on::before { background: rgba(24,25,27,.045); }
.chart .stackbar, .chart .val { position: relative; transition: opacity .15s; }
.chart.hovering .col:not(.on) .stackbar, .chart.hovering .col:not(.on) .val { opacity: .35; }
.chart .tip { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; min-width: 210px; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px 10px; box-shadow: 0 12px 28px rgba(0,0,0,.22); font-size: 13px; }
.chart .tip[hidden] { display: none; }
.chart .tip .tt { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.chart .tip .tr { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: rgba(255,255,255,.78); }
.chart .tip .tr i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart .tip .tr span { flex: 1; white-space: nowrap; }
.chart .tip .tr b { font-family: var(--mono); font-weight: 600; color: #fff; }
.chart .tip .tr em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: rgba(255,255,255,.55); width: 34px; text-align: right; }
.chart .tip .tr.hl { color: #fff; font-weight: 600; }
.chart .tip .tr.total { border-top: 1px solid rgba(255,255,255,.16); margin-top: 6px; padding-top: 8px; color: #fff; font-weight: 700; }
.chart .tip .tr.total b { font-size: 14.5px; font-weight: 700; margin-right: 42px; }
.chart .tip .tn { margin-top: 6px; font-size: 12px; color: rgba(255,255,255,.6); }
.chart .tip .tn.up { color: #6FD3A0; } .chart .tip .tn.down { color: #FF9C8F; }
.chart .val { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px; white-space: nowrap; }
.chart-x { display: flex; gap: clamp(6px, 2vw, 22px); padding-top: 8px; }
.chart-x span { flex: 1; text-align: center; color: var(--muted); font-size: 12px; font-family: var(--mono); min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend i, .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.split { display: flex; height: 44px; border-radius: 10px; overflow: hidden; }
.split > div { display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 600; color: #fff; min-width: 0; overflow: hidden; }

/* Asistencia */
.cal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 14px 0 16px; }
.cal div { border-radius: 8px; padding: 7px 6px; font-size: 12px; line-height: 1.35; min-height: 52px; }
.cal small { display: block; opacity: .8; }
.cal b { font-weight: 600; font-size: 12px; }
.cal .tiempo { background: var(--ok-bg); color: var(--ok-t); }
.cal .tarde { background: var(--warn-bg); color: var(--warn-t); }
.cal .descanso { background: var(--gray-bg); color: var(--gray-t); }
.cal .falta { background: var(--bad-bg); color: var(--bad-t); }
.cal .futuro, .cal .na { background: #F7F7F5; color: #A3A6AA; }

.feed-item { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .badge { justify-content: center; width: 96px; border-radius: 6px; align-self: start; padding: 5px 8px; }
.feed-item b { display: block; font-weight: 600; line-height: 1.3; }
.feed-item small { color: var(--muted); }

.box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.box + .box { margin-top: 10px; }
.box .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 4px; }
.box .top b { font-size: 15px; }
.box p { margin: 2px 0; color: var(--ink-2); font-size: 14px; }
.box p.m { color: var(--muted); }

.dark-card { background: var(--nav); color: #fff; border-color: var(--nav); }
.dark-card .v { font-family: var(--mono); font-size: 28px; margin: 6px 0 8px; }
.dark-card p { color: #C9CACD; margin: 0; font-size: 13.5px; }

.check { width: 26px; height: 26px; border-radius: 7px; border: 0; background: var(--ink); color: #fff; display: inline-grid; place-items: center; }
.check.off { background: #fff; border: 1.5px solid #C9C6C0; color: transparent; }

/* Formularios */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
.in { height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; width: 100%; font-size: 15px; }
.in:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(24,25,27,.08); }
textarea.in { height: auto; padding: 10px 12px; min-height: 76px; resize: vertical; }
.in.num { font-family: var(--mono); }
.in.sm { height: 34px; font-size: 14px; padding: 0 10px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }
.row2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 1fr 120px 36px; gap: 8px; align-items: center; }
.x { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 18px; line-height: 1; }
.x:hover { color: var(--bad-t); border-color: var(--bad-line); }

/* Modal */
.overlay.dk { background: rgba(0,0,0,.62); color: var(--d-ink); }
.overlay { position: fixed; inset: 0; background: rgba(15, 16, 18, .5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s ease; }
.modal { background: #fff; color: var(--ink); border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,.25); animation: pop .18s ease; }
.modal.wide { width: min(760px, 100%); }
.modal header { padding: 20px 22px 6px; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.modal header h3 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.modal header p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.modal .mb { padding: 14px 22px; overflow-y: auto; }
.modal footer { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal .close { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 9px; font-size: 18px; flex: none; color: var(--muted); }
.modal .err { color: var(--bad-t); font-size: 13.5px; font-weight: 500; margin-right: auto; align-self: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(440px, calc(100vw - 32px)); }
.toast { background: #17181B; color: #fff; padding: 13px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; display: flex; gap: 10px; align-items: center; animation: pop .2s ease; }
.toast.ok::before { content: '✓'; color: var(--d-ok); font-weight: 700; }
.toast.err { background: #4A1512; }
.toast.err::before { content: '!'; width: 20px; height: 20px; border-radius: 50%; background: var(--d-bad); color: #4A1512; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 13px; }

/* ───────── Tablet del puesto (oscuro) ───────── */
.pos { background: var(--d-bg); color: var(--d-ink); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pos .btn, .dk .btn { background: var(--d-card); color: var(--d-ink); border-color: var(--d-line-2); }
.pos .btn:hover:not(:disabled), .dk .btn:hover:not(:disabled) { background: var(--d-card-2); border-color: #444A52; }
.pos .btn.amber, .dk .btn.amber { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.pos .btn.amber:hover:not(:disabled), .dk .btn.amber:hover:not(:disabled) { background: var(--amber-hover); }
.pos .btn.warn, .dk .btn.warn { background: var(--d-warn-bg); color: var(--d-warn); border-color: #6B5320; }
.pos .btn.warn::before, .dk .btn.warn::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--d-warn); animation: pulse 1.6s infinite; }
.pos .btn.big, .dk .btn.big { height: 58px; font-size: 18px; border-radius: 12px; }
.pos .btn.mid, .dk .btn.mid { height: 50px; font-size: 16px; border-radius: 12px; }
.pos .btn:disabled, .dk .btn:disabled { opacity: 1; background: #2A2D33; color: #6F757D; border-color: #2A2D33; }
@keyframes pulse { 50% { opacity: .35; } }

.pbar { height: 66px; display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--d-line); flex: none; }
.pbar .logo { color: var(--d-ink); }
.pbar .brands { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--d-line-2); border-radius: 12px; background: var(--d-panel); }
.pbar .brands button { border: 0; background: none; color: var(--d-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; border: 1px solid transparent; }
.pbar .brands button:not(.on) { background: var(--d-card); border-color: var(--d-line); }
.pbar .brands button.on { background: var(--amber); color: var(--amber-ink); }
.pbar .brands button:disabled { opacity: .45; }
.pbar .info { margin-left: auto; text-align: right; line-height: 1.3; }
.pbar .info b { font-weight: 600; font-size: 14px; }
.pbar .info small { display: block; color: var(--d-muted); font-size: 12.5px; }
.pbar .back { width: 44px; height: 44px; border-radius: 11px; border: 1px solid var(--d-line-2); background: var(--d-card); color: var(--d-ink); display: grid; place-items: center; flex: none; transition: background .15s, color .15s, border-color .15s; }
.pbar .back:hover { background: #fff; color: #000; border-color: #fff; }
.pbar h1 { font-size: 21px; margin: 0; letter-spacing: -0.01em; }
.pbar .ttl small { display: block; color: var(--d-muted); font-size: 12.5px; }
.pbar .pill { margin-left: auto; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--d-warn-bg); color: var(--d-warn); white-space: nowrap; }
.pill.ok { background: var(--d-ok-bg); color: var(--d-ok); }
.pill.bad { background: var(--d-bad-bg); color: var(--d-bad); }
.pbar .acts { display: flex; gap: 8px; }
.pbar .icon-btn { width: 44px; padding: 0; }

/* Caja: altura fija a la pantalla; solo se desplazan productos y orden, el total queda siempre visible. */
.pos.caja { height: 100vh; height: 100dvh; overflow: hidden; }
.pos-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 0; }
.pos-left { padding: 20px 24px; overflow-y: auto; position: relative; }
.pos-right { border-left: 1px solid var(--d-line); background: var(--d-panel); display: flex; flex-direction: column; min-height: 0; }
.cats { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.cats button { height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--d-line-2); background: var(--d-card); color: var(--d-ink); font-weight: 600; font-size: 15px; }
.cats button.on { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.prod { height: 112px; border-radius: 12px; border: 1px solid var(--d-line-2); background: var(--d-card); color: var(--d-ink); text-align: left; padding: 16px 18px; display: flex; flex-direction: column; justify-content: space-between; position: relative; transition: background .1s, transform .05s; }
.prod { transition: background .25s ease, border-color .25s ease, transform .25s cubic-bezier(.2,.7,.3,1); will-change: transform; }
@media (hover: hover) { .prod:hover { background: var(--d-card-2); border-color: #3A3F46; transform: scale(1.025); } }
.prod:active { transform: scale(.985); }
.prod.pop { animation: prod-pop .32s cubic-bezier(.2,.7,.3,1); }
@keyframes prod-pop { 0% { transform: scale(1); } 40% { transform: scale(1.035); } 100% { transform: scale(1); } }
@media (hover: hover) { .prod.pop { animation-name: prod-pop-h; } }
@keyframes prod-pop-h { 0% { transform: scale(.985); } 100% { transform: scale(1.025); } }
@media (prefers-reduced-motion: reduce) { .prod, .prod:hover, .prod:active { transform: none; } .prod.pop { animation: none; } }
.prod b { font-size: 17px; font-weight: 600; line-height: 1.25; }
.prod span { font-family: var(--mono); font-size: 16px; color: #D7D9DC; }
.prod .qty { position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--amber); color: var(--amber-ink); font-weight: 700; font-size: 13px; display: grid; place-items: center; padding: 0 7px; font-family: var(--mono); }

.order-h { height: 74px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--d-line); flex: none; }
.order-h b { font-size: 18px; }
.order-h button { background: none; border: 0; color: var(--d-muted); font-size: 14px; padding: 8px; }
.order-h button:hover { color: var(--d-ink); }
.order-list { flex: 1; overflow-y: auto; padding: 8px 12px; min-height: 0; overscroll-behavior: contain; }
.order-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--d-muted); font-size: 14px; padding: 20px; }
.oline { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 8px; border-bottom: 1px solid var(--d-line); align-items: center; }
.oline .n { font-weight: 600; font-size: 15px; }
.oline .p { font-family: var(--mono); color: var(--d-muted); font-size: 13px; }
.oline .tot { font-family: var(--mono); font-size: 15px; text-align: right; }
.stepper { display: flex; align-items: center; gap: 6px; grid-column: 2; justify-self: end; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--d-line-2); background: var(--d-card); color: var(--d-ink); font-size: 18px; line-height: 1; transition: background .15s, color .15s, border-color .15s; }
.stepper button:hover { background: #fff; color: #000; border-color: #fff; }
.stepper span { min-width: 22px; text-align: center; font-family: var(--mono); font-weight: 600; }
.order-f { padding: 16px 20px 20px; border-top: 1px solid var(--d-line); display: grid; gap: 12px; flex: none; background: var(--d-panel); box-shadow: 0 -10px 18px -12px rgba(0,0,0,.6); }
.order-f .total { display: flex; justify-content: space-between; align-items: baseline; }
.order-f .total span { color: var(--d-muted); font-size: 15px; }
.order-f .total b { font-family: var(--mono); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; }
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay button { height: 50px; border-radius: 10px; border: 1px solid var(--d-line-2); background: transparent; color: var(--d-ink); font-weight: 600; font-size: 16px; }
.pay button.on { border-color: var(--amber); background: rgba(245,165,36,.12); color: var(--amber); }

.blocker { position: absolute; inset: 0; background: rgba(18,19,22,.86); display: grid; place-items: center; z-index: 5; backdrop-filter: blur(2px); padding: 20px; }
.blocker .in-box { max-width: 420px; text-align: center; }
.blocker h2 { margin: 0 0 8px; font-size: 22px; }
.blocker p { color: var(--d-muted); margin: 0 0 18px; }

/* Listas tipo checklist / conteo / corte */
.pwrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; min-height: 0; }
.pwrap > .l { padding: 20px 24px; overflow-y: auto; }
.pwrap > .r { border-left: 1px solid var(--d-line); background: var(--d-panel); padding: 20px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.progress { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.progress .track { flex: 1; height: 10px; background: var(--d-line); border-radius: 99px; overflow: hidden; }
.progress .track i { display: block; height: 100%; background: var(--d-ok); border-radius: 99px; transition: width .3s; }
.progress b { font-family: var(--mono); font-size: 15px; }
.citem { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 12px; border: 1px solid var(--d-line-2); background: var(--d-card); margin-bottom: 10px; cursor: pointer; width: 100%; text-align: left; color: var(--d-ink); }
.citem:hover { background: var(--d-card-2); }
.citem.done { border-color: var(--d-ok-line); background: #1A2620; }
.citem .box-c { width: 36px; height: 36px; border-radius: 9px; border: 2px solid #4A5058; flex: none; display: grid; place-items: center; }
.citem.done .box-c { background: var(--d-ok); border-color: var(--d-ok); color: #0F2A1B; }
.citem .tx { flex: 1; min-width: 0; }
.citem .tx b { display: block; font-size: 16.5px; font-weight: 600; }
.citem .tx small { color: var(--d-muted); font-size: 13px; }
.citem .tag { background: var(--d-card-2); border: 1px solid var(--d-line-2); padding: 6px 10px; border-radius: 8px; font-size: 13px; color: #D7D9DC; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.citem .tag.warn { background: var(--d-warn-bg); color: var(--d-warn); border-color: #6B5320; }
.citem img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--d-line-2); }
.side-h { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.att { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--d-line); }
.att b { font-weight: 600; font-size: 15px; }
.att small { display: block; color: var(--d-muted); font-size: 12.5px; }
.att .mono { font-size: 14px; color: var(--d-ok); }
.att .mono.late { color: var(--d-warn); }
.att .mono.out { color: var(--d-muted); }
.sidenote { color: var(--d-muted); font-size: 13px; line-height: 1.5; margin-top: auto; }
.seg.dark { background: var(--d-panel); border-color: var(--d-line-2); }
.seg.dark button { color: var(--d-ink); }
.seg.dark button:hover { background: var(--d-card); }
.seg.dark button.on { background: var(--amber); color: var(--amber-ink); }

.citem.count { cursor: pointer; }
.citem.count.cur { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
.citem.count .val { font-family: var(--mono); font-size: 18px; min-width: 64px; text-align: right; }
.citem.count .u { color: var(--d-muted); width: 40px; font-size: 14px; }
.display { height: 70px; border-radius: 12px; border: 1.5px solid var(--amber); background: #0E0F11; display: flex; align-items: center; justify-content: flex-end; padding: 0 18px; gap: 10px; }
.display b { font-family: var(--mono); font-size: 36px; font-weight: 500; }
.display span { color: var(--d-muted); font-size: 16px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { height: 62px; border-radius: 10px; border: 1px solid var(--d-line-2); background: var(--d-card); color: var(--d-ink); font-family: var(--mono); font-size: 24px; font-weight: 500; }
.pad button:hover { background: var(--d-card-2); }
.pad button:active { background: #30353C; }

.ccols { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 20px 24px; align-content: start; overflow-y: auto; }
.ccols h4 { font-size: 13px; letter-spacing: .07em; color: var(--d-muted); margin: 6px 0 12px; font-weight: 600; }
.dcard { background: var(--d-card); border: 1px solid var(--d-line-2); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.dcard .big { font-family: var(--mono); font-size: 36px; margin: 6px 0 4px; letter-spacing: -0.02em; }
.dcard .kv { border-color: var(--d-line); padding: 8px 0; color: var(--d-ink); }
.dcard .kv span { color: var(--d-ink); }
.dcard .kv b { font-family: var(--mono); font-weight: 500; }
.dcard .kv.tot b, .dcard .kv.tot span { font-weight: 700; }
.dcard small, .dcard .m { color: var(--d-muted); font-size: 13px; }
.dcard .splitbar { height: 6px; border-radius: 9px; display: flex; overflow: hidden; margin: 10px 0; background: var(--d-line); }
.dcard .ok { color: var(--d-ok); font-family: var(--mono); font-size: 13.5px; }
.dcard .bad { color: var(--d-bad); font-family: var(--mono); font-size: 13.5px; }
.din { width: 100%; height: 52px; border-radius: 10px; border: 1px solid var(--d-line-2); background: #0E0F11; color: var(--d-ink); padding: 0 14px; font-size: 16px; }
.din.num { font-family: var(--mono); font-size: 22px; }
.din:focus { outline: none; border-color: var(--amber); }
textarea.din { height: 70px; padding: 12px 14px; font-size: 15px; resize: none; font-family: var(--font); }
.diff { display: flex; justify-content: space-between; align-items: center; height: 52px; border-radius: 10px; padding: 0 14px; margin: 12px 0; font-weight: 600; }
.diff.bad { background: var(--d-bad-bg); border: 1px solid var(--d-bad-line); color: var(--d-bad); }
.diff.ok { background: var(--d-ok-bg); border: 1px solid var(--d-ok-line); color: var(--d-ok); }
.diff.over { background: #18263F; border: 1px solid #2F4A7A; color: var(--d-blue); }
.diff b { font-family: var(--mono); font-size: 20px; }
.dashed { width: 100%; height: 44px; border: 1px dashed #4A5058; border-radius: 10px; background: none; color: var(--d-ink); font-weight: 600; margin-top: 8px; }
.dashed:hover { background: var(--d-card-2); }
.dlbl { font-size: 13px; color: var(--d-muted); font-weight: 600; margin: 8px 0 8px; display: block; }

.dk .modal { background: var(--d-panel); color: var(--d-ink); border: 1px solid var(--d-line-2); }
.dk .modal header p { color: var(--d-muted); }
.dk .modal .close { background: var(--d-card); color: var(--d-muted); }
.dk .modal footer { border-color: var(--d-line); }
.dk .modal .err { color: var(--d-bad); }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; background: var(--d-bg); color: var(--d-ink); display: grid; place-items: center; padding: 24px 16px; }
.login .lbox { width: min(380px, 100%); }
.login .logo { justify-content: center; margin-bottom: 26px; font-size: 24px; color: var(--d-ink); }
.login .logo .mark { width: 40px; height: 40px; font-size: 21px; border-radius: 10px; }
.login h1 { text-align: center; font-size: 20px; margin: 0 0 6px; }
.login p.s { text-align: center; color: var(--d-muted); margin: 0 0 22px; }
.dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 22px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #4A5058; transition: background .1s; }
.dots i.f { background: var(--amber); border-color: var(--amber); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.login .err { text-align: center; color: var(--d-bad); min-height: 20px; margin-bottom: 12px; font-size: 14px; }
.login details { margin-top: 24px; color: var(--d-muted); font-size: 13px; border: 1px solid var(--d-line); border-radius: 12px; padding: 12px 14px; }
.login details summary { cursor: pointer; font-weight: 600; color: var(--d-ink); }
.login details table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.login details td { padding: 5px 0; }
.login details td:last-child { text-align: right; font-family: var(--mono); color: var(--d-ink); }

.done-screen { flex: 1; display: grid; place-items: center; padding: 24px; text-align: center; }
.done-screen .ic { width: 72px; height: 72px; border-radius: 50%; background: var(--d-ok-bg); color: var(--d-ok); display: grid; place-items: center; font-size: 34px; margin: 0 auto 16px; }

@media (max-width: 900px) {
  .pos-main, .pwrap { grid-template-columns: 1fr; }
  .pos-right { border-left: 0; border-top: 1px solid var(--d-line); max-height: none; }
  .order-list { max-height: 260px; }
  .pos.caja { height: auto; overflow: visible; }
  .order-f { position: sticky; bottom: 0; z-index: 3; }
  .pwrap > .r { border-left: 0; border-top: 1px solid var(--d-line); }
  .ccols { grid-template-columns: 1fr; }
  .pbar { height: auto; min-height: 66px; flex-wrap: wrap; padding: 10px 16px; }
  .pbar .info { margin-left: 0; text-align: left; order: 3; width: 100%; }
  .pos-left { padding: 16px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .head h1 { font-size: 26px; }
  .topbar { gap: 12px; }
  .who > button span { display: none; }
}

/* Impresión */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .no-print, #toasts, .pbar .acts, .pbar .back { display: none !important; }
  .pos { background: #fff; color: #000; }
  .pos .dcard { background: #fff; border-color: #ccc; color: #000; }
  .pos .din { background: #fff; color: #000; border-color: #ccc; }
  .print-only { display: block; }
  .card, .kpi { break-inside: avoid; }
}

/* Personal y sucursales */
.pin { display: inline-flex; align-items: center; gap: 8px; }
.pin b { font-family: var(--mono); font-size: 15px; letter-spacing: .18em; min-width: 52px; color: var(--muted); }
.pin.open b { color: var(--ink); }
.pin .eye { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: grid; place-items: center; transition: background .15s, color .15s, border-color .15s; }
.pin .eye:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.sm svg { margin-right: 2px; }
.ro { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 4px 10px; }
.chip .dot { margin-right: 6px; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.loc-card { position: relative; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 16px 14px 22px; display: grid; gap: 3px; color: var(--ink); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.loc-card:hover { border-color: #CFCCC5; box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.loc-card.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.loc-card > i { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.loc-card b { font-size: 15px; }
.loc-card span { color: var(--ink-2); font-size: 13px; }
.loc-card small { color: var(--muted); font-size: 12.5px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches .sw { width: 34px; height: 34px; border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform .12s; }
.swatches .sw:hover { transform: scale(1.08); }
.swatches .sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.pin-big { display: flex; justify-content: center; gap: 10px; margin-top: 4px; }
.pin-big span { width: 58px; height: 70px; border-radius: 14px; background: var(--ink); color: #fff; font-family: var(--mono); font-size: 34px; font-weight: 600; display: grid; place-items: center; }
.cal > div > small.mono { color: var(--muted); font-size: 11px; }

/* Menú superior en pantallas medianas: más compacto y con desvanecido cuando hay más pestañas a la derecha */
@media (max-width: 1280px) {
  .topbar { gap: 16px; }
  .nav { gap: 2px; }
  .nav a { padding: 10px 10px; font-size: 14px; }
  .who > button span { display: none; }
}
.nav.more { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.t td.nw, .t .nw { white-space: nowrap; }
