:root {
  /* ================= PALETTE & THEME TOKENS ================= */
  /* Surfaces & Backgrounds */
  --bg-canvas: #CAD0B7;         /* Warm light industrial sage/grey */
  --bg-dock: #222822;           /* Dark slate dock */
  --color-paper: #FAFBF7;       /* Off-white cards / sheet surfaces */

  /* Band & Card Container Colors */
  --bg-band-main: #DDB945;      /* Yellow / Mustard for Main Funds */
  --bg-band-recurring: #4F5C4B; /* Deep Olive for Recurring Funds */
  --bg-account-card: #2E342D;   /* Dark Anthracite / Graphite for Accounts */
  --text-account-card: var(--color-paper); /* Text & icons on Account cards (var(--color-paper) or var(--color-ink)) */

  /* Primary Typography & Ink */
  --color-ink: #141712;         /* Deep industrial ink */
  --color-ink-muted: #585F51;   /* Muted ink for labels and secondary text */
  --color-white: #FFFFFF;       /* Pure white */

  /* Brand Accents */
  --color-terracotta: #DF6B4C;  /* Terracotta primary action button */
  --color-mustard: #DDB945;     /* Warm mustard accent */
  --color-olive: #4F5C4B;       /* Deep olive accent */
  --color-anthracite: #2E342D;  /* Dark anthracite accent */

  /* Semantic & Status Colors */
  --color-danger: #BF4E30;      /* Terracotta red for danger, deletes & warnings */
  --color-expense: #BF4E30;     /* Warm brick red for expense transactions */
  --color-income: #15897A;      /* Teal / Sea green for income & confirm */
  --color-transfer: #2C497F;    /* Deep navy slate for transfers between accounts */

  /* Borders & Dividers */
  --border-muted: #AAB096;
  --border-line: rgba(20, 23, 18, 0.14);
  --border-line-light: rgba(255, 255, 255, 0.15);

  /* Geometry & Typography */
  --hatch-height: 22px;
  --radius-sub: 12px;
  --radius-pill: 9999px;
  --font-display: "Chakra Petch", -apple-system, BlinkMacSystemFont, monospace, sans-serif;
  --font-sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-sans);
}

button, input, select, textarea, a, .fund-arrow-btn, .band-fund-row, .dock-btn, .dock-btn-fab, .math-op-btn, .type-pill, .btn-modal-action-save {
  touch-action: manipulation;
}

html {
  height: 100%;
  height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--color-ink);
}

body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--color-ink);
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.cat-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
}

/* Hide native scrollbars to prevent right-edge gutters on Windows / desktop / Android */
.content-scroll::-webkit-scrollbar,
.source-picker-scroll-body::-webkit-scrollbar,
.sheet-modal::-webkit-scrollbar,
.settings-categories-wrap::-webkit-scrollbar,
.icon-picker-grid::-webkit-scrollbar,
.parent-picker-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.content-scroll,
.source-picker-scroll-body,
.sheet-modal,
.settings-categories-wrap,
.icon-picker-grid,
.parent-picker-list {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.app-frame {
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-canvas);
  overflow: hidden;
  flex: 1 1 100%;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .app-frame {
    max-width: 480px;
    flex: 0 0 480px;
    border-left: 1px solid var(--border-line);
    border-right: 1px solid var(--border-line);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
  }
}

.content-scroll {
  flex: 1 1 auto;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 0 0 calc(70px + env(safe-area-inset-bottom)) 0;
}

.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
}

/* ================= 1. NON-STICKY FULL-WIDTH BUDGET HEADER ================= */
.budget-header-block {
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-line);
}

.budget-figures-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--color-muted);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.sync-badge.is-active {
  opacity: 1;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #D97706;
  animation: pulse-sync 1.2s infinite ease-in-out;
}

@keyframes pulse-sync {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
}

.budget-figures {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.num-avail {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-ink);
  line-height: 1;
}

.num-slash {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-ink-muted);
}

.num-plan {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-ink-muted);
}

