/* ============================================================
   MOTORFLASH · FacturacionIA — Sistema visual 2026
   Orange accent #EF8213 · Inter Tight · dark-first
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Tokens compartidos ───────────────────────────────────── */
:root {
  --ease: cubic-bezier(.2,.7,.2,1);
  --t-fast: 120ms var(--ease);
  --t-base: 200ms var(--ease);
  --t-slow: 320ms var(--ease);

  --r-sm: 7px; --r-md: 11px; --r-lg: 15px; --r-xl: 22px;
  --row-h: 46px;

  --font-primary: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --font:  var(--font-primary);
  --mono:  var(--font-mono);

  --sb-w: 236px;
  --sb-w-collapsed: 54px;

  /* backward compat aliases */
  --transition-fast:   var(--t-fast);
  --transition-base:   var(--t-base);
  --transition-normal: var(--t-base);
  --transition-slow:   var(--t-slow);
  --radius-sm: var(--r-sm); --radius-md: var(--r-md);
  --radius-lg: var(--r-lg); --radius-xl: var(--r-xl);
  --color-gray-medium: var(--muted);
}

/* ── OSCURO (default) ─────────────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg:          #0A0A0B;
  --surface:     #131316;
  --surface-2:   #1B1B1F;
  --surface-3:   #232328;
  --ink:         #F6F5F1;
  --ink-2:       #D9D8D2;
  --muted:       #9C9C95;
  --muted-2:     #6E6E68;
  --line:        #26262B;
  --line-strong: #36363D;

  --accent:       #F58E22;
  --accent-hover: #FF9D38;
  --accent-soft:  rgba(245,142,34,0.16);
  --accent-ink:   #FFB565;

  --ok:    #45C463; --ok-bg:   rgba(69,196,99,0.14);
  --warn:  #E0A33A; --warn-bg: rgba(224,163,58,0.15);
  --err:   #F2685C; --err-bg:  rgba(242,104,92,0.15);
  --info:  #5AA0E6; --info-bg: rgba(90,160,230,0.14);

  --sidebar:      #050506;
  --sidebar-line: rgba(255,255,255,0.07);
  --sidebar-ink:  rgba(255,255,255,0.92);
  --sidebar-mut:  rgba(255,255,255,0.52);
  --sidebar-dim:  rgba(255,255,255,0.24);
  --sidebar-hover:rgba(255,255,255,0.055);

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.45);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.5);
  --shadow-lg: 0 16px 42px rgba(0,0,0,0.6);
  --shadow-pop:0 24px 60px rgba(0,0,0,0.7);

  --chart-grid: rgba(255,255,255,0.07);
  --chart-axis: #6E6E68;

  /* backward compat */
  --shadow-soft:   var(--shadow-sm);
  --shadow-medium: var(--shadow-md);

  color-scheme: dark;
}

/* ── CLARO ────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #F7F6F2;
  --surface:     #FFFFFF;
  --surface-2:   #F2F1EC;
  --surface-3:   #ECEBE4;
  --ink:         #15140F;
  --ink-2:       #3A3A36;
  --muted:       #6B6B63;
  --muted-2:     #9A9A90;
  --line:        #E6E4DC;
  --line-strong: #D4D2C8;

  --accent:       #EF8213;
  --accent-hover: #D87410;
  --accent-soft:  rgba(239,130,19,0.10);
  --accent-ink:   #8A4405;

  --ok:   #1F8F3C; --ok-bg:   #E6F4EA;
  --warn: #B46A00; --warn-bg: #FBF0DA;
  --err:  #B42318; --err-bg:  #FBE9E7;
  --info: #0B5BA6; --info-bg: rgba(11,91,166,0.08);

  /* sidebar stays dark in light mode — intentional */
  --sidebar:      #15140F;
  --sidebar-line: rgba(255,255,255,0.08);
  --sidebar-ink:  rgba(255,255,255,0.92);
  --sidebar-mut:  rgba(255,255,255,0.50);
  --sidebar-dim:  rgba(255,255,255,0.26);
  --sidebar-hover:rgba(255,255,255,0.06);

  --shadow-xs: 0 1px 2px rgba(20,18,10,0.05);
  --shadow-sm: 0 1px 4px rgba(20,18,10,0.07);
  --shadow-md: 0 6px 18px rgba(20,18,10,0.09);
  --shadow-lg: 0 16px 42px rgba(20,18,10,0.13);
  --shadow-pop:0 24px 60px rgba(20,18,10,0.18);

  --chart-grid: rgba(20,18,10,0.07);
  --chart-axis: #9A9A90;

  --shadow-soft:   var(--shadow-sm);
  --shadow-medium: var(--shadow-md);

  color-scheme: light;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01','cv11';
  overflow-x: hidden;
}
body {
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  letter-spacing: -0.005em;
  transition: background var(--t-base), color var(--t-base);
}
::selection { background: var(--accent-soft); color: var(--accent-ink); }
a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }
.mono, .text-mono { font-family: var(--font-mono); font-feature-settings: 'zero'; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.highlight, .text-orange, .text-accent { color: var(--accent); }
.text-small      { font-size: 0.875rem; }
.text-xs         { font-size: 0.75rem; }
.text-bold       { font-weight: 700; }
.text-gray       { color: var(--muted); }
.text-body-large { font-size: 1rem; line-height: 1.6; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid var(--bg); }

/* ── App shell ────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w);
  background: var(--sidebar);
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column;
  z-index: 300; overflow-y: auto;
  transition: width var(--t-base), transform var(--t-base);
}
.sidebar-logo {
  min-height: 57px; display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 18px; border-bottom: 1px solid var(--sidebar-line);
  margin-bottom: 6px; flex-shrink: 0; overflow: hidden;
}
.sidebar-logo img { max-width: 130px; height: auto; flex-shrink: 0; }
.sidebar-logo svg { height: 22px; width: auto; flex-shrink: 0; }

/* Wordmark text logo (new HTML) */
.wordmark { font-weight: 800; font-style: italic; font-size: 19px; letter-spacing: -0.03em; white-space: nowrap; }
.wordmark .m { color: #fff; }
.wordmark .f { color: var(--accent); }
.wordmark .s { color: rgba(255,255,255,0.34); font-size: 12px; font-style: normal; font-weight: 700; margin-left: 4px; letter-spacing: 0.02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--accent), #B85F0A);
  display: grid; place-items: center;
  color: #fff; font-weight: 900; font-style: italic; font-size: 17px;
  box-shadow: 0 3px 10px rgba(239,130,19,0.4);
}
/* Image logo (current HTML) */
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 900; letter-spacing: -0.05em; font-size: 13px; flex-shrink: 0;
}
.brand-name { font-weight: 800; letter-spacing: -0.02em; font-size: 13px; color: rgba(255,255,255,0.88); }
.brand-name em { color: var(--accent); font-style: normal; font-weight: 900; }

