/* DeniBook — mobile-first PWA. Tokens mirror the product design system. */
:root {
  /* Color system (per design spec) */
  --bg: #f9fafc;
  --surface: #ffffff;
  --primary: #6c40f6;
  --primary-dark: #5538d6;
  --primary-soft: #ede7ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #ea580c;
  --warn-soft: #ffedd5;
  --debt-amount: #ef4444;
  --public-bg: #f9fafc;

  /* Radius — 12–16px per spec */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 16px;

  /* Soft, mobile-app shadows */
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 6px 16px rgba(17, 24, 39, 0.05);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);

  /* Icon stroke — keep current visual rhythm */
  --icon-stroke: 1.62px;
  --icon-stroke-tab: 1.42px;

  /* App shell layout */
  --app-max: 27rem; /* ~432px ≈ "430px" mobile-native */
  --tab-h: 3.6rem;
  --sticky-actions-h: 3.25rem;
  --safe-b: env(safe-area-inset-bottom, 0);
  --safe-t: env(safe-area-inset-top, 0);
  --pwa-offline-h: 2.75rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

html.is-standalone .btn-text-out {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.4rem 0.5rem;
}

body.app-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 100vw;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Ubuntu,
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  overflow-x: hidden;
  box-sizing: border-box;
}

body.page-landing,
body.page-public {
  margin: 0;
  min-height: 100dvh;
  max-width: 100vw;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Ubuntu,
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  padding-top: var(--safe-t);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
  padding-bottom: var(--safe-b);
  overflow-x: hidden;
  box-sizing: border-box;
  background: var(--public-bg, var(--bg));
  color: var(--text);
}

/* Installed PWA: reduce double-tap zoom delay on tappable controls */
.app-tabbar a,
.app-tabbar .tab,
button,
.btn,
.btn-fab,
a.btn,
input[type="submit"] {
  touch-action: manipulation;
}

/* Skip to main (keyboard / screen reader) */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.4rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary-dark);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-120%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

a {
  color: var(--primary);
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Inline SVGs (line icons) — use inherit so parent text/button color wins; avoid
   `color: currentColor` on the svg itself (unreliable for stroke=currentColor in some WebKit) */
.icon {
  display: block;
  flex-shrink: 0;
  color: inherit;
  overflow: visible;
  stroke-width: var(--icon-stroke);
}
.icon--sm {
  width: 18px;
  height: 18px;
}
.icon--tiny {
  width: 16px;
  height: 16px;
}
.icon--tab {
  width: 20px;
  height: 20px;
  stroke-width: var(--icon-stroke-tab);
}
.icon--on-primary {
  color: #fff;
  opacity: 1;
}
.icon--muted {
  color: var(--text-muted);
}
.icon--row-end {
  color: var(--text-muted);
}
.icon--list-lead {
  color: var(--primary);
  margin-right: 0.65rem;
}
.icon--list-lead--muted {
  color: var(--text-muted);
}

/* Map icon color into SVG paints (WebKit: stroke=currentColor + inherited color) */
.app-body svg.icon [stroke="currentColor"],
.page-public svg.icon [stroke="currentColor"] {
  stroke: currentColor;
}

.app-body svg.icon [fill="currentColor"],
.page-public svg.icon [fill="currentColor"] {
  fill: currentColor;
}

/* Lucide nodes often omit stroke/fill attrs; resolve paint from the svg’s color (WebKit). */
.app-body svg.icon :is(path, line, polyline, polygon, rect, circle),
.page-public svg.icon :is(path, line, polyline, polygon, rect, circle) {
  stroke: currentColor;
}

/* ——— Public pages (landing, legal, sign-in) ——— */
.brand-logo {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-logo:hover,
.brand-logo:focus-visible {
  text-decoration: none;
}

.page-public {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Marketing and sign-in: distinct from in-app --bg */
  background: var(--public-bg);
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.25rem;
  padding: 0.5rem 1rem;
  padding-top: max(0.5rem, env(safe-area-inset-top, 0));
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(108, 64, 246, 0.04);
}

.public-topbar__logo {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  max-width: 3rem;
}

.public-brand-img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  object-position: center;
}

.public-topbar__signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.public-topbar__signin:hover,
.public-topbar__signin:focus-visible {
  background: var(--primary-soft);
  text-decoration: none;
}

/* Sign-in / OTP: back · centered wordmark · help */
.public-topbar--signin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.15rem;
  padding: 0.45rem 0.62rem 0.36rem 0.34rem;
  padding-top: max(0.44rem, env(safe-area-inset-top, 0));
  background: #fff;
  border-bottom: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: none;
}

.public-topbar__back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  flex-shrink: 0;
}

.public-topbar__back:hover,
.public-topbar__back:focus-visible {
  background: var(--primary-soft);
  text-decoration: none;
}

.public-topbar__back .icon {
  display: block;
  width: 20px;
  height: 20px;
}

.public-topbar__wordmark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  line-height: 0;
  max-width: min(13rem, 68vw);
}

.public-topbar__wordmark-txt {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--primary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.public-topbar__wordmark-img {
  display: block;
  width: 29px;
  height: 29px;
  object-fit: contain;
  flex-shrink: 0;
}

.public-topbar__trailing {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  flex-shrink: 0;
}

.public-topbar__trailing:hover,
.public-topbar__trailing:focus-visible {
  background: var(--primary-soft);
  text-decoration: none;
}

.public-topbar__trailing-ic {
  display: flex;
  color: #2f3443;
  opacity: 1;
}

.public-topbar__trailing .icon {
  width: 18px;
  height: 18px;
}

.public-topbar__trailing--spacer {
  min-width: 2.6rem;
  min-height: 1px;
  visibility: hidden;
}

.public-footer {
  margin-top: auto;
  padding: 1.25rem 1rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.public-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin: 0 0 0.6rem;
}

.public-footer__links a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
  padding: 0.25rem 0;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}

.public-footer__links a:hover,
.public-footer__links a:focus-visible {
  text-decoration: underline;
}

.public-footer__copy {
  margin: 0;
  font-size: 0.8rem;
}

.landing-page {
  flex: 1;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 0 1.25rem 1.5rem;
}

.landing-hero {
  text-align: center;
  padding: 2.25rem 0 1.5rem;
}

.landing-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 0.5rem;
}

.landing-hero h1 {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.landing-hero .landing-lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.landing-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.landing-hero-btn-secondary {
  display: block;
  text-align: center;
  min-height: 2.75rem;
  line-height: 2.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
  background: var(--surface);
}

.landing-hero-btn-secondary:hover,
.landing-hero-btn-secondary:focus-visible {
  background: var(--primary-soft);
  text-decoration: none;
}

.landing-section {
  margin-bottom: 1.15rem;
}

.landing-section h2 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.landing-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.landing-card p,
.landing-card li {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--text);
}

.landing-card p + p {
  margin-top: 0.65rem;
}

.landing-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
}

.landing-list li {
  margin: 0.4rem 0;
}

.landing-cta {
  text-align: center;
  margin: 0.5rem 0 0.5rem;
}

.landing-cta h2 {
  text-transform: none;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
  margin: 0 0 0.5rem;
}

.landing-cta .landing-card p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Legal + contact: readable column */
.legal-page {
  flex: 1;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  width: 100%;
}

.legal-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  line-height: 1.25;
  color: var(--text);
}

.legal-page h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.35rem 0 0.5rem;
  line-height: 1.3;
}

.legal-page p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
}

.legal-page p:last-child {
  margin-bottom: 0;
}

/* Privacy / terms / contact when opened signed-in from More (app chrome + back) */
.app-shell--legal .legal-page {
  margin: 0 auto;
}

