/* ════════════════════════════════════════════════════════════
   SEOTRONIX ERP · sistema visual
   Adaptación del documento Seotronix (navy + rojo, Manrope) a UI de app
   ════════════════════════════════════════════════════════════ */

:root {
  /* marca */
  --navy:        #0d1b35;
  --navy-2:      #15294a;
  --navy-soft:   #243353;
  --red:         #e8234a;
  --red-2:       #cf1d40;
  --red-tint:    rgba(232, 35, 74, 0.08);

  /* texto */
  --ink:         #232f44;
  --ink-soft:    #51607a;
  --muted:       #8a97ac;
  --faint:       #aab4c4;

  /* superficies */
  --page:        #ffffff;
  --backdrop:    #eef1f6;
  --rule:        #e3e8f0;
  --rule-strong: #c9d2df;
  --fill:        #f6f8fb;
  --fill-2:      #eff3f8;

  /* semánticos finanzas */
  --pos:         #1f8a5b;
  --pos-tint:    rgba(31, 138, 91, 0.10);
  --neg:         #d2304a;
  --neg-tint:    rgba(210, 48, 74, 0.08);
  --warn:        #b6802a;
  --warn-tint:   rgba(182, 128, 42, 0.12);

  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;

  --sidebar-w: 248px;
  --topbar-h: 60px;
  --radius: 9px;
  --shadow-sm: 0 1px 2px rgba(13,27,53,0.05), 0 1px 1px rgba(13,27,53,0.04);
  --shadow-md: 0 2px 6px rgba(13,27,53,0.06), 0 8px 24px rgba(13,27,53,0.07);
  --shadow-lg: 0 12px 40px rgba(13,27,53,0.16);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

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

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

/* ───────────────────────── LAYOUT ───────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ───────────────────────── SIDEBAR ───────────────────────── */
.sidebar {
  background: var(--navy);
  color: #cdd6e6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #0a1429;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 17px 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.4px;
  color: #fff;
}
.wordmark .light { font-weight: 400; color: #aab8d0; }
.wordmark svg { margin-top: -6px; }
.sb-badge {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--red);
  padding: 2px 6px;
  border-radius: 4px;
}

.sb-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sb-group { margin-bottom: 18px; }
.sb-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #5c6b87;
  padding: 0 10px 8px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 7px;
  color: #b7c2d8;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.sb-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sb-item.active { background: var(--navy-soft); color: #fff; }
.sb-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px; bottom: 7px;
  width: 3px;
  background: var(--red);
  border-radius: 0 3px 3px 0;
}
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.8; }
.sb-item .sb-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #8493b0;
  background: rgba(255,255,255,0.07);
  padding: 1px 7px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.sb-item.is-soon { color: #5c6b87; cursor: default; }
.sb-item.is-soon:hover { background: none; color: #5c6b87; }
.sb-item.is-soon .tag-soon {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #5c6b87;
  border: 1px solid #2a3a59;
  padding: 1px 5px;
  border-radius: 4px;
}

.sb-foot {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 12px;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.sb-user:hover { background: rgba(255,255,255,0.06); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red), #b3163a);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sb-user .u-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user .u-role { font-size: 11px; color: #7e8db0; }

/* ───────────────────────── MAIN ───────────────────────── */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.tb-titles { display: flex; flex-direction: column; min-width: 0; }
.tb-title { font-size: 15.5px; font-weight: 700; color: var(--navy); letter-spacing: -0.2px; line-height: 1.2; }
.tb-sub { font-size: 11.5px; color: var(--muted); }
.tb-spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--fill);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 7px 12px;
  width: 230px;
  color: var(--muted);
}
.search svg { width: 15px; height: 15px; flex-shrink: 0; }
.search input {
  border: none; background: none; outline: none;
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  width: 100%;
}
.search .kbd {
  font-size: 10px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--rule-strong); border-radius: 4px;
  padding: 1px 5px; background: #fff;
}

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  position: relative;
}
.icon-btn:hover { border-color: var(--rule-strong); color: var(--navy); }
.icon-btn svg { width: 17px; height: 17px; stroke-width: 1.8; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid #fff;
}

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, transform 0.08s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke-width: 2; }
.btn-primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--navy-2); transform: translateY(-1px); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-2); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--navy-soft); background: var(--fill); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ───────────────────────── VIEWS ───────────────────────── */
.scroll { flex: 1; overflow-y: auto; }
.view { display: none; padding: 24px 26px 60px; max-width: 1320px; margin: 0 auto; }
.view.active { display: block; }
.view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.view-head .vh-text { min-width: 0; }
.view-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; color: var(--navy); }
.view-head .vh-sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.view-head .vh-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* segmented / tabs */
.tabs { display: flex; gap: 2px; background: var(--fill-2); border: 1px solid var(--rule); border-radius: 9px; padding: 3px; }
.tabs button {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); background: none; border: none; cursor: pointer;
  padding: 6px 13px; border-radius: 6px; transition: background 0.12s, color 0.12s;
}
.tabs button:hover { color: var(--navy); }
.tabs button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