/* Hatch Meter Full Width */
.hatch-meter-container-full {
  width: 100%;
  height: var(--hatch-height);
  position: relative;
}

.hatch-track-dimmed {
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    rgba(20, 23, 18, 0.22) 0px,
    rgba(20, 23, 18, 0.22) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
  position: relative;
}

.hatch-track-active {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--color-ink) 0px,
    var(--color-ink) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
  transition: width 0.35s ease;
}

/* Overspending State (Existing --color-danger / Brick Red) */
.num-avail.is-overspent,
.fund-card-big-num.is-overspent {
  color: var(--color-danger) !important;
}

.hatch-track-active.is-overspent {
  background: repeating-linear-gradient(
    90deg,
    var(--color-danger) 0px,
    var(--color-danger) 1.5px,
    transparent 1.5px,
    transparent 4px
  ) !important;
}

/* ================= 2. SECTION HEADERS ================= */
.block-section-header {
  padding: 16px 16px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--color-ink-muted);
  text-transform: uppercase;
}
.mt-18 { margin-top: 10px; }

/* ================= 3. SOLID FULL-WIDTH EDGE-TO-EDGE BANDS (Exact match to Reference) ================= */
.funds-stack.full-width-stack, .accounts-strips-stack {
  display: flex;
  flex-direction: column;
  padding: 0;
  width: 100%;
  border-top: 1px solid var(--border-line);
  border-bottom: 1px solid var(--border-line);
}

.band-fund-row {
  width: 100%;
  padding: 14px 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 115px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-line-light);
  transition: opacity 0.15s ease;
}
.band-fund-row:last-child {
  border-bottom: none;
}
.band-fund-row:active {
  opacity: 0.9;
}

/* Color 1: All Main Funds share Yellowish / Mustard (Point 1) */
.band-fund-row.main-fund-color,
.source-detail-card.main-fund-color,
.picker-source-card.main-fund-color {
  background-color: var(--bg-band-main);
  color: var(--color-ink);
}
.band-fund-row.main-fund-color .fund-arrow-btn,
.source-detail-card.main-fund-color .fund-arrow-btn {
  background: rgba(20, 23, 18, 0.12);
  color: var(--color-ink);
}
.band-fund-row.main-fund-color .hatch-track-dimmed {
  background: repeating-linear-gradient(
    90deg,
    rgba(20, 23, 18, 0.22) 0px,
    rgba(20, 23, 18, 0.22) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
}
.band-fund-row.main-fund-color .hatch-track-active {
  background: repeating-linear-gradient(
    90deg,
    var(--color-ink) 0px,
    var(--color-ink) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
}

/* Color 2: All Recurring Funds share Light Olive (Point 1) */
.band-fund-row.recurring-fund-color,
.source-detail-card.recurring-fund-color,
.picker-source-card.recurring-fund-color {
  background-color: var(--bg-band-recurring);
  color: var(--color-paper);
}
.band-fund-row.recurring-fund-color .fund-arrow-btn,
.source-detail-card.recurring-fund-color .fund-arrow-btn {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-paper);
}
.band-fund-row.recurring-fund-color .hatch-track-dimmed {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25) 0px,
    rgba(255, 255, 255, 0.25) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
}
.band-fund-row.recurring-fund-color .hatch-track-active {
  background: repeating-linear-gradient(
    90deg,
    var(--color-white) 0px,
    var(--color-white) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
}

/* Accounts as compact fund-like cards in var(--bg-account-card) */
.band-fund-row.account-fund-color,
.source-detail-card.account-fund-color,
.source-detail-card.account-theme,
.picker-source-card.account-fund-color {
  background-color: var(--bg-account-card);
  color: var(--text-account-card);
}
.band-fund-row.account-fund-color {
  min-height: 54px;
  padding: 8px 16px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--text-account-card) 15%, transparent);
}
.band-fund-row.account-fund-color:last-child {
  border-bottom: none;
}
.band-fund-row.account-fund-color .fund-card-header {
  margin-bottom: 2px;
}
.band-fund-row.account-fund-color .fund-card-title {
  font-size: 0.76rem;
  letter-spacing: 0.8px;
}
.band-fund-row.account-fund-color .fund-arrow-btn,
.source-detail-card.account-theme .fund-arrow-btn,
.source-detail-card.account-fund-color .fund-arrow-btn {
  width: 28px;
  height: 28px;
  background: color-mix(in srgb, var(--text-account-card) 20%, transparent);
  color: var(--text-account-card);
}
.band-fund-row.account-fund-color .fund-card-big-num {
  font-size: 1.35rem;
}

