/* CredFlow — Premium SaaS UI (matches login/auth forest green) */

:root {
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "DM Sans", system-ui, sans-serif;

  --bg: #f1f5f2;
  --bg-elevated: #ffffff;
  --bg-solid: #ffffff;
  --surface: #ffffff;
  --border: #e2e8e5;
  --text: #101b29;
  --text-muted: #6b7787;
  --text-soft: #98a3b1;

  --primary: #0f7040;
  --primary-hover: #0b5931;
  --primary-soft: rgba(15, 112, 64, 0.10);
  --accent: #158a4f;
  --mint: #4ade80;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --info: #0284c7;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(11, 45, 28, 0.06);
  --shadow-lg: 0 12px 40px rgba(11, 45, 28, 0.10);
  --glass: none;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --bs-primary: #0f7040;
  --bs-primary-rgb: 15, 112, 64;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* Background atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(15, 112, 64, 0.10), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(74, 222, 128, 0.08), transparent);
}

/* Shell */
.app-shell { display: flex; min-height: 100vh; }

.impersonation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: #0f7040;
  color: #fff;
  font-size: 0.9rem;
  position: sticky;
  top: 0;
  z-index: 1080;
}
.impersonation-bar strong { font-weight: 600; }
.impersonation-bar .text-muted { color: rgba(255,255,255,.75) !important; }
.impersonation-bar .btn-light {
  border: 0;
  font-weight: 600;
  color: #0f7040;
}
.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 28px 32px 48px; flex: 1; animation: fadeUp 0.35s ease; }

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

@keyframes countPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(15, 112, 64, 0.25);
}
.brand-logo-img.is-wordmark {
  width: auto;
  height: 34px;
  max-width: 150px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: none;
  background: transparent;
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  transition: all var(--transition);
}

.nav-item i { font-size: 18px; width: 22px; text-align: center; }
.nav-item:hover { background: var(--primary-soft); color: var(--primary); }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 112, 64, 0.22);
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.nav-item.logout:hover { background: rgba(220, 38, 38, 0.1); color: var(--danger); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1035;
  cursor: pointer;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }

.global-search {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search i {
  position: absolute;
  left: 14px;
  color: var(--text-soft);
  font-size: 14px;
}

.global-search input {
  width: 280px;
  max-width: 40vw;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px 9px 38px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

.global-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-initial {
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

.avatar-lg {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-lg.avatar-initial { font-size: 32px; }

/* Cards & glass */
.glass-card, .stat-card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel { padding: 22px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-header p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: fadeUp 0.4s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:nth-child(5) { animation-delay: 0.25s; }
.stat-card:nth-child(6) { animation-delay: 0.3s; }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: 0.6;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.success { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.stat-icon.warning { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.stat-icon.danger { background: rgba(220, 38, 38, 0.12); color: var(--danger); }
.stat-icon.info { background: rgba(2, 132, 199, 0.12); color: var(--info); }

/* Tables */
.table-wrap { overflow-x: auto; }

.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-modern th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-modern td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-modern tbody tr {
  transition: background var(--transition);
}

.table-modern tbody tr:hover { background: var(--primary-soft); }
.table-modern tbody tr:last-child td { border-bottom: none; }

/* Forms */
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: #f7faf8;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: border var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  color: var(--text);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Buttons */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: 13.5px;
  padding: 9px 18px;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 112, 64, 0.20);
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

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

.btn-ghost:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-sm { padding: 5px 12px; font-size: 12.5px; }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}

/* Badges */
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-soft.credit, .badge-soft.high { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.badge-soft.payment, .badge-soft.success, .badge-soft.low { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.badge-soft.medium, .badge-soft.warning { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.badge-soft.info { background: rgba(2, 132, 199, 0.1); color: var(--info); }
.badge-soft.muted { background: var(--primary-soft); color: var(--primary); }

.amount-pos { color: var(--danger); font-weight: 600; }
.amount-neg { color: var(--success); font-weight: 600; }

/* Auth */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }

.auth-bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(160deg, #0d4a2c 0%, #0a3822 100%);
  z-index: -2;
}

.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(74, 222, 128, 0.15), transparent 35%);
}

.auth-wrapper { width: 100%; max-width: 420px; animation: fadeUp 0.5s ease; }

.auth-brand .brand-link {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-decoration: none;
}

.auth-brand-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.35);
}
.auth-brand-logo.is-wordmark {
  width: auto;
  height: 52px;
  max-width: 240px;
  object-fit: contain;
  border-radius: 12px;
  border: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  background: rgba(0,0,0,0.25);
  padding: 8px 12px;
}
.brand-preview-logo {
  height: 56px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 6px;
  background: var(--surface);
}
.brand-preview-logo:not(.is-wordmark) {
  width: 56px;
  object-fit: cover;
}

.auth-brand .brand-mark {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
}

.auth-brand .brand-name {
  font-family: var(--font-display);
  font-size: 28px;
  color: #fff;
}

.brand-tagline { color: rgba(255,255,255,0.7); font-size: 13px; margin-top: 8px; }

.auth-hero-block .subtitle {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.auth-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 14px;
}
.auth-icon-wrap.forgot {
  background: rgba(15, 112, 64, 0.12);
  color: #0f7040;
}
.auth-icon-wrap.reset {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}
.input-icon-wrap .form-control { padding-left: 42px; }
.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.auth-card {
  padding: 32px;
  border-radius: 20px;
}

.auth-card h2 {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.auth-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }

.auth-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-top: 22px;
  padding: 0 8px 8px;
  font-size: 12.5px;
}
.auth-legal-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}
.auth-legal-footer a:hover {
  color: var(--primary, #0f7040);
  text-decoration: underline;
}

.legal-body { align-items: start; background: var(--bg); }
.legal-body .auth-bg {
  background: var(--bg);
}
.legal-wrap {
  width: 100%;
  max-width: 760px;
  margin: 28px auto;
  padding: 0 16px 40px;
  position: relative;
  z-index: 1;
}
.legal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.legal-card {
  padding: 28px 26px;
}
.legal-card h1 {
  font-family: var(--font-sans);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.legal-card h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.6rem;
}
.legal-card p,
.legal-card li {
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.95rem;
}
.legal-card ul { padding-left: 1.2rem; }
.legal-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.2rem !important;
}
.legal-contact-box {
  background: var(--surface-2, rgba(15, 112, 64, 0.08));
  border: 1px solid rgba(15, 112, 64, 0.18);
  border-radius: 14px;
  padding: 16px 18px;
  font-weight: 600;
}
@media (max-width: 576px) {
  .legal-card { padding: 22px 18px; }
  .legal-card h1 { font-size: 1.6rem; }
}

.auth-input-wrap {
  position: relative;
}
.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
  z-index: 2;
}
.auth-input-has-icon {
  padding-left: 42px;
}
.auth-input-has-toggle {
  padding-right: 46px;
}
.auth-pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.auth-pass-toggle:hover,
.auth-pass-toggle:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  outline: none;
}

/* Login split — mobile + desktop */
.auth-body--split {
  display: block;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.auth-body--split .auth-bg {
  background:
    linear-gradient(165deg, #158a4f 0%, #0f7040 28%, #0b5931 100%);
}

.auth-body--split .auth-bg::after {
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(74, 222, 128, 0.22), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(255, 255, 255, 0.06), transparent 50%),
    radial-gradient(circle at 70% 10%, rgba(15, 112, 64, 0.35), transparent 40%);
}

.auth-split {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
  z-index: 1;
}

.auth-split-hero {
  display: none;
  position: relative;
  padding: 56px 52px;
  color: #fff;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(15, 112, 64, 0.55) 0%, rgba(15, 23, 42, 0.25) 100%),
    linear-gradient(145deg, #0f7040 0%, #0a3822 100%);
}

.auth-split-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 420px;
  animation: fadeUp 0.55s ease;
}

.auth-split-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  z-index: 1;
}
.auth-split-orb--1 {
  width: 280px;
  height: 280px;
  right: -60px;
  top: 12%;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.35), transparent 70%);
}
.auth-split-orb--2 {
  width: 200px;
  height: 200px;
  left: -40px;
  bottom: 8%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
}

.auth-split-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
  margin-bottom: 36px;
}

.auth-split-brand .auth-brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}
.auth-split-brand .auth-brand-logo.is-wordmark {
  height: 44px;
  width: auto;
  max-width: 200px;
}

