/* ARGUS GRP · Sistema de diseño compartido — fuente única de estilos
   <link rel="stylesheet" href="../assets/argus.css">
   Editar aquí actualiza TODOS los módulos de la suite. */

/* ─── TOKENS ──────────────────────────────────────────────────────── */
:root {
  /* Fondos y superficies */
  --bg:    #0b0b0e;
  --bg2:   #16161b;
  --ink:   #1c2536;
  --ink2:  #334155;
  --muted: #64748b;
  --line:  #e7ecf3;
  --soft:  #f5f8fc;
  --panel: #ffffff;

  /* Brand */
  --brand:   #0b5cab;
  --brand-d: #084a8c;
  --brand-l: #dbeafe;
  --accent:  #0ea5a4;
  --accent-d:#0c8584;
  --accent-l:#ccfbf1;

  /* Semáforos */
  --green:         #16a34a;
  --green-bg:      #dcfce7;
  --green-border:  #bbf7d0;
  --amber:         #d97706;
  --amber-bg:      #fef3c7;
  --amber-border:  #fde68a;
  --red:           #dc2626;
  --red-bg:        #fee2e2;
  --red-border:    #fecaca;
  --violet:        #7c3aed;
  --violet-bg:     #ede9fe;
  --blue-bg:       #e0f0ff;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04), 0 2px 6px rgba(16,24,40,.04);
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --shadow-lg: 0 4px 8px rgba(16,24,40,.06), 0 16px 40px rgba(16,24,40,.10);

  /* Radios */
  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Transición */
  --t: all .16s ease;
}

