:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-blue: #f1f6ff;
  --text: #18202f;
  --muted: #687386;
  --muted-2: #929bad;
  --border: #e5e9f0;
  --primary: #3157d5;
  --primary-dark: #2444b7;
  --primary-soft: #e9efff;
  --success: #18875b;
  --success-soft: #e5f7ef;
  --warning: #b66b08;
  --warning-soft: #fff4dc;
  --danger: #c54242;
  --danger-soft: #ffeded;
  --purple: #7856c7;
  --purple-soft: #f1ecff;
  --sidebar: #111827;
  --sidebar-2: #1b2434;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 4px rgba(15, 23, 42, .03);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .12);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-width: 254px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.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;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 15px 16px;
  color: #c8d0df;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, .04);
  transition: transform .22s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 21px;
}

.brand-mark {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(145deg, #5d7df0, #3157d5);
  box-shadow: 0 7px 20px rgba(49, 87, 213, .35);
}

.brand-mark span {
  display: block;
  width: 4px;
  border-radius: 4px;
  background: white;
}
.brand-mark span:nth-child(1) { height: 9px; opacity: .75; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .88; }

.brand strong {
  display: block;
  color: #fff;
  font-size: 17px;
  letter-spacing: -.2px;
}
.brand small { display: block; color: #8591a7; font-size: 11px; }

.workspace-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 0 3px 21px;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}

.workspace-btn {
  padding: 7px 8px;
  color: #8995aa;
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 6px;
}
.workspace-btn.active { color: white; background: var(--sidebar-2); box-shadow: 0 1px 5px rgba(0,0,0,.18); }

.nav { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.nav-section { margin: 13px 11px 7px; color: #667287; font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  color: #aeb8c9;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: background .16s ease, color .16s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: rgba(73, 105, 218, .18); }
.nav-item.active::before {
  position: absolute;
  left: -15px;
  width: 3px;
  height: 23px;
  content: "";
  background: #7892ff;
  border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 17px; height: 17px; color: #8794aa; }
.nav-item.active svg { color: #91a6ff; }
.nav-item .nav-count {
  margin-left: auto;
  min-width: 20px;
  padding: 2px 6px;
  color: #dce3f2;
  font-size: 10px;
  text-align: center;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
}
.nav-item .nav-count.alert { color: #ffd5d5; background: rgba(207, 76, 76, .25); }

.sidebar-footer { margin-top: 18px; }
.client-card, .user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.client-card { border-bottom: 1px solid rgba(255,255,255,.06); }
.client-logo {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: #dfe6ff;
  font-size: 10px;
  font-weight: 800;
  background: #29334a;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
}
.client-card strong, .user-card strong { display: block; color: #dce2ee; font-size: 11px; }
.client-card span, .user-card span { display: block; color: #778399; font-size: 10px; }
.user-card { position: relative; padding-bottom: 0; }
.user-card .status-dot { position: absolute; left: 33px; bottom: 9px; width: 7px; height: 7px; background: #36c78b; border: 2px solid var(--sidebar); border-radius: 50%; }
.avatar {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  color: #25325c;
  font-size: 10px;
  font-weight: 800;
  background: #dfe6ff;
  border-radius: 50%;
}

.main { min-height: 100vh; margin-left: var(--sidebar-width); transition: margin-left .22s ease; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 30px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar-left h1 { margin: 1px 0 0; font-size: 20px; line-height: 1.2; letter-spacing: -.35px; }
.eyebrow { margin: 0; color: var(--muted-2); font-size: 10px; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.icon-button:hover { color: var(--text); border-color: #cbd2de; }
.icon-button.small { width: 25px; height: 25px; margin-left: auto; color: #79869b; background: transparent; border: 0; }
.mobile-menu { display: inline-grid; }

.primary-button, .secondary-button, .ghost-button, .danger-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  font-weight: 650;
  border-radius: 9px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button { color: white; background: var(--primary); border: 1px solid var(--primary); box-shadow: 0 4px 12px rgba(49,87,213,.2); }
.primary-button:hover { background: var(--primary-dark); }
.secondary-button { color: #4d596c; background: white; border: 1px solid var(--border); }
.secondary-button:hover { color: var(--text); border-color: #cbd2de; }
.ghost-button { color: var(--primary); background: var(--primary-soft); border: 0; }
.danger-button { color: var(--danger); background: var(--danger-soft); border: 0; }
.primary-button svg, .secondary-button svg { width: 16px; height: 16px; }

.company-select-wrap select {
  min-width: 175px;
  height: 36px;
  padding: 0 31px 0 11px;
  color: #495468;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23687386' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--border);
  border-radius: 9px;
  appearance: none;
}

.demo-banner {
  display: flex;
  min-height: 35px;
  align-items: center;
  gap: 9px;
  padding: 7px 30px;
  color: #566177;
  font-size: 11px;
  background: #edf3ff;
  border-bottom: 1px solid #dce6fb;
}
.demo-pill {
  padding: 2px 7px;
  color: #3452b1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: white;
  border: 1px solid #d4e0fb;
  border-radius: 999px;
}
.demo-banner button { margin-left: auto; color: #3452b1; font-size: 11px; font-weight: 700; background: transparent; border: 0; }

.content { max-width: 1600px; margin: 0 auto; padding: 25px 30px 40px; }
.view { animation: viewIn .22s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.page-intro h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.45px; }
.page-intro p { margin: 0; color: var(--muted); font-size: 12px; }
.page-intro-actions { display: flex; gap: 8px; }

.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 17px;
  padding: 13px 15px;
  background: var(--warning-soft);
  border: 1px solid #f1dba9;
  border-radius: var(--radius-sm);
}
.alert-banner .alert-icon { display: grid; width: 26px; height: 26px; flex: 0 0 auto; place-items: center; color: var(--warning); font-weight: 800; background: white; border-radius: 7px; }
.alert-banner strong { display: block; margin-bottom: 1px; font-size: 12px; }
.alert-banner p { margin: 0; color: #7c633a; font-size: 11px; }
.alert-banner .ghost-button { min-height: 29px; margin-left: auto; padding: 5px 9px; color: #8c5b11; font-size: 10px; background: rgba(255,255,255,.75); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 15px; }
.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 16px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.kpi-card::after { position: absolute; right: -19px; bottom: -29px; width: 80px; height: 80px; content: ""; background: radial-gradient(circle, rgba(49,87,213,.07), transparent 68%); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.kpi-icon { display: grid; width: 28px; height: 28px; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 8px; }
.kpi-icon.green { color: var(--success); background: var(--success-soft); }
.kpi-icon.orange { color: var(--warning); background: var(--warning-soft); }
.kpi-icon.red { color: var(--danger); background: var(--danger-soft); }
.kpi-value { margin-top: 12px; font-size: 25px; font-weight: 740; letter-spacing: -.65px; }
.kpi-value small { margin-left: 3px; color: var(--muted-2); font-size: 11px; font-weight: 550; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.delta { padding: 2px 5px; color: var(--success); font-weight: 700; background: var(--success-soft); border-radius: 5px; }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.neutral { color: #6a55a5; background: var(--purple-soft); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .8fr); gap: 15px; margin-bottom: 15px; }
.grid-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin-bottom: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 15px; }

.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.card-header h3 { margin: 0; font-size: 13px; letter-spacing: -.1px; }
.card-header p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.card-header-actions { display: flex; align-items: center; gap: 7px; }
.card-body { padding: 16px; }
.link-button { color: var(--primary); font-size: 10px; font-weight: 700; background: transparent; border: 0; }
.period-select { padding: 4px 7px; color: var(--muted); font-size: 10px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 6px; }

.chart-wrap { padding: 12px 16px 15px; }
.chart { display: flex; height: 205px; align-items: flex-end; gap: 16px; padding: 17px 4px 0; border-bottom: 1px solid var(--border); }
.chart-group { display: flex; height: 100%; flex: 1; align-items: flex-end; justify-content: center; gap: 4px; }
.chart-bar { position: relative; width: min(20px, 38%); min-height: 4px; background: #b9c7f4; border-radius: 4px 4px 1px 1px; transition: height .4s ease; }
.chart-bar.actual { background: var(--primary); }
.chart-bar:hover::after { position: absolute; bottom: calc(100% + 6px); left: 50%; padding: 4px 6px; color: white; font-size: 9px; content: attr(data-label); white-space: nowrap; background: #273348; border-radius: 5px; transform: translateX(-50%); }
.chart-labels { display: flex; gap: 16px; padding: 7px 4px 0; }
.chart-labels span { flex: 1; color: var(--muted-2); font-size: 9px; text-align: center; }
.chart-legend { display: flex; gap: 15px; margin-top: 11px; color: var(--muted); font-size: 9px; }
.chart-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; background: var(--primary); border-radius: 2px; }
.chart-legend i.pale { background: #b9c7f4; }

.donut-layout { display: flex; min-height: 220px; align-items: center; justify-content: center; gap: 26px; }
.donut { position: relative; width: 135px; height: 135px; flex: 0 0 auto; background: conic-gradient(var(--primary) 0 43%, var(--purple) 43% 68%, #42a77a 68% 84%, #e6a141 84% 100%); border-radius: 50%; }
.donut::after { position: absolute; inset: 26px; content: ""; background: white; border-radius: 50%; }
.donut-center { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center strong { font-size: 20px; letter-spacing: -.5px; }
.donut-center span { color: var(--muted); font-size: 8px; }
.legend-list { display: grid; gap: 10px; }
.legend-list div { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; min-width: 128px; color: var(--muted); font-size: 10px; }
.legend-list i { width: 7px; height: 7px; background: var(--primary); border-radius: 2px; }
.legend-list strong { color: var(--text); font-size: 10px; }

.progress-list { display: grid; gap: 15px; }
.progress-item-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 10px; }
.progress-item-top span { color: var(--muted); }
.progress-item-top strong { font-size: 10px; }
.progress-track { height: 6px; overflow: hidden; background: #edf0f4; border-radius: 999px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: inherit; }
.progress-fill.green { background: var(--success); }
.progress-fill.orange { background: #dc8b1b; }

.exception-list { display: grid; }
.exception-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.exception-item:first-child { padding-top: 0; }
.exception-item:last-child { padding-bottom: 0; border-bottom: 0; }
.exception-mark { display: grid; width: 27px; height: 27px; flex: 0 0 auto; place-items: center; color: var(--danger); font-size: 11px; font-weight: 800; background: var(--danger-soft); border-radius: 7px; }
.exception-mark.warning { color: var(--warning); background: var(--warning-soft); }
.exception-mark.info { color: var(--primary); background: var(--primary-soft); }
.exception-content { min-width: 0; flex: 1; }
.exception-content strong { display: block; font-size: 11px; }
.exception-content p { margin: 2px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.exception-meta { margin-top: 5px; color: var(--muted-2); font-size: 9px; }

.activity-list { display: grid; gap: 14px; }
.activity-item { display: grid; grid-template-columns: 29px 1fr auto; align-items: start; gap: 9px; }
.activity-icon { display: grid; width: 29px; height: 29px; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 8px; }
.activity-icon.green { color: var(--success); background: var(--success-soft); }
.activity-icon.orange { color: var(--warning); background: var(--warning-soft); }
.activity-copy strong { display: block; font-size: 10px; }
.activity-copy span { color: var(--muted); font-size: 9px; }
.activity-time { color: var(--muted-2); font-size: 9px; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 13px; color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .05em; text-align: left; text-transform: uppercase; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
td { padding: 11px 13px; color: #475267; font-size: 10px; border-bottom: 1px solid #edf0f4; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.cell-main { color: var(--text); font-weight: 650; }
.cell-sub { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9px; }
.amount { color: var(--text); font-weight: 700; text-align: right; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; font-size: 9px; font-weight: 700; border-radius: 999px; white-space: nowrap; }
.status::before { width: 5px; height: 5px; content: ""; background: currentColor; border-radius: 50%; }
.status.success { color: var(--success); background: var(--success-soft); }
.status.warning { color: var(--warning); background: var(--warning-soft); }
.status.danger { color: var(--danger); background: var(--danger-soft); }
.status.info { color: var(--primary); background: var(--primary-soft); }
.status.neutral { color: #687386; background: #eef1f5; }
.status.purple { color: var(--purple); background: var(--purple-soft); }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-box { position: relative; width: min(280px, 100%); }
.search-box svg { position: absolute; top: 50%; left: 10px; width: 14px; color: var(--muted-2); transform: translateY(-50%); }
.search-box input { width: 100%; height: 32px; padding: 0 10px 0 31px; color: var(--text); font-size: 10px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 7px; outline: 0; }
.search-box input:focus { border-color: #aebdea; box-shadow: 0 0 0 3px rgba(49,87,213,.08); }
.filter-tabs { display: flex; gap: 3px; }
.filter-tab { padding: 5px 8px; color: var(--muted); font-size: 9px; font-weight: 650; background: transparent; border: 0; border-radius: 6px; }
.filter-tab.active { color: var(--primary); background: var(--primary-soft); }

.filter-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 15px; }
.filter-stat { padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-sm); }
.filter-stat span { display: block; color: var(--muted); font-size: 9px; }
.filter-stat strong { display: block; margin-top: 5px; font-size: 17px; letter-spacing: -.3px; }
.filter-stat small { color: var(--muted-2); font-size: 9px; }

.report-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.report-card { position: relative; overflow: hidden; padding: 17px; background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); }
.report-card::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; content: ""; background: var(--primary); }
.report-card.weekly::before { background: var(--purple); }
.report-card.monthly::before { background: #42a77a; }
.report-icon { display: grid; width: 34px; height: 34px; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 9px; }
.report-card h3 { margin: 12px 0 4px; font-size: 13px; }
.report-card p { min-height: 32px; margin: 0 0 14px; color: var(--muted); font-size: 10px; }
.report-card footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted-2); font-size: 9px; }

.advisor-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 15px; margin-bottom: 15px; }
.score-card { display: flex; align-items: center; gap: 23px; padding: 21px; background: linear-gradient(130deg, #172033, #25304a); border: 0; color: white; box-shadow: 0 12px 30px rgba(17,24,39,.15); }
.score-ring { position: relative; display: grid; width: 88px; height: 88px; flex: 0 0 auto; place-items: center; background: conic-gradient(#6f8df4 0 42%, rgba(255,255,255,.13) 42% 100%); border-radius: 50%; }
.score-ring::after { position: absolute; inset: 8px; content: ""; background: #1c2538; border-radius: 50%; }
.score-ring div { position: relative; z-index: 1; text-align: center; }
.score-ring strong { display: block; font-size: 21px; }
.score-ring span { color: #9ca9bf; font-size: 8px; }
.score-copy h2 { margin: 0 0 5px; font-size: 17px; }
.score-copy p { max-width: 520px; margin: 0; color: #aab5c8; font-size: 10px; line-height: 1.6; }
.score-copy .mini-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.mini-tag { padding: 3px 7px; color: #cbd5e9; font-size: 8px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.06); border-radius: 999px; }
.maturity-list { display: grid; gap: 14px; padding: 18px; }
.maturity-list h3 { margin: 0 0 2px; font-size: 12px; }
.maturity-list > p { margin: 0 0 4px; color: var(--muted); font-size: 9px; }

.questions-list { display: grid; gap: 9px; }
.question-item { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.question-item:last-child { border-bottom: 0; }
.question-number { display: grid; width: 23px; height: 23px; place-items: center; color: var(--primary); font-size: 9px; font-weight: 750; background: var(--primary-soft); border-radius: 7px; }
.question-item strong { display: block; font-size: 10px; }
.question-item span { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; }
.question-item .status { font-size: 8px; }

.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding-bottom: 17px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { position: absolute; top: 23px; bottom: 0; left: 11px; width: 1px; content: ""; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; display: grid; width: 23px; height: 23px; place-items: center; color: var(--primary); font-size: 8px; font-weight: 750; background: var(--primary-soft); border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.timeline-copy strong { display: block; font-size: 10px; }
.timeline-copy p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }

.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: var(--text); }

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .48);
  opacity: 0;
  transition: opacity .18s ease, visibility .18s ease;
}
.modal-backdrop.open { visibility: visible; opacity: 1; }
.modal { width: min(570px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: white; border-radius: 16px; box-shadow: var(--shadow-md); transform: translateY(8px); transition: transform .18s ease; }
.modal-backdrop.open .modal { transform: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 2px 0 0; font-size: 17px; }
.modal-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: grid; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: #4e5a6e; font-size: 10px; font-weight: 700; }
.form-field input, .form-field select, .form-field textarea { width: 100%; min-height: 37px; padding: 8px 10px; color: var(--text); font-size: 11px; background: white; border: 1px solid var(--border); border-radius: 8px; outline: 0; }
.form-field textarea { min-height: 72px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #aebdea; box-shadow: 0 0 0 3px rgba(49,87,213,.08); }
.form-hint { color: var(--muted-2); font-size: 9px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); }
.report-preview { color: #4c586b; font-size: 11px; line-height: 1.7; }
.report-preview h4 { margin: 17px 0 5px; color: var(--text); font-size: 11px; }
.report-preview ul { margin: 4px 0; padding-left: 18px; }

.toast {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  display: flex;
  visibility: hidden;
  align-items: center;
  gap: 10px;
  min-width: 285px;
  padding: 12px 14px;
  background: #172033;
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(12px);
  transition: .2s ease;
}
.toast.show { visibility: visible; opacity: 1; transform: none; }
.toast-icon { display: grid; width: 25px; height: 25px; place-items: center; color: white; font-weight: 800; background: var(--success); border-radius: 50%; }
.toast strong { display: block; color: white; font-size: 10px; }
.toast span { display: block; color: #aeb9cb; font-size: 9px; }

.sidebar-backdrop { display: none; }

/* Panel plegado en escritorio. La regla vive en min-width para no competir con
   .sidebar.open del cajon movil, que debe poder seguir abriendose. */
@media (min-width: 821px) {
  .app-shell.sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .app-shell.sidebar-collapsed .main { margin-left: 0; }
}

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .advisor-hero { grid-template-columns: 1fr; }
  .report-cards { grid-template-columns: 1fr 1fr; }
  .filter-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; display: block; visibility: hidden; background: rgba(15,23,42,.42); opacity: 0; transition: .2s ease; }
  .sidebar-backdrop.open { visibility: visible; opacity: 1; }
  .main { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 12px 18px; }
  .demo-banner { padding: 7px 18px; }
  .demo-banner button { display: none; }
  .content { padding: 20px 18px 35px; }
  .search-toggle, .company-select-wrap { display: none; }
  .grid-equal, .grid-3 { grid-template-columns: 1fr; }
  .filter-summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .topbar { min-height: 67px; }
  .topbar-left h1 { font-size: 16px; }
  .topbar-actions .secondary-button { display: none; }
  .primary-button span { display: none; }
  .primary-button { width: 36px; padding: 8px; }
  .demo-banner { font-size: 9px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .report-cards { grid-template-columns: 1fr; }
  .page-intro { align-items: flex-start; flex-direction: column; }
  .page-intro-actions { width: 100%; }
  .page-intro-actions button { flex: 1; }
  .filter-summary { grid-template-columns: 1fr 1fr; }
  .filter-stat strong { font-size: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .donut-layout { flex-direction: column; }
  .chart { gap: 6px; }
  .toast { right: 12px; bottom: 12px; left: 12px; min-width: 0; }
}

/* ---------- Flujo de la operación (pedido → entrega → factura → pago → saldo) ---------- */
.flow-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; padding: 16px; }
.flow-node { position: relative; overflow: visible; padding: 13px 14px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 11px; }
.flow-node::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; content: ""; background: var(--primary); border-radius: 11px 11px 0 0; }
.flow-node.ok::before { background: var(--success); }
.flow-node.warn::before { background: var(--warning); }
.flow-node.bad::before { background: var(--danger); }
.flow-node:not(:last-child)::after {
  position: absolute; top: 50%; right: -18px; z-index: 2;
  display: grid; width: 17px; height: 17px; place-items: center;
  color: var(--muted-2); font-size: 12px; line-height: 1; content: "\203A";
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
  transform: translateY(-50%);
}
.flow-step { display: block; color: var(--muted-2); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.flow-node strong { display: block; margin-top: 5px; font-size: 17px; letter-spacing: -.35px; }
.flow-node span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.flow-node em { display: block; margin-top: 6px; color: var(--muted-2); font-size: 9px; font-style: normal; }

@media (max-width: 1180px) {
  .flow-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .flow-node:not(:last-child)::after { display: none; }
}
@media (max-width: 820px) {
  .flow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .flow-strip { grid-template-columns: 1fr; }
}
