.deposit-head { align-items: center; row-gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.deposit-head > div:first-child { display:flex; align-items:center; flex-wrap:wrap; gap:22px; }
.deposit-head h1 { margin:0; }
.deposit-year-actions { display:flex; align-items:center; gap:8px; white-space:nowrap; }
.deposit-year-fields { display:grid; grid-template-columns:1fr 1fr; align-items:start; gap:12px; }
#deposit-dialog-years { height:auto; min-width:6.5em; padding:2px; border:1px solid var(--line); border-radius:4px; color:var(--ink); background:var(--custom-input,var(--paper)); font-variant-numeric:tabular-nums; }
#deposit-dialog-years option { padding:2px 10px; }
.deposit-head label, .deposit-tools label { display:inline-flex; align-items:center; gap:6px; font-weight:600; }
.deposit-tools, .deposit-footer { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; }
.deposit-tools { background:var(--paper); padding:10px; border:1px solid var(--line); border-radius:6px 6px 0 0; }
.deposit-tools button, .deposit-footer button, .deposit-tools select, .deposit-head select { padding:5px 9px; }
.deposit-fill-tools, .deposit-column-tools { display:flex; align-items:center; gap:8px; }
.deposit-column-tools { margin-inline-start:auto; }
:is(.deposit-fill-tools,.deposit-context) input[type=color] { width:34px; height:28px; padding:2px; cursor:pointer; }
.deposit-entry { display:flex; background:var(--paper); border:1px solid var(--line); border-top:0; }
.deposit-entry output { display:grid; align-items:center; min-width:86px; padding:4px 10px; text-align:center; font-variant-numeric:tabular-nums; border-right:1px solid var(--line); }
.deposit-entry button { border:0; border-right:1px solid var(--line); border-radius:0; padding:0 10px; }
.deposit-entry textarea { flex:1; min-width:0; height:36px; resize:none; border:0; padding:8px 12px; color:var(--ink); background:var(--custom-input,var(--paper)); }
.deposit-formula-bar { position:relative; flex:1; min-width:0; overflow:hidden; background:var(--custom-input,var(--paper)); }
.deposit-formula-bar textarea { display:block; position:relative; z-index:2; width:100%; line-height:20px; }
.deposit-formula-mirror { position:absolute; inset:0; z-index:1; overflow:hidden; padding:8px 12px; font:inherit; line-height:20px; text-align:left; color:var(--ink); background:var(--custom-input,var(--paper)); pointer-events:none; }
.deposit-formula-mirror > div { white-space:pre; }
.deposit-formula-token { color:var(--reference-color); background:color-mix(in srgb,var(--reference-color) 10%,white); border-radius:2px; }
.deposit-entry textarea.deposit-formula-colored, .deposit-grid-scroll .deposit-grid td.deposit-editing textarea.deposit-formula-colored { color:transparent; caret-color:var(--ink); background:transparent; text-align:left; white-space:pre; scrollbar-width:none; }
textarea.deposit-formula-colored::-webkit-scrollbar { display:none; }
textarea.deposit-formula-colored::selection { color:var(--ink); background:var(--selected,#b9d5e9); }
.deposit-grid td .deposit-inline-mirror { padding:4px 7px; }
.deposit-grid td textarea.deposit-formula-colored { z-index:2; }
.deposit-grid-scroll { position:relative; overflow:auto; scrollbar-gutter:stable; overscroll-behavior:contain; border:1px solid var(--line); border-top:0; background:var(--paper); }
.deposit-reference-layer { position:absolute; left:0; top:0; z-index:1; pointer-events:none; }
.deposit-reference-box { position:absolute; border:2px solid var(--reference-color); box-shadow:0 0 0 1px white,inset 0 0 0 1px white; pointer-events:none; }
.deposit-reference-box [data-reference-edge], .deposit-reference-box [data-reference-corner] { position:absolute; pointer-events:auto; touch-action:none; }
.deposit-reference-box [data-reference-edge] { cursor:move; }
.deposit-reference-box [data-reference-edge=n], .deposit-reference-box [data-reference-edge=s] { left:0; right:0; height:6px; }
.deposit-reference-box [data-reference-edge=n] { top:-2px; }
.deposit-reference-box [data-reference-edge=s] { bottom:-2px; }
.deposit-reference-box [data-reference-edge=e], .deposit-reference-box [data-reference-edge=w] { top:0; bottom:0; width:6px; }
.deposit-reference-box [data-reference-edge=w] { left:-2px; }
.deposit-reference-box [data-reference-edge=e] { right:-2px; }
.deposit-reference-box [data-reference-corner] { width:8px; height:8px; background:var(--reference-color); border:1px solid white; }
.deposit-reference-box [data-reference-corner=nw] { top:-2px; left:-2px; cursor:nwse-resize; }
.deposit-reference-box [data-reference-corner=ne] { top:-2px; right:-2px; cursor:nesw-resize; }
.deposit-reference-box [data-reference-corner=sw] { bottom:-2px; left:-2px; cursor:nesw-resize; }
.deposit-reference-box [data-reference-corner=se] { bottom:-2px; right:-2px; cursor:nwse-resize; }
.deposit-reference-dragging { user-select:none; }
.deposit-history-tools { display:flex; gap:4px; }
.deposit-selection-summary { display:block; min-height:25px; padding:3px 8px; text-align:right; font-size:12px; white-space:pre-wrap; color:var(--muted); font-variant-numeric:tabular-nums; }
@media print {
  .deposit-reference-layer,.deposit-formula-mirror,.deposit-selection-summary,.deposit-history-tools { display:none !important; }
  .deposit-entry textarea.deposit-formula-colored,.deposit-grid td textarea.deposit-formula-colored { color:inherit !important; }
}
.deposit-final-row .deposit-footer { padding-top:calc(10px + var(--end-space,0px)); }
.deposit-grid { border-spacing:0; table-layout:fixed; width:100%; min-width:1150px; color:var(--ink); outline-offset:-2px; }
.deposit-grid :is(td,th) { border:0; border-right:1px solid var(--line); border-bottom:1px solid var(--line); }
.deposit-grid thead th { position:sticky; top:0; z-index:3; background:var(--green); white-space:normal; }
.deposit-grid tbody th { position:sticky; left:0; z-index:2; padding:0; background:var(--paper); }
.deposit-grid th button { display:block; width:100%; padding:4px 3px; border:0; border-radius:0; color:inherit; background:transparent; }
.deposit-grid tbody th button { height:calc(var(--row-height,30px) - 1px); min-height:0; padding:0 3px; line-height:20px; }
.deposit-grid th small { display:block; font-weight:400; color:var(--muted); }
.deposit-grid td { position:relative; padding:4px 7px; height:var(--row-height,30px); vertical-align:middle; background:var(--paper); white-space:pre-wrap; overflow-wrap:anywhere; user-select:none; cursor:cell; font-variant-numeric:tabular-nums; }
.deposit-grid td.marked { --selection-tint:color-mix(in srgb,var(--selected,#90bfaa) 26%,transparent); box-shadow:inset 0 0 0 1px var(--selection-line,#3b775c); background-image:linear-gradient(var(--selection-tint),var(--selection-tint)); }
.deposit-grid td.current { outline:2px solid var(--selection-line,#276744); outline-offset:-2px; }
.deposit-grid td.deposit-fill-preview { outline:2px dashed var(--selection-line,#276744); outline-offset:-2px; }
.deposit-grid .deposit-fill-handle { position:absolute; right:-1px; bottom:-1px; z-index:2; width:10px; height:10px; min-width:0; min-height:0; padding:0; border:1px solid var(--paper); border-radius:0; background:var(--selection-line,#276744); cursor:crosshair; touch-action:none; }
.deposit-cell-text { display:block; height:20px; line-height:20px; overflow:hidden; white-space:pre; }
.deposit-grid td > .deposit-cell-text { position:absolute; left:7px; right:7px; top:50%; transform:translateY(-50%); }
.deposit-grid td[data-text-mode=wrap] > .deposit-cell-text { height:auto; max-height:calc(var(--row-height,30px) - 9px); white-space:pre-wrap; overflow-wrap:anywhere; }
.deposit-overflow { position:absolute; left:7px; top:50%; transform:translateY(-50%); z-index:1; width:calc(var(--stop) - var(--start) - 8px); overflow:hidden; pointer-events:none; }
.deposit-overflow .deposit-cell-text { width:max-content; min-width:calc(var(--next) - var(--start) - 15px); }
.deposit-grid td.deposit-editing .deposit-overflow { visibility:hidden; }
.deposit-grid td[data-note]::after { content:""; position:absolute; top:0; right:0; border-top:6px solid var(--muted); border-left:6px solid transparent; pointer-events:none; }
.deposit-grid td textarea { position:absolute; inset:0; box-sizing:border-box; width:100%; height:100%; min-height:0; margin:0; padding:4px 7px; border:0; line-height:20px; resize:none; text-align:inherit; color:var(--ink); background:var(--custom-input,var(--paper)); user-select:text; }
.deposit-grid thead th > button { overflow:hidden; text-overflow:ellipsis; }
.deposit-resizer { position:absolute; z-index:1; top:0; bottom:0; right:0; width:8px; cursor:col-resize; touch-action:none; }
.deposit-resizer:hover { background:var(--selection-line,#699a7b); }
.deposit-row-resizer { position:absolute; z-index:1; bottom:0; left:0; right:0; height:6px; cursor:row-resize; touch-action:none; }
.deposit-row-resizer:is(:hover,:focus-visible) { background:var(--selection-line,#699a7b); }
.deposit-popup { position:fixed; inset:auto; z-index:20; margin:0; padding:6px; border:1px solid var(--line); border-radius:6px; background:var(--paper); color:var(--ink); box-shadow:0 4px 18px #0003; }
.deposit-context { max-width:calc(100vw - 8px); max-height:calc(100vh - 8px); overflow:auto; }
.deposit-context fieldset { margin:3px 0 7px; border:0; padding:2px 6px; }
.deposit-context legend { color:var(--muted); font-size:.85em; }
.deposit-context fieldset div { display:flex; gap:3px; flex-wrap:wrap; }
.deposit-context button { padding:4px 6px; }
.deposit-swatch { display:block; width:18px; height:16px; border:1px solid #0004; }
.deposit-context-actions { display:grid; border-top:1px solid var(--line); }
.deposit-context-actions button { text-align:left; border:none; }
.deposit-row-menu button { display:block; width:100%; text-align:left; border:0; }
.deposit-grid tbody th[data-selected] { background:var(--green); }
.deposit-context label { display:inline-flex; align-items:center; gap:4px; }
.deposit-project-info hr { border:0; border-top:1px solid var(--line); margin:6px 0; }
.deposit-project-info a:not([hidden]) { display:block; padding:4px 0; }
.deposit-suggestions { width:max-content; min-width:200px; max-width:min(460px,calc(100vw - 8px)); max-height:min(220px,40vh); overflow:auto; }
.deposit-suggestions [role=option] { padding:5px 8px; cursor:pointer; }
.deposit-suggestions [role=option]:hover,.deposit-suggestions [aria-selected=true] { background:var(--green); }
.deposit-footer { position:sticky; left:0; width:fit-content; max-width:100%; padding:10px; }
#deposit-status { margin-left:auto; font-weight:600; }
.deposit-access { max-width:760px; }
.deposit-access tbody th { text-align:left; font-weight:500; }
.deposit-access :is(th,td):nth-child(n+2) { text-align:center; }
.deposit-error:not(:empty) { margin-bottom:10px; }
.spreadsheet-appearance-settings { padding:18px; margin-bottom:24px; border:1px solid var(--line); border-radius:6px; background:var(--paper); }
.spreadsheet-appearance-settings h2 { margin-top:0; }
.spreadsheet-appearance-preview { overflow:auto; background:var(--paper); border:1px solid var(--line); }
.spreadsheet-appearance-preview .deposit-grid { min-width:560px; }
@media screen {
  [data-sheet-theme]:not([data-sheet-theme="default"]) .deposit-grid th button { background:transparent; color:inherit; border-color:var(--line); }
  [data-sheet-theme]:not([data-sheet-theme="default"]) .deposit-footer button { background:var(--paper); color:var(--ink); border-color:var(--line); }
  [data-sheet-theme]:not([data-sheet-theme="default"]) .deposit-footer button:hover { background:var(--green); }
  [data-sheet-theme]:not([data-sheet-theme="default"]) .deposit-grid td textarea { background:var(--custom-input); color:var(--ink); }
}
@media(max-width:700px) {
  .deposit-head > div:first-child { gap:12px; }
  .deposit-year-actions button { padding-inline:8px; }
  #deposit-status { margin-left:0; }
}

/* Only spreadsheet pages use the window as a fixed frame. Settings and reports
   keep their normal page scrolling; the grid owns spreadsheet scrolling. */
@media screen {
  body.spreadsheet-page { height:100vh; height:100dvh; overflow:hidden; }
  body.spreadsheet-page #app { height:100%; display:flex; flex-direction:column; }
  body.spreadsheet-page #app > :not(main) { flex:none; }
  body.spreadsheet-page main { display:flex; flex-direction:column; flex:1; min-height:0; min-width:0; width:100%; max-width:none; margin:0; padding-block:16px 12px; }
  body.spreadsheet-page main > :not(.deposit-grid-scroll) { flex:none; }
  .deposit-grid-scroll { flex:1; min-height:0; }
}
@media screen and (max-width:700px), screen and (max-height:600px) {
  body.spreadsheet-page .topbar { height:auto; min-height:0; flex-wrap:nowrap; gap:8px; padding:0 12px; }
  body.spreadsheet-page .main-areas { flex:1; min-width:0; flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; gap:16px; }
  body.spreadsheet-page .main-areas .brand { flex:none; white-space:nowrap; font-size:17px; padding:8px 0; }
  body.spreadsheet-page .top-actions { flex:none; }
  body.spreadsheet-page .nav a { padding-block:8px; }
  body.spreadsheet-page main { padding-block:8px 12px; }
  .deposit-head { flex-direction:row; gap:8px; margin-bottom:8px; }
  .deposit-head > div:first-child { gap:8px; }
  .deposit-head h1 { font-size:22px; }
  .deposit-head button { padding:5px 9px; }
  .deposit-tools { flex-wrap:nowrap; overflow-x:auto; padding:6px; gap:8px; }
  .deposit-tools > * { flex:none; }
}