/* Top Row: Clean Fund Name + Circular Arrow (Point 4 - higher towards top) */
.fund-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.fund-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
}

.fund-arrow-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: background 0.15s ease;
  cursor: pointer;
  border: none;
}
.fund-arrow-btn:active {
  background: rgba(255, 255, 255, 0.3);
}
.fund-arrow-btn svg {
  width: 17px;
  height: 17px;
}

/* Bottom Content: Numbers on the left, 22px Hatch Meter on the right (Point 4 - aligned on level of amount) */
.fund-bottom-content-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.fund-nums-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fund-card-big-num {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

/* Tiny Plan figures beside or under the current value in same display font */
.fund-card-tiny-plan {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.7;
  text-transform: uppercase;
}

/* Hatch Meter on the RIGHT side */
.fund-right-hatch-box {
  width: 105px;
  height: var(--hatch-height); /* Strict 22px */
  position: relative;
  flex-shrink: 0;
}

/* ================= 4. SOURCE DETAIL VIEW ================= */
.source-detail-card {
  width: 100%;
  padding: 16px 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 115px;
  border-bottom: 1px solid var(--border-line-light);
}
.source-detail-card .fund-card-header {
  margin-bottom: 12px;
}

/* Source Detail Hatch Gauge (Point 7 - white hatch active lines) */
.source-detail-card .fund-right-hatch-box {
  width: 105px;
  height: var(--hatch-height);
  position: relative;
  flex-shrink: 0;
}
.source-detail-card .hatch-track-dimmed {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25) 0px,
    rgba(255, 255, 255, 0.25) 1.5px,
    transparent 1.5px,
    transparent 4px
  );
}
.source-detail-card .hatch-track-active {
  background: repeating-linear-gradient(
    90deg,
    var(--color-white) 0px,
    var(--color-white) 1.5px,
    transparent 1.5px,
    transparent 4px
  ) !important;
}

/* Floating Budget Header for History View (Point 9) */
.history-floating-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-canvas);
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-line);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
.history-floating-header.header-hidden {
  transform: translateY(-100%);
}

/* Date Group Header in History Lists (Point 10 - sticky over records) */
.history-date-group-header {
  position: sticky;
  top: var(--hist-header-offset, 86px);
  z-index: 20;
  padding: 10px 16px 8px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-line);
  transition: top 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Bottom Unified Add Button */
.bottom-add-trigger-wrap {
  padding: 16px 16px 20px;
}
.btn-full-add-source {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 1.5px dashed var(--color-ink-muted);
  border-radius: var(--radius-sub);
  color: var(--color-ink);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
.btn-full-add-source:active {
  background: rgba(20, 23, 18, 0.05);
}

/* ================= 5. HISTORY LIST ================= */
.history-list {
  display: flex;
  flex-direction: column;
}

.history-item-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}
.history-item-row:active {
  background: rgba(20, 23, 18, 0.05);
}

.hist-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.hist-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(20, 23, 18, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  flex-shrink: 0;
}
.hist-icon-box svg { width: 20px; height: 20px; }

.hist-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 2px;
  word-break: break-word;
}

/* History Metadata Lines: Source with Icon, Note with Icon (Points 12, 13, 16) */
.hist-lines-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 3px;
}

.hist-meta-line {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--color-ink-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  word-break: break-word;
}

.hist-meta-line.hist-note-line {
  color: var(--color-ink);
  opacity: 0.82;
  word-break: break-word;
}

.mini-meta-icon {
  width: 13px;
  height: 13px;
  opacity: 0.75;
  flex-shrink: 0;
}

