/* ============================================================
   మా షాప్ లెక్కలు — Andhra-style digital cashbook
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #FBF4E4;
  --bg-2: #F4E8CC;
  --surface: #FFFDF6;
  --surface-2: #FBEFD7;
  --ink: #43291B;
  --ink-2: #6E5540;
  --line: #E8D5B2;
  --line-2: #F1E3C4;

  --maroon: #84222E;
  --maroon-d: #61141F;
  --maroon-ink: #9E2B38;
  --maroon-tint: #F9E5E2;

  --turmeric: #E8A22B;
  --turmeric-d: #C77E08;
  --turmeric-tint: #FDF0D2;

  --gold: #B8893A;
  --gold-soft: #F2E2BA;
  --gold-line: #EAC877;

  --leaf: #2E704F;
  --leaf-d: #1F5539;
  --leaf-tint: #E2F0E5;

  --shadow: 0 12px 32px rgba(120, 88, 44, 0.10);
  --shadow-sm: 0 4px 14px rgba(120, 88, 44, 0.08);
  --ring-gray: #E9DCC0;

  --brand-a: #A02A38;
  --brand-b: #5F1520;

  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23842A32' stroke-width='1' opacity='.6'%3E%3Cpath d='M80 10 L94 30 L80 50 L66 30 Z'/%3E%3Cpath d='M80 110 L94 130 L80 150 L66 130 Z'/%3E%3Cpath d='M10 80 L30 66 L50 80 L30 94 Z'/%3E%3Cpath d='M110 80 L130 66 L150 80 L130 94 Z'/%3E%3Ccircle cx='80' cy='30' r='4'/%3E%3Ccircle cx='80' cy='130' r='4'/%3E%3Ccircle cx='30' cy='80' r='4'/%3E%3Ccircle cx='130' cy='80' r='4'/%3E%3Ccircle cx='80' cy='80' r='5'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="dark"] {
  --bg: #1B120C;
  --bg-2: #231710;
  --surface: #2A1D13;
  --surface-2: #322315;
  --ink: #F5E7D1;
  --ink-2: #C6AE8F;
  --line: #4A351F;
  --line-2: #3A2A18;

  --maroon: #E05764;
  --maroon-d: #F17C88;
  --maroon-ink: #FF9AA3;
  --maroon-tint: #46242B;

  --turmeric: #F2B241;
  --turmeric-d: #F9C878;
  --turmeric-tint: #3B2C12;

  --gold: #E3C077;
  --gold-soft: #3B2C16;
  --gold-line: #EAC877;

  --leaf: #6FBF97;
  --leaf-d: #8FD4B2;
  --leaf-tint: #1F3A2C;

  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.30);
  --ring-gray: #3A2A18;

  --brand-a: #C33A49;
  --brand-b: #863546;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Mukta Mahee", "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--pattern);
  background-size: 160px 160px;
  opacity: 0.5;
  pointer-events: none;
}

h1, h2, h3 { font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif; line-height: 1.3; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--maroon);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
}
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  padding: 11px 18px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  min-height: 46px;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
  text-align: center;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-d));
  color: #fff;
  box-shadow: 0 6px 18px rgba(132, 34, 46, 0.28);
}
.btn-primary:hover { box-shadow: 0 9px 24px rgba(132, 34, 46, 0.38); transform: translateY(-1px); }

.btn-gold {
  background: linear-gradient(135deg, var(--turmeric), var(--turmeric-d));
  color: #3A2405;
  box-shadow: 0 6px 18px rgba(199, 126, 8, 0.25);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(199, 126, 8, 0.32); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--gold); background: var(--surface-2); }

.btn-danger {
  background: linear-gradient(135deg, #B3261E, #8F1D16);
  color: #fff;
}

.btn-sm { min-height: 40px; padding: 8px 14px; font-size: .95rem; }
.btn-big { min-height: 52px; font-size: 1.1rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  flex: none;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--gold); color: var(--maroon); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.danger:hover { border-color: var(--maroon); color: var(--maroon-ink); }

.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, .type-pill:has(input:focus-visible) {
  outline: 3px solid var(--turmeric);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--turmeric), var(--maroon), var(--gold), var(--leaf));
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-mark {
  flex: none;
  filter: drop-shadow(0 4px 10px rgba(95, 21, 32, .3));
}
.brand-ring { stroke: var(--gold-line); stroke-width: 2; }
.brand-petals { fill: none; stroke: var(--gold-line); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand-dot { fill: var(--gold-line); }

.brand-text h1 {
  font-size: 1.35rem;
  color: var(--maroon);
  letter-spacing: .3px;
}
.brand-text .subtitle {
  font-size: .88rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }

.today-pill {
  font-family: "Mukta", "Mukta Mahee", sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.theme-btn { border-radius: 50%; }
.theme-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-moon { display: block; }

/* ---------- Nav ---------- */
.main-nav { border-top: 1px solid var(--line-2); }
.nav-list { display: flex; gap: 6px; padding-top: 10px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.nav-list::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink-2);
  border: 1.5px solid transparent;
  white-space: nowrap;
  transition: all .18s ease;
}
.nav-link .nav-en { display: none; }
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link.active {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-d));
  color: #fff;
  box-shadow: 0 6px 16px rgba(132, 34, 46, .28);
}

