:root {
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --surface-alt: #F4F4F5;
  --ink: #111111;
  --ink-secondary: #525252;
  --ink-muted: #737373;
  --border: #E5E5E5;
  --border-strong: #111111;
  --track: #E5E5E5;
  --fill: #111111;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
}

[data-theme="dark"] {
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-alt: #1F1F1F;
  --ink: #FAFAFA;
  --ink-secondary: #D4D4D4;
  --ink-muted: #A3A3A3;
  --border: #262626;
  --border-strong: #FAFAFA;
  --track: #262626;
  --fill: #FAFAFA;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  transition: background-color 0.15s ease, color 0.15s ease;
}

button, input, select {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

.app-shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: max(10px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  gap: 10px;
}

/* TOP CARD: BUDGET & SLIDER */
.top-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.budget-headline-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.eyebrow-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.sync-dot {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
}

.headline-numbers {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.1;
}

.spent-num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.slash-sep {
  font-size: 18px;
  font-weight: 400;
  color: var(--ink-muted);
}

.total-budget-btn {
  background: transparent;
  border: 1px dashed transparent;
  padding: 2px 5px;
  margin-left: -3px;
  border-radius: var(--radius-sm);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.total-budget-btn:hover,
.total-budget-btn:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-alt);
  outline: none;
}

.edit-glyph {
  font-size: 12px;
  color: var(--ink-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-pill-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.icon-pill-btn:hover {
  border-color: var(--border-strong);
}

.reset-pill-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: border-color 0.12s ease, transform 0.08s ease;
}

.reset-pill-btn:hover {
  border-color: var(--border-strong);
}

.reset-pill-btn:active {
  transform: scale(0.98);
}

.chevron {
  font-size: 10px;
  color: var(--ink-muted);
}

/* Inline Budget Editor */
.inline-budget-editor {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline-budget-editor[hidden] {
  display: none !important;
}

.inline-editor-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.inline-editor-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mono-input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.mono-btn-sm {
  height: 36px;
  padding: 0 12px;
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mono-btn-ghost-sm {
  height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* USAGE PROGRESS TRACK & SLIDER */
.usage-bar-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.usage-track {
  position: relative;
  height: 14px;
  width: 100%;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.usage-fill {
  height: 100%;
  background: var(--fill);
  border-radius: 999px;
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.usage-fill.over-budget {
  background: repeating-linear-gradient(
    -45deg,
    var(--ink),
    var(--ink) 6px,
    var(--ink-secondary) 6px,
    var(--ink-secondary) 12px
  );
}

.usage-thumb {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 16px;
  background: var(--ink);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.slider-subrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.left-stats-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stat-dot {
  color: var(--ink-muted);
  font-weight: 700;
}

.meta-stat {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.meta-stat-right {
  color: var(--ink-secondary);
}

.daily-allowance-pill {
  display: inline-flex;
  align-items: center;
  background: var(--ink);
  color: var(--surface);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.daily-allowance-pill.is-over {
  background: var(--surface-alt);
  color: var(--ink-muted);
  border: 1px solid var(--border-strong);
}

/* Reconciliation Breakdown Row */
.reconcile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.reconcile-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-inline-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.calendar-inline-btn:hover {
  border-color: var(--border-strong);
}

.cap-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}

.cap-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.mono-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--track);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.mono-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  cursor: grab;
}

.mono-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  cursor: grab;
}

/* Segmented View Switcher (Quick Add | Transactions (N)) */
.view-switcher-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}

.view-seg-control {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.view-seg-btn {
  height: 30px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.view-seg-btn.is-active {
  background: var(--ink);
  color: var(--surface);
}

/* Ticker Bar */
.ticker-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 7px;
}

.ticker-main-btn {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-secondary);
  font-size: 12px;
}

.ticker-dot {
  color: var(--ink);
  font-size: 10px;
}

.ticker-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.ticker-expand-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
}

.ticker-undo-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

/* CENTER ZONE: AMOUNT, CATEGORIES, KEYPAD, ADD BUTTON */
.entry-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.amount-readout-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

.amount-readout {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  justify-content: center;
  user-select: none;
  outline: none;
}

.amount-readout.is-zero {
  color: var(--ink-muted);
}

.currency-prefix {
  font-size: 24px;
  font-weight: 700;
  margin-right: 2px;
  color: var(--ink-secondary);
}

.note-input {
  width: 100%;
  max-width: 260px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: center;
  font-size: 12px;
  padding: 3px 6px;
  color: var(--ink-secondary);
  outline: none;
}

.note-input:focus {
  border-bottom-color: var(--ink);
}

/* Category Pills */
.category-strip-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-strip-wrap::-webkit-scrollbar {
  display: none;
}

.category-strip {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
}

.cat-pill {
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.1s ease;
}

.cat-pill:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.cat-pill.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.cat-pill-add {
  border-style: dashed;
  color: var(--ink-muted);
  padding: 0 11px;
}

/* Keypad 3x4 */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.key-btn {
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.08s ease, transform 0.06s ease;
}

.key-btn:hover {
  border-color: var(--ink-muted);
}

.key-btn:active {
  background: var(--ink);
  color: var(--surface);
  transform: scale(0.97);
}

.key-btn-secondary {
  background: var(--surface);
  font-size: 18px;
}

/* Primary Add Spend Button */
.add-spend-btn {
  height: 48px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 0.12s ease, transform 0.08s ease;
}

.add-spend-btn:active {
  transform: scale(0.99);
}

.add-spend-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* LINE-BY-LINE TRANSACTIONS LEDGER CARD */
.ledger-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.ledger-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ledger-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.ledger-count-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}

.ledger-header-actions {
  display: flex;
  gap: 6px;
}

.ledger-action-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.ledger-action-btn:hover {
  border-color: var(--border-strong);
}

.ledger-filters {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ledger-cat-filter-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.ledger-cat-filter-strip::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-pill.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.ledger-search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink);
  outline: none;
}

.ledger-search-input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}