.hist-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 8px;
}

.hist-sum {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  white-space: nowrap;
}
.hist-sum.expense { color: var(--color-expense); }
.hist-sum.income { color: var(--color-income); }
.hist-sum.transfer { color: var(--color-transfer); }

/* Stylish Display Font for Amount Expression (Point 11) */
.hist-expr-badge {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-ink-muted);
  letter-spacing: 0.2px;
  margin-top: 2px;
}

/* ================= 7. EDITORIAL TRANSACTION MODAL (Screenshot 1 & Top-Docked) ================= */
.sheet-backdrop.top-docked {
  align-items: flex-start; /* Dock to top of screen! Prevents virtual keyboard occlusion */
  padding-top: calc(8px + env(safe-area-inset-top));
}

.sheet-modal.top-modal {
  border-radius: 0 0 28px 28px;
  animation: slideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.editorial-modal {
  padding: 14px 18px 20px;
}

.modal-top-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

/* Circular back arrow in modal (Point 7) */
.modal-top-actions-row .fund-arrow-btn {
  background: rgba(20, 23, 18, 0.1);
  color: var(--color-ink);
}
.modal-top-actions-row .fund-arrow-btn:active {
  background: rgba(20, 23, 18, 0.2);
}

.btn-modal-action-save {
  background: var(--color-terracotta);
  border: none;
  border-radius: var(--radius-pill);
  color: var(--color-white);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(223, 107, 76, 0.35);
  transition: transform 0.1s ease;
}
.btn-modal-action-save:active {
  transform: scale(0.96);
}

.sheet-types-switch.full-width {
  width: 100%;
  display: flex;
  margin-bottom: 16px;
}
.sheet-types-switch.full-width .type-pill {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 0.85rem;
}

/* Big Amount Formula Field */
.hero-amount-formula-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.input-formula-amount {
  background: transparent;
  border: none;
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-ink);
  text-align: center;
  max-width: 260px;
}
.input-formula-amount:focus {
  outline: none;
}

.amount-curr-label {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-ink-muted);
}

.formula-eval-preview {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-ink-muted);
  margin-bottom: 12px;
}

/* Mathematical Operator Buttons Row (+, -, *, /, (, )) */
.math-operator-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.math-op-btn {
  flex: 1;
  max-width: 52px;
  height: 42px;
  background: rgba(20, 23, 18, 0.08);
  border: 1px solid var(--border-line);
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease;
}
.math-op-btn:active {
  background: var(--bg-band-main);
  color: var(--color-white);
}

/* Editorial Specs Table with Vector SVG Icons */
.editorial-specs-table {
  width: 100%;
  border-top: 1px solid var(--border-line);
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 18px;
}

.spec-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-line);
  min-height: 46px;
}
.spec-row:last-child {
  border-bottom: none;
}

.spec-icon-box {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink-muted);
  flex-shrink: 0;
}

.spec-icon {
  width: 20px;
  height: 20px;
}

.spec-val {
  flex: 1;
}

.spec-select, .spec-input {
  width: 100%;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-ink);
  padding: 8px 0;
  text-align: left; /* Strict left alignment for all fields including date! */
  -webkit-appearance: none;
}
.spec-select:focus, .spec-input:focus {
  outline: none;
}

/* Ensure native date inputs on mobile and desktop align strictly to the left */
input[type="date"].spec-input {
  text-align: left !important;
  display: block;
}
input[type="date"]::-webkit-date-and-time-value {
  text-align: left !important;
}

/* Full Width Solid Terracotta Button */
.btn-solid-action {
  width: 100%;
  padding: 15px;
  background: var(--color-terracotta);
  border: none;
  border-radius: var(--radius-sub);
  color: var(--color-white);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 4px 14px rgba(223, 107, 76, 0.4);
}
.btn-solid-action.btn-danger-solid {
  background: var(--color-danger);
  box-shadow: 0 4px 14px rgba(191, 78, 48, 0.35);
}
.btn-solid-action:active {
  transform: scale(0.98);
}