/* ---------- Sections ---------- */
.tab-panel { display: none; padding-top: 26px; padding-bottom: 40px; animation: fadeIn .35s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head { text-align: center; margin-bottom: 22px; }
.section-head h2 { font-size: 1.55rem; color: var(--maroon); }
.section-sub { color: var(--ink-2); margin-top: 4px; }

.ornament {
  display: inline-block;
  width: 11px;
  height: 11px;
  background: linear-gradient(135deg, var(--turmeric), var(--gold));
  transform: rotate(45deg);
  border-radius: 2px;
  position: relative;
  margin-bottom: 10px;
}
.ornament::before, .ornament::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 46px;
  height: 2px;
  background: var(--gold-soft);
}
.ornament::before { right: 16px; border-radius: 2px; }
.ornament::after { left: 16px; border-radius: 2px; }

/* ---------- Date row ---------- */
.date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.date-stepper { display: flex; align-items: center; gap: 10px; }

.date-field { display: flex; flex-direction: column; gap: 3px; }
.date-cap {
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .3px;
}
.date-field input {
  font-family: "Mukta", "Mukta Mahee", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 10px 12px;
  min-height: 46px;
  width: 170px;
  transition: border-color .15s ease;
}
.date-field input:hover { border-color: var(--gold); }
.date-field input:focus { border-color: var(--turmeric); outline: none; }

.date-label {
  font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--maroon);
  margin: 2px 0 16px;
}

/* ---------- Panels & cards ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
  transition: box-shadow .2s ease, transform .2s ease;
}

.panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-title-row h3 { font-size: 1.15rem; color: var(--ink); }
.tiny-en { font-size: .72rem; font-weight: 600; letter-spacing: 1px; color: var(--gold); text-transform: uppercase; }
.panel-hint { color: var(--ink-2); font-size: .9rem; margin-bottom: 14px; }
.foot-note { color: var(--ink-2); font-size: .82rem; margin-top: 14px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  opacity: .28;
  background: radial-gradient(circle at center, currentColor, transparent 70%);
  pointer-events: none;
}

.stat-chip {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.card-opening .stat-chip { background: var(--turmeric-tint); color: var(--turmeric-d); }
.card-received .stat-chip { background: var(--leaf-tint); color: var(--leaf); }
.card-spent .stat-chip { background: var(--maroon-tint); color: var(--maroon-ink); }
.card-closing .stat-chip { background: var(--gold-soft); color: var(--gold); }

.card-opening { border-top: 4px solid var(--turmeric); color: var(--turmeric-d); }
.card-received { border-top: 4px solid var(--leaf); color: var(--leaf); }
.card-spent { border-top: 4px solid var(--maroon); color: var(--maroon); }
.card-closing { border-top: 4px solid var(--gold); color: var(--gold); }

.stat-label { font-size: .92rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.stat-value {
  font-family: "Mukta", "Mukta Mahee", sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
  word-break: break-word;
}
.stat-closing-val { font-size: 1.85rem; }
.stat-card .stat-en { font-size: .72rem; color: var(--ink-2); margin-top: 4px; opacity: .75; }

/* dash extra */
.dash-extra { margin-top: 4px; }
.dash-count { color: var(--ink-2); font-size: .92rem; text-align: center; margin: 6px 0 14px; }
.dash-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.mini-compare { max-width: 560px; margin: 12px auto 6px; }

/* comparison bar */
.cmp-track {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ring-gray);
}
.cmp-seg { height: 100%; transition: width .5s ease; }
.cmp-seg.seg-rec { background: linear-gradient(90deg, var(--leaf), var(--leaf-d)); }
.cmp-seg.seg-spent { background: linear-gradient(90deg, var(--maroon), var(--maroon-ink)); }
.cmp-caption { display: flex; justify-content: space-between; margin-top: 6px; font-size: .8rem; font-weight: 600; }
.cmp-caption .cap-rec { color: var(--leaf); }
.cmp-caption .cap-spent { color: var(--maroon-ink); }