.ledger-table-head {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.col-amt {
  text-align: right;
}

.ledger-rows-container {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.app-shell.ledger-focused .ledger-rows-container {
  max-height: 68dvh;
}

/* Day Group Sticky Header inside Line-by-Line Ledger */
.ledger-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  text-transform: uppercase;
}

.ledger-line-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  background: var(--surface);
  transition: background 0.1s ease;
}

.ledger-line-row:last-child {
  border-bottom: none;
}

.ledger-line-row:hover {
  background: var(--surface-alt);
}

.line-idx-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.line-num-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
}

.line-date-tag {
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.15;
}

.line-desc-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.line-cat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-cat-badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-alt);
}

.line-note-text {
  font-size: 12px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-amt-col {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-amt-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.line-amt-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.line-run-bal {
  font-size: 10px;
  color: var(--ink-muted);
}

.line-row-actions {
  display: flex;
  gap: 3px;
}

.line-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.line-icon-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* SHEETS & MODALS */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 12px;
}

.sheet-backdrop[hidden] {
  display: none !important;
}

.sheet-panel {
  width: 100%;
  max-width: 440px;
  max-height: 90dvh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-panel-compact {
  max-height: 75dvh;
}

.sheet-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.sheet-subtitle {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.section-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-action-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

/* Category Summary Grid */
.cat-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-stat-chip {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cat-stat-name {
  font-weight: 600;
  color: var(--ink-secondary);
}

.cat-stat-val {
  font-weight: 800;
  color: var(--ink);
}

/* Entries List inside Full Sheet */
.entries-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.entry-row:last-child {
  border-bottom: none;
}

.entry-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-cat-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.entry-cat-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.entry-note {
  font-size: 12px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-time {
  font-size: 10px;
  color: var(--ink-muted);
}

.entry-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.entry-amount {
  font-size: 14px;
  font-weight: 800;
}

.entry-del-btn {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  cursor: pointer;
}

.entry-del-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.empty-state-box {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Archives */
.archives-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.archive-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* Reset Sheet Controls & Custom Calendar Picker */
.mono-input-lg {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 800;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

.seg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.seg-grid-5 .seg-btn:first-child {
  grid-column: span 2;
}

.seg-btn {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.schedule-subbox {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subbox-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.cal-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Interactive Monochrome Calendar Grid */
.mono-calendar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-month-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.cal-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-cell {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cal-day-cell:hover {
  border-color: var(--border-strong);
}

.cal-day-cell.is-outside {
  color: var(--ink-muted);
  opacity: 0.4;
}

.cal-day-cell.is-in-range {
  background: var(--surface-alt);
  border-color: var(--border);
}

.cal-day-cell.is-edge {
  background: var(--ink);
  color: var(--surface);
  font-weight: 800;
}

.cal-hint-text {
  font-size: 10px;
  color: var(--ink-muted);
  text-align: center;
}

.mono-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.next-reset-preview {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 6px 8px;
  border-left: 2px solid var(--ink);
  background: var(--surface-alt);
}

.sheet-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mono-btn-primary {
  height: 42px;
  width: 100%;
  background: var(--ink);
  color: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.divider-line {
  height: 1px;
  background: var(--border);
}

.manual-reset-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-reset-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.manual-reset-title {
  font-size: 13px;
  font-weight: 700;
}

.manual-reset-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.mono-btn-outline-danger {
  height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.mono-btn-outline-danger:hover {
  background: var(--ink);
  color: var(--surface);
}

.manage-cats-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manage-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.manage-cat-del {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-muted);
}


/* Alias classes for full compatibility */
.usage-track.is-over-budget .usage-fill {
  background: repeating-linear-gradient(
    -45deg,
    var(--ink),
    var(--ink) 6px,
    var(--ink-secondary) 6px,
    var(--ink-secondary) 12px
  );
}
.filter-chip {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter-chip.is-active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.cat-stat-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.line-col-idx {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.line-num-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
}
.line-date-sub {
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.15;
}
.line-col-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.line-cat-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-alt);
}
.line-col-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.line-numbers-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.line-bal-sub {
  font-size: 10px;
  color: var(--ink-muted);
}
.empty-list-msg {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}
.archive-row {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
