/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === LIGHT THEME (default) === */
:root {
  --primary: #005288;
  --primary-light: #1a6da8;
  --primary-dark: #002E66;
  --accent: #dcae39;
  --accent-hover: #c99d2e;
  --orange: #e67a27;
  --orange-hover: #d46b1a;
  --light-blue: #4bb6e8;
  --bg: #f7f8fb;
  --bg-card: #ffffff;
  --bg-hover: #f2f4f8;
  --bg-active: #eaeff5;
  --text: #253142;
  --text-secondary: #7b8a9d;
  --text-muted: #a0aab5;
  --border: #e0e5ec;
  --border-light: #f0f3f7;
  --div-bar: #2c6285;
  --div-bar-hover: #367090;
  --div-bar-plans: #c06a22;
  --div-bar-plans-hover: #b86c28;
  --div-bar-markups: #3d5260;
  --success: #1a8a5e;
  --warning: #c0780a;
  --danger: #c23030;
  --shadow-sm: 0 1px 2px rgba(0,20,50,0.05);
  --shadow: 0 1px 3px rgba(0,20,50,0.08), 0 1px 2px rgba(0,20,50,0.04);
  --shadow-md: 0 2px 6px rgba(0,20,50,0.1), 0 1px 3px rgba(0,20,50,0.06);
  --shadow-lg: 0 4px 12px rgba(0,20,50,0.1);
  --radius: 6px;
  --radius-lg: 10px;
  --font: 'Inter', -apple-system, sans-serif;
  --font-body: 'Ubuntu', 'Inter', -apple-system, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --header-bg: #002E66;
  --header-border: #dcae39;
  --input-bg: #f7f9fc;
  --input-focus-bg: #ffffff;
  --input-border: var(--border);
  --mark-bg: #fef3cd;
  --mark-color: #856404;
}

/* === DARK THEME === */
[data-theme="dark"] {
  --bg: #1a2332;
  --bg-card: #253142;
  --bg-hover: #33404D;
  --bg-active: #3d4d5e;
  --text: #d4dde8;
  --text-secondary: #8a97a8;
  --text-muted: #5c7088;
  --border: #33404D;
  --border-light: #2d3a4a;
  --div-bar: #1a3050;
  --div-bar-hover: #224060;
  --div-bar-plans: #8a5520;
  --div-bar-plans-hover: #a06028;
  --div-bar-markups: #1a2e3e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.25);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  --header-bg: #0f1a28;
  --header-border: #b8952f;
  --input-bg: #1a2d40;
  --input-focus-bg: #1e3448;
  --input-border: #33404D;
  --success: #2eac75;
  --primary: #4a90c0;
  --primary-light: #4a9ed4;
  --primary-dark: #80b8dc;
  --accent: #dcae39;
  --orange: #E67A27;
  --mark-bg: #4a3d1a;
  --mark-color: #f0d060;
}

html { font-size: 14px; }
body {
  font-family: var(--font-body); background: var(--bg);
  color: var(--text); min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* === HEADER === */
#app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px;
  background: var(--header-bg); color: #fff;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-bottom: 3px solid var(--header-border);
}
.header-left { display: flex; align-items: center; }
.logo { display: flex; align-items: center; }
.logo-img { height: 38px; width: auto; }
.header-center { display: flex; }
#main-nav { display: flex; gap: 2px; background: rgba(255,255,255,0.08); border-radius: var(--radius); padding: 3px; }
.nav-btn {
  background: transparent; border: none; color: rgba(255,255,255,0.65);
  padding: 6px 20px; border-radius: 4px; cursor: pointer;
  font-weight: 500; font-size: 0.875rem; transition: all 0.15s;
  font-family: var(--font);
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-btn.active { color: #fff; background: var(--orange); font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-action {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85); padding: 6px 14px; border-radius: var(--radius);
  cursor: pointer; font-size: 0.8125rem; font-weight: 500; transition: all 0.15s;
  font-family: var(--font);
}
.header-action:hover { background: rgba(255,255,255,0.16); color: #fff; }
.header-action.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.header-action.primary:hover { background: var(--orange-hover); }

/* Export dropdown */
.export-dropdown { position: relative; }
.export-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 200px; z-index: 150;
}
.export-dropdown.open .export-menu { display: block; }
.export-option {
  display: block; width: 100%; padding: 10px 16px; border: none;
  background: transparent; color: var(--text); font-size: 0.875rem;
  text-align: left; cursor: pointer; font-family: var(--font);
  transition: background 0.1s;
}
.export-option:hover { background: var(--bg-hover); }
.export-option:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.export-option:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* === PROJECT BAR === */
#project-bar {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 12px 24px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: none; transition: background 0.3s;
  flex-wrap: wrap;
}
.project-field { display: flex; flex-direction: column; gap: 4px; }
.project-field:first-child { flex: 1; min-width: 200px; }
.project-field.small { width: 140px; }
.project-field label {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary); font-family: var(--font);
}
.project-field input, .project-field select {
  padding: 7px 10px; border: 1px solid var(--input-border); border-radius: var(--radius);
  font-size: 0.875rem; font-family: var(--font); background: var(--input-bg);
  color: var(--text); transition: border-color 0.15s, background 0.3s;
}
.project-field input:focus, .project-field select:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(0,82,136,0.1); background: var(--input-focus-bg);
}
.project-totals { display: flex; gap: 16px; margin-left: auto; padding: 0; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.total-item { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.total-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); font-family: var(--font); }
.total-value { font-size: 1.125rem; font-weight: 700; font-family: var(--mono); color: var(--text); }
.total-item.highlight .total-value { color: var(--primary-dark); font-size: 1.25rem; }

