:root,
[data-theme="classic"] {
  --rt-bg: #f3f1ec;
  --rt-surface: #fffdf9;
  --rt-ink: #1c2a22;
  --rt-muted: #5d6b63;
  --rt-accent: #1f6b4a;
  --rt-accent-dark: #154d35;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #d7ddd7;
  --rt-sidebar: #14261d;
  --rt-sidebar-end: #0f1b15;
  --rt-sidebar-text: #e8f0ea;
  --rt-sidebar-muted: #9bb5a6;
  --rt-sidebar-section: #7f9a8b;
  --rt-sidebar-link: #d5e4db;
  --rt-sidebar-hover: rgba(255, 255, 255, 0.08);
  --rt-glow: rgba(31, 107, 74, 0.08);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #f5faf7;
  --rt-table-head: #eef4f0;
  --rt-ok-bg: #ecfdf5;
  --rt-ok-border: #86efac;
}

[data-theme="soft_blue"] {
  --rt-bg: #eef3f8;
  --rt-surface: #fbfcfe;
  --rt-ink: #1e2a3a;
  --rt-muted: #5b6b7c;
  --rt-accent: #3a6ea5;
  --rt-accent-dark: #2b527a;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #d5dde8;
  --rt-sidebar: #e8eef6;
  --rt-sidebar-end: #dce6f2;
  --rt-sidebar-text: #1e2a3a;
  --rt-sidebar-muted: #66788c;
  --rt-sidebar-section: #7a8fa3;
  --rt-sidebar-link: #334155;
  --rt-sidebar-hover: rgba(58, 110, 165, 0.12);
  --rt-glow: rgba(58, 110, 165, 0.10);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #f0f5fb;
  --rt-table-head: #e8eef6;
  --rt-ok-bg: #eaf3fb;
  --rt-ok-border: #93c5fd;
}

[data-theme="warm_sand"] {
  --rt-bg: #f7f1e8;
  --rt-surface: #fffaf3;
  --rt-ink: #3a2f24;
  --rt-muted: #7a6a58;
  --rt-accent: #9a6b3f;
  --rt-accent-dark: #7a5230;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #e4d7c6;
  --rt-sidebar: #f3e8da;
  --rt-sidebar-end: #eadccb;
  --rt-sidebar-text: #3a2f24;
  --rt-sidebar-muted: #8a7660;
  --rt-sidebar-section: #9a846c;
  --rt-sidebar-link: #4a3c2e;
  --rt-sidebar-hover: rgba(154, 107, 63, 0.12);
  --rt-glow: rgba(154, 107, 63, 0.10);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #f8f1e7;
  --rt-table-head: #f1e6d8;
  --rt-ok-bg: #f5efe6;
  --rt-ok-border: #d2b48c;
}

[data-theme="mist_teal"] {
  --rt-bg: #eef6f5;
  --rt-surface: #f8fcfb;
  --rt-ink: #1c3330;
  --rt-muted: #5a736f;
  --rt-accent: #2f7a72;
  --rt-accent-dark: #235c56;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #cfe0dd;
  --rt-sidebar: #e4f0ee;
  --rt-sidebar-end: #d7e8e5;
  --rt-sidebar-text: #1c3330;
  --rt-sidebar-muted: #62807b;
  --rt-sidebar-section: #6f918c;
  --rt-sidebar-link: #2a4541;
  --rt-sidebar-hover: rgba(47, 122, 114, 0.12);
  --rt-glow: rgba(47, 122, 114, 0.10);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #eef7f5;
  --rt-table-head: #e3efed;
  --rt-ok-bg: #e7f5f2;
  --rt-ok-border: #99d5cc;
}

