/* ══════════════════════════════════════════════════════════
   CRM Database — Stylesheet
   Aesthetic: Warm Industrial — slate, amber accents, sharp type
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0d0f12;
  --bg-2: #151920;
  --bg-3: #1d2330;
  --bg-4: #2c3548;
  --border: #3a4660;
  --border-2: #4d5a78;
  --text: #f4f6fa;
  --text-2: #c8cfdb;
  --text-3: #a0adc0;
  --accent: #f0b528;
  --accent-2: #f5cc5c;
  --accent-bg: rgba(240,181,40,0.16);
  --blue: #7ab4ee;
  --green: #5cd98a;
  --red: #ed6b78;
  --orange: #f09558;
  --sidebar-w: 240px;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); background: #111520; border-right: 1px solid var(--border-2);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  transition: transform 0.25s ease;
}
.sidebar-brand {
  padding: 1rem 1rem 0.85rem; border-bottom: 1px solid var(--border-2);
  text-align: center;
}
.sidebar-logo {
  display: block; max-width: 100%; height: auto; max-height: 64px;
  margin: 0 auto; border-radius: var(--radius-sm);
}
.sidebar-brand h2 {
  font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; color: var(--accent);
}
.sidebar-brand small { font-size: 0.7rem; color: var(--text-2); display: block; margin-top: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 0.75rem 0.6rem; overflow-y: auto; }
.nav-section {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); padding: 1.2rem 0.75rem 0.4rem;
  border-top: 1px solid var(--border); margin-top: 0.25rem;
}
.nav-section:first-child { border-top: none; margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 0.92rem; transition: all var(--transition);
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
  background: rgba(230,168,23,0.15); color: var(--accent);
  border-left: 3px solid var(--accent); padding-left: calc(0.75rem - 3px);
}
.nav-item svg { opacity: 0.65; flex-shrink: 0; }
.nav-item:hover svg { opacity: 0.9; }
.nav-item.active svg { opacity: 1; }
.nav-count {
  margin-left: auto; font-size: 0.7rem; background: var(--border); color: var(--text);
  padding: 1px 7px; border-radius: 10px; font-weight: 600;
}
.sidebar-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--border-2); font-size: 0.75rem; color: var(--text-3); }
.sidebar-footer strong { color: var(--text); }

/* ── Main Content ── */
.main-area { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.topbar {
  height: 52px; background: #111520; border-bottom: 2px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-2); cursor: pointer; padding: 4px; }
.topbar-user {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 500;
}
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700;
}
#main-content {
  padding: 1.5rem; max-width: 1300px; transition: opacity 0.12s ease, transform 0.12s ease;
}

/* ── Page Header ── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.page-subtitle { font-size: 0.85rem; color: var(--text-2); margin-top: 0.15rem; display: flex; align-items: center; gap: 0.5rem; }
.header-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ── Cards ── */
.card {
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 0; 
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-header h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }

/* ── KPI Cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 1.25rem;
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--border-2);
}
.kpi-card.accent::before { background: var(--accent); }
.kpi-card.highlight::before { background: var(--green); }
.kpi-label { font-size: 0.78rem; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; margin: 0.15rem 0; }
.kpi-sub { font-size: 0.78rem; color: var(--text-3); }

/* ── Dashboard Grid ── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ── Pipeline ── */
.pipeline-stages { display: flex; flex-direction: column; gap: 0.6rem; }
.pipeline-row { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.pipeline-label { width: 140px; font-size: 0.82rem; color: var(--text-2); flex-shrink: 0; }
.pipeline-bar-bg { flex: 1 1 auto; min-width: 40px; height: 22px; background: var(--bg-4); border-radius: 4px; overflow: hidden; }
.pipeline-bar { height: 100%; border-radius: 4px; transition: width 0.6s ease; min-width: 2px; }
.pipeline-count { flex-shrink: 0; min-width: 120px; text-align: right; font-size: 0.82rem; font-weight: 600; font-family: var(--mono); white-space: nowrap; }
.pipeline-count .pipeline-value { color: var(--text-3); font-weight: 500; margin-left: 0.25rem; }

/* ── Activity List ── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-3); margin: 0 -1.25rem; padding-left: 2rem; padding-right: 2rem; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0; color: white;
}
.activity-content { flex: 1; min-width: 0; }
.activity-title { font-weight: 600; font-size: 0.88rem; }
.activity-meta { font-size: 0.78rem; color: var(--text-3); margin-top: 1px; }
.activity-notes { font-size: 0.8rem; color: var(--text-2); margin-top: 4px; line-height: 1.4; }
.activity-date { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }

/* ── Upcoming Jobs ── */
.upcoming-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.upcoming-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem;
  cursor: pointer; transition: all var(--transition);
}
.upcoming-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.upcoming-status { margin-bottom: 0.5rem; }
.upcoming-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.upcoming-desc { font-size: 0.8rem; color: var(--text-2); margin-bottom: 0.5rem; }
.upcoming-meta { font-size: 0.75rem; color: var(--text-3); display: flex; gap: 1rem; }