.nav-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--sidebar-dim); padding: 16px 16px 5px; font-weight: 700; flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 4px 9px; overflow-y: auto; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px 9px 13px;
  color: var(--sidebar-mut); font-weight: 500; font-size: 14px;
  border-radius: var(--r-sm); position: relative; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  letter-spacing: -0.01em; border: none; background: transparent; text-decoration: none;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.sidebar-nav a.active { background: var(--accent-soft); color: #fff; }
.sidebar-nav a.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.sidebar-nav .nav-icon, .sidebar-nav .icon {
  width: 18px; height: 18px; flex-shrink: 0; color: var(--sidebar-dim);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-nav a:hover .nav-icon,
.sidebar-nav a:hover .icon { color: var(--sidebar-mut); }
.sidebar-nav a.active .nav-icon,
.sidebar-nav a.active .icon { color: var(--accent); }
.sidebar-nav .nav-text, .sidebar-nav .text { font-size: 14px; }

/* Sidebar footer */
.sidebar-footer, .sidebar-foot {
  margin-top: auto; padding: 10px 9px;
  border-top: 1px solid var(--sidebar-line);
  flex-shrink: 0; display: flex; flex-direction: column; gap: 3px;
}
.sidebar-user-row, .sidebar-user, .user-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
}
.sidebar-avatar, .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7a3d07);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 12px; flex-shrink: 0;
}
.sidebar-user-info, .user-meta { font-size: 12px; line-height: 1.3; min-width: 0; overflow: hidden; }
.sidebar-user-info b, .user-meta b {
  display: block; font-weight: 700; color: var(--sidebar-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-info span, .user-meta span {
  color: var(--sidebar-dim); font-size: 11px;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-logout {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 11px;
  background: none; border: none; color: var(--sidebar-mut); font-family: var(--font-primary);
  font-size: 13px; font-weight: 500; cursor: pointer; border-radius: var(--r-sm);
  text-align: left; transition: background var(--t-fast), color var(--t-fast);
}
.btn-logout:hover { background: rgba(180,35,24,0.18); color: #ff8a8a; }

/* Sidebar collapse button (in page-header topbar) */
#sidebarCollapseBtn {
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--muted); width: 34px; height: 34px; border-radius: var(--r-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
#sidebarCollapseBtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }

/* Collapsed state — only show the "m" logo mark */
.sidebar.collapsed { width: var(--sb-w-collapsed); }
.sidebar.collapsed .wordmark,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-foot { display: none; }
.sidebar.collapsed .sidebar-logo {
  justify-content: center; padding: 0;
  flex: 1; align-items: flex-start; padding-top: 14px; border-bottom: none; margin-bottom: 0;
}
.sidebar.collapsed .logo-mark { cursor: pointer; }

/* Sidebar foot actions — classification + logout buttons */
.sidebar-foot-actions {
  display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 6px;
}
.sidebar-foot-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border-radius: var(--r-sm);
  border: none; background: transparent;
  color: var(--sidebar-mut); font-size: 13px;
  font-family: var(--font-primary); font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-foot-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.sidebar-foot-btn--danger:hover { background: rgba(180,35,24,0.18); color: #ff8a8a; }
.sidebar-foot-icon { flex-shrink: 0; }

/* Mobile overlay */
.sidebar-overlay, .mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(5,5,6,0.45); z-index: 1100;
}
.sidebar-overlay.open, .mobile-overlay.open { display: block; }

/* ── Main content ─────────────────────────────────────────── */
.main-content, .main {
  flex: 1; min-width: 0;
  margin-left: var(--sb-w);
  display: flex; flex-direction: column; min-height: 100vh;
  background: var(--bg);
  transition: margin-left var(--t-base);
  overflow-x: hidden;
}
body.sidebar-collapsed .main-content,
body.sidebar-collapsed .main,
.app.collapsed .main { margin-left: var(--sb-w-collapsed); }

/* ── Topbar / Page header ─────────────────────────────────── */
.topbar, .page-header {
  height: 57px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 12px; padding: 0 24px; flex-shrink: 0;
}
.crumbs, .topbar-crumbs {
  display: flex; align-items: center; gap: 7px; font-size: 13px;
  color: var(--muted);
}
.crumbs b, .crumbs .here, .topbar-crumbs b { color: var(--ink); font-weight: 600; }
.crumbs .sep, .topbar-crumbs .sep { color: var(--line-strong); font-size: 11px; }
.topbar-spacer { flex: 1; }

/* Page header h1 (current HTML puts title inside page-header) */
.page-header h1 {
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.025em;
  color: var(--ink); margin: 0; line-height: 1.2;
}
.page-header p { font-size: 12px; color: var(--muted); margin: 0; }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  transition: all var(--t-fast); font-size: 14px;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--line-strong); }

/* Segmented currency control (new) */
.seg, .segmented {
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.seg button, .segmented button {
  border: none; background: transparent; padding: 5px 13px;
  font-family: var(--font-primary); font-size: 12px; font-weight: 600;
  color: var(--muted); border-radius: 5px; cursor: pointer; transition: all var(--t-fast);
}
.seg button.active, .seg button.on,
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* User avatar + dropdown in topbar */
.user-menu-wrapper { position: relative; flex-shrink: 0; }
.user-avatar-btn {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7a3d07); color: #fff;
  border: none; cursor: pointer; font-size: 12px; font-weight: 800;
  display: grid; place-items: center; transition: transform var(--t-fast);
}
.user-avatar-btn:hover { transform: scale(1.07); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  min-width: 200px; padding: 6px; z-index: 500;
  display: none; flex-direction: column; gap: 2px;
}
.user-dropdown.open { display: flex; }
.user-dropdown-header {
  padding: 9px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.user-dropdown-email {
  font-size: 12px; color: var(--muted); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-sm); border: none;
  background: transparent; color: var(--ink-2); font-size: 13px;
  font-family: var(--font-primary); cursor: pointer; text-align: left;
  transition: background var(--t-fast), color var(--t-fast); width: 100%;
}
.user-dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.user-dropdown-item.disabled { color: var(--muted-2); cursor: default; pointer-events: none; }
.user-dropdown-item.danger { color: var(--err); }
.user-dropdown-item.danger:hover { background: var(--err-bg); color: var(--err); }
.user-dropdown-divider {
  border: none; border-top: 1px solid var(--line); margin: 4px 0;
}

/* Theme toggle (current HTML) */
#themeToggle {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  transition: all var(--t-fast); font-size: 15px;
}
#themeToggle:hover { background: var(--surface-3); border-color: var(--line-strong); }

/* Currency badge button (current HTML — backward compat) */
#currencyBadge {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); font-family: var(--font-primary); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
#currencyBadge:hover { background: var(--surface-3); border-color: var(--line-strong); }

.menu-toggle { display: none; }

/* ── Container ────────────────────────────────────────────── */
.container { max-width: 1440px; width: 100%; padding: 30px 30px 72px; margin: 0 auto; }
.mb-8 { margin-bottom: 26px; }
.mb-6 { margin-bottom: 18px; }
.mt-4 { margin-top: 12px; }
.mt-2 { margin-top: 6px; }

.screen { animation: screenIn .4s var(--ease); }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Typography ───────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  color: var(--ink); letter-spacing: -0.02em; line-height: 1.2;
  font-weight: 700; margin-bottom: 16px;
}
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
p  { margin-bottom: 16px; line-height: 1.65; }

