/* ============================================================
   BARATOTE — Carga de Vencidos · Sistema de diseño (ERP)
   ============================================================ */

:root {
  /* Brand / accent (overridable via Tweaks) */
  --brand-h: 250;
  --brand: oklch(0.52 0.13 var(--brand-h));
  --brand-strong: oklch(0.44 0.14 var(--brand-h));
  --brand-soft: oklch(0.95 0.03 var(--brand-h));
  --brand-softer: oklch(0.975 0.018 var(--brand-h));
  --brand-line: oklch(0.88 0.04 var(--brand-h));

  /* Neutrals (cool) */
  --bg: oklch(0.978 0.004 250);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.985 0.004 250);
  --surface-3: oklch(0.965 0.006 250);
  --line: oklch(0.91 0.006 250);
  --line-strong: oklch(0.85 0.008 250);
  --ink: oklch(0.24 0.012 255);
  --ink-2: oklch(0.42 0.012 255);
  --ink-3: oklch(0.58 0.012 255);
  --ink-on-brand: oklch(0.99 0.01 250);

  /* Status */
  --vencido: oklch(0.55 0.17 25);
  --vencido-soft: oklch(0.96 0.04 25);
  --averiado: oklch(0.62 0.15 65);
  --averiado-soft: oklch(0.96 0.04 65);
  --ok: oklch(0.58 0.13 155);
  --ok-soft: oklch(0.95 0.04 155);
  --warn: oklch(0.72 0.15 85);
  --warn-soft: oklch(0.96 0.05 85);
  --inactive: oklch(0.6 0.008 255);

  /* Geometry / density (overridable via Tweaks) */
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --density: 1; /* row vertical padding multiplier */
  --pad-y: calc(9px * var(--density));
  --pad-y-sm: calc(6px * var(--density));

  --shadow-sm: 0 1px 2px oklch(0.4 0.03 255 / 0.06), 0 1px 1px oklch(0.4 0.03 255 / 0.04);
  --shadow-md: 0 4px 14px oklch(0.4 0.03 255 / 0.08), 0 1px 3px oklch(0.4 0.03 255 / 0.05);
  --shadow-lg: 0 18px 48px oklch(0.3 0.03 255 / 0.18), 0 4px 12px oklch(0.3 0.03 255 / 0.08);

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gold: #b8860b;

  --sidebar-w: 238px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--brand-soft); }

/* Scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color .12s, box-shadow .12s, transform .04s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 16px; height: 16px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn.block { width: 100%; }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--ink-on-brand);
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }

.btn.danger { color: var(--vencido); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--vencido-soft); border-color: var(--vencido); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  transition: color .12s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--vencido-soft); color: var(--vencido); }

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; }
.field .hint { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.req { color: var(--vencido); }
.opt { color: var(--ink-3); font-weight: 400; }

.input, .select {
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder { color: var(--ink-3); }
.input.invalid { border-color: var(--vencido); }
.input.invalid:focus { box-shadow: 0 0 0 3px var(--vencido-soft); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2370788a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.err-msg { font-size: 11.5px; color: var(--vencido); font-weight: 500; }

/* ============================================================
   Cards / panels
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.005em; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card-body { padding: 16px; }

/* ============================================================
   Badges / chips
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.vencido { color: var(--vencido); background: var(--vencido-soft); }
.badge.averiado { color: var(--averiado); background: var(--averiado-soft); }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.inactive { color: var(--inactive); background: var(--surface-3); }
.badge.warn { color: oklch(0.5 0.13 70); background: var(--warn-soft); }
.badge.role { background: var(--brand-soft); color: var(--brand-strong); }
.badge.neutral { background: var(--surface-3); color: var(--ink-2); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.data tbody td {
  padding: var(--pad-y) 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data tbody tr:hover td { background: var(--brand-softer); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.data .center { text-align: center; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 20px; text-align: center; color: var(--ink-3);
}
.empty-state svg { width: 34px; height: 34px; opacity: 0.5; }
.empty-state .t { font-weight: 600; color: var(--ink-2); font-size: 14px; }

/* ============================================================
   Layout shell
   ============================================================ */