[data-theme="coral_cream"] {
  --rt-bg: #f8f0ec;
  --rt-surface: #fffaf8;
  --rt-ink: #3a2722;
  --rt-muted: #7a5f57;
  --rt-accent: #c46b55;
  --rt-accent-dark: #9e4f3d;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #e8d5ce;
  --rt-sidebar: #f4e8e3;
  --rt-sidebar-end: #eddcd5;
  --rt-sidebar-text: #3a2722;
  --rt-sidebar-muted: #8a6a61;
  --rt-sidebar-section: #9a7a70;
  --rt-sidebar-link: #4a322c;
  --rt-sidebar-hover: rgba(196, 107, 85, 0.12);
  --rt-glow: rgba(196, 107, 85, 0.10);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #faf1ed;
  --rt-table-head: #f0e3de;
  --rt-ok-bg: #f8ece8;
  --rt-ok-border: #e8b4a6;
}

[data-theme="slate_sky"] {
  --rt-bg: #eef1f4;
  --rt-surface: #fafbfc;
  --rt-ink: #243040;
  --rt-muted: #5f6e7e;
  --rt-accent: #4b6584;
  --rt-accent-dark: #374b63;
  --rt-warn: #b45309;
  --rt-danger: #b42318;
  --rt-border: #d3dae2;
  --rt-sidebar: #e6ebf0;
  --rt-sidebar-end: #dce3ea;
  --rt-sidebar-text: #243040;
  --rt-sidebar-muted: #667788;
  --rt-sidebar-section: #7a8a9a;
  --rt-sidebar-link: #334155;
  --rt-sidebar-hover: rgba(75, 101, 132, 0.12);
  --rt-glow: rgba(75, 101, 132, 0.10);
  --rt-stat-from: #ffffff;
  --rt-stat-to: #f0f3f6;
  --rt-table-head: #e5ebf1;
  --rt-ok-bg: #e9eef4;
  --rt-ok-border: #a8b8c8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans Devanagari", Tahoma, sans-serif;
  background:
    radial-gradient(circle at top right, var(--rt-glow), transparent 40%),
    linear-gradient(180deg, color-mix(in srgb, var(--rt-bg) 70%, white), var(--rt-bg) 100%);
  color: var(--rt-ink);
  min-height: 100vh;
}

a { color: var(--rt-accent); text-decoration: none; }
a:hover { color: var(--rt-accent-dark); }

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--rt-sidebar), var(--rt-sidebar-end));
  color: var(--rt-sidebar-text);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--rt-border);
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
  color: var(--rt-sidebar-text);
}

.brand-sub {
  color: var(--rt-sidebar-muted);
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
}

.nav-link {
  display: block;
  color: var(--rt-sidebar-link);
  padding: 0.55rem 0.75rem;
  border-radius: 0.45rem;
  margin-bottom: 0.2rem;
}

.nav-link:hover,
.nav-link.active {
  background: var(--rt-sidebar-hover);
  color: var(--rt-sidebar-text);
}

.nav-section {
  margin-top: 1.1rem;
  margin-bottom: 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rt-sidebar-section);
  padding-left: 0.75rem;
}

.main {
  padding: 1.25rem 1.5rem 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.card {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 24px rgba(20, 38, 29, 0.04);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.stat {
  background: linear-gradient(145deg, var(--rt-stat-from), var(--rt-stat-to));
  border: 1px solid var(--rt-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.stat .label { color: var(--rt-muted); font-size: 0.85rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: 0.25rem; }

.btn-primary {
  background: var(--rt-accent);
  border-color: var(--rt-accent);
}

.btn-primary:hover {
  background: var(--rt-accent-dark);
  border-color: var(--rt-accent-dark);
}

.table thead th {
  background: var(--rt-table-head);
  color: var(--rt-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-low {
  background: #fff7ed;
  color: var(--rt-warn);
  border: 1px solid #fdba74;
}

.badge-ok {
  background: var(--rt-ok-bg);
  color: var(--rt-accent);
  border: 1px solid var(--rt-ok-border);
}

.line-items-table input,
.line-items-table select {
  min-width: 100px;
}

/* ---------- Subscription ---------- */

.plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0.65rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.plan-banner-danger {
  background: var(--rt-danger);
  color: #fff;
}

.plan-banner-warning {
  background: var(--rt-warn);
  color: #fff;
}

.plan-banner-info {
  background: var(--rt-accent);
  color: #fff;
}

.plan-status-card {
  padding: 1.5rem;
}

.plan-status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.plan-status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--rt-muted);
}

.plan-status-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rt-ink);
}

.plan-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  padding: 1rem 0 1.25rem;
  border-top: 1px solid var(--rt-border);
}

.plan-fact-label {
  font-size: 0.78rem;
  color: var(--rt-muted);
  margin-bottom: 0.2rem;
}

.plan-fact-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--rt-ink);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.plan-card {
  padding: 1.5rem;
}