/* ───────────────────────── CARDS ───────────────────────── */
.card {
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--rule);
}
.card-head h3 { font-size: 13.5px; font-weight: 700; color: var(--navy); letter-spacing: -0.1px; }
.card-head .ch-sub { font-size: 11.5px; color: var(--muted); }
.card-head .ch-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.link-more {
  font-size: 12px; font-weight: 600; color: var(--red); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; background: none; border: none; font-family: var(--sans);
}
.link-more:hover { text-decoration: underline; }

.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }

/* KPI / stat */
.stat { padding: 16px 18px; }
.stat .s-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 7px;
}
.stat .s-label svg { width: 14px; height: 14px; stroke-width: 1.9; }
.stat .s-value {
  font-size: 26px; font-weight: 800; letter-spacing: -0.8px; color: var(--navy);
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 10px;
}
.stat .s-value .cur { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 3px; }
.stat .s-value .dec { color: var(--muted); font-weight: 700; }
.stat .s-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta svg { width: 13px; height: 13px; stroke-width: 2.4; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--neg); }
.s-meta .s-note { color: var(--muted); }

/* ───────────────────────── TABLE ───────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
  text-align: left; font-weight: 700; font-size: 10.5px; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 16px; border-bottom: 1px solid var(--rule); white-space: nowrap;
  background: var(--fill); position: sticky; top: 0; z-index: 1;
}
table.tbl tbody td {
  padding: 11px 16px; border-bottom: 1px solid var(--rule); color: var(--ink); vertical-align: middle;
}
table.tbl tbody tr { transition: background 0.1s; }
table.tbl tbody tr:hover { background: var(--fill); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.tbl .col-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.amt-pos { color: var(--pos); }
.amt-neg { color: var(--ink); }
td .t-desc { font-weight: 600; color: var(--navy); }
td .t-sub { font-size: 11.5px; color: var(--muted); }

/* chips / badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px;
  border-radius: 20px; border: 1px solid var(--rule-strong); color: var(--ink-soft);
  background: #fff; white-space: nowrap;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px;
  letter-spacing: 0.2px; white-space: nowrap;
}
.badge.pos { background: var(--pos-tint); color: var(--pos); }
.badge.neg { background: var(--neg-tint); color: var(--neg); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.navy { background: var(--fill-2); color: var(--navy-soft); }
.badge.red { background: var(--red-tint); color: var(--red); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* account tile */
.acct {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border-bottom: 1px solid var(--rule); cursor: pointer; transition: background 0.1s;
}
.acct:last-child { border-bottom: none; }
.acct:hover { background: var(--fill); }
.acct-logo {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff;
}
.acct-main { min-width: 0; flex: 1; }
.acct-name { font-weight: 700; color: var(--navy); font-size: 13.5px; }
.acct-type { font-size: 11.5px; color: var(--muted); }
.acct-bal { text-align: right; }
.acct-bal .b-val { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); font-size: 14.5px; }
.acct-bal .b-cur { font-size: 11px; color: var(--muted); font-weight: 600; }

