/* ── Sheet spaces (founder 2026-09-28) ──
   A Sheet space swaps the add form and the bookmark cards for a sheet that
   reads like a spreadsheet at a glance: a grey heading band and row-number
   gutter, hairline gridlines, 24px rows, one plain 13px type with no bold,
   italics or capitals ("optimised for density and clarity of reading", up to
   1,000 rows), numbers right-aligned, values shown exactly as stored. The
   active cell keeps the app's orange ring. */
#wallet-view .wallet-plus-card-panel.is-ledger .wallet-plus-card-form,
#wallet-view .wallet-plus-card-panel.is-ledger .wallet-bookmark-card-feedback,
#wallet-view .wallet-plus-card-panel.is-ledger .wallet-bookmark-card-retry,
#wallet-view .wallet-plus-card-panel.is-ledger .wallet-plus-card-list,
#wallet-view .wallet-plus-card-panel.is-ledger .wallet-bookmark-sync-group { display: none; }

#wallet-bookmark-space-menu #wallet-bookmark-space-type-sheet {
  position: relative;
  margin-left: 0;
  width: auto;
  padding-left: 22px;
  padding-right: 30px;
  font-weight: 500;
}
#wallet-bookmark-space-menu #wallet-bookmark-space-type-sheet[hidden] { display: none; }

#wallet-view .wallet-ledger { display: grid; gap: 8px; min-width: 0; }
#wallet-view .wallet-ledger[hidden] { display: none; }
#wallet-view .wallet-ledger-scroll {
  position: relative;
  max-height: min(70vh, 626px);        /* heading band + 25 rows */
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
#wallet-view .wallet-ledger-grid {
  --ledger-rule: color-mix(in srgb, var(--border) 90%, transparent);
  --ledger-band: var(--raised);
  min-width: 792px;
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
#wallet-view .wallet-ledger-row {
  display: grid;
  grid-template-columns: 40px minmax(220px, 1.6fr) minmax(96px, 0.7fr) minmax(220px, 1.6fr) minmax(96px, 0.7fr) minmax(120px, 0.9fr);
  min-height: 24px;
}
#wallet-view .wallet-ledger-row > * {
  min-width: 0;
  border-right: 1px solid var(--ledger-rule);
  border-bottom: 1px solid var(--ledger-rule);
}
#wallet-view .wallet-ledger-row > :last-child { border-right: 0; }
#wallet-view .wallet-ledger-row:last-child > * { border-bottom: 0; }

/* Heading band */
#wallet-view .wallet-ledger-head-row {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 24px;
}
#wallet-view .wallet-ledger-head-row > * {
  background: var(--ledger-band);
  border-bottom-color: var(--border);
}
#wallet-view .wallet-ledger-head {
  padding: 0 6px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  line-height: 23px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#wallet-view .wallet-ledger-head--named { position: relative; display: flex; align-items: center; padding: 0 2px; }
#wallet-view .wallet-ledger input.wallet-ledger-label {
  width: 100%;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  cursor: text;
}
#wallet-view .wallet-ledger input.wallet-ledger-label:hover { border-color: var(--border-strong); }
#wallet-view .wallet-ledger input.wallet-ledger-label:focus {
  outline: none;
  border-color: var(--btc-ink);
  background: var(--surface);
  color: var(--text);
}
#wallet-view .wallet-ledger-pen {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  color: var(--text-3);
  opacity: 0.8;
  pointer-events: none;
}
#wallet-view .wallet-ledger-head--named:focus-within .wallet-ledger-pen { display: none; }

/* Row numbers: click to select a row, shift click for a range, the corner for all. */
#wallet-view .wallet-ledger-num,
#wallet-view .wallet-ledger-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--ledger-band);
}
#wallet-view .wallet-ledger-corner { z-index: 3; }
#wallet-view .wallet-ledger-num {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#wallet-view .wallet-ledger-num:hover { color: var(--text); }
#wallet-view .wallet-ledger-row.is-empty .wallet-ledger-num { cursor: default; }
#wallet-view .wallet-ledger-all {
  appearance: none;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
#wallet-view .wallet-ledger-all:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
#wallet-view .wallet-ledger-all:focus-visible { outline: 2px solid var(--btc-ink); outline-offset: -2px; }

/* Cells */
#wallet-view .wallet-ledger-cell {
  position: relative;
  padding: 0 6px;
  overflow: hidden;
  color: var(--text);
  line-height: 23px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: cell;
  outline: none;
}
#wallet-view .wallet-ledger-cell.is-num { text-align: right; }
#wallet-view .wallet-ledger-cell.is-active { box-shadow: inset 0 0 0 2px var(--btc-ink); }
#wallet-view .wallet-ledger-grid:not(:focus-within) .wallet-ledger-cell.is-active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--btc-ink) 55%, transparent);
}
#wallet-view .wallet-ledger-cell.is-editing {
  padding: 0;
  overflow: visible;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--btc-ink);
  z-index: 1;
}
#wallet-view .wallet-ledger input.wallet-ledger-editor {
  display: block;
  width: 100%;
  height: 23px;
  min-height: 0;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  outline: none;
}

/* Selected rows: a light wash, the numbers in orange ink. */
#wallet-view .wallet-ledger-row.is-selected > .wallet-ledger-cell {
  background: color-mix(in srgb, var(--btc) 9%, var(--surface));
}
#wallet-view .wallet-ledger-row.is-selected > .wallet-ledger-num {
  background: color-mix(in srgb, var(--btc) 16%, var(--ledger-band));
  color: var(--btc-ink);
}

#wallet-view .wallet-ledger-grid.is-loading .wallet-ledger-cell { color: var(--text-3); }

/* Footer: row count or save state, and the clear control for a selection */
#wallet-view .wallet-ledger-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  padding: 0 4px;
}
#wallet-view .wallet-ledger-status {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#wallet-view .wallet-ledger-status.is-error { color: var(--negative); }
#wallet-view .wallet-ledger-retry {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--btc-ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
#wallet-view .wallet-ledger-retry[hidden] { display: none; }
#wallet-view .wallet-ledger-clear {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--negative) 45%, var(--border));
  border-radius: 8px;
  background: transparent;
  color: var(--negative);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#wallet-view .wallet-ledger-clear:hover { border-color: var(--negative); }
#wallet-view .wallet-ledger-clear.is-confirm {
  border-color: var(--negative);
  background: color-mix(in srgb, var(--negative) 14%, transparent);
}
#wallet-view .wallet-ledger-clear[hidden] { display: none; }

/* Clipboard catcher for Cmd/Ctrl+C and V on the sheet (see sheets.js). */
.wallet-ledger-clip {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 560px) {
  #wallet-view .wallet-ledger-scroll { max-height: 64vh; }
  #wallet-view .wallet-ledger-grid { min-width: 700px; }
  #wallet-view .wallet-ledger-row { grid-template-columns: 36px minmax(190px, 1.5fr) minmax(88px, 0.7fr) minmax(190px, 1.5fr) minmax(92px, 0.7fr) minmax(104px, 0.9fr); }
}
@media (pointer: coarse) {
  #wallet-view .wallet-ledger-row { min-height: 32px; }
  #wallet-view .wallet-ledger-cell { line-height: 31px; }
  #wallet-view .wallet-ledger input.wallet-ledger-editor { height: 31px; font-size: 16px; }
  #wallet-view .wallet-ledger input.wallet-ledger-label { height: 26px; }
  #wallet-view .wallet-ledger input.wallet-ledger-label:focus { font-size: 16px; }
  #wallet-view .wallet-ledger-clear { height: 36px; }
}