/* === MAIN === */
#app-main { padding: 0; }
.view { display: none; padding: 24px 32px; }
.view.active { display: block; max-width: 1600px; margin: 0 auto; }

/* === TOOLBAR === */
.estimate-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.toolbar-left { display: flex; gap: 8px; align-items: center; }
.toolbar-divider { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tool-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  font-size: 0.8125rem; font-weight: 500; transition: all 0.15s; font-family: var(--font);
}
.tool-btn:hover:not(:disabled) { border-color: var(--primary-light); color: var(--primary); background: var(--bg-hover); }
.tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tool-btn:disabled { opacity: 0.4; cursor: default; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); min-width: 260px; transition: background 0.3s;
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { border: none; outline: none; background: transparent; font-size: 0.875rem; width: 100%; color: var(--text); }

/* Loading indicator */
.loading-indicator {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 1rem; font-style: italic;
}

/* Search highlight */
mark {
  background: var(--mark-bg); color: var(--mark-color);
  padding: 1px 3px; border-radius: 2px;
}

/* === DIVISION SECTIONS === */
.division-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
  box-shadow: none; overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}
.division-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; cursor: pointer; user-select: none;
  background: var(--div-bar); color: rgba(255,255,255,0.88);
  transition: background 0.15s;
}
.division-header:hover { background: var(--div-bar-hover); }
.division-header.markups-header { background: var(--div-bar-markups); }
.division-header.markups-header:hover { background: var(--div-bar-hover); }
.division-header-left { display: flex; align-items: center; gap: 8px; }
.division-chevron { transition: transform 0.2s; font-size: 0.65rem; opacity: 0.5; }
.division-section.open .division-chevron { transform: rotate(90deg); opacity: 0.7; }
.division-number {
  font-weight: 600; font-size: 0.65rem; background: rgba(255,255,255,0.1);
  padding: 2px 7px; border-radius: 3px; font-family: var(--font); letter-spacing: 0.02em;
}
.division-name { font-weight: 500; font-size: 0.8125rem; font-family: var(--font); letter-spacing: 0.01em; }
.division-indicators { display: flex; gap: 6px; margin-right: 12px; }
.div-badge { font-size: 0.6875rem; padding: 1px 6px; border-radius: 3px; font-weight: 600; display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.div-badge-note { background: rgba(0,82,136,0.15); color: var(--primary); }
.div-badge-nic { background: rgba(245,158,11,0.15); color: #F59E0B; }
.div-badge-sub { background: rgba(16,185,129,0.15); color: #10B981; }
.division-total { font-family: var(--mono); font-weight: 600; font-size: 0.875rem; opacity: 0.5; }
.division-total.has-value { color: #fff; opacity: 0.95; }
.division-body { display: none; }
.division-section.open .division-body { display: block; }

/* === LINE ITEMS TABLE === */
.items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.items-table th {
  padding: 8px 10px; font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary);
  background: var(--bg); border-bottom: 2px solid var(--border);
  text-align: left; position: sticky; top: 0; font-family: var(--font);
  transition: background 0.3s;
}
.items-table th:nth-child(n+3) { text-align: right; }
.items-table th.col-code, .items-table td.col-code { width: 6%; }
.items-table th.col-item, .items-table td.col-item { width: 26%; }
.items-table th.col-qty, .items-table td.col-qty { width: 7%; }
.items-table th.col-unit, .items-table td.col-unit { width: 5%; }
.items-table th.col-price, .items-table td.col-price { width: 10%; }
.items-table th.col-sub, .items-table td.col-sub { width: 10%; }
.items-table th.col-est, .items-table td.col-est { width: 10%; text-align: right; }
.items-table th.col-ext, .items-table td.col-ext { width: 10%; }
.items-table th.col-nic, .items-table td.col-nic { width: 3%; text-align: center !important; }
.items-table th.col-note, .items-table td.col-note { width: 3%; text-align: center !important; }

.item-row { transition: background 0.1s; }
.item-row:hover { background: var(--bg-hover); }
.item-row td { padding: 5px 10px; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; }
.item-row td:nth-child(n+3) { text-align: right; }
.item-row.section-header { background: var(--bg-active); }
.item-row.section-header td { font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.item-row.section-header td:first-child { color: var(--primary); }
.item-row.indent-1 td.col-item { padding-left: 28px; }
.item-row.indent-2 td.col-item { padding-left: 44px; }
.item-row.has-value { background: rgba(26,138,94,0.04); }
[data-theme="dark"] .item-row.has-value { background: rgba(46,172,117,0.06); }
.item-row.has-value td:first-child { border-left: 2px solid var(--success); }

.item-row td.col-code { color: var(--text-muted); font-family: var(--mono); font-size: 0.8125rem; }
.item-row td.col-ext, .item-row td.col-sub { font-family: var(--mono); font-weight: 500; }
.section-header td.col-ext { color: var(--primary); font-weight: 700; }

.item-row input {
  width: 100%; padding: 4px 6px; border: 1px solid transparent; border-radius: 3px;
  text-align: right; font-size: 0.875rem; font-family: var(--mono);
  background: transparent; color: var(--text); transition: all 0.15s;
}
.item-row input:hover { border-color: var(--border); background: var(--input-bg); }
.item-row input:focus { border-color: var(--primary-light); background: var(--input-focus-bg); outline: none; box-shadow: 0 0 0 2px rgba(0,82,136,0.12); }
.item-row input.has-value { color: var(--success); font-weight: 600; }

/* === PLANS & PERMITS SPECIAL SECTIONS === */
.pre-division-section { margin-bottom: 12px; }
.pre-division-section .division-header { background: var(--div-bar-plans); }
.pre-division-section .division-header:hover { background: var(--div-bar-plans-hover); }
.pre-division-section .division-total.has-value { color: #fff; }

/* === SUMMARY VIEW === */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.summary-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
  transition: background 0.3s, border-color 0.3s;
}
.summary-card.full-width { grid-column: 1 / -1; }
.summary-card h3 {
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px; border-bottom: 3px solid var(--accent);
  padding-bottom: 8px; font-family: var(--font);
}
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.summary-table td:first-child { font-weight: 500; }
.summary-table td:last-child { text-align: right; font-family: var(--mono); font-weight: 600; }
.summary-table tr.subtotal td { border-top: 2px solid var(--border); font-weight: 700; background: var(--bg); }
.summary-table tr.grand-total td { border-top: 3px double var(--primary); font-weight: 700; font-size: 1.125rem; color: var(--primary); background: var(--bg-active); }
.summary-table tr.markup td { color: var(--text-secondary); font-style: italic; }
.summary-table tr.markup td:last-child { font-style: normal; }
.summary-table .pct { color: var(--text-muted); font-size: 0.8125rem; margin-left: 8px; }

.markup-input {
  width: 70px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 3px;
  text-align: right; font-size: 0.875rem; font-family: var(--mono);
  background: var(--input-bg); color: var(--text);
}
.markup-input:focus { outline: none; border-color: var(--primary-light); }

.chart-bar-container { margin: 4px 0; }
.chart-bar-label { display: flex; justify-content: space-between; font-size: 0.8125rem; margin-bottom: 2px; }
.chart-bar-label span:last-child { font-family: var(--mono); font-weight: 600; }
.chart-bar { height: 20px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: var(--div-bar); border-radius: 3px; transition: width 0.3s ease; min-width: 2px; }

/* === BILLING VIEW === */
.billing-toolbar { display: flex; gap: 8px; margin-bottom: 16px; }
.billing-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.billing-table th {
  padding: 10px 12px; background: var(--div-bar); color: rgba(255,255,255,0.9);
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  font-family: var(--font); white-space: nowrap;
}
.billing-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); font-size: 0.8125rem; }
.billing-table td:nth-child(n+3) { text-align: right; font-family: var(--mono); }
.billing-table tr.billing-division td { background: var(--bg-active); font-weight: 600; }
.billing-table tr.billing-total td { background: var(--bg); font-weight: 700; border-top: 2px solid var(--border); }
.billing-table tr.billing-grand td { background: var(--bg-active); font-weight: 700; font-size: 0.9375rem; border-top: 3px double var(--primary); }
.billing-table input {
  width: 80px; padding: 3px 6px; border: 1px solid var(--input-border); border-radius: 3px;
  text-align: right; font-size: 0.75rem; font-family: var(--mono);
  background: var(--input-bg); color: var(--text);
}

/* Change order form */
.co-form {
  display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px;
}
.co-form .field { display: flex; flex-direction: column; gap: 3px; }
.co-form .field label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); font-family: var(--font); }
.co-form .field input, .co-form .field select {
  padding: 6px 8px; border: 1px solid var(--input-border); border-radius: 3px;
  font-size: 0.8125rem; background: var(--input-bg); color: var(--text);
}
.co-form .field.desc { flex: 1; }
.co-form .field.amount input { width: 100px; text-align: right; font-family: var(--mono); }