/* ── Editorial hero ───────────────────────────────────────── */
.editorial-hero, .editorial { padding: 6px 0 26px; }
.editorial-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.editorial-actions { display: flex; gap: 10px; flex-shrink: 0; padding-bottom: 4px; }
@media (max-width: 720px) { .editorial-actions { width: 100%; } .editorial-actions .btn { flex: 1; } }
.editorial-title, .editorial-subtitle, .editorial-sub {
  font-size: clamp(1.9rem, 4.2vw, 3.25rem); font-weight: 800; line-height: 1;
  letter-spacing: -0.035em; color: var(--ink); margin: 0;
}
.editorial-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .18em; }
.editorial-year  { color: var(--accent); }
.editorial-dot   { color: var(--ink); }
.editorial-subtitle, .editorial-sub { margin-top: 4px; }
.editorial-em    { color: var(--ink); }
.editorial-lead  { margin-top: 18px; max-width: 640px; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; transition: box-shadow var(--t-base), border-color var(--t-base), background var(--t-base);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header, .card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 15px 22px; border-bottom: 1px solid var(--line);
}
.card-title {
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.015em; display: flex; align-items: center; gap: 8px;
  white-space: nowrap; margin: 0;
}
.card-body { padding: 22px; }

/* ── Filtros ──────────────────────────────────────────────── */
.filters-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 20px 24px; padding: 20px 24px 4px;
}
.filter-item { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.filter-item label, .field-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 700; line-height: 1;
}
.field-label .req { color: var(--err); font-weight: 800; }
.filters-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 16px 24px 20px; border-top: 1px solid var(--line); margin-top: 20px;
}

/* ── Inputs ───────────────────────────────────────────────── */
.input, select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  font-family: var(--font-primary); font-size: 13.5px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-base);
  letter-spacing: -0.01em;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus, select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239A9A90' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.input-affix { position: relative; }
.input-affix .pre { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 13px; }
.input-affix .input { padding-left: 30px; }

input[type=color].swatch-input {
  -webkit-appearance: none; appearance: none; width: 46px; height: 40px; padding: 4px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; flex-shrink: 0;
}
input[type=color].swatch-input::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color].swatch-input::-webkit-color-swatch { border: none; border-radius: 4px; }

/* Form layout */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 14px; height: 36px; font-family: var(--font-primary); font-size: 13px; font-weight: 600;
  line-height: 1; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap; user-select: none; letter-spacing: -0.01em;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn-primary, .btn-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover, .btn-dark:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 2px 8px var(--accent-soft); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-success:hover { filter: brightness(1.06); }