.bottom-dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 100%;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-dock);
  border-radius: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-left: 14px;
  padding-right: 14px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 50;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .bottom-dock {
    max-width: 480px;
  }
}

.dock-btn {
  background: transparent;
  border: none;
  color: rgba(250, 251, 247, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  flex: 1;
}
.dock-btn.active { color: var(--color-paper); }
.dock-svg { width: 19px; height: 19px; }
.dock-btn span { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.3px; }

.dock-btn-fab {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--color-terracotta);
  border: none;
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(223, 107, 76, 0.5);
  transition: transform 0.15s ease;
  margin-top: -6px;
}
.dock-btn-fab:active { transform: scale(0.92); }
.fab-svg { width: 22px; height: 22px; }

/* ================= 10. BASE SHEETS ================= */
.sheet-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 23, 18, 0.65);
  backdrop-filter: blur(5px);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop.open { display: flex; }

.sheet-modal {
  background: var(--bg-canvas);
  width: 100%;
  max-width: 100%;
  border-radius: 28px 28px 0 0;
  padding: 12px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .sheet-modal {
    max-width: 480px;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(20, 23, 18, 0.2);
  margin: 0 auto 10px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.sheet-header h3 { font-size: 1.1rem; font-weight: 800; }

.btn-sheet-close {
  background: rgba(20, 23, 18, 0.08);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.95rem;
  color: var(--color-ink);
  cursor: pointer;
}

.sheet-types-switch {
  display: flex;
  background: rgba(20, 23, 18, 0.08);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.type-pill {
  border: none;
  background: transparent;
  color: var(--color-ink-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.type-pill.active {
  background: var(--color-ink);
  color: var(--color-paper);
}

.sheet-field { margin-bottom: 12px; }
.sheet-field label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin-bottom: 5px;
}
.sheet-input, .sheet-select {
  width: 100%;
  padding: 11px 12px;
  background: rgba(20, 23, 18, 0.06);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sub);
  color: var(--color-ink);
  font-size: 0.92rem;
  font-weight: 600;
}
.sheet-input:focus, .sheet-select:focus { outline: none; border-color: var(--color-ink); }

/* Settings Styles */
.settings-content { display: flex; flex-direction: column; gap: 16px; }
.settings-block { border-bottom: 1px solid rgba(20, 23, 18, 0.15); padding-bottom: 14px; }
.settings-block:last-child { border-bottom: none; }
.block-title { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.8px; color: var(--color-ink-muted); margin-bottom: 8px; }

.btn-outline-action {
  width: 100%;
  padding: 11px 14px;
  background: rgba(20, 23, 18, 0.06);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sub);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: var(--color-ink);
}
.btn-outline-action.danger-text { color: var(--color-danger); }
.mini-arrow { width: 14px; height: 14px; }
.mini-svg { width: 16px; height: 16px; }
.settings-btn-grid { display: flex; flex-direction: column; gap: 7px; }

.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.hidden { display: none !important; }

/* ================= 11. ZENMONEY-STYLE IN-APP NUMPAD (Item 13) ================= */
.zen-keypad {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-line);
  user-select: none;
  -webkit-user-select: none;
}

.zen-keypad-ops {
  display: flex;
  gap: 6px;
}
.zen-keypad-ops .zen-key {
  flex: 1;
  height: 40px;
  background: rgba(20, 23, 18, 0.08);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sub);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.zen-keypad-ops .zen-key.zen-confirm {
  background: var(--color-income);
  color: var(--color-white);
  border-color: var(--color-income);
  font-weight: 900;
}

.zen-keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.zen-keypad-grid .zen-key {
  height: 46px;
  background: rgba(20, 23, 18, 0.05);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sub);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.zen-key:active {
  background: var(--bg-band-main) !important;
  color: var(--color-white) !important;
  transform: scale(0.96);
}

/* ================= 12. SOURCE PICKER SHEET (Item 2) ================= */
.source-picker-modal {
  max-height: 82vh;
}
.source-picker-scroll-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0 20px;
  max-height: 70vh;
  overflow-y: auto;
}
.picker-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  margin: 10px 0 4px;
}
.picker-source-card {
  padding: 12px 16px;
  border-radius: var(--radius-sub);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.picker-source-card:active {
  transform: scale(0.98);
}
.picker-source-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.picker-source-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

/* Custom Trigger instead of native select */
.spec-picker-trigger {
  padding: 8px 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  width: 100%;
}
.spec-picker-trigger .picker-placeholder {
  color: var(--color-ink-muted);
  font-weight: 500;
}

/* ================= 13. SETTINGS CATEGORIES LIST (Items 1, 2, 4) ================= */
.settings-categories-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 8px;
  padding: 2px 0;
}
.cat-manage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(20, 23, 18, 0.05);
  border-radius: var(--radius-sub);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.cat-manage-item:active {
  background: rgba(20, 23, 18, 0.1);
}
.cat-manage-item.subcat {
  margin-left: 20px;
  background: rgba(20, 23, 18, 0.025);
  border-left: 2px solid var(--border-muted);
}
.cat-manage-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.cat-manage-icon-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 23, 18, 0.06);
  flex-shrink: 0;
}
.cat-manage-icon-badge .cat-svg {
  width: 15px;
  height: 15px;
}
.cat-manage-name {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-ink);
}
.cat-manage-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-edit-cat-trigger {
  background: none;
  border: none;
  color: var(--color-ink-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
}
.btn-del-cat {
  background: none;
  border: none;
  color: var(--color-danger);
  font-weight: 800;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.95rem;
  line-height: 1;
}
.btn-del-cat:active {
  opacity: 0.6;
}

/* ================= 14. CATEGORY MODAL CONTROLS (Items 3, 5, 6, 7) ================= */
.cat-icon-trigger-row {
  width: 100%;
}
.cat-icon-select-btn {
  width: 100%;
  padding: 8px 12px;
  background: rgba(20, 23, 18, 0.05);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-sub);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}
