:root {
  color-scheme: light;
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  --ink: #1b1915;
  --muted: #6f6b62;
  --ivory: #f7f5ef;
  --paper: #fffefa;
  --border: #ded7c9;
  --line-soft: #ebe6dc;
  --gold: #d5a019;
  --gold-bright: #f4b400;
  --accent: #79570b;
  --soft: #fff4cf;
  --shadow: 0 14px 36px rgb(43 34 17 / .08);
  --serif: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--ivory);
}

:root.high-contrast {
  --ink:#000;
  --muted:#252525;
  --ivory:#fff;
  --paper:#fff;
  --border:#000;
  --line-soft:#444;
  --gold:#8a5a00;
  --accent:#000;
  --soft:#fff2a8;
  --shadow:none;
}
:root.high-contrast button:focus-visible,:root.high-contrast input:focus-visible,
:root.high-contrast select:focus-visible,:root.high-contrast summary:focus-visible,:root.high-contrast a:focus-visible {outline-width:3px;}
:root.large-text { font-size:17px; }

*, *::before, *::after { box-sizing: border-box; }
progress[data-transfer-progress],progress[data-operation-progress] { width:100%; min-height:14px; accent-color:var(--gold); }
body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(ellipse at 83% 0%, #efdfb755, transparent 40rem), var(--ivory);
}
button, input, select, summary { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, input, select, summary { border-radius: 9px; }
button { background: var(--paper); border: 1px solid var(--border); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
input, select { background: var(--paper); border: 1px solid var(--border); }
input::placeholder { color: var(--muted); }
button, input, select, summary { min-width: 0; }
button svg, summary svg, .brand svg, .search svg { width: 18px; height: 18px; flex: none; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.025em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.primary, .secondary {
  min-height: 40px;
  padding: 7px 13px;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  font-weight: 650;
  white-space: nowrap;
}
.primary {
  background: linear-gradient(145deg, #2a2925, #171716);
  border: 1px solid #3c3a33;
  border-bottom: 3px solid var(--gold);
  color: #fffefa;
  box-shadow: 0 6px 15px rgb(35 30 18 / .11);
}
.primary:hover { background: linear-gradient(145deg, #393225, #222017); }
.secondary { background: var(--paper); }
.secondary:hover, .icon-button:hover:not(:disabled) { background: var(--soft); }
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  font-weight: 700;
}

.workbook-home { min-height: 100dvh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.library-sidebar, .sign-in-brand {
  color: var(--paper);
  background: radial-gradient(ellipse at 40% 0%, #423723, transparent 23rem), linear-gradient(#1b1b19, #111110);
  border-right: 1px solid #ac852949;
}
.library-sidebar { padding: 24px 16px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 19px;
  font-weight: 730;
  letter-spacing: -.025em;
  text-decoration: none;
  white-space: nowrap;
}
.library-sidebar .brand { margin: 0 8px 38px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(145deg, #fffdf7, #efe5d0); border: 1px solid #d6bb7d; color: var(--accent); }
.brand-mark svg { width: 21px; height: 21px; }
.library-sidebar nav { display: grid; gap: 4px; }
.library-sidebar nav button { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid transparent; border-left: 3px solid transparent; background: transparent; text-align: left; color: #e4dfd4; }
.library-sidebar nav button:hover, .library-sidebar [aria-current="page"] { background: linear-gradient(90deg, #f4b4002b, #f4b4000c); color: white; border-left-color: var(--gold-bright); }
.library-sidebar [aria-current="page"] { font-weight: 680; }
.library-top { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px clamp(18px, 4vw, 54px); border-bottom: 1px solid var(--border); background: #fffefaf5; }
.library-top > span { font-weight: 660; color: var(--muted); }
.library-content { margin-inline: auto; max-width: 1280px; padding: 43px clamp(18px, 4vw, 54px) 64px; }
.library-heading h1 { font-size: clamp(30px, 4vw, 43px); line-height: 1.15; }
.library-heading p { margin-top: 8px; color: var(--muted); }
.start-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin: 27px 0 39px; }
.start-card { display: flex; align-items: flex-start; gap: 12px; min-height: 109px; text-align: left; padding: 20px 16px; border-radius: 15px; background: linear-gradient(135deg, var(--paper), #f8f3e8); border-color: var(--line-soft); box-shadow: var(--shadow); }
.start-card:hover { border-color: #ceaa5a; background: linear-gradient(135deg, var(--paper), #f7e9c5); }
.start-icon, .book-icon { display: grid; place-items: center; color: var(--accent); background: var(--soft); border: 1px solid #e9d69f; border-radius: 8px; flex: none; }
.start-icon { width: 38px; height: 38px; }
.start-icon svg { width: 20px; height: 20px; }
.start-card strong, .workbook-name strong { display: block; }
.start-card strong { font: 500 1.24rem/1.2 var(--serif); }
.start-card small, .workbook-name small, .version-list small { display: block; color: var(--muted); margin-top: 3px; }
.workbook-list > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.library-heading + .workbook-list { margin-top: 28px; }
.workbook-list h2 { font-size: 24px; }
.search { display: inline-flex; align-items: center; gap: 7px; width: min(100%, 255px); border: 1px solid var(--border); background: var(--paper); border-radius: 9px; padding: 0 10px; color: var(--muted); }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px #f4b40020; }
.search input { width: 100%; height: 38px; outline: 0; border: 0; background: transparent; }
.search input:focus-visible { outline: 0; }
.empty-state { border: 1px dashed var(--border); border-radius: 12px; background: #fffdf7; color: var(--muted); text-align: center; padding: 32px 15px; }
.library-table { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 13px; box-shadow: var(--shadow); }
.library-table table { width: 100%; border-spacing: 0; }
.library-table th, .library-table td { padding: 10px 16px; text-align: left; }
.library-table th { color: #6b5d40; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; background: #f3efe5; }
.library-table th:first-child { border-radius: 12px 0 0 0; }
.library-table th:last-child { border-radius: 0 12px 0 0; }
.library-table td { border-top: 1px solid var(--line-soft); }
.library-table tr:hover td { background: #fdf8eb; }
.library-table td:nth-child(2), .library-table td:nth-child(3), .library-table td:nth-child(4) { color: var(--muted); font-size: 13px; }
.library-table td:nth-child(2) { width: 12%; }
.library-table td:nth-child(3) { width: 19%; }
.library-table td:nth-child(3) strong, .library-table td:nth-child(3) small { display:block; }
.library-table td:nth-child(4) { width: 20%; }
.library-table .row-action { text-align: right; width: 1%; }
.workbook-name { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 0; text-align: left; overflow-wrap: anywhere; }
button.workbook-name:hover strong { color: var(--accent); text-decoration: underline; }
.book-icon { width: 35px; height: 35px; }

.workbook-menu, .export-menu { position: relative; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.workbook-menu summary { display: grid; place-items: center; width: 34px; height: 34px; }
.workbook-menu summary:hover, .workbook-menu[open] summary { background: var(--soft); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 167px; display: grid; gap: 2px; border: 1px solid var(--border); border-radius: 9px; padding: 5px; box-shadow: var(--shadow); background: var(--paper); }
.menu-panel button, .menu-panel a { color: var(--ink); display: block; padding: 7px 9px; border: 0; border-radius: 5px; text-align: left; text-decoration: none; white-space: nowrap; }
.menu-panel button:hover, .menu-panel a:hover { background: var(--soft); }

.editor { height: 100dvh; min-height: 260px; display: flex; flex-direction: column; overflow: hidden; background: white; }
.editor-header, .editor-toolbar, .formula-bar, .editor-footer { display: flex; align-items: center; flex: none; border-bottom: 1px solid var(--border); }
.editor-header { position: relative; z-index: 10; min-height: 65px; padding: 9px 16px; gap: 15px; background: linear-gradient(110deg, var(--paper), #f6efdf); }
.editor-header .brand { padding-right: 15px; border-right: 1px solid var(--border); border-radius: 0; }
.editor-name { flex: 1; min-width: 0; }
.editor-name input { width: min(420px,100%); padding: 1px 5px; margin-left: -5px; font: 500 1.45rem/1.15 var(--serif); letter-spacing: -.025em; border: 1px solid transparent; background: transparent; text-overflow: ellipsis; }
.editor-name input:hover, .editor-name input:focus { border-color: var(--border); background: white; }
[data-save-status] { min-height: 16px; font-size: 11px; color: var(--muted); }
[data-save-status].threat { color: #8d3c17; }
.header-actions { display: flex; gap: 8px; }
.editor-toolbar { padding: 4px 12px; gap: 8px; background: #f6f3eb; overflow-x: auto; }
.tool-group { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 8px; border-right: 1px solid var(--border); }
.tool-group:last-child { border-right: 0; padding-right: 0; }
.tool-group [aria-pressed="true"] { background: var(--soft); color: var(--accent); border-color: #e4cc8e; }
.toolbar-button { height: 32px; padding: 4px 8px; border-color: transparent; white-space: nowrap; background: transparent; }
.toolbar-button:hover, .toolbar-button.toolbar-active { background: var(--soft); color: var(--accent); }
.italic-tool { font-style: italic; }
.tool-group select { appearance: none; padding: 4px 25px 4px 6px; height: 32px; border: 1px solid transparent; cursor: pointer; font-size: 13px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236f6b62' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") right 5px center / 14px no-repeat; }
.tool-group select:hover { background-color: var(--soft); }
.color-tool { position: relative; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; font-weight: 700; }
.color-tool:hover { background: var(--soft); }
.color-tool input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.color-tool:focus-within { outline: 2px solid var(--accent); }
.color-tool span { border-bottom: 2px solid currentColor; }
.fill-tool span { width: 14px; height: 14px; border: 1px solid #c4a761; border-radius: 3px; background: var(--soft); }
.formula-bar { min-height: 37px; background: #fff; }
.formula-bar input { height: 34px; border: 0; border-radius: 0; padding: 0 9px; }
.formula-bar input:focus-visible { outline-offset: -2px; }
.formula-bar .name-box { flex: none; width: 113px; border-right: 1px solid var(--border); font: 12px ui-monospace, monospace; }
.function-mark { padding: 0 10px; font: italic 16px Georgia, serif; color: var(--muted); border-right: 1px solid var(--border); }
.formula-input { flex: 1; font: 13px ui-monospace, monospace; }
.editor-banner { flex: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 5px 12px; border-bottom: 1px solid #e7d9a6; background: #fcf6e0; color: #644e21; font-size: 13px; }
.editor-banner button { padding: 3px 8px; border-color: #dfd3ad; }

.grid-workspace { display:grid; grid-template-columns:minmax(0,1fr); flex:1; min-height:0; }
.grid-workspace.is-split { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1px; background:var(--border); }
.worksheet-pane { display:flex; min-width:0; min-height:0; flex-direction:column; background:white; overflow:hidden; }
.split-pane > header { display:flex; align-items:center; gap:9px; min-height:38px; padding:4px 8px; border-bottom:1px solid var(--border); background:var(--ivory); font-size:12px; }
.split-pane > header label { display:flex; align-items:center; gap:6px; }
.split-pane > header select { max-width:150px; }
.split-pane > header [data-split-status] { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); }
.grid-viewport { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; user-select: none; outline: none; background: white; }
.grid-surface { position: relative; }
.cell-layer, .header-layer, .grid-overlay { position: absolute; inset: 0; pointer-events: none; }
.grid-row, .grid-cell, .grid-pane, .grid-divider, .column-label, .row-label, .grid-corner, .cell-editor { position: absolute; }
.grid-pane { overflow: hidden; }
.grid-divider { z-index: 3; background: #c9b47e; }
.grid-cell { pointer-events: auto; align-content: center; padding: 0 7px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.2; }
.grid-cell.merged { z-index: 1; }
.grid-cell[aria-selected="true"] { box-shadow: inset 0 0 0 100vmax #e1ac1b1c; }
.grid-cell.active { z-index: 2; outline: 2px solid #ab790b; outline-offset: -2px; box-shadow: none; }
.header-layer { z-index: 5; }
.grid-overlay { z-index: 4; }
.column-label, .row-label, .grid-corner { display: grid; place-items: center; background: #f2eee4; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.grid-corner { z-index: 2; }
.column-label { z-index: 1; }
.column-label.chosen, .row-label.chosen { background: var(--soft); color: var(--accent); font-weight: 690; }
.cell-editor { pointer-events: auto; border: 2px solid #ab790b; border-radius: 0; padding: 0 5px; font-size: 13px; outline: 0; }
.cell-editor:focus-visible { outline: 0; }
.editor-footer { min-height: 39px; padding: 0 6px; border-bottom: 0; border-top: 1px solid var(--border); background: #f8f5ed; }
.sheet-tabs { display: flex; flex: 1; min-width: 0; align-items: center; gap: 3px; padding: 3px 1px; overflow: auto; }
.sheet-tabs button { flex: none; min-height: 29px; padding: 3px 9px; border: 1px solid transparent; background: transparent; white-space: nowrap; }
.sheet-tabs button:hover { background: var(--soft); }
.sheet-tabs button[aria-current="true"] { font-weight: 680; background: var(--soft); border-color: #e4cc8e; color: var(--accent); }
.selection-summary { flex: none; padding: 0 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.popup { width: min(488px, calc(100% - 24px)); max-height: calc(100% - 32px); border: 1px solid var(--border); border-radius: 18px; padding: 0; background: var(--paper); box-shadow: 0 18px 62px #24201955; color: var(--ink); }
.popup::backdrop { background: #221e185e; }
.popup header, .popup section, .popup footer { padding: 14px 18px; }
.popup header { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); background: linear-gradient(110deg, var(--paper), #f5ecd9); }
.popup h2 { font-size: 24px; }
.popup section label { display: grid; gap: 6px; }
.popup section input { padding: 8px 10px; }
.popup section p + p { margin-top: 8px; }
.layout-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.data-fields { display: grid; gap: 12px; }
.data-fields .layout-fields { margin-top: 0; }
.data-fields select { min-height: 38px; padding: 5px 7px; }
.data-fields p { color: var(--muted); }
.data-fields label.check-field { display: flex; gap: 7px; align-items: center; }
.check-field input { accent-color: var(--accent); }
.filter-banner { background: #f5f0e3; border-bottom-color: var(--border); }
.popup footer { display: flex; gap: 7px; justify-content: flex-end; background: var(--ivory); border-top: 1px solid var(--line-soft); }
.inline-error { margin-top: 8px; color: #9d361e; }
.version-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.version-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.version-list li + li { border-top: 1px solid var(--border); }
.current-version { color: var(--accent); }
.notice { position: fixed; z-index: 20; bottom: 52px; right: 14px; max-width: calc(100% - 28px); padding: 9px 14px; border-radius: 8px; background: #29261f; color: white; border-bottom: 2px solid var(--gold); box-shadow: var(--shadow); }

.sign-in { display: grid; grid-template-columns: minmax(265px, 2fr) 3fr; min-height: 100dvh; }
.sign-in-brand { display: grid; place-items: center; padding: 26px; }
.sign-in-identity { display: flex; align-items: center; gap: 14px; font: 500 clamp(24px, 4vw, 40px)/1.1 var(--serif); }
.sign-in-identity .brand-mark { width: 54px; height: 54px; border-radius: 13px; }
.sign-in-identity .brand-mark svg { width: 30px; height: 30px; }
.sign-in-content { display: grid; place-items: center; padding: 26px; }
.sign-in-card { display: grid; gap: 8px; width: min(100%, 428px); padding: clamp(22px, 5vw, 40px); border: 1px solid var(--line-soft); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.sign-in-card h1 { font-size: clamp(28px, 4vw, 36px); line-height: 1.1; margin-bottom: 16px; }
.sign-in-card label { font-weight: 650; color: var(--muted); }
.sign-in-card input { width: 100%; min-height: 44px; padding: 8px 12px; }
.sign-in-card .primary { margin-top: 9px; min-height: 44px; }
.sign-in-card .inline-error { margin: 0; }

@media (max-width: 840px) {
  .workbook-home { grid-template-columns: 156px minmax(0, 1fr); }
  .library-sidebar { padding-inline: 11px; }
  .start-card { flex-direction: column; }
}
@media (max-width: 610px) {
  .workbook-home { display: block; }
  .library-sidebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; }
  .library-sidebar .brand { margin: 0; }
  .library-sidebar nav { display: flex; gap: 3px; }
  .library-sidebar nav { overflow-x: auto; overscroll-behavior-inline: contain; }
  .library-sidebar nav button { padding: 7px; }
  .library-sidebar nav svg { display: none; }
  .library-top { min-height: 55px; }
  .library-top > span { font-size: 12px; }
  .library-content { padding-top: 28px; }
  .start-actions { grid-template-columns: 1fr; gap: 7px; margin-block: 18px 27px; }
  .start-card { flex-direction: row; align-items: center; min-height: 60px; padding: 8px 11px; }
  .library-table td, .library-table th { padding: 8px; }
  .library-table td:nth-child(2), .library-table td:nth-child(3), .library-table td:nth-child(4) { font-size: 11px; }
  .editor-header { padding-inline: 8px; gap: 8px; }
  .editor-header .brand { padding-right: 8px; }
  .editor-header .brand > span:last-child, .header-actions button > span { display: none; }
  .header-actions { gap: 5px; }
  .header-actions .secondary, .header-actions .primary { padding-inline: 8px; }
  .selection-summary { max-width: 43%; overflow: hidden; text-overflow: ellipsis; }
  .grid-workspace.is-split { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(160px,1fr) minmax(160px,1fr); }
  .split-pane > header label { font-size:0; }
  .split-pane > header select { max-width:120px; font-size:12px; }
  .sign-in { grid-template-columns: 1fr; grid-template-rows: minmax(76px, auto) 1fr; }
  .sign-in-brand { place-items: start; border-right: 0; border-bottom: 1px solid #ac852949; padding: 14px 20px; }
  .sign-in-identity .brand-mark { width: 46px; height: 46px; }
}

.fill-handle { position:absolute; z-index:5; border:1px solid #fff; border-radius:2px; background:#8c6416; cursor:crosshair; pointer-events:auto; touch-action:none; }
.grid-cell.fill-preview { box-shadow:inset 0 0 0 1px #b08828; }
.collaborators { color:#6e5621; font-size:.78rem; max-width:18rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.formula-bar [data-cell-choices] { flex:0 0 auto; color:#785916; padding-inline:12px; }
.tool-options { margin-block:0 18px; }
.tool-options h3 { margin:0 0 8px; font-size:1rem; }
.tool-options div { display:flex; flex-wrap:wrap; gap:8px; }
.popup .data-fields textarea { width:100%; padding:8px; border:1px solid var(--border); border-radius:6px; resize:vertical; font:inherit; }
.popup section > label:has(textarea) textarea { width:100%; }
.popup .check-label { display:flex; align-items:center; gap:8px; }
.popup .check-label input { width:auto; }
.report-table { max-width:100%; overflow:auto; margin-block:10px; }
.report-table table { width:100%; border-collapse:collapse; }
.report-table th,.report-table td { padding:7px 9px; border:1px solid #ded5c6; text-align:left; overflow-wrap:anywhere; }
.report-table th { background:#f2eadd; }
.report-chart { width:100%; max-width:680px; height:auto; background:#fbf8f1; border-radius:6px; }
.sheet-print { display:none; }
@media print {
  body > :not(.sheet-print) { display:none !important; }
  html, body { background:white !important; color:black; overflow:visible !important; height:auto !important; }
  .sheet-print { display:block; font:10pt system-ui,sans-serif; }
  .sheet-print .report-table { overflow:visible; }
  .sheet-print thead { display:table-header-group; }
  .sheet-print tr { break-inside:avoid; }
}
@media (min-width:1000px) { .start-actions { grid-template-columns:repeat(4,minmax(0,1fr)); } }

.library-filters { display:flex; flex-wrap:wrap; gap:12px; padding:8px 14px; color:var(--muted); }
.library-filters label { display:flex; align-items:center; gap:6px; }
.library-filters select { max-width:15rem; }
.formula-suggestions { display:flex; gap:6px; flex-wrap:wrap; align-items:center; padding:7px 12px; background:var(--paper); border-bottom:1px solid var(--border); }
.formula-suggestions p { margin:0 10px 0 0; font-size:.85rem; }
.formula-suggestions button { min-height:28px; padding:4px 9px; }
.grid-cell.reference-0 { box-shadow:inset 0 0 0 2px #8f6923; }
.grid-cell.reference-1 { box-shadow:inset 0 0 0 2px #317566; }
.grid-cell.reference-2 { box-shadow:inset 0 0 0 2px #655799; }
.grid-cell.reference-3 { box-shadow:inset 0 0 0 2px #a65042; }
.import-mapping { max-height:230px; overflow:auto; }
.import-mapping > div { display:grid; grid-template-columns:minmax(135px,2fr) minmax(65px,1fr) minmax(95px,1fr); align-items:end; gap:9px; padding-block:5px; }
.import-mapping input[type="number"] { width:100%; }
.selection-summary { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:620px) {
  .formula-suggestions { max-height:105px; overflow:auto; }
  .selection-summary { max-width:48vw; }
  .popup .tool-options .secondary { min-height:36px; }
}
.dashboard-numbers { display:grid; grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); gap:8px; margin-block:9px; }
.dashboard-numbers > div { padding:10px 12px; border:1px solid var(--border); border-radius:8px; background:var(--paper); }
.dashboard-numbers strong,.dashboard-numbers small { display:block; }
.dashboard-numbers strong { font-size:1.3rem; }
.dashboard-shell { padding:4px; border-radius:10px; }
.dashboard-shell.dashboard-wide .report-chart { max-width:100%; }
.dashboard-shell.dashboard-compact .dashboard-numbers > div { padding:6px 8px; }
.dashboard-shell.dashboard-compact .report-chart[height="180"] { display:none; }
.dashboard-shell.dashboard-midnight { padding:14px; color:#f6f0df; background:#1e2630; }
.dashboard-shell.dashboard-midnight .dashboard-numbers > div,.dashboard-shell.dashboard-midnight .report-table th { color:#f6f0df; background:#303b48; border-color:#596675; }
.dashboard-shell.dashboard-midnight .report-table td { border-color:#596675; }
.dashboard-shell.dashboard-forest { padding:14px; background:#edf4ed; }
.dashboard-shell.dashboard-forest .dashboard-numbers > div { background:#f7fbf6; border-color:#a8bea8; }
.dashboard-description { margin:2px 0 10px; color:inherit; }
.kpi-variance { display:block; margin-top:4px; font-size:.74rem; }
.kpi-variance.positive { color:#26715c; }
.kpi-variance.negative { color:#a34736; }
.dashboard-midnight .kpi-variance.positive { color:#7bd1b4; }
.dashboard-midnight .kpi-variance.negative { color:#ff9f91; }
.report-chart:focus-visible { outline:2px solid var(--gold); }
.cell-sparkline { display:block; margin:1px 0; }
.comment-reply { padding-inline-start:14px; border-inline-start:2px solid var(--line-soft); }
.mobile-control { display:none; }
@media (pointer:coarse), (max-width:620px) { .mobile-control { display:inline-flex; } }
@media print { .sheet-print > img { max-width:100%; height:auto; } }

.grid-cell.spill-result { color: #385f51; background-color: #f4faf6; }
.grid-cell.spill-result.active { box-shadow: inset 0 0 0 2px #587e6b; }

.grid-cell, .cell-editor { font-size:calc(13px * var(--grid-scale, 1)); }
.grid-zoom { margin:3px 4px; padding:3px 6px; font-size:12px; width:auto; }
.grid-resize-handle { position:absolute; pointer-events:auto; touch-action:none; }
.column-label .grid-resize-handle { top:0; right:0; height:100%; width:7px; cursor:col-resize; }
.row-label .grid-resize-handle { bottom:0; left:0; width:100%; height:7px; cursor:row-resize; }
.grid-resize-handle:hover { background:#b0882850; }
.resizing-columns, .resizing-columns * { cursor:col-resize !important; }
.resizing-rows, .resizing-rows * { cursor:row-resize !important; }
.sheet-tabs button[style*="--tab-color"] { box-shadow:inset 0 -3px var(--tab-color); }

.command-item { display:inline-flex; align-items:center; }
.command-item .secondary { border-start-end-radius:0; border-end-end-radius:0; }
.command-pin { align-self:stretch; padding:0 8px; border:1px solid var(--border); border-left:0; border-radius:0 7px 7px 0; color:var(--accent); background:var(--paper); }
.command-pin:hover, .command-pin[aria-pressed="true"] { background:var(--soft); }