/* === MODALS === */
.modal {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center;
}
[data-theme="dark"] .modal { background: rgba(0,0,0,0.7); }
.modal.open { display: flex; }
.modal-content {
  background: var(--bg-card); border-radius: var(--radius-lg);
  width: 90%; max-width: 520px; box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease; border: 1px solid var(--border);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.125rem; font-weight: 700; font-family: var(--font); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.modal-body { padding: 20px; }

.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary-light); background: var(--bg-hover); }
.drop-zone svg { color: var(--text-muted); margin-bottom: 12px; }
.drop-zone p { color: var(--text-secondary); margin-bottom: 4px; }
.drop-hint { font-size: 0.8125rem; color: var(--text-muted) !important; }
.btn-primary {
  background: var(--orange); color: #fff; border: none; padding: 8px 20px;
  border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 0.875rem;
  margin-top: 12px; transition: background 0.15s; font-family: var(--font);
}
.btn-primary:hover { background: var(--orange-hover); }
.btn-secondary {
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  padding: 8px 20px; border-radius: var(--radius); cursor: pointer;
  font-weight: 500; font-size: 0.875rem; transition: all 0.15s; font-family: var(--font);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--primary-light); }
.import-status { padding: 12px; border-radius: var(--radius); margin-top: 16px; font-size: 0.875rem; }
.import-status.success { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }
.import-status.error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
[data-theme="dark"] .import-status.success { background: rgba(46,172,117,0.1); border-color: rgba(46,172,117,0.3); }
[data-theme="dark"] .import-status.error { background: rgba(194,48,48,0.1); border-color: rgba(194,48,48,0.3); }