.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn-danger:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.btn-secondary { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--line-strong); background: var(--surface-3); }
.btn-sm  { height: 30px; padding: 0 11px; font-size: 12px; }
.btn-lg  { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ── KPI / Stat cards — separated, rounded, hover lift ───── */
.stats-grid, .kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px;
}
.stat-card, .stat, .kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 18px 20px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base), background var(--t-base);
  min-height: 148px; cursor: default;
}
.stat-card:hover, .stat:hover, .kpi:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong);
}
.stat-card:active, .stat:active, .kpi:active { transform: translateY(-1px); }

.stat-card .label, .stat-label, .kpi-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--muted);
  font-weight: 800; line-height: 1.3; padding-top: 5px; white-space: nowrap;
}
.stat-card .value, .stat-value, .kpi-val {
  font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1;
  letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
}
.stat-card .value.highlight, .stat-value.is-accent { color: var(--accent); }
.stat-card .stat-foot {
  font-size: 0.72rem; margin-top: 8px; color: var(--muted-2);
  letter-spacing: 0; text-transform: none; font-weight: 500;
}
.stat-trend {
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center;
  gap: 5px; letter-spacing: -0.01em;
}
.stat-trend .pct { display: inline-flex; align-items: center; gap: 3px; }
.stat-trend.up   .pct { color: var(--ok); }
.stat-trend.down .pct { color: var(--err); }
.stat-trend.flat .pct { color: var(--muted); }
.stat-trend .foot { color: var(--muted-2); font-weight: 500; }