.cat-icon-select-btn:active {
  background: rgba(20, 23, 18, 0.09);
}
.cat-icon-box-preview {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(20, 23, 18, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.cat-icon-box-preview .cat-svg {
  width: 20px;
  height: 20px;
}
.cat-icon-label-text {
  flex: 1;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-ink);
}

/* Color Palette Swatches (Item 5) */
.color-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
}
.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
  position: relative;
  outline: none;
}
.color-swatch-btn:active {
  transform: scale(0.92);
}
.color-swatch-btn.active {
  border-color: var(--color-ink);
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Subcategory Control (Item 3) */
.btn-make-subcat {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 1.5px dashed var(--color-ink-muted);
  border-radius: var(--radius-sub);
  color: var(--color-ink);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.1s ease;
}
.btn-make-subcat:active {
  background: rgba(20, 23, 18, 0.05);
}
.subcat-active-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(20, 23, 18, 0.08);
  border-radius: var(--radius-sub);
  font-weight: 700;
  font-size: 0.88rem;
}
.subcat-chip-left {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.subcat-chip-left .cat-svg {
  width: 16px;
  height: 16px;
}
.btn-clear-subcat {
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0 4px;
}

/* Icon Picker Grid (Item 7) */
.icon-picker-modal {
  max-height: 80vh;
}
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 8px 0 20px;
}
.icon-grid-btn {
  aspect-ratio: 1;
  background: rgba(20, 23, 18, 0.05);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sub);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  color: var(--color-ink);
}
.icon-grid-btn .cat-svg {
  width: 22px;
  height: 22px;
}
.icon-grid-btn:hover, .icon-grid-btn:active {
  background: rgba(20, 23, 18, 0.1);
  transform: scale(0.95);
}
.icon-grid-btn.active {
  border-color: var(--color-ink);
  background: var(--bg-band-main);
  color: var(--color-ink);
}

/* Parent Category Picker (Item 3) */
.parent-picker-modal {
  max-height: 80vh;
}
.parent-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 8px 0 20px;
}
.parent-picker-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(20, 23, 18, 0.05);
  border-radius: var(--radius-sub);
  cursor: pointer;
  transition: background 0.12s ease;
}
.parent-picker-card:active {
  background: rgba(20, 23, 18, 0.1);
}
.parent-picker-card .cat-svg {
  width: 20px;
  height: 20px;
}
.parent-picker-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-ink);
}