/* ─── RESET ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow-x: hidden; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
a { text-decoration: none; }

/* ─── LAYOUT ──────────────────────────────────────────────────────── */
.app  { display: flex; min-height: 100vh; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content {
  padding: 24px 28px;
  max-width: 1240px;
  width: 100%;
}

/* ─── SIDEBAR ─────────────────────────────────────────────────────── */
.side {
  width: 252px;
  background: var(--bg);
  color: #cbd5e1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Brand / logo */
.brand { padding: 16px 18px 12px; }
.brand .logo {
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.brand .logo .mk {
  display: inline-flex;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2563eb, #0ea5a4);
  align-items: center;
  justify-content: center;
}
.brand .logo .mk svg { display: block; }
.brand .logo span { color: var(--accent); }

/* Space switcher */
.spsw {
  margin: 10px 12px 2px;
  background: var(--bg2);
  border: 1px solid #26262e;
  border-radius: var(--r);
  padding: 8px 10px;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.spsw .r  { display: flex; align-items: center; gap: 9px; }
.spsw .av {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: #26262e;
  display: flex; align-items: center; justify-content: center;
  color: #cbd5e1;
}
.spsw .nm  { font-size: 12.5px; font-weight: 700; color: #fff; line-height: 1.1; }
.spsw .sb  { font-size: 10px; color: #71737e; }
.spsw .cv  { margin-left: auto; color: #71737e; font-size: 11px; }
.spsw .mn  { display: none; margin-top: 8px; border-top: 1px solid #26262e; padding-top: 6px; }
.spsw.open .mn { display: block; }
.spsw .mn a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  color: #c7c9d1;
  font-size: 12px;
}
.spsw .mn a:hover { background: #26262e; }
.spsw .mn a.cur   { background: #1d2f42; color: #fff; }
.spsw .mn .dv     { height: 1px; background: #26262e; margin: 5px 0; }

/* Navigation */
.nav { padding: 8px 0; flex: 1; }
.nav .grp {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 18px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: var(--t);
}
.nav a:hover  { background: var(--bg2); }
.nav a.active {
  background: #1b1b22;
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.nav a.dim   { color: #565a66; cursor: default; }
.nav a.dim:hover { background: transparent; }
.nav a .ic   { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; opacity: .9; flex-shrink: 0; }
.nav a .tagx {
  margin-left: auto;
  font-size: 8.5px;
  background: #26262e;
  color: #8a909e;
  border-radius: 8px;
  padding: 1px 6px;
  letter-spacing: .5px;
}

/* Footer */
.side .foot {
  padding: 11px 18px;
  border-top: 1px solid #20202a;
  font-size: 11px;
  color: #64748b;
  line-height: 1.6;
}

/* ─── TOPBAR ──────────────────────────────────────────────────────── */
.top {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 8;
  flex-wrap: wrap;
}
.top .muni       { font-weight: 700; font-size: 15px; }
.top .breadcrumb { font-size: 12px; color: var(--muted); }
.top .breadcrumb span { color: var(--ink2); font-weight: 600; }
.top .tag {
  font-size: 11px;
  background: var(--blue-bg);
  color: var(--brand);
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
}
.top .right  { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

/* ─── PAGE HEADER ─────────────────────────────────────────────────── */
.ph {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.ph h1 { font-size: 22px; margin: 0; }
.ph p  { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.ph .actions { margin-left: auto; display: flex; gap: 8px; }

/* ─── BOTONES ─────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--r);
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--t);
  line-height: 1;
}
.btn:hover    { background: var(--soft); }
.btn.pri      { background: var(--brand);  color: #fff; border-color: var(--brand);  }
.btn.pri:hover{ background: var(--brand-d); }
.btn.acc      { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.acc:hover{ background: var(--accent-d); }
.btn.ghost    { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger   { color: var(--red); border-color: var(--red-border); }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm       { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
  border-radius: var(--r-sm);
}

/* ─── CARDS Y GRID ────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g4   { grid-template-columns: repeat(4, 1fr); }
.g3   { grid-template-columns: repeat(3, 1fr); }
.g2   { grid-template-columns: 1.3fr .9fr; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3    { margin: 0 0 4px; font-size: 15px; }
.card .desc { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.card.hover { transition: var(--t); cursor: pointer; }
.card.hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

/* ─── KPI CARDS ───────────────────────────────────────────────────── */
.kpi .lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.kpi .ico {
  width: 34px; height: 34px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-l), var(--accent-l));
}
.kpi .val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 10px;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.kpi .sub   { font-size: 11px; color: var(--muted); margin-top: 4px; }
.kpi .trend { font-size: 11.5px; font-weight: 700; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi .trend.up   { color: var(--green); }
.kpi .trend.down { color: var(--red); }

/* ─── BADGES ──────────────────────────────────────────────────────── */
.badge {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
.b-green  { background: var(--green-bg);  color: #15803d; border: 1px solid var(--green-border); }
.b-amber  { background: var(--amber-bg);  color: #b45309; border: 1px solid var(--amber-border); }
.b-red    { background: var(--red-bg);    color: #b91c1c; border: 1px solid var(--red-border);   }
.b-blue   { background: var(--blue-bg);   color: var(--brand); }
.b-gray   { background: #eef2f7; color: #64748b; }
.b-violet { background: var(--violet-bg); color: #6d28d9; }
.b-teal   { background: var(--accent-l);  color: var(--accent-d); }

/* ─── ALERTS ──────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  border: 1px solid;
}
.alert.ok   { background: var(--green-bg); border-color: var(--green-border); }
.alert.warn { background: var(--amber-bg); border-color: var(--amber-border); }
.alert.bad  { background: var(--red-bg);   border-color: var(--red-border);   }
.alert.info { background: var(--blue-bg);  border-color: #bfdcff; }
.alert .ai  { font-size: 18px; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.alert .ti  { font-weight: 700; font-size: 13.5px; }
.alert .tx  { font-size: 12.5px; color: #475569; margin-top: 3px; }
.alert.ok   .ti { color: #14532d; }
.alert.warn .ti { color: #78350f; }
.alert.bad  .ti, .alert.bad .tx { color: #7f1d1d; }

/* ─── TABLAS ──────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); }
table     { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td    { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line); }
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  background: #f8fafc;
  white-space: nowrap;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tr-hover tr:hover td { background: #fafcff; }
tfoot td {
  font-weight: 700;
  background: #f8fafc;
  border-top: 2px solid var(--line);
}
.mono { font-variant-numeric: tabular-nums; font-family: "SF Mono", "Fira Code", monospace; font-size: 12px; }

/* ─── FORMULARIOS ─────────────────────────────────────────────────── */
.field         { margin-bottom: 14px; }
.field label   { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--ink2); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: var(--t);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11,92,171,.12);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint    { font-size: 11px; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-group {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.field-group legend { font-size: 12px; font-weight: 700; color: var(--ink2); padding: 0 6px; }

/* Checkbox / radio custom */
.check-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; cursor: pointer; }
.check-row input[type=checkbox],
.check-row input[type=radio] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }

/* ─── MODAL / OVERLAY ─────────────────────────────────────────────── */
.ov {
  position: fixed; inset: 0;
  background: rgba(15,23,41,.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 20px;
}
.ov.show { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--r-xl);
  width: 640px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.modal.wide { width: 860px; }
.modal.sm   { width: 440px; }

.modal .mh {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.modal .mh h3 { margin: 0; font-size: 16px; }
.modal .mh .x {
  margin-left: auto;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  border: none;
  background: none;
  line-height: 1;
}
.modal .mb { padding: 22px; overflow-y: auto; flex: 1; }
.modal .mf {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ─── TABS ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tabs button {
  border: none;
  background: none;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--t);
}
.tabs button.on  { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover:not(.on) { color: var(--ink2); }
.tabs.pills { border-bottom: none; gap: 6px; }
.tabs.pills button { border-bottom: none; border-radius: 20px; padding: 6px 14px; }
.tabs.pills button.on { background: var(--brand); color: #fff; }

/* ─── STEPPER ─────────────────────────────────────────────────────── */
.stepper { display: flex; gap: 0; margin-bottom: 18px; }
.stp {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  padding-bottom: 8px;
}
.stp.on   { color: var(--brand); }
.stp.done { color: var(--green); }
.stp .n {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #eef2f7;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 5px;
  font-size: 12px;
}
.stp.on   .n { background: var(--brand); color: #fff; }
.stp.done .n { background: var(--green); color: #fff; }

/* ─── TOOLBAR / SEARCH ────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar input.search,
.toolbar select {
  flex: 1;
  min-width: 170px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  background: #fff;
}
.toolbar input.search:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11,92,171,.10);
}

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  border: none;
  background: #fff;
  padding: 8px 13px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  transition: var(--t);
}
.seg button.on  { background: var(--brand); color: #fff; }
.seg button:hover:not(.on) { background: var(--soft); }

/* ─── TOAST ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r);
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(10px);
  transition: .25s;
  z-index: 50;
  max-width: 340px;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast.t-ok   { background: var(--green); }
.toast.t-warn { background: var(--amber); }
.toast.t-err  { background: var(--red);   }

/* ─── PROGRESS / GAUGE ────────────────────────────────────────────── */
.progress     { background: #eef2f7; border-radius: 99px; height: 10px; overflow: hidden; margin: 6px 0; }
.progress-bar { background: #eef2f7; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width .4s ease;
}
.gauge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  margin: 4px 0;
}
.gauge .g-track { flex: 1; background: #eef2f7; border-radius: 99px; height: 8px; overflow: hidden; }
.gauge .g-fill  { height: 100%; border-radius: 99px; background: var(--brand); }
.gauge .g-pct   { width: 38px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ─── BAR CHART (CSS-ONLY) ────────────────────────────────────────── */
.bar     { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.bar .nm { width: 150px; color: #475569; flex-shrink: 0; }
.bar .track {
  flex: 1;
  background: #eef2f7;
  border-radius: 6px;
  height: 18px;
  overflow: hidden;
}
.bar .fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}
.bar .vv {
  width: 120px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink2);
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── FLUJO / MOMENTOS DEL GASTO ─────────────────────────────────── */
/* Stepper horizontal de 6 pasos */
.mflow {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 14px 0;
  overflow-x: auto;
  padding-bottom: 4px;
}
.mflow .mstp {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
  position: relative;
}
.mflow .mstp::before {
  content: '';
  position: absolute;
  top: 13px;
  right: 0; left: 50%;
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}
.mflow .mstp:last-child::before { display: none; }
.mflow .mstp .mn {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  margin-bottom: 5px;
  position: relative;
  z-index: 1;
}
.mflow .mstp.done .mn,
.mflow .mstp.done::before { background: var(--green); color: #fff; }
.mflow .mstp.on   .mn     { background: var(--brand); color: #fff; }
.mflow .mstp.on            { color: var(--brand); }
.mflow .mstp.done          { color: var(--green); }

/* ─── DOCUMENTO OFICIAL ───────────────────────────────────────────── */
.doc {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  background: #fff;
  font-size: 12.5px;
  color: var(--ink);
}
.doc .dh {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.doc .escudo {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--brand);
  font-size: 10px;
  text-align: center;
  line-height: 1.1;
  flex-shrink: 0;
}
.doc .folio {
  margin-left: auto;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}
.doc .folio strong { display: block; font-size: 15px; color: var(--ink); }
.doc dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0 0 12px;
}
.doc dt { color: var(--muted); font-size: 11px; }
.doc dd { margin: 0; font-weight: 600; }
.doc .sello {
  margin-top: 20px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  display: flex;
  justify-content: space-around;
  text-align: center;
  font-size: 11px;
}
.doc .sello .ln { border-top: 1px solid #475569; width: 180px; margin: 32px auto 4px; }
.doc .qr {
  width: 64px; height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}

/* ─── UTILIDADES ──────────────────────────────────────────────────── */
.up     { color: var(--green); }
.down   { color: var(--red);   }
.muted  { color: var(--muted); }
.small  { font-size: 11px; color: var(--muted); }
.link   { color: var(--brand); cursor: pointer; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.flex-c  { display: flex; align-items: center; }
.flex-bc { display: flex; align-items: center; justify-content: space-between; }
.gap-8   { gap: 8px;  }
.gap-12  { gap: 12px; }
.note    { font-size: 11.5px; color: var(--muted); margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rowact  { display: flex; gap: 6px; justify-content: flex-end; }
.totbox  { background: var(--soft); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.totbox .ln     { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; }
.totbox .ln.tot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 800; font-size: 16px; }

/* AI / Violet chip */
.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--violet-bg);
  color: #6d28d9;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

/* ─── DEMO BANNER ─────────────────────────────────────────────────── */
.demo-banner {
  background: linear-gradient(90deg, #0b5cab, #0ea5a4);
  color: #fff;
  text-align: center;
  font-size: 11.5px;
  padding: 6px 12px;
  letter-spacing: .3px;
  font-weight: 500;
}

/* ─── BOTTOM NAV (móvil — módulos de campo) ───────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 6px 4px env(safe-area-inset-bottom, 0px);
  z-index: 20;
  justify-content: space-around;
  box-shadow: 0 -2px 16px rgba(0,0,0,.07);
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: var(--r);
  cursor: pointer;
  text-decoration: none;
  flex: 1;
  transition: var(--t);
  letter-spacing: .2px;
}
.bn-item svg { width: 22px; height: 22px; stroke-width: 1.5; }
.bn-item.active { color: var(--brand); }
.bn-item:active { background: var(--brand-l); }

/* ─── FAB (floating action button — acción primaria en campo) ─────── */
.fab {
  position: fixed;
  bottom: calc(64px + 14px);
  right: 18px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  box-shadow: 0 4px 18px rgba(11,92,171,.42);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: var(--t);
}
.fab:hover   { background: var(--brand-d); transform: scale(1.06); }
.fab:active  { transform: scale(0.93); }
.fab svg     { width: 24px; height: 24px; pointer-events: none; }

/* ─── ANIMACIONES ─────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in  { animation: fadeIn  .22s ease both; }
.slide-up { animation: slideUp .24s ease both; }

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */

/* Overlay para drawer móvil (se añade via shell.js) */
.side-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.52);
  backdrop-filter: blur(1px);
  z-index: 39;
}
.side-overlay.show { display: block; }

/* Botón hamburguesa — oculto en desktop, visible en móvil */
.menu-btn {
  display: none;
  border: none;
  background: none;
  padding: 6px;
  margin-right: 4px;
  cursor: pointer;
  color: var(--ink2);
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--t);
}
.menu-btn:hover { background: var(--soft); }

/* ── 1080px: desktop amplio ─────────────────────────────────────── */
@media (max-width: 1080px) {
  .g4      { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 20px 18px; }
}

/* ── 900px: tablet horizontal ───────────────────────────────────── */
@media (max-width: 900px) {
  .side { width: 220px; }
  .g3   { grid-template-columns: repeat(2, 1fr); }
  .g2   { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
}

/* ── 768px: tablet vertical / móvil — sidebar drawer ───────────── */
@media (max-width: 768px) {
  /* Sidebar se convierte en drawer deslizable desde la izquierda */
  .side {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 265px !important;
    height: 100vh !important;
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 40;
  }
  .side.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0,0,0,.32);
  }

  /* El main ocupa todo el ancho */
  .app  { flex-direction: row; }
  .main { width: 100%; min-width: 0; }

  /* Hamburguesa visible */
  .menu-btn { display: inline-flex; }

  /* Grids */
  .g4  { grid-template-columns: repeat(2, 1fr); }
  .g3  { grid-template-columns: 1fr; }
  .g2  { grid-template-columns: 1fr; }

  /* Formularios */
  .row2, .row3 { grid-template-columns: 1fr; }

  /* Topbar */
  .top { padding: 10px 14px; }
  .top .breadcrumb { display: none; }
  .content { padding: 14px 12px; }

  /* Bar chart: nombres más cortos */
  .bar .nm { width: 90px; font-size: 11px; }
  .bar .vv { width: 80px; font-size: 11px; }

  /* Espacio para bottom nav */
  .content { padding-bottom: 88px; }

  /* Bottom nav y FAB visibles */
  .bottom-nav { display: flex; }
  .fab        { display: flex; }

  /* Toast: sube sobre el FAB */
  .toast { bottom: 88px; right: 12px; left: 12px; max-width: none; }

  /* ── Overrides para grids definidas inline en módulos ──
     !important necesario porque el <style> del módulo carga
     después de argus.css en el <head> y tiene igual especificidad */
  .kpi-grid       { grid-template-columns: repeat(2, 1fr) !important; }
  .cuadrante-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .bar-row        { grid-template-columns: 140px 1fr !important; }
  .bar-row .bar-val { display: none; }
}

/* ── 480px: móvil pequeño ───────────────────────────────────────── */
@media (max-width: 480px) {
  .g4 { grid-template-columns: 1fr; }

  /* Modal: sheet desde abajo (más natural en móvil) */
  .ov    { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0 !important;
    width: 100% !important;
    max-height: 92vh;
  }

  /* Tabs: scroll horizontal sin salto de línea */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex-shrink: 0; }

  /* KPI: valor algo más compacto */
  .kpi .val { font-size: 22px; }

  /* Page header: acciones debajo del título */
  .ph { flex-direction: column; align-items: flex-start; }
  .ph .actions { margin-left: 0; width: 100%; justify-content: flex-start; }

  /* Toolbar: columna */
  .toolbar { flex-direction: column; }
  .toolbar input.search,
  .toolbar select { min-width: 0; width: 100%; }

  /* Stepper compacto */
  .stp       { font-size: 9.5px; }
  .stp .n    { width: 22px; height: 22px; font-size: 10px; }

  /* ── Overrides módulos — todo a 1 columna en móvil pequeño ── */
  .kpi-grid, .ficha-grid, .prop-grid,
  .form-grid, .cuadrante-grid,
  .spei-card { grid-template-columns: 1fr !important; }
  .bar-row   { grid-template-columns: 1fr !important; }
  .bar-row .bar-val { display: block; }
}
