:root {
  color-scheme: dark;
  --bg: #040910;
  --panel: #091321;
  --panel-2: #0c192a;
  --panel-3: #101f33;
  --line: #243750;
  --line-strong: #345476;
  --text: #e5edf7;
  --muted: #8191a7;
  --blue: #1b5b9d;
  --blue-bright: #3a83d4;
  --blue-soft: #15395e;
  --cyan: #6db8ff;
  --warning: #d4a657;
  --danger: #d76066;
  --ok: #53a688;
  --radius: 3px;
  --header-h: 40px;
  --footer-h: 24px;
  --font-ui: 12px;
  --font-table: 11px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: var(--font-ui);
}

button, input, select { font: inherit; }

button, input, select {
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #08111d;
  color: var(--text);
}

button { padding: 2px 8px; cursor: pointer; }
button:hover, button:focus-visible { border-color: var(--blue-bright); background: #102945; outline: none; }
button.primary { background: var(--blue); border-color: #2874bd; font-weight: 650; }
button.secondary { background: #10233a; }
input, select { padding: 2px 4px; }
input:focus, select:focus { outline: 1px solid var(--blue-bright); border-color: var(--blue-bright); }

.app-shell {
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr) var(--footer-h);
  width: 100vw;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line-strong);
  background: #050c16;
}

.brand {
  height: 100%;
  min-width: 148px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-right: 1px solid var(--line);
  color: #f3f7fc;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid #397abd;
  border-radius: 3px;
  background: #0e3155;
  color: var(--cyan);
}

.brand-sub { color: var(--muted); font-size: 9px; letter-spacing: .04em; }

.commands { display: flex; align-items: center; gap: 3px; padding: 0 6px; white-space: nowrap; }
.commands button { border-color: transparent; background: transparent; }
.commands button.primary { border-color: #2874bd; background: var(--blue); }
.project-commands { flex-shrink:0; }
.calculation-commands { flex-shrink:0; margin-left:auto; padding-right:8px; }
.commands button.warning-outline { border-color:#e2b94c; color:#fff; background:#c89b14; font-weight:650; }
.commands button.warning-outline:hover, .commands button.warning-outline:focus-visible { border-color:#ffe18a; background:#d8aa20; color:#fff; outline:1px solid #e2b94c; outline-offset:1px; }
button.lsq-action, .commands button.lsq-action { background:#166b42; border-color:#359d68; color:#fff; font-weight:650; }
button.lsq-action:not(:disabled):hover, .commands button.lsq-action:not(:disabled):hover { background:#1d8252; border-color:#64d99a; }
button.lsq-action:focus-visible, .commands button.lsq-action:focus-visible { outline:2px solid #a7efc7; outline-offset:2px; }
button.lsq-action:disabled, .commands button.lsq-action:disabled { background:#203b30; border-color:#355747; color:#91ac9d; cursor:not-allowed; }

.file-chip {
  margin-left: 0;
  flex:1 1 0;
  min-width:0;
  padding: 3px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #a9b9cd;
  border-left: 1px solid var(--line);
  max-width: none;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(300px, var(--workspace-left, 38%), calc(100% - 386px)) 6px minmax(0, 1fr);
  grid-template-rows: clamp(min(140px, 30%), var(--workspace-top, 42%), calc(100% - min(140px, 30%) - 6px)) 6px minmax(0, 1fr);
  gap: 0;
  background: var(--line);
}

.panel { min-width: 0; min-height: 0; background: var(--panel); overflow: hidden; }
.stations-panel { grid-column: 1; grid-row: 1; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.stations-panel > .panel-head { min-height: 32px; flex-wrap: wrap; }
.stations-panel .compact-search { margin-left:auto; }
.orientation-button { background:transparent; padding:2px 5px; font-size:10px; }
.orientation-button.is-set { background:#15533c; border-color:#3a9b71; color:#d9ffed; }
.orientation-button.is-set:hover { background:#20684c; }
.scheme-panel { grid-column: 1; grid-row: 3; display: grid; grid-template-rows: 32px minmax(0, 1fr); }
.detail-panel { grid-column: 3; grid-row: 1 / 4; display: grid; grid-template-rows: 36px minmax(0, 1fr); }
.workspace-divider { background:#102237; touch-action:none; user-select:none; position:relative; }
.column-divider { grid-column:2; grid-row:1 / 4; cursor:col-resize; }
.row-divider { grid-column:1; grid-row:2; cursor:row-resize; }
.workspace-divider::after { content:''; position:absolute; background:#4b6685; border-radius:2px; }
.column-divider::after { width:2px; height:32px; left:2px; top:calc(50% - 16px); }
.row-divider::after { height:2px; width:32px; top:2px; left:calc(50% - 16px); }
.workspace-divider:hover,.workspace-divider:focus-visible,.workspace-divider.dragging { background:#2468a5; outline:none; }
body.resizing-panes,body.resizing-panes * { user-select:none!important; }
body.resizing-columns,body.resizing-columns * { cursor:col-resize!important; }
body.resizing-rows,body.resizing-rows * { cursor:row-resize!important; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 3px 6px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

h1, h2, h3 { margin: 0; font-size: 12px; line-height: 1.25; }
h1, h2 { text-transform: uppercase; letter-spacing: .055em; }
.muted { color: var(--muted); font-size: 10px; }
.compact-search input { width: 82px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.table-scroll { min-height: 0; overflow: auto; scrollbar-color: #34506e #07101c; scrollbar-width: thin; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--font-table); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { height: 20px; padding: 1px 3px; border-right: 1px solid #172840; border-bottom: 1px solid #17263a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table th { position: sticky; top: 0; z-index: 2; height: 22px; background: #0d1d30; color: #91a7c1; font-size: 10px; font-weight: 650; text-align: left; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:nth-child(even) { background: #0a1625; }
.data-table tbody tr:hover { background: #102b49; }
.data-table tbody tr.selected { background: #153d66; color: #fff; }
.data-table tbody tr.issue { box-shadow: inset 2px 0 var(--warning); }
.data-table input, .data-table select { width: 100%; min-height: 18px; height: 18px; padding: 0 2px; border-color: #2b4665; font-size: 10px; }

.stations-table { min-width:570px; }
.stations-table th:nth-child(1) { width:25px; }
.stations-table th:nth-child(2) { width:64px; }
.stations-table th:nth-child(3), .stations-table th:nth-child(4) { width:92px; }
.stations-table th:nth-child(5) { width:69px; }
.stations-table th:nth-child(6) { width:48px; }
.stations-table th:nth-child(7) { width:120px; }
.stations-table th:nth-child(8) { width:26px; }
.stations-table th:nth-child(9) { width:24px; }
.stations-table [data-station-delete] { padding:0 3px; min-height:18px; height:18px; color:#f6a4a4; }
.stations-table [data-station-delete]:disabled { opacity:.25; cursor:default; }
.station-context-menu { position:fixed; z-index:1000; padding:3px; border:1px solid #345476; border-radius:3px; background:#091321; max-width:calc(100vw - 12px); }
.station-context-menu[hidden] { display:none; }
.station-context-menu button { color:#f6a4a4; }
.danger-button { background:#842d35; color:#fff; border-color:#b55860; }
#deleteStationDescription,#deleteStationError { overflow-wrap:anywhere; }
.stations-table td { padding:2px; }
.stations-table input[readonly] { background:transparent; border-color:transparent; cursor:pointer; }
.stations-table input:disabled { opacity:.45; }
.stations-table input:not([data-station-field='name']) { text-align:right; }
.stations-table [data-station-status] { display:block; border:0; padding:0 2px; background:transparent; font-size:9px; }
.stations-table [data-station-status][hidden] { display:none; }
.stations-table [data-station-sdr] { padding:0 3px; min-height:18px; height:18px; }
.stations-table [data-station-sdr]:disabled { opacity:.25; cursor:default; }
.stations-table input:invalid { outline:1px solid var(--danger); }
.stations-table [data-station-field='mode'][data-mode='fixed'],
.stations-table [data-coordinate-status='fixed'] [data-station-status] { color:#9acbff; border-color:#427eb7; background:#102b48; }
.stations-table [data-station-field='mode'][data-mode='preliminary'],
.stations-table [data-coordinate-status='preliminary'] [data-station-status] { color:#f1aaaa; border-color:#a45c66; background:#321b25; }
.stations-table [data-coordinate-status='adjusted'] [data-station-status] { color:#8ddbc3; background:#12372f; }
.stations-table [data-coordinate-status='adjusted'] [data-station-field='mode'][data-mode='none'] { color:#8ddbc3; border-color:#3c8d77; background:#12372f; }
.stations-table [data-coordinate-status='calculated'] [data-station-status] { color:#b2c5dc; background:transparent; }

.state-label { display: inline-block; max-width: 100%; padding: 1px 3px; border: 1px solid #324967; border-radius: 2px; color: #8ea1b8; font-size: 9px; }
.state-label.fixed { border-color: #3c8d77; background: #12372f; color: #8ddbc3; }
.state-label.preliminary { border-color: #786436; background: #332915; color: #e0c276; }

.tool-group { display: flex; align-items: center; gap: 3px; }
.tool-group button { min-width: 24px; min-height: 22px; padding: 1px 5px; }
.check-label { display: inline-flex; align-items: center; gap: 4px; color: #a7b5c6; font-size: 10px; }
.check-label input { min-height: auto; width: 13px; height: 13px; margin: 0; }

.scheme-stage { position: relative; min-height: 0; overflow: hidden; background-color: #050c15; background-image: linear-gradient(#122237 1px, transparent 1px), linear-gradient(90deg, #122237 1px, transparent 1px); background-size: 22px 22px; }
#scheme { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
#scheme.dragging { cursor: grabbing; }
.scheme-edge { stroke: #31577d; stroke-width: 2; vector-effect: non-scaling-stroke; }
.scheme-ray { stroke: #153451; stroke-width: 1; vector-effect: non-scaling-stroke; }
.scheme-point { fill: #617893; opacity: .55; vector-effect: non-scaling-stroke; }
.scheme-hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.scheme-station { fill: #0b1420; stroke: #5f93c8; stroke-width: 3; cursor: pointer; vector-effect: non-scaling-stroke; }
.scheme-station:hover { fill: #1c5d9f; }
.scheme-station.selected { fill: #e9f4ff; stroke: #3d8ee2; stroke-width: 5; }
.scheme-station.fixed { fill: #5cc6a4; stroke: #b4ffe8; }
.scheme-label { fill: #b9c7d8; font-size: 17px; font-weight: 650; paint-order: stroke; stroke: #050c15; stroke-width: 4px; pointer-events: none; }
.scheme-legend { position: absolute; left: 6px; bottom: 5px; display: flex; gap: 10px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 2px; background: rgba(5,12,21,.88); color: #91a0b4; font-size: 9px; }
.scheme-legend span { display: flex; align-items: center; gap: 3px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.station-dot { background: #5f93c8; }.selected-dot { background: #e9f4ff; }.fixed-dot { background: #5cc6a4; }
.target-dot { background: #d4a657; }
.scheme-target { fill: #101923; stroke: #d4a657; stroke-width: 2; cursor: pointer; vector-effect: non-scaling-stroke; }
.scheme-target:hover { fill: #5e481f; }
.scheme-target.selected { fill: #ffe2a8; stroke: #ffffff; stroke-width: 4; }
.scheme-edge.observed { stroke: #7b6337; stroke-dasharray: 5 3; }
.ellipse-toolbar { flex:1 0 100%; display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; padding-top:3px; border-top:1px solid #203148; }
.ellipse-options { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; }
.ellipse-options[hidden] { display:none; }
.ellipse-options label { display:flex; align-items:center; gap:3px; }
.ellipse-options input { width:56px; }
.ellipse-summary { flex:1 0 100%; color:#96adc8; font-size:9px; white-space:normal; }
.error-ellipse { stroke-width:1.5px; vector-effect:non-scaling-stroke; pointer-events:stroke; cursor:pointer; }
.error-ellipse.over-limit { stroke:#ff7474; fill:rgba(255,90,90,.08); }
.error-ellipse.within-limit { stroke:#55c7ab; fill:rgba(85,199,171,.06); }
.error-ellipse:hover,.error-ellipse:focus { stroke:#fff; stroke-width:2.5px; outline:none; }

.detail-head { padding-left: 8px; }
.status-strip { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.status-light { width: 7px; height: 7px; border-radius: 50%; background: #566476; }
.status-light.saved { background: var(--ok); }
.status-light.dirty { background: var(--warning); }

.detail-content { min-height: 0; display: grid; grid-template-rows: auto auto minmax(120px, 1fr); overflow: hidden; }
.journal-status-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:4px; padding:3px 7px; background:#0b1827; border-bottom:1px solid var(--line); font-size:10px; }
.journal-status-bar .has-errors { color:#ffacaf; border-color:#a24e5b; }
.journal-dialog { width:min(1000px,94vw); max-height:90vh; padding:0; border:1px solid #345476; border-radius:4px; background:#091321; color:#e5edf7; font-size:10px; }
.journal-dialog[open] { display:flex; flex-direction:column; }
.journal-dialog::backdrop { background:#0009; }
.journal-dialog-head { display:flex; align-items:center; justify-content:space-between; padding:6px 7px; border-bottom:1px solid var(--line); background:#102339; }
.journal-dialog-head h2 { margin:0; font-size:13px; }
.journal-dialog #journalControlSummary { margin:6px 7px; }
.journal-dialog.has-errors #journalControlSummary { color:#ffacaf; }
.journal-dialog fieldset { margin:3px 7px; border:1px solid #345476; border-radius:3px; }
.journal-dialog .control-options label { display:flex; align-items:center; gap:3px; }
.journal-dialog > :not(.journal-issue-list) { flex-shrink:0; }
.control-options { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 3px 7px; font-size: 10px; }
.control-options label { white-space: nowrap; }
.control-options input { width: 58px; }
.control-note { padding: 0 7px 4px; color: #a9b8ca; }
.journal-issue-list { min-height:0; max-height:55vh; overflow:auto; overscroll-behavior:contain; }
.journal-issue { padding: 3px 7px; border-top: 1px solid #22344b; border-left: 3px solid #426787; font-size: 10px; }
.journal-issue.error { border-left-color: #f1848a; color: #ffb7bd; }
.journal-issue.warning { border-left-color: #d9ad61; color: #f2d093; }
.journal-issue.info { color: #9aacc1; }
.journal-issue button { min-height: 20px; padding: 1px 4px; margin: 2px 2px 0 0; font-size: 10px; }
.measurements-table .journal-error td { background: #341a27; }
.measurements-table .journal-warning td { background: #2c2618; }
.measurements-table .journal-info td:last-child { color: #93adc8; }
.measurements-table .journal-focus td { outline: 1px solid #83bbef; outline-offset: -1px; }
.journal-badge { display: block; max-width: 225px; min-width: 145px; white-space: normal; text-align: left; font-size: 10px; }
.journal-error .journal-badge { color: #ffb7bd; }
.journal-warning .journal-badge { color: #f2d093; }
.editor-block { padding: 5px 7px; border-bottom: 1px solid var(--line); background: #091522; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; min-height: 25px; gap: 8px; }
.constraint-grid { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(130px, 1.25fr) repeat(4, minmax(82px, 1fr)); gap: 4px; }
.constraint-grid label, .orientation-grid label, .measurements-toolbar label { display: flex; flex-direction: column; gap: 2px; color: #8194aa; font-size: 10px; }
.inline-note { margin: 4px 0 0; color: #667b92; font-size: 9px; }
.mini-badge { padding: 1px 4px; border: 1px solid #334962; border-radius: 2px; color: #8495a8; font-size: 9px; }
.mini-badge.active { border-color: #3272ae; background: #112e4b; color: #9fd2ff; }
.orientation-grid { display: grid; grid-template-columns: minmax(120px, 1.1fr) minmax(150px, 1.5fr) 65px 58px 70px auto; gap: 4px; align-items: end; }
.save-orientation { align-self: end; }

.measurements-section { min-height: 0; display: grid; grid-template-rows: 38px minmax(0,1fr); }
.measurements-toolbar { display: flex; align-items: center; gap: 8px; padding: 3px 7px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.measurements-toolbar > div:first-child { margin-right: auto; }
.measurement-search input { width: 112px; }
.measurements-scroll { background: #07111d; }
.measurements-section { grid-template-rows: auto minmax(0,1fr); }
.measurements-toolbar { flex-wrap: wrap; min-height: 38px; }
.measurement-empty td { white-space: normal; padding: 6px 3px; color: var(--warning); }
.scheme-panel > .panel-head { flex-wrap: wrap; height: auto; }
.scheme-panel .tool-group { flex-wrap: wrap; }
.scheme-panel { grid-template-rows: auto minmax(0,1fr); }
.measurements-table th:nth-child(1) { width: 48px; }
.measurements-table th:nth-child(2) { width: 37px; }
.measurements-table th:nth-child(3) { width: 112px; }
.measurements-table th:nth-child(4) { width: 63px; }
.measurements-table th:nth-child(5), .measurements-table th:nth-child(6) { width: 72px; }
.measurements-table th:nth-child(7) { width: 65px; }
.measurements-table th:nth-child(8) { width: 76px; }
.hr-editor { display:flex; align-items:center; gap:2px; }
.hr-editor input { width:52px; min-width:0; text-align:right; }
.hr-editor button { padding:0 2px; min-height:18px; min-width:16px; font-size:10px; }
.hr-editor input:invalid { outline:1px solid #f17b87; }
.measurements-table th:nth-child(9) { width: 64px; }
.measurements-table th:nth-child(10) { width: 150px; }
.height-difference { font-variant-numeric: tabular-nums; }
.role-backsight { color: #83bfff; }
.role-traverse_or_control { color: #f0c978; }
.assignment-modified { color: #ffdc83; font-weight: 700; }
.target-modified { color: #ffe29a; border-color: #886f3b !important; font-weight: 700; }
.route-field { grid-column: span 3; }
.series-results { max-height: 190px; overflow: auto; }

.footerbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 7px; border-top: 1px solid var(--line-strong); background: #050b13; color: #8494a8; font-size: 10px; }
.footer-mode { justify-self: end; }

.toast { position: fixed; right: 10px; bottom: 34px; max-width: 390px; padding: 7px 10px; border: 1px solid #3f668f; border-radius: 3px; background: #102840; color: #edf6ff; box-shadow: 0 8px 26px rgba(0,0,0,.35); opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.project-dialog { width:min(620px,94vw); max-height:90vh; overflow:auto; padding:12px; border:1px solid #345476; border-radius:3px; background:#091321; color:#e5edf7; }
.project-dialog::backdrop { background:#0009; }
.route-dialog { width:min(650px,94vw); font-size:10px; }
.route-dialog .constraint-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.route-dialog .route-field { grid-column:1 / -1; }
.route-dialog input,.route-dialog select { width:100%; min-width:0; }
.route-dialog .tool-group { flex-wrap:wrap; }
.route-dialog #routeCalculationStatus { color:#ffcf82; }
.orientation-dialog { width:min(500px,94vw); font-size:10px; }
.orientation-dialog .orientation-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.orientation-dialog .orientation-station { grid-column:span 1; }
.orientation-dialog .orientation-target { grid-column:span 2; }
.orientation-dialog .orientation-grid input, .orientation-dialog .orientation-grid select { width:100%; min-width:0; }
.orientation-dialog #orientationState { white-space:normal; overflow-wrap:anywhere; }
.orientation-dialog #orientationError { color:#f1aaaa; }
.measurements-toolbar label.check-label { flex-direction:row; align-items:center; gap:4px; }
.project-fields { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.project-fields label { display:flex; flex-direction:column; gap:3px; min-width:0; }
.project-fields input,.project-fields textarea { width:100%; box-sizing:border-box; }
.project-fields label:last-child { grid-column:1/-1; }
.project-fields textarea { min-height:70px; }
.project-dialog .tool-group { margin-top:10px; }
.merge-fields { display:grid; gap:8px; }
.merge-fields label { display:grid; gap:3px; min-width:0; }
.merge-fields input,.merge-fields select { max-width:100%; min-width:0; width:100%; }
#mergeProjectPreview { white-space:pre-line; overflow-wrap:anywhere; color:#a8c7e8; }
#mergeProjectStatus { overflow-wrap:anywhere; }
@media(max-width:650px) { .project-fields { grid-template-columns:1fr; } .commands [data-command='project'], .commands .reports-dropdown button { display:block !important; } }

@media (max-width: 980px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; grid-template-rows: var(--header-h) auto var(--footer-h); }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 250px 330px 620px; }
  .workspace-divider { display:none; }
  .stations-panel { grid-column: 1; grid-row: 1; }
  .scheme-panel { grid-column: 1; grid-row: 2; }
  .detail-panel { grid-column: 1; grid-row: 3; }
  .file-chip { display: none; }
  .commands { overflow-x: auto; }
}

@media (max-width: 650px) {
  :root { --header-h: 38px; }
  .brand { min-width: 96px; }
  .brand-sub { display: none; }
  .commands button:not(.primary) { display: none; }
  .commands button[data-command='control'] { display:block; }
  .journal-dialog { max-height:94vh; overflow:auto; }
  .journal-dialog .control-options label { white-space:normal; }
  .constraint-grid, .orientation-grid { grid-template-columns: 1fr 1fr; }
  .route-field { grid-column: span 2; }
  .footerbar { grid-template-columns: 1fr auto; }
  .footer-mode { display: none; }
}

/* Keep all three actions together on the right; compact second row on narrow screens. */
@media (max-width:1280px) {
  :root { --header-h:76px; }
  .topbar { display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-rows:36px 39px; }
  .topbar .brand { min-width:96px; }
  .topbar .brand-sub { display:none; }
  .topbar .file-chip { display:none; }
  .topbar .project-commands { min-width:0; overflow-x:auto; }
  .topbar .project-commands .reports-dropdown > div { position:fixed; top:36px; left:8px; max-height:calc(100vh - 90px); overflow-y:auto; }
  .topbar .calculation-commands { grid-column:1 / -1; justify-self:end; max-width:100%; margin:0; overflow:visible; }
  .topbar .commands button[data-command='import'] { display:block; }
}
@media (max-width:500px) {
  .calculation-commands { gap:2px; padding:0 4px; }
  .calculation-commands button { padding:2px 4px; font-size:10px; }
}