/* File Upload Status List */
.file-progress-summary {
  padding: 10px 12px; margin-top: 12px; font-size: 0.8125rem; font-weight: 600;
  color: var(--text-secondary); border-bottom: 1px solid var(--border);
}
.file-status-list {
  margin-top: 8px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.file-status-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
}
.file-status-item:last-child { border-bottom: none; }
.file-status-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-weight: 500; color: var(--text);
}
.file-status-size { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; font-family: var(--mono); }
.file-status-icon { width: 20px; text-align: center; flex-shrink: 0; }
.file-status-icon .spinner {
  width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.6s linear infinite; display: inline-block;
}
.file-status-icon .check { color: var(--success); font-weight: 700; }
.file-status-icon .fail { color: var(--danger); font-weight: 700; }
.file-status-error {
  font-size: 0.75rem; color: var(--danger); cursor: pointer;
  text-decoration: underline; text-decoration-style: dotted;
}
.file-status-error:hover { text-decoration-style: solid; }
.file-retry-container { margin-top: 12px; text-align: center; }
.btn-retry-failed {
  background: var(--danger); color: #fff; border: none; padding: 8px 20px;
  border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 0.8125rem;
  transition: background 0.15s; font-family: var(--font);
}
.btn-retry-failed:hover { opacity: 0.9; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }

/* Save/Load */
.save-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.save-actions input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--input-border);
  border-radius: var(--radius); font-size: 0.875rem;
  background: var(--input-bg); color: var(--text);
}
.saved-list { max-height: 300px; overflow-y: auto; }
.saved-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background 0.1s;
}
.saved-item:hover { background: var(--bg-hover); }
.saved-item-info { display: flex; flex-direction: column; }
.saved-item-name { font-weight: 600; }
.saved-item-date { font-size: 0.75rem; color: var(--text-muted); }
.saved-item-total { font-family: var(--mono); font-weight: 600; color: var(--primary); }
.saved-item-actions { display: flex; gap: 6px; }
.saved-item-actions button {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px;
  background: transparent; cursor: pointer; font-size: 0.75rem; color: var(--text);
}
.saved-item-actions .btn-delete { color: var(--danger); border-color: var(--danger); }
.saved-item-actions .btn-delete:hover { background: var(--danger); color: #fff; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  #project-bar { flex-wrap: wrap; }
  .project-totals { width: 100%; justify-content: space-between; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); margin-left: 0; }
  .summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #app-header { padding: 0 12px; }
  .logo-img { height: 28px; }
  .header-action span { display: none; }
  .view { padding: 12px; }
  .estimate-toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left { flex-wrap: wrap; }
  .search-box { min-width: auto; }
  .items-table { font-size: 0.75rem; }
  .items-table th, .items-table td { padding: 4px 6px; }
  .items-table th.col-sub, .items-table td.col-sub { display: none; }
  .billing-table { font-size: 0.75rem; }
  .co-form { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .items-table th.col-code, .items-table td.col-code { display: none; }
  .items-table th.col-unit, .items-table td.col-unit { display: none; }
}