/* ---------- Opening balance ---------- */
.opening-panel { border-top: 4px solid var(--turmeric); }

.opening-saved {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--turmeric-tint);
  border: 1.5px dashed var(--turmeric);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.opening-saved-cap { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.opening-saved-amt {
  font-family: "Mukta", "Mukta Mahee", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--maroon);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.open-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.open-form .input-wrap { flex: 1 1 200px; }
.open-form .btn { flex: none; }

/* ---------- Forms ---------- */
.form-panel { border-top: 4px solid var(--maroon); }
.form-panel.editing { box-shadow: 0 0 0 3px var(--turmeric); }

.tx-type-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.type-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: all .18s ease;
}
.type-pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pill-icon {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-2);
  transition: all .18s ease;
}
.type-pill .pill-text { font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif; font-weight: 600; font-size: 1rem; color: var(--ink); }
.type-pill .pill-en { display: block; font-size: .7rem; color: var(--ink-2); margin-top: -2px; }

.type-rec:has(input:checked) {
  border-color: var(--leaf);
  background: var(--leaf-tint);
}
.type-rec:has(input:checked) .pill-icon { background: var(--leaf); color: #fff; }

.type-spent:has(input:checked) {
  border-color: var(--maroon);
  background: var(--maroon-tint);
}
.type-spent:has(input:checked) .pill-icon { background: var(--maroon); color: #fff; }

/* fallback for browsers without :has() */
.type-rec.checked { border-color: var(--leaf); background: var(--leaf-tint); }
.type-rec.checked .pill-icon { background: var(--leaf); color: #fff; }
.type-spent.checked { border-color: var(--maroon); background: var(--maroon-tint); }
.type-spent.checked .pill-icon { background: var(--maroon); color: #fff; }

.form-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; color: var(--ink); }
.field .opt { color: var(--ink-2); font-weight: 400; font-size: .82rem; }

.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Mukta", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-2);
  pointer-events: none;
}

input[type="number"], input[type="text"] {
  font-family: "Mukta", "Mukta Mahee", sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
  min-height: 50px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap input { padding-left: 40px; }
input:focus { border-color: var(--turmeric); outline: none; box-shadow: 0 0 0 3px var(--turmeric-tint); }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Transaction list ---------- */
.tx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  animation: fadeIn .3s ease;
}
.tx-item.txn-credit { border-left: 5px solid var(--leaf); }
.tx-item.txn-debit { border-left: 5px solid var(--maroon); }

.tx-chip {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.txn-credit .tx-chip { background: var(--leaf-tint); color: var(--leaf); }
.txn-debit .tx-chip { background: var(--maroon-tint); color: var(--maroon-ink); }

.tx-body { flex: 1; min-width: 0; }
.tx-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tx-type { font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif; font-weight: 600; font-size: .95rem; color: var(--ink); }
.tx-amount {
  font-family: "Mukta", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.txn-credit .tx-amount { color: var(--leaf); }
.txn-debit .tx-amount { color: var(--maroon-ink); }

.tx-meta { display: flex; gap: 10px; align-items: center; margin-top: 2px; color: var(--ink-2); font-size: .8rem; flex-wrap: wrap; }
.tx-note { font-style: normal; }
.tx-actions { display: flex; gap: 6px; flex: none; }
.tx-actions .icon-btn { width: 38px; height: 38px; border-radius: 11px; }

.empty-state {
  text-align: center;
  padding: 30px 16px;
  color: var(--ink-2);
  border: 1.5px dashed var(--line);
  border-radius: 16px;
}
.empty-state .empty-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--gold);
}
.empty-state p { margin-top: 4px; }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.chart-panel { margin-bottom: 0; }

.cmp-wrap { padding: 6px 0; }
.cmp-block { margin-bottom: 12px; }
.cmp-label { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 600; margin-bottom: 5px; }
.cmp-label .lab-rec { color: var(--leaf); }
.cmp-label .lab-spent { color: var(--maroon-ink); }

/* ring chart */
.ring-wrap {
  position: relative;
  width: 175px;
  height: 175px;
  margin: 6px auto;
}
.ring-wrap svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--ring-gray); stroke-width: 15; }
.ring-rec { fill: none; stroke: var(--leaf); stroke-width: 15; stroke-linecap: butt; transition: stroke-dasharray .6s ease; }
.ring-spent { fill: none; stroke: var(--maroon); stroke-width: 15; stroke-linecap: butt; transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 12px;
}
.ring-amt { font-family: "Mukta", sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.ring-cap { font-size: .72rem; color: var(--ink-2); margin-top: 2px; }

.chart-empty { color: var(--ink-2); text-align: center; padding: 26px 10px; font-size: .9rem; }

/* month chart */
.legend { display: flex; gap: 18px; justify-content: center; margin-bottom: 14px; font-size: .85rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.swatch-rec { background: var(--leaf); }
.swatch-spent { background: var(--maroon); }

.chart-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.chart-scroll::-webkit-scrollbar { height: 8px; }
.chart-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.month-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-width: 100%;
  padding: 8px 4px 0;
  height: 240px;
}

.bar-day {
  flex: 1;
  min-width: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 100%;
  position: relative;
}
.bar-day .bar-w { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.bar-rec, .bar-spent {
  width: min(10px, 42%);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  position: relative;
  transition: height .5s ease;
}
.bar-rec { background: linear-gradient(180deg, var(--leaf-d), var(--leaf)); }
.bar-spent { background: linear-gradient(180deg, var(--maroon-ink), var(--maroon)); }
.bar-day .bar-x {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .68rem;
  color: var(--ink-2);
  font-weight: 600;
  pointer-events: none;
}

.month-chart .chart-base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  height: 2px;
  background: var(--line);
}

/* ---------- Data tab ---------- */
.data-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.data-item { text-align: center; }
.data-num {
  font-family: "Mukta", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--maroon);
  display: block;
  font-variant-numeric: tabular-nums;
}
.data-cap { font-size: .82rem; color: var(--ink-2); }