/* Quick Date Pills */
.date-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.date-val-row input[type="date"] {
  flex: 1;
}
.quick-date-pills {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.date-quick-btn {
  background: rgba(20, 23, 18, 0.08);
  border: none;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.1s ease;
}
.date-quick-btn:active {
  background: var(--color-ink);
  color: var(--color-paper);
}

/* Category Picker Grid Sheet (Point 4) */
.category-picker-modal {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.cat-picker-subtitle {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.category-picker-scroll-body {
  display: flex;
  flex-direction: column;
  max-height: 56vh;
  overflow-y: auto;
  padding: 2px 2px 14px;
}
.cat-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 8px;
}
.cat-grid-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
}
.cat-grid-card:active {
  transform: scale(0.92);
}
.cat-grid-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: rgba(20, 23, 18, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
}
.cat-grid-card.selected .cat-grid-icon-circle {
  background: currentColor;
  box-shadow: 0 0 0 3px var(--bg-canvas), 0 0 0 5px currentColor;
}
.cat-grid-card.selected .cat-grid-icon-circle .cat-svg {
  color: #ffffff !important;
}
.cat-grid-chevron {
  position: absolute;
  bottom: 2px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}
.cat-grid-name {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}
.cat-grid-card.selected .cat-grid-name {
  font-weight: 800;
}
.cat-grid-subcats-block {
  grid-column: 1 / -1;
  background: rgba(20, 23, 18, 0.04);
  border-radius: var(--radius-sub);
  padding: 14px 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 6px;
  margin: 4px 0 6px;
  border: 1px dashed rgba(20, 23, 18, 0.18);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.cat-picker-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-line);
  margin-top: auto;
}
.cat-picker-selected-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 23, 18, 0.08);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-ink);
  max-width: calc(100% - 66px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-chip-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: 0.7rem;
  font-weight: 900;
  flex-shrink: 0;
}
.cat-picker-confirm-fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-terracotta);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(223, 107, 76, 0.4);
  cursor: pointer;
  transition: transform 0.12s ease;
  flex-shrink: 0;
}
.cat-picker-confirm-fab:active {
  transform: scale(0.92);
}
.cat-picker-confirm-fab svg {
  width: 24px;
  height: 24px;
}
.mb-8 { margin-bottom: 8px; }

/* Drag and Drop Reordering */
.band-fund-row {
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
}
.band-fund-row.reorder-dragging {
  transform: scale(1.025);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  z-index: 40;
  opacity: 0.95;
}
.band-fund-row.reorder-drag-over {
  border-top: 2px solid var(--color-terracotta);
}

/* PIN Lock Screen Overlay */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.pin-lock-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.pin-container {
  width: 100%;
  max-width: 320px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.pin-brand {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--color-ink);
  margin-bottom: 6px;
}

.pin-subheading {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pin-dots-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-ink);
  background-color: transparent;
  transition: all 0.15s ease;
}

.pin-dot.filled {
  background-color: var(--color-terracotta);
  border-color: var(--color-terracotta);
  transform: scale(1.1);
}

.pin-error-msg {
  height: 20px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--color-danger);
  margin-bottom: 16px;
}

.pin-dots-row.shake {
  animation: pin-shake 0.35s ease-in-out;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.pin-pad-btn {
  height: 56px;
  border-radius: 12px;
  background-color: var(--color-paper);
  border: 1px solid var(--border-line);
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.1s ease, transform 0.08s ease;
}

.pin-pad-btn:active {
  background-color: var(--color-slate);
  color: var(--color-paper);
  transform: scale(0.95);
}

.pin-pad-btn.pin-action-btn {
  background-color: transparent;
  border-color: transparent;
  font-size: 1.1rem;
  color: var(--color-muted);
}

.pin-pad-btn.pin-action-btn:active {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--color-ink);
}

