:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ink: #1a1612;
  --ink-soft: #4a433a;
  --muted: #7a7268;
  --gold: #c4a35a;
  --gold-deep: #8d6b2f;
  --gold-soft: #f3e6c4;
  --ivory: #f3eee6;
  --paper: #ffffff;
  --line: rgba(26, 22, 18, 0.08);
  --shadow: 0 8px 22px rgba(26, 22, 18, 0.06);
  --radius: 14px;
  --nav: 72px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background-color: #f3eee6;
  background-image: url("/static/img/theme-cream.svg");
  background-attachment: fixed;
  background-size: cover;
  background-position: center center;
  line-height: 1.5;
}

h1, h2, h3, h4, .display, .brand-serif {
  font-family: var(--font);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.25;
}

a { color: var(--gold-deep); }

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 64px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--nav);
  padding: 12px 22px;
  background: #ffffff;
  color: #1a1612;
  border-bottom: 1px solid #eeeeee;
}
.topbar .brand,
.topbar .brand strong { color: #1a1612 !important; }
.topbar .brand span { color: #8d6b2f; }
.topbar .btn-ghost { color: #1a1612; border-color: #e5e5e5; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff !important;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e8d5a3, #8d6b2f);
  color: #1a1612;
  font-size: 20px;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}

.brand span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d8c49a;
  margin-top: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-ghost, .btn-gold, .btn-ink, .btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  font-family: inherit;
  font-size: 13px;
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.25);
}
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