.auth-split-brand .brand-name {
  font-family: var(--font-display);
  font-size: 2.1rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-split-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 2.8vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: #fff;
}

.auth-split-tagline {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 360px;
  line-height: 1.6;
  margin: 0 0 36px;
}

.auth-split-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-width: 360px;
}

.auth-split-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.auth-split-features li:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(3px);
}

.auth-split-features i {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.12);
  color: #99f6e4;
}

.auth-split-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding:
    max(16px, env(safe-area-inset-top))
    16px
    max(20px, env(safe-area-inset-bottom));
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 28px 22px !important;
  border-radius: 22px !important;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 24px 48px rgba(15, 23, 42, 0.14);
  animation: fadeUp 0.5s ease;
}

.login-page {
  display: flex;
  flex-direction: column;
}

.login-mobile-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.login-mobile-logo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15, 112, 64, 0.2);
}
.login-mobile-logo.is-wordmark {
  width: auto;
  height: 40px;
  max-width: 180px;
  object-fit: contain;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.login-mobile-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-progress {
  margin-bottom: 22px;
}

.login-progress-track {
  height: 3px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 12px;
}

.login-progress-fill {
  display: block;
  height: 100%;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #4ade80);
  transition: width 0.35s ease;
}
.login-progress-fill.step-2 {
  width: 100%;
}

.login-progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.login-progress-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.login-progress-steps li.is-active,
.login-progress-steps li.is-done {
  color: var(--text);
  font-weight: 600;
}

.login-progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

.login-progress-steps li.is-active .login-progress-dot {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.login-progress-steps li.is-done .login-progress-dot {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border-color: var(--primary);
  color: var(--primary);
}

.login-head {
  text-align: center;
  margin-bottom: 22px;
}

.login-head h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.45rem, 5vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--text);
}

.login-head .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.login-masked-email {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

.login-otp-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 16%, transparent), color-mix(in srgb, var(--primary) 8%, transparent));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}

.login-field {
  margin-bottom: 16px;
}

.login-field .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.login-label-row .form-label {
  margin-bottom: 0;
}

.login-forgot {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.login-options {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.login-options .form-check-label {
  font-size: 13.5px;
  color: var(--text-muted);
}

.login-submit {
  min-height: 52px;
  font-weight: 600;
  font-size: 15.5px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 28%, transparent);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 34%, transparent);
}

.login-submit:active {
  transform: translateY(0);
}

.login-form .form-control-lg {
  min-height: 52px;
  border-radius: 14px;
  font-size: 16px;
  border-color: var(--border);
  background: var(--bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-form .form-control-lg:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.login-otp-input {
  letter-spacing: 0.55em;
  text-align: center;
  font-weight: 700;
  font-size: 1.5rem !important;
  font-variant-numeric: tabular-nums;
  padding-left: 1.1em !important;
}

.login-otp-hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

.login-otp-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.login-otp-sep {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1;
}

.login-page .auth-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.login-page .auth-footer a {
  font-weight: 600;
}

.login-trust {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
}

.login-trust span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.login-trust i {
  font-size: 12px;
  color: var(--primary);
  opacity: 0.85;
}

.auth-body--split .auth-legal-footer {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.55);
}
.auth-body--split .auth-legal-footer a {
  color: rgba(255, 255, 255, 0.65);
}
.auth-body--split .auth-legal-footer a:hover {
  color: #fff;
}

@media (min-width: 576px) {
  .auth-split-main {
    padding: 36px 28px;
  }
  .login-card {
    padding: 36px 34px !important;
  }
}

@media (min-width: 992px) {
  .auth-split {
    grid-template-columns: minmax(380px, 46%) 1fr;
  }

  .auth-split-hero {
    display: flex;
  }

  .auth-split-main {
    min-height: auto;
    padding: 48px 40px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(20px);
  }

  .auth-body--split .auth-bg {
    background: transparent;
  }
  .auth-body--split .auth-bg::after {
    display: none;
  }

  .login-mobile-brand {
    display: none;
  }

  .login-card {
    max-width: 440px;
    padding: 40px 38px !important;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .auth-body--split .auth-legal-footer {
    color: var(--text-muted);
  }
  .auth-body--split .auth-legal-footer a {
    color: var(--text-muted);
  }
  .auth-body--split .auth-legal-footer a:hover {
    color: var(--primary);
  }
}

@media (max-width: 991.98px) {
  .auth-split-main {
    background: transparent;
  }
}

@media (max-width: 575.98px) {
  .auth-body--split .auth-card.login-card {
    padding: 26px 18px !important;
    border-radius: 20px !important;
  }

  .login-head h1 {
    font-size: 1.5rem;
  }

  .login-otp-input {
    font-size: 1.35rem !important;
    letter-spacing: 0.45em;
  }

  .theme-fab {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 16px;
  }
}

.theme-fab { display: none !important; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }

/* Activity list */
.activity-item, .list-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child, .list-row:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}

.list-meta { font-size: 12px; color: var(--text-soft); }

/* Transaction edit tabs + logs */
.txn-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.txn-tabs .nav-link {
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
}
.txn-tabs .nav-link.active {
  background: var(--primary);
  color: #fff;
}
.txn-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255,255,255,0.25);
}
.txn-tabs .nav-link:not(.active) .txn-tab-count {
  background: var(--primary-soft);
  color: var(--primary);
}
.txn-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 16px;
}
.txn-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.txn-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.txn-log-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 12px;
}
.txn-log-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 16px;
}
.txn-log-icon.created {
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
}
.txn-log-icon.updated {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}
.txn-log-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.txn-log-detail {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.txn-log-meta {
  font-size: 12px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.txn-log-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-weight: 600;
  margin: 8px 0 12px;
}
.txn-log-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
}
.txn-log-empty i {
  font-size: 32px;
  opacity: 0.45;
  display: block;
  margin-bottom: 8px;
  color: var(--success);
}
.txn-log-empty p {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.txn-log-empty span { font-size: 13px; }
@media (max-width: 575.98px) {
  .txn-meta-row { grid-template-columns: 1fr; }
  .txn-tabs { width: 100%; }
  .txn-tabs .nav-item { flex: 1; }
  .txn-tabs .nav-link { width: 100%; justify-content: center; }
}

/* Chart container */
.chart-box { position: relative; height: 260px; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  height: 16px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Modal overrides */
.modal-content {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.glass-dropdown {
  background: var(--bg-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.dropdown-item { color: var(--text); font-size: 13px; }
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary); }
button.dropdown-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}

/* Pagination */
.pagination .page-link {
  background: var(--bg-solid);
  border-color: var(--border);
  color: var(--text-muted);
  border-radius: 8px !important;
  margin: 0 3px;
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Invoice print */
.invoice-sheet {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  color: #0f172a;
  padding: 40px;
  border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .page-header h1 { font-size: 26px; }
  .global-search input { width: 160px; }
}

@media (max-width: 575.98px) {
  .stat-value { font-size: 22px; }
  .auth-card { padding: 24px; }
}

/* =========================================================
   OK Credit–style mobile home (premium CredFlow teal)
   ========================================================= */
.ok-mobile {
  --ok-green: var(--primary, #0f7040);
  --ok-green-soft: var(--primary-soft, rgba(15, 112, 64, 0.12));
  --ok-orange: #ea580c;
  --ok-coral: #e11d48;
  --ok-peach: #fff1f2;
  --ok-gray: #f1f5f4;
  margin: -8px -14px 96px;
  background:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(15, 112, 64, 0.12), transparent 55%),
    var(--ok-gray);
  min-height: calc(100vh - var(--topbar-h) - 80px);
  padding-bottom: 8px;
}

.ok-header {
  padding: 12px 16px 22px;
  background: linear-gradient(180deg, rgba(15, 112, 64, 0.14) 0%, transparent 100%);
}

.ok-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.ok-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 12px rgba(15, 112, 64, 0.18);
}

.ok-avatar-initial {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #158a4f, #0f7040);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.ok-upi-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(15, 112, 64, 0.1);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.ok-upi-pill strong {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.ok-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(15, 112, 64, 0.1);
  display: grid;
  place-items: center;
  color: var(--ok-coral);
  font-size: 17px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  text-decoration: none;
  transition: transform 0.15s ease;
}
.ok-icon-btn:active { transform: scale(0.94); }

.ok-quick-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ok-quick-card {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(15, 112, 64, 0.08);
  border-radius: 16px;
  padding: 14px 8px 12px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.ok-quick-card:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.ok-quick-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 8px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(15, 112, 64, 0.16), rgba(15, 112, 64, 0.08));
  color: var(--ok-green);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.ok-sheet {
  background: var(--bg-solid);
  border-radius: 26px 26px 0 0;
  padding: 10px 0 calc(170px + env(safe-area-inset-bottom));
  min-height: 60vh;
  box-shadow:
    0 -8px 28px rgba(15, 23, 42, 0.06),
    0 -1px 0 rgba(15, 112, 64, 0.08);
  position: relative;
  border-top: 1px solid rgba(15, 112, 64, 0.06);
}

.ok-sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 14%, transparent);
  margin: 4px auto 12px;
}

