:root {
  --bg: #f6f4ee;
  --surface: #fffdf8;
  --surface-strong: #fff7e8;
  --ink: #1e1b16;
  --muted: #6b6458;
  --line: #e7dcc8;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 22px;
  --shadow: 0 14px 40px rgba(48, 39, 24, 0.08);
  --font-main: "Segoe UI", "Noto Sans Devanagari", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(245, 158, 11, 0.2), transparent 34%),
    linear-gradient(180deg, #fcfaf5 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: var(--font-main);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 16px 110px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 4px 24px;
}

.topbar h1,
.hero-strip h2,
.panel h2,
.panel h3,
.auth-card h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.eyebrow,
.muted-line {
  margin: 0;
  color: var(--muted);
}

.topbar-actions,
.hero-actions,
.bill-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.content {
  display: grid;
  gap: 18px;
}

.subnav {
  margin: -8px 0 10px;
}

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

.panel,
.auth-card,
.hero-strip {
  padding: 20px;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(245, 158, 11, 0.08));
}

.stats-grid,
.action-grid {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.action-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat-card,
.action-card {
  padding: 18px;
}

.stat-card span,
.action-card span {
  color: var(--muted);
  display: block;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.4rem;
}

.action-card strong {
  display: block;
  margin-bottom: 8px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.stack,
.list-stack {
  display: grid;
  gap: 12px;
}

.workspace-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 300px) minmax(320px, 1fr) minmax(280px, 360px);
  align-items: start;
}

.workspace-form {
  position: sticky;
  top: 16px;
}

.workspace-list,
.workspace-form,
.workspace-history {
  min-height: 0;
}

.scroll-list,
.picker-list {
  max-height: min(70vh, 720px);
  overflow: auto;
  padding-right: 6px;
}

.picker-list {
  display: grid;
  gap: 10px;
}

.picker-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.picker-card strong,
.picker-card span {
  display: block;
}

.picker-card span {
  margin-top: 4px;
  color: var(--muted);
}

.picker-card:hover,
.picker-card.active {
  border-color: var(--brand);
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.selection-banner {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 247, 232, 0.55);
}

.selection-banner strong,
.selection-banner span {
  display: block;
}

.selection-banner span {
  margin-top: 4px;
  color: var(--muted);
}

.inline-link {
  color: var(--ink);
  text-decoration: none;
}

.inline-link:hover {
  color: var(--brand-dark);
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:hover {
  background: rgba(255, 247, 232, 0.5);
}

.activity-columns {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  align-items: start;
}

.detail-calendar-panel,
.detail-activity {
  grid-column: 1 / -1;
}

.delivery-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-head {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  padding-bottom: 4px;
}

.calendar-day,
.calendar-empty {
  min-height: 84px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 247, 232, 0.35);
  padding: 10px;
}

.calendar-empty {
  background: transparent;
  border-style: dashed;
  opacity: 0.4;
}

.calendar-day {
  display: grid;
  gap: 6px;
  align-content: start;
}

.calendar-day strong {
  font-size: 1rem;
}

.calendar-date,
.calendar-day small {
  color: var(--muted);
}

.calendar-day.override {
  border-color: var(--brand);
  background: rgba(15, 118, 110, 0.08);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(245, 158, 11, 0.35);
}

.activity-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 247, 232, 0.4);
}

.compact-list .list-row {
  padding: 10px 0;
}

.grid-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-form label,
.inline-form label,
.stack label {
  display: grid;
  gap: 6px;
}

.grid-form label span,
.inline-form label span,
.stack label span {
  font-size: 0.95rem;
  color: var(--muted);
}

.span-2 {
  grid-column: span 2;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: var(--brand);
  outline: 2px solid rgba(15, 118, 110, 0.15);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.pill-btn,
.install-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}

.primary-btn {
  background: var(--brand);
  color: white;
}

.secondary-btn {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid #f0d9aa;
}

.ghost-btn {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.pill-btn.ok {
  background: #dcfce7;
  color: #166534;
}

.pill-btn.warn {
  background: #fee2e2;
  color: #991b1b;
}

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

.list-row:last-child {
  border-bottom: 0;
}

.list-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.list-row.large {
  align-items: flex-start;
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

.flash-stack {
  display: grid;
  gap: 8px;
}

.flash {
  border-radius: 16px;
  padding: 12px 14px;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

.auth-card {
  max-width: 560px;
  margin: 0 auto;
}

.dual-auth {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

#recaptcha-container {
  min-height: 78px;
}

.auth-primary h3,
.auth-helper h3 {
  margin: 0 0 6px;
}

.auth-helper {
  display: grid;
  gap: 12px;
}

.auth-primary {
  max-width: 460px;
}

.auth-helper summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.auth-helper summary::-webkit-details-marker {
  display: none;
}

.auth-secondary {
  margin-top: 12px;
}

button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.panel-flat {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 247, 232, 0.4);
}

.auth-card.wide {
  max-width: 720px;
}

.hero-panel {
  margin-bottom: 16px;
}

.muted-line a {
  color: var(--brand-dark);
  font-weight: 700;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
}

.compact {
  margin-bottom: 16px;
}

.bill-table {
  display: grid;
  gap: 14px;
}

.history-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-history .bill-card {
  padding: 14px;
}

.bill-card {
  padding: 16px;
}

.bill-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.bill-top p {
  margin: 4px 0 0;
  color: var(--muted);
}

.bill-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.bill-grid span {
  color: var(--muted);
}

.status-badge {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-badge.paid {
  background: #dcfce7;
  color: #166534;
}

.status-badge.partial {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.pending {
  background: #fee2e2;
  color: #991b1b;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: min(94vw, 720px);
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px;
  backdrop-filter: blur(12px);
}

.bottom-nav a {
  padding: 10px 8px;
  text-align: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.bottom-nav a.active {
  background: var(--brand);
  color: white;
}

.install-btn {
  position: fixed;
  right: 16px;
  bottom: 88px;
  background: var(--accent);
  color: #3b2300;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

body[data-page="customers"] .content {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  align-items: start;
}

body[data-page="customers"] .content > section:first-child {
  position: sticky;
  top: 16px;
}

body[data-page="customers"] .content > section:last-child .list-stack {
  max-height: min(70vh, 720px);
  overflow: auto;
  padding-right: 6px;
}

.filter-hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .topbar,
  .hero-strip,
  .bill-top {
    flex-direction: column;
  }

  .workspace-shell,
  body[data-page="customers"] .content,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .activity-columns {
    grid-template-columns: 1fr;
  }

  .delivery-calendar {
    gap: 6px;
  }

  .calendar-day,
  .calendar-empty {
    min-height: 72px;
    padding: 8px;
  }

  .calendar-head {
    font-size: 0.78rem;
  }

  .workspace-form,
  body[data-page="customers"] .content > section:first-child {
    position: static;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .section-head {
    align-items: flex-start;
  }

  .bottom-nav a {
    font-size: 0.78rem;
    padding: 11px 4px;
  }
}