.contact-lead {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.contact-email {
  display: inline-block;
  min-height: 2.75rem;
  line-height: 1.4;
  padding: 0.65rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}

.legal-page .contact-form {
  margin-top: 0.5rem;
}

.page-center {
  flex: 1;
  max-width: 23.5rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
  width: 100%;
}

.page-center h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.page-center .lead {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.lock-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ——— Auth: login + verify (sign-in, OTP) ——— */
.page-center--auth {
  flex: 1;
  width: 100%;
  max-width: 22.5rem;
  margin: 0 auto;
  padding: 1rem 1.2rem 2.5rem;
}

.auth-landing {
  width: 100%;
}

.auth-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 0.9rem;
}

.auth-messages .alert {
  margin: 0;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-hero {
  text-align: center;
  margin-bottom: 1.15rem;
}

.auth-hero__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.auth-hero__title {
  margin: 0 0 0.4rem;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-hero__lead {
  margin: 0 auto;
  max-width: 20rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Enter-your-code: preface on one line, address on the next (email verify) */
.auth-hero__lead--verify-email {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-hero__verify-preface {
  display: block;
}

.auth-hero__lead--verify-email .verify-code__email {
  display: block;
  width: 100%;
  max-width: 19.5rem;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: anywhere;
  hyphens: none;
}

/* Plain text fields (login + code inputs) */
input.auth-input {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin: 0;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  line-height: 1.35;
  color: #111827;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

input.auth-input::placeholder {
  color: #9ca3af;
}

input.auth-input:hover {
  border-color: #d1d5db;
  background: #fff;
}

input.auth-input:focus,
input.auth-input:focus-visible {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(108, 64, 246, 0.16);
}

.auth-remember--light {
  margin: 0.4rem 0 0.85rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

.auth-remember--light .form-remember {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
}

.auth-remember--slim {
  margin: 0 0 0.6rem;
  padding: 0;
  background: none;
  border: none;
}

.auth-remember--slim .form-remember {
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* Legacy tinted remember (if used elsewhere) */
.auth-remember {
  margin: 0.15rem 0 1rem;
  padding: 0.65rem 0.7rem 0.7rem;
  background: #f7f5fd;
  border: 1px solid #e8e2f7;
  border-radius: var(--radius-sm);
}

.auth-remember .form-remember {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.auth-remember__hint {
  margin: 0.4rem 0 0 1.5rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Fine print in card + verify */
.auth-fineprint {
  margin: 0.75rem 0 0;
  padding: 0 0.1rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #6b7280;
  text-align: center;
}

.auth-fineprint--below {
  margin: 0.65rem 0 0;
  padding: 0 0.1rem 0.15rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #9ca3af;
}

.auth-panel__foot {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0 0.25rem;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.4;
  border-top: 1px solid #f0f1f3;
}

.auth-panel__foot--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

.auth-panel__foot-sep {
  color: #d1d5db;
  user-select: none;
}

a.auth-link-secondary {
  color: #6b7280;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(107, 114, 128, 0.35);
  padding-bottom: 0.05rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a.auth-link-secondary:hover,
a.auth-link-secondary:focus-visible {
  color: var(--primary);
  border-bottom-color: rgba(108, 64, 246, 0.45);
  outline: none;
}

.auth-trust {
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #6b7280;
  margin: 1rem 0 0;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 6px 28px rgba(50, 40, 100, 0.07);
  padding: 1.15rem 1.1rem 0.35rem;
  margin-top: 0.25rem;
}

.auth-panel--plain {
  padding: 0.9rem 1rem;
}

.auth-panel__alone {
  margin: 0;
}

.page-center--auth .alert {
  margin-bottom: 0.85rem;
}

.auth-form .form-row {
  margin-bottom: 0.78rem;
}

.form-row--center {
  text-align: center;
}

.form-row--center label {
  display: block;
  margin-bottom: 0.4rem;
}

/* OTP fields: keep label, input, and hint visually centered */
.auth-form.verify-code .form-row--center {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-form.verify-code .form-row--center .auth-hint {
  text-align: center;
  max-width: 19rem;
  margin-left: 0.25rem;
  margin-right: 0.25rem;
}

.auth-hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.auth-resend {
  margin: 0.5rem 0 0.15rem;
  padding: 0.4rem 0 0.35rem;
  border-top: 1px dashed var(--border);
}

.auth-resend__form {
  margin: 0;
}

.auth-aux-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0.65rem 0 0.15rem;
  font-size: 0.86rem;
}

.auth-aux-links__a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  padding: 0.2rem 0.1rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
}

.auth-aux-links__a:hover,
.auth-aux-links__a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-aux-links__dot {
  color: var(--text-muted);
  user-select: none;
}

.auth-trust {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.45rem;
  margin: 1.25rem 0.25rem 0;
  max-width: 20rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.auth-trust__ic {
  display: flex;
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: #8b839c;
  opacity: 0.9;
}

.auth-inline-link {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.auth-inline-link:hover,
.auth-inline-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.public-topbar__link--subtle {
  font-weight: 600;
  color: var(--text-muted);
}

.public-topbar__link--subtle:hover,
.public-topbar__link--subtle:focus-visible {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ——— App top bar — back/menu · centered DeniBook · bell/FAB ——— */
/* Fixed header (see partials/app-header.ejs); main gets padding-top below */
.app-topbar-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  max-width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.05);
}

/* Clear fixed header: single top row vs top + business bar */
body.app-body:has(> .app-topbar-wrap) {
  --app-top-pad: 0.75rem;
  --app-header-stack: max(3.4rem, calc(env(safe-area-inset-top, 0px) + 2.85rem));
}
body.app-body:has(> .app-topbar-wrap .app-bizbar) {
  --app-header-stack: max(6.2rem, calc(env(safe-area-inset-top, 0px) + 5.65rem));
}
body.app-body:has(> .app-topbar-wrap) > main.app-shell,
body.app-body:has(> .app-topbar-wrap) > main {
  padding-top: calc(var(--app-header-stack) + var(--app-top-pad));
  scroll-margin-top: var(--app-header-stack);
}

.app-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.35rem;
  min-height: 3.25rem;
  padding: 0.4rem 1rem;
  padding-top: max(0.45rem, env(safe-area-inset-top, 0));
  background: var(--surface);
}

.app-bizbar {
  /* Center the switcher / name; … menu on the right; empty 1fr left balances the 1fr right */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 0.4rem;
  /* Match .app-shell horizontal padding so the search/cards below line up */
  padding: 0.35rem 1rem 0.5rem;
  background: #fafbfc;
  border-top: 1px solid var(--border);
}

.app-bizbar__name {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
  max-width: min(12.5rem, 100%);
  display: flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.3rem 0.7rem 0.3rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2c3140;
  background: #f7f7fb;
  border: 1px solid #ececf3;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-bizbar__actions {
  grid-column: 3;
  justify-self: end;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.6rem;
}

/* “⋯” / more — opens Add business + Add customer */
.app-bizbar__details {
  position: relative;
  flex-shrink: 0;
}

.app-bizbar__more {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  min-height: 2.35rem;
  padding: 0.2rem 0.45rem;
  margin: 0;
  color: #5c6573;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: #fff;
  border: 1px solid #e0e2e8;
  border-radius: 10px;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.app-bizbar__more:hover,
.app-bizbar__more:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  background: #faf8ff;
  outline: none;
}

.app-bizbar__more::-webkit-details-marker,
.app-bizbar__more::marker {
  display: none;
  content: "";
}

.app-bizbar__more .icon {
  display: block;
  width: 20px;
  height: 20px;
}

.app-bizbar__menu {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0.35rem 0;
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 50;
  min-width: 12.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(17, 24, 39, 0.12);
}

.app-bizbar__menu .app-bizbar__menu-a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.app-bizbar__menu .app-bizbar__menu-a:hover,
.app-bizbar__menu .app-bizbar__menu-a:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
  outline: none;
}

/* Single business: switch hidden; multiple: select is the only business label (no duplicate name) */
.app-bizbar__switch {
  margin: 0;
}

/* Center column; fixed max width; compact height */
.app-bizbar__switch--primary {
  grid-column: 2;
  justify-self: center;
  flex: unset;
  min-width: 0;
  max-width: min(12.5rem, 100%);
  width: 100%;
}

/* Compact; same color family as customer search, smaller footprint */
.app-bizbar__select {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 2.35rem;
  padding: 0.3rem 1.9rem 0.3rem 0.65rem;
  margin: 0;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  color: #2c3140;
  -webkit-appearance: none;
  appearance: none;
  background-color: #f7f7fb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.95rem 0.95rem;
  border: 1px solid #ececf3;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.app-bizbar__select:hover {
  border-color: #e4e4ef;
  background-color: #f5f5fa;
}

.app-bizbar__select:focus,
.app-bizbar__select:focus-visible {
  outline: none;
  border-color: #cbbcff;
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(108, 64, 246, 0.08);
}

.app-topbar__left {
  justify-self: start;
  display: inline-flex;
  align-items: center;
}

.app-topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--primary);
  text-decoration: none;
}

.app-topbar__brand.brand-logo {
  font-weight: 800;
}

.app-topbar__brand--img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  line-height: 0;
}

.app-brand-img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
}

.app-topbar__brand-text {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--primary);
  line-height: 1;
}

.app-topbar__brand:hover {
  text-decoration: none;
}

.app-topbar__back,
.app-topbar__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-size: 0;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-topbar__back:hover,
.app-topbar__back:focus-visible,
.app-topbar__menu:hover,
.app-topbar__menu:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.app-topbar__back .icon,
.app-topbar__menu .icon {
  width: 22px;
  height: 22px;
}

.app-topbar__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  justify-self: center;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  grid-column: 2;
  color: var(--text);
}

.app-topbar__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  grid-column: 3;
}

.app-topbar__bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.25rem;
  color: var(--text-muted);
  border-radius: 10px;
  pointer-events: none;
  user-select: none;
}

.app-topbar__bell .icon {
  width: 20px;
  height: 20px;
}

.app-topbar__bell--hidden {
  visibility: hidden;
}

.btn-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.95rem;
  height: 2.95rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff !important;
  font-size: 0;
  font-weight: 600;
  line-height: 0;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(108, 64, 246, 0.28);
}

