/* ═══════════════════════════════════════════════════════════════════════════
   ANS Partners — Styles (v5 — light theme + dark sidebar)
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #2a2f3d;
  --surface: #323848;
  --surface2: #3b4254;
  --surface3: #444c60;
  --border: #525b72;
  --border-light: #606a84;

  --text: #eaecf2;
  --text-secondary: #a0a6b8;
  --text-muted: #636b82;

  --accent: #5b8def;
  --accent-hover: #7aa3ff;
  --accent-dim: #1a2a52;
  --accent-glow: rgba(91, 141, 239, 0.06);

  --green: #3ecf8e;
  --green-dim: #0e2e1e;
  --yellow: #f0b429;
  --yellow-dim: #2e2200;
  --red: #f87171;
  --red-dim: #2e1010;
  --purple: #a78bfa;
  --purple-dim: #1e1535;
  --teal: #2dd4bf;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 232px;
  --topbar-h: 60px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── SIDEBAR ──────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-5) 0;
  flex-shrink: 0;
  z-index: 100;
  transition: transform 0.25s var(--ease);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 99;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo-title { font-size: 14px; font-weight: 700; }
.logo-sub { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--sp-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: all 0.15s var(--ease);
  outline: none;
  user-select: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 550; }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-divider { height: 1px; background: var(--border); margin: var(--sp-3) var(--sp-3); }

.sidebar-footer { padding: var(--sp-4) var(--sp-5) 0; border-top: 1px solid var(--border); }
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.sidebar-logout-btn:hover { color: var(--red); background: var(--red-dim); }

.view-as-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.view-as-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.view-as-select {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s;
}
.view-as-select:hover { border-color: var(--accent); }
.view-as-select:focus { border-color: var(--accent); outline: none; }

/* ─── MAIN (light theme override) ─────────────────────────────────────────── */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;

  --bg: #F8F5EF;
  --surface: #FFFFFF;
  --surface2: #F0EBE3;
  --surface3: #E6E0D6;
  --border: #DDD6CA;
  --border-light: #C8C0B4;

  --text: #1C1C2E;
  --text-secondary: #55536A;
  --text-muted: #8D89A0;

  --accent: #4A7DE0;
  --accent-hover: #3A6BD0;
  --accent-dim: #E8F0FE;
  --accent-glow: rgba(74, 125, 224, 0.08);

  --green: #1A9B5C;
  --green-dim: #E4F8EF;
  --yellow: #C88A08;
  --yellow-dim: #FFF8E1;
  --red: #DC4343;
  --red-dim: #FFF0F0;
  --purple: #7C5CC4;
  --purple-dim: #F3EEFF;

  background: var(--bg);
  color: var(--text);
}

.main ::-webkit-scrollbar-thumb { background: var(--border); }
.main ::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ─── TOPBAR ───────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  gap: var(--sp-3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar-left { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--sp-1);
}

.page-title { font-size: 18px; font-weight: 700; white-space: nowrap; }
.page-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ─── PERIOD TOGGLE ────────────────────────────────────────────────────────── */

.period-toggle {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  position: relative;
  gap: 0;
}

.period-btn {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 14px;
  cursor: pointer;
  transition: color 0.2s var(--ease);
  user-select: none;
  border-radius: 4px;
}
.period-btn:hover { color: var(--text-secondary); }
.period-btn.active { color: var(--text); }

.period-slider {
  position: absolute;
  z-index: 1;
  top: 2px;
  height: calc(100% - 4px);
  background: var(--surface3);
  border-radius: 4px;
  transition: left 0.25s var(--ease-spring), width 0.25s var(--ease-spring);
  pointer-events: none;
}

/* ─── SEARCH ───────────────────────────────────────────────────────────────── */

.search-box {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 180px;
}
.search-box input::placeholder { color: var(--text-muted); }

.status-pill {
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-pill.live { background: var(--green-dim); color: var(--green); }
.status-pill.live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── VIEWS ────────────────────────────────────────────────────────────────── */

.view {
  display: none;
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}
.view.active {
  display: block;
  animation: viewIn 0.3s var(--ease-out);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}

.financial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.period-context {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ─── METRIC CARDS ─────────────────────────────────────────────────────────── */

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.metric-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--sp-2);
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: var(--sp-1);
  letter-spacing: -0.5px;
  transition: color 0.2s;
}
.metric-value.green { color: var(--green); }
.metric-value.red { color: var(--red); }
.metric-value.accent { color: var(--accent); }

.metric-sub {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}

.metric-delta { font-size: 11px; line-height: 1.5; }
.metric-delta.positive { color: var(--green); }
.metric-delta.negative { color: var(--red); }
.metric-delta.neutral { color: var(--text-muted); }

/* ─── ENTITY GRID ──────────────────────────────────────────────────────────── */

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.entity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.entity-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}
.entity-card:active { transform: translateY(0); }

