/* SAM Estimator design system - hand-written (no Tailwind CLI available in
   this offline build, see ARCHITECTURE.md). Utility-class approach inspired
   by Tailwind's ergonomics, implemented directly. */

:root {
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-surface-alt: #fafbfc;
  --color-border: #e2e5ea;
  --color-border-strong: #cbd1db;
  --color-text: #1a1f2b;
  --color-text-muted: #626b7a;
  --color-text-faint: #8b93a3;
  --color-primary: #1f5eff;
  --color-primary-dark: #1443c2;
  --color-primary-bg: #eaf0ff;
  --color-success: #17845a;
  --color-success-bg: #e7f7ef;
  --color-warning: #b76a00;
  --color-warning-bg: #fff4e2;
  --color-danger: #c92a2a;
  --color-danger-bg: #fdecec;
  --color-accent: #7749f8;
  --color-accent-bg: #f2ecff;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 33, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 24, 33, 0.10);
  --shadow-lg: 0 12px 32px rgba(20, 24, 33, 0.16);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#root { height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--color-primary); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Layout ------------------------------------------------------------- */
.app-shell { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  flex-shrink: 0; z-index: 20;
}
.topbar-brand { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.topbar-brand .logo-dot { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); flex-shrink: 0; }
.main-layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--color-surface); border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-section { padding: 12px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-faint); }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 12px; margin: 1px 8px; border-radius: var(--radius-sm);
  color: var(--color-text-muted); cursor: pointer; font-size: 13px; font-weight: 500; border: none; background: none; width: calc(100% - 16px); text-align: left;
  text-decoration: none; box-sizing: border-box;
}
.nav-item:hover { background: var(--color-surface-alt); color: var(--color-text); }
.nav-item.active { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.nav-item svg { flex-shrink: 0; width: 16px; height: 16px; }
.content-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.workspace { flex: 1; display: flex; min-height: 0; }
.center-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.right-pane {
  width: 380px; flex-shrink: 0; background: var(--color-surface); border-left: 1px solid var(--color-border);
  overflow-y: auto;
}
.page-scroll { flex: 1; overflow-y: auto; padding: 20px; }

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text);
  font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.2;
  text-decoration: none; box-sizing: border-box;
}
.btn:hover { background: var(--color-surface-alt); border-color: var(--color-text-faint); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-danger { color: var(--color-danger); border-color: #f3c9c9; background: var(--color-danger-bg); }
.btn-danger:hover { background: #fbdada; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-icon { padding: 6px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--color-surface-alt); }
.btn-accent { background: var(--color-accent-bg); border-color: #d9c9ff; color: #5b2fd4; }
.btn-accent:hover { background: #e7dbff; }

/* Forms ------------------------------------------------------------------ */
.field-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.field-hint { font-size: 11px; color: var(--color-text-faint); }
.field-error { font-size: 11px; color: var(--color-danger); }
.input, select.input, textarea.input {
  width: 100%; padding: 6px 9px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text); font-size: 13px;
}
.input:focus, select.input:focus, textarea.input:focus { outline: 2px solid var(--color-primary-bg); border-color: var(--color-primary); }
textarea.input { resize: vertical; min-height: 60px; }
.checkbox-row { display: flex; align-items: center; gap: 7px; font-size: 13px; }

/* Cards / panels ----------------------------------------------------------- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.card-header { padding: 12px 16px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-body { padding: 16px; }
.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
.panel-section:last-child { border-bottom: none; }
.panel-section-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-faint); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

/* Tables ----------------------------------------------------------------- */
.data-table-wrap { flex: 1; overflow: auto; background: var(--color-surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data-table thead th {
  position: sticky; top: 0; z-index: 5; background: var(--color-surface-alt); text-align: left; padding: 7px 10px;
  font-weight: 600; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); white-space: nowrap;
  user-select: none; cursor: pointer;
}
table.data-table thead th:hover { color: var(--color-text); }
table.data-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data-table tbody tr:hover { background: var(--color-surface-alt); }
table.data-table tbody tr.selected { background: var(--color-primary-bg); }
table.data-table tbody tr.section-row { background: #f0f2f6; font-weight: 700; }
table.data-table tbody tr.section-row td { padding-top: 9px; padding-bottom: 9px; }
table.data-table tbody tr.expanded { background: var(--color-surface-alt); }
/* Cost item rows (the resource lines under a BOQ item) get a distinct tint
   plus a left accent stripe so they read as "belongs to the item above"
   rather than another top-level BOQ row - the previous #fbfbfd was nearly
   indistinguishable from plain white. */
table.data-table tbody tr.cost-item-row { background: var(--color-accent-bg); box-shadow: inset 3px 0 0 var(--color-accent); color: #5b3fa8; }
table.data-table tbody tr.cost-item-row:hover { background: #e9defc; }
table.data-table tbody tr.cost-item-row.selected { background: var(--color-primary-bg); box-shadow: inset 3px 0 0 var(--color-primary); color: var(--color-primary-dark); }
table.data-table tbody tr.cost-item-total-row { background: #fbfbfd; }
table.data-table tbody tr.cost-item-total-row td { border-top: 1px dashed var(--color-border-strong); }
.cell-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.cell-editable { cursor: text; }
.cell-editable:hover { outline: 1px dashed var(--color-border-strong); outline-offset: -1px; }
.cell-input { width: 100%; border: 1px solid var(--color-primary); border-radius: 3px; padding: 2px 5px; font-size: 12.5px; }

/* Toggle group (e.g. Cost/Selling Price switch, Fixed/x BOQ qty switch) ---- */
.toggle-group { display: inline-flex; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; }
.toggle-opt { padding: 5px 11px; cursor: pointer; color: var(--color-text-muted); font-weight: 500; user-select: none; }
.toggle-opt.active { background: var(--color-accent); color: #fff; }

/* Badges / tags ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-neutral { background: #eef0f3; color: var(--color-text-muted); }
.badge-primary { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }

/* Context menu --------------------------------------------------------------- */
.context-menu {
  position: fixed; z-index: 100; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 4px; min-width: 210px;
}
.context-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 12.5px; cursor: pointer; color: var(--color-text);
}
.context-menu-item:hover { background: var(--color-primary-bg); color: var(--color-primary-dark); }
.context-menu-item.danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }
.context-menu-sep { height: 1px; background: var(--color-border); margin: 4px 2px; }
.context-menu-shortcut { color: var(--color-text-faint); font-size: 11px; }

/* Row actions theme ----------------------------------------------------------
   A compact horizontal group of icon-only buttons for per-row actions
   (Duplicate, Delete, ...), hidden until the row is hovered/focused so the
   table stays quiet at rest. Each button carries a title= tooltip instead of
   a text label. Reused anywhere a table row needs quick actions - see the
   BOQ Workspace cost item rows and the library pages' row menu triggers. */
.row-actions { display: inline-flex; align-items: center; gap: 2px; opacity: 0; transition: opacity 0.1s ease; }
tr:hover .row-actions, tr:focus-within .row-actions, .row-actions:focus-within { opacity: 1; }
.row-actions .btn-icon { padding: 4px; border-radius: var(--radius-sm); }

/* Modal ----------------------------------------------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 18, 25, 0.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px; }
.modal { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 960px; }
.modal-xl { max-width: 1200px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 8px; }

/* Toast --------------------------------------------------------------------- */
.toast-container { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--color-text); color: #fff; padding: 10px 14px; border-radius: var(--radius-md); box-shadow: var(--shadow-md); font-size: 12.5px; max-width: 360px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.toast-error { background: var(--color-danger); }
.toast-success { background: var(--color-success); }
.toast-action { color: #fff; border: 1px solid rgba(255,255,255,0.5); flex-shrink: 0; }
.toast-action:hover { background: rgba(255,255,255,0.15); }
.toast-anchored { z-index: 400; transition: opacity 0.1s ease-out; }

/* Misc ----------------------------------------------------------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Manual supply-responsibility override flags (BOQ workspace) */
.override-pill {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  background: #fff3cd; color: #8a5a00; border: 1px solid #f0c36d;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
tr.has-override > td:first-child { box-shadow: inset 3px 0 0 #f0a020; }
tr.has-override { background: #fffaf0; }
.override-banner {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px;
  background: #fff3cd; color: #8a5a00; border: 1px solid #f0c36d; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.override-input { border-color: #f0a020 !important; background: #fffaf0 !important; }
.override-note {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px;
  padding: 6px 8px; background: #fff3cd; color: #8a5a00; border: 1px solid #f0c36d; border-radius: 6px; font-size: 12px;
}
/* Full-text popup for clipped cells/inputs - see src/ui/hoverReveal.ts */
.hover-reveal-tip {
  position: fixed; z-index: 10000; pointer-events: none; padding: 8px 10px;
  background: #1f2430; color: #fff; font-size: 12.5px; line-height: 1.45;
  border-radius: 6px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.divider { height: 1px; background: var(--color-border); margin: 12px 0; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--color-text-faint); text-align: center; gap: 10px; }
.kbd { font-family: var(--font-mono); font-size: 10.5px; background: var(--color-surface-alt); border: 1px solid var(--color-border-strong); border-radius: 4px; padding: 1px 5px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 14px 16px; }
.stat-card .stat-label { font-size: 11px; color: var(--color-text-faint); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.stat-card .stat-sub { font-size: 11.5px; color: var(--color-text-muted); margin-top: 2px; }
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-chart-row { display: grid; grid-template-columns: 120px 1fr 80px; align-items: center; gap: 10px; font-size: 12px; }
.bar-track { background: var(--color-surface-alt); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--color-primary); }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12.5px; cursor: default; }
.tree-row:hover { background: var(--color-surface-alt); }
/* position: sticky only takes effect when a .tab-bar sits inside a
   scrolling ancestor (e.g. BoqItemDetailPanel inside .right-pane) - where a
   .tab-bar instead sits above its own separate scroll area (e.g. Settings'
   page-scroll), this is a no-op since there's nothing for it to stick to. */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); padding: 0 4px; position: sticky; top: 0; z-index: 5; background: var(--color-surface); }
.tab-item { padding: 8px 12px; font-size: 12.5px; font-weight: 500; color: var(--color-text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-item:hover { color: var(--color-text); }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
/* "Create new" invite card (e.g. Create a new assembly, from the BOQ item's
   Costing tab) - a same-weight action, not a plain text link, but visually
   distinct (dashed border) from a normal library pick. */
.create-card {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; margin-top: 4px; border: 1.5px dashed #cbb8ff; border-radius: var(--radius-md);
  background: #fbf9ff; color: #5b2fd4; cursor: pointer; text-align: left; text-decoration: none; box-sizing: border-box;
}
.create-card:hover { background: var(--color-accent-bg); border-color: #a97ff5; }
.create-card-icon {
  width: 26px; height: 26px; border-radius: 7px; background: var(--color-accent-bg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #5b2fd4; font-weight: 700; font-size: 15px;
}
.create-card-title { font-size: 12.5px; font-weight: 600; }
.create-card-sub { font-size: 11px; color: #7a5fc0; margin-top: 1px; }

.search-input-wrap { position: relative; flex: 1; max-width: 360px; }
.search-input-wrap input { padding-left: 30px; }
.search-input-wrap svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--color-text-faint); }

/* Quotation letter (ui/pages/QuotationsPage.tsx) --------------------------
   A formal client-facing document rendered inline for editing (every field
   is a real input/textarea, styled to look like plain text) and printed
   as-is via window.print() - ".print-only" content (plain text/bullets)
   swaps in for the editable form controls only inside @media print below,
   so what prints is never clipped by a fixed-height textarea. */
.qletter-page { background: var(--color-bg); padding: 24px; }
.qletter { max-width: 820px; margin: 0 auto; background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); border-radius: var(--radius-md); padding: 48px 56px; font-size: 13px; color: var(--color-text); }
.qletter-company { font-weight: 700; font-size: 18px; color: var(--color-primary-dark); letter-spacing: -0.01em; }
.qletter-tagline { font-size: 11px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.qletter-rule { height: 2px; background: var(--color-text); margin-top: 10px; }
.qletter-title { font-size: 22px; margin: 18px 0 6px; }
.qletter-subject { font-weight: 600; margin-bottom: 16px; }
.qletter-meta { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 12.5px; table-layout: fixed; }
.qletter-meta td { border: 1px solid var(--color-border-strong); padding: 6px 10px; }
.qletter-meta-label { font-weight: 700; background: var(--color-surface-alt); width: 110px; }
.qletter-section-title { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; margin: 20px 0 8px; }
.qletter-offer, .qletter-terms { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 4px; }
.qletter-offer th, .qletter-offer td, .qletter-terms th, .qletter-terms td { border: 1px solid var(--color-border-strong); padding: 6px 8px; vertical-align: top; text-align: left; }
.qletter-offer thead th, .qletter-terms thead th { background: var(--color-surface-alt); font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em; }
.qletter-total-row td { font-weight: 700; background: var(--color-surface-alt); }
.qletter-section-row td { background: var(--color-surface-alt); font-weight: 700; }
.qletter-section-input { font-weight: 700; }
.qletter-section-subtotal td { font-weight: 600; font-style: italic; text-align: right; }
.qletter-section-subtotal td.cell-numeric { font-style: normal; }
.qletter-grand-total td { font-size: 13.5px; background: var(--color-primary-bg); color: var(--color-primary-dark); }
.qletter-field { border: 1px solid var(--color-border-strong); border-radius: 4px; padding: 4px 6px; font-size: inherit; font-family: inherit; width: 100%; box-sizing: border-box; background: var(--color-surface); }
.qletter-cell { padding: 3px 4px; }
.qletter-print-text { white-space: pre-wrap; }
.qletter-bullets { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; }
.qletter-account { font-size: 12.5px; line-height: 1.8; }
.qletter-footer { margin-top: 28px; padding-top: 10px; font-size: 10.5px; color: var(--color-text-faint); text-align: center; }
.qletter-footer-sub { margin-top: 2px; }
.print-only { display: none; }

@media print {
  html, body, #root, .app-shell, .main-layout, .content-area, .page-scroll {
    height: auto !important; overflow: visible !important; display: block !important;
  }
  body * { visibility: hidden; }
  .qletter-page, .qletter-page * { visibility: visible; }
  .qletter-page { position: absolute; left: 0; top: 0; width: 100%; padding: 0; background: #fff; }
  .qletter { box-shadow: none; border: none; border-radius: 0; max-width: none; padding: 0; }
  .no-print { display: none !important; }
  .print-only { display: revert !important; }
  .qletter-field { border: none !important; background: transparent !important; padding: 0 !important; }
  @page { size: A4; margin: 16mm; }
}
.cost-toolbar-row td { background: #f6f4ff; border-bottom: 1px solid var(--color-border); padding-top: 4px; padding-bottom: 4px; }

/* Assembly row on a BOQ item (a library assembly = one cost item) */
table.data-table tbody tr.cost-assembly-row { background: #eaf6ee; box-shadow: inset 4px 0 0 #2f9e62; color: #1d5c3a; }
table.data-table tbody tr.cost-assembly-row:hover { background: #dcf0e3; }
table.data-table tbody tr.cost-assembly-row.selected { background: var(--color-primary-bg); box-shadow: inset 4px 0 0 var(--color-primary); color: var(--color-primary-dark); }
.assembly-tag { display: inline-block; margin-right: 8px; padding: 0 7px; border-radius: 10px; background: #2f9e62; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }

/* Assembly header row on the Assemblies library page */
table.data-table tbody tr.assembly-lib-row { background: #eaf6ee; box-shadow: inset 4px 0 0 #2f9e62; color: #1d5c3a; }
table.data-table tbody tr.assembly-lib-row:hover { background: #dcf0e3; }
table.data-table tbody tr.assembly-lib-row.selected { background: var(--color-primary-bg); box-shadow: inset 4px 0 0 var(--color-primary); color: var(--color-primary-dark); }

/* Clear "this is the selected row" highlight - BOQ items, cost items,
   assembly rows and library assemblies all share it. */
table.data-table tbody tr.selected,
table.data-table tbody tr.selected:hover,
table.data-table tbody tr.cost-item-row.selected,
table.data-table tbody tr.cost-assembly-row.selected,
table.data-table tbody tr.assembly-lib-row.selected {
  background: #d6e4ff;
  box-shadow: inset 5px 0 0 var(--color-primary);
  color: var(--color-primary-dark);
  font-weight: 600;
}
table.data-table tbody tr.selected > td { border-top: 1px solid #9db9ff; border-bottom: 1px solid #9db9ff; }

/* "Resource" tag on single cost lines - same size as the Assembly tag, different colour */
.assembly-tag.resource-tag { background: #7c5cd6; }

/* Row actions float over the row on hover instead of owning a column. */
table.data-table tbody td.row-actions-cell { width: 0; padding: 0; position: relative; overflow: visible; border-bottom: 1px solid var(--color-border); }
.row-actions.row-actions-float {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  z-index: 6; padding: 2px 4px; pointer-events: none;
  background: var(--color-surface); border: 1px solid var(--color-border-strong, var(--color-border));
  border-radius: 6px; box-shadow: var(--shadow-md, 0 2px 8px rgba(0,0,0,.15));
}
tr:hover .row-actions.row-actions-float, tr:focus-within .row-actions.row-actions-float { pointer-events: auto; }

/* Smaller, more see-through floating row actions */
.row-actions.row-actions-float {
  padding: 0 2px; gap: 0; border-radius: 5px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(120, 130, 160, 0.25);
  box-shadow: none;
  -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
tr:hover .row-actions.row-actions-float { opacity: 0.7; }
tr:hover .row-actions.row-actions-float:hover { opacity: 1; background: rgba(255, 255, 255, 0.85); }
.row-actions.row-actions-float .btn-icon { padding: 2px; font-size: 10px; line-height: 1; min-width: 0; }
.row-actions.row-actions-float svg { width: 10px; height: 10px; }

/* Hover over the row: icons only hint at where they are (content stays readable).
   Hover over the icon area: icons become clear, with a solid backing. */
tr:hover .row-actions.row-actions-float { opacity: 0.4; background: transparent; border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
tr:hover .row-actions.row-actions-float:hover { opacity: 1; background: rgba(255, 255, 255, 0.96); border-color: rgba(120, 130, 160, 0.45); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18); }