.btn-fab .icon {
  color: #fff;
  width: 21px;
  height: 21px;
}

.btn-fab:hover,
.btn-fab:focus-visible {
  background: var(--primary-dark);
  text-decoration: none;
}

.app-topbar__out {
  margin: 0;
  display: none;
}

/* ——— App shell + bottom tab ——— */
.app-shell {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 0.75rem);
}

.app-shell--dashboard {
  padding-bottom: calc(var(--tab-h) + var(--sticky-actions-h) + var(--safe-b) + 0.75rem);
}

.app-shell--customer {
  padding-bottom: calc(var(--tab-h) + var(--sticky-actions-h) + var(--safe-b) + 0.75rem);
}

/* ——— Customer screen (ref: total owed → Credit Sales|Payments → grey stack + white cards) ——— */
.customer-screen {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.customer-screen__hero.hero-outstanding,
.customer-ref .customer-screen__hero.hero-outstanding {
  margin-bottom: 0;
  padding: 1.2rem 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
}

.customer-screen__hero .hero-label,
.customer-ref .customer-screen__hero .hero-label {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.92;
}

.customer-screen__hero .hero-amount,
.customer-ref .customer-screen__hero .hero-amount {
  margin: 0;
  font-size: 2.1rem;
  line-height: 1.1;
  font-weight: 800;
}

/* Tabs: same background as the page; no grey “stack” */
.customer-tabs {
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}

.customer-tabs .tabs,
.customer-ref .customer-tabs .tabs {
  margin: 0 0 0.15rem;
  border-bottom: 1px solid #e4e6eb;
  background: #fff;
  border-radius: 0;
  padding: 0 0.1rem 0;
}

section.customer-tabs > .tab-panels,
.customer-ref section.customer-tabs > .tab-panels {
  margin-top: 0;
  background: transparent;
  padding: 0.4rem 0 0;
  box-sizing: border-box;
  border-radius: 0;
}

/* Credit sales: flex+gap only when visible — must not override .tab-panel.is-hidden */
#tab-sales.tab-panel--stack:not(.is-hidden) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  min-height: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
}

.customer-credit-filter {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 0 0 0.25rem;
  min-height: 2rem;
}

.customer-unpaid-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.86rem;
}

/* Sizable hit target over the track — 0×0 + pointer-events:none breaks toggle on some browsers */
.customer-unpaid-toggle__input {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 2;
  width: 2.5rem;
  height: 1.4rem;
  margin: 0;
  transform: translateY(-50%);
  opacity: 0;
  cursor: pointer;
}

.customer-unpaid-toggle__input:focus-visible + .customer-unpaid-toggle__track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.customer-unpaid-toggle__track {
  position: relative;
  width: 2.5rem;
  height: 1.4rem;
  border-radius: 999px;
  background: #e5e7eb;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.customer-unpaid-toggle__track::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.customer-unpaid-toggle__input:checked + .customer-unpaid-toggle__track {
  background: var(--primary);
}

.customer-unpaid-toggle__input:checked + .customer-unpaid-toggle__track::after {
  transform: translateX(1.1rem);
}

.customer-unpaid-toggle__label {
  color: #374151;
  font-weight: 650;
}

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

#tab-payments.tab-panel--stack:not(.is-hidden) {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  min-height: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
}

.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: var(--tab-h);
  padding: 0.3rem 0.25rem;
  padding-bottom: calc(0.35rem + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(17, 24, 39, 0.05);
}

.app-tabbar .tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-height: 2.9rem;
  padding: 0.32rem 0.1rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  border-radius: var(--radius-sm);
}

.app-tabbar .tab__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tabbar .tab.is-active {
  color: var(--primary);
  background: transparent;
  text-decoration: none;
}

.app-tabbar .tab.is-active .icon--tab {
  color: var(--primary);
}

.app-tabbar .tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  z-index: 1;
}

/* Sticky pair above tabbar (dashboard & customer) */
.sticky-pair {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b));
  z-index: 35;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.55rem 1rem 0.65rem;
  max-width: var(--app-max);
  margin: 0 auto;
  background: linear-gradient(to top, var(--bg) 70%, rgba(249, 250, 252, 0));
}

.sticky-pair--single {
  grid-template-columns: 1fr;
}

.sticky-pair .btn {
  min-height: 3rem;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 12px;
}

.sticky-pair .btn .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ——— PWA: offline + install (non-intrusive) ——— */
.denibook-pwa-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-sizing: border-box;
  max-width: 100%;
}

.denibook-pwa-bar--offline {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  padding-top: max(0.45rem, env(safe-area-inset-top, 0));
  min-height: var(--pwa-offline-h);
  font-size: 0.9rem;
  line-height: 1.35;
  color: #7c2d12;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
}

body.is-offline {
  padding-top: calc(var(--pwa-offline-h) + env(safe-area-inset-top, 0));
  box-sizing: border-box;
}