.entity-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.entity-card.active::before { background: linear-gradient(90deg, var(--green), var(--teal)); }
.entity-card.buildout::before { background: linear-gradient(90deg, var(--yellow), #fb923c); }
.entity-card.on-hold::before { background: linear-gradient(90deg, var(--text-muted), var(--surface2)); }

.entity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.entity-icon { font-size: 24px; margin-bottom: var(--sp-2); }
.entity-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.entity-type { font-size: 11px; color: var(--text-muted); }

.entity-fee-block { text-align: right; }
.entity-fee { font-size: 20px; font-weight: 800; color: var(--accent); letter-spacing: -0.3px; }
.entity-fee-label { font-size: 10px; color: var(--text-muted); }
.entity-cost-line { font-size: 11px; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

.entity-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.entity-services { display: flex; flex-wrap: wrap; gap: var(--sp-1); }

.service-tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.pill {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.pill.active { background: var(--green-dim); color: var(--green); }
.pill.buildout { background: var(--yellow-dim); color: var(--yellow); }
.pill.on-hold { background: var(--surface2); color: var(--text-muted); }

/* Buildout progress */
.buildout-progress { margin-top: var(--sp-3); }
.progress-bar-track {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #fb923c);
  border-radius: 2px;
  transition: width 0.8s var(--ease-out);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

/* ─── TWO COLUMN ───────────────────────────────────────────────────────────── */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6);
}

/* ─── TASK LIST ────────────────────────────────────────────────────────────── */

.task-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.task-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  transition: all 0.2s var(--ease);
}
.task-item:hover { border-color: var(--border-light); }
.task-item.completed { opacity: 0.4; }
.task-item.completed .task-text { text-decoration: line-through; }

.task-checkbox {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: transparent;
  padding: 0;
  color: transparent;
}
.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.task-checkbox svg { width: 10px; height: 10px; }

.task-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-dot.high { background: var(--red); }
.task-dot.medium { background: var(--yellow); }
.task-dot.low { background: var(--green); }

.task-body { flex: 1; min-width: 0; }
.task-text { font-size: 13px; font-weight: 450; }
.task-entity { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.task-due { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ─── CHARTS ───────────────────────────────────────────────────────────────── */

.chart-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}

.bar-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.bar-row:last-child { margin-bottom: 0; }

.bar-label {
  width: 120px;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 26px;
  background: var(--surface3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.8s var(--ease-out);
  display: flex;
  align-items: center;
  padding-left: var(--sp-3);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  min-width: fit-content;
}

.bar-fill.accent { background: linear-gradient(90deg, var(--accent), #7aa3ff); }
.bar-fill.green { background: linear-gradient(90deg, var(--green), var(--teal)); }
.bar-fill.yellow { background: linear-gradient(90deg, var(--yellow), #fb923c); }
.bar-fill.red { background: linear-gradient(90deg, var(--red), #fb7185); }
.bar-fill.purple { background: linear-gradient(90deg, var(--purple), #c4b5fd); }

/* ─── SERVICES OVERVIEW ────────────────────────────────────────────────────── */

.services-overview { display: flex; flex-direction: column; gap: var(--sp-2); }

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px var(--sp-4);
  transition: border-color 0.15s;
}
.service-row:hover { border-color: var(--border-light); }

.service-info { min-width: 0; }
.service-name { font-size: 13px; font-weight: 500; }
.service-tool { font-size: 11px; color: var(--text-muted); }

.service-count {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

/* ─── INTEGRATIONS GRID ────────────────────────────────────────────────────── */

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.integration-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.integration-card[data-status="connected"]::before { background: linear-gradient(90deg, var(--green), var(--teal)); }
.integration-card[data-status="manual"]::before { background: linear-gradient(90deg, var(--yellow), #fb923c); }
.integration-card[data-status="planned"]::before { background: var(--text-muted); }
.integration-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.integration-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.integration-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.integration-icon { font-size: 24px; }
.integration-name { font-size: 14px; font-weight: 700; }
.integration-category { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.integration-status {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.integration-status--connected { background: var(--green-dim); color: var(--green); }
.integration-status--manual { background: var(--yellow-dim); color: var(--yellow); }
.integration-status--planned { background: var(--surface3); color: var(--text-muted); }

/* Setup progress */
.integration-progress-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.integration-progress-row .progress-bar-track { flex: 1; height: 6px; }
.integration-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
  width: 28px;
  text-align: right;
}

.integration-progress--green {
  background: linear-gradient(90deg, var(--green), var(--teal));
}
.integration-progress--yellow {
  background: linear-gradient(90deg, var(--yellow), #fb923c);
}
.integration-progress--muted {
  background: var(--text-muted);
}

/* Setup steps */
.integration-setup-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  background: var(--surface2);
  border-radius: var(--radius-sm);
}

.setup-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 0;
}
.setup-step.done { color: var(--text-secondary); }
.setup-step.done .setup-step-label { text-decoration: line-through; opacity: 0.6; }

.setup-step-check {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  color: transparent;
}
.setup-step.done .setup-step-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.setup-step-label { font-size: 12px; }

/* Meta rows */
.integration-meta {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.integration-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.integration-meta-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.integration-meta-value { font-size: 12px; font-weight: 600; }

/* Data tags */
.integration-data-section { margin-bottom: var(--sp-3); }
.integration-data-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--sp-2); }
.integration-data-tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); }

.data-tag {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Complete badge (replaces checklist when all steps done) */
.integration-complete-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-bottom: var(--sp-4);
}

.data-tag--green {
  background: var(--green-dim);
  color: var(--green);
}

/* API note */
.integration-api-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: var(--sp-3);
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  margin-top: var(--sp-2);
}

/* ─── DATA FLOW ────────────────────────────────────────────────────────────── */

.dataflow-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  overflow-x: auto;
}

.dataflow-pipeline {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.dataflow-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.dataflow-step:last-child { border-bottom: none; }
.dataflow-step:hover { background: var(--accent-glow); border-radius: var(--radius-sm); }

.dataflow-node {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-width: 110px;
  text-align: center;
}
.dataflow-node--from {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-opacity: 0.2;
}
.dataflow-node--to {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green);
  border-opacity: 0.2;
}

.dataflow-arrow {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  min-width: 120px;
}

.dataflow-arrow-line {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 1px;
  position: relative;
}
.dataflow-arrow-line::after {
  content: '';
  position: absolute;
  right: -1px;
  top: -3px;
  width: 0;
  height: 0;
  border-left: 6px solid var(--green);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.dataflow-arrow-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.dataflow-arrow-freq {
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── SERVICES GRID ────────────────────────────────────────────────────────── */

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.service-card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.service-card-icon { font-size: 28px; margin-bottom: var(--sp-3); }
.service-card-name { font-size: 15px; font-weight: 700; margin-bottom: var(--sp-1); }
.service-card-tool { font-size: 12px; color: var(--accent); margin-bottom: var(--sp-3); font-weight: 500; }
.service-card-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.7; }
.service-card-entities { margin-top: var(--sp-4); display: flex; flex-wrap: wrap; gap: var(--sp-1); }

/* ─── TECH STACK ───────────────────────────────────────────────────────────── */

.tech-stack-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}

.stack-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.stack-row:last-child { border-bottom: none; }

.stack-name { width: 160px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.stack-cost { width: 70px; font-size: 13px; font-weight: 700; color: var(--accent); text-align: right; flex-shrink: 0; }
.stack-bar-track { flex: 1; height: 8px; background: var(--surface3); border-radius: 4px; overflow: hidden; }
.stack-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  transition: width 0.8s var(--ease-out);
}

/* ─── TABLES ───────────────────────────────────────────────────────────────── */

.entity-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.entity-table { width: 100%; border-collapse: collapse; }

.entity-table th {
  background: var(--surface2);
  padding: 11px var(--sp-4);
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.entity-table td {
  padding: 13px var(--sp-4);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.entity-table tr:last-child td { border-bottom: none; }
.entity-table tbody tr:hover td { background: var(--surface2); }
.entity-table tbody tr { cursor: pointer; }

.total-row td { background: var(--surface2) !important; font-weight: 700; }
.total-row { cursor: default !important; }
#cost-category-table tbody tr { cursor: default; }
#cost-category-table tbody tr:hover td { background: var(--surface2); }

/* Comparison table */
.comparison-table td:not(:first-child),
.comparison-table th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.comparison-table .highlight-col { background: var(--accent-glow); }
.comparison-table .row-divider td { border-top: 2px solid var(--border-light); font-weight: 700; }
.comparison-table .section-label td { background: var(--surface2); }
.comparison-table .section-label td:first-child { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }

/* ─── ENTITY DETAIL ────────────────────────────────────────────────────────── */

.entity-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
  animation: viewIn 0.25s var(--ease-out);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.detail-title-block { display: flex; align-items: center; gap: var(--sp-4); }
.detail-icon { font-size: 32px; }
.detail-name { font-size: 20px; font-weight: 800; }
.detail-type { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.detail-close {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.detail-close:hover { background: var(--surface3); color: var(--text); }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.detail-stat {
  padding: var(--sp-4);
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.detail-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: var(--sp-1); }
.detail-stat-value { font-size: 18px; font-weight: 700; }

.detail-services-heading { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: var(--sp-3); }
.detail-services-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.detail-service-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
}

/* ─── REVENUE STREAMS ────────────────────────────────────────────────────── */

.rev-section { margin-top: 4px; }

.rev-heading-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  margin-left: var(--sp-3);
  letter-spacing: 0;
  text-transform: none;
}

.rev-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rev-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--green);
  transition: background 0.12s;
}

.rev-item:first-child {
  border-top: 1px solid var(--border);
}

.rev-item:has(.rev-freq-onetime) {
  border-left-color: var(--yellow);
}

.rev-item:hover {
  background: var(--accent-glow);
}

.rev-item-left {
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
}

.rev-item-amount {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.rev-item-freq-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 3px;
}

.rev-freq-monthly { background: var(--green-dim); color: var(--green); }
.rev-freq-onetime { background: var(--yellow-dim); color: var(--yellow); }
.rev-freq-other { background: var(--accent-dim); color: var(--accent); }

.rev-item-body {
  flex: 1;
  min-width: 0;
}

.rev-item-type {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rev-item-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: 2px;
}

.rev-item-monthly {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
}

.rev-onetime {
  color: var(--yellow);
}

.rev-item-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

.rev-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.rev-item-remove:hover {
  color: var(--red);
  background: var(--red-dim);
}

.rev-remove-confirm {
  color: var(--red) !important;
  background: var(--red-dim) !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.rev-empty {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.rev-add-form {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.rev-add-input {
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s;
}

.rev-add-input:focus {
  border-color: var(--accent);
}

.rev-add-type { flex: 1.5; min-width: 120px; }
.rev-add-amount { width: 90px; }
.rev-add-freq { min-width: 110px; }
.rev-add-notes { flex: 1; min-width: 80px; }

.rev-add-btn {
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.rev-add-btn:hover {
  background: var(--accent-hover);
}

.rev-add-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
  opacity: 0.6;
  text-align: right;
}

.rev-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.rev-item-type-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 1px 6px;
  background: var(--surface2);
  border-radius: 999px;
}

.rev-add-name { flex: 1; min-width: 100px; }

/* ─── COST STREAMS ───────────────────────────────────────────────────────── */

.cost-section { margin-top: 4px; }

.cost-heading-total {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  margin-left: var(--sp-3);
  letter-spacing: 0;
  text-transform: none;
}

.cost-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cost-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--red);
  transition: background 0.12s;
}

.cost-item:first-child {
  border-top: 1px solid var(--border);
}

.cost-item:hover {
  background: var(--accent-glow);
}

.cost-item-left {
  min-width: 90px;
  text-align: right;
  flex-shrink: 0;
}

.cost-item-amount {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--red);
}

.cost-item-freq-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 3px;
}

.cost-freq-monthly { background: var(--red-dim); color: var(--red); }
.cost-freq-onetime { background: var(--yellow-dim); color: var(--yellow); }
.cost-freq-other { background: var(--accent-dim); color: var(--accent); }

.cost-item-body {
  flex: 1;
  min-width: 0;
}

.cost-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cost-item-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: 2px;
}

.cost-item-type-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 1px 6px;
  background: var(--surface2);
  border-radius: 999px;
}

.cost-item-monthly {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--red);
}

.cost-onetime {
  color: var(--yellow);
}

.cost-item-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

.cost-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.cost-item-remove:hover {
  color: var(--red);
  background: var(--red-dim);
}

.cost-remove-confirm {
  color: var(--red) !important;
  background: var(--red-dim) !important;
  font-size: 11px !important;
  padding: 2px 8px !important;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.cost-empty {
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cost-add-form {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.cost-add-input {
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s;
}

.cost-add-input:focus {
  border-color: var(--accent);
}

.cost-add-name { flex: 1; min-width: 100px; }
.cost-add-type { flex: 1.5; min-width: 120px; }
.cost-add-amount { width: 90px; }
.cost-add-freq { min-width: 110px; }
.cost-add-notes { flex: 1; min-width: 80px; }

.cost-add-btn {
  padding: 7px 14px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.cost-add-btn:hover {
  opacity: 0.85;
}

.cost-add-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
  opacity: 0.6;
  text-align: right;
}

@media (max-width: 768px) {
  .cost-add-form { flex-wrap: wrap; }
  .cost-add-name { min-width: 0; flex: 1; }
  .cost-add-type { min-width: 0; flex: 1; }
  .cost-add-amount { flex: 1; }
  .cost-add-freq { flex: 1; min-width: 0; }
  .cost-item-left { min-width: 70px; }
}

.entity-stream-badge {
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
  opacity: 0.8;
}

.re-table-stream-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

@media (max-width: 768px) {
  .rev-add-form { flex-wrap: wrap; }
  .rev-add-type { min-width: 0; flex: 1; }
  .rev-add-amount { flex: 1; }
  .rev-add-freq { flex: 1; min-width: 0; }
  .rev-item-left { min-width: 70px; }
}

/* ─── PROJECTION ───────────────────────────────────────────────────────────── */

.projection-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}

.projection-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: var(--sp-4);
}

.projection-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.projection-bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.6s var(--ease-out);
  position: relative;
  cursor: pointer;
}
.projection-bar .bar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.projection-bar:hover .bar-tooltip { display: block; }
.projection-bar:hover { filter: brightness(1.15); }

.projection-bar.revenue { background: linear-gradient(180deg, var(--accent), var(--accent-dim)); }
.projection-bar.profit { background: linear-gradient(180deg, var(--green), var(--green-dim)); }

.projection-month {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: var(--sp-2);
  text-align: center;
}
.projection-bar-col.current-month .projection-bar.revenue {
  background: linear-gradient(180deg, var(--green), var(--green-dim));
  box-shadow: 0 0 8px rgba(76,175,80,0.3);
}
.projection-bar-col.current-month .projection-month {
  color: var(--green);
  font-weight: 700;
}

.projection-legend {
  display: flex;
  gap: var(--sp-5);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: var(--sp-2); font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ─── REPORTS ──────────────────────────────────────────────────────────────── */

.report-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.report-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  transition: border-color 0.15s;
}
.report-item:hover { border-color: var(--border-light); }

.report-freq {
  width: 80px;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.report-freq.weekly { background: var(--accent-dim); color: var(--accent); }
.report-freq.biweekly { background: var(--green-dim); color: var(--green); }
.report-freq.monthly { background: var(--yellow-dim); color: var(--yellow); }
.report-freq.quarterly { background: var(--purple-dim); color: var(--purple); }
.report-freq.annually { background: var(--red-dim); color: var(--red); }

.report-body { flex: 1; min-width: 0; }
.report-name { font-size: 13px; font-weight: 600; }
.report-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.report-tool { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.recent-reports {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
}

.recent-report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-4);
  transition: border-color 0.15s;
  cursor: pointer;
}
.recent-report-card:hover { border-color: var(--accent); }

.recent-report-icon { font-size: 20px; margin-bottom: var(--sp-2); }
.recent-report-name { font-size: 13px; font-weight: 600; margin-bottom: var(--sp-1); }
.recent-report-date { font-size: 11px; color: var(--text-muted); }
.recent-report-status { font-size: 11px; margin-top: var(--sp-2); }

/* ─── SETTINGS ─────────────────────────────────────────────────────────────── */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.setting-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}
.setting-card-title { font-size: 14px; font-weight: 700; margin-bottom: var(--sp-1); }
.setting-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: var(--sp-4); line-height: 1.6; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--border);
}
.setting-label { font-size: 13px; font-weight: 450; }
.setting-value {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

/* ─── COST METRICS & CHART ────────────────────────────────────────────────── */

.cost-summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.cost-entity-chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}

.cost-entity-bars {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.cost-entity-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.cost-entity-label {
  font-size: 13px;
  font-weight: 600;
}

.cost-entity-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.cost-entity-bar-track {
  flex: 1;
  height: 12px;
  background: var(--surface3);
  border-radius: 6px;
  overflow: hidden;
}

.cost-entity-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s var(--ease-out);
}

.cost-entity-fill--accent { background: linear-gradient(90deg, var(--accent), var(--purple)); }
.cost-entity-fill--yellow { background: linear-gradient(90deg, var(--yellow), #fb923c); }
.cost-entity-fill--green { background: linear-gradient(90deg, var(--green), var(--teal)); }
.cost-entity-fill--red { background: linear-gradient(90deg, var(--red), #fb923c); }

.cost-entity-profit {
  font-size: 12px;
  font-weight: 600;
  margin-left: var(--sp-3);
}
.cost-entity-profit.positive { color: var(--green); }
.cost-entity-profit.negative { color: var(--red); }

.cost-entity-dual-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cost-entity-bar-type {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 32px;
  flex-shrink: 0;
}

.cost-entity-amount {
  font-size: 13px;
  font-weight: 700;
  min-width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cost-entity-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: 2px;
}

.cost-entity-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── TOAST ────────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 200;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-5);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  animation: toastIn 0.3s var(--ease-out), toastOut 0.3s var(--ease) 2.7s forwards;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* ─── PRINT ────────────────────────────────────────────────────────────────── */

@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .toast-container, .mobile-menu-btn, .task-checkbox, .period-toggle, .search-box, .status-pill { display: none !important; }
  .main { overflow: visible; }
  .view { display: block !important; padding: 12px; break-inside: avoid; animation: none !important; }
  .metric-card, .entity-card, .service-card, .integration-card, .entity-table-wrap, .chart-container, .projection-chart, .tech-stack-chart, .dataflow-container, .cost-entity-chart {
    border: 1px solid #ddd;
    box-shadow: none;
    break-inside: avoid;
  }
  .entity-card:hover { transform: none; box-shadow: none; }
  .metric-value, .entity-fee { color: #000 !important; }
  .metric-value.green, .metric-value.accent { color: #0a7 !important; }
  .metric-value.red { color: #c00 !important; }
}

/* ─── RESPONSIVE ───────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .metrics-row, .cost-summary-metrics { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Services List ──────────────────────────────────────────────────────── */

.services-list-simple {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.service-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color 0.15s;
}
.service-list-item:hover {
  border-color: var(--border-light);
}

.service-list-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  padding-top: 2px;
}

.service-list-body {
  flex: 1;
  min-width: 0;
}

.service-list-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.service-list-tool {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 4px;
}

.service-list-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.service-list-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.service-list-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  max-width: 260px;
  justify-content: flex-end;
}

.svc-edit-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3px 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.svc-edit-btn:hover {
  background: var(--accent);
  color: #fff;
}

.svc-entity-editor {
  width: 100%;
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.svc-editor-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.svc-editor-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.svc-editor-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.svc-editor-check:hover {
  border-color: var(--accent);
}
.svc-editor-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}
.svc-editor-check input {
  display: none;
}

.svc-editor-actions {
  display: flex;
  gap: 8px;
}
.svc-editor-save {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.svc-editor-save:hover { opacity: 0.9; }
.svc-editor-cancel {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}
.svc-editor-cancel:hover { border-color: var(--text-muted); }

.svc-entity-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 6px;
}

.svc-no-entities {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.service-tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.service-tag.on-hold {
  opacity: 0.5;
  text-decoration: line-through;
}

/* ── User Management ─────────────────────────────────────────────────────── */

.pill.user-role-admin { background: var(--accent-dim); color: var(--accent); }
.pill.user-role-editor { background: var(--yellow-dim); color: var(--yellow); }
.pill.user-role-viewer { background: var(--surface2); color: var(--text-secondary); }

.user-avatar-admin { background: var(--accent) !important; color: #fff !important; }
.user-avatar-editor { background: var(--yellow) !important; color: #fff !important; }

.user-email-cell {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.user-role-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

.user-entity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.user-entity-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

.users-no-entities {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.user-actions {
  display: flex;
  gap: 6px;
}

.user-remove-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.user-remove-btn:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(239, 68, 68, 0.08);
}

.user-confirm {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-confirm-row td { border: none !important; padding: 4px 0 !important; }
.user-confirm .ent-delete-btn,
.user-confirm .ent-cancel-btn { font-size: 11px; padding: 4px 12px; }

.user-entity-select-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.user-select-link {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.user-select-link:hover { text-decoration: underline; }
.user-select-sep { color: var(--text-muted); font-size: 10px; }

.user-admin-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.metric-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.metric-card-clickable:hover {
  border-color: var(--accent);
}
.metric-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.user-date-cell {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.users-empty {
  text-align: center;
  padding: 40px 20px;
}
.users-empty-icon { font-size: 32px; margin-bottom: 8px; }
.users-empty-text { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.users-empty-sub { font-size: 12px; color: var(--text-muted); }

/* Permissions overview grid */
.users-permissions-grid {
  margin-top: 12px;
}

.users-perm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.users-perm-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
.users-perm-card:hover { border-color: var(--border-light); }
.users-perm-card.on-hold { opacity: 0.55; }

.users-perm-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.users-perm-total {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.users-perm-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.users-perm-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}
.users-perm-badge.admin { background: var(--accent-dim); color: var(--accent); }
.users-perm-badge.editor { background: var(--yellow-dim); color: var(--yellow); }
.users-perm-badge.viewer { background: var(--surface2); color: var(--text-secondary); }

.users-perm-none {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.users-perm-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.user-editor {
  padding: 16px 18px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.user-edit-panel td {
  padding: 0 !important;
  border: none !important;
}
.user-edit-panel td > .user-editor {
  margin: 8px 0;
}

@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .mobile-menu-btn { display: flex; }
  .search-box { display: none; }

  .view { padding: var(--sp-4); }
  .metrics-row, .cost-summary-metrics { grid-template-columns: 1fr; }
  .entity-grid { grid-template-columns: 1fr; }
  .service-list-item { flex-direction: column; }
  .service-list-right { align-items: flex-start; width: 100%; }
  .service-list-entities { max-width: 100%; justify-content: flex-start; }
  .page-date { display: none; }
  .topbar { padding: 0 var(--sp-4); }
  .period-toggle { order: -1; }

  .comparison-table { font-size: 12px; }
  .comparison-table th, .comparison-table td { padding: 8px; }
  .employee-metrics-row { grid-template-columns: 1fr !important; }

  /* Calendar */
  .cal-cell { min-height: 60px; padding: 4px; }
  .cal-cell-tasks { display: none; }
  .cal-form-row { flex-direction: column; }
  .cal-form-group { min-width: 100%; }
  .cal-top-bar { flex-direction: column; align-items: flex-start; }

  /* Scheduling */
  .schedule-stats-row { grid-template-columns: 1fr 1fr; }
  .schedule-header { flex-direction: column; align-items: flex-start; }
}

/* ─── ENTITY FORM & EDIT ─────────────────────────────────────────────────── */

.entity-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.ent-form-wrap {
  margin-bottom: var(--sp-5);
}

.ent-form-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-4);
}

.ent-svc-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ent-svc-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  user-select: none;
}
.ent-svc-check:hover { background: var(--surface3); color: var(--text); }
.ent-svc-check:has(input:checked) {
  background: var(--accent-dim);
  color: var(--accent);
}

.ent-svc-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.ent-form-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.btn-accent {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s var(--ease);
}
.btn-accent:hover {
  background: transparent;
  color: var(--accent);
}

.ent-cancel-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s var(--ease);
}
.ent-cancel-btn:hover { background: var(--surface3); color: var(--text); }

.ent-delete-btn {
  background: var(--red-dim);
  border: 1px solid transparent;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  transition: all 0.12s var(--ease);
}
.ent-delete-btn:hover { background: var(--red); color: #fff; }

.ent-edit-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s var(--ease);
}
.ent-edit-btn:hover { background: var(--accent); color: #fff; }

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ─── EMPLOYEES ──────────────────────────────────────────────────────────── */

.employee-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.employee-summary {
  display: flex;
  gap: var(--sp-3);
}

.employee-stat {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.employee-filter-bar {
  margin-bottom: var(--sp-5);
}

.employee-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.employee-table .employee-name-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.employee-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.employee-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.employee-type-badge.ft {
  background: var(--green-dim);
  color: var(--green);
}

.employee-type-badge.pt {
  background: var(--purple-dim);
  color: var(--purple);
}

.employee-id-badge {
  font-size: 11px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ─── CALENDAR TASKS ─────────────────────────────────────────────────────── */

.cal-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.cal-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Entity filter bar */
.cal-entity-filter {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.cal-filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  font-family: inherit;
}
.cal-filter-btn:hover { background: var(--surface3); color: var(--text); }
.cal-filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Calendar grid */
.cal-grid-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.cal-day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.cal-day-hdr {
  text-align: center;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  min-height: 100px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  cursor: pointer;
  transition: background 0.1s var(--ease);
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--surface2); }
.cal-cell-empty {
  background: var(--bg);
  cursor: default;
}
.cal-cell-empty:hover { background: var(--bg); }

.cal-cell-today {
  background: var(--accent-glow);
}
.cal-cell-today:hover { background: var(--accent-dim); }

.cal-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cal-cell-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cal-today-num {
  background: var(--accent);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.cal-cell-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 10px;
}

.cal-cell-tasks {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-task-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  white-space: nowrap;
}

.cal-task-pill.cal-task-done { opacity: 0.4; text-decoration: line-through; }

.cal-task-accent { background: var(--accent-dim); color: var(--accent); }
.cal-task-yellow { background: var(--yellow-dim); color: var(--yellow); }
.cal-task-green  { background: var(--green-dim); color: var(--green); }

.cal-task-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-task-dot.high   { background: var(--red); }
.cal-task-dot.medium { background: var(--yellow); }
.cal-task-dot.low    { background: var(--text-muted); }

.cal-task-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-more {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 6px;
  font-weight: 600;
}

/* Day detail panel */
.cal-day-detail {
  margin-top: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.cal-detail-date {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.cal-detail-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-detail-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cal-detail-close:hover { color: var(--text); }

.cal-detail-tasks {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-detail-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.cal-detail-task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.1s var(--ease);
}
.cal-detail-task:hover { background: var(--surface2); }
.cal-detail-task.completed { opacity: 0.45; }

.cal-detail-task .task-dot { margin-top: 5px; }

.cal-detail-task-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.cal-detail-task.completed .cal-detail-task-text { text-decoration: line-through; }

.cal-detail-task-entity {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Cadence pill (shared) */
.task-cadence-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--purple-dim);
  color: var(--purple);
  padding: 2px 7px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}

/* Create task form */
.cal-create-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.cal-form-row {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.cal-form-row:last-child { margin-bottom: 0; }

.cal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.cal-form-grow { flex: 1; }

.cal-form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.cal-input, .cal-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.12s var(--ease);
}
.cal-input:focus, .cal-select:focus {
  outline: none;
  border-color: var(--accent);
}
.cal-input::placeholder { color: var(--text-muted); }

.cal-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='%2355536A' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.cal-form-btn-wrap {
  justify-content: flex-end;
  align-self: flex-end;
}

.cal-create-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s var(--ease);
  white-space: nowrap;
}
.cal-create-btn:hover { background: var(--accent-hover); }

/* All tasks list */
.cal-task-list-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.cal-task-table td { vertical-align: middle; }

.cal-tl-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-tl-check {
  flex-shrink: 0;
}

.cal-tl-done-text {
  text-decoration: line-through;
  opacity: 0.5;
}

.cal-task-row-done td {
  opacity: 0.55;
}

.cal-tl-entity {
  font-size: 12px;
  color: var(--text-secondary);
}

.cal-tl-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: all 0.12s var(--ease);
}
.cal-tl-delete:hover {
  color: var(--red);
  background: var(--red-dim);
}

.pill.completed-pill {
  background: var(--surface3);
  color: var(--text-muted);
}

/* ─── SCHEDULING ─────────────────────────────────────────────────────────── */

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.schedule-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.schedule-nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease);
}
.schedule-nav-btn:hover { background: var(--surface3); }

.schedule-week-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 160px;
  text-align: center;
}

.schedule-today-btn {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: var(--sp-2);
  transition: background 0.15s var(--ease);
}
.schedule-today-btn:hover { background: var(--accent); color: #fff; }

.schedule-legend {
  display: flex;
  gap: var(--sp-5);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.schedule-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.shift-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.shift-dot.shift-open  { background: var(--accent); }
.shift-dot.shift-close { background: var(--purple); }
.shift-dot.shift-off   { background: var(--surface3); border: 1px solid var(--border); }

.schedule-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.schedule-calendar-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}

.schedule-table th,
.schedule-table td {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.sched-emp-header {
  text-align: left;
  padding: 10px 14px !important;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface2);
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 160px;
}

.sched-day-header {
  text-align: center;
  padding: 8px 6px !important;
  background: var(--surface2);
  min-width: 80px;
}
.sched-day-header.sched-today {
  background: var(--accent-dim);
}

.sched-day-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}
.sched-day-header.sched-today .sched-day-name { color: var(--accent); }

.sched-day-date {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.sched-day-header.sched-today .sched-day-date {
  color: var(--accent);
}

.sched-total-header {
  text-align: center;
  padding: 10px 8px !important;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface2);
  min-width: 50px;
}

.sched-role-divider td {
  background: var(--surface2);
  padding: 6px 14px !important;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.sched-emp-row:hover { background: var(--accent-glow); }

.sched-emp-cell {
  padding: 8px 14px !important;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  min-width: 160px;
}
.sched-emp-row:hover .sched-emp-cell { background: var(--surface2); }

.sched-emp-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.sched-emp-loc {
  font-size: 11px;
  color: var(--text-muted);
}

.sched-cell {
  text-align: center;
  padding: 6px 4px !important;
  vertical-align: middle;
}
.sched-cell.sched-today {
  background: rgba(91, 141, 239, 0.04);
}

.shift-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  min-width: 58px;
  text-align: center;
}

.shift-badge.shift-open {
  background: var(--accent-dim);
  color: var(--accent);
}

.shift-badge.shift-close {
  background: var(--purple-dim);
  color: var(--purple);
}

.shift-badge.shift-off {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 10px;
  opacity: 0.5;
}

.sched-hrs-cell {
  text-align: center;
  padding: 8px !important;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.sched-editable {
  cursor: pointer;
  transition: background 0.12s var(--ease);
}
.sched-editable:hover {
  background: var(--surface2) !important;
}
.sched-editable:hover .shift-badge {
  outline: 2px solid var(--border-light);
  outline-offset: 1px;
  border-radius: var(--radius-sm);
}

/* Shift editor popover */
.shift-editor {
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  width: 210px;
  overflow: hidden;
  animation: editorIn 0.15s var(--ease-out);
}

@keyframes editorIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shift-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.shift-editor-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.shift-editor-day {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shift-editor-options {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shift-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.1s var(--ease);
  position: relative;
  font-family: inherit;
}

.shift-option:hover {
  background: var(--surface2);
}

.shift-option.selected {
  background: var(--accent-dim);
}

.shift-option.selected::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.shift-option-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  padding-right: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXPENSES & RECEIPTS
   ═══════════════════════════════════════════════════════════════════════════ */

.expense-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.expense-add-toggle {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.expense-add-toggle:hover { background: var(--accent-hover); }

/* ── Add form ──────────────────────────────────────────────────────────── */

.expense-add-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  animation: viewIn 0.2s var(--ease-out);
}

.expense-form-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text);
}

.expense-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.expense-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}

.expense-form-group input,
.expense-form-group select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.expense-form-group input:focus,
.expense-form-group select:focus {
  border-color: var(--accent);
  outline: none;
}

.expense-form-receipt {
  grid-column: span 3;
}

.expense-receipt-upload {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.expense-receipt-upload:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.expense-receipt-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.expense-receipt-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.expense-receipt-icon {
  font-size: 28px;
}

.expense-receipt-preview {
  position: relative;
  display: inline-block;
}

.expense-receipt-preview img {
  max-height: 120px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.expense-receipt-clear {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.expense-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.expense-submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.expense-submit-btn:hover { background: var(--accent-hover); }

.expense-cancel-btn {
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* ── Filters ───────────────────────────────────────────────────────────── */

.expense-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.expense-filter-select {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
}

/* ── Table ──────────────────────────────────────────────────────────────── */

.expense-table th:nth-child(8),
.expense-table td:nth-child(8) {
  text-align: right;
  font-weight: 600;
}

.expense-table tbody tr { cursor: default; }
.expense-table tbody tr.expense-row-clickable { cursor: pointer; }
.expense-table tbody tr:not(.expense-total-row):hover { background: var(--surface2); }
.expense-amount-cell { color: var(--red); font-weight: 600; }

.expense-receipt-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
}
.expense-receipt-thumb:hover { transform: scale(1.15); }

.expense-no-receipt {
  color: var(--text-muted);
  font-size: 11px;
}

.expense-category-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface3);
  color: var(--text-secondary);
  white-space: nowrap;
}

.expense-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.expense-remove-btn:hover { color: var(--red); background: var(--red-dim); }
.expense-remove-confirm {
  color: var(--red) !important;
  font-size: 11px !important;
  font-weight: 600;
}

.expense-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.expense-total-row td {
  font-weight: 700 !important;
  border-top: 2px solid var(--border) !important;
  padding-top: 10px !important;
}

.expense-payment-pill,
.expense-payback-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface3);
  color: var(--text-secondary);
  white-space: nowrap;
}
.expense-payback-pill { background: var(--green-dim); color: var(--green); }
.expense-ref { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Expense Edit Modal ────────────────────────────────────────────────── */
.expense-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.expense-edit-dialog {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 32px;
  width: 600px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}
.expense-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.expense-edit-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.expense-edit-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.expense-edit-close:hover { color: var(--red); background: var(--red-dim); }

/* ── Entity detail — expenses subsection ───────────────────────────────── */

.entity-expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 10px;
  border-left: 3px solid var(--red);
  margin-bottom: 6px;
}

.entity-expense-amount {
  font-weight: 700;
  font-size: 14px;
  color: var(--red);
  min-width: 70px;
}

.entity-expense-body {
  flex: 1;
  min-width: 0;
}

.entity-expense-vendor {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.entity-expense-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.entity-expense-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.entity-expense-heading-total {
  float: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
}

.entity-expense-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Receipt modal ─────────────────────────────────────────────────────── */

.receipt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: viewIn 0.15s ease-out;
}

.receipt-modal {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.receipt-modal-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.receipt-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Team View ─────────────────────────────────────────────────────────── */

.team-invite-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  align-items: center;
}

.team-invite-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.team-invite-input:focus { border-color: var(--accent); }

.team-invite-role {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
}

.team-invite-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.team-invite-btn:hover { opacity: 0.9; }
.team-invite-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.team-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.team-member-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
}

.team-member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.team-member-info { flex: 1; min-width: 0; }

.team-member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.team-member-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.team-member-role {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.team-role-owner { background: var(--accent-dim); color: var(--accent); }
.team-role-admin { background: var(--purple-dim, #1e1533); color: var(--purple); }
.team-role-editor { background: var(--green-dim); color: var(--green); }
.team-role-viewer { background: var(--surface2); color: var(--text-muted); }

.team-member-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
  font-size: 16px;
  line-height: 1;
}

.team-member-remove:hover { color: var(--red); background: var(--red-dim); }

.team-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface);
}

.team-pending { opacity: 0.6; font-style: italic; }

/* ── Responsive — Tablet ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .expense-form-grid { grid-template-columns: 1fr; }
  .expense-form-receipt { grid-column: span 1; }
  .expense-filters { flex-wrap: wrap; }
  .expense-section-header { flex-wrap: wrap; }
  .team-invite-bar { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MOBILE — Comprehensive responsive overhaul (max-width: 640px)
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Global ──────────────────────────────────────────────────────────── */
  .view { padding: var(--sp-3) var(--sp-3); }
  .section-heading { font-size: 10px; margin-bottom: var(--sp-3); }

  /* ── Topbar ─────────────────────────────────────────────────────────── */
  .topbar { padding: 0 var(--sp-3); height: 50px; gap: var(--sp-2); }
  .page-title { font-size: 15px; }
  .page-date { display: none; }
  .mobile-menu-btn { display: flex; }
  .search-box { display: none; }
  .status-pill { font-size: 10px; padding: 3px 8px; }
  .period-btn { padding: 4px 10px; font-size: 11px; }

  /* ── Sidebar (off-canvas) ───────────────────────────────────────────── */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* ── Metrics ────────────────────────────────────────────────────────── */
  .metrics-row,
  .cost-summary-metrics { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .metric-card { padding: var(--sp-3); }
  .metric-value { font-size: 20px; }
  .metric-label { font-size: 10px; }
  .metric-sub { font-size: 11px; }

  /* ── Entity Grid ────────────────────────────────────────────────────── */
  .entity-grid { grid-template-columns: 1fr; gap: var(--sp-3); margin-bottom: var(--sp-5); }
  .entity-card { padding: var(--sp-4); }
  .entity-fee { font-size: 16px; }

  /* ── Two Column → Stack ─────────────────────────────────────────────── */
  .two-col { grid-template-columns: 1fr; gap: var(--sp-4); }

  /* ── Charts ─────────────────────────────────────────────────────────── */
  .chart-container { padding: var(--sp-3); }
  .bar-label { width: 80px; font-size: 11px; }
  .bar-track { height: 20px; }
  .bar-fill { font-size: 10px; padding-left: var(--sp-2); }

  /* ── Entity Detail Panel ────────────────────────────────────────────── */
  .entity-detail-panel { padding: var(--sp-4); margin-bottom: var(--sp-4); }
  .detail-header { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .detail-name { font-size: 16px; }
  .detail-icon { font-size: 24px; }
  .detail-stats { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .detail-stat { padding: var(--sp-3); }
  .detail-stat-val { font-size: 18px; }

  /* ── Tables (generic) ───────────────────────────────────────────────── */
  .entity-table,
  .comparison-table { font-size: 11px; }
  .entity-table th,
  .entity-table td,
  .comparison-table th,
  .comparison-table td { padding: 8px 6px; }

  /* ── Expense Section ────────────────────────────────────────────────── */
  .expense-section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .expense-form-grid { grid-template-columns: 1fr; }
  .expense-form-receipt { grid-column: span 1; }
  .expense-filters { flex-wrap: wrap; gap: 6px; }
  .expense-filters select,
  .expense-filters input { font-size: 12px; }
  .expense-add-form { padding: var(--sp-3); }

  /* Expense table — horizontal scroll wrapper handled by JS,
     but make cells tighter */
  .expense-table { min-width: 700px; }
  .expense-table th,
  .expense-table td { padding: 8px 6px; font-size: 11px; white-space: nowrap; }

  /* Expense edit modal */
  .expense-edit-dialog { width: 95vw; max-height: 90vh; padding: var(--sp-4); }
  .expense-edit-header h3 { font-size: 16px; }

  /* ── Financial View ─────────────────────────────────────────────────── */
  .financial-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .period-context { font-size: 11px; }

  /* Projection chart */
  .projection-bars { height: 120px; }

  /* ── Services ───────────────────────────────────────────────────────── */
  .service-list-item { flex-direction: column; padding: var(--sp-3); }
  .service-list-right { align-items: flex-start; width: 100%; }
  .service-list-entities { max-width: 100%; justify-content: flex-start; }
  .services-overview .service-row { padding: 8px var(--sp-3); }

  /* ── Integrations ───────────────────────────────────────────────────── */
  .integrations-grid { grid-template-columns: 1fr; }
  .integration-card { padding: var(--sp-4); }
  .integration-steps { gap: var(--sp-2); }
  .integration-step { font-size: 12px; }

  /* ── Reports ────────────────────────────────────────────────────────── */
  .report-item { flex-wrap: wrap; gap: 8px; }
  .recent-reports-grid { grid-template-columns: 1fr 1fr; }

  /* ── Employees ──────────────────────────────────────────────────────── */
  .employee-metrics-row { grid-template-columns: 1fr !important; }
  .employee-table { min-width: 500px; }

  /* ── Calendar ───────────────────────────────────────────────────────── */
  .cal-top-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cal-cell { min-height: 50px; padding: 3px; }
  .cal-cell-tasks { display: none; }
  .cal-cell-day { font-size: 11px; }
  .cal-form-row { flex-direction: column; }
  .cal-form-group { min-width: 100%; }

  /* ── Scheduling ─────────────────────────────────────────────────────── */
  .schedule-stats-row { grid-template-columns: 1fr; }
  .schedule-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .schedule-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .schedule-table { min-width: 500px; }

  /* ── Users ──────────────────────────────────────────────────────────── */
  .users-metrics-row { grid-template-columns: 1fr; }
  .user-add-form { flex-direction: column; }
  .user-add-form input,
  .user-add-form select,
  .user-add-form button { width: 100%; }

  /* ── Team ───────────────────────────────────────────────────────────── */
  .team-invite-bar { flex-direction: column; }
  .team-invite-input,
  .team-invite-role,
  .team-invite-btn { width: 100%; }
  .team-member-row { padding: 12px 14px; gap: 10px; }
  .team-member-name { font-size: 13px; }

  /* ── Settings ───────────────────────────────────────────────────────── */
  .settings-grid { grid-template-columns: 1fr !important; }

  /* ── Entity Form ────────────────────────────────────────────────────── */
  .ent-form-row { flex-direction: column; }
  .ent-form-row > * { width: 100%; }
  .ent-svc-checkboxes { gap: 4px; }
  .ent-svc-check { font-size: 12px; padding: 5px 10px; }

  /* ── Toasts ─────────────────────────────────────────────────────────── */
  .toast-container { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); }

  /* ── Revenue/Cost stream forms ──────────────────────────────────────── */
  .cost-add-form,
  .rev-add-form { flex-wrap: wrap; }
  .cost-add-form > *,
  .rev-add-form > * { min-width: 0; flex: 1 1 100%; }
  .cost-add-form button,
  .rev-add-form button { flex: 0 0 auto; }

  /* ── Permissions grid ───────────────────────────────────────────────── */
  .users-permissions-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