.plan-card-current {
  border-color: var(--rt-accent);
  box-shadow: 0 0 0 2px rgba(31, 107, 74, 0.12);
}

.plan-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.plan-card-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--rt-ink);
}

.plan-price {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--rt-ink);
  line-height: 1.1;
}

.plan-price-unit {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--rt-muted);
}

.plan-price-year {
  font-size: 0.85rem;
  color: var(--rt-muted);
  margin-bottom: 1rem;
}

.plan-save {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(31, 107, 74, 0.12);
  color: var(--rt-accent-dark);
  font-weight: 600;
}

.plan-features,
.pay-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.plan-features li,
.pay-steps li {
  position: relative;
  padding-left: 1.4rem;
  font-size: 0.9rem;
  color: var(--rt-ink);
}

.plan-features li::before,
.pay-steps li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.45rem;
  width: 0.4rem;
  height: 0.22rem;
  border-left: 2px solid var(--rt-accent);
  border-bottom: 2px solid var(--rt-accent);
  transform: rotate(-45deg);
}

.plan-card .plan-features {
  margin-bottom: 1.25rem;
}

/* Monthly/yearly switch works without JavaScript: the hidden radios drive
   which price block and pay button stay visible. */
.plan-chooser {
  position: relative;
}

.plan-chooser > input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.plan-cycle-switch {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  border: 1px solid var(--rt-border);
  border-radius: 999px;
  background: var(--rt-table-head);
}

.plan-cycle-switch label {
  margin: 0;
  padding: 0.35rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--rt-muted);
  cursor: pointer;
}

.plan-cycle-switch label:hover {
  color: var(--rt-ink);
}

#cycle-monthly:checked ~ .plan-cycle-switch label[for="cycle-monthly"],
#cycle-yearly:checked ~ .plan-cycle-switch label[for="cycle-yearly"] {
  background: var(--rt-accent);
  color: #fff;
}

#cycle-monthly:focus-visible ~ .plan-cycle-switch label[for="cycle-monthly"],
#cycle-yearly:focus-visible ~ .plan-cycle-switch label[for="cycle-yearly"] {
  outline: 2px solid var(--rt-accent-dark);
  outline-offset: 2px;
}

#cycle-monthly:checked ~ .plan-grid [data-cycle="yearly"],
#cycle-yearly:checked ~ .plan-grid [data-cycle="monthly"] {
  display: none;
}

.plan-pay {
  margin: 0;
}

/* ---------- Installable app ---------- */

.header-install {
  white-space: nowrap;
}

.offline-wrap {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--rt-bg);
  color: var(--rt-ink);
}

.offline-wrap h1 {
  margin: 0.5rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.offline-wrap p {
  max-width: 30rem;
  margin: 0;
  color: var(--rt-muted);
}

.offline-hint {
  font-size: 0.9rem;
}

/* ---------- Payments ---------- */

.test-mode-badge {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #7a4b00;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.checkout-card {
  max-width: 560px;
  padding: 1.75rem;
}

.checkout-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rt-border);
}

.checkout-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rt-muted);
}

.checkout-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--rt-ink);
  word-break: break-all;
}