.denibook-pwa-bar--install {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 1rem;
  z-index: 45;
  max-width: 26rem;
  margin: 0 auto;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

body.app-body.app-has-tabbar .denibook-pwa-bar--install {
  bottom: calc(var(--tab-h) + var(--safe-b) + 0.5rem);
}

html.is-standalone .denibook-pwa-bar--install {
  display: none;
}

.denibook-pwa-bar__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.denibook-pwa-bar--install .denibook-pwa-bar__text {
  padding-right: 0.25rem;
}

.denibook-pwa-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
  align-items: center;
}

.denibook-pwa-bar__actions .btn {
  min-height: 2.75rem;
  font-size: 0.88rem;
  padding: 0.4rem 0.7rem;
}

/* More tab */
.app-shell--more {
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 0.55rem);
}

.more-eyebrow {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.more-pwa-tip {
  margin: 1.1rem 0 0;
  padding: 0.9rem 1rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.more-signout {
  margin: 1.5rem 0 0;
}

.more-signout__btn {
  color: var(--danger);
  border-color: var(--danger);
  background: var(--surface);
}

.more-signout__btn .icon {
  color: var(--danger) !important;
}

.more-signout__btn:hover,
.more-signout__btn:focus-visible {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
  text-decoration: none;
}

.more-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.more-list li {
  margin: 0 0 0.5rem;
}

.more-list__a {
  display: flex;
  align-items: center;
  min-height: 2.9rem;
  padding: 0.48rem 0.72rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  gap: 0.65rem;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.more-list__a .icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
  opacity: 0.9;
  flex-shrink: 0;
}

.more-list__a span:last-child,
.more-list__a .more-list__text {
  flex: 1;
  min-width: 0;
}

.more-list__chev {
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.more-list__chev .icon {
  width: 18px;
  height: 18px;
}

.more-list__form {
  margin: 0;
}

.more-list__btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.48rem 0.72rem;
  margin: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  gap: 0.65rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.more-list__btn:hover,
.more-list__btn:focus-visible {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--text);
  outline: none;
}

.more-list__a--static {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: default;
  pointer-events: none;
  opacity: 0.95;
}

.business-pill {
  display: inline-block;
  margin-left: auto;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #166534;
  background: #dcfce7;
}

/* Business setup: progress (decorative) */
.setup-progress {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 0 1rem;
  max-width: 12rem;
}

.setup-progress__fill {
  height: 100%;
  width: 100%;
  background: var(--primary);
  border-radius: 4px;
  opacity: 0.9;
}

/* Business setup: progress dots (decorative) */
.setup-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0 1rem;
}

.setup-dots__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #d6d3df;
  display: inline-block;
}

.setup-dots__dot.is-active {
  background: var(--primary);
  width: 22px;
}

.more-list__a:focus-visible,
.more-list__a:hover {
  text-decoration: none;
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #ddd6fe;
  box-shadow: 0 4px 14px rgba(108, 64, 246, 0.1);
}

/* ——— Typography & cards ——— */
/* Per spec:
   page title 22/28 bold · section title 18/24 semibold ·
   body 14/20 · small 12/16
*/
h1.page-title {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1.page-title--with-icon {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.page-title__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}

.page-title__ic .icon {
  width: 24px;
  height: 24px;
}

h2.section-title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 1.1rem 0 0.55rem;
}

.app-shell--dashboard h2.section-title {
  margin-top: 1.1rem;
}

