/* ============================================================
   LabLIS — Estilo visual (adaptado del prototipo de diseño)
   Requiere la fuente IBM Plex (se importa en _Layout.cshtml)
   ============================================================ */
:root{
  /* accent (tweakable) */
  --accent: #2563a8;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fa;
  --teal: #0d9488;

  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #16202e;
  --ink-2: #3d4a5c;
  --muted: #6b7a90;
  --line: #e4e9f0;
  --line-2: #eef1f6;

  /* sidebar */
  --side-bg: #0f1a2b;
  --side-bg-2: #13233b;
  --side-ink: #a9b7cb;
  --side-hover: #1c2f4a;

  /* status */
  --st-tomada-bg:#fdf2e3; --st-tomada-ink:#a35a08;
  --st-recibida-bg:#e5f2fb; --st-recibida-ink:#0a5c8f;
  --st-procesando-bg:#ecebfb; --st-procesando-ink:#4a3fc7;
  --st-validada-bg:#e3f5ea; --st-validada-ink:#127a41;
  --st-reportada-bg:#eef1f6; --st-reportada-ink:#4a586c;

  /* flags */
  --fl-n-bg:#e3f5ea; --fl-n-ink:#127a41;
  --fl-h-bg:#fdf2e3; --fl-h-ink:#a35a08;
  --fl-l-bg:#e5f2fb; --fl-l-ink:#0a5c8f;
  --fl-crit-bg:#fbe9e7; --fl-crit-ink:#b4271b;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20,32,48,.05), 0 4px 16px rgba(20,32,48,.05);
  --shadow-lg: 0 10px 40px rgba(16,26,43,.16);
  --pad: 28px;
  --row-h: 15px;
  --sidebar-w: 244px;
}
html[data-density="compact"]{ --pad:20px; --row-h:11px; }
html[data-density="comfy"]{ --pad:36px; --row-h:19px; }