/* ── Sub Cards (inside detail pages) ── */
.sub-card {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; margin-bottom: 0.6rem; transition: all var(--transition);
}
.sub-card.clickable { cursor: pointer; }
.sub-card.clickable:hover { border-color: var(--accent); }
.sub-card-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; font-size: 0.78rem; color: var(--text-3); }
.sub-card-title { font-weight: 600; font-size: 1rem; }
.sub-card-meta { font-size: 0.78rem; color: var(--text-2); margin-top: 0.2rem; }
.sub-card-actions { margin-top: 0.6rem; display: flex; gap: 0.5rem; }

/* ── Info List ── */
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.info-row { display: flex; flex-direction: column; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.info-row.full { grid-column: 1 / -1; }
.info-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 500; margin-bottom: 2px; }

/* ── Finance Summary ── */
.finance-summary { display: flex; flex-direction: column; gap: 0; }
.fin-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.fin-row.total { font-weight: 700; font-size: 1rem; border-bottom: 2px solid var(--border-2); }
.fin-row.due { font-weight: 700; color: var(--red); }
.positive { color: var(--green); }
.negative { color: var(--red); }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-2); margin-bottom: 0; }
.tab {
  padding: 0.65rem 1.1rem; font-size: 0.85rem; font-weight: 600; color: var(--text-3);
  background: none; border: none; cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(230,168,23,0.06); }
.tab-content { display: none; padding-top: 1.25rem; }
.tab-content.active { display: block; }

/* ── Tables ── */
.tbl-wrap { overflow-x: auto; }
.tbl-wrap table { width: 100%; border-collapse: collapse; }
.tbl-wrap th {
  text-align: left; padding: 0.65rem 0.75rem; font-size: 0.73rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-2); font-weight: 700; border-bottom: 2px solid var(--border-2);
  white-space: nowrap; background: rgba(0,0,0,0.15);
}
.tbl-wrap td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: middle; }
.tbl-wrap tr.clickable { cursor: pointer; transition: background var(--transition); }
.tbl-wrap tr.clickable:hover { background: var(--bg-3); }
.tbl-wrap.compact th { padding: 0.5rem 0.6rem; }
.tbl-wrap.compact td { padding: 0.5rem 0.6rem; font-size: 0.83rem; }
.empty-row { text-align: center; color: var(--text-3); padding: 2rem !important; }

.cell-name { display: flex; align-items: center; gap: 0.65rem; }
.cell-name strong { display: block; }
.cell-sub { display: block; font-size: 0.75rem; color: var(--text-3); }
.cell-desc { color: var(--text-2); font-size: 0.83rem; }