/* category bar */
.cat-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.cat-row .c-name { font-size: 13px; font-weight: 600; color: var(--ink); width: 150px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.cat-row .c-track { flex: 1; height: 8px; border-radius: 5px; background: var(--fill-2); overflow: hidden; }
.cat-row .c-fill { height: 100%; border-radius: 5px; }
.cat-row .c-val { width: 110px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--navy); flex-shrink: 0; }
.cat-row .c-pct { width: 42px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* filter bar */
.filterbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.select, .field {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px; background: #fff;
  padding: 7px 11px; outline: none; cursor: pointer;
}
.select:focus, .field:focus { border-color: var(--navy-soft); }
.field { cursor: text; }
.flt-spacer { flex: 1; }
.flt-count { font-size: 12px; color: var(--muted); }

/* employee row */
.emp {
  display: grid; grid-template-columns: 1fr; gap: 0;
}
.emp-meta { font-size: 11.5px; color: var(--muted); }

/* progress mini */
.mini-prog { height: 6px; border-radius: 4px; background: var(--fill-2); overflow: hidden; width: 100%; }
.mini-prog > span { display: block; height: 100%; background: var(--navy-soft); border-radius: 4px; }

/* timeline / actions */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--rule); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--rule-strong);
}
.tl-item.done::before { background: var(--pos); border-color: var(--pos); }
.tl-item.active::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.tl-date { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; color: var(--muted); }
.tl-title { font-size: 13.5px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.tl-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* doc list */
.doc-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.doc-item:last-child { border-bottom: none; }
.doc-ic {
  width: 34px; height: 40px; border-radius: 5px; background: var(--fill);
  border: 1px solid var(--rule-strong); display: grid; place-items: center; flex-shrink: 0;
  font-size: 8.5px; font-weight: 800; color: var(--ink-soft); letter-spacing: 0.3px;
}
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-weight: 600; color: var(--navy); font-size: 13px; }
.doc-meta { font-size: 11.5px; color: var(--muted); }

/* empty / soon */
.soon-wrap { display: grid; place-items: center; padding: 60px 20px; text-align: center; }
.soon-wrap .soon-ic { width: 54px; height: 54px; border-radius: 14px; background: var(--fill-2); display: grid; place-items: center; color: var(--muted); margin-bottom: 16px; }
.soon-wrap h2 { font-size: 18px; color: var(--navy); font-weight: 800; }
.soon-wrap p { color: var(--ink-soft); font-size: 13.5px; max-width: 380px; margin-top: 6px; }