*{ box-sizing:border-box; }
html,body{ margin:0; height:100%; }
body{
  font-family:'IBM Plex Sans', system-ui, sans-serif;
  background:var(--bg); color:var(--ink);
  font-size:14.5px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.mono{ font-family:'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric:tabular-nums; }
.num{ font-variant-numeric:tabular-nums; }
h1,h2,h3,h4{ margin:0; font-weight:600; letter-spacing:-.01em; color:var(--ink); }
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }

#root{ height:100%; }

/* default inline icon size */
svg{ width:18px; height:18px; flex:none; display:inline-block; vertical-align:middle; }
.brand .mark svg{ width:30px; height:30px; }
.st-ico svg{ width:19px; height:19px; }
.stat .st-ico svg{ width:19px; height:19px; }
.empty svg{ width:34px; height:34px; }

/* ============ SHELL ============ */
.shell{ display:flex; min-height:100vh; }
.sidebar{
  width:var(--sidebar-w); flex:0 0 var(--sidebar-w);
  background:linear-gradient(180deg,var(--side-bg),var(--side-bg-2));
  color:var(--side-ink); display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
}
.brand{ padding:22px 22px 18px; }
.brand .logo{ display:flex; align-items:center; gap:13px; }
.brand .mark{
  width:52px; height:52px; border-radius:13px; flex:0 0 52px;
  background:linear-gradient(135deg,var(--teal),var(--accent));
  display:grid; place-items:center; color:#fff; font-weight:700; font-size:15px;
  box-shadow:0 6px 16px rgba(13,148,136,.38);
}
.brand .name{ font-size:40px; font-weight:700; color:#fff; letter-spacing:-.02em; line-height:1; }
.brand .name b{ color:var(--teal); font-weight:700; }
.brand .sub{ font-size:11px; letter-spacing:3px; color:#4c5c76; margin:11px 3px 0; font-weight:600; }

.nav{ padding:8px 12px; flex:1; overflow:auto; }
.nav .group-label{ font-size:10.5px; letter-spacing:1.5px; text-transform:uppercase; color:#55688a; margin:16px 12px 7px; font-weight:600; }
.nav-item{
  display:flex; align-items:center; gap:12px; padding:9px 13px; margin-bottom:2px;
  border-radius:9px; color:var(--side-ink); font-size:14px; cursor:pointer;
  transition:background .12s,color .12s; font-weight:500; position:relative;
}S
.nav-item:hover{ background:var(--sideS-hover); color:#fff; }
.nav-item.active{ background:rgba(255,255,255,.06); color:#fff; font-weight:600; }
.nav-item.active::before{
  content:""; position:absolute; left:-12px; top:8px; bottom:8px; width:3px;
  border-radius:0 3px 3px 0; background:var(--teal);
}
.nav-item .ico{ width:19px; height:19px; flex:0 0 19px; display:grid; place-items:center; opacity:.9; }
.nav-item .ico svg{ width:18px; height:18px; }
.nav-item .badge-count{
  margin-left:auto; font-size:11px; background:rgba(255,255,255,.1); color:#cdd8e8;
  padding:1px 8px; border-radius:20px; font-weight:600; font-family:'IBM Plex Mono',monospace;
}

.side-foot{ padding:14px; border-top:1px solid rgba(255,255,255,.07); }
.side-user{ display:flex; align-items:center; gap:11px; }
.side-user .av{
  width:38px; height:38px; border-radius:50%; flex:0 0 38px;
  background:linear-gradient(135deg,var(--teal),var(--accent));
  display:grid; place-items:center; color:#fff; font-weight:700; font-size:14px;
}
.side-user .who{ min-width:0; }
.side-user .who b{ color:#eef2f8; font-size:13px; font-weight:600; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.side-user .who small{ color:#657692; font-size:11.5px; }
.side-user .out{ margin-left:auto; color:#8393aa; cursor:pointer; padding:6px; border-radius:7px; display:grid; place-items:center; }
.side-user .out:hover{ background:rgba(224,96,63,.16); color:#ff9b85; }

/* ============ MAIN ============ */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  background:rgba(255,255,255,.85); backdrop-filter:saturate(1.4) blur(8px);
  border-bottom:1px solid var(--line); padding:0 var(--pad);
  height:62px; display:flex; align-items:center; gap:18px; position:sticky; top:0; z-index:20;
}
.topbar .tb-title{ font-size:18px; font-weight:600; }
.topbar .tb-crumb{ color:var(--muted); font-size:13px; }
.topbar .spacer{ flex:1; }
.topbar .search{
  display:flex; align-items:center; gap:8px; background:var(--surface-2);
  border:1px solid var(--line); border-radius:20px; padding:7px 14px; width:280px; color:var(--muted);
}
.topbar .search input{ border:none; background:none; outline:none; font-family:inherit; font-size:13.5px; width:100%; color:var(--ink); }
.topbar .tb-date{ font-size:13px; color:var(--muted); text-transform:capitalize; }
.tb-icon{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; color:var(--ink-2); cursor:pointer; }
.tb-icon:hover{ background:var(--surface-2); }

.content{ padding:var(--pad); flex:1; }
.page-head{ display:flex; align-items:flex-end; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head .ph-txt h1{ font-size:23px; }
.page-head .ph-txt p{ margin:5px 0 0; color:var(--muted); font-size:14px; }
.page-head .ph-actions{ margin-left:auto; display:flex; gap:10px; align-items:center; }

/* ============ UI PRIMITIVES ============ */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.card-pad{ padding:20px 22px; }

.btn{
  display:inline-flex; align-items:center; gap:8px; border:1px solid var(--line);
  background:var(--surface); color:var(--ink); padding:9px 15px; border-radius:9px;
  font-size:13.5px; font-weight:600; cursor:pointer; transition:.12s; white-space:nowrap;
}
.btn:hover{ border-color:#cdd6e2; background:var(--surface-2); }
.btn.primary{ background:var(--accent); border-color:var(--accent); color:var(--accent-ink); }
.btn.primary:hover{ filter:brightness(1.06); background:var(--accent); }
.btn.teal{ background:var(--teal); border-color:var(--teal); color:#fff; }
.btn.teal:hover{ filter:brightness(1.06); background:var(--teal); }
.btn.ghost{ background:transparent; border-color:transparent; }
.btn.ghost:hover{ background:var(--surface-2); }
.btn.sm{ padding:6px 11px; font-size:12.5px; border-radius:8px; }
.btn.success{ background:#16834a; border-color:#16834a; color:#fff; }
.btn.success:hover{ filter:brightness(1.06); background:#16834a; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

.chip{
  display:inline-flex; align-items:center; gap:6px; padding:6px 13px; border-radius:20px;
  font-size:13px; font-weight:600; border:1px solid var(--line); background:var(--surface);
  color:var(--ink-2); cursor:pointer; transition:.12s; white-space:nowrap;
}
.chip:hover{ border-color:#cdd6e2; }
.chip.on{ background:var(--accent); border-color:var(--accent); color:#fff; }
.chip .c-count{ font-family:'IBM Plex Mono',monospace; opacity:.75; font-size:12px; }
.chip.on .c-count{ opacity:.9; }

.badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:7px; font-size:12px; font-weight:600; letter-spacing:.01em; white-space:nowrap; }
.badge .dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge.area{ background:var(--surface-2); border:1px solid var(--line); color:var(--ink-2); font-family:'IBM Plex Mono',monospace; font-size:11.5px; letter-spacing:.04em; }
.st-Tomada{ background:var(--st-tomada-bg); color:var(--st-tomada-ink); }
.st-Recibida{ background:var(--st-recibida-bg); color:var(--st-recibida-ink); }
.st-Procesando{ background:var(--st-procesando-bg); color:var(--st-procesando-ink); }
.st-Validada{ background:var(--st-validada-bg); color:var(--st-validada-ink); }
.st-Reportada{ background:var(--st-reportada-bg); color:var(--st-reportada-ink); }

.fl{ font-family:'IBM Plex Mono',monospace; }
.fl-N{ background:var(--fl-n-bg); color:var(--fl-n-ink); }
.fl-H{ background:var(--fl-h-bg); color:var(--fl-h-ink); }
.fl-L{ background:var(--fl-l-bg); color:var(--fl-l-ink); }
.fl-HH,.fl-LL{ background:var(--fl-crit-bg); color:var(--fl-crit-ink); }
.pri-Urgente{ background:#fbe9e7; color:#b4271b; }
.pri-Rutina{ background:var(--surface-2); color:var(--muted); border:1px solid var(--line); }

/* ============ TABLE ============ */
.tbl-wrap{ overflow:auto; border-radius:var(--radius); }
table.tbl{ width:100%; border-collapse:collapse; font-size:13.5px; }
table.tbl thead th{
  text-align:left; font-size:11px; letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted); font-weight:600; padding:12px 16px; background:var(--surface-2);
  border-bottom:1px solid var(--line); position:sticky; top:0; white-space:nowrap;
}
table.tbl tbody td{ padding:var(--row-h) 16px; border-bottom:1px solid var(--line-2); vertical-align:middle; }
table.tbl tbody tr:last-child td{ border-bottom:none; }
table.tbl tbody tr{ transition:background .1s; }
table.tbl tbody tr.clickable{ cursor:pointer; }
table.tbl tbody tr.clickable:hover{ background:var(--surface-2); }
table.tbl .r{ text-align:right; }
table.tbl .c{ text-align:center; }
.code-link{ color:var(--accent); font-weight:600; font-family:'IBM Plex Mono',monospace; }
.code-link:hover{ text-decoration:underline; }
.t-muted{ color:var(--muted); }
.t-sub{ color:var(--muted); font-size:12.5px; }

/* stat cards */
.stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:16px; margin-bottom:26px; }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; box-shadow:var(--shadow); position:relative; overflow:hidden; }
.stat .st-top{ display:flex; align-items:center; justify-content:space-between; }
.stat .st-ico{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; }
.stat .st-num{ font-size:32px; font-weight:700; letter-spacing:-.02em; margin-top:10px; font-variant-numeric:tabular-nums; }
.stat .st-lbl{ font-size:12.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; font-weight:600; }
.stat .st-trend{ font-size:12px; margin-top:7px; color:var(--muted); }
.stat .st-trend b{ color:#12793f; }

/* forms */
.field{ display:flex; flex-direction:column; gap:6px; }
.field label{ font-size:12.5px; font-weight:600; color:var(--ink-2); }
.field label .req{ color:#c0392b; }
.input, .select{
  border:1px solid var(--line); background:var(--surface); border-radius:9px;
  padding:9px 12px; font-family:inherit; font-size:14px; color:var(--ink); outline:none; transition:.12s; width:100%;
}
.input:focus,.select:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.grid-form{ display:grid; grid-template-columns:repeat(12,1fr); gap:16px; }
.alert{ padding:13px 16px; border-radius:10px; font-size:14px; display:flex; align-items:center; gap:10px; }
.alert.info{ background:var(--accent-soft); color:#1c4f83; border:1px solid #cfe0f2; }
.alert.success{ background:#e3f5ea; color:#12793f; border:1px solid #bfe6cd; }
.alert.warn{ background:#fdf2e3; color:#95530a; border:1px solid #f4dcb5; }

/* exam picker */
.exam-group{ margin-bottom:8px; }
.exam-group .eg-head{ display:flex; align-items:center; gap:10px; margin:16px 0 10px; }
.exam-group .eg-head h4{ font-size:14px; color:var(--accent); }
.exam-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:8px; }
.exam-opt{ display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:9px; padding:10px 12px; cursor:pointer; transition:.12s; background:var(--surface); }
.exam-opt:hover{ border-color:#cdd6e2; background:var(--surface-2); }
.exam-opt.sel{ border-color:var(--accent); background:var(--accent-soft); }
.exam-opt .cbx{ width:18px; height:18px; border-radius:5px; border:1.5px solid #c3ccda; flex:0 0 18px; display:grid; place-items:center; background:#fff; }
.exam-opt.sel .cbx{ background:var(--accent); border-color:var(--accent); color:#fff; }
.exam-opt .ex-name{ font-size:13.5px; font-weight:500; }
.exam-opt .ex-price{ margin-left:auto; font-size:12px; color:var(--muted); font-family:'IBM Plex Mono',monospace; }

/* results entry table */
.res-input{ width:110px; text-align:right; border:1px solid var(--line); border-radius:8px; padding:7px 10px; font-family:'IBM Plex Mono',monospace; font-size:14px; font-weight:600; outline:none; }
.res-input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.res-input.flagged-H,.res-input.flagged-HH{ border-color:#e0a760; color:#a35a08; }
.res-input.flagged-L{ border-color:#7cb4dd; color:#0a5c8f; }
.res-input.flagged-HH,.res-input.flagged-LL{ border-color:#d98a80; color:#b4271b; }
.exam-sep td{ background:var(--surface-2)!important; font-weight:600; color:var(--accent); font-size:12px; letter-spacing:.04em; text-transform:uppercase; padding:9px 16px!important; }

/* kanban */
.kanban{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(268px,1fr); gap:16px; overflow-x:auto; padding-bottom:8px; }
.kcol{ background:var(--surface-2); border:1px solid var(--line); border-radius:var(--radius); display:flex; flex-direction:column; max-height:calc(100vh - 230px); }
.kcol-head{ padding:13px 15px; display:flex; align-items:center; gap:9px; border-bottom:1px solid var(--line); position:sticky; top:0; }
.kcol-head .k-name{ font-weight:600; font-size:13.5px; }
.kcol-head .k-n{ margin-left:auto; font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--muted); background:var(--surface); border:1px solid var(--line); padding:1px 8px; border-radius:20px; }
.kcol-body{ padding:11px; display:flex; flex-direction:column; gap:10px; overflow:auto; }
.kcard{ background:var(--surface); border:1px solid var(--line); border-radius:10px; padding:12px 13px; cursor:pointer; box-shadow:0 1px 2px rgba(20,32,48,.04); transition:.12s; }
.kcard:hover{ border-color:#cbd5e3; box-shadow:var(--shadow); transform:translateY(-1px); }
.kcard .kc-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:7px; }
.kcard .kc-pt{ font-weight:600; font-size:13.5px; margin-bottom:3px; }
.kcard .kc-ex{ font-size:12.5px; color:var(--muted); line-height:1.4; }
.kcard .kc-foot{ display:flex; align-items:center; gap:8px; margin-top:9px; }

/* cards view */
.cardgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:14px; }
.mcard{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; box-shadow:var(--shadow); cursor:pointer; transition:.12s; }
.mcard:hover{ border-color:#cbd5e3; box-shadow:var(--shadow-lg); transform:translateY(-2px); }

/* segmented view switch */
.seg{ display:inline-flex; background:var(--surface-2); border:1px solid var(--line); border-radius:9px; padding:3px; gap:2px; }
.seg button{ border:none; background:none; padding:6px 13px; border-radius:7px; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer; display:flex; align-items:center; gap:6px; }
.seg button.on{ background:var(--surface); color:var(--ink); box-shadow:0 1px 2px rgba(20,32,48,.08); }

/* login */
.login-wrap{ min-height:100vh; display:grid; grid-template-columns:1.1fr 1fr; }
.login-hero{ background:linear-gradient(150deg,var(--side-bg),var(--side-bg-2)); color:#fff; padding:56px 60px; display:flex; flex-direction:column; position:relative; overflow:hidden; }
.login-form-col{ display:grid; place-items:center; padding:40px; background:var(--surface); }
.login-card{ width:100%; max-width:360px; }

/* report / pdf */
.pdf-toolbar{ display:flex; align-items:center; gap:12px; margin-bottom:18px; }
.pdf-sheet{ background:#fff; width:820px; max-width:100%; margin:0 auto; box-shadow:var(--shadow-lg); border:1px solid var(--line); }

.empty{ text-align:center; padding:50px 20px; color:var(--muted); }

/* settings */
.cfg-wrap{ display:grid; grid-template-columns:238px 1fr; gap:22px; align-items:start; }
.cfg-nav{ position:sticky; top:80px; display:flex; flex-direction:column; gap:2px; }
.cfg-nav-item{ display:flex; align-items:center; gap:11px; padding:10px 13px; border-radius:9px; font-size:13.5px; font-weight:500; color:var(--ink-2); cursor:pointer; transition:.12s; }
.cfg-nav-item:hover{ background:var(--surface-2); }
.cfg-nav-item.on{ background:var(--accent-soft); color:var(--accent); font-weight:600; }
.cfg-nav-item svg{ width:17px; height:17px; opacity:.85; }
.cfg-panel{ min-width:0; }
.cfg-sec-head{ display:flex; align-items:flex-end; gap:14px; margin-bottom:18px; }
.cfg-sec-head h2{ font-size:19px; }
.cfg-sec-head p{ margin:4px 0 0; color:var(--muted); font-size:13.5px; }
.cfg-sec-head .actions{ margin-left:auto; display:flex; gap:8px; }
.cfg-block{ margin-bottom:18px; }
.cfg-block .cb-title{ font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:600; margin-bottom:12px; }
.cfg-rowline{ display:flex; align-items:center; gap:16px; padding:14px 0; border-bottom:1px solid var(--line-2); }
.cfg-rowline:last-child{ border-bottom:none; }
.cfg-rowline .rl-label{ flex:0 0 210px; }
.cfg-rowline .rl-label b{ font-size:13.5px; font-weight:600; display:block; }
.cfg-rowline .rl-label small{ color:var(--muted); font-size:12px; }
.cfg-rowline .rl-control{ flex:1; display:flex; gap:10px; align-items:center; }
.switch{ width:42px; height:24px; border-radius:20px; background:#cdd6e2; position:relative; cursor:pointer; transition:.15s; flex:none; }
.switch.on{ background:var(--accent); }
.switch .knob{ position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:#fff; transition:.15s; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.switch.on .knob{ left:21px; }
.swatch-row{ display:flex; gap:9px; }
.swatch{ width:30px; height:30px; border-radius:8px; cursor:pointer; border:2px solid transparent; box-shadow:0 0 0 1px rgba(0,0,0,.08) inset; }
.swatch.on{ border-color:var(--ink); }
.pill-state{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:3px 10px; border-radius:20px; }

/* focus fade-in */
@media (prefers-reduced-motion: no-preference){
  .view-enter{ animation:vin .28s ease both; }
  @keyframes vin{ from{ transform:translateY(7px);} to{ transform:none;} }
}

::-webkit-scrollbar{ width:11px; height:11px; }
::-webkit-scrollbar-thumb{ background:#cfd7e2; border-radius:20px; border:3px solid transparent; background-clip:content-box; }
::-webkit-scrollbar-thumb:hover{ background:#b6c1d0; background-clip:content-box; }