/* === NOTES === */
.col-note { text-align: center !important; }
.note-btn {
  background: transparent; border: none; cursor: pointer; opacity: 0.3;
  color: var(--text-muted); padding: 2px; transition: all 0.15s;
}
.note-btn:hover { opacity: 0.7; color: var(--primary); }
.note-btn.has-note { opacity: 1; color: var(--orange); }
.note-row td { padding: 2px 10px 6px !important; border-bottom: 1px solid var(--border) !important; }
.note-input {
  width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 3px;
  font-size: 0.8125rem; font-family: var(--font); color: var(--text);
  background: var(--input-bg); font-style: italic;
}
.note-input:focus { border-color: var(--primary-light); outline: none; background: var(--input-focus-bg); }

/* === SECTION ESTIMATE INPUT === */
.section-est-input {
  width: 90px; padding: 3px 6px; border: 1px solid transparent; border-radius: 3px;
  text-align: right; font-size: 0.875rem; font-family: var(--mono);
  background: transparent; color: var(--accent); font-weight: 600; transition: all 0.15s;
}
.section-est-input:hover { border-color: var(--border); background: var(--input-bg); }
.section-est-input:focus { border-color: var(--primary-light); background: var(--input-focus-bg); outline: none; }
.col-est { text-align: right; }

/* === QUOTE HINT === */
.quote-hint {
  font-size: 0.7rem; background: rgba(255,255,255,0.15);
  padding: 1px 6px; border-radius: 3px; margin-left: 8px;
  opacity: 0.7; font-weight: 400;
}

/* === MODAL (generic for quotes/codes) === */
.modal-lg .modal-content { max-width: 720px; }
.modal-body-scroll { max-height: 60vh; overflow-y: auto; }
.modal-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px; background: var(--bg-hover); border-radius: var(--radius); border: 1px solid var(--border); }
.modal-form .field { display: flex; flex-direction: column; gap: 3px; }
.modal-form .field label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; color: var(--text-secondary); }
.modal-form .field input, .modal-form .field select, .modal-form .field textarea {
  padding: 6px 8px; border: 1px solid var(--input-border); border-radius: 3px;
  font-size: 0.8125rem; background: var(--input-bg); color: var(--text); font-family: var(--font);
}
.modal-form .field.grow { flex: 1; min-width: 150px; }
.modal-form .field.amount input { text-align: right; font-family: var(--mono); width: 100px; }

.quote-item, .code-item {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px; border-bottom: 1px solid var(--border-light); gap: 12px;
}
.quote-item:hover, .code-item:hover { background: var(--bg-hover); }
.quote-item-info, .code-item-info { flex: 1; }
.quote-item-vendor { font-weight: 600; }
.quote-item-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.quote-item-amount { font-family: var(--mono); font-weight: 700; color: var(--primary); white-space: nowrap; }
.code-item-req { font-weight: 500; }
.code-item-ref { font-size: 0.75rem; color: var(--text-muted); font-family: var(--mono); margin-top: 2px; }
.code-item-jurisdiction { font-size: 0.6875rem; background: var(--bg-active); padding: 1px 6px; border-radius: 3px; }
.code-type-badge { font-size: 0.6875rem; background: var(--primary); color: #fff; padding: 1px 6px; border-radius: 3px; text-transform: uppercase; }
.modal-search { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-search input { flex: 1; padding: 8px 12px; border: 1px solid var(--input-border); border-radius: var(--radius); font-size: 0.875rem; background: var(--input-bg); color: var(--text); }
.modal-search select { padding: 8px; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--input-bg); color: var(--text); }
.modal-empty { text-align: center; padding: 30px; color: var(--text-muted); font-style: italic; }
.btn-delete-sm { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 3px 8px; border-radius: 3px; cursor: pointer; font-size: 0.7rem; }
.btn-delete-sm:hover { background: var(--danger); color: #fff; }

/* === VERSION COMPARISON === */
.version-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.version-toolbar select { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--input-bg); color: var(--text); font-family: var(--font); }
.version-summary { padding: 12px 16px; background: var(--bg-active); border-radius: var(--radius); margin-bottom: 16px; font-weight: 600; }
.version-summary .diff-positive { color: var(--danger); }
.version-summary .diff-negative { color: var(--success); }
.diff-table { width: 100%; border-collapse: collapse; }
.diff-table th { padding: 8px 10px; background: var(--bg); border-bottom: 2px solid var(--border); font-size: 0.75rem; text-transform: uppercase; font-family: var(--font); text-align: left; }
.diff-table th:nth-child(n+3) { text-align: right; }
.diff-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.diff-table td:nth-child(n+3) { text-align: right; font-family: var(--mono); }
.diff-added { background: rgba(26,138,94,0.08); }
.diff-added td:first-child { border-left: 3px solid var(--success); }
.diff-removed { background: rgba(194,48,48,0.08); }
.diff-removed td:first-child { border-left: 3px solid var(--danger); }
.diff-changed { background: rgba(220,174,57,0.08); }
.diff-changed td:first-child { border-left: 3px solid var(--accent); }

/* === QUOTE POPOVER === */
.quote-popover {
  position: absolute; z-index: 150; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 12px; min-width: 280px; max-width: 360px;
}
.quote-popover-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-light); gap: 8px; }
.quote-popover-item:last-child { border-bottom: none; }
.quote-popover-vendor { font-weight: 600; font-size: 0.8125rem; }
.quote-popover-amount { font-family: var(--mono); font-weight: 700; color: var(--primary); }
.quote-popover-date { font-size: 0.7rem; color: var(--text-muted); }
.btn-use-quote { padding: 3px 8px; background: var(--orange); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: 0.7rem; font-weight: 600; }
.btn-use-quote:hover { background: var(--orange-hover); }