.ok-sheet-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
}

.ok-tabs {
  display: flex;
  gap: 4px;
  background: var(--ok-gray);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid rgba(15, 112, 64, 0.06);
}

.ok-tab {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ok-tab.active {
  background: var(--bg-solid, #fff);
  color: var(--ok-green);
  box-shadow: 0 2px 8px rgba(15, 112, 64, 0.12);
}

.ok-tool-btns { display: flex; gap: 8px; }

.ok-round-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-solid);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ok-round-btn:active {
  background: var(--ok-green-soft);
  color: var(--ok-green);
}

.ok-search-form {
  padding: 0 16px 12px;
}

.ok-net-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 16px 14px;
  padding: 16px 16px;
  background: linear-gradient(135deg, rgba(15, 112, 64, 0.08), rgba(15, 112, 64, 0.02));
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(15, 112, 64, 0.12);
  box-shadow: 0 4px 14px rgba(15, 112, 64, 0.06);
  transition: transform 0.15s ease;
}
.ok-net-balance:active { transform: scale(0.99); }

.ok-net-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ok-net-meta { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.ok-net-amount {
  font-family: var(--font-display, var(--font-sans));
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ok-coral);
  text-align: right;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.ok-net-youget {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-soft);
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.ok-remind-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 16px 8px;
  padding: 12px 14px;
  background: var(--ok-peach);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ok-coral);
  font-size: 13px;
  font-weight: 600;
}

.ok-remind-left i { margin-right: 8px; }
.ok-remind-right { font-weight: 500; font-size: 12px; opacity: 0.9; }

.ok-customer-list { padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }

.ok-customer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.ok-customer-row:active {
  background: var(--ok-green-soft);
  border-color: rgba(15, 112, 64, 0.12);
  transform: scale(0.99);
}

.ok-cust-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, #158a4f, #0f7040);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(15, 112, 64, 0.25);
}

.ok-cust-info { flex: 1; min-width: 0; }

.ok-cust-name {
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ok-cust-status {
  font-size: 12px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-soft);
}

.ok-cust-status.status-today { color: var(--ok-green); font-weight: 600; }
.ok-cust-status.status-later { color: var(--text-soft); }
.ok-cust-status.status-payment { color: var(--ok-orange); font-weight: 500; }

.ok-cust-bal { text-align: right; flex-shrink: 0; }

.ok-amt {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ok-amt.you-get { color: var(--ok-coral); }
.ok-amt.you-give { color: var(--ok-green); }
.ok-amt.settled { color: var(--text-soft); }

.ok-amt-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  color: var(--text-soft);
}

.ok-fab-bar {
  position: fixed;
  left: 0;
  right: 0;
  /* Above bottom nav + protruding Invoice FAB (~52px circle -14px lift) */
  bottom: calc(108px + env(safe-area-inset-bottom));
  z-index: 105;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 16px;
  pointer-events: none;
}

.ok-fab {
  pointer-events: auto;
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  z-index: 1;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(15, 112, 64, 0.22);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
  margin-left: auto;
  max-width: calc(100vw - 32px);
}

.ok-fab i {
  font-size: 1.1rem;
  line-height: 1;
}

.ok-fab:hover {
  color: #fff;
  background: var(--primary-hover);
}

.ok-fab:active {
  transform: scale(0.97);
}

/* New Entry → sticky Add Customer */
.ok-entry-add-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #fff 65%, rgba(255,255,255,0));
  pointer-events: none;
}
.ok-entry-add-btn {
  pointer-events: auto;
  display: flex;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  justify-content: center;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 112, 64, 0.25);
}
@media (min-width: 992px) {
  .ok-entry-add-bar {
    left: var(--sidebar-w, 260px);
  }
  .ok-fab-bar {
    display: none;
  }
}

/* Mobile bottom nav — premium frosted */
.ok-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-solid, #fff) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid color-mix(in srgb, var(--primary) 12%, var(--border));
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08);
}

.ok-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px 2px;
  text-decoration: none;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  min-width: 0;
  transition: color 0.15s ease;
}

.ok-bottom-nav a i {
  font-size: 20px;
  width: 44px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.ok-bottom-nav a.active {
  color: var(--primary, #0f7040);
}

.ok-bottom-nav a.active i {
  background: var(--primary-soft, rgba(15, 112, 64, 0.12));
  color: var(--primary, #0f7040);
}

.ok-bottom-nav a:active i {
  transform: scale(0.92);
}

.ok-bottom-nav a.ok-nav-fab {
  position: relative;
  top: -14px;
}
.ok-nav-fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(145deg, #158a4f, #0f7040);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow:
    0 8px 20px rgba(15, 112, 64, 0.4),
    0 0 0 4px color-mix(in srgb, var(--bg-solid, #fff) 90%, transparent);
  margin-bottom: 2px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.ok-nav-fab-btn:active,
.ok-bottom-nav a.ok-nav-fab:active .ok-nav-fab-btn {
  transform: scale(0.94);
}
.ok-nav-fab-btn i {
  width: auto;
  height: auto;
  font-size: 22px;
  color: #fff !important;
  background: transparent !important;
}
.ok-bottom-nav a.ok-nav-fab.active .ok-nav-fab-btn {
  background: linear-gradient(145deg, #158a4f, #0b5931);
}
.ok-bottom-nav a.ok-nav-fab span:last-child {
  margin-top: -2px;
}

/* More menu page */
.m-more {
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 24px;
}
.m-more-header h1 {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}
.m-more-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 20px;
}
.m-more-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}
.m-more-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-weight: 600;
  padding: 12px 16px 6px;
}
.m-more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.m-more-item:first-of-type { border-top: none; }
.m-more-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.m-more-text { flex: 1; font-weight: 600; font-size: 15px; }
.m-more-item > .bi-chevron-right { color: var(--text-soft); font-size: 14px; }
.m-more-item.danger .m-more-icon {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}
.m-more-item.danger .m-more-text { color: var(--danger); }

/* Mobile list cards (shared) — premium */
.m-card-list { display: none; }
.m-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--border));
  border-radius: 16px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.m-card:active {
  transform: scale(0.985);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.m-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.m-card-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.m-card-meta { font-size: 12px; color: var(--text-soft); }
.m-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Transactions list ? day filters + day-wise rows */
.txn-period-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 14px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.txn-period-scroll::-webkit-scrollbar { display: none; }
.txn-period-chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.txn-period-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.txn-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.txn-summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.txn-summary-item span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-weight: 600;
}
.txn-summary-item strong { font-size: 15px; }
.txn-summary-item.given strong { color: var(--danger); }
.txn-summary-item.received strong { color: var(--success); }

.txn-filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.txn-filter-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.txn-filter-chevron { transition: transform 0.2s ease; color: var(--text-soft); }
.txn-filter-toggle.is-open .txn-filter-chevron,
.txn-filter-toggle[aria-expanded="true"] .txn-filter-chevron {
  transform: rotate(180deg);
}
.txn-filter-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}
.txn-filter-body.is-open { display: block; padding-top: 14px; }
.txn-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 575.98px) {
  .txn-filter-row { grid-template-columns: 1fr; }
  .txn-summary-item strong { font-size: 13px; }
}

.txn-day-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.txn-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.txn-day-totals {
  display: flex;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}