.page-subhead {
  margin: 0 0 0.55rem;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.card--flat {
  box-shadow: none;
}

/* Credit sale (Sales tab) — new / edit */
.app-shell--sales {
  padding-top: 0.45rem;
}

.app-shell--sales .card--form {
  margin-top: 0;
}

.app-shell--sales .page-subhead + .alert,
.app-shell--sales .page-subhead + .card--form,
.app-shell--sales .alert + .card--form {
  margin-top: 0.5rem;
}

.sales-create-head {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  margin: 0 0 0.75rem;
  padding: 0.95rem 1rem;
  background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.sales-create-head__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 12px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 20px rgba(108, 64, 246, 0.18);
}

.sales-create-head__ic .icon {
  width: 21px;
  height: 21px;
}

.sales-create-head__copy {
  min-width: 0;
}

.sales-create-head__label {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sales-create-head h2 {
  margin: 0.16rem 0 0;
  font-size: 1.18rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sales-create-form {
  padding: 1.05rem;
}

.sales-create-form .btn-block {
  margin-top: 0.1rem;
}

.sales-date-grid {
  display: grid;
  gap: 0;
}

.sales-empty-hint {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0 0;
  padding: 0.85rem 0.95rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: #f7f8fb;
  border: 1px dashed #d8dce5;
  border-radius: var(--radius);
}

.sales-empty-hint__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
}

.sales-empty-hint__ic .icon {
  width: 18px;
  height: 18px;
}

.sales-empty-hint p {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
}

.sales-empty-hint .link-quiet {
  flex-shrink: 0;
  font-size: 0.84rem;
  white-space: nowrap;
}

.sales-context-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 0 0.75rem;
  box-shadow: var(--shadow-sm);
}

.sales-context-card__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.sales-context-card__ic .icon {
  width: 20px;
  height: 20px;
}

.sales-context-card__body {
  min-width: 0;
  flex: 1;
}

.sales-context-card__label {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sales-context-card__name {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sales-edit-hint {
  margin: 0 0 0.75rem;
}

.app-shell--sales-edit .subtle-help + .alert,
.app-shell--sales-edit .subtle-help + .card--form {
  margin-top: 0.5rem;
}

@media (min-width: 24rem) {
  .sales-date-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.7rem;
  }
}

.card-title-row {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card-title-row__ic {
  display: flex;
  color: var(--primary);
  flex-shrink: 0;
}

/* Hero purple (dashboard total, customer total) */
.hero-outstanding {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.2rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 14px 30px rgba(108, 64, 246, 0.24);
}

.hero-outstanding__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.hero-outstanding .hero-label {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  opacity: 0.94;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.hero-outstanding__wallet {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
}

.hero-outstanding__wallet .icon {
  width: 21px;
  height: 21px;
}

.hero-outstanding .hero-amount {
  margin: 0;
  font-size: 2.2rem;
  line-height: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

/* Summary row (3 cards) */
.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}

.summary-card {
  background: var(--surface);
  border: 1px solid rgba(229, 231, 235, 0.65);
  border-radius: 18px;
  padding: 0.95rem 0.7rem 0.9rem;
  text-align: center;
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.summary-card__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.summary-card--customers .summary-card__ic {
  background: #f0ebff;
  color: #7a5af8;
}

.summary-card--overdue .summary-card__ic {
  background: #ffe8eb;
  color: #ef4444;
}

.summary-card--partial .summary-card__ic {
  background: #fff3df;
  color: #f59e0b;
}

.summary-card__ic .icon {
  width: 18px;
  height: 18px;
}

.summary-card .sc-label {
  display: block;
  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 600;
  color: #4b5563;
  min-height: 2.25rem;
}

.summary-card .sc-val {
  display: block;
  font-size: 2rem;
  line-height: 1;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.05em;
}

/* Activity */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.15rem 0 0.7rem;
}

.section-heading .section-title {
  margin: 0;
}

.section-heading__hint {
  color: var(--primary);
  font-size: 0.96rem;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: visible;
  border: none;
  background: transparent;
  box-shadow: none;
}

.activity-list li {
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  font-size: 14px;
  line-height: 20px;
}

.activity-list__link,
.activity-list__row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.95rem 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.activity-list__link {
  margin: 0;
  color: inherit;
  border-radius: 12px;
  text-decoration: none !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
}

.activity-list__link:visited,
.activity-list__link:active {
  color: inherit;
}

.activity-list__link,
.activity-list__link:visited,
.activity-list__link:hover,
.activity-list__link:active,
.activity-list__link:focus,
.activity-list__link * {
  text-decoration: none !important;
}

.activity-list__link:hover {
  background: rgba(243, 244, 246, 0.85);
}

.activity-list__link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 0;
  background: rgba(243, 244, 246, 0.95);
}

.activity-list__ic {
  flex-shrink: 0;
  margin-top: 0.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 999px;
}

.activity-list__ic--primary {
  color: #7a5af8;
  background: #f3efff;
}

.activity-list__ic--success {
  color: #16a34a;
  background: #eaf8ee;
}

.activity-list__ic--warning {
  color: #f59e0b;
  background: #fff4e5;
}

.activity-list__ic .icon {
  width: 20px;
  height: 20px;
}

.activity-list__body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.activity-list__main,
.activity-list__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.activity-list__main {
  gap: 0.18rem;
  flex: 1;
}

.activity-list__meta {
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}

.activity-list__name {
  display: block;
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.activity-list__detail {
  display: block;
  font-size: 0.96rem;
  line-height: 1.35;
  color: #616a78;
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list li.activity-list__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.activity-list__amount {
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.activity-list__amount--primary {
  color: var(--primary);
}

.activity-list__amount--success {
  color: var(--success);
}

.activity-list__amount--warning {
  color: #d97706;
}

.activity-list__date {
  font-size: 0.94rem;
  line-height: 1.25;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Customer detail — payment history tab */
.payment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.payment-list__item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.payment-list__item:last-child,
.payment-list__empty {
  border-bottom: none;
}

.payment-list__empty {
  display: block;
  padding: 1.35rem 1rem;
  text-align: center;
  list-style: none;
}

.payment-list__ic {
  display: flex;
  flex-shrink: 0;
  color: var(--success);
  margin-top: 0.1rem;
}

.payment-list__ic .icon {
  width: 20px;
  height: 20px;
}

.payment-list__body {
  min-width: 0;
  flex: 1;
}

/* Buttons — min 48px tap target per spec */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.55rem 1rem;
  gap: 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.btn:hover,
.btn:focus-visible {
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(108, 64, 246, 0.28);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 6px 20px rgba(76, 42, 212, 0.32);
}

.btn-primary:active {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(76, 42, 212, 0.25);
}

/* Ensure SVGs pick up button ink (parent color can fail to map to stroke in some UAs) */
.btn-primary .icon,
a.btn-primary .icon,
button.btn-primary .icon {
  color: #fff;
  opacity: 1;
}

.btn-outline .icon,
a.btn-outline .icon,
button.btn-outline .icon {
  color: var(--primary);
  opacity: 1;
}

.btn-ghost .icon,
a.btn-ghost .icon,
button.btn-ghost .icon {
  color: var(--primary);
  opacity: 1;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
  font-weight: 600;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
}

.btn-outline {
  background: linear-gradient(180deg, #fefeff 0%, var(--primary-soft) 100%);
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(108, 64, 246, 0.12);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary-dark);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(108, 64, 246, 0.18);
}

/* Secondary: neutral surface (e.g. “More” on credit sale card) */
.btn-light {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
  min-height: 2.75rem;
  padding: 0.45rem 0.85rem;
}

.btn-light:hover,
.btn-light:focus-visible {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #1f2937;
}

/* Forms */
label.form-remember {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  width: 100%;
  line-height: 1.35;
  cursor: pointer;
}
label.form-remember input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
  flex-shrink: 0;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.78rem;
}

.form-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.form-row__head label {
  min-width: 0;
}

.form-row__action {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  min-height: 2rem;
  padding: 0.25rem 0.48rem;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  border: 1px solid #e1d8ff;
  border-radius: 999px;
  background: var(--primary-soft);
}

.form-row__action .icon {
  width: 15px;
  height: 15px;
}

.form-row__action:hover,
.form-row__action:focus-visible {
  color: var(--primary-dark);
  border-color: #cfc1ff;
  text-decoration: none;
}

.form-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.money-input {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.money-input:hover {
  border-color: #d1d5db;
}

.money-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 64, 246, 0.15);
}

.money-input__prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 4.1rem;
  padding: 0 0.7rem;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 800;
  color: var(--text-muted);
  background: #f6f7fb;
  border-right: 1px solid var(--border);
}

.money-input input[type="number"] {
  min-width: 0;
  min-height: calc(2.75rem - 2px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.money-input input[type="number"]:focus,
.money-input input[type="number"]:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}

.form-input-wrap--date:has(.form-input-wrap__suffix) input[type="date"],
.form-input-wrap--date:has(.form-input-wrap__suffix) input[type="text"] {
  padding-right: 2.5rem;
}

.form-input-wrap--date-native input[type="date"] {
  min-height: 2.75rem;
  /* Native date field supplies the picker; no room needed for a duplicate icon */
  padding-right: 0.75rem;
}

/* mm/dd/yyyy overlay: native value stays YYYY-MM-DD; text is shown via sibling span */
.form-input-wrap--date-mmdd {
  position: relative;
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.form-input-wrap--date-mmdd input[type="date"] {
  position: relative;
  z-index: 1;
  margin: 0;
  color: transparent;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.form-input-wrap--date-mmdd input[type="date"]:focus,
.form-input-wrap--date-mmdd input[type="date"]:focus-visible {
  outline: none !important;
  box-shadow: none;
}

.form-input-wrap--date-mmdd input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.9;
  z-index: 2;
  position: relative;
}

.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit,
.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit-text,
.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit-year-field,
.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit-month-field,
.form-input-wrap--date-mmdd input[type="date"]::-webkit-datetime-edit-day-field {
  color: transparent;
}

.date-mmdd-text {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
  font-size: 0.95rem;
  line-height: 1.2;
  max-width: calc(100% - 3rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.date-mmdd-text--placeholder {
  color: var(--text-muted);
}

.form-input-wrap--date-mmdd:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.form-input-wrap__suffix {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input-wrap__suffix .icon {
  width: 20px;
  height: 20px;
}

label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="search"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="date"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
select:hover,
textarea:hover {
  border-color: #d1d5db;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 64, 246, 0.15);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

.search-wrap {
  position: relative;
  margin-bottom: 0.85rem;
}

.search-wrap::before {
  content: "";
  display: none;
}

.search-wrap--with-icon::before {
  content: none;
}

.search-wrap__ic {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap__ic .icon,
.search-wrap__ic .search-wrap__svg {
  width: 1.1rem;
  height: 1.1rem;
}

.search-wrap input {
  padding-left: 2.55rem;
  background: var(--surface);
}

/* Customer list */
.app-shell--customers {
  padding-top: 0.45rem;
}

.customer-directory {
  margin: 0;
}

.search-wrap--customers {
  margin: 0 0 1.15rem;
}

.search-wrap--customers .search-wrap__ic {
  left: 1rem;
  color: #6b7280;
}

.search-wrap--customers .search-wrap__ic .icon,
.search-wrap--customers .search-wrap__ic .search-wrap__svg {
  width: 1.2rem;
  height: 1.2rem;
}

.search-wrap--customers input[type="search"] {
  min-height: 3.35rem;
  padding-left: 3.05rem;
  padding-right: 1rem;
  border: 1px solid #ececf3;
  border-radius: 18px;
  background: #f7f7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: 1.02rem;
  font-weight: 500;
  color: #2c3140;
}

.search-wrap--customers input[type="search"]::placeholder {
  color: #858b98;
  opacity: 1;
}

.search-wrap--customers input[type="search"]:hover {
  border-color: #e4e4ef;
  background: #f5f5fa;
}

.search-wrap--customers input[type="search"]:focus {
  border-color: #cbbcff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(108, 64, 246, 0.08);
}

.customer-list {
  background: transparent;
}

.list-card--flush {
  padding: 0;
  overflow: hidden;
  margin: 0 0 0.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.customer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.customer-row:last-child {
  border-bottom: none;
}

.customer-row:active {
  background: var(--bg);
}

@media (hover: hover) {
  .customer-row:hover {
    background: #faf8ff;
  }
}

.customer-row--directory {
  gap: 0.85rem;
  padding: 1.2rem 0.2rem 1.15rem;
  border-bottom: 1px solid #f0f1f5;
  background: transparent;
}

.customer-row--directory:active {
  background: rgba(108, 64, 246, 0.04);
}

@media (hover: hover) {
  .customer-row--directory:hover {
    background: rgba(108, 64, 246, 0.03);
  }
}

.customer-row__main {
  flex: 1;
  min-width: 0;
}

.customer-row__name {
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.25;
  color: var(--text);
  display: block;
  letter-spacing: -0.03em;
}

.customer-row__phone {
  font-size: 0.98rem;
  line-height: 1.3;
  color: #6b7280;
  margin-top: 0.28rem;
  display: block;
}

.customer-row__row2 {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
  min-width: 7.75rem;
}

.amount-due {
  font-weight: 800;
  color: #ff5a5f;
  font-size: 1.08rem;
  white-space: nowrap;
  letter-spacing: -0.03em;
}

.amount-ok {
  font-weight: 700;
  color: #9ca3af;
  font-size: 0.98rem;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.chev {
  color: #9ca3af;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chev .icon {
  width: 18px;
  height: 18px;
}

.empty-state--customers {
  padding: 2rem 0.35rem;
  text-align: center;
  border-top: 1px solid #f0f1f5;
}

/* Tabs (customer detail) */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin: 0 0 0.75rem;
}

.tab-btn {
  flex: 1;
  min-height: 2.85rem;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.tab-btn .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  opacity: 1;
}

.tab-btn.is-active .icon {
  color: var(--primary);
}

.tab-btn.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: block;
}

.tab-panel.is-hidden {
  display: none;
}

/* Tab panels: flex display rules are ID-specific; keep hidden panels fully suppressed */
#tab-sales.tab-panel--stack.is-hidden,
#tab-payments.tab-panel--stack.is-hidden {
  display: none !important;
}

.tab-panel__empty {
  margin: 0;
  padding: 1.35rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tab-panels {
  margin-top: 0.5rem;
}

.sale-amount--paid {
  color: var(--success);
}

.sale-amount--due {
  color: var(--debt-amount);
}

/* Customer detail — credit sale line cards (views/customers/show.ejs) */
.credit-sale-card {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

.credit-sale-card:last-child {
  margin-bottom: 0;
}

/* Open “⋯” menu: lift whole card so the dropdown isn’t covered by the next card or the bottom bar (see credit-sale-card__more-inline) */
.credit-sale-card:has(.credit-sale-card__more-inline[open]) {
  z-index: 50;
}

.credit-sale-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0;
}

.credit-sale-card__owing {
  min-width: 0;
  flex: 1;
}

.credit-sale-card__label {
  margin: 0 0 0.15rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
}

.credit-sale-card__amount {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.credit-sale-card__amount--cleared {
  color: #16a34a;
}

/* Outstanding: dark text, not an error; badge carries state color */
.credit-sale-card__amount--owing {
  color: #111827;
}

.status-badge {
  flex-shrink: 0;
  display: inline-block;
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.2;
}

.status-badge--unpaid {
  background: #fee2e2;
  color: #dc2626;
}

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

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

.credit-sale-card__description {
  margin: 10px 0 0.35rem;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: #111827;
}

.credit-sale-card__description--empty {
  font-weight: 500;
  font-size: 14px;
  color: #6b7280;
}

.credit-sale-card__date,
.credit-sale-card__due {
  margin: 0 0 0.2rem;
  font-size: 14px;
  line-height: 1.45;
  color: #6b7280;
}

.credit-sale-card__due {
  margin-bottom: 0.5rem;
}

.credit-sale-card__overdue-flag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #dc2626;
  background: #fee2e2;
}

.credit-sale-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0 0 0.5rem;
  font-size: 14px;
  line-height: 1.4;
  color: #6b7280;
}

.credit-sale-card__meta-sep {
  color: #d1d5db;
  user-select: none;
}

.credit-sale-card__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 10px;
  margin-top: 0.2rem;
}

.credit-sale-card__actions--more-only {
  justify-content: flex-end;
}

a.credit-sale-card__btn-record.btn-primary {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border-radius: 15px;
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(108, 64, 246, 0.25);
}

a.credit-sale-card__btn-record.btn-primary:hover,
a.credit-sale-card__btn-record.btn-primary:focus-visible {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
  text-decoration: none;
}

.credit-sale-card__actions--more-only .credit-sale-card__more {
  flex: 0 0 86px;
  width: 86px;
  min-width: 86px;
  max-width: 86px;
}

.credit-sale-card__more {
  position: relative;
  flex: 0 0 86px;
  width: 86px;
  min-width: 86px;
  max-width: 86px;
}

.credit-sale-card__more[open] {
  z-index: 20;
}

.credit-sale-card__summary {
  list-style: none;
  width: 100%;
  min-height: 48px;
  font: inherit;
  box-sizing: border-box;
  padding: 0 0.5rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: #6b7280;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.credit-sale-card__summary:hover {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #4b5563;
}

.credit-sale-card__summary:focus-visible {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.credit-sale-card__summary::-webkit-details-marker {
  display: none;
}

.credit-sale-card__more-list {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
  margin: 0.3rem 0 0;
  min-width: 12rem;
  padding: 0.35rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  box-sizing: border-box;
}

.credit-sale-card__more-list li {
  margin: 0;
}

.credit-sale-card__link {
  display: block;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: #4b5563;
  text-decoration: none;
}

.credit-sale-card__link:hover,
.credit-sale-card__link:focus-visible {
  background: #f9fafb;
  color: #111827;
  text-decoration: none;
  outline: none;
}

/* Customer payment rows: card shell in views/customers/show.ejs (inline) */
.customer-ref .tab-panel--stack .payment-list__empty,
.customer-ref .tab-panel--stack .tab-panel__empty {
  display: block;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 1.2rem 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  list-style: none;
}

/* "Unpaid only" filter empty state uses [hidden]; display:block above would show it always */
.customer-ref .tab-panel--stack .tab-panel__empty[hidden] {
  display: none !important;
}

.sale-amount {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.sale-desc {
  margin: 0;
  font-size: 0.9rem;
}

.btn-sm {
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
}

.subtle-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.dl-ledger {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.dl-ledger > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.dl-ledger > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dl-ledger dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}
.dl-ledger dd {
  margin: 0;
  text-align: right;
}

.card--summary {
  padding: 0.9rem 1rem;
}
.card--summary .card-title {
  font-weight: 600;
  color: var(--text);
}

.remain-line {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.4rem 0 0;
}

/* Customer detail — name + phone under hero (visible without relying on top bar) */
.customer-identity {
  margin: 0.5rem 0 0.5rem;
  line-height: 1.4;
  color: var(--text);
}

.customer-identity--with-icon {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.customer-identity-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 0.05rem;
}

.customer-identity-ic .icon {
  width: 22px;
  height: 22px;
}

.customer-identity__main {
  flex: 1;
  min-width: 0;
}

.customer-identity-line {
  margin: 0;
}

.customer-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.4rem 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--primary);
}

.customer-edit-link .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.customer-identity .customer-name {
  font-weight: 800;
  font-size: 1.15rem;
  display: inline;
}

.customer-identity .customer-phone {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Name and phone on one line on slightly wider narrow screens */
@media (min-width: 22rem) {
  .customer-identity--inline .customer-phone {
    display: inline;
    margin-top: 0;
    margin-left: 0.25rem;
  }
  .customer-identity--inline .customer-phone::before {
    content: "·";
    margin-right: 0.4rem;
    color: var(--text-muted);
    font-weight: 400;
  }
}

/* Payment / credit summary cards */
.card-lite {
  background: var(--primary-soft);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.card-lite .row-strong {
  font-weight: 800;
  color: var(--primary-dark);
}

.card-lite--payment {
  box-shadow: 0 6px 18px rgba(108, 64, 246, 0.14);
}

.card-lite__head {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.card-lite__ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  margin-top: 0.1rem;
}

.card-lite__ic .icon {
  width: 24px;
  height: 24px;
}

.card-lite__head-body {
  flex: 1;
  min-width: 0;
}

.card-lite__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
  margin: 0.62rem 0 0;
  padding: 0.62rem 0 0;
  border-top: 1px solid rgba(108, 64, 246, 0.15);
}

.card-lite__lbl {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.card-lite__val {
  margin: 0;
  font-size: 0.95rem;
}

.card-lite__val--emph {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.card-lite__val--due {
  color: var(--debt-amount);
}

/* card-lite customer name line (used in adjustment / payment summary) */
.card-lite__name {
  margin: 0.18rem 0 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Inline form hint (sub-label below an input) */
.form-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Adjustment shell — same as sales, slight top spacing adjustment */
.app-shell--adjustment .card-lite {
  margin-bottom: 0.6rem;
}

.app-shell--adjustment .subtle-help {
  margin: 0 0 0.65rem;
}

.app-shell--adjustment .card--form {
  margin-top: 0;
}

/* Badges — Unpaid=light red · Partial=light orange · Paid=light green */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 14px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.badge-unpaid {
  background: var(--danger-soft);
  color: #b91c1c;
}

.badge-partial {
  background: var(--warn-soft);
  color: var(--danger);
}

.badge-paid {
  background: var(--success-soft);
  color: #15803d;
}

.badge-neutral {
  background: #f3f4f6;
  color: #4b5563;
}

/* Report */
body.page-report .app-topbar__bell {
  visibility: hidden;
}

.app-shell--report {
  padding-top: 0.25rem;
}

.report-total-block {
  margin: 1.05rem 0 0.68rem;
}

.report-total-label {
  margin: 0 0 0.28rem;
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 500;
  color: #4b5563;
}

.report-total {
  margin: 0;
  font-size: 1.52rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: -0.02em;
}

.status-ok {
  color: var(--success);
  font-weight: 700;
  font-size: 12px;
  line-height: 16px;
}

.status-bad {
  color: var(--danger);
  font-weight: 700;
  font-size: 12px;
  line-height: 16px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 0.2rem;
  padding: 0.18rem;
  background: #f1f2f5;
  border: 1px solid #eceef2;
  border-radius: 999px;
}

.report-filters a {
  justify-content: center;
  min-width: 0;
  min-height: 2.08rem;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #171923;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.report-filters a:hover,
.report-filters a:focus-visible {
  color: var(--primary);
  border-color: transparent;
  text-decoration: none;
}

.report-filters a.is-active {
  color: #fff;
  background: var(--primary);
  border-color: transparent;
  box-shadow: 0 5px 12px rgba(108, 64, 246, 0.22);
}

.report-filters a.is-active:hover,
.report-filters a.is-active:focus-visible {
  color: #fff;
  background: var(--primary-dark);
}

.report-customer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border-top: 1px solid #eef0f4;
}

.report-customer-list__item {
  margin: 0;
  border-bottom: 1px solid #eef0f4;
}

.report-customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  min-height: 4.08rem;
  padding: 0.64rem 0;
  color: var(--text);
  text-decoration: none;
}

.report-customer-row:hover,
.report-customer-row:focus-visible {
  color: var(--text);
  text-decoration: none;
  background: rgba(108, 64, 246, 0.03);
}

.report-customer-row__main,
.report-customer-row__right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-customer-row__main {
  gap: 0.16rem;
  flex: 1;
}

.report-customer-row__right {
  align-items: flex-end;
  gap: 0.16rem;
  flex-shrink: 0;
  max-width: 46%;
  text-align: right;
}

.report-customer-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  line-height: 1.28;
  font-weight: 800;
  color: #111827;
}

.report-customer-row__meta {
  font-size: 0.82rem;
  line-height: 1.25;
  font-weight: 500;
  color: #6b7280;
}

.report-customer-row__amount {
  font-size: 0.93rem;
  line-height: 1.25;
  font-weight: 800;
  color: #111827;
  white-space: nowrap;
}

.report-customer-row__status {
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 600;
  white-space: nowrap;
}

.report-customer-row__status--bad {
  color: #ff1f2d;
}

.report-customer-row__status--ok {
  color: #139343;
}

.report-customer-row__status--due {
  color: #374151;
}

.btn--compact {
  min-height: 2.08rem;
  font-size: 0.78rem;
  padding: 0 0.55rem;
  flex: 1;
  min-width: 0;
}

.empty-state--report {
  padding: 1.25rem 0 0.5rem;
  text-align: left;
}

.link-quiet {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.link-quiet:hover,
.link-quiet:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.report-stamp {
  margin-top: 0.2rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.filter-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.filter-tabs a:hover,
.filter-tabs a:focus-visible {
  text-decoration: none;
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tabs a.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.filter-tabs a.is-active:hover,
.filter-tabs a.is-active:focus-visible {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.filter-tabs--sm a {
  font-size: 0.8rem;
  min-height: 2.1rem;
  padding: 0 0.6rem;
}

.app-shell--report .report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 0.2rem;
  padding: 0.18rem;
  background: #f1f2f5;
  border: 1px solid #eceef2;
  border-radius: 999px;
}

.app-shell--report .report-filters a {
  justify-content: center;
  min-width: 0;
  min-height: 2.08rem;
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #171923;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.app-shell--report .report-filters a:hover,
.app-shell--report .report-filters a:focus-visible {
  color: var(--primary);
  border-color: transparent;
  text-decoration: none;
}

.app-shell--report .report-filters a.is-active {
  color: #fff;
  background: var(--primary);
  border-color: transparent;
  box-shadow: 0 5px 12px rgba(108, 64, 246, 0.22);
}

.app-shell--report .report-filters a.is-active:hover,
.app-shell--report .report-filters a.is-active:focus-visible {
  color: #fff;
  background: var(--primary-dark);
}

.sub-filters {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

/* Alerts */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 14px;
  line-height: 20px;
  margin: 0 0 0.9rem;
}

.alert-success {
  background: var(--success-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #ddd6fe;
}

/* Email / phone OTP: fixed-width field, centered in the form row */
input.auth-input.verify-code__input {
  display: block;
  box-sizing: border-box;
  width: min(100%, 12.5rem);
  min-width: 0;
  max-width: 12.5rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.45rem;
  letter-spacing: 0.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: #fafaff;
  border-color: #dcd4f0;
}

.page-center--auth .verify-code__input:focus,
.page-center--auth .verify-code__input:focus-visible {
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.verify-code__email {
  word-break: break-all;
}

.app-footer {
  margin-top: 1.5rem;
  padding: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hr {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0.6rem 0;
}

.muted-block {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.email-inline {
  margin-top: 1.25rem;
  padding: 0;
  border: none;
}

.email-inline--panel {
  margin-top: 1rem;
  padding: 0.85rem 0.8rem 0.9rem;
  background: var(--primary-soft);
  border: 1px solid #ddd6fe;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.email-inline--panel > p.muted {
  margin: 0 0 0.6rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.email-inline--panel .btn {
  min-height: 2.5rem;
  font-size: 0.88rem;
}

.empty-state {
  margin: 0;
  padding: 1.5rem 1.1rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.email-inline form {
  margin: 0;
}

.email-inline .btn {
  min-height: 2.5rem;
  font-size: 0.85rem;
}

/* Desktop: still show bottom nav for mockup fidelity, slightly wider shell */
@media (min-width: 28rem) {
  .app-shell,
  .page-center,
  .landing-page {
    max-width: 26rem;
  }
}

/* Customer directory polish */
.app-shell--customers {
  padding-top: 0.75rem;
}

.search-wrap--customers {
  margin-bottom: 1rem;
}

.customer-list {
  display: grid;
  gap: 0.75rem;
}

.customer-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05);
  color: #111827;
  text-decoration: none;
}

.customer-card:hover,
.customer-card:focus-visible {
  text-decoration: none;
  background: #f9fafb;
  border-color: #e5e7eb;
}

.customer-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1rem;
  font-weight: 850;
}

.customer-card__body {
  flex: 1;
  min-width: 0;
}

.customer-card__top,
.customer-card__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.customer-card__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.customer-card__amount {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.customer-card__amount--due {
  color: #111827;
}

.customer-card__amount--ok {
  color: #16a34a;
}

.customer-card__phone {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.28rem;
  color: #6b7280;
  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 600;
}

.customer-card__chev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  flex-shrink: 0;
}

.customer-card__chev .icon {
  width: 18px;
  height: 18px;
}

/* Customer detail polish */

.app-shell--customer {
  padding-top: 0.75rem;
  padding-bottom: calc(var(--tab-h) + 5.5rem + var(--safe-b));
}

.customer-screen {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.customer-profile-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05);
}

.customer-profile-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 850;
}

.customer-profile-card__body {
  flex: 1;
  min-width: 0;
}

.customer-profile-card__body h1 {
  margin: 0;
  color: #111827;
  font-size: 1.15rem;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: -0.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-profile-card__body p {
  margin: 0.28rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.25;
  font-weight: 600;
}

.customer-total-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.15rem;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(108, 64, 246, 0.22);
}

.customer-total-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -34px;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.customer-total-card__label {
  position: relative;
  z-index: 1;
  margin: 0 0 0.35rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.85rem;
  line-height: 1.2;
  font-weight: 700;
}

.customer-total-card__amount {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 2.15rem;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -0.055em;
}

.customer-total-card__icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.customer-total-card__icon .icon {
  width: 23px;
  height: 23px;
}

.customer-total-card__meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.35rem;
  margin-top: 0.45rem;
  font-size: 0.9rem;
  line-height: 1.3;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.customer-total-card__name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  max-width: 100%;
}

.customer-total-card__name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.12s ease;
}

.customer-total-card__name:hover {
  color: #fff;
  text-decoration: none;
  opacity: 0.92;
}

.customer-total-card__name:focus-visible {
  color: #fff;
  text-decoration: none;
  opacity: 1;
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 2px;
}

.customer-total-card__phone {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

/* Customer tabs polish */

.customer-tabs {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.customer-tabs .tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.customer-tabs .tab-btn {
  flex: 1;
  min-height: 3rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6b7280;
  font-size: 0.92rem;
  font-weight: 750;
}

.customer-tabs .tab-btn.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.customer-tabs .tab-panels {
  margin-top: 0.85rem;
}

/* Credit sale card polish */

.credit-sale-card {
  margin: 0 0 0.85rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

.credit-sale-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.credit-sale-card__label {
  margin: 0 0 0.15rem;
  color: #9ca3af;
  font-size: 11px;
  line-height: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.credit-sale-card__amount {
  margin: 0;
  color: #111827;
  font-size: 1.65rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.045em;
}

.credit-sale-card__amount--cleared {
  color: #16a34a;
}

.credit-sale-card__amount--owing {
  color: #111827;
}

.status-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-badge--unpaid {
  background: #fee2e2;
  color: #dc2626;
}

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

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

.credit-sale-card__description {
  margin: 0.65rem 0 0.35rem;
  color: #111827;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 650;
}

.credit-sale-card__description--empty {
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
}

.credit-sale-card__date,
.credit-sale-card__due {
  margin: 0 0 0.2rem;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 550;
}

.credit-sale-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0.4rem 0 0.65rem;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.4;
}

.credit-sale-card__actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.credit-sale-card__btn-record {
  flex: 1;
  min-height: 48px;
  border-radius: 15px;
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(108, 64, 246, 0.22);
}

.credit-sale-card__more {
  position: relative;
  flex: 0 0 86px;
  width: 86px;
}

.credit-sale-card__summary {
  list-style: none;
  width: 100%;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 0 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.credit-sale-card__summary::-webkit-details-marker {
  display: none;
}

.credit-sale-card__more-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.12);
}

.credit-sale-card__link {
  display: block;
  padding: 0.65rem 0.9rem;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

/* Payments tab polish */

.customer-ref #tab-payments .payment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.customer-ref #tab-payments .payment-list__item:not(.payment-list__empty) {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.05);
}

.payment-list__ic {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #16a34a;
  background: #dcfce7;
}

.payment-list__ic .icon {
  width: 19px;
  height: 19px;
}

.payment-list__body {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  line-height: 1.45;
}

.payment-list__body .amount-ok {
  color: #16a34a;
  font-size: 1rem;
  font-weight: 850;
}

/* Bottom action polish */

.customer-bottom-action {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b));
  z-index: 35;
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 0.65rem 1rem 0.75rem;
  background: linear-gradient(to top, var(--bg) 72%, rgba(255, 255, 255, 0));
}

.customer-bottom-action__btn {
  min-height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(108, 64, 246, 0.28);
}

.customer-bottom-action__btn:hover,
.customer-bottom-action__btn:focus-visible {
  background: var(--primary-dark);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 16px 32px rgba(76, 42, 212, 0.28);
}

.customer-bottom-action__btn .icon {
  width: 20px;
  height: 20px;
}

/* Inline more (⋯) next to amount */

.credit-sale-card__amount-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.credit-sale-card__more-inline {
  position: relative;
  flex-shrink: 0;
}

.credit-sale-card__more-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
}

.credit-sale-card__more-trigger:hover {
  background: #f3f4f6;
}

.credit-sale-card__more-trigger::-webkit-details-marker {
  display: none;
}

.credit-sale-card__more-inline[open] {
  z-index: 20;
}

.credit-sale-card__more-inline .credit-sale-card__more-list {
  right: 0;
  top: calc(100% + 6px);
}

.credit-sale-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.credit-sale-card__more-inline {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.credit-sale-card__more-trigger {
  list-style: none;
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #6b7280;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}

.credit-sale-card__more-trigger::-webkit-details-marker {
  display: none;
}

.credit-sale-card__more-trigger:hover {
  background: #f3f4f6;
}

.credit-sale-card__more-inline .credit-sale-card__more-list {
  right: 0;
  top: calc(100% + 6px);
}