/* === SHORTCUTS MODAL === */
.shortcuts-table { width: 100%; border-collapse: collapse; }
.shortcuts-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.shortcuts-table td:first-child { font-family: var(--mono); font-weight: 600; color: var(--primary); white-space: nowrap; width: 40%; }

/* === PDF EXTRACTION REVIEW === */
.extraction-review { padding: 0; }
.extraction-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 16px; box-shadow: var(--shadow);
}
.extraction-vendor { font-size: 1.125rem; font-weight: 700; }
.extraction-file { font-size: 0.8125rem; color: var(--text-muted); margin-left: 8px; }
.extraction-total { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.confidence-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 3px 10px;
  border-radius: 12px; margin-left: 12px;
}
.conf-high { background: rgba(26,138,94,0.15); color: var(--success); }
.conf-medium { background: rgba(220,174,57,0.15); color: #8a6d15; }
.conf-low { background: rgba(194,48,48,0.15); color: var(--danger); }
.extraction-exclusions {
  padding: 12px 16px; background: rgba(220,174,57,0.1); border: 1px solid rgba(220,174,57,0.3);
  border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem;
}
.extraction-exclusions strong { display: block; margin-bottom: 4px; color: var(--warning); }
.extraction-exclusions ul { margin: 0; padding-left: 20px; color: var(--text-secondary); }
.extraction-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
.extraction-table th {
  padding: 10px 12px; background: var(--div-bar); color: rgba(255,255,255,0.9);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; font-family: var(--font);
  text-align: left;
}
.extraction-table th:nth-child(n+3) { text-align: right; }
.extraction-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.extraction-table td:nth-child(n+3) { text-align: right; font-family: var(--mono); }
.extraction-table select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 3px; font-size: 0.8125rem; background: var(--input-bg); color: var(--text); }
.mapping-unmatched { background: rgba(194,48,48,0.06); }
.mapping-unmatched td:first-child { border-left: 3px solid var(--danger); }
.mapping-section { background: rgba(220,174,57,0.06); }
.mapping-removed { opacity: 0.3; text-decoration: line-through; }
.extraction-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.extraction-actions-left { font-size: 0.875rem; color: var(--text-secondary); }
.extraction-actions-right { display: flex; gap: 8px; }
.option-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.option-tab {
  padding: 6px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
  font-size: 0.8125rem; font-weight: 500; transition: all 0.15s;
}
.option-tab:hover { border-color: var(--primary-light); color: var(--primary); }
.option-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-remove-mapping {
  padding: 2px 8px; background: transparent; border: 1px solid var(--danger);
  color: var(--danger); border-radius: 3px; cursor: pointer; font-size: 0.7rem;
}
.btn-remove-mapping:hover { background: var(--danger); color: #fff; }

/* === DETAIL ROW (labor/material/trade) === */
.detail-row td { padding: 4px 10px 8px !important; border-bottom: 1px solid var(--border) !important; background: var(--bg-hover); }
.detail-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 4px 0;
}
.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-field label { font-size: 0.6rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); font-family: var(--font); }
.detail-field input, .detail-field select {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 3px;
  font-size: 0.8rem; background: var(--input-bg); color: var(--text); font-family: var(--mono);
}
.detail-field select { font-family: var(--font); }
.detail-btn {
  background: transparent; border: none; cursor: pointer; opacity: 0.25;
  color: var(--text-muted); padding: 2px; font-size: 0.7rem; transition: opacity 0.15s;
}
.detail-btn:hover { opacity: 0.7; }
.detail-btn.has-detail { opacity: 0.8; color: var(--primary); }

/* === VARIANCE / BASELINE === */
.variance-card { border-left: 4px solid var(--accent); }
.variance-positive { color: var(--danger); }
.variance-negative { color: var(--success); }
.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.progress-fill.over-budget { background: var(--danger); }