.app-shell { display: flex; height: 100%; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: oklch(0.21 0.02 258);
  color: oklch(0.86 0.01 258);
  display: flex; flex-direction: column;
  border-right: 1px solid oklch(0.27 0.02 258);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid oklch(0.27 0.02 258);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.12);
}
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: white; line-height: 1; }
.brand-name small { display: block; font-weight: 500; font-size: 10.5px; letter-spacing: 0.06em; color: oklch(0.7 0.02 258); margin-top: 3px; }

/* Logo wordmark */
.brand-logo { height: 32px; width: auto; display: block; }
.brand-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: oklch(0.62 0.02 258); line-height: 1.25; padding-left: 10px; margin-left: 1px;
  border-left: 1px solid oklch(0.32 0.02 258);
}

.nav { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: oklch(0.55 0.02 258); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: oklch(0.78 0.01 258); font-size: 13px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: oklch(0.27 0.02 258); color: white; }
.nav-item.active { background: var(--brand); color: white; box-shadow: var(--shadow-sm); }
.nav-item.active svg { opacity: 1; }
.nav-item .count { margin-left: auto; font-size: 11px; font-family: var(--font-mono); background: oklch(1 0 0 / 0.12); padding: 1px 7px; border-radius: 99px; }

.sidebar .user-card {
  flex-shrink: 0; padding: 12px; border-top: 1px solid oklch(0.27 0.02 258);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}
.user-card .meta { min-width: 0; flex: 1; }
.user-card .meta .n { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .meta .r { font-size: 11px; color: oklch(0.65 0.02 258); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
}
.topbar .page-title { font-size: 15px; font-weight: 600; }
.topbar .page-title small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; margin-top: 1px; }
.topbar .spacer { flex: 1; }
.topbar .branch-chip {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px;
  border-radius: 99px; background: var(--brand-soft); color: var(--brand-strong);
  font-size: 12.5px; font-weight: 600;
}
.menu-toggle { display: none; }