.pay-result {
  max-width: 560px;
  margin: 1rem auto;
  padding: 2rem 1.75rem;
  text-align: center;
}

.pay-result-icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}

.pay-result-ok .pay-result-icon {
  background: var(--rt-accent);
}

.pay-result-fail .pay-result-icon {
  background: #b02a37;
}

.pay-result-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rt-ink);
}

.pay-result-text {
  color: var(--rt-muted);
}

.pay-result-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  text-align: left;
}

.pay-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.pay-result-actions form {
  margin: 0;
}

/* ---------- Login / signup ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 3rem 3.5rem;
  color: var(--rt-sidebar-text);
  background:
    radial-gradient(circle at 85% 12%, rgba(255, 209, 102, 0.20), transparent 45%),
    radial-gradient(circle at 12% 88%, rgba(52, 168, 120, 0.28), transparent 50%),
    linear-gradient(160deg, var(--rt-sidebar) 0%, var(--rt-accent-dark) 65%, var(--rt-accent) 100%);
}

.auth-brand-inner {
  position: relative;
  max-width: 30rem;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.auth-logo-mark {
  border-radius: 0.9rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.auth-logo-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.auth-logo-sub {
  font-size: 0.8rem;
  color: var(--rt-sidebar-muted);
}

.auth-headline {
  font-size: clamp(1.7rem, 2.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.85rem;
}

.auth-sub {
  color: var(--rt-sidebar-muted);
  font-size: 1rem;
  margin-bottom: 1.75rem;
}

.auth-points {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: grid;
  gap: 0.85rem;
}

.auth-points li {
  position: relative;
  padding-left: 2rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  /* tick mark drawn with a rotated border so no icon font is needed */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.auth-points li::after {
  content: "";
  position: absolute;
  left: 0.42rem;
  top: 0.42rem;
  width: 0.42rem;
  height: 0.22rem;
  border-left: 2px solid #ffd166;
  border-bottom: 2px solid #ffd166;
  transform: rotate(-45deg);
}

.auth-industries {
  margin-bottom: 1.75rem;
}

.auth-industries-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--rt-sidebar-muted);
  margin-bottom: 0.6rem;
}

.auth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.auth-chip {
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.auth-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-form-side {
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem;
  background: var(--rt-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: 1.25rem;
  padding: 2.25rem;
  box-shadow: 0 18px 44px rgba(20, 38, 29, 0.10);
}

.auth-card-wide {
  max-width: 560px;
}

.auth-card-head {
  margin-bottom: 1.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--rt-ink);
  margin: 0 0 0.35rem;
}

.auth-tagline {
  color: var(--rt-muted);
  font-size: 0.92rem;
  margin: 0;
}

.auth-section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--rt-muted);
  padding-bottom: 0.5rem;
  margin: 1.5rem 0 1rem;
  border-bottom: 1px solid var(--rt-border);
}

.auth-section-label:first-of-type {
  margin-top: 0;
}

.req {
  color: var(--rt-danger);
}

.invalid-note {
  color: var(--rt-danger);
  font-size: 0.82rem;
  margin-top: 0.3rem;
}

.auth-switch {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--rt-muted);
}

.auth-switch a {
  color: var(--rt-accent);
  font-weight: 600;
}