/* Primary (dark/black) variant */
.stat-card.is-primary, .stat.is-primary {
  background: #0A0A0A; border-color: #0A0A0A;
}
.stat-card.is-primary:hover, .stat.is-primary:hover { background: #1a1a18; }
.stat-card.is-primary .label, .stat.is-primary .stat-label { color: rgba(255,255,255,0.55); }
.stat-card.is-primary .value, .stat.is-primary .stat-value { color: #FAFAF7; }
.stat-card.is-primary .value.highlight { color: var(--accent); }
.stat-card.is-primary .stat-foot, .stat.is-primary .stat-trend .foot { color: rgba(255,255,255,0.5); }
[data-theme="dark"] .stat-card.is-primary,
[data-theme="dark"] .stat.is-primary { background: #000; border-color: var(--line-strong); }

/* Orange gradient (accent) variant */
.stat-card.is-accent, .stat.is-accent {
  background: linear-gradient(150deg, var(--accent-hover) 0%, var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #b5560a) 100%);
  border-color: transparent; color: #fff;
}
.stat-card.is-accent:hover, .stat.is-accent:hover {
  box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 45%, transparent);
}
.stat-card.is-accent .label, .stat.is-accent .stat-label { color: rgba(255,255,255,0.85); }
.stat-card.is-accent .value, .stat.is-accent .stat-value { color: #fff; }

@media (max-width: 1180px) { .stats-grid, .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px)  { .stats-grid, .kpi-grid { grid-template-columns: 1fr; } }

/* Secondary metric strip */
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 15px 18px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.metric:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.metric .m-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.metric .m-value { font-size: 1.35rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric .m-foot  { font-size: 10.5px; color: var(--muted-2); }
@media (max-width: 1180px) { .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px)  { .metric-strip { grid-template-columns: 1fr; } }

/* ── Chart ────────────────────────────────────────────────── */
.chart-wrap { padding: 18px 22px 22px; }
.chart-legend { display: flex; gap: 18px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.legend-swatch { width: 22px; height: 11px; border-radius: 3px; border: 2px solid; }
.chart-box, .chart-container { position: relative; height: 340px; }
.chart-container { margin-bottom: 20px; }
#tableContainer { overflow: hidden; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 11px 16px; text-align: left; font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
thead th.r { text-align: right; }
tbody tr { border-bottom: 1px solid var(--line); transition: background var(--t-fast); }
tbody tr:last-child { border-bottom: none; }
tbody tr.hoverable, tbody tr.clickable { cursor: pointer; }
tbody tr.hoverable:hover, tbody tr.clickable:hover { background: var(--surface-2); }
tbody td { padding: 0 16px; height: var(--row-h); color: var(--ink-2); vertical-align: middle; }
tbody td.r { text-align: right; }
tbody td strong { color: var(--ink); font-weight: 600; }
td.mono, .td-num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; text-align: right; }
.row-idx { color: var(--muted-2); font-variant-numeric: tabular-nums; width: 30px; }
.cost-cell { color: var(--ok); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Total footer row */
tfoot .total-row { border-top: 2px solid var(--line-strong); background: var(--surface-2); }
tfoot .total-row td { height: 50px; color: var(--ink); font-weight: 700; }
tfoot .total-row td strong { font-weight: 800; letter-spacing: 0.02em; }
tfoot .total-row .cost-cell { font-size: 13.5px; }

/* Delta arrows */
.delta { font-size: 10px; margin-left: 3px; }
.delta.up   { color: var(--err); }
.delta.down { color: var(--ok); }

/* Nested subtable (billing) */
.subtable { background: var(--surface-2); }
.subtable thead th { background: var(--surface-2); font-size: 10px; }
.subtable tbody td { height: 42px; }
.fact-uso { background: var(--info-bg); }

/* Client cell */
.client-name b     { color: var(--ink); }
.client-name small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }

/* Clickable row (clients table) */
tbody tr.clickable-row { cursor: pointer; }
tbody tr.clickable-row:hover { background: var(--surface-2); }

/* Client link in table */
.client-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.client-link:hover { color: var(--accent); }

/* Table actions cell */
.td-actions { white-space: nowrap; }
.billing-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* Profit indicators (billing) */
.profit-positive { color: var(--ok);  font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.profit-negative { color: var(--err); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Billing summary margin/cost colors */
.is-good { color: var(--ok); }
.is-cost { color: var(--err); }

/* Agent cost-level indicators */
.cost-low    { color: var(--ok);   font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cost-medium { color: var(--warn); font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cost-high   { color: var(--err);  font-weight: 700; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* KPI section (billing summary stats) */
.kpi-section { margin-bottom: 22px; display: flex; flex-direction: column; gap: 16px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

/* badge-info (single-class variant of .badge.info) */
.badge-info { color: var(--info); background: var(--info-bg); border-color: transparent; }

/* Row actions */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Fixed-layout for #reportsTable */
#reportsTable { table-layout: fixed; width: 100%; font-size: 0.8rem; }
#reportsTable thead th { padding: 10px 8px; white-space: normal; word-break: break-word; line-height: 1.3; vertical-align: bottom; }
#reportsTable tbody td { padding: 10px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reportsTable thead th:nth-child(1)  { width: 3%;  }
#reportsTable thead th:nth-child(2)  { width: 20%; }
#reportsTable thead th:nth-child(3)  { width: 7%;  }
#reportsTable thead th:nth-child(4)  { width: 9%;  }
#reportsTable thead th:nth-child(5)  { width: 9%;  }
#reportsTable thead th:nth-child(6)  { width: 8%;  }
#reportsTable thead th:nth-child(7)  { width: 8%;  }
#reportsTable thead th:nth-child(8)  { width: 9%;  }
#reportsTable thead th:nth-child(9)  { width: 10%; }
#reportsTable thead th:nth-child(10) { width: 8%;  }
#reportsTable thead th:nth-child(11) { width: 9%;  }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.voice,
.badge.err,
.badge.danger,
.badge-danger   { color: var(--err);  background: var(--err-bg);  border-color: transparent; }
.badge.chat,
.badge.ok,
.badge-success  { color: var(--ok);   background: var(--ok-bg);   border-color: transparent; }
.badge.warn,
.badge-warning  { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge.info,
.badge-info     { color: var(--info); background: var(--info-bg); border-color: transparent; }
.badge.accent   { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.type-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.type-badge.voice        { background: var(--err-bg);  color: var(--err); }
.type-badge.chat         { background: var(--ok-bg);   color: var(--ok); }
.type-badge.unconfigured { background: var(--surface-2); color: var(--muted-2); border: 1px solid var(--line); }

/* ── Chips ────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.chip b { color: var(--ink); font-weight: 800; }
.chip.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

/* ── Empty state ──────────────────────────────────────────── */
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 1.8rem; margin-bottom: 8px; opacity: .6; }
.empty-state {
  padding: 48px 24px; text-align: center; color: var(--muted);
  font-size: 14px; line-height: 1.6;
}

/* ── Loading / spinner ────────────────────────────────────── */
.loading {
  padding: 48px 20px; text-align: center;
  color: var(--muted); font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loaders */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
.skeleton-stat {
  height: 148px; border-radius: var(--r-xl); display: block;
}
.skeleton-row {
  height: var(--row-h); border-radius: 0; display: block; margin-bottom: 1px;
}

/* ── Alert ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 13.5px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.alert-error {
  background: var(--err-bg); border-color: var(--err); color: var(--err);
}

/* ── Table class wrapper ──────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-responsive { overflow-x: auto; }

/* ── Stat chips (classification / drawer) ────────────────── */
.stat-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; font-size: 12px; color: var(--muted); font-weight: 600;
}
.stat-chip span { color: var(--ink); font-weight: 800; }

/* ── Toolbar / filter bar ─────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.filter-bar {
  display: flex; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px;
}
.btn-filter {
  padding: 5px 13px; border-radius: calc(var(--r-sm) - 2px);
  border: none; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-family: var(--font-primary); transition: all var(--t-fast);
}
.btn-filter:hover { color: var(--ink); }
.btn-filter.is-active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* ── Type select (classification table) ──────────────────── */
.type-select {
  appearance: none; -webkit-appearance: none;
  padding: 3px 10px; border-radius: 999px; border: none;
  font-size: 10.5px; font-weight: 700; font-family: var(--font-primary);
  text-transform: uppercase; letter-spacing: 0.05em;
  cursor: pointer; background: var(--surface-2); color: var(--muted-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.type-select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-select.voice { background: var(--err-bg); color: var(--err); }
.type-select.chat  { background: var(--ok-bg);  color: var(--ok); }

/* ── Type toggle (classification table) ──────────────────── */
.type-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
.type-toggle-btn {
  padding: 3px 12px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  border: none; cursor: pointer;
  background: transparent; color: var(--muted-2);
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1.5;
}
.type-toggle-btn:not(.active):hover { background: var(--surface-3, rgba(255,255,255,.06)); }
.type-toggle-btn.active.chat  { background: var(--ok-bg);  color: var(--ok); }
.type-toggle-btn.active.voice { background: var(--err-bg); color: var(--err); }

/* ── Warn badge ───────────────────────────────────────────── */
.warn-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn);
  font-size: 10.5px; font-weight: 700; margin-left: 8px;
}

/* ── Form control (billing filter select) ────────────────── */
.form-control {
  padding: 7px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 13px; font-family: var(--font-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ── CSV button (billing) ─────────────────────────────────── */
.btn-csv {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); font-size: 13px; font-weight: 600;
  font-family: var(--font-primary); cursor: pointer; text-decoration: none;
  transition: all var(--t-fast);
}
.btn-csv:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }

/* ── Utility ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ── Drawer ───────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(5,5,6,0.5); backdrop-filter: blur(3px);
  z-index: 900; opacity: 0; pointer-events: none; transition: opacity var(--t-base);
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer,
.classification-drawer {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: clamp(560px, 52vw, 880px); max-width: 100vw;
  background: var(--surface); z-index: 1000; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  transform: translateX(100%); transition: transform var(--t-slow);
}
.drawer.open,
.classification-drawer.open { transform: none; }
.drawer-head,
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 22px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.drawer-head h2,
.drawer-header h2 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 9px; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-close-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--muted-2); cursor: pointer;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  transition: all var(--t-fast);
}
.drawer-close-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ── Detail / history / states ────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.detail-item { background: var(--surface); padding: 13px 16px; display: flex; flex-direction: column; gap: 4px; }
.detail-item .d-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.detail-item .d-value { font-size: 15px; font-weight: 700; color: var(--ink); }
.detail-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 13px; }
.confirm-box { display: flex; gap: 14px; align-items: flex-start; }
.confirm-box .confirm-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--err-bg); color: var(--err); display: grid; place-items: center; flex-shrink: 0; }
.confirm-box p { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.confirm-box strong { color: var(--ink); }
.history-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.history-item { background: var(--surface); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-item b    { display: block; font-size: 13px; color: var(--ink); font-weight: 700; }
.history-item span { font-size: 12px; color: var(--muted); }
.history-item time { font-size: 11.5px; color: var(--muted-2); font-family: var(--font-mono); white-space: nowrap; }
.states-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 18px; }
.state-row { background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.state-dot  { width: 16px; height: 16px; border-radius: 5px; flex-shrink: 0; }
.state-name { flex: 1; font-weight: 600; color: var(--ink); font-size: 14px; }
.state-acts { display: flex; gap: 8px; }
.state-add  { display: flex; gap: 12px; align-items: flex-end; }
@media (max-width: 520px) { .state-add { flex-wrap: wrap; } }

/* ── Modal (legacy: .modal = overlay, .modal-content = card) ── */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,5,6,0.55); backdrop-filter: blur(3px);
  z-index: 1100; align-items: center; justify-content: center; padding: 24px;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  width: min(540px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.modal-header { margin-bottom: 20px; }
.modal-header h3 { font-size: 1.08rem; font-weight: 600; color: var(--ink); margin: 0 0 5px; }
.modal-header p { color: var(--muted); font-size: 13px; margin: 0; }
/* Assign-agent / product overlays (client-detail) */
.assign-agent-modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(5,5,6,0.55); backdrop-filter: blur(3px);
  z-index: 1100; align-items: center; justify-content: center; padding: 24px;
}
.assign-agent-modal-overlay.active { display: flex; }
.assign-agent-modal-content {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 24px;
}
.assign-agent-modal-header { margin-bottom: 20px; }
.assign-agent-modal-header h3 { font-size: 1.08rem; font-weight: 600; color: var(--ink); margin: 0 0 5px; }
.assign-agent-modal-header p { color: var(--muted); font-size: 13px; margin: 0; }
/* Modal action buttons */
.form-actions, .assign-agent-form-actions {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;
}
.btn-cancel {
  padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font-size: 13px;
  font-family: var(--font-primary); cursor: pointer; transition: all var(--t-fast);
}
.btn-cancel:hover { background: var(--surface-3); }
.btn-accept {
  padding: 8px 16px; border-radius: var(--r-sm); border: none;
  background: var(--accent); color: #fff; font-size: 13px;
  font-family: var(--font-primary); cursor: pointer; font-weight: 500;
  transition: all var(--t-fast);
}
.btn-accept:hover { opacity: .88; }
/* Info grid (Detalles modal in clients) */
.info-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.info-row { display: flex; align-items: baseline; gap: 12px; }
.info-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; min-width: 110px; }
.info-value { font-size: 14px; color: var(--ink); }
/* Form section highlight (assign agent pricing) */
.form-section-highlight {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 14px; margin-bottom: 4px;
}
.form-section-highlight h4 { font-size: 13px; font-weight: 600; color: var(--ink); margin: 0 0 12px; }
/* Form error */
.form-error { color: var(--err, #dc3545); font-size: 13px; margin-top: 6px; min-height: 18px; }
/* New-style modal overlay (future reference pattern) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,5,6,0.55); backdrop-filter: blur(4px);
  z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity var(--t-base);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-head { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.modal-head.center { text-align: center; padding: 24px 28px 16px; }
.modal-head.center h3 { justify-content: center; font-size: 1.18rem; }
.modal-head .modal-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 6px; margin-bottom: 0; }
.modal-body, .modal-body-pad { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot, .modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap;
}
.modal-close {
  width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: transparent; color: var(--muted-2); cursor: pointer;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }

/* ── Agent multi-select modal ─────────────────────────────── */
.agent-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; height: 40px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--font-primary); font-size: 13px; color: var(--ink);
  cursor: pointer; text-align: left;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.agent-trigger:hover { border-color: var(--line-strong); }
.agent-trigger:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.agent-trigger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-trigger-label.is-placeholder { color: var(--muted-2); }
.agent-trigger-icon { color: var(--muted-2); font-size: 11px; }

.agent-modal-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(10,10,10,0.55);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.agent-modal-overlay[hidden] { display: none; }
.agent-modal {
  background: var(--surface); border-radius: var(--r-md); box-shadow: 0 24px 64px rgba(10,10,10,0.28);
  width: 100%; max-width: 760px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
}
.agent-modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line);
}
.agent-modal-titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agent-modal-title   { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.agent-modal-summary { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.agent-modal-close {
  background: transparent; border: none; font-size: 24px; line-height: 1;
  color: var(--muted-2); cursor: pointer; padding: 0 6px; border-radius: var(--r-sm);
}
.agent-modal-close:hover { color: var(--ink); background: var(--surface-2); }
.agent-modal-controls {
  display: flex; align-items: center; gap: 10px; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap;
}
.agent-modal-action-group { display: flex; gap: 6px; }
.agent-list-search { position: relative; flex: 1; min-width: 200px; }
.agent-list-search input {
  width: 100%; height: 34px; padding: 6px 10px 6px 30px; font-size: 13px;
  font-family: var(--font-primary); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.agent-list-search::before {
  content: '⌕'; position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%); font-size: 12px; opacity: 0.55; pointer-events: none;
}
.agent-list-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.agent-list-action {
  background: var(--surface); border: 1px solid var(--line); padding: 6px 12px;
  font-size: 11.5px; font-weight: 600; color: var(--ink); cursor: pointer;
  border-radius: var(--r-sm); letter-spacing: -0.005em;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.agent-list-action:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.agent-list-options {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 6px; padding: 10px 14px; overflow-y: auto; flex: 1; min-height: 240px;
}
.agent-list-option {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 13px;
  color: var(--ink); cursor: pointer; user-select: none; border-radius: var(--r-sm);
  transition: background var(--t-fast);
}
.agent-list-option:hover { background: var(--surface-2); }
.agent-list-option.is-selected { background: var(--accent-soft); }
.agent-list-option input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; width: 16px; height: 16px;
  border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface);
  cursor: pointer; position: relative; flex-shrink: 0;
}
.agent-list-option input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.agent-list-option input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.agent-list-option-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-list-empty { grid-column: 1 / -1; padding: 28px 14px; text-align: center; color: var(--muted-2); font-size: 13px; line-height: 1.55; }
.agent-list-empty .agent-list-action { margin-top: 10px; display: inline-block; }
.agent-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .agent-modal-overlay { padding: 0; align-items: stretch; }
  .agent-modal { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .agent-list-options { grid-template-columns: 1fr; min-height: 200px; }
}

/* ── Toast ────────────────────────────────────────────────── */
#toast,
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 11px 18px;
  background: var(--ink); color: var(--bg); border-radius: var(--r-md);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: all var(--t-base); z-index: 2000;
  pointer-events: none;
}
#toast.show, .toast.show { opacity: 1; transform: none; pointer-events: auto; }
#toast.err,  .toast.err,   .toast.error   { background: var(--err); color: #fff; }
#toast.ok,   .toast.ok,    .toast.success { background: var(--ok);  color: #fff; }

/* ── Redirect / spinner ───────────────────────────────────── */
.redirect-message {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center; background: var(--bg); color: var(--ink);
}
.redirect-message h1 { font-size: 2rem; margin-bottom: 1rem; }
.redirect-message p  { font-size: 1.125rem; opacity: 0.9; }
.spinner {
  border: 4px solid rgba(255,255,255,0.3); border-top: 4px solid var(--accent);
  border-radius: 50%; width: 40px; height: 40px;
  animation: spin 1s linear infinite; margin: 20px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ── Login page ───────────────────────────────────────────── */
.login-layout {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh;
}
.login-hero {
  position: relative; background: #0A0A0B; color: #fff;
  padding: 36px 56px; display: flex; flex-direction: column; overflow: hidden;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 25%, rgba(239,130,19,0.22), transparent 55%),
              radial-gradient(circle at 90% 80%, rgba(239,130,19,0.08), transparent 55%);
  pointer-events: none;
}
.login-brand { display: inline-flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.login-brand .brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 14px; }
.login-brand .brand-name { font-size: 14px; font-weight: 700; color: #fff; }
.login-brand .brand-name em { color: var(--accent); font-style: normal; font-weight: 800; }
.login-brand .brand-name .dot { color: var(--accent); margin: 0 6px; }
.login-hero-content { position: relative; z-index: 1; max-width: 540px; margin: auto 0; }
.login-headline { font-size: clamp(2.6rem, 5.5vw, 4.5rem); font-weight: 800; line-height: 0.96; letter-spacing: -0.04em; color: #fff; margin: 0; }
.login-headline em { color: var(--accent); font-style: normal; }
.login-tagline { margin-top: 28px; color: rgba(255,255,255,0.65); font-size: 0.95rem; max-width: 420px; line-height: 1.6; }
.login-form-wrap { display: grid; place-items: center; padding: 36px; }
.login-form-card { width: 100%; max-width: 380px; }
.login-form-card h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 8px; }
.login-form-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.form-group input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
  font-size: 14px; font-family: var(--font-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-login { width: 100%; height: 46px; background: var(--accent); color: #fff; border: none; border-radius: var(--r-sm); font-size: 14.5px; font-weight: 700; cursor: pointer; margin-top: 8px; transition: background var(--t-fast); letter-spacing: -0.01em; }
.btn-login:hover { background: var(--accent-hover); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-forgot { display: block; margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.login-forgot:hover { color: var(--ink); text-decoration: underline; }
.error-msg { display: none; background: var(--err-bg); border: 1px solid var(--err); color: var(--err); border-radius: var(--r-sm); padding: 10px 14px; font-size: 0.875rem; margin-bottom: 16px; text-align: center; }
.error-msg.visible { display: block; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sb-w: 220px; }
  .filters-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  #reportsTable { font-size: 0.75rem; }
  #reportsTable thead th,
  #reportsTable tbody td { padding: 8px 6px; }
}
@media (max-width: 860px) {
  .filters-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 768px) {
  .menu-toggle { display: grid; }
  .sidebar { transform: translateX(-100%); width: 264px; z-index: 1200; }
  .sidebar.open { transform: none; }
  .main-content, .main { margin-left: 0; }
  .container { padding: 20px 16px 56px; }
  .drawer { width: 100vw; }
  .filters-grid { grid-template-columns: 1fr; padding: 16px 16px 4px; }
  .filters-actions { padding: 14px 16px 16px; }
  .filters-actions .btn { flex: 1; }
  #sidebarCollapseBtn { display: none; }
}
@media (max-width: 720px) {
  .stat-card, .stat, .kpi { padding: 16px 18px; }
  .editorial-title, .editorial-subtitle { font-size: 1.9rem; }
  .editorial-lead { font-size: 0.875rem; }
  .login-hero { padding: 24px 24px 32px; }
  .login-form-wrap { padding: 28px 24px 40px; }
}
@media (max-width: 600px) {
  .container { padding: 20px 16px 48px; }
  .card { border-radius: var(--r-md); }
}
@media (max-width: 560px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 960px) {
  .login-headline { font-size: clamp(2.2rem, 7vw, 3.4rem); }
}
@media (max-width: 720px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-hero { min-height: auto; }
}

/* ── Selector de mes (Gastos / Rentabilidad) ───────────────────────────── */
.month-picker {
  display: inline-flex; align-items: center; gap: 6px;
}
.month-picker .icon-btn:disabled {
  opacity: .4; cursor: not-allowed;
}
.month-picker .icon-btn:disabled:hover {
  background: var(--surface-2); border-color: var(--line);
}
/* El <input type="month"> nativo se superpone invisible sobre la etiqueta en
   español, para conservar el calendario del navegador sin su formato en-US. */
.month-picker-field {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 160px; height: 34px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); font-weight: 600; font-size: 13px; text-transform: capitalize;
  cursor: pointer; transition: all var(--t-fast);
}
.month-picker-field:hover { background: var(--surface-3); border-color: var(--line-strong); }
.month-picker-field input[type="month"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: none; padding: 0;
}

/* ── Fila de totales en tablas de rentabilidad ─────────────────────────── */
tr.row-total td {
  font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--surface-2);
}
tr.row-muted td { color: var(--muted); font-style: italic; }

/* Valores monetarios: positivo/negativo */
.val-ok  { color: var(--ok); }
.val-err { color: var(--err); }

/* Barra de proporción dentro de una celda */
.bar-track {
  height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 60px;
}
.bar-fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* Visible solo para lectores de pantalla y agentes de navegador: el contenido
   de un <canvas> no es legible por software, así que las gráficas publican
   aquí sus datos en forma de tabla. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Informes IA (report-settings.html) ───────────────────── */
.report-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.report-title { font-size: 1.35rem; font-weight: 800; margin: 0; color: var(--ink); }
.report-subtitle { margin: 4px 0 0; font-size: 12.5px; }
.report-status { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.report-tabs { margin-bottom: 16px; }
.report-banner { margin-bottom: 16px; color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.report-banner a:not(.btn) { color: var(--ink); font-weight: 700; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-wide { grid-column: 1 / -1; }
.report-form { display: flex; flex-direction: column; gap: 12px; }
.report-two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-span { grid-column: 1 / -1; }
.report-savebar {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 12px 0; margin-top: 16px; background: var(--bg); border-top: 1px solid var(--line); z-index: 5;
}
.report-pane[hidden] { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.check-list { display: flex; flex-direction: column; gap: 8px; }
.freq-row, .hs-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.freq-row.muted .check { color: var(--muted); }
.input-time { width: 110px; }
.input-num { width: 84px; }
.input-date { width: 160px; }
.hours-grid { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; align-items: center; }
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.progress { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width var(--t-base); }
.matrix { font-size: 12px; }
.matrix th { font-size: 10px; white-space: nowrap; }
.matrix td { text-align: center; font-variant-numeric: tabular-nums; }
.matrix td.hit { color: var(--ok); background: var(--ok-bg); font-weight: 700; }
.matrix td.miss { color: var(--err); background: var(--err-bg); }
.drawer-h { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.attempt { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; margin-bottom: 8px; }
.attempt summary { cursor: pointer; font-size: 12.5px; }
.attempt pre, .drawer-body pre {
  white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2); padding: 10px; border-radius: var(--r-sm); max-height: 320px; overflow: auto; color: var(--ink-2);
}
.kv-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.transcript { display: flex; flex-direction: column; gap: 8px; }
.turn { padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; color: var(--ink); max-width: 88%; }
.turn span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .06em; }
.turn.user { align-self: flex-end; background: var(--accent-soft); }
#publicViewInfo a { overflow-wrap: anywhere; }
.btn[hidden], .alert[hidden] { display: none; }
.draft-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.draft-row + .draft-row { margin-top: 8px; }
.nowrap { white-space: nowrap; }
.proposal-grid { display: flex; flex-direction: column; gap: 14px; }
.proposal-row { border-top: 1px solid var(--line); padding-top: 12px; }
.proposal-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.proposal-cols .badge { margin: 0 4px 4px 0; }
.proposal-text { white-space: pre-wrap; font-family: inherit; font-size: 12px; max-height: 240px; overflow: auto;
  background: var(--surface-2); padding: 10px; border-radius: var(--r-sm); margin: 0; color: var(--ink-2); }
@media (max-width: 900px) { .proposal-cols { grid-template-columns: 1fr; } }

/* Revisión del mensual (report-review.html) */
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.review-preview { position: sticky; top: 12px; overflow: hidden; }
.review-frame { display: block; width: 100%; height: calc(100vh - 160px); min-height: 520px; border: 0; background: var(--surface-2); }
@media (max-width: 900px) {
  .report-grid, .report-two-cols { grid-template-columns: 1fr; }
  .review-layout { grid-template-columns: 1fr; }
  .review-preview { position: static; }
}