.content { flex: 1; overflow-y: auto; padding: 22px; }
.content-inner { max-width: 1240px; margin: 0 auto; }
.app-footer {
  max-width: 1240px; margin: 26px auto 0; padding: 16px 4px 4px;
  border-top: 1px solid var(--line);
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  letter-spacing: 0.02em;
}
.app-footer strong { color: var(--ink-2); font-weight: 600; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Stat cards
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .label { font-size: 12px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .label .ic { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.stat .label .ic svg { width: 15px; height: 15px; }
.stat .value { font-size: 30px; font-weight: 700; font-family: var(--font-mono); margin-top: 10px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; color: var(--ink-3); font-weight: 500; font-family: var(--font-sans); }
.stat .delta { font-size: 11.5px; margin-top: 6px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }

.ic.v-vencido { background: var(--vencido-soft); color: var(--vencido); }
.ic.v-averiado { background: var(--averiado-soft); color: var(--averiado); }
.ic.v-brand { background: var(--brand-soft); color: var(--brand-strong); }
.ic.v-ok { background: var(--ok-soft); color: var(--ok); }

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-bar .search { flex: 1; min-width: 200px; position: relative; }
.filter-bar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-3); }
.filter-bar .search .input { padding-left: 34px; }
.filter-bar .select { width: auto; min-width: 150px; }
.seg {
  display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 3px; gap: 2px;
}
.seg button {
  border: none; background: transparent; padding: 6px 12px; border-radius: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.seg button.active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm); }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: oklch(0.2 0.02 258 / 0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 200;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden;
  animation: pop .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .left { margin-right: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ============================================================
   Product search combobox
   ============================================================ */
.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 264px; overflow-y: auto; padding: 4px;
}
.combo-opt { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.combo-opt:hover, .combo-opt.hl { background: var(--brand-soft); }
.combo-opt .code { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--brand-strong); background: var(--surface-3); padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }
.combo-opt .desc { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.combo-add { padding: 9px 10px; margin: 4px 0 0; border-top: 1px solid var(--line); color: var(--brand-strong); font-weight: 600; font-size: 12.5px; cursor: pointer; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 8px; }
.combo-add:hover { background: var(--brand-soft); }

/* ============================================================
   Charts
   ============================================================ */
.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.bars { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 12px; }
.bar-row .lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.bar-track { height: 26px; background: var(--surface-3); border-radius: 5px; overflow: hidden; display: flex; }
.bar-seg { height: 100%; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.bar-seg.v { background: var(--vencido); }
.bar-seg.a { background: var(--averiado); }
.bar-row .tot { font-family: var(--font-mono); font-size: 13px; font-weight: 600; min-width: 36px; text-align: right; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 4px 2px 0; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }

.trend { width: 100%; height: 200px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; padding: 8px 0; }
.donut-legend { display: flex; flex-direction: column; gap: 12px; }
.donut-legend .li { display: flex; align-items: center; gap: 10px; }
.donut-legend .sw { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.donut-legend .li .v { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.donut-legend .li .l { font-size: 12px; color: var(--ink-3); }

/* ============================================================
   Login
   ============================================================ */
.login-wrap {
  height: 100%; display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.login-art {
  background:
    radial-gradient(circle at 18% 22%, oklch(0.45 0.14 var(--brand-h) / 0.55), transparent 42%),
    radial-gradient(circle at 82% 78%, oklch(0.4 0.12 calc(var(--brand-h) + 30) / 0.5), transparent 46%),
    linear-gradient(150deg, oklch(0.28 0.06 258), oklch(0.18 0.03 258));
  color: white; padding: 52px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art .grid-bg { position: absolute; inset: 0; opacity: 0.5;
  background-image: linear-gradient(oklch(1 0 0 / 0.05) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / 0.05) 1px, transparent 1px);
  background-size: 38px 38px; }
.login-art .brand-row { display: flex; align-items: center; gap: 12px; position: relative; }
.login-art .brand-row .brand-mark { width: 42px; height: 42px; font-size: 20px; border-radius: 10px; }
.login-art .brand-row .t { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.login-art h2 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 14px; position: relative; max-width: 16ch; }
.login-art p { font-size: 14px; color: oklch(0.82 0.02 258); position: relative; max-width: 38ch; line-height: 1.6; }
.login-art .foot { font-size: 12px; color: oklch(0.66 0.02 258); position: relative; }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 23px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.login-card .sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 26px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-error { background: var(--vencido-soft); color: var(--vencido); border: 1px solid color-mix(in oklch, var(--vencido) 30%, transparent); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.demo-creds { margin-top: 22px; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px 14px; }
.demo-creds .h { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.demo-creds .crow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 12.5px; border-top: 1px solid var(--line); }
.demo-creds .crow:first-of-type { border-top: none; }
.demo-creds .crow .who { color: var(--ink-2); font-weight: 600; }
.demo-creds .crow code { font-family: var(--font-mono); font-size: 11.5px; color: var(--brand-strong); cursor: pointer; background: var(--brand-softer); padding: 2px 6px; border-radius: 4px; }
.demo-creds .crow code:hover { background: var(--brand-soft); }

.pwd-wrap { position: relative; }
.pwd-wrap .input { padding-right: 40px; }
.pwd-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* ============================================================
   Toast
   ============================================================ */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; background: oklch(0.24 0.02 258); color: white;
  padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: toastin .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } }
.toast svg { width: 17px; height: 17px; }
.toast.ok svg { color: oklch(0.75 0.15 155); }
.toast.err svg { color: oklch(0.7 0.16 25); }

/* ============================================================
   Misc helpers
   ============================================================ */
.help-note { display: flex; gap: 10px; padding: 11px 13px; background: var(--brand-softer); border: 1px solid var(--brand-line); border-radius: var(--radius); font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.help-note svg { width: 17px; height: 17px; color: var(--brand); flex-shrink: 0; margin-top: 1px; }
.help-note.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 30%, transparent); }
.help-note.warn svg { color: oklch(0.6 0.14 75); }

.lock-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.lock-pill svg { width: 13px; height: 13px; }
.edit-window { font-size: 11px; font-family: var(--font-mono); color: var(--ok); font-weight: 600; }
.edit-window.expired { color: var(--ink-3); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 34px 20px; text-align: center; color: var(--ink-3);
  transition: border-color .12s, background .12s; cursor: pointer; background: var(--surface-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone svg { width: 34px; height: 34px; color: var(--brand); margin-bottom: 10px; }
.dropzone .t { font-weight: 600; color: var(--ink); font-size: 14px; }
.dropzone .s { font-size: 12.5px; margin-top: 4px; }
.dropzone .fmt { margin-top: 12px; font-family: var(--font-mono); font-size: 11px; background: var(--surface-3); display: inline-block; padding: 4px 10px; border-radius: 5px; color: var(--ink-2); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: none; background: transparent; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand-strong); border-bottom-color: var(--brand); }

.section-gap > * + * { margin-top: 18px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .chart-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 264px; }
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 150;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.7,.3,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: oklch(0.2 0.02 258 / 0.4); z-index: 140; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
  .topbar .branch-chip .lbl-long { display: none; }
  .page-head h1 { font-size: 18px; }
}

/* ============================================================
   Dark theme — paleta baratote (rojo #FF0F1F · dorado #D4A017 · negro #0A0A0A)
   ============================================================ */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #151515;
  --surface-2: #101010;
  --surface-3: #202020;
  --line: rgba(217, 217, 217, 0.12);
  --line-strong: rgba(217, 217, 217, 0.22);
  --ink: #ffffff;
  --ink-2: #d9d9d9;
  --ink-3: #8c8c8c;
  --ink-on-brand: #ffffff;

  --brand: #ff0f1f;
  --brand-strong: #d60c1a;
  --brand-soft: rgba(255, 15, 31, 0.16);
  --brand-softer: rgba(255, 15, 31, 0.07);
  --brand-line: rgba(255, 15, 31, 0.34);

  --gold: #d4a017;

  --vencido: #ff5a5f;
  --vencido-soft: rgba(255, 90, 95, 0.16);
  --averiado: #d4a017;
  --averiado-soft: rgba(212, 160, 23, 0.16);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #d4a017;
  --warn-soft: rgba(212, 160, 23, 0.16);
  --inactive: #7a7a7a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.72);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .sidebar { background: #0d0d0d; border-right-color: rgba(217, 217, 217, 0.1); }
[data-theme="dark"] .sidebar .brand { border-bottom-color: rgba(217, 217, 217, 0.1); }
[data-theme="dark"] .sidebar .user-card { border-top-color: rgba(217, 217, 217, 0.1); }
[data-theme="dark"] .nav-item { color: #cfcfcf; }
[data-theme="dark"] .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
[data-theme="dark"] .nav-label { color: #6a6a6a; }
[data-theme="dark"] .brand-tag { color: var(--gold); border-left-color: rgba(217, 217, 217, 0.18); }
[data-theme="dark"] .seg { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .seg button { color: var(--ink-2); }
[data-theme="dark"] .seg button.active { background: rgba(255, 255, 255, 0.12); color: #fff; }
[data-theme="dark"] .topbar .branch-chip { background: var(--brand-soft); color: #ff8a90; }
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.8); }
[data-theme="dark"] .stat .value { color: #fff; }
[data-theme="dark"] ::selection { background: var(--brand-soft); }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #333; border-color: var(--bg); }
[data-theme="dark"] .badge.role { background: var(--brand-soft); color: #ff8a90; }
[data-theme="dark"] .dropzone { background: #101010; }
[data-theme="dark"] .login-form-side { background: var(--bg); }