.auth-lang {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rt-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 991.98px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  /* Keep the pitch short above the form so the fields stay near the top */
  .auth-brand {
    padding: 1.75rem 1.25rem;
  }

  .auth-logo {
    margin-bottom: 1.25rem;
  }

  .auth-points,
  .auth-sub,
  .auth-industries {
    display: none;
  }

  .auth-headline {
    font-size: 1.35rem;
    margin-bottom: 0.9rem;
  }

  .auth-form-side {
    padding: 1.5rem 1rem 2.5rem;
  }

  .auth-card {
    padding: 1.5rem;
    box-shadow: none;
  }
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.theme-option {
  border: 1px solid var(--rt-border);
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  background: var(--rt-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-option:hover {
  border-color: var(--rt-accent);
}

.theme-option.is-selected {
  border-color: var(--rt-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rt-accent) 25%, transparent);
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-swatch {
  height: 42px;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(0,0,0,0.06);
}

.theme-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.settings-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.25rem 0 0.5rem;
  color: var(--rt-accent-dark);
}

.content-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: 0;
  color: var(--rt-sidebar-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.5rem;
  background: color-mix(in srgb, var(--rt-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rt-border);
}

.header-identity {
  min-width: 0;
  flex: 1;
}

.header-shop {
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-meta {
  color: var(--rt-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-meta .dot { margin: 0 0.3rem; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-lang select { width: auto; min-width: 96px; }

.icon-btn.sidebar-open {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--rt-border);
  border-radius: 0.5rem;
  background: var(--rt-surface);
  cursor: pointer;
}

.icon-btn.sidebar-open span {
  display: block;
  height: 2px;
  background: var(--rt-ink);
  border-radius: 2px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.55rem;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: 999px;
  cursor: pointer;
}

.user-chip .avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rt-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-chip .user-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.user-chip .user-name { font-size: 0.85rem; font-weight: 600; }
.user-chip .user-role { font-size: 0.7rem; color: var(--rt-muted); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 21, 0.45);
  z-index: 1030;
}

@media (max-width: 992px) {
  .app-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 260px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar-close { display: block; }
  .icon-btn.sidebar-open { display: flex; }
  .app-header { padding: 0.7rem 1rem; }
  .main { padding: 1rem 1rem 2rem; }

  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }
}

@media (max-width: 576px) {
  .user-chip .user-text { display: none; }
  .header-lang select { min-width: 74px; }
}

/* Keyboard users must always be able to see where they are. */
:focus-visible {
  outline: 2px solid var(--rt-accent);
  outline-offset: 2px;
}

.page-title { font-size: clamp(1.2rem, 4vw, 1.55rem); }

.empty-cell {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--rt-muted);
}

.status-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-paid { background: #ecfdf5; color: #166534; border-color: #86efac; }
.status-partial { background: #fff7ed; color: #b45309; border-color: #fdba74; }
.status-credit { background: #fef2f2; color: #b42318; border-color: #fecaca; }
.status-cancelled { background: #f3f4f6; color: #6b7280; border-color: #d1d5db; }

.money { white-space: nowrap; }

.mobile-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem -1rem -1rem;
  padding: 0.75rem 1rem;
  background: var(--rt-surface);
  border-top: 1px solid var(--rt-border);
  box-shadow: 0 -6px 18px rgba(20, 38, 29, 0.08);
}

.mobile-save-bar .total-label {
  font-size: 0.78rem;
  color: var(--rt-muted);
  display: block;
}

.mobile-save-bar .total-value { font-weight: 700; font-size: 1.1rem; }

@media (max-width: 768px) {
  /* Line items become stacked cards: a 5-column grid is unusable on a phone. */
  .line-items-table thead { display: none; }

  .line-items-table,
  .line-items-table tbody,
  .line-items-table tr,
  .line-items-table td {
    display: block;
    width: 100%;
  }

  .line-items-table tr {
    background: var(--rt-surface);
    border: 1px solid var(--rt-border);
    border-radius: 0.6rem;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .line-items-table td {
    border: 0;
    padding: 0.25rem 0;
  }

  .line-items-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rt-muted);
    margin-bottom: 0.15rem;
  }

  .line-items-table .line-amount {
    font-weight: 700;
    font-size: 1.05rem;
  }

  .line-items-table .row-actions { text-align: right; }

  .line-items-table input,
  .line-items-table select { min-width: 0; }

  .totals-card { max-width: none !important; margin-left: 0 !important; }
}

@media (max-width: 576px) {
  .table { font-size: 0.88rem; }
  .card { padding: 0.85rem 0.9rem; }
  .stat .value { font-size: 1.35rem; }
}
