/* Hospitales San Roque - AI voice assistant demo panel */
:root {
  --brand: #76b729;
  --brand-ink: #3f7410;
  --brand-soft: #dcecc8;
  --brand-softer: #ebf4df;

  --teal-950: #082b2c;
  --teal-900: #0b3b3c;
  --teal-800: #10504f;
  --teal-700: #176663;
  --teal-600: #1f7d78;
  --teal-100: #d3e6e3;
  --teal-50: #e6f0ee;

  --bg: #e3eae0;
  --surface: #f4f7f0;
  --surface-2: #ecf1e7;
  --surface-3: #e0e8da;
  --line: #c9d5c4;
  --line-strong: #a9bba4;

  --ink: #0f2427;
  --ink-2: #2f4549;
  --ink-3: #4f6569;

  /* action kinds */
  --cita-bg: #d4ecbd; --cita-ink: #2c5a09;
  --transfer-bg: #fbe0b6; --transfer-ink: #6e4200;
  --email-bg: #e2d9f6; --email-ink: #45298a;
  --info-bg: #cce7eb; --info-ink: #0b5260;
  --urgent-bg: #f7cfc8; --urgent-ink: #8a1f14;
  --query-bg: #d3e2f4; --query-ink: #1c4c86;
  --wa-bg: #c7ecd5; --wa-ink: #0f6634;
  --rule-bg: #f3e1c2; --rule-ink: #6a4a12;

  /* specialties (validated categorical set) */
  --sp-trauma: #1f6fb2;
  --sp-cardio: #2f7d32;
  --sp-gine: #c2477a;
  --sp-pedia: #c97a10;
  --sp-radio: #6a4fb3;
  --sp-derma: #00897b;
  --sp-oftal: #3d5fa8;
  --sp-urg: #b3402e;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(15, 36, 39, .06), 0 1px 3px rgba(15, 36, 39, .08);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* fallback size for inline icons (charts and flags have their own classes) */
svg:not([class]) { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--teal-900);
  color: #e3efec;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 14px 12px;
  gap: 14px;
}
.logo-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 10px;
  display: flex; justify-content: center; align-items: center;
  border-bottom: 3px solid var(--brand);
}
.logo-card img { width: 184px; max-width: 100%; height: auto; display: block; }
.product-tag {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--teal-800);
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: 12.5px; line-height: 1.25;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(118, 183, 41, .25); flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #cfe0dc;
  font-weight: 600;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--teal-800); color: #fff; }