.data-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.data-actions .btn { flex: 1 1 220px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--bg);
  padding: 13px 22px;
  border-radius: 999px;
  font-family: "Baloo Tamma 2", "Mukta Mahee", sans-serif;
  font-weight: 600;
  font-size: .98rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .28s ease;
  max-width: min(92vw, 480px);
  text-align: center;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--maroon); color: #fff; }
.toast.ok { background: var(--leaf); color: #fff; }

/* ---------- Dialog ---------- */
.confirm-dialog {
  border: none;
  border-radius: 22px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: calc(100vw - 40px);
}
.confirm-dialog::backdrop { background: rgba(35, 20, 10, .55); backdrop-filter: blur(3px); }
.confirm-dialog[open] { animation: pop .25s ease; }

@keyframes pop {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

.dialog-inner { padding: 26px 24px; text-align: center; }
.dialog-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--maroon-tint);
  color: var(--maroon-ink);
}
.dialog-inner h3 { font-size: 1.25rem; color: var(--maroon); }
.dialog-inner p { color: var(--ink-2); margin: 8px 0 18px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line-2);
  padding: 28px 0 calc(96px + env(safe-area-inset-bottom));
}
.footer-inner { text-align: center; }
.footer-inner .ornament { margin-bottom: 12px; }
.footer-inner p { color: var(--ink-2); font-size: .92rem; }
.foot-en { font-size: .76rem; margin-top: 4px; opacity: .7; letter-spacing: .3px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  /* bottom navigation on mobile */
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    border-top: 1px solid var(--line-2);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 24px rgba(60, 40, 15, .10);
  }
  .nav-list {
    justify-content: space-around;
    padding: 8px 6px;
    gap: 0;
    overflow: visible;
  }
  .nav-link {
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 14px;
    font-size: .74rem;
    line-height: 1.1;
    flex: 1;
  }
  .nav-link .nav-en { display: block; font-size: .56rem; font-family: "Mukta", sans-serif; letter-spacing: .3px; }
  .nav-link svg { width: 21px; height: 21px; }

  .brand-text .subtitle { max-width: 40vw; }
  .brand-text h1 { font-size: 1.15rem; }
  .brand-mark svg { width: 44px; height: 44px; }
  .today-pill { display: none; }

  body { padding-bottom: 0; }
  .site-footer { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-value { font-size: 1.4rem; }
  .stat-closing-val { font-size: 1.55rem; }

  .form-grid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 1.35rem; }
}

@media (max-width: 380px) {
  .stat-value { font-size: 1.25rem; }
  .stat-closing-val { font-size: 1.4rem; }
  .date-field input { width: 150px; }
  .nav-link .nav-en { display: none; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}