.txn-day-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--border);
}
.txn-day-row:first-of-type { border-top: none; }
.txn-day-row:active { background: var(--bg); }
.txn-day-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.txn-day-icon.credit { background: rgba(220, 38, 38, 0.1); color: var(--danger); }
.txn-day-icon.payment { background: rgba(5, 150, 105, 0.1); color: var(--success); }
.txn-day-info { flex: 1; min-width: 0; }
.txn-day-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn-day-sub {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.txn-day-amt { font-weight: 700; font-size: 15px; flex-shrink: 0; }

/* Staff Performance cards */
.perf-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.perf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.perf-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.perf-card-who { flex: 1; min-width: 0; }
.perf-card-name {
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perf-card-meta {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perf-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.perf-stat {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.perf-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-weight: 600;
}
.perf-stat strong { font-size: 15px; }
.perf-today {
  background: rgba(15, 112, 64, 0.06);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.perf-today-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 8px;
}
.perf-today-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.perf-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-soft);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .perf-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .perf-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 991.98px) {
  .perf-grid + .table-desktop,
  .panel.table-desktop { display: none !important; }
}

@media (max-width: 991.98px) {
  .ok-bottom-nav { display: flex; }
  .app-content {
    padding: 14px 12px calc(92px + env(safe-area-inset-bottom)) !important;
  }
  .topbar {
    height: 56px;
    padding: 0 12px;
    background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
    box-shadow: 0 1px 0 var(--border);
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .page-header h1 {
    font-size: 1.55rem;
    letter-spacing: -0.02em;
  }
  .page-header p {
    font-size: 13px;
  }
  .page-header .btn,
  .page-header .d-flex {
    width: 100%;
  }
  .page-header .d-flex {
    flex-wrap: wrap;
  }
  .page-header .d-flex .btn {
    flex: 1;
    min-width: 120px;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card,
  .panel,
  .glass-card {
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.045);
  }
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .panel-header form {
    flex-direction: column !important;
    width: 100%;
  }
  .panel-header .form-select,
  .panel-header .form-control {
    width: 100% !important;
    max-width: none !important;
  }
  .btn {
    border-radius: 12px;
  }
  .btn-lg {
    min-height: 48px;
  }
  .table-desktop { display: none !important; }
  .m-card-list { display: block; }
  .txn-edit-wrap { max-width: none !important; }
  .txn-tabs { width: 100%; }
  .chart-box { height: 220px; }
  .reports-export { flex-wrap: wrap; }
  .reports-export .btn { flex: 1; min-width: 30%; }
  .m-more-section {
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  }
  .m-more-item {
    min-height: 52px;
  }
}

/* Hide sticky topbar search clutter a bit on small phones when using OK UI */
@media (max-width: 575.98px) {
  .global-search { display: none; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }
  .topbar { padding: 0 10px; height: 52px; }
  .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }
  .ok-mobile {
    margin-left: -12px;
    margin-right: -12px;
  }
}

/* =========================================================
   OK Credit chat-style customer ledger
   ========================================================= */
.ok-ledger-mode .topbar,
.ok-ledger-mode .sidebar,
.ok-ledger-mode .sidebar-overlay {
  display: none !important;
}
.ok-ledger-mode .app-main { margin-left: 0 !important; }
.ok-ledger-mode .app-content {
  padding: 0 !important;
  min-height: 100vh;
  background: #ece5dd;
}
.ok-ledger-mode .app-content > .alert {
  margin: 8px 12px;
  position: relative;
  z-index: 20;
}

/* Ledger modals must sit above sticky footer / entry screen */
body.ok-ledger-mode .modal { z-index: 2200; }
body.ok-ledger-mode .modal-backdrop { z-index: 2190; }
body.ok-ledger-mode .modal-dialog {
  margin: 1rem auto;
  max-width: 480px;
}
@media (max-width: 575.98px) {
  body.ok-ledger-mode .modal-fullscreen-sm-down {
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
  }
  body.ok-ledger-mode .modal-fullscreen-sm-down .modal-content {
    height: 100%;
    border-radius: 0;
  }
}

.ok-bubble.bubble-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
  max-width: 85%;
  margin: 0 auto;
  display: block;
  text-decoration: none;
  color: inherit;
}
.ok-bubble-wrap.note-wrap {
  align-self: center;
  align-items: center;
  max-width: 90%;
  width: 90%;
}

.ok-ledger {
  --ok-green: #0f7040;
  --ok-red: #e11d48;
  --ok-chat-bg: #ece5dd;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--ok-chat-bg);
  position: relative;
}

.ok-ledger-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.ok-ledger-back {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: #334155;
  font-size: 22px;
  text-decoration: none;
  border-radius: 50%;
}
.ok-ledger-back:hover { background: #f1f5f9; color: #0f172a; }

.ok-ledger-who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ok-ledger-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #86efac, #0f7040);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
}

.ok-ledger-name {
  font-weight: 700;
  font-size: 16px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ok-ledger-profile-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--ok-green);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ok-ledger-actions { display: flex; gap: 4px; }