.mini-table { margin-top: 0.5rem; border-top: 1px solid var(--border); padding-top: 0.5rem; }
.mini-table table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.mini-table th { text-align: left; padding: 0.25rem 0.5rem; color: var(--text-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.mini-table td { padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--border); }

/* ── Badge ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600;
  background: color-mix(in srgb, var(--badge-c) 15%, transparent); color: var(--badge-c);
  letter-spacing: 0.02em;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; border: 1px solid var(--border-2);
  background: var(--bg-3); color: var(--text); cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-4); border-color: var(--text-3); }
.btn-primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent-2); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn-icon { background: none; border: none; color: var(--text-2); cursor: pointer; padding: 4px; font-size: 1.2rem; display: flex; align-items: center; }
.btn-icon:hover { color: var(--text); }

/* ── Search Box ── */
.search-box {
  display: flex; align-items: center; gap: 0.5rem; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 0.65rem; height: 36px;
}
.search-box svg { color: var(--text-3); flex-shrink: 0; }
.search-box input {
  background: none; border: none; outline: none; color: var(--text); width: 170px; font-size: 0.85rem;
}
.search-box input::placeholder { color: var(--text-3); }

.filter-select {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.4rem 0.65rem; font-size: 0.85rem; cursor: pointer; outline: none;
}
.filter-select option { background: var(--bg-2); }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group:has(textarea), .form-actions { grid-column: 1 / -1; }
.form-group label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg-3); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.5rem 0.65rem; font-size: 0.88rem; outline: none; transition: border var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── Modal ── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
#modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  width: 90%; max-width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-box.wide { max-width: 700px; }
.modal-box.extra-wide { max-width: 1100px; }
.plan-tab-btn { padding: 0.45rem 0.95rem; border: none; background: transparent; color: var(--text-2); cursor: pointer; border-radius: 5px 5px 0 0; font-size: 0.85rem; font-weight: 500; transition: background 120ms ease, color 120ms ease; }
.plan-tab-btn:hover:not(.active) { background: var(--bg-3); color: var(--text); }
.plan-tab-btn.active { background: var(--accent); color: #1a1a1a; font-weight: 700; box-shadow: 0 -2px 0 var(--accent-2) inset, 0 2px 6px rgba(240,181,40,0.25); }
.plan-report-item:hover { background: var(--bg-3); }

/* ── Material Plan: top-level shell (sidebar + scope-shell content) ── */
.plan-shell { display: flex; gap: 1rem; min-height: 60vh; }
.plan-sidebar { flex: 0 0 180px; display: flex; flex-direction: column; gap: 0.15rem; border-right: 1px solid var(--border); padding-right: 0.5rem; }
.plan-scope-btn { padding: 0.55rem 0.85rem; border: none; background: transparent; color: var(--text-2); cursor: pointer; border-radius: 4px; text-align: left; font-size: 0.9rem; font-weight: 500; transition: background 120ms ease, color 120ms ease; }
.plan-scope-btn:hover:not(.active) { background: var(--bg-3); color: var(--text); }
.plan-scope-btn.active { background: var(--accent); color: #1a1a1a; font-weight: 700; box-shadow: 0 1px 4px rgba(240,181,40,0.25); }
.plan-scope-btn[data-stub] { color: var(--text-3); font-style: italic; }
.plan-scope-sep { border: none; border-top: 1px solid var(--border); margin: 0.4rem 0; }
.plan-main { flex: 1 1 auto; min-width: 0; }
.plan-subtabs { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.plan-stub-panel { display: flex; align-items: center; justify-content: center; min-height: 40vh; border: 1px dashed var(--border); border-radius: 6px; background: var(--bg-1); }

/* ── Material Plan: report viewer (Reports → Summary of Materials, etc.) ── */
.plan-report-toolbar { display: flex; gap: 0.5rem; align-items: center; padding: 0.6rem 0.85rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; margin-bottom: 1rem; }
.plan-report-body { background: #ffffff; color: #1a1a1a; padding: 1.25rem 1.5rem; border-radius: 4px; box-shadow: var(--shadow); }
.plan-report-print { font-family: 'DM Sans', -apple-system, sans-serif; color: #1a1a1a; max-width: 8.5in; margin: 0 auto; }
.plan-report-print .report-header { border-bottom: 2px solid #1a3a5c; padding-bottom: 0.6rem; margin-bottom: 1rem; }
.plan-report-print .report-header h1 { font-size: 1.35rem; font-weight: 700; color: #1a3a5c; margin: 0 0 0.4rem 0; }
.plan-report-print .report-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; font-size: 0.85rem; color: #444; }
.plan-report-print .report-warning { background: #fef3c7; border-left: 4px solid #d97706; padding: 0.6rem 0.85rem; margin-bottom: 1rem; border-radius: 0 4px 4px 0; color: #7c2d12; font-size: 0.85rem; }
.plan-report-print .report-warning ul { margin: 0.4rem 0 0.4rem 1.25rem; padding: 0; }
.plan-report-print .report-warning li { margin-bottom: 0.15rem; }
.plan-report-print .report-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.plan-report-print .report-table th { background: #1a3a5c; color: #fff; text-align: left; padding: 0.45rem 0.6rem; font-weight: 600; border: 1px solid #1a3a5c; }
.plan-report-print .report-table td { padding: 0.4rem 0.6rem; border: 1px solid #d4d4d4; vertical-align: top; }
.plan-report-print .report-table tbody tr:nth-child(even) td { background: #f5f7fa; }
.plan-report-print .report-table tfoot td { background: #eef2f7; font-size: 0.95rem; padding: 0.55rem 0.6rem; }
.plan-report-print .report-section-heading { font-size: 1.05rem; font-weight: 700; color: #1a3a5c; margin: 1.5rem 0 0.25rem 0; padding-bottom: 0.25rem; border-bottom: 1px solid #d4d4d4; }
.plan-report-print .report-section-note { font-size: 0.78rem; color: #555; margin: 0 0 0.55rem 0; font-style: italic; }
.plan-report-print .report-footer { font-size: 0.78rem; color: #666; margin-top: 1rem; }

/* Vendor Order — denser layout to fit more rows per page. */
.plan-report-vendor-order .report-header { padding-bottom: 0.4rem; margin-bottom: 0.55rem; }
.plan-report-vendor-order .report-header h1 { font-size: 1.15rem; margin-bottom: 0.2rem; }
.plan-report-vendor-order .report-meta { font-size: 0.78rem; gap: 0.15rem 1.1rem; }
.plan-report-vendor-order .report-section-heading { font-size: 0.92rem; margin: 0.75rem 0 0.15rem 0; padding-bottom: 0.15rem; }
.plan-report-vendor-order .report-section-note { font-size: 0.72rem; margin: 0 0 0.3rem 0; }
.plan-report-vendor-order .report-table { font-size: 0.74rem; margin-top: 0.15rem; }
.plan-report-vendor-order .report-table th { padding: 0.25rem 0.4rem; font-size: 0.7rem; }
.plan-report-vendor-order .report-table td { padding: 0.2rem 0.4rem; }
.plan-report-vendor-order .report-footer { font-size: 0.72rem; margin-top: 0.55rem; }

/* Print mode is activated only when the user clicks Print Report — JS
 * adds `plan-print-mode` to <body>, then removes it on `afterprint`.
 * Strategy: collapse the modal chain to natural flow and `display:none`
 * everything that isn't the report. Avoids the visibility-hidden trick,
 * which left the modal layout occupying space and produced blank /
 * duplicate pages on long reports. */
@media print {
  body.plan-print-mode { background: #fff !important; }
  body.plan-print-mode > *:not(#modal-overlay) { display: none !important; }
  body.plan-print-mode #modal-overlay,
  body.plan-print-mode .modal-overlay,
  body.plan-print-mode .modal-box {
    position: static !important; max-width: none !important;
    width: auto !important; height: auto !important;
    max-height: none !important;
    background: #fff !important; box-shadow: none !important; border: none !important;
    overflow: visible !important; padding: 0 !important; margin: 0 !important;
    transform: none !important;
  }
  body.plan-print-mode .modal-header,
  body.plan-print-mode .modal-footer,
  body.plan-print-mode #plan-main-shell,
  body.plan-print-mode .plan-report-toolbar { display: none !important; }
  body.plan-print-mode .modal-body { padding: 0 !important; overflow: visible !important; }
  body.plan-print-mode #plan-report-view,
  body.plan-print-mode .plan-report-body {
    background: #fff !important; padding: 0 !important; box-shadow: none !important;
    border-radius: 0 !important; display: block !important;
  }
  body.plan-print-mode .plan-report-print {
    color: #1a1a1a !important; max-width: none !important; margin: 0 !important;
    padding: 0.4in !important; box-shadow: none !important;
  }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 500; z-index: 2000; transform: translateY(20px);
  opacity: 0; transition: all 0.3s ease; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }

/* ── Empty state ── */
.empty-state { color: var(--text-3); text-align: center; padding: 2rem 1rem; font-size: 0.9rem; }

/* ── Link ── */
.link { color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ── Estimate line builder ── */
.est-line-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; flex-wrap: wrap; }
.est-line-row select { flex: 1; min-width: 140px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 0.4rem; font-size: 0.82rem; }
.est-line-row input { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 0.4rem; font-size: 0.82rem; }
.est-line-row input[type="text"] { flex: 1; min-width: 100px; }
.est-line-total { font-weight: 600; font-family: var(--mono); font-size: 0.85rem; min-width: 80px; text-align: right; }

/* ── Chart Bars ── */
.chart-bars { display: flex; flex-direction: column; gap: 0.5rem; }
.chart-bar-row { display: flex; align-items: center; gap: 0.6rem; }
.chart-bar-label { width: 100px; font-size: 0.78rem; color: var(--text-2); text-align: right; flex-shrink: 0; }
.chart-bar-bg { flex: 1; height: 18px; background: var(--bg-4); border-radius: 3px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.chart-bar-val { min-width: 70px; font-size: 0.78rem; font-family: var(--mono); color: var(--text-2); }

/* ── Status Grid ── */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.6rem; }
.status-chip {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.75rem; text-align: center; border-left: 3px solid var(--chip-c);
}
.status-count { display: block; font-size: 1.5rem; font-weight: 700; font-family: var(--mono); color: var(--chip-c); }
.status-label { font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── User Cards ── */
.user-cards { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.user-card { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-3); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; color: white; flex-shrink: 0;
}
.user-info { flex: 1; }
.user-name { font-weight: 600; font-size: 0.92rem; }
.user-email { font-size: 0.78rem; color: var(--text-3); }
.user-role { margin-top: 3px; }
.user-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: white; flex-shrink: 0;
}

/* ── Reference page — content search ── */
.ref-mode-toggle { display: inline-flex; border: 1px solid var(--border-2); border-radius: var(--radius-sm); overflow: hidden; }
.ref-mode-toggle button {
  background: transparent; color: var(--text-2); border: none;
  padding: 0.4rem 0.85rem; font-size: 0.82rem; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.ref-mode-toggle button.active { background: var(--accent); color: #1a1a1a; font-weight: 600; }
.ref-mode-toggle button:not(.active):hover { background: var(--bg-3); color: var(--text); }
.ref-content-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-2); padding: 0.75rem 0.95rem; margin-bottom: 0.6rem;
}
.ref-content-card h4 { font-size: 0.92rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text); }
.ref-content-card .ref-doc-meta { font-size: 0.75rem; color: var(--text-3); margin-bottom: 0.5rem; }
.ref-content-hit {
  display: block; padding: 0.45rem 0.6rem; margin-top: 0.3rem;
  border-left: 3px solid var(--border-2); background: var(--bg-3);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
  font-size: 0.85rem; line-height: 1.45;
}
.ref-content-hit:hover { background: var(--bg-4); border-left-color: var(--accent); }
.ref-content-hit .ref-page-tag {
  display: inline-block; background: var(--bg-4); color: var(--text-2);
  padding: 0.1rem 0.45rem; border-radius: 3px; font-size: 0.72rem;
  font-family: var(--mono); margin-right: 0.5rem;
}
mark { background: var(--accent); color: #1a1a1a; padding: 0 2px; border-radius: 2px; }

.ref-ask-form { display: flex; gap: 0.6rem; align-items: flex-start; }
.ref-ask-form textarea {
  flex: 1; min-height: 56px; padding: 0.55rem 0.75rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.92rem; line-height: 1.45; resize: vertical;
}
.ref-ask-form textarea:focus { outline: none; border-color: var(--accent); }
.ref-ask-answer {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem;
  font-size: 0.93rem; line-height: 1.55;
}
.ref-ask-answer h4 { font-size: 1rem; font-weight: 600; margin: 0.8rem 0 0.4rem; color: var(--text); }
.ref-ask-answer h5 { font-size: 0.92rem; font-weight: 600; margin: 0.6rem 0 0.3rem; color: var(--text); }
.ref-ask-answer p  { margin: 0 0 0.65rem; }
.ref-ask-answer ol, .ref-ask-answer ul { margin: 0 0 0.65rem 1.4rem; }
.ref-ask-answer li { margin-bottom: 0.3rem; }
.ref-ask-answer hr { border: 0; border-top: 1px solid var(--border); margin: 0.8rem 0; }
.ref-ask-answer strong { color: var(--text); }
.ref-ask-answer code { font-family: var(--mono); background: var(--bg-3); padding: 0 0.3rem; border-radius: 3px; font-size: 0.85rem; }
.ref-cite {
  display: inline-block; background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 0 0.35rem; font-size: 0.72rem; font-weight: 600;
  margin: 0 1px; cursor: pointer; vertical-align: super; line-height: 1.3;
  text-decoration: none;
}
.ref-cite:hover { background: var(--accent); color: #1a1a1a; }
.ref-ask-source-list { margin-top: 0.9rem; }
.ref-ask-source-list h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 0 0.5rem; }
.ref-ask-source {
  display: flex; gap: 0.6rem; padding: 0.45rem 0.65rem; margin-bottom: 0.3rem;
  background: var(--bg-3); border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
  font-size: 0.83rem; color: var(--text-2); text-decoration: none;
}
.ref-ask-source:hover { background: var(--bg-4); color: var(--text); }
.ref-ask-source.flash { background: var(--accent-bg); border-left: 3px solid var(--accent); }
.ref-ask-source-num {
  font-family: var(--mono); color: var(--accent); font-weight: 600; min-width: 1.8rem;
}
.ref-ask-cost { font-size: 0.74rem; color: var(--text-3); margin-top: 0.5rem; text-align: right; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 7px;
  border: 3px solid var(--bg-2);  /* inset effect — thumb appears narrower than track */
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
::-webkit-scrollbar-corner { background: var(--bg-2); }
/* Firefox */
* { scrollbar-width: auto; scrollbar-color: var(--border-2) var(--bg-2); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .dash-grid, .detail-grid, .report-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .header-actions { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  #main-content { padding: 1rem; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .search-box input { width: 120px; }
}

/* ══════════════════════════════════════════════════════════
   Document Scanning Module Styles
   ══════════════════════════════════════════════════════════ */

/* ── Step indicator ── */
.scan-steps {
  display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid var(--border);
}
.scan-step {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem;
  font-size: 0.85rem; font-weight: 500; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition);
}
.scan-step.active { color: var(--accent); border-bottom-color: var(--accent); }
.scan-step.done { color: var(--green); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; background: var(--bg-4); color: var(--text-3);
}
.scan-step.active .step-num { background: var(--accent); color: var(--bg); }
.scan-step.done .step-num { background: var(--green); color: white; }

.scan-panel { display: none; }
.scan-panel.active { display: block; }

/* ── Upload zone ── */
.upload-zone {
  border: 2px dashed var(--border-2); border-radius: var(--radius); padding: 3rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem; cursor: pointer;
  transition: all 0.2s ease; text-align: center;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: var(--accent-bg);
}
.upload-icon { opacity: 0.7; }
.upload-zone:hover .upload-icon { opacity: 1; }
.upload-text strong { display: block; font-size: 1rem; margin-bottom: 0.25rem; }
.upload-text span { font-size: 0.82rem; color: var(--text-3); }

/* ── File preview ── */
.file-preview {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.file-preview-icon { flex-shrink: 0; }
.file-preview-info { flex: 1; }
.file-preview-info strong { display: block; font-size: 0.9rem; }
.file-preview-info span { font-size: 0.78rem; color: var(--text-3); }

/* ── Scan type buttons ── */
.scan-type-btn {
  padding: 0.4rem 0.85rem; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 500;
  border: 1px solid var(--border-2); background: var(--bg-3); color: var(--text-2);
  cursor: pointer; transition: all var(--transition);
}
.scan-type-btn:hover { border-color: var(--text-3); color: var(--text); }
.scan-type-btn.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }

/* ── Extraction loading ── */
.extraction-loading { text-align: center; padding: 3rem 2rem; }
.extraction-loading h3 { margin-bottom: 0.35rem; }
.extraction-loading p { color: var(--text-2); font-size: 0.88rem; margin-bottom: 2rem; }

.extraction-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border-2); border-top-color: var(--accent);
  border-radius: 50%; margin: 0 auto 1.5rem; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.extraction-steps-detail { display: flex; flex-direction: column; gap: 0.6rem; max-width: 340px; margin: 0 auto; text-align: left; }
.ext-step { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--text-3); }
.ext-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; transition: all 0.3s ease;
}
.ext-dot.pending { background: var(--bg-4); }
.ext-dot.active { background: var(--accent); box-shadow: 0 0 8px rgba(230,168,23,0.5); animation: pulse-dot 1s ease infinite; }
.ext-dot.done { background: var(--green); }
@keyframes pulse-dot { 0%,100%{ opacity:1; } 50%{ opacity:0.4; } }

/* ── Review form ── */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.25rem; margin-bottom: 1rem; }
.review-field { display: flex; flex-direction: column; gap: 0.25rem; }
.review-field label {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-2); display: flex; align-items: center; gap: 0.35rem;
}
.review-field input, .review-field select {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.5rem 0.65rem; font-size: 0.88rem; outline: none;
}
.review-field input:focus, .review-field select:focus { border-color: var(--accent); }
.review-field.needs-review { position: relative; }
.review-field.needs-review::after {
  content: ''; position: absolute; left: -6px; top: 0; bottom: 0; width: 3px;
  background: var(--orange); border-radius: 2px;
}

.review-notes {
  padding: 0.75rem 1rem; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.85rem; color: var(--text-2); margin-top: 0.75rem;
}

/* ── Confidence badges ── */
.conf-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 0.65rem; font-weight: 700;
}
.conf-high { background: rgba(61,189,110,0.15); color: var(--green); }
.conf-medium { background: rgba(230,168,23,0.15); color: var(--accent); }
.conf-low { background: rgba(217,68,82,0.15); color: var(--red); }

/* ── Review line items ── */
.review-line-items { overflow-x: auto; }
.review-line-items table { min-width: 900px; }
.li-input {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 3px;
  color: var(--text); padding: 0.3rem 0.4rem; font-size: 0.82rem; width: 100%;
  outline: none; font-family: inherit;
}
.li-input:focus { border-color: var(--accent); }
.li-input.li-sm { width: 75px; }
.li-input[name^="li_match"] { min-width: 160px; }
.low-conf-row { background: rgba(217,68,82,0.05); }
.med-conf-row { background: rgba(230,168,23,0.04); }
.match-reason { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; font-style: italic; }

.btn-lg { padding: 0.6rem 1.5rem; font-size: 0.92rem; }

/* ── Scan warning (duplicate detection) ── */
.scan-warning {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.85rem 1.1rem; margin-bottom: 1rem;
  background: rgba(217,68,82,0.08); border: 1px solid rgba(217,68,82,0.25);
  border-radius: var(--radius-sm); color: var(--red); font-size: 0.88rem;
}
.scan-warning svg { flex-shrink: 0; }

/* ── Scan detail — price updates ── */
.price-updates-summary { display: flex; flex-direction: column; gap: 0; }
.price-update-row {
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}
.price-update-row:last-child { border-bottom: none; }
.price-update-item { font-weight: 600; font-size: 0.88rem; margin-bottom: 2px; }
.price-update-detail { font-size: 0.78rem; color: var(--text-2); display: flex; gap: 1rem; }
.price-update-detail .unmatched { color: var(--accent); }

@media (max-width: 900px) {
  .review-grid { grid-template-columns: 1fr; }
  .scan-steps { flex-wrap: wrap; }
}

/* ── Vendor code tags ── */
.vendor-code-tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 0.72rem;
  font-family: var(--mono); font-weight: 500; background: var(--bg-4); color: var(--accent);
  border: 1px solid var(--border); margin-right: 3px; cursor: help;
}

/* ── Color tier badges ── */
.tier-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 0.65rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-left: 4px;
}
.tier-premium { background: rgba(74,144,217,0.15); color: var(--blue); }
.tier-deluxe { background: rgba(230,168,23,0.15); color: var(--accent); }

/* ── Additional review input widths ── */
.li-code { width: 100px !important; font-family: var(--mono); font-size: 0.78rem !important; }
.li-md { width: 110px !important; }
.li-xs { width: 55px !important; }

/* ── Item code conflict warnings ── */
.scan-warning-amber {
  background: rgba(230,168,23,0.08); border-color: rgba(230,168,23,0.25); color: var(--accent);
}
.scan-warning-amber strong { color: var(--accent); }
.conflict-list { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.conflict-item {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.4rem 0.6rem;
  background: rgba(0,0,0,0.15); border-radius: var(--radius-sm); font-size: 0.82rem;
}
.conflict-code {
  font-family: var(--mono); font-weight: 700; color: var(--accent); white-space: nowrap;
  padding: 1px 6px; background: rgba(230,168,23,0.12); border-radius: 3px; flex-shrink: 0;
}
.conflict-compare { flex: 1; }
.conflict-label { font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.conflict-existing { color: var(--text-2); }
.conflict-new { color: var(--text); margin-top: 2px; }

/* ── Per-vendor price table inside a materials-catalog cell ──
   A small real <table> — Vendor · Price · Date — so the prices line
   up in their own monospace, right-aligned column. The source doc
   type (Invoice / Quote / Credit Memo / Delivery Ticket / Order Ack)
   lives in the price cell's hover tooltip so it never disturbs the
   layout. One row per vendor, sorted cheapest-first; cheapest row
   highlighted. */
.vp-table { border-collapse: collapse; font-size: 0.8rem; }
.vp-table th {
  font-size: 0.66rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--text-3); text-align: left;
  padding: 0 0.6rem 1px 0; border-bottom: 1px solid var(--border);
}
/* Price (col 2) and Date (col 3) right-align under their headers. */
.vp-table th:nth-child(2), .vp-table th:nth-child(3) { text-align: right; }
.vp-table td { padding: 1px 0.6rem 1px 0; vertical-align: baseline; white-space: nowrap; }
.vp-table td:last-child, .vp-table th:last-child { padding-right: 0; }
.vp-vendor { color: var(--text-3); }
.vp-price  { font-family: var(--mono); text-align: right; }
.vp-date   { font-size: 0.72rem; color: var(--text-3); text-align: right; }
.vp-table tr.vp-best > td { color: var(--green); font-weight: 600; }

/* ── Credit memo info banner ── */
.scan-warning-blue {
  background: rgba(74,144,217,0.08); border-color: rgba(74,144,217,0.25); color: var(--blue);
}
.scan-warning-blue strong { color: var(--blue); }

/* ── Check scanning upload zones ── */
.check-upload-zone {
  border: 2px dashed var(--border-2); border-radius: var(--radius-sm); padding: 1rem;
  text-align: center; cursor: pointer; transition: all 0.2s ease;
}
.check-upload-zone:hover, .check-upload-zone.drag-over { border-color: var(--accent); background: var(--accent-bg); }
.check-upload-zone.has-file { border-color: var(--green); border-style: solid; background: rgba(61,189,110,0.05); }
.check-upload-label { font-size: 0.85rem; color: var(--text-2); }
.check-upload-zone.has-file .check-upload-label { color: var(--green); font-weight: 500; }

/* ══════════════════════════════════════════════════════════
   Vendor Report Styles
   ══════════════════════════════════════════════════════════ */
.vendor-report-controls {
  display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap;
}
.vendor-report-controls .form-group { min-width: 120px; }
.vendor-report-controls label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 3px; display: block;
}
.vendor-report-controls select, .vendor-report-controls input {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 0.4rem 0.55rem; font-size: 0.85rem; width: 100%;
}

/* ── Expandable invoice rows ── */
.vr-invoice-rows { display: flex; flex-direction: column; }
.vr-invoice-row { border-bottom: 1px solid var(--border); }
.vr-invoice-row:last-child { border-bottom: none; }

.vr-invoice-header {
  display: flex; align-items: center; gap: 0.65rem; padding: 0.65rem 0.5rem;
  cursor: pointer; transition: background var(--transition);
}
.vr-invoice-header:hover { background: var(--bg-3); }

.vr-expand-icon {
  flex-shrink: 0; transition: transform 0.2s ease; display: flex; color: var(--text-3);
}
.vr-expand-icon.expanded { transform: rotate(90deg); }

.vr-inv-date { width: 100px; font-size: 0.82rem; color: var(--text-2); flex-shrink: 0; }
.vr-inv-type { width: 95px; flex-shrink: 0; }
.vr-inv-vendor { flex: 1; font-size: 0.85rem; min-width: 120px; }
.vr-inv-number { width: 175px; font-size: 0.85rem; font-family: var(--mono); flex-shrink: 0; }
.vr-inv-items { width: 65px; font-size: 0.78rem; color: var(--text-3); flex-shrink: 0; text-align: center; }
.vr-inv-amount { width: 100px; text-align: right; font-family: var(--mono); font-size: 0.88rem; flex-shrink: 0; }
.vr-inv-mode { width: 70px; flex-shrink: 0; text-align: right; }

/* ── Expanded detail panel ── */
.vr-invoice-detail {
  padding: 0.75rem 0.75rem 1rem 2.25rem; /* indent past the expand icon */
  background: var(--bg-3); border-top: 1px solid var(--border);
  animation: vr-slide-in 0.15s ease;
}
@keyframes vr-slide-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.vr-detail-summary {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.4rem 1.5rem;
  margin-bottom: 0.5rem;
}
.vr-detail-field { display: flex; flex-direction: column; padding: 0.3rem 0; }
.vr-detail-field.vr-detail-full { grid-column: 1 / -1; }
.vr-detail-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3); font-weight: 600; margin-bottom: 1px;
}

/* ── Inline financials row (Subtotal + Tax = Total) ── */
.vr-financials-row {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  font-size: 0.88rem;
}
.vr-fin-sep {
  color: var(--text-3); font-size: 0.78rem; font-weight: 400;
}

@media (max-width: 900px) {
  .vendor-report-controls { flex-direction: column; }
  .vr-invoice-header { flex-wrap: wrap; }
  .vr-inv-vendor { min-width: 100%; }
  .vr-detail-summary { grid-template-columns: 1fr; }
}