/* === TRADE SUMMARY === */
.trade-table { width: 100%; border-collapse: collapse; }
.trade-table th { padding: 6px 10px; font-size: 0.7rem; text-transform: uppercase; background: var(--bg); border-bottom: 2px solid var(--border); text-align: left; font-family: var(--font); }
.trade-table th:nth-child(n+3) { text-align: right; }
.trade-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); font-size: 0.8125rem; }
.trade-table td:nth-child(n+3) { text-align: right; font-family: var(--mono); }
.trade-status { font-size: 0.6875rem; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.trade-quoted { background: rgba(220,174,57,0.15); color: #8a6d15; }
.trade-awarded { background: rgba(75,182,232,0.15); color: #1a6fa0; }
.trade-inprogress { background: rgba(230,122,39,0.15); color: #a0541a; }
.trade-complete { background: rgba(26,138,94,0.15); color: #0f6b42; }

/* === CONFLICT WARNING === */
.conflict-banner {
  padding: 12px 16px; background: rgba(220,174,57,0.1); border: 1px solid rgba(220,174,57,0.3);
  border-radius: var(--radius); margin-bottom: 16px; font-size: 0.875rem;
}
.conflict-banner strong { color: var(--warning); }
.conflict-item { padding: 4px 0; font-size: 0.8125rem; }

/* === RETAINAGE SCHEDULE === */
.retainage-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.retainage-table th { padding: 8px 10px; background: var(--bg); font-size: 0.7rem; text-transform: uppercase; border-bottom: 2px solid var(--border); text-align: right; font-family: var(--font); }
.retainage-table th:first-child { text-align: left; }
.retainage-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); text-align: right; font-family: var(--mono); font-size: 0.8125rem; }
.retainage-table td:first-child { text-align: left; }

/* === UNMATCHED ITEMS === */
.unmatched-panel {
  padding: 16px; background: rgba(194,48,48,0.05); border: 1px solid rgba(194,48,48,0.2);
  border-radius: var(--radius-lg); margin-bottom: 16px;
}
.unmatched-panel h4 { color: var(--danger); margin-bottom: 8px; font-family: var(--font); }
.unmatched-list { font-size: 0.8125rem; }
.unmatched-item { padding: 4px 8px; border-bottom: 1px solid rgba(194,48,48,0.1); display: flex; justify-content: space-between; }
.unmatched-item-name { font-weight: 500; }
.unmatched-item-value { font-family: var(--mono); color: var(--text-secondary); }

/* === BID COMPARE === */
.bid-compare-row {
  background: var(--bg-hover);
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
}
.bid-compare-row td { padding: 12px 16px; }

/* === CO SIMULATION === */
.co-simulation {
  padding: 16px; background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 12px;
}
.co-simulation h4 { margin-bottom: 8px; font-family: var(--font); }
.co-sim-result { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }
.co-sim-item { display: flex; flex-direction: column; }
.co-sim-label { font-size: 0.6875rem; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; }
.co-sim-value { font-family: var(--mono); font-weight: 700; font-size: 1rem; }

/* === BASELINE INDICATOR === */
.baseline-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--success); font-weight: 600;
  padding: 2px 8px; background: rgba(26,138,94,0.1); border-radius: 3px;
}

/* === BENCHMARK GAUGE === */
.benchmark-gauge { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.gauge-bar { width: 100px; height: 10px; background: var(--bg-active); border-radius: 5px; position: relative; overflow: visible; }
.gauge-fill { height: 100%; border-radius: 5px; transition: width 0.4s, background 0.4s; }
.gauge-marker { position: absolute; top: -3px; width: 3px; height: 16px; background: #fff; border-radius: 1px; transition: left 0.4s; box-shadow: 0 0 3px rgba(0,0,0,0.3); }
.gauge-label { font-size: 0.6875rem; font-weight: 600; white-space: nowrap; font-family: var(--font); }
.win-badge { font-size: 0.6875rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }

/* === PRINT === */
@media print {
  body { background: #fff; color: #000; }
  #app-header { display: none; }
  .estimate-toolbar { display: none; }
  #project-bar { box-shadow: none; border-bottom: 2px solid #000; }
  .project-field input, .project-field select { border: none; background: transparent; padding: 0; }
  .division-section { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .division-body { display: block !important; }
  .division-header { background: #e8e8e8 !important; color: #000 !important; -webkit-print-color-adjust: exact; }
  .pre-division-section .division-header { background: #f0d8c0 !important; }
  .item-row input { border: none; background: transparent; padding: 0; }
  .view { padding: 10px 0; }
  .nav-btn, .header-action, .tool-btn { display: none; }
  /* Print header */
  .print-header {
    display: block; text-align: center; margin-bottom: 20px;
    font-family: var(--font); border-bottom: 3px solid #002E66;
    padding-bottom: 10px;
  }
  .print-header h1 { font-size: 18px; color: #002E66; }
  .print-header p { font-size: 12px; color: #666; }
  .summary-grid { display: block !important; }
  .summary-card { break-inside: avoid; margin-bottom: 16px; box-shadow: none; border: 1px solid #ccc; }
  #btn-print-summary { display: none; }
  .note-row { display: none !important; }
  .note-btn { display: none; }
}

/* === NIC (Not In Contract) === */
.col-nic { text-align: center !important; }
.nic-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.item-row.nic-item td { text-decoration: line-through; opacity: 0.55; }
.item-row.nic-item td.col-nic { text-decoration: none; opacity: 1; }

/* === QUOTE HINT BUTTON === */
.quote-hint-btn {
  background: none; border: 1px solid var(--primary-light); border-radius: 3px;
  color: var(--primary); font-size: 0.75rem; padding: 1px 6px; cursor: pointer;
  margin-left: 8px; font-family: var(--font); transition: all 0.15s;
}
.quote-hint-btn:hover { background: var(--primary); color: #fff; }

/* === BILLING CONDITIONAL FORMATTING === */
.billing-negative { color: var(--danger) !important; font-weight: 700; }
.billing-warn { background: rgba(255,193,7,0.15); }
.billing-danger { background: rgba(220,53,69,0.12); color: var(--danger); font-weight: 600; }
.billing-pending { color: #e67e22; font-weight: 600; }
tr.billing-pending { background: rgba(230,126,34,0.06); }

/* === VERSION COMPARISON === */
.version-compare-controls select { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }
.version-added { background: rgba(40,167,69,0.12); }
.version-removed { background: rgba(220,53,69,0.10); }
.version-changed { background: rgba(255,193,7,0.12); }

/* === DASHBOARD === */
.dashboard { padding: 20px 0; }
.dashboard-stats-bar {
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  padding: 16px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.dashboard-stat { font-size: 0.95rem; color: var(--text-muted); }
.dashboard-stat strong { color: var(--primary); font-family: var(--mono); }
.dashboard-stat-badge {
  font-size: 0.8rem; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-active); color: var(--text-muted); font-weight: 500;
}
.dashboard-sort-bar { margin-bottom: 16px; }
.dashboard-sort-bar select { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.dashboard-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.dashboard-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dashboard-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.dashboard-card-header h4 { margin: 0; font-size: 1rem; color: var(--text); }
.dashboard-status-badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase;
}
.status-draft { background: var(--bg-active); color: var(--text-muted); }
.status-active { background: rgba(26,138,94,0.12); color: var(--success); }
.status-complete { background: rgba(0,82,136,0.1); color: var(--primary); }
.dashboard-card-body { font-size: 0.875rem; }
.dashboard-card-stat { color: var(--text); margin-bottom: 4px; font-family: var(--mono); }
.dashboard-card-meta { color: var(--text-muted); font-size: 0.8rem; margin-top: 8px; }
.dashboard-card-new {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed var(--border); background: transparent; min-height: 140px;
}
.dashboard-card-new:hover { border-color: var(--primary); color: var(--primary); }
.dashboard-card-plus { font-size: 2.5rem; font-weight: 300; color: var(--text-muted); line-height: 1; margin-bottom: 8px; }

/* === BATCH PDF BROWSER === */
.batch-browser { margin-bottom: 16px; }
.batch-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.batch-header h3 { font-size: 1rem; font-weight: 700; font-family: var(--font); color: var(--text); }
.batch-summary { font-size: 0.8125rem; color: var(--text-secondary); }
.batch-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 2px solid var(--border);
}
.batch-tab {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); cursor: pointer; transition: all 0.15s;
  text-align: left; min-width: 140px;
}
.batch-tab:hover { border-color: var(--primary-light); box-shadow: var(--shadow); }
.batch-tab.active { border-color: var(--primary); background: var(--bg-active); box-shadow: 0 0 0 2px rgba(0,82,136,0.15); }
.batch-tab-name { font-weight: 600; font-size: 0.8125rem; color: var(--text); }
.batch-tab-total { font-family: var(--mono); font-size: 0.875rem; font-weight: 700; color: var(--primary); }
.batch-tab-applied { opacity: 0.6; }
.batch-tab-applied .batch-tab-name { text-decoration: line-through; }
.batch-tab-badge {
  font-size: 0.6rem; background: var(--success); color: #fff;
  padding: 1px 6px; border-radius: 3px; text-transform: uppercase;
  font-weight: 700; align-self: flex-start;
}
.batch-tab-error { border-color: var(--danger); }
.batch-tab-error .batch-tab-name { color: var(--danger); }
.batch-tab-error .batch-tab-total { color: var(--danger); }