.btn-gold {
  background: linear-gradient(180deg, #e6cf93, #c4a35a);
  color: #1a1612;
  box-shadow: 0 8px 20px rgba(196, 163, 90, 0.28);
}
.btn-gold:hover { transform: translateY(-1px); color: #1a1612; }

.btn-ink {
  background: var(--ink);
  color: #fff;
}
.btn-ink:hover { color: #fff; transform: translateY(-1px); }

.btn-line {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-line:hover { border-color: var(--gold); color: var(--ink); }

.wa-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--ink, #1a1a1a);
  font: inherit;
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.wa-icon svg { width: 26px; height: 26px; display: block; transition: transform .18s ease; }
.wa-icon:hover {
  transform: translateY(-2px);
  background: var(--gold-soft, #f3e6c4);
  color: var(--gold-deep, #8d6b2f);
}
.wa-icon:hover svg { transform: scale(1.08); }
.wa-icon.wa-customer,
.wa-icon.wa-anyone { color: #128C7E; }
.wa-icon.wa-customer:hover,
.wa-icon.wa-anyone:hover { color: #075E54; background: #e7f6f3; }
.wa-icon.delete-invoice { color: #9c1c1c; }
.wa-icon.delete-invoice:hover { color: #6e1010; background: #fdecec; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy, .panel, .stat, .action, .auth-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196,163,90,.35), transparent 70%);
}

.kicker {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-deep);
  font-weight: 600;
}

.hero-copy h1, .auth-card h1, .page-head h1 {
  font-size: 1.7rem;
  margin: 8px 0 10px;
  line-height: 1.25;
}

.lede { color: var(--ink-soft); max-width: 46ch; margin: 0; }

.stat-grid, .action-grid {
  display: grid;
  gap: 16px;
}

.stat-grid { grid-template-columns: 1fr 1fr; }
.hero .stat-grid { grid-template-columns: 1fr; }

.stat { padding: 10px 12px; }
.stat em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font);
  font-size: 18px;
  font-weight: 650;
  color: var(--gold-deep);
  line-height: 1.2;
}
.stat small { color: var(--muted); }

.section-label {
  margin: 16px 0 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.section-label h2 { margin: 0; font-size: 15px; }

.action-grid { grid-template-columns: repeat(3, 1fr); }

.action {
  padding: 14px;
  text-decoration: none;
  color: inherit;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .18s ease, border-color .18s ease;
}
.action:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 163, 90, 0.55);
  color: inherit;
}
.action .icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  font-size: 1.15rem;
}
.action h3 { margin: 8px 0 2px; font-size: 16px; }
.action p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.panel { padding: 10px 12px; }
.panel h2, .panel h3 { margin-top: 0; font-size: 15px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head p { margin: 0; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

input, select, textarea, .form-control, .form-select {
  width: 100%;
  border: 1px solid rgba(26,22,18,.12) !important;
  background: #fff !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  box-shadow: none !important;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus, .form-control:focus, .form-select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 4px rgba(196, 163, 90, 0.18) !important;
}

.table-wrap {
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.scroll-box {
  max-height: calc(100vh - 220px);
  overflow: auto;
}
.scroll-box table {
  border-collapse: separate;
  border-spacing: 0;
}
.scroll-box thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.search-bar,
.stock-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 22px;
}
.search-bar .field,
.stock-row .field { flex: 1; min-width: 0; }
.stock-row .field.narrow { flex: 0.7; }
.search-bar .btn-gold,
.stock-row .btn-gold,
.stock-row .btn-line { flex: 0 0 auto; min-height: 30px; padding: 6px 12px; }
.stock-row { margin-bottom: 0; }
.master-link {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}
.master-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.master-copy h2 { margin: 0; }
.master-link p { margin: 0; color: var(--muted); }
.master-link strong { color: var(--gold-deep); white-space: nowrap; margin-top: 8px; }
.master-mark {
  flex: 1 1 46%;
  max-width: 220px;
  min-height: 160px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 30%, #fff 0%, #f8f1df 46%, #e7d3a2 100%);
  border: 1px solid #eadfcb;
}
.master-mark svg { width: min(72%, 110px); height: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 5px 10px; text-align: left; vertical-align: middle; white-space: nowrap; line-height: 1.35; }
thead th {
  background: #1a1612;
  color: #f7f3ec;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
tbody tr:nth-child(even) { background: #fbf8f2; }
tbody tr:hover { background: #f6efe2; }
tbody tr.row-added td { background: #e7f6ec; }
tbody tr.row-removed td { background: #fde8e8; }
td.cell-reduced { background: #fde8e8; color: #9b2c2c; font-weight: 600; }
.tag-ok, .tag-reduced, .tag-out {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.tag-ok { background: #e7f6ec; color: #1f7a3a; }
.tag-reduced { background: #fde8e8; color: #9b2c2c; }
.tag-out { background: #eeeae4; color: #6b6258; }
tbody tr.row-added:hover td { background: #d7f0e0; }
tbody tr.row-removed:hover td { background: #f8d4d4; }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.filters-panel {
  position: relative;
  z-index: 2;
  margin-bottom: 28px;
}
#kpi-cards { margin-top: 8px; }
.filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}
.filters input[type="date"] {
  width: 8.2rem !important;
  min-width: 0;
  flex: 0 0 auto;
  padding: 6px 10px !important;
  border-radius: 999px !important;
  font-size: 0.8rem;
}
.filters #customFilterBtn {
  flex: 0 0 auto;
  white-space: nowrap;
  background: #c4a35a !important;
  color: #1a1612 !important;
  border: 1px solid #a6853c !important;
  border-radius: 999px;
  font-weight: 650;
  padding: 6px 14px;
  font-size: 0.8rem;
}
.filters #customFilterBtn:hover {
  background: #1a1612 !important;
  color: #f6efe2 !important;
  border-color: #1a1612 !important;
}
.filters .filter-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.filters .btn, .filter-btn {
  border-radius: 999px !important;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.chart-card {
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  height: 240px;
  display: flex;
  flex-direction: column;
}
.chart-card canvas,
.trend-card canvas {
  width: 100% !important;
  height: 150px !important;
  max-height: 150px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-visual {
  position: relative;
  padding: 48px;
  color: #1a1612;
  background: #ffffff;
  border-right: 1px solid #eeeeee;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-visual h2 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 12px 0;
  max-width: 18ch;
}

.auth-form {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-card {
  width: min(520px, 100%);
  padding: 32px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.alert {
  border: 1px solid #eeeeee;
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: #ffffff;
}
.alert-success { background: #e8f6ec; color: #1d6b38; }
.alert-success::before { content: "✓  "; }
.alert-danger { background: #fdecec; color: #8d2b2b; }
.alert-info, .alert-warning { background: #ffffff; color: #6d5b32; border-color: #eee6d8; }
.alert-info::before, .alert-warning::before { content: "✓  "; }

.sales-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}
.sales-title {
  font-family: var(--font);
  font-size: 1.25rem;
  line-height: 1.25;
  margin: 4px 0 8px;
  font-weight: 650;
}
.trend-card {
  background: #fff;
  border: 1px solid #eee6d8;
  border-radius: 12px;
  padding: 10px 12px 6px;
  height: 200px;
  overflow: hidden;
}
.trend-plot {
  position: relative;
  height: 150px;
  overflow: hidden;
}
.filter-btn {
  background: #fff !important;
  color: #3c3832 !important;
  border: 1px solid #e7e0d4 !important;
  border-radius: 999px !important;
  padding: 6px 11px !important;
  font-size: 0.8rem !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.filter-btn.active {
  background: #fff8ea !important;
  border-color: #c4a35a !important;
  color: #1a1612 !important;
  box-shadow: inset 0 0 0 1px #c4a35a;
}
.filter-btn[data-range="today"]:hover { background: #f6e7c1 !important; border-color: #c4a35a !important; }
.filter-btn[data-range="yesterday"]:hover { background: #f8d4c2 !important; border-color: #d08962 !important; }
.filter-btn[data-range="week"]:hover { background: #d9ecd9 !important; border-color: #6a9a6e !important; }
.filter-btn[data-range="month"]:hover { background: #f3dd9a !important; border-color: #c4a35a !important; }
.filter-btn[data-range="3m"]:hover { background: #d5e6f6 !important; border-color: #6d93b8 !important; }
.filter-btn[data-range="6m"]:hover { background: #e6d8f2 !important; border-color: #8d6aa8 !important; }
.filter-btn[data-range="year"]:hover { background: #f6d5e0 !important; border-color: #c47088 !important; }
.filter-btn[data-range="all"]:hover { background: #e4dfd6 !important; border-color: #6d6458 !important; }

.muted { color: var(--muted); }
.center { text-align: center; }

.app-body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #1a1612;
  border-right: 1px solid #eeeeee;
  padding: 18px 12px 14px;
  z-index: 30;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1a1612 !important;
  text-decoration: none;
  padding: 2px 8px 18px;
}
.logo-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
  background:
    radial-gradient(circle, #fff 0 7px, transparent 8px),
    conic-gradient(from 210deg, #f6edd4, #c4a35a, #f8f3e6, #a8843a, #f6edd4);
  box-shadow: inset 0 0 0 2px #fff;
}
.side-brand strong {
  display: block;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.1;
  color: #1a1612;
}
.side-brand span {
  display: block;
  margin-top: 2px;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b0893e;
}

.side-label {
  margin: 0 12px 6px;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a8843a;
}

.side-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.side-group { display: flex; flex-direction: column; gap: 2px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #4e4942 !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.side-link svg { flex: 0 0 auto; color: #8d867c; transition: color .16s ease; }
.side-link:hover {
  background: #fbf6ea;
  color: #1a1612 !important;
  border-color: #ead9b0;
  transform: translateX(3px);
}
.side-link:hover svg { color: #a8843a; }
.side-link.active {
  background: #fbf6ea;
  color: #1a1612 !important;
  border-color: #ead9b0;
  box-shadow: inset 3px 0 0 #c4a35a;
}
.side-link.active svg { color: #8d6b2f; }

.side-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #eeeeee;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: #3c3832;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #8d6b2f;
  font-size: 0.8rem;
  font-weight: 600;
}

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.workbar {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;
}
.workbar h1 {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
}
.workbar .profit-eye { margin-left: auto; }
.profit-eye {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.profit-eye svg { width: 18px; height: 18px; }
.profit-eye .eye-on { display: none; }
body.show-profit .profit-eye .eye-off { display: none; }
body.show-profit .profit-eye .eye-on { display: block; }
body:not(.show-profit) .is-profit { display: none !important; }
.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
}
.work { padding: 10px 12px; }
.work .page { width: auto; margin: 0; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.metric {
  background: #fff;
  border: 1px solid #eee6d8;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: none;
}
.metric.up { border-color: #c9e7d1; background: #f7fbf8; }
.metric.up strong { color: #1f7a3a; }
.metric.down { border-color: #f0c8c8; background: #fff8f8; }
.metric.down strong { color: #9b2c2c; }
.metric em {
  display: block;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}
#kpi-cards.metric-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metric-grid.stock-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid.manage-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body:not(.show-profit) .metric-grid.stock-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.side-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .menu-btn { display: inline-grid; place-items: center; }
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: none; }
  .side-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 25;
  }
}

@media (max-width: 980px) {
  .hero, .auth-shell, .chart-grid, .pair-row, .form-grid, .action-grid, .kpi-grid, .sales-hero {
    grid-template-columns: 1fr;
  }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .auth-visual { min-height: 280px; padding: 28px; }
  .auth-visual h2 { font-size: 1.7rem; }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .nav-actions { width: 100%; }
  .stat-grid, .kpi-grid { grid-template-columns: 1fr; }
  .page { width: min(1180px, calc(100% - 20px)); }
  .hero-copy, .auth-card, .panel { padding: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .search-bar, .stock-row { flex-wrap: wrap; }
  .master-link { flex-direction: column; }
  .master-mark { max-width: none; width: 100%; min-height: 140px; }
}
html[lang="hi"] body { font-family: "Noto Sans Devanagari", var(--font); }
html[lang="pa"] body { font-family: "Noto Sans Gurmukhi", var(--font); }
body.theme-cream {
  background-color: #f3eee6;
  background-image: url("/static/img/theme-cream.svg");
}
body.theme-white {
  background-color: #f7f8fa;
  background-image: url("/static/img/theme-white.svg");
}
body.theme-gold {
  background-color: #f3dfb0;
  background-image: url("/static/img/theme-gold.svg");
}
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}
.shop-stamp {
  width: 92px;
  height: 92px;
  display: block;
  margin-top: 10px;
  transform: rotate(-8deg);
}
.choice input {
  width: auto !important;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  box-shadow: none !important;
}
.choice:has(input:checked) { border-color: #c4a35a; box-shadow: inset 0 0 0 1px #c4a35a; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid #ddd; display: inline-block; }
.swatch.cream { background: linear-gradient(145deg, #fffaf2 0%, #e8d092 55%, #8d6b2f 100%); }
.swatch.white { background: linear-gradient(145deg, #ffffff 0%, #d5e0ec 55%, #8ea0b4 100%); }
.swatch.gold { background: linear-gradient(145deg, #fff6d4 0%, #e0b44a 50%, #7a5418 100%); }
@media print {
  body { background: #fff !important; background-image: none !important; }
}

.customer-table td.addr {
  white-space: nowrap;
  max-width: none;
}
.customer-table td .muted {
  display: inline;
  margin-left: 8px;
  white-space: nowrap;
}
.customer-table .row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.customer-table .row-actions .btn-line {
  padding: 5px 10px;
  font-size: 0.82rem;
}
.customer-table .delete-invoice-form { display: inline-flex; margin: 0; }
.customer-table .wa-icon {
  flex-direction: row;
  gap: 4px;
  margin: 0;
  padding: 4px 8px;
  white-space: nowrap;
}
.customer-table .wa-icon svg { width: 16px; height: 16px; }
#invoiceTableBody tr.invoice-row { cursor: pointer; }
#invoiceTableBody tr.invoice-row:hover td { background: var(--gold-soft); }

.bill-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(26, 22, 18, 0.46);
}
.bill-sheet[hidden] { display: none; }
.bill-card {
  width: min(680px, 100%);
  max-height: min(88vh, 840px);
  overflow: auto;
  background: #fff;
  color: var(--ink);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(26, 22, 18, 0.22);
  padding: 26px 26px 20px;
}
.bill-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.bill-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
  font-weight: 700;
}
.bill-top h2 { margin: 4px 0 0; font-size: 1.45rem; }
.bill-top .muted { margin: 2px 0 0; }
.bill-status {
  flex: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}
.bill-status.paid { background: #e7f6ef; color: #146c43; }
.bill-status.pending { background: #fff4e0; color: #8a5a00; }
.bill-status.unknown { background: var(--ivory); color: var(--muted); }
.bill-who {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 18px;
  margin: 16px 0 8px;
}
.bill-who span, .bill-pay span, .bill-totals span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.bill-who strong, .bill-pay strong { font-size: 1.02rem; }
.bill-who p { margin: 4px 0 0; color: var(--ink-soft); }
.bill-card table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.bill-card th {
  text-align: left;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.bill-card td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.bill-card td.num, .bill-card th.num { text-align: right; }
.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.ledger-head .bill-kicker { margin: 0; }
.ledger-head .btn-line { padding: 6px 12px; font-size: 0.82rem; }
.bill-card table.pay-ledger {
  table-layout: fixed;
  border: 1px solid #e7e0d4;
  border-radius: 12px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}
.bill-card table.pay-ledger th,
.bill-card table.pay-ledger td {
  padding: 11px 16px;
  white-space: nowrap;
}
.bill-card table.pay-ledger th {
  background: #1a1612;
  color: #f7f3ec;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: normal;
}
.bill-card table.pay-ledger th.num,
.bill-card table.pay-ledger td.num { text-align: right; }
.bill-card table.pay-ledger th.mode,
.bill-card table.pay-ledger td.mode {
  text-align: left;
  width: 18%;
  padding-left: 28px;
}
.bill-card table.pay-ledger th.edit,
.bill-card table.pay-ledger td.edit {
  width: 52px;
  padding: 8px;
  text-align: center;
}
.pay-edit {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #e7e0d4;
  background: #fff;
  color: var(--gold-deep);
  cursor: pointer;
}
.pay-edit:hover { background: var(--gold-soft); }
.bill-card table.pay-ledger tbody tr:nth-child(even) { background: #fbf8f2; }
.bill-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.bill-totals div {
  background: var(--ivory);
  border-radius: 12px;
  padding: 10px 12px;
}
.bill-totals strong { font-size: 1.05rem; }
.bill-pay {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fffaf1;
  border: 1px solid #f0e2c4;
}
.bill-pay .wide { grid-column: 1 / -1; }
.bill-pay .remain strong { color: #8a5a00; font-size: 1.2rem; }
.bill-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
@media (max-width: 640px) {
  .bill-who, .bill-totals, .bill-pay { grid-template-columns: 1fr; }
  .bill-card { padding: 18px 16px 14px; }
}