/* ───────────────────────── AGENT PANEL ───────────────────────── */
.agent {
  position: fixed; top: 0; right: 0; bottom: 0; width: 372px;
  background: #fff; border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  z-index: 200; display: flex; flex-direction: column;
}
.agent.open { transform: translateX(0); }
.agent-head {
  display: flex; align-items: center; gap: 11px; padding: 15px 18px;
  border-bottom: 1px solid var(--rule); background: var(--navy); color: #fff;
}
.agent-head .a-logo {
  width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,0.1);
  display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.15);
}
.agent-head .a-logo svg { width: 16px; height: 16px; color: var(--red); }
.agent-head h3 { font-size: 14px; font-weight: 700; }
.agent-head .a-sub { font-size: 11px; color: #9fb0cc; display: flex; align-items: center; gap: 5px; }
.agent-head .a-sub .live { width: 6px; height: 6px; border-radius: 50%; background: #3fce8e; }
.agent-head .a-close { margin-left: auto; background: rgba(255,255,255,0.08); border: none; color: #cdd6e6; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.agent-head .a-close:hover { background: rgba(255,255,255,0.16); color: #fff; }
.agent-body { flex: 1; overflow-y: auto; padding: 18px; background: var(--fill); }
.msg { margin-bottom: 16px; max-width: 90%; }
.msg.user { margin-left: auto; }
.msg .bubble {
  padding: 10px 13px; border-radius: 12px; font-size: 13px; line-height: 1.5;
}
.msg.bot .bubble { background: #fff; border: 1px solid var(--rule); color: var(--ink); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--navy); color: #fff; border-top-right-radius: 4px; }
.msg .who { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.msg.user .who { text-align: right; }
.agent-card {
  background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 12px; margin-top: 9px;
}
.agent-card .ac-label { font-size: 10px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--red); margin-bottom: 7px; }
.agent-card .ac-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.agent-card .ac-row b { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.agent-foot { padding: 13px; border-top: 1px solid var(--rule); background: #fff; }
.agent-input {
  display: flex; align-items: flex-end; gap: 8px;
  border: 1px solid var(--rule-strong); border-radius: 11px; padding: 8px 8px 8px 13px; background: #fff;
}
.agent-input textarea {
  flex: 1; border: none; outline: none; resize: none; font-family: var(--sans);
  font-size: 13px; color: var(--ink); line-height: 1.45; max-height: 90px; background: none;
}
.agent-input .send { width: 32px; height: 32px; border-radius: 8px; background: var(--red); border: none; cursor: pointer; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.agent-input .send:hover { background: var(--red-2); }
.agent-input .send svg { width: 16px; height: 16px; }
.agent-suggest { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.agent-suggest button {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; color: var(--navy-soft);
  background: var(--fill); border: 1px solid var(--rule); border-radius: 20px; padding: 5px 11px; cursor: pointer;
}
.agent-suggest button:hover { border-color: var(--navy-soft); background: #fff; }

.scrim { position: fixed; inset: 0; background: rgba(13,27,53,0.32); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 150; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ───────────────────────── MODAL ───────────────────────── */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(13,27,53,0.4); z-index: 300;
  display: none; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow-y: auto;
}
.modal-scrim.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 540px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.18s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--rule); }
.modal-head h2 { font-size: 16px; font-weight: 800; color: var(--navy); letter-spacing: -0.3px; }
.modal-head .m-close { margin-left: auto; background: var(--fill); border: 1px solid var(--rule); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; color: var(--ink-soft); }
.modal-head .m-close:hover { background: var(--fill-2); color: var(--navy); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--rule); background: var(--fill); }

.form-row { margin-bottom: 16px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label.lbl { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: 0.2px; }
.input, select.input {
  width: 100%; font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: 8px; padding: 9px 12px; outline: none; background: #fff;
}
.input:focus, select.input:focus { border-color: var(--navy-soft); box-shadow: 0 0 0 3px rgba(36,51,83,0.08); }
.seg { display: flex; gap: 0; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 9px; border: none; background: #fff; color: var(--ink-soft); cursor: pointer; border-left: 1px solid var(--rule); }
.seg button:first-child { border-left: none; }
.seg button.active.in { background: var(--pos-tint); color: var(--pos); }
.seg button.active.out { background: var(--neg-tint); color: var(--neg); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 400;
  opacity: 0; pointer-events: none; transition: all 0.25s; display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: #3fce8e; }

/* misc */
.muted { color: var(--muted); }
.sep { height: 1px; background: var(--rule); margin: 16px 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack-sm > * + * { margin-top: 10px; }

@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: 1fr; }
  .g-2-1, .g-1-2, .g-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .search { display: none; }
  .g-4 { grid-template-columns: 1fr 1fr; }
}

/* ───────────────────────── LOGIN ───────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 34px 32px; }
.login-brand { display: flex; align-items: center; gap: 7px; justify-content: center; margin-bottom: 6px; }
.login-card h1 { font-size: 18px; font-weight: 800; color: var(--navy); text-align: center; letter-spacing: -0.3px; }
.login-card .login-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 4px 0 22px; }
.login-card .form-row { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.login-err { background: var(--neg-tint); color: var(--neg); font-size: 12.5px; font-weight: 600; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; }

/* ───────────────────────── ALERTS / MESSAGES ───────────────────────── */
.alerts { position: fixed; top: 70px; right: 22px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.alert { background: #fff; border: 1px solid var(--rule); border-left: 3px solid var(--navy-soft); box-shadow: var(--shadow-md); padding: 11px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink); }
.alert.success { border-left-color: var(--pos); }
.alert.error { border-left-color: var(--neg); }

/* logo img en sidebar (opcional) */
.sb-logo-img { height: 20px; }

/* ── Quitar subrayado de los componentes que ahora son <a> (Django multipágina) ── */
.sidebar a, .btn, .acct, .link-more, a.card, .agent a, .doc-item a { text-decoration: none; }
.link-more:hover { text-decoration: underline; }
