/* ════════════════════════════════════════════════════════════
   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; }

/* ── Navegación mobile (hamburguesa + drawer) ── */
.nav-toggle {
  display: none; place-items: center; width: 36px; height: 36px;
  border-radius: 8px; border: 1px solid var(--rule); background: #fff;
  color: var(--navy); cursor: pointer; flex-shrink: 0;
}
.nav-toggle svg { width: 18px; height: 18px; stroke-width: 2; }
.nav-scrim { display: none; position: fixed; inset: 0; background: rgba(13,27,53,0.4); z-index: 310; }

@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) {
  .app { grid-template-columns: 1fr; }
  .search { display: none; }
  .g-4 { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: grid; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 320;
    width: 248px; height: 100vh; transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .nav-scrim.show { display: block; }
  /* Header del detalle de proyecto: las acciones bajan a una fila propia */
  .prj-head-row { flex-wrap: wrap; }
  .prj-head-row .prj-head-actions { width: 100%; }
  .prj-head-row .prj-head-actions .btn { flex: 1; }
}

/* ───────────────────────── 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; }

/* ───────────────────────── PLAN DE ACCIÓN (mensual) ───────────────────────── */
.plan-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--navy); color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}
.plan-banner .pb-title { font-size: 10.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--red); white-space: nowrap; }
.plan-banner .pb-freq { font-size: 12.5px; font-weight: 600; color: #cdd6e6; white-space: nowrap; }
.plan-banner .pb-spacer { flex: 1; }
.plan-banner .pb-legend { display: flex; gap: 12px; }
.plan-banner .pb-legend span { font-size: 11px; color: #9fb0cc; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.plan-banner .pb-legend .ld { width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 820px) { .plan-banner .pb-legend { display: none; } }

table.plan { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plan thead th {
  text-align: left; font-weight: 700; font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--muted); background: var(--fill); padding: 9px 14px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
}
table.plan td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.plan tbody tr:hover td { background: var(--fill); }
table.plan tbody tr.month-row:hover td { background: var(--navy-soft); }
table.plan .month-row td {
  background: var(--navy-soft); color: #fff; padding: 9px 14px;
  font-weight: 800; font-size: 12.5px; letter-spacing: 0.2px;
}
table.plan .month-row .mr-inner { display: flex; align-items: center; gap: 12px; }
table.plan .month-row .mr-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  background: rgba(255,255,255,0.14); color: #fff; padding: 2px 8px; border-radius: 5px;
}
table.plan .month-row .mr-stats { margin-left: auto; font-weight: 500; font-size: 11.5px; color: #aab8d0; display: flex; gap: 12px; }
table.plan .month-row .mr-stats b { color: #fff; font-weight: 700; }
.plan-date { font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; font-weight: 600; font-size: 12px; }
.plan-topic { font-weight: 700; color: var(--navy); line-height: 1.4; }
.plan-detail { color: var(--ink-soft); font-size: 12.5px; line-height: 1.5; max-width: 38ch; }
.plan-comment { color: var(--muted); font-size: 12px; font-style: italic; max-width: 22ch; line-height: 1.45; }
.col-estado { width: 1%; }
.col-doc { width: 1%; }

.st { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 6px; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.st.hecho     { background: var(--pos-tint);  color: var(--pos); }
.st.proceso   { background: var(--warn-tint); color: var(--warn); }
.st.standby   { background: var(--neg-tint);  color: var(--neg); }
.st.pendiente { background: var(--fill-2);    color: var(--navy-soft); }

.docdl {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--rule-strong); border-radius: 8px; padding: 6px 10px 6px 7px;
  background: #fff; transition: border-color 0.12s, background 0.12s; max-width: 220px;
}
.docdl:hover { border-color: var(--navy-soft); background: var(--fill); }
.docdl .dd-ic {
  width: 24px; height: 28px; border-radius: 4px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 7px; font-weight: 800; letter-spacing: 0.2px; color: #fff;
}
.docdl .dd-ic.DOC { background: #2a6fdb; }
.docdl .dd-ic.XLS { background: #1f8a5b; }
.docdl .dd-ic.PDF { background: var(--red); }
.docdl .dd-ic.SHEET { background: #1f8a5b; }
.docdl .dd-ic.LINK { background: var(--navy-soft); }
.docdl .dd-name { font-size: 12px; font-weight: 600; color: var(--navy); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docdl .dd-dl { color: var(--muted); flex-shrink: 0; }
.docdl .dd-dl svg { width: 14px; height: 14px; display: block; }
.doc-none { color: var(--faint); font-size: 12px; }

/* tabs internas del proyecto */
.prj-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.prj-tabs a {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; cursor: pointer; padding: 10px 4px; margin-right: 18px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.prj-tabs a:hover { color: var(--navy); }
.prj-tabs a.active { color: var(--navy); border-bottom-color: var(--red); }
.prj-tabs a .pt-count { font-size: 11px; color: var(--muted); font-weight: 700; margin-left: 5px; }
/* ════════════════════════════════════════════════════════════
   SEOTRONIX ERP · CRM — estilos del módulo de contactos
   Reutiliza las variables y patrones de styles.css
   ════════════════════════════════════════════════════════════ */

/* ── tabla de contactos ── */
.crm-tbl tbody tr { cursor: pointer; }
.crm-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.crm-ava {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff;
  letter-spacing: 0.2px;
}
.crm-id-main { min-width: 0; }
.crm-id-name { font-weight: 700; color: var(--navy); font-size: 13.5px; line-height: 1.25; }
.crm-id-email { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.crm-company { font-weight: 600; color: var(--ink); font-size: 13px; }
.crm-company .crm-web { display: block; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.crm-web a { color: inherit; text-decoration: none; }
.crm-web a:hover { color: var(--red); text-decoration: underline; }

.crm-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 3px 9px 3px 8px; border-radius: 20px;
  white-space: nowrap; line-height: 1.4;
}
.tag .tdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.crm-channel { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.crm-sub { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.crm-sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.crm-sub.suscrito { color: var(--pos); }
.crm-sub.sin-confirmar { color: var(--warn); }
.crm-sub.baja { color: var(--neg); }

.crm-rowact {
  opacity: 0; display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 7px; border: 1px solid var(--rule); background: #fff; color: var(--ink-soft);
  cursor: pointer; transition: opacity 0.12s, border-color 0.12s, color 0.12s;
}
.crm-tbl tbody tr:hover .crm-rowact { opacity: 1; }
.crm-rowact:hover { border-color: var(--navy-soft); color: var(--navy); }
.crm-rowact svg { width: 16px; height: 16px; stroke-width: 2; }

.crm-empty { display: grid; place-items: center; text-align: center; padding: 54px 20px; }
.crm-empty .soon-ic { width: 48px; height: 48px; border-radius: 13px; background: var(--fill-2); display: grid; place-items: center; color: var(--muted); margin-bottom: 14px; }
.crm-empty .soon-ic svg { width: 22px; height: 22px; }
.crm-empty .ce-title { font-weight: 700; color: var(--navy); font-size: 14px; }
.crm-empty .ce-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* quick tag filter pill active state in select isn't enough — keep simple */

/* ── DRAWER (detalle de contacto) ── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw;
  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: 220; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
}
.drawer-head .dh-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.dh-avatar {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
}
.drawer-head h3 { font-size: 16px; font-weight: 800; color: var(--navy); letter-spacing: -0.3px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head .dh-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head .a-close { background: var(--fill); border: 1px solid var(--rule); color: var(--ink-soft); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.drawer-head .a-close:hover { background: var(--fill-2); color: var(--navy); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--rule); background: var(--fill); }

.cd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.cd-field { padding: 11px 0; border-bottom: 1px solid var(--rule); display: flex; align-items: flex-start; gap: 14px; }
.cd-field:last-child { border-bottom: none; }
.cd-field .cf-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--muted); width: 96px; flex-shrink: 0; padding-top: 2px;
}
.cd-field .cf-val { font-size: 13.5px; color: var(--ink); font-weight: 500; flex: 1; min-width: 0; word-break: break-word; }
.cd-field .cf-val a { color: var(--red); text-decoration: none; font-weight: 600; }
.cd-field .cf-val a:hover { text-decoration: underline; }
.cd-field .cf-val.empty { color: var(--faint); font-weight: 400; }
.cd-field .cf-val.mono { font-family: var(--mono); font-size: 12.5px; }
.cd-notes {
  background: var(--fill); border: 1px solid var(--rule); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin-top: 4px;
}
.cd-section-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.cd-sub-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 8px; }
.cd-sub-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.cd-sub-pill.suscrito { background: var(--pos-tint); color: var(--pos); }
.cd-sub-pill.sin-confirmar { background: var(--warn-tint); color: var(--warn); }
.cd-sub-pill.baja { background: var(--neg-tint); color: var(--neg); }

/* ── tag picker (en el formulario) ── */
.tag-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-opt {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 20px;
  border: 1px solid var(--rule-strong); background: #fff; color: var(--ink-soft);
  cursor: pointer; transition: all 0.12s; user-select: none;
}
.tag-opt .tdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tag-opt:hover { border-color: var(--navy-soft); }
.tag-opt.on { color: #fff; border-color: transparent; }
.tag-opt.on .tdot { background: #fff !important; }

/* ── tag manager ── */
.tag-manage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.tag-manage-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border: 1px solid var(--rule); border-radius: 9px; background: #fff;
}
.tag-manage-item .tmi-swatch { width: 22px; height: 22px; border-radius: 7px; flex-shrink: 0; cursor: pointer; position: relative; }
.tag-manage-item .tmi-name {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--navy);
  border: none; background: none; outline: none; padding: 4px 2px; border-radius: 5px;
}
.tag-manage-item .tmi-name:focus { background: var(--fill); }
.tag-manage-item .tmi-count { font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.tag-manage-item .tmi-del {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--rule); background: #fff;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.tag-manage-item .tmi-del:hover { border-color: var(--neg); color: var(--neg); background: var(--neg-tint); }
.tag-manage-item .tmi-del svg { width: 14px; height: 14px; stroke-width: 2; }

.tag-add-row { display: flex; align-items: center; gap: 9px; }
.tag-add-row .input { flex: 1; }
.tag-color-picker, .tag-color-pop { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-color-picker .tc { width: 24px; height: 24px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; }
.tag-color-picker .tc.on { border-color: var(--navy); box-shadow: 0 0 0 2px #fff inset; }

/* color popover for editing existing tag color */
.tag-color-pop {
  position: fixed; z-index: 360; background: #fff; border: 1px solid var(--rule-strong);
  border-radius: 11px; box-shadow: var(--shadow-lg); padding: 10px; width: 168px;
}
.tag-color-pop .tc { width: 26px; height: 26px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; }
.tag-color-pop .tc.on { border-color: var(--navy); box-shadow: 0 0 0 2px #fff inset; }

/* drawer scrim shares the agent scrim (#scrim) */

/* ── CRM · extras de la versión Django ── */
.drawer-scrim { display: none; position: fixed; inset: 0; background: rgba(13,27,53,0.4); z-index: 210; }
.drawer-scrim.show { display: block; }
.tag-opt input, .tag-color-picker input { display: none; }
.tag-manage-item .tmi-colorsel {
  width: 34px; font-size: 0; color: transparent; border: 1px solid var(--rule);
  border-radius: 7px; height: 30px; cursor: pointer; background: var(--fill); flex-shrink: 0;
}
.tag-manage-item .tmi-save {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--rule); background: #fff;
  color: var(--pos); cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.tag-manage-item .tmi-save:hover { border-color: var(--pos); background: var(--pos-tint); }
.tag-manage-item .tmi-save svg { width: 15px; height: 15px; stroke-width: 2; }
@media (max-width: 860px) { .drawer { width: 92vw; } }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE MOBILE ≤640px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Padding de vistas ── */
  .view { padding: 14px 14px 48px; }

  /* ── view-head: apila verticalmente para que el subtitle no se aplaste ── */
  .view-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
  }
  .view-head .vh-actions {
    margin-left: 0;
    flex-wrap: wrap;
    width: 100%;
  }
  .view-head h1 { font-size: 19px; }
  .view-head .vh-sub { font-size: 12.5px; }

  /* ── Grids inline: colapsar todo a 1 columna en mobile ── */
  .view .grid,
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  /* Excepción: grids de 2 columnas chicas (stats) se mantienen en 2 */
  .g-2-stats { grid-template-columns: 1fr 1fr !important; }

  /* ── Tablas: scroll horizontal en lugar de romper el layout ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  table.plan { min-width: 560px; }

  /* ── card-head: wrap cuando hay muchos elementos ── */
  .card-head { flex-wrap: wrap; gap: 8px; }
  .card-head .ch-right { margin-left: auto; }

  /* ── Topbar ── */
  .topbar { padding: 0 12px; gap: 8px; }

  /* ── Botones en vh-actions: tamaño uniforme en mobile ── */
  .view-head .vh-actions .btn { font-size: 12px; padding: 6px 12px; }

  /* ── row-between: permitir wrap en mobile ── */
  .row-between { flex-wrap: wrap; gap: 8px; }

  /* ── Alertas flash: full width en mobile ── */
  .alerts { right: 10px; left: 10px; }
  .alert { font-size: 12.5px; }
}

/* ── ACS templates: grids específicos mobile ── */
@media (max-width: 640px) {
  .acs-grid-main,
  .acs-grid-2,
  [style*="230px 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Chat ACS: layout full-height correcto en desktop y mobile (iOS safe) ── */
.acs-chat-section {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
  /* Fallback para browsers sin dvh */
  height: calc(100vh - var(--topbar-h));
  /* dvh descuenta la barra del browser en iOS Safari */
  height: calc(100dvh - var(--topbar-h));
}
.acs-chat-section #js-history {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  /* Scroll suave en iOS */
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  /* En mobile el view-head apilado ya ocupa más espacio — ajustar */
  .acs-chat-section {
    height: calc(100svh - var(--topbar-h));
  }
}