.nav a.active { background: var(--brand); color: #0d2a06; }
.nav a.active svg { opacity: 1; }
.nav .badge { margin-left: auto; background: #e8a33a; color: #2b1800; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 800; }
.side-meter { margin-top: auto; background: var(--teal-800); border-radius: var(--radius); padding: 10px 12px; }
.side-meter .row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.side-meter .bar { height: 8px; background: var(--teal-950); border-radius: 5px; margin: 7px 0 4px; overflow: hidden; }
.side-meter .bar span { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.side-meter .plan { font-size: 12px; color: #bcd3cf; }

.main { min-width: 0; padding: 16px 22px 40px; }
.topline {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  margin-bottom: 14px;
  min-height: 40px;
}
.topline h1 { font-size: 22px; line-height: 1.1; margin: 0 6px 0 0; font-weight: 800; letter-spacing: -.01em; }
.topline .spacer { flex: 1; }
.date-chip { background: var(--teal-900); color: #e6f2ef; font-weight: 700; border-radius: 20px; padding: 5px 12px; font-size: 12.5px; }

/* ---------- Controls ---------- */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--teal-800); color: #fff; }
.field-inline { display: inline-flex; align-items: center; gap: 6px; }
.select, .input {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 13px;
  min-height: 34px;
}
.select:focus, .input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand-ink); }
.input.search { width: 220px; }
.btn {
  border: 0; border-radius: 7px; padding: 7px 13px; font-weight: 700; cursor: pointer;
  background: var(--teal-800); color: #fff; font-size: 13px; min-height: 34px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: var(--teal-700); }
.btn.green { background: var(--brand); color: #10300a; }
.btn.green:hover { background: #6aa823; }
.btn.light { background: var(--surface-3); color: var(--ink); }
.btn.light:hover { background: var(--line); }
.btn.danger { background: #f3d2cc; color: var(--urgent-ink); }
.btn.danger:hover { background: #ecbcb3; }
.btn.small { padding: 4px 9px; min-height: 28px; font-size: 12px; }
.pill-close { border: 0; background: var(--teal-900); color: #fff; border-radius: 20px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.pill-close:hover { background: var(--teal-700); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.card-h {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand-soft);
  border-bottom: 1px solid #c3dca6;
  padding: 9px 14px;
  min-height: 42px;
}
.card-h h2 { font-size: 14.5px; margin: 0; font-weight: 800; color: var(--teal-950); }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-h.teal { background: var(--teal-800); border-bottom-color: var(--teal-900); }
.card-h.teal h2 { color: #fff; }
.card-b { padding: 14px; }
.card-b.flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.kpi .k-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-weight: 800; font-size: 12.5px; }
.kpi .k-h svg { width: 16px; height: 16px; }
.kpi .k-b { padding: 8px 12px 12px; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-family: var(--font); font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 700; color: var(--ink-3); }
.kpi .sub { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.kpi.t-calls .k-h { background: var(--teal-800); color: #fff; }
.kpi.t-min .k-h { background: var(--brand); color: #10300a; }
.kpi.t-cita .k-h { background: var(--cita-bg); color: var(--cita-ink); }
.kpi.t-transfer .k-h { background: var(--transfer-bg); color: var(--transfer-ink); }
.kpi.t-email .k-h { background: var(--email-bg); color: var(--email-ink); }
.kpi.t-lang .k-h { background: var(--info-bg); color: var(--info-ink); }
.meter { height: 9px; background: var(--surface-3); border-radius: 6px; overflow: hidden; margin-top: 7px; position: relative; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.meter.over span { background: #d9822b; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 20px; padding: 2px 9px;
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.5;
}
.chip svg { width: 13px; height: 13px; }
.chip.cita { background: var(--cita-bg); color: var(--cita-ink); }
.chip.transfer { background: var(--transfer-bg); color: var(--transfer-ink); }
.chip.email { background: var(--email-bg); color: var(--email-ink); }
.chip.info { background: var(--info-bg); color: var(--info-ink); }
.chip.urgent { background: var(--urgent-bg); color: var(--urgent-ink); }
.chip.query, .chip.call { background: var(--query-bg); color: var(--query-ink); }
/* WhatsApp: official glyph, white on WhatsApp green */
.wa-glyph { width: 16px; height: 16px; flex: none; color: #25d366; vertical-align: -3px; }
.chip.wa { background: #25d366; color: #fff; }
.chip.wa .wa-glyph { color: #fff; }
.chip.live { background: var(--wa-bg); color: var(--wa-ink); }
.chip.ai { background: var(--cita-bg); color: var(--cita-ink); }
.h-wa { display: inline-flex; align-items: center; gap: 8px; }
h1.h-wa .wa-glyph { width: 24px; height: 24px; }
.nav a.active .wa-glyph { color: #fff; }
.kpi.t-wa .k-h { background: #25d366; color: #fff; }
.kpi.t-wa .k-h .wa-glyph { color: #fff; }
.wa-th .ph .wa-glyph { width: 13px; height: 13px; vertical-align: -2px; }
.chip.rule { background: var(--rule-bg); color: var(--rule-ink); }
.chip.neutral { background: var(--surface-3); color: var(--ink-2); }
.chip.dark { background: var(--teal-900); color: #e6f2ef; }
.chip.pending { background: #fbe7b5; color: #6b4a00; border: 1px dashed #c99a2b; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }

.lang {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 5px; padding: 2px 7px 2px 3px;
  font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--ink-2);
}
.lang .flag { width: 20px; height: 14px; border-radius: 2px; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.lang .flag.code { display: grid; place-items: center; font-size: 9px; color: #fff; background: #0f6b58; width: 20px; }
.lang.es { background: #f6e1c6; color: #6b3b00; }
.lang.en { background: #d7e1f3; color: #1d3f7a; }
.lang.de { background: #eadbd0; color: #5a2c10; }
.lang.ar { background: #cfe9de; color: #0d5a43; }
.lang.fr { background: #dde0f6; color: #2d3487; }
.lang.it { background: #d9ecd2; color: #23591a; }

.sp-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.sp-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t thead th {
  background: var(--teal-800); color: #f0f7f5;
  text-align: left; font-weight: 700; font-size: 12.5px;
  padding: 9px 12px; white-space: nowrap; position: sticky; top: 0;
}
table.t tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:nth-child(even) td { background: var(--surface-2); }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover td { background: var(--brand-softer); }
table.t .day-row td { background: var(--teal-50) !important; font-weight: 800; color: var(--teal-800); padding: 6px 12px; font-size: 12.5px; }
table.t td.when { white-space: nowrap; }
table.t td.when b { display: block; font-size: 13.5px; }
table.t td.when span { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.reason b { display: block; font-weight: 700; }
.reason span { font-size: 12.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.empty { padding: 30px 16px; text-align: center; font-weight: 700; color: var(--ink-2); background: var(--surface-2); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: #cdd8c8; stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-weight: 600; }
.chart .bar { fill: var(--teal-600); }
.chart .bar.today { fill: var(--brand); }
.chart .bar.weekend { fill: #6fa5a0; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { filter: brightness(1.12); }
.chart .limit { stroke: #c0392b; stroke-width: 2; stroke-dasharray: 6 4; }
.chart .limit-label { fill: #a0281b; font-size: 11.5px; font-weight: 800; }
.chart .cum { fill: none; stroke: var(--teal-700); stroke-width: 2.5; }
.chart .proj { fill: none; stroke: #d9822b; stroke-width: 2; stroke-dasharray: 5 4; }
.chart .dot { fill: var(--teal-700); stroke: var(--surface); stroke-width: 2; }
.chart .val-label { fill: var(--ink); font-size: 11.5px; font-weight: 800; }
.tooltip {
  position: fixed; pointer-events: none; z-index: 50;
  background: var(--teal-950); color: #fff; border-radius: 7px;
  padding: 7px 10px; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); display: none; max-width: 260px;
}
.tooltip b { color: #bfe48e; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.legend i.line { height: 3px; border-radius: 2px; vertical-align: 3px; }

/* ---------- Activity feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.feed li:nth-child(even) { background: var(--surface-2); }
.feed li.link { cursor: pointer; }
.feed li.link:hover { background: var(--brand-softer); }
.feed .time { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink-2); padding-top: 2px; }
.feed .what { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.feed .what .txt { font-weight: 600; font-size: 13px; }

/* breakdown bars */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 230px minmax(0, 1fr) 44px; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.hbar .track { height: 12px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 6px; }
.hbar .n { text-align: right; font-family: var(--mono); font-weight: 600; }

/* ---------- Call detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: 14px; align-items: start; }
.player { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--teal-900); color: #fff; }
.player .play { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--brand); color: #10300a; cursor: pointer; display: grid; place-items: center; flex: none; }
.player .play svg { width: 16px; height: 16px; }
.wave { flex: 1; height: 38px; display: flex; align-items: center; gap: 2px; cursor: pointer; min-width: 0; }
.wave i { flex: 1; background: #3f7f7a; border-radius: 2px; min-width: 1px; }
.wave i.played { background: var(--brand); }
.player .t { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.player .speed { background: var(--teal-800); border: 0; color: #fff; border-radius: 5px; padding: 3px 7px; font-weight: 700; cursor: pointer; font-size: 12px; }

.transcript { padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); max-height: 640px; overflow-y: auto; }
.turn { display: flex; flex-direction: column; max-width: 82%; }
.turn.agent { align-self: flex-start; }
.turn.caller { align-self: flex-end; align-items: flex-end; }
.turn .who { font-size: 11.5px; font-weight: 800; margin-bottom: 3px; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.turn .who .ts { font-family: var(--mono); font-weight: 500; }
.bubble { padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.turn.agent .bubble { background: var(--teal-800); color: #fff; border-top-left-radius: 3px; }
.turn.caller .bubble { background: #fff3dc; color: var(--ink); border: 1px solid #edd6a8; border-top-right-radius: 3px; }
.turn.current .bubble { box-shadow: 0 0 0 3px var(--brand); }
.bubble .tr { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(127,127,127,.45); font-size: 13px; }
.turn.agent .bubble .tr { color: #d6ece8; }
.turn.caller .bubble .tr { color: var(--ink-2); }
.bubble[dir="rtl"] .tr { direction: ltr; text-align: left; }
.lang-note { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--info-bg); color: var(--info-ink); font-weight: 700; font-size: 13px; flex-wrap: wrap; }

.timeline { list-style: none; margin: 0; padding: 12px 14px 4px; }
.timeline li { position: relative; padding: 0 0 14px 30px; }
.timeline li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .node { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.timeline .node svg { width: 12px; height: 12px; }
.timeline .node.cita { background: var(--cita-bg); color: var(--cita-ink); }
.timeline .node.transfer { background: var(--transfer-bg); color: var(--transfer-ink); }
.timeline .node.email { background: var(--email-bg); color: var(--email-ink); }
.timeline .node.info { background: var(--info-bg); color: var(--info-ink); }
.timeline .node.urgent { background: var(--urgent-bg); color: var(--urgent-ink); }
.timeline .node.query { background: var(--query-bg); color: var(--query-ink); }
.timeline .node.rule { background: var(--rule-bg); color: var(--rule-ink); }
.timeline .tl-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-h b { font-size: 13.5px; }
.timeline .tl-h .num { font-size: 11.5px; color: var(--ink-3); }
.timeline .tl-d { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.timeline .ok { font-size: 11.5px; font-weight: 800; color: var(--cita-ink); }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0; font-size: 13.5px; }
.kv > div { padding: 7px 14px; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { font-weight: 700; color: var(--ink-2); background: var(--surface-2); }
.summary { padding: 12px 14px; font-size: 14px; line-height: 1.55; background: var(--brand-softer); border-left: 4px solid var(--brand); }

/* ---------- WhatsApp ---------- */
.wa-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 92px); min-height: 520px; }
.wa-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); }
.wa-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.wa-item:hover { background: var(--brand-softer); }
.wa-item.on { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand-ink); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; }
.wa-item .nm { font-weight: 800; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item .pv { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11.5px; font-family: var(--mono); color: var(--ink-2); }
.wa-item .unread { background: #1fa855; color: #fff; border-radius: 10px; padding: 0 6px; font-family: var(--font); font-weight: 800; }
.wa-thread { display: flex; flex-direction: column; min-width: 0; }
.wa-th { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--teal-800); color: #fff; flex-wrap: wrap; }
.wa-th .nm { font-weight: 800; }
.wa-th .ph { font-family: var(--mono); font-size: 12px; color: #c9e1dd; }
.wa-th .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #dfe6d6; background-image: radial-gradient(rgba(16, 80, 79, .07) 1px, transparent 1px); background-size: 14px 14px; }
.msg { max-width: 70%; padding: 7px 10px 5px; border-radius: 9px; font-size: 13.5px; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.msg .by { font-size: 11px; font-weight: 800; margin-bottom: 2px; }
.msg .tm { font-size: 10.5px; font-family: var(--mono); color: var(--ink-3); text-align: right; margin-top: 2px; }
.msg.in { align-self: flex-start; background: #fff; }
.msg.out { align-self: flex-end; background: #d6f2c0; }
.msg.out.human { background: #fde7c0; }
.msg.out .by { color: var(--brand-ink); }
.msg.out.human .by { color: #8a5300; }
.msg.sys { align-self: center; background: var(--teal-900); color: #e6f2ef; font-size: 12px; font-weight: 700; border-radius: 14px; padding: 4px 12px; }
.msg .att { display: flex; gap: 8px; align-items: center; background: rgba(0,0,0,.06); border-radius: 6px; padding: 6px 8px; margin-bottom: 4px; font-weight: 700; font-size: 12.5px; }
.wa-compose { display: flex; gap: 8px; padding: 10px 12px; background: var(--surface-3); align-items: center; }
.wa-compose .input { flex: 1; }
.wa-compose .lock { flex: 1; font-weight: 700; color: var(--ink-2); font-size: 13px; }

/* ---------- Config ---------- */
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cfg-grid .wide { grid-column: 1 / -1; }
.form-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: 0; }
.form-row > label { font-weight: 700; font-size: 13px; }
textarea.input { min-height: 72px; resize: vertical; width: 100%; line-height: 1.45; }
.input.full, .select.full { width: 100%; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.toggle { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-weight: 700; font-size: 13px; user-select: none; }
.toggle.on { background: var(--brand-softer); border-color: #a8cf7a; }
.switch { width: 34px; height: 20px; border-radius: 12px; background: #b5c3b1; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on .switch, .switch.on { background: var(--brand-ink); }
.toggle.on .switch::after, .switch.on::after { left: 17px; }
.toggle.locked { cursor: default; }
.faq-item { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); align-items: start; }
.faq-item:nth-child(even) { background: var(--surface-2); }
.faq-head { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; padding: 8px 14px; background: var(--teal-800); color: #f0f7f5; font-weight: 700; font-size: 12.5px; }
.faq-item textarea.input { min-height: 54px; }
.integ { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: #fdf3da; border-bottom: 1px solid #ecd9a6; }
.integ b { font-size: 14px; }
td .input, td .select { width: 100%; min-height: 30px; padding: 4px 7px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Consumo ---------- */
.usage-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.big-meter .v { font-size: 34px; }
.big-meter .meter { height: 14px; }
.big-meter .scale { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-top: 4px; font-family: var(--mono); }

/* toast */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--teal-950); color: #fff; padding: 9px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; z-index: 60; box-shadow: 0 6px 18px rgba(0,0,0,.25); display: none; }
.toast.show { display: block; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 43, 44, .55); display: grid; place-items: center; z-index: 70; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(520px, 100%); overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal .card-b { display: flex; flex-direction: column; gap: 4px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; background: var(--surface-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .g-main-side, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .usage-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cfg-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; gap: 8px; z-index: 20; overflow-x: auto; }
  .logo-card { padding: 5px 8px; flex: none; border-bottom-width: 2px; }
  .logo-card img { width: 104px; }
  .product-tag, .side-meter { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { padding: 7px 9px; white-space: nowrap; font-size: 13px; }
  .nav a span.lbl { display: none; }
  .nav a.active span.lbl { display: inline; }
  .main { padding: 12px 16px 30px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .wa-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .wa-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wa-msgs { min-height: 380px; }
  .msg { max-width: 88%; }
  .usage-hero { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .faq-head { display: none; }
  .faq-item { grid-template-columns: minmax(0, 1fr); }
  .input.search { width: 100%; }
  .topline .spacer { display: none; }
  .hbar { grid-template-columns: 110px minmax(0, 1fr) 36px; }
  .turn { max-width: 94%; }
  table.t.responsive thead { display: none; }
  table.t.responsive tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
  table.t.responsive tbody tr:nth-child(even) { background: var(--surface-2); }
  table.t.responsive tbody td { padding: 0; border: 0; background: transparent !important; }
  table.t.responsive tbody td.c-res { grid-column: 1 / -1; }
  table.t.responsive tbody td.c-reason { grid-column: 1 / -1; }
}
table.t.compact thead th, table.t.compact tbody td { padding-left: 8px; padding-right: 8px; }
table.t.compact thead th:first-child, table.t.compact tbody td:first-child { padding-left: 14px; }

/* Guaranteed capacity */
.cap-chip { display: inline-flex; align-items: center; gap: 7px; background: #e3f2d0; color: #2f5a0c; border: 1.5px solid #76b729; border-radius: 20px; padding: 4px 6px 4px 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.cap-chip svg { width: 16px; height: 16px; color: #4f8a12; flex: none; }
.cap-chip b { font-weight: 800; }
.cap-now { background: #4f8a12; color: #fff; border-radius: 14px; padding: 2px 9px; font-weight: 700; margin-left: 4px; }
.cap-side { display: flex; align-items: center; gap: 10px; margin-top: 8px; background: rgba(118,183,41,.14); border: 1px solid rgba(118,183,41,.45); border-radius: 10px; padding: 8px 12px; color: #e8f4dc; font-size: 11.5px; }
.cap-side svg { width: 22px; height: 22px; color: #9ed35c; flex: none; }
.cap-side b { display: block; font-size: 13px; color: #fff; }
@media (max-width: 900px) {
  .cap-side { display: none; }
  .cap-chip { white-space: normal; flex-wrap: wrap; order: 5; width: 100%; padding: 6px 10px; }
  .cap-now { margin-left: 0; }
}