.ok-ledger-icon {
  width: 40px; height: 40px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #475569;
  font-size: 18px;
  text-decoration: none;
  cursor: pointer;
}
.ok-ledger-icon:hover { background: #f1f5f9; color: #0f172a; }

.ok-ledger-search {
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.ok-ledger-feed {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 16px;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.ok-ledger-empty {
  text-align: center;
  padding: 64px 24px;
  color: #64748b;
}
.ok-ledger-empty i { font-size: 40px; opacity: 0.4; display: block; margin-bottom: 12px; }

.ok-date-pill {
  display: table;
  margin: 14px auto;
  background: #dbeafe;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.ok-bubble-wrap {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
  max-width: 82%;
}
.ok-bubble-wrap.given { align-self: flex-end; align-items: flex-end; margin-left: auto; }
.ok-bubble-wrap.received { align-self: flex-start; align-items: flex-start; }

.ok-bubble {
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.04);
  min-width: 160px;
}
.ok-bubble-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ok-bubble-arrow {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.bubble-given .ok-bubble-arrow { background: #ffe4e6; color: var(--ok-red); }
.bubble-received .ok-bubble-arrow { background: #dcfce7; color: var(--ok-green); }

.ok-bubble-amt {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  flex: 1;
}
.ok-bubble-meta {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.ok-bubble-meta i { color: #38bdf8; font-size: 14px; }

.ok-bubble-note {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.35;
}

.ok-bubble-due {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  padding: 0 4px;
}

.ok-ledger-footer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,0.06);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.ok-contact-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.ok-contact-bar > a {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #475569;
  font-size: 18px;
  text-decoration: none;
}
.ok-contact-bar > a:hover { background: #e2e8f0; color: var(--ok-green); }

.ok-more-btn {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.ok-balance-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  background: #f0fdf4;
  border-bottom: 1px solid rgba(22, 163, 74, 0.12);
  font-size: 14px;
}
.ok-balance-bar strong { font-size: 16px; }
.ok-balance-bar strong.due { color: var(--ok-red); }
.ok-balance-bar strong.advance { color: var(--ok-green); }

.ok-entry-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 14px 14px;
}

.ok-btn-received,
.ok-btn-given {
  border: 1.5px solid;
  background: #fff;
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ok-btn-received {
  border-color: #86efac;
  color: var(--ok-green);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.12);
}
.ok-btn-given {
  border-color: #fecdd3;
  color: var(--ok-red);
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.12);
}
.ok-btn-received:active,
.ok-btn-given:active { transform: scale(0.98); }

@media (min-width: 992px) {
  .ok-ledger-mode .sidebar { display: flex !important; }
  .ok-ledger-mode .app-main { margin-left: var(--sidebar-w) !important; }
  .ok-ledger-mode .topbar { display: flex !important; }
  .ok-ledger-mode .app-content {
    padding: 24px 32px 48px !important;
    background: var(--bg);
    min-height: auto;
  }
  .ok-ledger {
    height: calc(100vh - var(--topbar-h) - 48px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
  }
}

/* =========================================================
   OK Credit Given / Received keypad entry
   (No plan / subscription banner)
   ========================================================= */
body.ok-entry-open { overflow: hidden; }

.ok-entry-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 0 40px rgba(0,0,0,0.15);
}

/* Standalone New Entry page (same keypad, full page) */
.ok-entry-page-mode .topbar,
.ok-entry-page-mode .sidebar,
.ok-entry-page-mode .sidebar-overlay {
  display: none !important;
}
.ok-entry-page-mode .app-main { margin-left: 0 !important; }
.ok-entry-page-mode .app-content {
  padding: 0 !important;
  min-height: 100vh;
  background: #fff;
}
.ok-entry-page-mode .app-content > .alert {
  margin: 8px 12px;
  position: relative;
  z-index: 30;
}
.ok-entry-page-mode .ok-entry-screen {
  position: relative;
  inset: auto;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  box-shadow: none;
}
body.ok-entry-page-mode.ok-entry-open { overflow: auto; }

.ok-entry-type-switch {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}
.ok-type-chip {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ok-type-chip.active.given {
  border-color: #e11d48;
  color: #e11d48;
  background: #fff1f2;
}
.ok-type-chip.active.received {
  border-color: #0f7040;
  color: #0f7040;
  background: #f0fdf4;
}

.ok-entry-pick {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.ok-entry-pick-search {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.ok-entry-pick-search i {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}
.ok-entry-pick-search .form-control {
  padding-left: 40px;
  border-radius: 12px;
  background: #f8fafc;
}
.ok-entry-pick-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}
.ok-entry-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.ok-entry-pick-row:active { background: #f8fafc; }
.ok-entry-pick-bal {
  font-weight: 700;
  font-size: 14px;
  color: #64748b;
}
.ok-entry-pick-bal.due { color: #e11d48; }
.ok-entry-pick-bal.adv { color: #0f7040; }

@media (min-width: 992px) {
  .ok-entry-page-mode .sidebar { display: flex !important; }
  .ok-entry-page-mode .app-main { margin-left: var(--sidebar-w) !important; }
  .ok-entry-page-mode .topbar { display: flex !important; }
  .ok-entry-page-mode .app-content {
    padding: 24px !important;
    background: var(--bg);
  }
  .ok-entry-page-mode .ok-entry-screen,
  .ok-entry-page-mode .ok-entry-pick {
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
    min-height: calc(100vh - 120px);
    overflow: hidden;
  }
}

.ok-entry-screen.d-none { display: none !important; }

.ok-entry-screen > form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.ok-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  flex-shrink: 0;
}

.ok-entry-due {
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}
.ok-entry-due.is-due { color: #e11d48; }

.ok-entry-body {
  flex: 1;
  padding: 8px 20px 12px;
  overflow-y: auto;
  min-height: 0;
}

.ok-amount-display {
  text-align: center;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.1;
  padding: 20px 8px 8px;
  word-break: break-all;
}
.ok-currency { margin-right: 2px; }

.ok-amount-line {
  width: 120px;
  height: 3px;
  background: #0f7040;
  margin: 0 auto 28px;
  border-radius: 2px;
}
.ok-amount-line.is-received { background: #0f7040; }

.ok-entry-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ok-field-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 14px;
  color: #64748b;
  text-align: left;
  cursor: pointer;
}
.ok-field-pill > i:first-child { font-size: 18px; color: #94a3b8; }
.ok-field-pill span,
.ok-field-pill .ok-field-mid { flex: 1; color: #334155; font-weight: 500; }
.ok-field-mid { display: flex; flex-direction: column; line-height: 1.2; }
.ok-field-mid small { font-size: 11px; color: #94a3b8; font-weight: 400; }
.ok-field-mid strong { font-size: 14px; font-weight: 600; }
.ok-field-right { margin-left: auto; color: #94a3b8; }

.ok-entry-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  padding: 8px 16px 12px;
  flex-shrink: 0;
}

.ok-create-bill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #166534;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: none;
}
.ok-create-bill:hover { color: #166534; background: #d1fae5; }

.ok-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border-radius: 999px;
  background: #15803d;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.35);
}
.ok-confirm-btn:active { transform: scale(0.98); }

.ok-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  background: #f8fafc;
  flex-shrink: 0;
}
.ok-keypad button {
  border: none;
  background: #fff;
  border-radius: 12px;
  padding: 16px 0;
  font-size: 22px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  min-height: 54px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ok-keypad button:active { background: #e2e8f0; }

.ok-keypad .key-back {
  background: #ffe4e6;
  color: #be123c;
}
.ok-keypad .key-op,
.ok-keypad .key-eq {
  background: #dcfce7;
  color: #15803d;
  font-size: 24px;
}

@media (min-width: 576px) {
  .ok-entry-screen {
    top: 0; bottom: 0;
    border-radius: 0;
  }
}

/* =========================================================
   OK Credit ? Add Customer By Yourself
   ========================================================= */
.ok-add-customer-mode .topbar,
.ok-add-customer-mode .sidebar,
.ok-add-customer-mode .sidebar-overlay {
  display: none !important;
}
.ok-add-customer-mode .app-main { margin-left: 0 !important; }
.ok-add-customer-mode .app-content {
  padding: 0 !important;
  min-height: 100vh;
  background: #fff;
}
.ok-add-customer-mode .app-content > .alert {
  margin: 8px 16px;
}

.ok-add-customer {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.ok-add-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.ok-add-back {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 22px;
  text-decoration: none;
  border-radius: 50%;
}
.ok-add-header h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  font-family: var(--font-sans);
}
.ok-add-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px 20px 24px;
}

.ok-add-fields { flex: 1; }

.ok-outline-field {
  position: relative;
  margin-bottom: 22px;
}

.ok-outline-field > label {
  position: absolute;
  top: -8px;
  left: 14px;
  background: #fff;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #15803d;
  z-index: 1;
}
.ok-outline-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #15803d;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.ok-outline-field.is-focused .ok-outline-inner,
.ok-outline-inner:focus-within {
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.ok-outline-inner > i {
  font-size: 20px;
  color: #64748b;
  flex-shrink: 0;
}

.ok-outline-inner input,
.ok-outline-inner textarea {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 16px;
  color: #0f172a;
  padding: 0;
  resize: none;
}
.ok-add-mobile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 8px 4px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
}
.ok-add-mobile-link i { font-size: 18px; }
.ok-add-mobile-link:hover { color: #15803d; }

.ok-add-footer {
  padding-top: 24px;
  padding-bottom: env(safe-area-inset-bottom);
}

.ok-confirm-pill {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  background: #d1d5db;
  color: #fff;
  cursor: not-allowed;
  transition: background 0.2s ease;
}
.ok-confirm-pill:not(:disabled) {
  background: #15803d;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
}
.ok-confirm-pill:not(:disabled):active { transform: scale(0.98); }

@media (min-width: 992px) {
  .ok-add-customer-mode .sidebar { display: flex !important; }
  .ok-add-customer-mode .app-main { margin-left: var(--sidebar-w) !important; }
  .ok-add-customer-mode .topbar { display: flex !important; }
  .ok-add-customer-mode .app-content {
    padding: 24px 32px !important;
    background: var(--bg);
  }
  .ok-add-customer {
    min-height: auto;
    height: calc(100vh - var(--topbar-h) - 48px);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
  }
}

/* =========================================================
   Daily Register — Tabs (Sales / Expenses)
   ========================================================= */
.dr-notebook-page { max-width: 720px; padding-bottom: 40px; }

.dr-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.dr-toolbar-left,
.dr-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dr-date-nav {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.dr-date-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.dr-date-btn:hover { background: var(--bg); }
.dr-date-btn:active { transform: scale(0.96); }
.dr-today-btn { align-self: flex-end; height: 40px; }

.dr-date-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.dr-date-wrap .form-control {
  min-width: 142px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  height: 40px;
}

.dr-saved-wrap { position: relative; }
.dr-saved-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, 92vw);
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  z-index: 50;
  padding: 6px;
}
.dr-saved-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.dr-saved-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
}
.dr-saved-item:hover { background: var(--bg); }
.dr-saved-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.dr-saved-top span { color: var(--primary); font-weight: 700; }
.dr-saved-preview {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dr-save-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  min-width: 90px;
  text-align: right;
}
.dr-save-status.ok { color: var(--success); }
.dr-save-status.saving { color: var(--primary); }
.dr-save-status.typing { color: var(--text-muted); }
.dr-save-status.error { color: var(--danger); }

.dr-live-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.dr-live-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.dr-live-chip span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dr-live-chip strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dr-live-chip.sale strong { color: #059669; }
.dr-live-chip.expense strong { color: #e11d48; }
.dr-live-chip.net {
  cursor: default;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
}
.dr-live-chip.net strong { color: var(--primary); }
.dr-live-chip.net strong.is-neg { color: #e11d48; }
.dr-live-chip.is-active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.dr-live-chip.sale.is-active {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.dr-live-chip.expense.is-active {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16);
}

.dr-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 10px;
}
.dr-tab {
  border: none;
  background: transparent;
  border-radius: 11px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.dr-tab em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
}
.dr-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.dr-tab[data-tab="sale"].is-active { color: #059669; }
.dr-tab[data-tab="expense"].is-active { color: #e11d48; }
.dr-tab[data-tab="sale"].is-active em {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}
.dr-tab[data-tab="expense"].is-active em {
  background: rgba(244, 63, 94, 0.14);
  color: #e11d48;
}

.dr-note-hint-bar {
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: none;
}
.dr-note-hint-bar code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--text);
}

.dr-panels { margin-bottom: 12px; }
.dr-panel[hidden] { display: none !important; }
.dr-panel.is-active { animation: drFadeIn 0.22s ease; }

.dr-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}
.dr-note-card.sale { border-top: 3px solid #10b981; }
.dr-note-card.expense { border-top: 3px solid #f43f5e; }
.dr-note-card.dr-flash { animation: drPop 0.28s ease; }
.dr-note-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.dr-note-card.sale .dr-note-label span { color: #059669; }
.dr-note-card.expense .dr-note-label span { color: #e11d48; }
.dr-note-label strong {
  font-size: 15px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}
.dr-note {
  width: 100%;
  flex: 1;
  min-height: 280px;
  border: none;
  resize: vertical;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.7;
  font-family: "DM Sans", ui-monospace, Menlo, Consolas, monospace;
  background: transparent;
  color: var(--text);
  outline: none;
}
.dr-note::placeholder {
  color: var(--text-soft);
  opacity: 0.65;
  font-size: 14px;
}

.dr-note-footer.sticky-footer {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.dr-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  border: none;
  background: transparent;
  padding: 4px 2px;
  width: 100%;
  text-align: left;
  cursor: default;
}
button.dr-total-row {
  cursor: pointer;
  border-radius: 10px;
}
button.dr-total-row:hover { background: var(--bg); }
.dr-total-row strong {
  font-size: 15px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.dr-total-row.big {
  grid-column: 1 / -1;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px dashed var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: default;
}
.dr-total-row.big strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}
.dr-total-row.big strong.is-neg { color: #e11d48; }
.dr-line-count {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-soft);
  text-align: right;
}

@media (max-width: 767.98px) {
  .dr-note { min-height: 42vh; }
  .dr-note-footer.sticky-footer {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 15;
  }
  .dr-live-strip {
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 6px 0;
    background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  }
}

@media (max-width: 575.98px) {
  .dr-note {
    min-height: 48vh;
    font-size: 16px;
    padding: 14px;
  }
  .dr-note-footer {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .dr-toolbar-right .btn { padding-inline: 10px; }
  .dr-live-chip strong { font-size: 13.5px; }
  .dr-date-wrap .form-control { min-width: 128px; }
}

.dr-notebook-page .dr-fab { display: none !important; }

.dr-page {
  max-width: 920px;
  margin: 0 auto;
  padding-bottom: 100px;
}
.dr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.dr-header h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.dr-header p { margin: 0; color: var(--text-muted); font-size: 14px; }
.dr-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dr-date-input { width: auto; min-width: 150px; border-radius: 12px; }

.dr-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.dr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease;
}
.dr-card:active { transform: scale(0.98); }
.dr-card span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  font-weight: 600;
}
.dr-card strong { font-size: 1.05rem; line-height: 1.2; }
.dr-card.sale strong { color: var(--success); }
.dr-card.expense strong { color: var(--danger); }
.dr-card.cash strong { color: var(--primary); }
.dr-card.profit strong { color: #0f7040; }
.dr-card .dr-last { font-size: 0.95rem; }

.dr-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.dr-breakdown b { color: var(--text); font-weight: 700; margin-left: 4px; }

.dr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  position: sticky;
  top: calc(var(--topbar-h, 56px) + 8px);
  z-index: 20;
  margin-bottom: 20px;
}
.dr-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 18px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dr-btn:hover { transform: translateY(-1px); }
.dr-btn:active { transform: scale(0.98); }
.dr-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.dr-btn.sale {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.35);
}
.dr-btn.expense {
  background: linear-gradient(135deg, #dc2626, #f43f5e);
  box-shadow: 0 8px 22px rgba(244, 63, 94, 0.3);
}
.dr-btn i { font-size: 1.25rem; }

.dr-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 8px;
}
.dr-timeline-head h2 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.dr-hint { font-size: 12px; color: var(--text-soft); }

.dr-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dr-bubble {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 40px 12px 14px;
  border-left: 4px solid var(--border);
  animation: drFadeIn 0.25s ease;
}
.dr-bubble.sale { border-left-color: #10b981; }
.dr-bubble.expense { border-left-color: #f43f5e; }
.dr-bubble.dr-pop { animation: drPop 0.35s ease; }
.dr-bubble-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.dr-time { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.dr-type-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
}
.dr-bubble.sale .dr-type-pill { background: rgba(16, 185, 129, 0.12); color: #059669; }
.dr-bubble.expense .dr-type-pill { background: rgba(244, 63, 94, 0.12); color: #e11d48; }
.dr-bubble-title { font-weight: 700; font-size: 15px; }
.dr-bubble-amt { font-size: 1.15rem; font-weight: 700; margin: 2px 0; }
.dr-bubble.sale .dr-bubble-amt { color: #059669; }
.dr-bubble.expense .dr-bubble-amt { color: #e11d48; }
.dr-bubble-meta { font-size: 12px; color: var(--text-muted); }
.dr-del {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.dr-del:hover { background: rgba(244, 63, 94, 0.12); color: #e11d48; }

.dr-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.dr-empty i { font-size: 2.5rem; opacity: 0.4; display: block; margin-bottom: 8px; }

/* FAB (mobile) */
.dr-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #158a4f, #0f7040);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 10px 28px rgba(15, 112, 64, 0.4);
  z-index: 40;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.dr-fab.open { transform: rotate(45deg); }
.dr-fab-menu {
  position: fixed;
  right: 18px;
  bottom: calc(140px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}
.dr-fab-item {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dr-fab-item.sale { background: #059669; }
.dr-fab-item.expense { background: #e11d48; }

/* Modal */
body.dr-modal-open { overflow: hidden; }
.dr-modal[hidden] { display: none !important; }
.dr-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.dr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}
.dr-modal-sheet {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,0.18);
  animation: drSheetUp 0.28s ease;
}
.dr-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.dr-modal-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dr-modal-x {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}
.dr-form-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 10px;
  margin-bottom: 10px;
}
.dr-pay-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.dr-pay {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.dr-pay.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.dr-save {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 14px;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}
.dr-save.sale { background: #059669; }
.dr-save.expense { background: #e11d48; }
.dr-save:disabled { opacity: 0.6; cursor: wait; }
.dr-shortcut-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  margin: 10px 0 0;
}

.dr-suggest-wrap { position: relative; margin-bottom: 10px; }
.dr-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}
.dr-suggest-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.dr-suggest-item:last-child { border-bottom: 0; }
.dr-suggest-item:hover { background: var(--bg); }
.dr-suggest-item small { color: var(--text-soft); white-space: nowrap; }

.dr-export-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
}
.dr-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dr-analytics-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.dr-analytics-panel h3 {
  font-size: 14px;
  margin: 0 0 12px;
  font-weight: 700;
}
.dr-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dr-rank-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.dr-rank-list li:last-child { border-bottom: 0; }
.dr-rank-list small { color: var(--text-soft); }
.dr-custom-range {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.card-soft { /* alias */ }

@keyframes drSheetUp {
  from { transform: translateY(40px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes drFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes drPop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (min-width: 768px) {
  .dr-modal { align-items: center; padding: 24px; }
  .dr-modal-sheet {
    border-radius: 20px;
    max-height: 85vh;
  }
}

@media (max-width: 767.98px) {
  .dr-summary { grid-template-columns: repeat(2, 1fr); }
  .dr-card.meta:nth-child(5),
  .dr-card.meta:nth-child(6) { grid-column: span 1; }
  .dr-actions { top: auto; position: relative; }
  .dr-fab { display: flex; align-items: center; justify-content: center; }
  .dr-analytics-grid { grid-template-columns: 1fr; }
  .dr-form-row { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
  .dr-btn { padding: 14px; font-size: 15px; }
  .dr-card strong { font-size: 0.95rem; }
}

/* Admin business usage */
.admin-usage-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 18px 0 10px;
}
.stat-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-grid.compact .stat-card { padding: 12px; }
.stat-grid.compact .stat-value { font-size: 1.25rem; }

/* Activity / audit feed */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.activity-item:last-child { border-bottom: 0; }
.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary, #158a4f);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #158a4f) 22%, transparent);
}
.activity-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.activity-desc { font-size: 14px; line-height: 1.45; }
.activity-meta { margin-top: 4px; }

/* Cash closing panel */
.dr-cash-close {
  margin: 16px 0 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.dr-cash-close > summary.dr-cash-close-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.dr-cash-close > summary.dr-cash-close-head::-webkit-details-marker { display: none; }
.dr-cash-close-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.dr-cash-close-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.dr-cash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 768px) {
  .dr-cash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Staff permissions matrix */
.perm-matrix th:not(:first-child),
.perm-matrix td:not(:first-child) {
  text-align: center;
  width: 90px;
}
.perm-matrix td:not(:first-child) {
  font-weight: 700;
  color: var(--primary, #158a4f);
}

/* ===== Invoice — premium mobile ===== */
.inv-page { max-width: 720px; margin: 0 auto; position: relative; }
.inv-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  margin-bottom: 8px;
}
.inv-page-header h1,
.inv-list-header h1,
.inv-view-header h1 {
  letter-spacing: -0.02em;
}


.inv-list-page { max-width: 720px; margin: 0 auto; padding-bottom: 20px; }
.inv-list-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.inv-list-top h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.inv-list-new {
  border-radius: 12px;
  font-weight: 700;
  padding: 10px 14px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inv-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.inv-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.inv-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  font-size: 14px;
}
.inv-search-wrap .form-control {
  padding-left: 36px;
  border-radius: 12px;
  min-height: 44px;
  background: var(--surface);
}
.inv-filter-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inv-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.inv-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.inv-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.inv-m-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inv-m-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--border));
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}
.inv-m-card-main {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.inv-m-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.inv-m-num {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.inv-m-customer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-m-date {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}
.inv-m-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.inv-m-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0;
}
.inv-m-icon-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

/* —— Invoice view —— */
.inv-view-page { max-width: 720px; margin: 0 auto; padding-bottom: 24px; }
.inv-view-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.inv-view-top h1 {
  margin: 0;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
}
.inv-view-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.inv-view-btn {
  border-radius: 12px;
  min-height: 46px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-outline-primary.inv-view-btn {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--surface);
}
.inv-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.inv-info-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.inv-info-value {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.inv-info-num { color: var(--primary); }
.inv-view-table-head,
.inv-view-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 0.45fr 0.85fr 0.9fr;
  gap: 8px;
  align-items: center;
}
.inv-view-table-head {
  padding: 0 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.inv-view-table-head span:nth-child(n+2),
.inv-view-item-row span {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.inv-view-item-row {
  padding: 12px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.inv-view-item-row:last-child { border-bottom: 0; }
.inv-view-prod {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-view-summary {
  margin-top: 12px;
  padding-top: 8px;
  background: transparent;
  border-radius: 0;
}
.inv-view-items { display: block; }

/* —— Invoice create (mobile mockup) —— */
.inv-create-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 12px 28px;
}
.inv-create-top {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 6px 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.inv-create-top-mid {
  text-align: center;
  min-width: 0;
}
.inv-create-top-mid h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.inv-create-top-mid p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.3;
}
.inv-top-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  padding: 0;
  cursor: pointer;
}
.inv-top-btn i { font-size: 1.15rem; line-height: 1; }
.inv-top-btn--ghost {
  visibility: hidden;
  pointer-events: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.inv-top-save {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
  background: var(--primary-soft);
}
.inv-top-save:disabled { opacity: 0.65; }

.inv-section {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 8%, var(--border));
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.inv-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin: 0 0 14px;
}
.inv-section-title--plain {
  margin: 0 0 10px;
  padding: 0 2px;
}
.inv-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.inv-field { margin-bottom: 12px; }
.inv-field:last-child { margin-bottom: 0; }
.inv-field .form-label {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.inv-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.inv-create-page .form-control,
.inv-create-page .form-select {
  border-radius: 10px;
  min-height: 40px;
  border-color: var(--border);
  background: var(--bg);
  font-size: 14px;
}
.inv-create-page .form-control:focus,
.inv-create-page .form-select:focus {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.inv-status-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inv-status-pill {
  cursor: pointer;
  margin: 0;
}
.inv-status-pill input { position: absolute; opacity: 0; pointer-events: none; }
.inv-status-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.inv-status-pill input:checked + span {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: none;
}

.inv-items-section { margin-bottom: 12px; }
.inv-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.inv-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  transition: border-color 0.15s ease;
}
.inv-item-card.is-open {
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
}

.inv-item-summary {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}
.inv-sum-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.inv-sum-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.25;
}
.inv-sum-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-sum-meta {
  font-size: 11px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.inv-sum-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.inv-item-summary .inv-sum-total {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.inv-sum-chevron {
  font-size: 11px;
  color: var(--text-soft);
}
.inv-item-card.is-open .inv-sum-chevron { transform: none; }

.inv-item-body {
  display: none;
  padding: 0 10px 8px;
  border-top: 1px dashed var(--border);
}
.inv-item-card.is-open .inv-item-body { display: block; padding-top: 6px; }
.inv-field--compact { margin-bottom: 6px; }
.inv-field--compact .form-label { margin-bottom: 2px; font-size: 11px; }
.inv-item-nums--main .form-label { margin-bottom: 2px; font-size: 11px; }
.inv-item-card .form-control {
  min-height: 34px;
  padding: 4px 10px;
  font-size: 13px;
  border-radius: 8px;
}

.inv-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.inv-item-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.inv-item-top .inv-item-remove {
  width: 28px;
  height: 28px;
  padding: 0;
}
.inv-item-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.inv-item-nums--main { margin-bottom: 6px; }
.inv-item-more {
  margin: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  padding: 0 8px;
}
.inv-item-more summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 0;
}
.inv-item-more summary::-webkit-details-marker { display: none; }
.inv-item-more[open] summary { padding-bottom: 4px; }
.inv-item-more .inv-item-nums { padding-bottom: 8px; }

.inv-items-empty {
  text-align: center;
  padding: 28px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--text-soft);
}
.inv-items-empty i {
  font-size: 2rem;
  opacity: 0.45;
  display: block;
  margin-bottom: 8px;
}
.inv-items-empty p { margin: 0; font-size: 13.5px; font-weight: 600; }
.inv-items.d-none { display: none !important; }

.inv-add-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 112, 64, 0.25);
  cursor: pointer;
}
.inv-add-item-btn:active { transform: scale(0.985); }
.inv-add-item-btn span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.inv-bottom-save {
  margin: 8px 0 20px;
}
.inv-bottom-save .btn {
  border-radius: 14px;
  min-height: 50px;
  font-weight: 700;
}

.inv-summary { padding: 16px; }
.inv-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
}
.inv-sum-row span:last-child,
.inv-sum-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.inv-sum-row.inv-sum-total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.inv-sum-row.inv-sum-total strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

.inv-notes-section .form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.inv-notes-section textarea {
  min-height: 88px;
  resize: vertical;
}

.inv-form-spacer { height: 96px; }
.inv-sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-solid, #fff) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
}
.inv-sticky-total {
  flex: 1;
  min-width: 0;
}
.inv-sticky-total span {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inv-sticky-total strong {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.inv-sticky-actions .btn {
  flex-shrink: 0;
  min-width: 120px;
  border-radius: 14px;
}

@media (min-width: 992px) {
  .inv-create-page { max-width: 720px; padding: 0 0 28px; }
  .inv-create-top {
    position: static;
    background: transparent;
    backdrop-filter: none;
    padding-bottom: 20px;
  }
}

/* Full-screen create on mobile (match mockup) */
@media (max-width: 991.98px) {
  .inv-create-mode .topbar,
  .inv-create-mode .sidebar,
  .inv-create-mode .sidebar-overlay {
    display: none !important;
  }
  .inv-create-mode .app-main { margin-left: 0 !important; }
  .inv-create-mode .app-content {
    padding: 8px 0 24px !important;
    min-height: 100dvh;
    background: var(--bg);
  }
}
@media (min-width: 992px) {
  .inv-create-mode .sidebar { display: flex !important; }
  .inv-create-mode .app-main { margin-left: var(--sidebar-w) !important; }
  .inv-create-mode .topbar { display: flex !important; }
}

.inv-view-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.inv-view-title-row h1 { margin: 0; }
.inv-view-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.inv-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.inv-act i { font-size: 1.2rem; }
.inv-act-wa {
  background: #ecfdf5;
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
}
.inv-act-print {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
  color: var(--primary);
}
.inv-parties {
  display: grid;
  gap: 14px;
}
.inv-party-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.inv-party-name {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 2px;
}
.inv-notes-text {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 14px;
}
.inv-status-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.inv-status-field { flex: 1; min-width: 160px; }

@media (min-width: 992px) {
  .inv-list-page .inv-m-list { display: none; }
  .inv-item-nums--main { grid-template-columns: 1fr 1fr; }
  .inv-view-page .inv-view-top { max-width: 100%; }
}
@media (max-width: 991.98px) {
  .inv-list-page .table-desktop { display: none !important; }
  .inv-page { padding-bottom: 8px; }
  .inv-status-form {
    flex-direction: column;
    align-items: stretch;
  }
  .inv-status-form .btn { width: 100%; }
}

/* =========================================================
   Global mobile compatibility (modern, safe)
   ========================================================= */

/* Prevent horizontal page scroll from wide children */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
.app-content,
.panel,
.m-card,
.search-hit {
  min-width: 0;
}

/* Toasts above bottom nav */
.toast-nav-safe {
  bottom: 16px;
  z-index: 120;
}

/* ===== Global slim toast (cf-toast) ===== */
.cf-toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: max(10px, env(safe-area-inset-top));
  z-index: 2000;
  width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.cf-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 8px 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: #0f7040;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cf-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.cf-toast.is-out {
  opacity: 0;
  transform: translateY(-6px);
}

.cf-toast-icon {
  flex-shrink: 0;
  font-size: 14px;
  opacity: 0.95;
}

.cf-toast-msg {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.cf-toast-x {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.cf-toast-x:hover {
  background: rgba(255, 255, 255, 0.24);
}

.cf-toast--success { background: #059669; }
.cf-toast--error { background: #dc2626; }
.cf-toast--warning { background: #d97706; }
.cf-toast--info { background: #0284c7; }

@media (max-width: 991.98px) {
  .cf-toast-host {
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
    width: calc(100vw - 20px);
  }

  .cf-toast {
    min-height: 34px;
    padding: 6px 6px 6px 10px;
    font-size: 12.5px;
    border-radius: 9px;
  }

  .toast-nav-safe {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
}

/* Search */
.search-panel { max-width: 640px; }
.search-bar {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.search-bar .form-control { flex: 1; min-width: 0; }
.search-results { padding: 0 4px 8px; }
.search-hit {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-hit-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.search-hit-amt {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Notifications */
.notif-row {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: 0; }
.notif-row.is-read { opacity: 0.62; }
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(15, 112, 64, 0.1);
  color: var(--primary, #0f7040);
  font-size: 14px;
}
.notif-icon.success { background: rgba(22, 163, 74, 0.12); color: #0f7040; }
.notif-icon.warning { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.notif-icon.info { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.notif-body { flex: 1; min-width: 0; }
.notif-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* Permissions mobile cards */
.perm-mobile { display: none; }
.perm-mobile-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.perm-mobile-row:last-child { border-bottom: 0; }
.perm-mobile-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
.perm-mobile-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.perm-mobile-roles span {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.perm-mobile-roles span.on {
  background: rgba(15, 112, 64, 0.12);
  border-color: rgba(15, 112, 64, 0.28);
  color: var(--primary, #0f7040);
}

/* Profile */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-avatar-field { flex: 1; min-width: 0; }

/* Invoice status */
.inv-status-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  max-width: 480px;
}
.inv-status-field { flex: 1; min-width: 160px; }

/* Settings panels full width on phone */
.settings-panel,
.panel[style*="max-width"] {
  max-width: 100% !important;
}

/* Day totals wrap on transactions */
.txn-day-head {
  flex-wrap: wrap;
  gap: 8px;
}
.txn-day-totals {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* List-row modern wrap (dashboard lists etc.) */
.list-row {
  flex-wrap: wrap;
  gap: 10px;
}
.list-row > .flex-grow-1,
.list-row > div:not(.stat-icon) {
  min-width: 0;
}

@media (max-width: 991.98px) {
  .toast-nav-safe {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .perm-mobile { display: block; }

  .search-bar {
    flex-direction: column;
  }
  .search-bar .btn { width: 100%; }

  .profile-avatar-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-avatar-field { width: 100%; }

  .inv-status-form {
    flex-direction: column;
    align-items: stretch;
  }
  .inv-status-form .btn { width: 100%; }

  /* Daily register: sticky totals shouldn't cover cash close */
  .dr-cash-close {
    margin-bottom: calc(96px + env(safe-area-inset-bottom));
    scroll-margin-bottom: 120px;
  }
  .dr-note-footer.sticky-footer {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }

  /* Forms / selects never overflow */
  .form-control,
  .form-select,
  .btn {
    max-width: 100%;
  }

  /* Charts don't force width */
  .chart-box,
  canvas {
    max-width: 100% !important;
  }

  /* Soften page header actions on very small */
  .page-header .d-flex .btn {
    min-width: 0;
  }

  /* Tables that aren't marked desktop still scroll cleanly */
  .table-wrap:not(.table-desktop) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap:not(.table-desktop) .table-modern {
    min-width: 520px;
  }

  /* Code blocks wrap */
  code {
    word-break: break-word;
    white-space: pre-wrap;
  }
}

@media (max-width: 575.98px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card { padding: 12px; }
  .stat-value {
    font-size: 16px !important;
    word-break: break-word;
  }
  .search-hit {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .search-hit-amt { align-self: flex-end; }
  .notif-actions .btn { flex: 1; }
  .m-form-stack > [class*="col-"] {
    width: 100%;
  }
}

/* ===== SEO landing (public home) ===== */
.legal-wrap--wide { max-width: 880px; }
.legal-top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.seo-hero { margin-bottom: 1.4rem; }
.seo-eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary, #0f7040);
}
.seo-hero h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--text);
}
.seo-lead {
  font-size: 1.02rem !important;
  color: var(--text-muted);
  margin-bottom: 1.1rem !important;
}
.seo-cta,
.seo-foot-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0.4rem 0 0.2rem;
}
.seo-block { margin-top: 1.6rem; }
.seo-chips {
  list-style: none;
  padding: 0 !important;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.seo-chips li {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2, rgba(15, 112, 64, 0.06));
  font-size: 0.82rem !important;
  font-weight: 600;
  color: var(--text) !important;
  line-height: 1.3 !important;
}
.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 1.5rem;
}
.seo-grid article {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2, rgba(15, 23, 42, 0.03));
}
.seo-grid h3 {
  font-size: 1rem;
  margin: 0 0 6px;
  color: var(--text);
}
.seo-grid p {
  margin: 0 !important;
  font-size: 0.9rem !important;
}
.seo-faq { margin-top: 1.6rem; }
.seo-faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface);
}
.seo-faq summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--text);
}
.seo-faq details p {
  margin: 10px 0 0 !important;
}
@media (max-width: 640px) {
  .seo-grid { grid-template-columns: 1fr; }
  .legal-top { flex-wrap: wrap; }
  .legal-top-actions { width: 100%; }
}

/* Bootstrap primary → forest green */
.btn-primary {
  --bs-btn-bg: #0f7040;
  --bs-btn-border-color: #0f7040;
  --bs-btn-hover-bg: #0b5931;
  --bs-btn-hover-border-color: #0b5931;
  --bs-btn-active-bg: #0b5931;
  --bs-btn-active-border-color: #0b5931;
  --bs-btn-disabled-bg: #0f7040;
  --bs-btn-disabled-border-color: #0f7040;
}
.form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem var(--primary-soft);
}
