/* Elvo Architecture - Porcelain & Ion, tuned as a precise review workbench. */
:root {
  --base: #f5f6fa;
  --surface: #ffffff;
  --ink: #0b0e1a;
  --muted: #5c6274;
  --muted-2: #858b9b;
  --accent: #6023e8;
  --accent-cyan: #0e7ea0;
  --line: rgb(11 14 26 / 0.09);
  --line-strong: rgb(11 14 26 / 0.15);
  --veil: rgb(255 255 255 / 0.72);
  --danger: #b42334;
  --danger-soft: rgb(180 35 52 / 0.09);
  --ok: #157347;
  --ok-soft: rgb(21 115 71 / 0.10);
  --warn: #8a6100;
  --warn-soft: rgb(196 148 20 / 0.13);
  --info-soft: rgb(14 126 160 / 0.10);
  --accent-soft: rgb(96 35 232 / 0.09);

  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-sans: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;

  --shadow-header: 0 14px 40px -22px rgb(11 14 26 / 0.30);
  --shadow-card: 0 14px 34px -28px rgb(11 14 26 / 0.28);
  --shadow-float: 0 28px 70px -36px rgb(11 14 26 / 0.38);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow-x: clip; }
html { color-scheme: light; scroll-behavior: smooth; }

body {
  background: var(--base);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(54rem 30rem at 88% -12%, rgb(96 35 232 / 0.075), transparent 68%),
    radial-gradient(42rem 28rem at -8% 88%, rgb(14 126 160 / 0.055), transparent 70%);
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
button, input, select, textarea { font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

::selection { background: rgb(96 35 232 / 0.20); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgb(11 14 26 / 0.18); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

.glass {
  background: var(--veil);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgb(255 255 255 / 0.82);
  box-shadow: var(--shadow-header);
}

.text-gradient-ion {
  background: linear-gradient(105deg, var(--accent) 8%, var(--accent-cyan) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.overline {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1.4;
  text-transform: uppercase;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono, .num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.assump { color: var(--warn); }

code {
  border-radius: 6px;
  background: rgb(11 14 26 / 0.05);
  color: rgb(11 14 26 / 0.78);
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 2px 6px;
}
code:empty { display: none; }

/* Controls */
button, .btn, a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 28px -18px rgb(96 35 232 / 0.58);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

button:hover:not(:disabled), .btn:hover, a.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -19px rgb(96 35 232 / 0.64);
}

button:active:not(:disabled), .btn:active { transform: translateY(0); }
button:disabled { opacity: 0.42; cursor: not-allowed; transform: none; box-shadow: none; }

button.secondary, a.button-link, .btn-secondary {
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.78);
  color: var(--ink);
  box-shadow: none;
}
button.secondary:hover:not(:disabled), a.button-link:hover, .btn-secondary:hover {
  border-color: var(--line-strong);
  background: #fff;
  box-shadow: none;
}

button.ghost, .btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }
button.ghost:hover:not(:disabled), .btn-ghost:hover { background: rgb(11 14 26 / 0.05); color: var(--ink); box-shadow: none; }
button.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
button.danger:hover:not(:disabled) { background: rgb(180 35 52 / 0.15); box-shadow: none; }
button.accent { background: var(--accent); color: #fff; }
button.small, .btn-sm, a.button-link.small { min-height: 32px; padding: 6px 13px; font-size: 12px; }
button.icon, .btn-icon { padding: 9px; }

select, input:not([type="checkbox"]):not([type="file"]), textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 9px 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(96 35 232 / 0.12);
}

select { cursor: pointer; }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* Global shell */
.shell { min-height: 100vh; padding: 16px 18px 56px; }

.app-header {
  position: sticky;
  top: 12px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(1560px, 100%);
  min-height: 66px;
  margin: 0 auto 14px;
  padding: 8px 10px 8px 18px;
  border-radius: 999px;
}

.app-brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}
.app-brand img { display: block; width: 34px; height: 34px; }
.app-brand > span { display: flex; flex-direction: column; }
.wordmark { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.025em; line-height: 1; }
.brand-sub { margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 0.25em; line-height: 1; text-transform: uppercase; }

.workspace-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.nav-link {
  min-height: 42px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
}
.nav-link svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.68; }
.nav-link:hover:not(:disabled) { background: rgb(255 255 255 / 0.72); color: var(--ink); box-shadow: none; transform: none; }
/* Active page is a soft accent pill: the dark ink pill is reserved for the one primary action on screen (Upload DWG). */
.nav-link.active { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.nav-link.active svg { opacity: 1; }

.pill, .badge, .status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1.35;
  white-space: nowrap;
}
.pill { min-width: 19px; padding: 2px 6px; background: var(--accent-soft); color: var(--accent); }
.pill:empty { display: none; }
.nav-link.active .pill { background: var(--accent); color: #fff; }
.badge-neutral, .status { background: rgb(11 14 26 / 0.06); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-info { background: var(--info-soft); color: var(--accent-cyan); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.status-Open { background: var(--danger-soft); color: var(--danger); }
.status-InRfi { background: var(--warn-soft); color: var(--warn); }
.status-Resolved, .status-Applied { background: var(--ok-soft); color: var(--ok); }
.status-Rejected { background: rgb(11 14 26 / 0.06); color: var(--muted); }
.sev-Critical, .sev-Major { color: var(--danger); font-weight: 800; }
.sev-Warning { color: var(--warn); font-weight: 800; }
.sev-Info { color: var(--muted); font-weight: 700; }

.menu-label { display: block; padding: 7px 12px 4px; color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.menu-item[data-lang-btn] { position: relative; padding-right: 30px; font-weight: 500; }
.menu-item[data-lang-btn].active { color: var(--accent); font-weight: 700; }
/* the tick marks the active language without shifting the label */
.menu-item[data-lang-btn].active::after { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); content: "\2713"; font-size: 12px; }

.header-action { flex: 0 0 auto; min-height: 46px; padding-inline: 20px; }
/* Same soft accent pill as the active page: quieter than the primary Upload DWG action, but still clearly clickable. */
button.header-action { background: var(--accent-soft); color: var(--accent); border: 0; box-shadow: none; }
button.header-action:hover:not(:disabled) { background: rgb(96 35 232 / 0.16); color: var(--accent); box-shadow: none; }

/* Rare actions live behind the "..." button in the project bar. */
.app-header .menu { flex: 0 0 auto; }
.header-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgb(11 14 26 / 0.05);
  box-shadow: none;
  color: var(--muted);
}
.header-avatar:hover:not(:disabled) { background: rgb(11 14 26 / 0.09); color: var(--ink); box-shadow: none; transform: none; }
.header-avatar[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-float); animation: toast-in 160ms ease both; }
.menu-list[hidden] { display: none; }
.menu-item { display: block; width: 100%; min-height: 0; padding: 9px 12px; border: 0; border-radius: 8px; background: none; box-shadow: none; color: var(--ink); font-size: 13px; font-weight: 600; text-align: left; }
.menu-item:hover:not(:disabled) { background: rgb(11 14 26 / 0.05); box-shadow: none; transform: none; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover:not(:disabled) { background: var(--danger-soft); }

.main { width: min(1560px, 100%); margin: 0 auto; padding: 0 8px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 28px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / 0.58);
}
.topbar .spacer { flex: 1; }
.project-picker { display: flex; align-items: center; gap: 11px; min-width: 0; }
.project-picker .overline { flex: 0 0 auto; }
.project-picker select {
  min-width: 220px;
  max-width: 360px;
  border-color: transparent;
  border-radius: 999px;
  background-color: #fff;
  font-weight: 700;
}
.project-meta { color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
/* Job and action messages float above the page instead of competing for room in the project bar. */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  display: flex; align-items: flex-start; gap: 12px;
  max-width: min(440px, calc(100vw - 44px)); padding: 13px 14px 13px 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-float); font-size: 13px; font-weight: 600; line-height: 1.45;
  animation: toast-in 220ms ease both;
}
.toast[hidden] { display: none; }
.toast-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.toast.error .toast-dot { background: var(--danger); }
.toast.error { color: var(--danger); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex: none; margin: -4px -6px -4px 0; padding: 0 6px; min-height: 0; background: none; border: 0; box-shadow: none; color: var(--muted-2); font-size: 18px; line-height: 1; cursor: pointer; }
.toast-close:hover { color: var(--ink); background: none; box-shadow: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Page structure */
.tab { display: none; }
.tab.active { display: block; animation: page-in 220ms ease both; }
.tab[hidden] { display: none !important; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 4px 22px;
}
.page-title { margin: 4px 0 0; font-family: var(--font-sans); font-size: clamp(28px, 3vw, 38px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.08; }
.page-title .dot, .dot { color: var(--accent); }
.page-sub { max-width: 720px; margin-top: 7px; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

h2, .section-title { margin: 26px 0 12px; font-family: var(--font-sans); font-size: 17px; font-weight: 800; letter-spacing: -0.025em; }
h2:first-child { margin-top: 0; }
h3 { margin: 18px 0 8px; font-family: var(--font-sans); font-size: 14px; font-weight: 800; }
ol, ul { padding-left: 21px; }
li { margin: 5px 0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.toolbar label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.toolbar select { min-width: 170px; }
.toolbar .muted { font-size: 12px; }

.card, .workspace-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.card .big { margin-top: 8px; font-family: var(--font-sans); font-size: 27px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.card .muted { margin-top: 5px; font-size: 12px; }
.card a.snap { text-decoration: none; }
.card a.snap:hover b { color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* Overview */
.workflow-card { margin-bottom: 16px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.workflow-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.workflow-head h2 { margin: 0 0 4px; }
.workflow-state { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.workflow-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.workflow-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding-right: 18px; }
.workflow-step:not(:last-child)::after { content: ''; position: absolute; top: 16px; right: 4px; width: calc(100% - 48px); height: 1px; background: var(--line-strong); transform: translateX(50%); }
.step-marker { position: relative; z-index: 1; display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--muted-2); font-family: var(--font-mono); font-size: 10px; font-weight: 800; }
.workflow-step.complete .step-marker { border-color: var(--ink); background: var(--ink); color: #fff; }
.workflow-step.active .step-marker { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.step-name { display: block; font-size: 12.5px; font-weight: 800; }
.step-note { display: block; margin-top: 1px; color: var(--muted); font-size: 10.5px; }

.overview-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 16px; }
.workspace-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.workspace-card-head h2 { margin: 0; }
.model-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); }
.model-metric { padding: 17px; border-right: 1px solid var(--line); }
.model-metric:last-child { border-right: 0; }
.model-value { font-size: 25px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.model-label { margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.revision-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.revision-file { min-width: 0; flex: 1; }
.revision-file strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.revision-file span { color: var(--muted); font-size: 11.5px; }

.attention-list { display: grid; gap: 10px; }
.attention-item { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.attention-item:last-child { border-bottom: 0; }
.attention-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--muted-2); }
.attention-dot.danger { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }
.attention-dot.warn { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); }
.attention-dot.ok { background: var(--ok); box-shadow: 0 0 0 5px var(--ok-soft); }
.attention-copy { min-width: 0; flex: 1; }
.attention-copy strong { display: block; font-size: 13px; }
.attention-copy span { color: var(--muted); font-size: 11.5px; }
.attention-item button { min-height: 29px; padding: 5px 10px; font-size: 11px; }

.technical-details { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgb(255 255 255 / 0.66); }
.technical-details > summary { padding: 17px 20px; color: var(--ink); }
.technical-body { padding: 0 20px 20px; }

.empty-workspace { display: grid; place-items: center; min-height: 510px; padding: 48px 24px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); text-align: center; }
.empty-mark { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 22px; background: var(--accent-soft); color: var(--accent); font-size: 28px; }
.empty-workspace h1 { max-width: 620px; margin-bottom: 12px; font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.055em; line-height: 1; }
.empty-workspace p { max-width: 520px; margin-bottom: 24px; color: var(--muted); }

/* Issue review master-detail */
.review-shell { display: grid; grid-template-columns: minmax(360px, 0.82fr) minmax(440px, 1.18fr); min-height: 590px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-card); }
.review-list-panel { min-width: 0; border-right: 1px solid var(--line); background: rgb(248 248 251 / 0.76); }
.review-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 0.88); }
.review-count { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.filter-tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgb(11 14 26 / 0.05); }
.filter-tab { min-height: 28px; padding: 5px 10px; background: transparent; color: var(--muted); box-shadow: none; font-size: 10.5px; }
.filter-tab:hover:not(:disabled) { background: rgb(255 255 255 / 0.72); color: var(--ink); box-shadow: none; transform: none; }
.filter-tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgb(11 14 26 / 0.08); }
.review-list { max-height: 650px; overflow-y: auto; padding: 8px; }
.review-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: stretch; margin-bottom: 6px; overflow: hidden; border: 1px solid transparent; border-radius: 16px; background: transparent; transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.review-item:hover { border-color: var(--line); background: #fff; }
.review-item.active { border-color: rgb(96 35 232 / 0.34); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.review-select { display: grid; place-items: start center; padding-top: 17px; }
.review-item .issue-open { display: block; min-width: 0; min-height: 0; padding: 13px 14px 13px 4px; border-radius: 0; background: transparent; color: var(--ink); box-shadow: none; text-align: left; white-space: normal; }
.review-item .issue-open:hover { transform: none; box-shadow: none; }
.issue-row-top { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.severity-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--muted-2); }
.severity-dot.Critical, .severity-dot.Major { background: var(--danger); }
.severity-dot.Warning { background: var(--warn); }
.issue-id { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; }
.issue-state { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.issue-title { display: block; overflow: hidden; font-size: 13.5px; font-weight: 800; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.issue-meta { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.issue-inspector { min-width: 0; padding: clamp(24px, 3vw, 38px); }
.inspector-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.inspector-heading .status { margin-left: auto; }
.inspector-title { max-width: 760px; margin: 0 0 10px; font-family: var(--font-sans); font-size: clamp(24px, 2.7vw, 36px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.08; }
.inspector-description { max-width: 740px; margin-bottom: 24px; color: var(--muted); }
.inspector-context { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.context-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.evidence-stack { border-top: 1px solid var(--line); }
.evidence-block { padding: 15px 0; border-bottom: 1px solid var(--line); }
.evidence-label { display: block; margin-bottom: 5px; color: var(--accent); font-size: 9.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.evidence-detail { font-size: 13px; line-height: 1.55; }
.evidence-source { display: block; margin-top: 7px; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; }
.resolution-note { margin-top: 18px; padding: 13px 15px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); font-size: 12px; }
.inspector-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 26px; }
.inspector-actions .destructive-action { margin-left: auto; }

/* Drawing and 3D */
.drawing-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.drawing-stage { min-width: 0; }
.drawing-toolbar { margin-bottom: 10px; }
.panel { min-height: 44px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; }
.evidence-panel { position: sticky; top: 96px; min-height: 260px; margin: 0; padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.evidence-panel h2 { margin: 5px 0 10px; font-size: 21px; }
.evidence-panel .viewer-help { color: var(--muted); font-size: 12.5px; }
.viewer-legend { display: grid; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.legend-row { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11.5px; }
.legend-swatch { width: 16px; height: 3px; border-radius: 3px; background: var(--ink); }
.legend-swatch.issue { background: var(--danger); }
.legend-swatch.model { background: var(--accent); }

#svgWrap, #threeWrap { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
#svgWrap {
  height: calc(100vh - 275px);
  min-height: 520px;
  background-color: #fbfbfd;
  background-image: radial-gradient(rgb(11 14 26 / 0.075) 0.75px, transparent 0.75px);
  background-size: 22px 22px;
}
#svg { display: block; width: 100%; height: 100%; cursor: grab; }
#svg:active { cursor: grabbing; }
#threeWrap { height: calc(100vh - 285px); min-height: 540px; background: #fff; }
#threeWrap canvas { display: block; width: 100% !important; height: 100% !important; border-radius: inherit; }
#levelToggles label { margin-right: 10px; }
/* Room names projected over the 3D canvas: an overlay that never catches the pointer, so orbit and pick go through */
#threeWrap .three-labels { position: absolute; top: 0; left: 0; pointer-events: none; }
#threeWrap .room-label { padding: 1px 6px; border-radius: 6px; background: rgb(255 255 255 / 0.82); color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; box-shadow: 0 1px 2px rgb(11 14 26 / 0.10); }
#threeWrap .room-label.wet { color: #0e7ea0; }
#threeWrap .room-label.culled { visibility: hidden; }
#threeWrap .room-label.unit { padding: 3px 10px; border-radius: 999px; background: rgb(96 35 232 / 0.92); color: #fff; font-size: 12.5px; letter-spacing: 0.04em; }
/* the room-names switch floats over the model so it is at hand while the toolbar has scrolled away */
#threeWrap .three-fab { position: absolute; bottom: 12px; right: 12px; z-index: 2; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgb(255 255 255 / 0.92); box-shadow: 0 1px 3px rgb(11 14 26 / 0.10); }
#threeWrap .three-fab button { min-height: 28px; padding: 4px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; box-shadow: none; }
#threeWrap .three-fab button:hover { background: rgb(11 14 26 / 0.05); color: var(--ink); box-shadow: none; }
#threeWrap .three-fab button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Tables and technical content */
#modelView, #moneyView, #verifyList, .table-scroll { max-width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 690px; margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; border-radius: var(--radius-md); background: var(--surface); font-size: 12.5px; }
th { padding: 11px 13px; border-bottom: 1px solid var(--line); background: rgb(11 14 26 / 0.025); color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: 0.14em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 10px 13px; border-bottom: 1px solid rgb(11 14 26 / 0.055); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover td { background: rgb(96 35 232 / 0.026); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.log { max-height: 240px; overflow: auto; margin-bottom: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgb(11 14 26 / 0.025); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; }

details { margin-top: 10px; }
summary { display: flex; align-items: center; gap: 9px; padding: 8px 0; color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 800; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 160ms ease; }
details[open] > summary::before { transform: rotate(45deg); }
summary:hover { color: var(--ink); }
p.muted { margin-bottom: 14px; }

/* Dialog */
dialog { width: calc(100% - 28px); max-width: 520px; padding: 26px 28px; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); animation: modal-rise 240ms cubic-bezier(0.16, 1, 0.3, 1) both; }
dialog::backdrop { background: rgb(11 14 26 / 0.42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes modal-rise { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: none; } }
dialog h3 { margin: 0 0 18px; font-size: 19px; }
dialog label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
dialog input:not([type="checkbox"]), dialog select, dialog textarea { width: 100%; }
dialog .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* Compatibility for old issue markup while content refreshes. */
.issue { margin-bottom: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.issue .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.issue .title { min-width: 160px; flex: 1; font-weight: 700; }
.issue .evidence { margin: 8px 0 0 24px; color: var(--muted); font-size: 12px; }
.issue .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 1240px) {
  .app-header { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 14px; border-radius: 25px; }
  .app-brand { grid-column: 1; grid-row: 1; }
  .header-action { grid-column: 3; grid-row: 1; }
  .workspace-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding-bottom: 1px; scrollbar-width: none; }
  .workspace-nav::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; }
  .overview-columns { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
}

@media (max-width: 900px) {
  .shell { padding: 10px 10px 44px; }
  .main { padding: 0 2px; }
  .topbar { flex-wrap: wrap; }
  .topbar .spacer { display: none; }
  .project-picker { flex: 1 1 100%; }
  .project-picker select { flex: 1; max-width: none; }
  .project-meta { margin-right: auto; }
  .overview-columns, .review-shell, .drawing-workspace { grid-template-columns: 1fr; }
  .review-list-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-list { max-height: 430px; }
  .evidence-panel { position: static; min-height: 0; }
  #svgWrap, #threeWrap { height: 62vh; min-height: 430px; }
  .model-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model-metric:nth-child(2) { border-right: 0; }
  .model-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workflow-track { min-width: 670px; }
  .workflow-card { overflow-x: auto; }
}

@media (max-width: 620px) {
  .shell { padding-inline: 7px; }
  .app-header { top: 7px; grid-template-columns: 1fr auto; padding: 8px 9px 8px 13px; }
  .header-action { grid-column: 2; min-height: 40px; padding: 8px 13px; }
  .header-action span { display: none; }
  .workspace-nav { gap: 0; }
  .nav-link { min-height: 38px; padding: 8px 10px; font-size: 11.5px; }
  .nav-link svg { display: none; }
  .topbar { align-items: stretch; padding: 10px; }
  .project-picker { display: grid; grid-template-columns: 1fr; gap: 5px; }
  .topbar button { flex: 1; }
  .project-meta { width: 100%; }
  .page-head { align-items: stretch; flex-direction: column; margin-inline: 2px; }
  .page-head > button { width: 100%; }
  .workflow-card, .workspace-card, .card { padding: 17px; }
  .overview-columns { gap: 10px; }
  .review-shell { border-radius: var(--radius-lg); }
  .review-tools { align-items: flex-start; flex-direction: column; }
  .issue-inspector { padding: 23px 18px; }
  .inspector-actions > * { width: 100%; }
  .inspector-actions .destructive-action { margin-left: 0; }
  .drawing-toolbar select { width: 100%; }
  #svgWrap, #threeWrap { min-height: 360px; }
  dialog { padding: 22px 19px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 3D tab: the estimator's readout under the model — what was clicked, and totals per wall type */
#threeLegend, #threeInfo { margin: 12px 0 0; }
#threeSelected .muted.small { margin-top: 10px; word-break: break-all; }
#threeSelected .sel-title, #threeLegend .sel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; font-weight: 700; }
#threeSelected dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 8px; }
#threeSelected dt { color: var(--muted); }
#threeSelected dd { margin: 0; font-variant-numeric: tabular-nums; }
#threeSelected dd.net { font-weight: 700; }
.tag-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
#threeLegend table { min-width: 0; margin-bottom: 6px; }
#threeLegend tr.tag-row { cursor: pointer; }
#threeLegend tr.tag-row:hover td { background: rgb(11 14 26 / 0.03); }
#threeLegend tr.tag-row.active td { background: var(--accent-soft); }
#threeLegend tr.total td { font-weight: 700; }
#threeSelected dl { font-size: 13px; }
/* the details panel is there only while something is selected; otherwise the model spans the row */
#tab-three .drawing-workspace:not(.has-selection) { grid-template-columns: minmax(0, 1fr); }
#threeSelected .close { position: absolute; top: 12px; right: 12px; min-height: 0; width: 30px; height: 30px; padding: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; box-shadow: none; }
#threeSelected .close:hover { background: rgb(11 14 26 / 0.06); color: var(--ink); transform: none; box-shadow: none; }
#threeSelected .sel-title { padding-right: 34px; }

/* sheets of the building (overview): file, role, what the model took from it */
.sheet-list { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.sheet-list .overline { display: block; margin-bottom: 8px; }
.sheet-table td { vertical-align: middle; }
.sheet-table .sheet-file { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.sheet-table select.sheet-role { font-size: 12px; padding: 4px 8px; margin-right: 8px; }
.sheet-table .sheet-status { color: var(--muted); font-size: 12px; }
.sheet-help { margin: 10px 0 0; font-size: 11.5px; }
