/* ═══════════════════════════════════════════════════════════════
   Bhatta360 — Kiln & Clay Design System v7
   Typeface: Outfit (display) + Source Serif 4 (body numerals)
            + JetBrains Mono (data)
   Palette: fired earth · raw clay · kiln smoke · ember glow
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,400&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── DESIGN TOKENS ───────────────────────────────────────────── */
:root {
  /* ── Surfaces: warm parchment + clay ── */
  --bg:        #f7f3ee;
  --surface:   #fefcf9;
  --surface-2: #f9f5f0;
  --surface-3: #f2ebe0;
  --surface-4: #e8dccf;
  --border:    #e0d0be;
  --border-2:  #d0bba4;
  --border-3:  #b89e84;

  /* ── Primary: kiln-fired deep terracotta ── */
  /* Contrast verified: 7.7:1 on white, 7.2:1 on #f7f3ee */
  --primary:     #8b2e0f;
  --primary-2:   #6e2409;
  --primary-3:   #c4400e;
  --primary-dim: rgba(139,46,15,0.08);
  --primary-glow:rgba(139,46,15,0.18);

  /* ── Ink: warm charcoal ── */
  --ink:   #1a120a;
  --ink-2: #3d2b1a;
  --ink-3: #6b5240;
  --muted: #7c6452;   /* 5.2:1 on white — AA compliant */

  /* ── Semantic ── */
  --success:     #1a5c2a;  /* 7.2:1 on success-dim */
  --success-dim: rgba(26,92,42,0.08);
  --warn:        #7a3500;  /* 7.6:1 on warn-dim */
  --warn-dim:    rgba(122,53,0,0.08);
  --danger:      #8b1515;  /* 7.8:1 on danger-dim */
  --danger-dim:  rgba(139,21,21,0.08);
  --info:        #124e73;  /* 7.0:1 on info-dim */
  --info-dim:    rgba(18,78,115,0.08);

  /* ── Structural ── */
  --nav-h:     60px;
  --sidebar-w: 252px;
  --bnav-h:    66px;
  --r:    7px;
  --r-lg: 12px;
  --r-xl: 18px;

  /* ── Elevation ── */
  --shadow-xs: 0 1px 2px rgba(28,18,10,0.06);
  --shadow-sm: 0 1px 4px rgba(28,18,10,0.08), 0 2px 8px rgba(28,18,10,0.04);
  --shadow-md: 0 4px 16px rgba(28,18,10,0.10), 0 2px 6px rgba(28,18,10,0.06);
  --shadow-lg: 0 8px 32px rgba(28,18,10,0.12), 0 4px 12px rgba(28,18,10,0.08);
  --shadow-up: 0 -2px 12px rgba(28,18,10,0.08);

  /* ── Typography scale ── */
  --text-xs:   0.7rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1rem;
  --text-lg:   1.15rem;
  --text-xl:   1.35rem;

  /* ── Transitions ── */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 0.12s;
  --t-mid:  0.22s;
  --t-slow: 0.38s;
}

/* ── RESET + BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; font-size: 16px; }
body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 0.9375rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--nav-h);
}

/* ── TYPOGRAPHY ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700; line-height: 1.25; color: var(--ink);
}
/* Display numbers (rupee amounts etc) get Source Serif */
.serif-num {
  font-family: 'Source Serif 4', serif;
  font-weight: 600; font-feature-settings: 'lnum', 'tnum';
}
code, .mono, kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em; font-weight: 500;
  background: var(--surface-3); color: var(--primary);
  padding: 0.1em 0.4em; border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── SCROLLBAR ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}
.topbar-left, .topbar-right {
  display: flex; align-items: center; gap: 0.65rem;
}
.topbar-brand {
  display: flex; align-items: center;
  gap: 0.6rem; text-decoration: none;
}
.brand-icon-wrap {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.brand-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.12rem; font-weight: 800;
  color: var(--ink); letter-spacing: -0.5px;
  line-height: 1;
}
.brand-text em { color: var(--primary); font-style: normal; }
.sidebar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--border);
  color: var(--ink-3); font-size: 1.15rem;
  border-radius: var(--r); cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
  flex-shrink: 0; -webkit-tap-highlight-color: transparent;
}
.sidebar-toggle:hover { background: var(--surface-3); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 0.5rem; }
.user-chip .avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: #fff;
  letter-spacing: 0.3px;
}
.user-chip .uname {
  display: none; font-size: 0.82rem; font-weight: 600;
  color: var(--ink-2);
}
.role-pill {
  display: none; font-size: 0.6rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-3);
  border: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.role-pill.is-admin {
  background: var(--primary-dim); color: var(--primary);
  border-color: rgba(139,46,15,0.2);
}
.topbar-logout {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); text-decoration: none;
  border-radius: var(--r);
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-logout:hover { background: var(--surface-3); color: var(--ink); }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: var(--nav-h); left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 1100;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar.open { transform: translateX(0); }
.sidebar-label {
  display: block; font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.8px;
  color: var(--muted); padding: 1.25rem 1.1rem 0.35rem;
}
.sidebar-sep {
  border: none; border-top: 1px solid var(--border);
  margin: 0.35rem 0.8rem;
}
.sidebar-links { list-style: none; padding: 0 0 0.5rem; }
.sidebar-links a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.58rem 0.9rem; margin: 0.08rem 0.5rem;
  border-radius: var(--r); color: var(--ink-3);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem; font-weight: 500;
  text-decoration: none; min-height: 42px;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.sidebar-links a i {
  font-size: 0.88rem; width: 16px;
  flex-shrink: 0; opacity: 0.65;
  transition: opacity var(--t-fast);
}
.sidebar-links a:hover {
  background: var(--surface-3); color: var(--ink-2);
}
.sidebar-links a:hover i { opacity: 1; }
.sidebar-links a.active {
  background: var(--primary-dim); color: var(--primary);
  font-weight: 600;
}
.sidebar-links a.active i { color: var(--primary); opacity: 1; }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 1090;
  background: rgba(26,18,10,0.4);
  backdrop-filter: blur(3px);
}
.sidebar-backdrop.show { display: block; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.page-wrap {
  padding: 1.4rem 1.15rem calc(var(--bnav-h) + 1.5rem);
  min-height: calc(100vh - var(--nav-h));
}
.page-header {
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 0.6rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem; font-weight: 800;
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--ink);
}
.page-header h4 i {
  color: var(--primary); font-size: 0.92rem;
  opacity: 0.9;
}

/* ── BOTTOM NAV ──────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bnav-h); background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-up); z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bnav-inner {
  display: flex; height: 100%; align-items: stretch;
}
.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted);
  position: relative;
  font-family: 'Outfit', sans-serif;
  font-size: 0.55rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 6px 2px 5px; min-width: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast);
}
.bnav-item i { font-size: 1.22rem; line-height: 1; }
.bnav-item span {
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; width: 100%; text-align: center;
}
.bnav-item.active { color: var(--primary); }
.bnav-item.active::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%;
  height: 2.5px; background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* ── BOOTSTRAP COMPONENT OVERRIDES ──────────────────────────── */

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: var(--surface-2) !important;
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.2rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem; font-weight: 700;
  color: var(--ink);
  display: flex; align-items: center; gap: 0.4rem;
  border-radius: var(--r-lg) var(--r-lg) 0 0 !important;
}
.card-header i { color: var(--primary); opacity: 0.85; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.8rem 1.2rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* Tables */
.table {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem; margin-bottom: 0; color: var(--ink);
}
.table th {
  background: var(--surface-2); color: var(--muted);
  font-size: 0.64rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  border-color: var(--border) !important;
  padding: 0.72rem 1rem; white-space: nowrap;
}
.table td {
  vertical-align: middle; padding: 0.8rem 1rem;
  border-color: var(--border) !important;
  color: var(--ink); font-size: 0.9rem;
}
.table > :not(caption) > * > * { border-color: var(--border); }
.table-hover > tbody > tr {
  transition: background var(--t-fast);
}
.table-hover > tbody > tr:hover > * {
  background-color: var(--surface-2) !important;
}

/* Forms */
.form-control, .form-select {
  font-family: 'Outfit', sans-serif;
  background: var(--surface);
  border: 1.5px solid var(--border-2);
  color: var(--ink); border-radius: var(--r);
  font-size: 0.9rem; min-height: 44px;
  transition: border-color var(--t-fast),
              box-shadow var(--t-fast),
              background var(--t-fast);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-dim);
  color: var(--ink); outline: none;
}
.form-control::placeholder { color: var(--muted); opacity: 0.7; }
.form-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem; font-weight: 700;
  color: var(--ink-3); margin-bottom: 0.3rem;
  text-transform: uppercase; letter-spacing: 0.5px;
  display: block;
}
.form-text { font-size: 0.72rem; color: var(--muted); }
.form-control-sm, .form-select-sm {
  min-height: 36px; font-size: 0.82rem;
  padding: 0.28rem 0.65rem;
}
.input-group-text {
  background: var(--surface-3);
  border: 1.5px solid var(--border-2);
  color: var(--ink-3); font-weight: 600;
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem;
}

/* Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 700; border-radius: var(--r);
  transition: all var(--t-fast) var(--ease);
  min-height: 40px; padding: 0.46rem 1.1rem;
  font-size: 0.86rem; letter-spacing: 0.1px;
}
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 4px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-2); border-color: var(--primary-2);
  color: #fff; box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-1px);
}
.btn-success  { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #145c22; border-color: #145c22; color: #fff; transform: translateY(-1px); }
.btn-danger   { background: var(--danger);  border-color: var(--danger);  color: #fff; }
.btn-danger:hover { background: #6e1010; border-color: #6e1010; color: #fff; }
.btn-secondary {
  background: var(--surface); border-color: var(--border-2);
  color: var(--ink-2);
}
.btn-secondary:hover { background: var(--surface-3); color: var(--ink); border-color: var(--border-2); }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-outline-primary {
  color: var(--primary); border-color: var(--primary); background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }
.btn-outline-secondary {
  color: var(--ink-2); border-color: var(--border-2); background: transparent;
}
.btn-outline-secondary:hover { background: var(--surface-3); color: var(--ink); border-color: var(--border-2); }
.btn-outline-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-success { color: var(--success); border-color: var(--success); background: transparent; }
.btn-outline-success:hover { background: var(--success); color: #fff; }
.btn-outline-info { color: var(--info); border-color: var(--info); background: transparent; }
.btn-outline-info:hover { background: var(--info); color: #fff; }
.btn-outline-dark { color: var(--ink-2); border-color: var(--border-2); background: transparent; }
.btn-outline-dark:hover { background: var(--surface-3); color: var(--ink); }
.btn-outline-warning { color: var(--warn); border-color: var(--warn); background: transparent; }
.btn-outline-warning:hover { background: var(--warn); color: #fff; }
.btn-sm  { font-size: 0.76rem; padding: 0.28rem 0.7rem; min-height: 32px; }
.btn-xs  { font-size: 0.68rem; padding: 0.2rem 0.55rem; min-height: 26px; border-radius: 5px; }
.btn-lg  { padding: 0.62rem 1.5rem; font-size: 0.96rem; min-height: 48px; }

/* Badges */
.badge {
  font-family: 'Outfit', sans-serif; font-weight: 700;
  border-radius: 999px; padding: 0.26em 0.7em; font-size: 0.68rem;
  letter-spacing: 0.2px;
}
.badge.bg-success { background: var(--success-dim) !important; color: var(--success) !important; }
.badge.bg-danger  { background: var(--danger-dim)  !important; color: var(--danger)  !important; }
.badge.bg-warning { background: var(--warn-dim)    !important; color: var(--warn)    !important; }
.badge.bg-info    { background: var(--info-dim)    !important; color: var(--info)    !important; }
.badge.bg-secondary {
  background: var(--surface-3) !important;
  color: var(--ink-3) !important;
  border: 1px solid var(--border);
}

/* Flash alerts */
.flash-wrap {
  position: fixed; top: calc(var(--nav-h) + 10px);
  right: 12px; left: 12px; z-index: 2000;
}
.flash-wrap .alert {
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem; font-weight: 600;
  border: none;
  animation: slideDown 0.25s var(--ease-spring);
}
@keyframes slideDown {
  from { transform: translateY(-24px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Modals */
.modal-content {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.modal-header {
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 1rem 1.25rem;
  font-family: 'Outfit', sans-serif;
}
.modal-title { font-weight: 800; font-size: 0.96rem; }
.modal-footer {
  background: var(--surface-2); border-top: 1px solid var(--border);
  padding: 0.85rem 1.25rem;
}
@media (max-width: 575px) {
  .modal-dialog { margin: 0; }
  .modal-content { border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .modal-dialog.modal-dialog-centered {
    align-items: flex-end; min-height: 100%;
  }
}

/* ── APP COMPONENTS ──────────────────────────────────────────── */

/* ── Stat cards ── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; min-height: 90px;
  transition: box-shadow var(--t-mid) var(--ease),
              transform var(--t-mid) var(--ease);
}
.stat-card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.stat-card .stat-icon {
  position: absolute; right: 1rem; top: 50%;
  transform: translateY(-50%); font-size: 2.5rem;
  opacity: 0.05; pointer-events: none; color: var(--ink);
}
.stat-card h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.55rem; font-weight: 700;
  margin: 0 0 4px; letter-spacing: -0.5px;
  line-height: 1;
}
.stat-card p {
  margin: 0; font-family: 'Outfit', sans-serif;
  font-size: 0.6rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.9px;
  color: var(--muted);
}
.stat-bg-1 { border-top: 3px solid var(--info);    } .stat-bg-1 h2 { color: var(--info); }
.stat-bg-2 { border-top: 3px solid var(--success); } .stat-bg-2 h2 { color: var(--success); }
.stat-bg-3 { border-top: 3px solid var(--primary); } .stat-bg-3 h2 { color: var(--primary); }
.stat-bg-4 { border-top: 3px solid var(--ink-3);   }
.stat-bg-danger { border-top: 3px solid var(--danger); } .stat-bg-danger h2 { color: var(--danger); }

/* ── Login ── */
.login-page {
  min-height: 100vh; padding-top: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 2.5rem 2.2rem;
  width: 100%; max-width: 400px; margin: 1rem;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem; font-weight: 900; margin-bottom: 0.1rem;
  letter-spacing: -0.5px;
}
.login-logo span { color: var(--primary); }
.login-sub { color: var(--muted); font-size: 0.84rem; margin-bottom: 2rem; }

/* ── Bhatta banner ── */
.bhatta-banner {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--r-lg);
  padding: 1rem 1.2rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-xs);
}
.bhatta-banner-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.98rem; font-weight: 800; margin-bottom: 5px;
}
.bhatta-banner-chips {
  display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
}
.bhatta-chip {
  background: var(--surface-3); padding: 2px 9px;
  border-radius: 12px; font-size: 0.65rem; font-weight: 600;
  color: var(--ink-3); display: flex; align-items: center;
  gap: 0.25rem; border: 1px solid var(--border);
  font-family: 'Outfit', sans-serif;
}
.bhatta-chip.mono-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem; color: var(--primary);
}

/* ── Status pills ── */
.status-pill {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 800; padding: 0.2rem 0.62rem;
  border-radius: 999px; text-transform: uppercase;
  letter-spacing: 0.4px; display: inline-block; white-space: nowrap;
}
.status-pill.paid,    .status-pill.ps-paid    { background: var(--success-dim); color: var(--success); }
.status-pill.partial, .status-pill.ps-partial { background: var(--warn-dim);    color: var(--warn);    }
.status-pill.unpaid,  .status-pill.ps-unpaid  { background: var(--danger-dim);  color: var(--danger);  }

/* ── Risk badges ── */
.risk-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.24rem 0.65rem; border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem; font-weight: 700;
}
.risk-low  { background: var(--success-dim); color: var(--success); }
.risk-mod  { background: var(--warn-dim);    color: var(--warn);    }
.risk-high { background: var(--danger-dim);  color: var(--danger);  }

/* ── Tags ── */
.pg-tag {
  display: inline-block; font-family: 'Outfit', sans-serif;
  font-size: 0.64rem; font-weight: 700; padding: 0.18rem 0.56rem;
  border-radius: 999px; white-space: nowrap;
}
.pg-tag-info    { background: var(--info-dim);    color: var(--info);    }
.pg-tag-success { background: var(--success-dim); color: var(--success); }
.pg-tag-warn    { background: var(--warn-dim);    color: var(--warn);    }
.pg-tag-danger  { background: var(--danger-dim);  color: var(--danger);  }
.pg-tag-muted   { background: var(--surface-3); color: var(--ink-3); border: 1px solid var(--border); }
.pg-tag-gold    { background: #fef3c7; color: #7c2d00; }

/* ── Action icon buttons (32×32) ── */
.pg-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r); font-size: 0.85rem;
  border: 1px solid var(--border); cursor: pointer;
  text-decoration: none; background: transparent;
  transition: all var(--t-fast) var(--ease); color: var(--ink-3);
}
.pg-act-info:hover  { background: var(--info-dim);    border-color: var(--info);    color: var(--info);    }
.pg-act-edit:hover  { background: var(--surface-3);   border-color: var(--border-2); color: var(--ink);   }
.pg-act-del         { color: var(--danger); }
.pg-act-del:hover   { background: var(--danger-dim);  border-color: var(--danger);  color: var(--danger);  }
.pg-act-succ:hover  { background: var(--success-dim); border-color: var(--success); color: var(--success); }
.pg-act-pay         { color: #fff; background: var(--success); border-color: var(--success); }
.pg-act-pay:hover   { background: #145c22; border-color: #145c22; color: #fff; }
.pg-act-paid        { color: var(--success); background: var(--success-dim); border-color: rgba(26,92,42,0.2); }
.pg-act-pdf         { color: var(--danger);  border-color: rgba(139,21,21,0.25); }
.pg-act-pdf:hover   { background: var(--danger-dim);  border-color: var(--danger);  color: var(--danger);  }
.pg-act-dup:hover   { background: var(--surface-3);   border-color: var(--border-2); color: var(--ink-2); }
.pg-act-view        { color: var(--info); border-color: rgba(18,78,115,0.25); }
.pg-act-view:hover  { background: var(--info-dim);    border-color: var(--info);    color: var(--info);    }

/* ── Form cards ── */
.pg-form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--r-lg);
  margin-bottom: 1rem; box-shadow: var(--shadow-md); overflow: hidden;
}
.pg-form-inline { border-radius: 0; box-shadow: none; margin: 0; }
.pg-form-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.78rem 1.15rem; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-family: 'Outfit', sans-serif;
  font-size: 0.86rem; font-weight: 800; color: var(--ink);
}
.pg-form-x {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--r);
  color: var(--ink-3); text-decoration: none; font-size: 0.92rem;
  transition: all var(--t-fast); flex-shrink: 0;
}
.pg-form-x:hover { background: var(--danger-dim); color: var(--danger); }
.pg-form-body { padding: 1.15rem; }
.pg-form-foot {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  padding: 0.78rem 1.15rem; background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.pg-edit-row td { padding: 0 !important; border: none !important; }
.req { color: var(--danger); margin-left: 1px; }

/* ── Grid helpers ── */
.pg-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.pg-grid-1 { display: grid; grid-template-columns: 1fr; gap: 0.8rem; }
.pg-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }
.pg-f  { display: flex; flex-direction: column; }
.pg-f2 { grid-column: span 2; }
.pg-f3 { grid-column: 1 / -1; }
.pg-f label {
  display: block; font-family: 'Outfit', sans-serif;
  font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ink-3); margin-bottom: 0.28rem;
}

/* ── Mobile entity cards ── */
.pg-mob-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 0.65rem;
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-mid);
}
.pg-mob-card:hover { box-shadow: var(--shadow-md); }
.pg-mob-top {
  display: flex; justify-content: space-between;
  align-items: flex-start; padding: 0.9rem 1rem 0.62rem; gap: 0.5rem;
}
.pg-mob-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem; font-weight: 800; line-height: 1.25;
}
.pg-mob-sub  { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.pg-mob-meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem;
  padding: 0.5rem 1rem; border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.pg-mob-meta span {
  display: flex; align-items: center; gap: 0.28rem;
  font-size: 0.74rem; color: var(--ink-2); font-weight: 500;
}
.pg-mob-meta i { color: var(--muted); font-size: 0.7rem; }
.pg-mob-actions {
  display: grid; gap: 0.4rem;
  padding: 0.65rem 1rem; border-top: 1px solid var(--border);
}

/* Mobile action buttons */
.pg-mob-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.58rem 0.5rem; border-radius: var(--r);
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  border: 1.5px solid transparent;
  transition: all var(--t-fast) var(--ease);
  min-height: 42px; width: 100%;
}
.pg-mob-btn:active { opacity: 0.82; transform: scale(0.97); }
.pg-mob-info  { background: var(--info-dim);    color: var(--info);    border-color: rgba(18,78,115,0.18);  }
.pg-mob-edit  { background: var(--surface-2);   color: var(--ink);     border-color: var(--border);         }
.pg-mob-del   { background: var(--danger-dim);  color: var(--danger);  border-color: rgba(139,21,21,0.18);  }
.pg-mob-succ  { background: var(--success-dim); color: var(--success); border-color: rgba(26,92,42,0.18);   }
.pg-mob-warn  { background: var(--warn-dim);    color: var(--warn);    border-color: rgba(122,53,0,0.18);   }
.pg-mob-pay   { background: var(--success);     color: #fff;           border-color: var(--success);        }
.pg-mob-pdf   { background: var(--surface-2);   color: var(--danger);  border-color: rgba(139,21,21,0.18);  }
.pg-mob-view  { background: var(--surface-2);   color: var(--ink);     border-color: var(--border);         }
.pg-mob-paid  { background: var(--success-dim); color: var(--success); border-color: rgba(26,92,42,0.18);   }

/* ── Empty state ── */
.pg-empty {
  text-align: center; padding: 4rem 1.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.pg-empty i {
  font-size: 2.8rem; display: block; margin-bottom: 0.9rem;
  opacity: 0.15; color: var(--primary);
}
.pg-empty p {
  font-family: 'Outfit', sans-serif;
  font-size: 0.92rem; font-weight: 700;
  color: var(--ink-2); margin-bottom: 1.1rem;
}

/* ── Invoice feed ── */
.invoice-feed { list-style: none; padding: 0; margin: 0; }
.inv-feed-item {
  display: flex; align-items: stretch; text-decoration: none;
  color: var(--ink); border-bottom: 1px solid var(--border);
  transition: background var(--t-fast); overflow: hidden;
}
.inv-feed-item:last-child { border-bottom: none; }
.inv-feed-item:hover { background: var(--surface-2); color: var(--ink); }
.inv-feed-bar { width: 3px; flex-shrink: 0; }
.inv-feed-bar.paid    { background: var(--success); }
.inv-feed-bar.partial { background: var(--warn); }
.inv-feed-bar.unpaid  { background: var(--danger); }
.inv-feed-body {
  flex: 1; min-width: 0; display: flex; align-items: center;
  justify-content: space-between; gap: 0.5rem; padding: 0.78rem 1rem;
}
.inv-feed-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; color: var(--muted); display: block;
}
.inv-feed-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 175px; display: block;
}
.inv-feed-meta {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; color: var(--muted); margin-top: 2px;
}
.inv-feed-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem; font-weight: 600; display: block;
}
.inv-feed-cta {
  font-family: 'Outfit', sans-serif;
  font-size: 0.64rem; font-weight: 700; color: var(--success);
  text-decoration: none; display: inline-flex;
  align-items: center; gap: 0.2rem; padding: 2px 8px;
  border-radius: 5px; background: var(--success-dim);
  border: 1px solid rgba(26,92,42,0.18);
  transition: all var(--t-fast); white-space: nowrap;
}
.inv-feed-cta:hover { background: var(--success); color: #fff; }
.inv-feed-cta.done {
  color: var(--muted); background: var(--surface-3);
  border-color: var(--border);
}

/* ── Invoice list stats strip ── */
.il-stats {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 0.65rem; margin-bottom: 1.1rem;
}
.il-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow var(--t-mid), transform var(--t-mid);
}
.il-stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.il-stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.il-stat-total::before  { background: var(--info);    }
.il-stat-billed::before { background: var(--primary); }
.il-stat-due::before    { background: var(--danger);  }
.il-stat-status::before { background: var(--success); }
.il-stat-icon {
  position: absolute; right: 0.85rem; top: 50%;
  transform: translateY(-50%); font-size: 1.9rem;
  opacity: 0.04; pointer-events: none;
}
.il-stat-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.28rem; font-weight: 700;
  line-height: 1.1; margin-bottom: 0.2rem; color: var(--ink);
}
.il-stat-val.plain { font-family: 'Outfit', sans-serif; }
.il-stat-due    .il-stat-val { color: var(--danger);  }
.il-stat-billed .il-stat-val { color: var(--primary); }
.il-stat-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted);
}
.il-stat-pills { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.3rem; }
.il-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 700; padding: 0.17rem 0.5rem; border-radius: 999px;
}
.il-badge--paid    { background: var(--success-dim); color: var(--success); }
.il-badge--partial { background: var(--warn-dim);    color: var(--warn);    }
.il-badge--unpaid  { background: var(--danger-dim);  color: var(--danger);  }

/* Invoice table styles */
.il-inv-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem; font-weight: 600; color: var(--primary); text-decoration: none;
}
.il-inv-num:hover { color: var(--primary-2); text-decoration: underline; }
.il-due-small { font-size: 0.68rem; color: var(--danger); font-weight: 600; margin-top: 2px; }
.il-b2c-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 700; background: var(--surface-3);
  color: var(--ink-3); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px;
}

/* Invoice mobile cards */
.ilm-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-bottom: 0.65rem;
}
.ilm-card.ps-paid    { border-left: 3px solid var(--success); }
.ilm-card.ps-partial { border-left: 3px solid var(--warn);    }
.ilm-card.ps-unpaid  { border-left: 3px solid var(--danger);  }
.ilm-body { padding: 0.92rem 1rem; }
.ilm-top {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 0.5rem; margin-bottom: 0.58rem;
}
.ilm-customer {
  font-family: 'Outfit', sans-serif;
  font-size: 0.97rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ilm-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; color: var(--muted); margin-top: 2px;
}
.ilm-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.08rem; font-weight: 700; line-height: 1.1;
}
.ilm-meta {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.44rem 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); margin-bottom: 0.65rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.74rem; color: var(--ink-2); font-weight: 500;
}
.ilm-due-pill {
  margin-left: auto; font-size: 0.68rem; font-weight: 700;
  color: var(--danger); background: var(--danger-dim);
  border-radius: 999px; padding: 0.14rem 0.55rem;
}

/* ── Invoice view toolbar ── */
.vi-bar {
  position: sticky; top: var(--nav-h); z-index: 100;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0.68rem 1.15rem; display: flex; align-items: center;
  justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.vi-back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.82rem; font-weight: 700; color: var(--ink-2);
  text-decoration: none; padding: 0.42rem 0.8rem;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface-2);
  transition: all var(--t-fast);
}
.vi-back:hover { color: var(--ink); background: var(--surface-3); }
.vi-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.44rem 0.9rem; font-family: 'Outfit', sans-serif;
  font-size: 0.8rem; font-weight: 700;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer;
  text-decoration: none; transition: all var(--t-fast) var(--ease);
  min-height: 36px;
}
.vi-btn:hover     { background: var(--surface-2); color: var(--ink); }
.vi-btn-pdf       { background: var(--danger-dim); color: var(--danger); border-color: rgba(139,21,21,0.25); }
.vi-btn-pdf:hover { background: var(--danger); color: #fff; }
.vi-btn-pay       { background: var(--success); color: #fff; border-color: var(--success); }
.vi-btn-pay:hover { background: #145c22; color: #fff; }
.vi-btn-paid        { background: var(--success-dim); color: var(--success); border-color: rgba(26,92,42,0.25); }
.vi-btn-paid:hover  { background: var(--success); color: #fff; }
.vi-btn-wa          { background: rgba(37,211,102,0.09); color: #14702e; border-color: rgba(37,211,102,0.3); }
.vi-btn-wa:hover    { background: #25d366; color: #fff; }
.vi-btn-print       { background: var(--primary); color: #fff; border-color: var(--primary); }
.vi-btn-print:hover { background: var(--primary-2); color: #fff; }

/* ── Invoice letterhead ── */
.inv-letterhead { border-bottom: 1px solid var(--border); margin-bottom: 1rem; padding-bottom: 1rem; }
.inv-lh-title-wrap { text-align: center; margin-bottom: 0.85rem; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.inv-lh-tax-badge {
  display: inline-block; font-family: 'Outfit', sans-serif;
  font-size: 1rem; font-weight: 800; letter-spacing: 2.5px;
  color: var(--ink); border: 2px solid var(--border-2);
  padding: 0.28rem 1.3rem; border-radius: 5px; text-transform: uppercase;
}
.inv-lh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.inv-lh-section-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--muted); margin-bottom: 0.3rem;
}
.inv-lh-name  {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem; font-weight: 800; margin-bottom: 0.2rem;
}
.inv-lh-addr  { font-size: 0.8rem; color: var(--ink-2); line-height: 1.55; }
.inv-lh-gstin { font-size: 0.8rem; margin-top: 0.24rem; }
.inv-lh-meta  {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.72rem 1rem;
}
.inv-lh-meta-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.28rem 0; border-bottom: 1px solid var(--border);
}
.inv-lh-meta-row:last-of-type { border-bottom: none; }
.inv-lh-meta-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.inv-lh-meta-val   {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem; font-weight: 700;
}
.inv-bill-to { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 0.72rem 1rem; margin-bottom: 1rem; }
.inv-bill-to-label  { font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 0.3rem; font-family: 'Outfit', sans-serif; }
.inv-bill-to-name   { font-family: 'Outfit', sans-serif; font-size: 0.98rem; font-weight: 800; margin-bottom: 0.14rem; }
.inv-bill-to-detail { font-size: 0.8rem; color: var(--ink-2); line-height: 1.55; }
.invoice-badge {
  display: inline-block; background: var(--surface-2);
  border: 1px solid var(--border-2); color: var(--primary);
  padding: 4px 12px; border-radius: 5px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.84rem; letter-spacing: 1.2px;
}

/* ── Create invoice components ── */
.item-mob-card {
  border: 1.5px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.item-mob-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
}
.item-mob-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
}
.item-mob-num {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.2px; color: var(--primary);
}
.item-mob-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.65rem; }
.item-mob-field label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.28rem; display: block;
}
.item-mob-row3 { display: grid; grid-template-columns: 1fr 1fr 80px; gap: 0.55rem; }
.item-mob-totals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.45rem; }
.item-mob-total-pill {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.46rem 0.5rem; text-align: center;
}
.item-mob-total-pill span {
  display: block; font-family: 'Outfit', sans-serif;
  font-size: 0.54rem; font-weight: 800;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}
.item-mob-total-pill strong {
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 700;
}
.item-mob-grand { background: var(--primary-dim); border-color: rgba(139,46,15,0.18); }
.item-mob-grand span { color: var(--primary); }
.item-mob-grand strong { color: var(--primary-2); font-size: 0.88rem; }
#itemsCardsMobile { padding: 0.5rem 0.6rem 0; }
.mob-add-item-wrap { padding: 0.62rem; display: none; }
.mob-add-item-btn {
  width: 100%; padding: 0.75rem; background: transparent;
  border: 1.5px dashed var(--border-2); border-radius: var(--r-lg);
  color: var(--success); font-family: 'Outfit', sans-serif;
  font-weight: 700; font-size: 0.88rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; transition: all var(--t-fast);
}
.mob-add-item-btn:hover {
  background: var(--success-dim); border-color: var(--success); color: var(--success);
}
.gst-toggle-btn {
  display: inline-flex; align-items: center; gap: 0.65rem;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r); padding: 0.55rem 0.85rem; cursor: pointer;
  width: 100%; transition: all var(--t-fast);
  font-family: 'Outfit', sans-serif; min-height: 42px;
}
.gst-toggle-btn:hover { background: var(--surface-3); color: var(--ink); }
.gst-toggle-btn.active { border-color: var(--primary); background: var(--primary-dim); }
.gst-toggle-track {
  width: 36px; height: 20px; min-width: 36px; background: var(--surface-4);
  border-radius: 10px; position: relative; transition: background var(--t-fast);
  flex-shrink: 0; border: 1px solid var(--border-2);
}
.gst-toggle-btn.active .gst-toggle-track { background: var(--primary); border-color: var(--primary); }
.gst-toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: transform var(--t-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.gst-toggle-btn.active .gst-toggle-thumb { transform: translateX(16px); }
.gst-toggle-label {
  font-size: 0.84rem; font-weight: 600; color: var(--ink-2);
  transition: color var(--t-fast);
}
.gst-toggle-btn.active .gst-toggle-label { color: var(--primary); }
.gst-toggle-hint { font-size: 0.7rem; color: var(--muted); padding-left: 0.24rem; line-height: 1.4; }
.gst-toggle-wrap { display: flex; flex-direction: column; gap: 0.35rem; }
.tax-inv-banner {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--primary); border-radius: var(--r);
  padding: 0.85rem 1.1rem; margin-bottom: 1.2rem;
}
.tax-inv-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.94rem; font-weight: 800; color: var(--primary);
  letter-spacing: 1.2px; text-transform: uppercase; white-space: nowrap;
}
.tax-inv-sub { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

/* ── Payments ── */
.pay-banner {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.2rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.pay-banner-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.8rem; margin-bottom: 0.8rem; }
.pay-banner-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--muted); margin-bottom: 0.22rem; font-weight: 800;
}
.pay-banner-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.12rem; font-weight: 700; line-height: 1.1; color: var(--ink);
}
.pay-banner-sub { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.pay-prog-track { background: var(--surface-3); border-radius: 20px; height: 6px; overflow: hidden; }
.pay-prog-fill  { height: 6px; border-radius: 20px; transition: width 0.4s ease; }
.pay-mode-grid  { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.4rem; }
.pay-mode-grid .btn-check + label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem; padding: 0.5rem 0.3rem;
  border-radius: var(--r); font-weight: 600;
}
.pay-hist-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 0.85rem 1rem; margin-bottom: 0.55rem;
}
.pay-hist-amt  {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.06rem; font-weight: 700; color: var(--success);
}
.pay-hist-date { font-size: 0.76rem; color: var(--muted); }

/* ── Coal ITC ── */
.coal-itc-bar { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.65rem; margin-bottom: 1rem; }
.coal-itc-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 0.9rem 1rem;
  text-align: center; box-shadow: var(--shadow-sm);
}
.coal-itc-tile.accent { border-top: 3px solid var(--success); }
.coal-itc-val   {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem; font-weight: 700; color: var(--ink);
}
.coal-itc-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted); margin-top: 3px;
}

/* ── PWA prompt ── */
.pwa-prompt {
  position: fixed; bottom: calc(var(--bnav-h) + 10px);
  left: 0.75rem; right: 0.75rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 0.9rem 1rem; display: flex; align-items: center; gap: 0.75rem;
  box-shadow: var(--shadow-md); z-index: 1030; font-size: 0.82rem;
  animation: slideUp 0.3s var(--ease-spring);
}
.pwa-prompt.hidden { display: none; }
@keyframes slideUp {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.pwa-prompt .pp-text { flex: 1; min-width: 0; }
.pwa-prompt strong { display: block; font-size: 0.84rem; margin-bottom: 2px; font-weight: 700; }
.pwa-prompt span   { display: block; color: var(--muted); font-size: 0.7rem; line-height: 1.4; }

/* ── DASHBOARD ───────────────────────────────────────────────── */

.dash-greeting {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.3rem;
  padding: 1.1rem 1.3rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.dash-greeting-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.12rem; font-weight: 800; color: var(--ink);
  line-height: 1.2;
}
.dash-greeting-sub  { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }
.dash-gstin {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem; color: var(--primary);
}
.dash-date-badge { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.dash-date-num  {
  font-family: 'Outfit', sans-serif;
  font-size: 2.4rem; font-weight: 900; color: var(--primary);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.dash-date-my   {
  font-family: 'Outfit', sans-serif;
  font-size: 0.76rem; font-weight: 700; color: var(--ink-2); line-height: 1.3;
}
.dash-date-dow  { font-size: 0.68rem; color: var(--muted); }

/* KPI cards */
.dash-kpi-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem; margin-bottom: 1.1rem;
}
.dash-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.1rem;
  display: flex; align-items: flex-start; gap: 0.9rem;
  box-shadow: var(--shadow-sm); border-top-width: 3px;
  transition: box-shadow var(--t-mid) var(--ease),
              transform var(--t-mid) var(--ease);
}
.dash-kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dash-kpi-primary { border-top-color: var(--primary); }
.dash-kpi-danger  { border-top-color: var(--danger);  }
.dash-kpi-success { border-top-color: var(--success); }
.dash-kpi-info    { border-top-color: var(--info);    }
.dash-kpi-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.12rem;
}
.dash-kpi-primary .dash-kpi-icon { background: var(--primary-dim); color: var(--primary); }
.dash-kpi-danger  .dash-kpi-icon { background: var(--danger-dim);  color: var(--danger);  }
.dash-kpi-success .dash-kpi-icon { background: var(--success-dim); color: var(--success); }
.dash-kpi-info    .dash-kpi-icon { background: var(--info-dim);    color: var(--info);    }
.dash-kpi-body { min-width: 0; flex: 1; }
.dash-kpi-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.42rem; font-weight: 700; color: var(--ink); line-height: 1.1;
}
.dash-kpi-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted); margin-top: 4px;
}
.dash-kpi-trend {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem; font-weight: 600; margin-top: 4px;
  display: flex; align-items: center; gap: 1px;
}
.dash-kpi-trend.up      { color: var(--success); }
.dash-kpi-trend.down    { color: var(--danger);  }
.dash-kpi-trend.neutral { color: var(--muted);   }

/* Bar chart */
.dash-chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 140px; padding-bottom: 24px; position: relative;
}
.dash-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.dash-chart-val {
  font-family: 'Outfit', sans-serif;
  font-size: 0.58rem; font-weight: 700; color: var(--muted);
  text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  width: 100%; line-height: 1.2; flex-shrink: 0;
}
.dash-chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.dash-chart-bar {
  width: 100%; border-radius: 5px 5px 0 0;
  background: var(--surface-4); min-height: 4px;
  transition: background var(--t-mid),
              height var(--t-slow) var(--ease);
}
.dash-chart-bar.current { background: var(--primary); }
.dash-chart-bar:hover   { opacity: 0.75; }
.dash-chart-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.64rem; font-weight: 600; color: var(--muted); flex-shrink: 0;
}
.dash-chart-label.current { color: var(--primary); font-weight: 800; }

/* Collection ring */
.dash-collection { display: flex; align-items: center; gap: 2rem; }
.dash-rate-wrap { flex-shrink: 0; }
.dash-rate-circle { position: relative; width: 100px; height: 100px; }
.dash-rate-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dash-rate-bg   { fill: none; stroke: var(--surface-3); stroke-width: 3; }
.dash-rate-fill {
  fill: none; stroke: var(--primary); stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.7s var(--ease);
}
.dash-rate-inner {
  position: absolute; inset: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
}
.dash-rate-pct {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem; font-weight: 900; color: var(--ink); line-height: 1;
}
.dash-rate-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 0.56rem; font-weight: 800; text-transform: uppercase;
  color: var(--muted); letter-spacing: 0.5px;
}
.dash-cb-list  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.78rem; }
.dash-cb-row   { display: flex; align-items: center; gap: 0.6rem; }
.dash-cb-dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dash-cb-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem; font-weight: 600; color: var(--ink-2); width: 52px; flex-shrink: 0;
}
.dash-cb-bar-wrap { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.dash-cb-bar { height: 6px; border-radius: 3px; transition: width 0.5s var(--ease); min-width: 2px; }
.dash-cb-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem; font-weight: 700; color: var(--ink-2);
  min-width: 24px; text-align: right; flex-shrink: 0;
}

/* Quick actions */
.dash-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.62rem; }
.dash-action {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.45rem; padding: 0.95rem 0.5rem;
  border-radius: var(--r-lg); text-decoration: none;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--ink-2);
  font-family: 'Outfit', sans-serif; font-size: 0.76rem; font-weight: 700;
  transition: all var(--t-mid) var(--ease); text-align: center;
}
.dash-action i { font-size: 1.35rem; }
.dash-action:hover {
  background: var(--surface-2); border-color: var(--border-2);
  color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.dash-action.primary {
  background: var(--primary); color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px var(--primary-glow);
}
.dash-action.primary:hover {
  background: var(--primary-2); transform: translateY(-2px);
  box-shadow: 0 5px 16px var(--primary-glow); color: #fff;
}

/* Mini stat tiles */
.dash-mini-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.65rem; }
.dash-mini-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 0.9rem 0.8rem;
  text-align: center; text-decoration: none;
  color: var(--ink); box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-mid), transform var(--t-mid);
}
.dash-mini-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--ink); }
.dash-mini-tile i { font-size: 1.15rem; color: var(--primary); display: block; margin-bottom: 0.32rem; }
.dash-mini-tile.danger i { color: var(--danger); }
.dash-mini-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.22rem; font-weight: 800; line-height: 1;
}
.dash-mini-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.6rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin-top: 3px;
}

/* Recent payments feed */
.dash-pay-row {
  display: flex; align-items: center; gap: 0.78rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.dash-pay-row:last-child { border-bottom: none; }
.dash-pay-row:hover { background: var(--surface-2); color: var(--ink); }
.dash-pay-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 8px;
  background: var(--success-dim); color: var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 0.88rem;
}
.dash-pay-info { flex: 1; min-width: 0; }
.dash-pay-name {
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-pay-meta { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }
.dash-pay-amt  {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem; font-weight: 700; color: var(--success); flex-shrink: 0;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (min-width: 768px) {
  .sidebar { transform: translateX(0) !important; box-shadow: none; }
  .sidebar-backdrop, .sidebar-toggle, .bottom-nav, .mob-add-item-wrap { display: none !important; }
  .page-wrap {
    margin-left: var(--sidebar-w);
    padding: 1.75rem 2.25rem 2.5rem;
    max-width: 1400px;
  }
  .flash-wrap { left: auto; right: 16px; min-width: 290px; max-width: 400px; }
  .pwa-prompt { bottom: 1.5rem; left: auto; right: 1.5rem; max-width: 350px; }
  .role-pill, .user-chip .uname { display: block; }
  #summaryCard { position: sticky; top: calc(var(--nav-h) + 1rem); }
}
@media (max-width: 991px) {
  .dash-kpi-row { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 767px) {
  html { font-size: 15px; }
  .sidebar-toggle { display: flex !important; }
  .sidebar.open { transform: translateX(0) !important; }
  .bottom-nav { display: block !important; }
  .mob-add-item-wrap { display: block; }
  .stat-card h2 { font-size: 1.32rem; }
  .stat-card { min-height: 82px; padding: 0.88rem; }
  .table th, .table td { padding: 0.55rem 0.75rem; font-size: 0.875rem; }
  .card-header { padding: 0.65rem 0.95rem; font-size: 0.8rem; }
  .page-header h4 { font-size: 1rem; }
  .pg-grid, .pg-grid-3 { grid-template-columns: 1fr 1fr; }
  .pg-f2 { grid-column: span 2; } .pg-f3 { grid-column: span 2; }
  .il-stats { grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.9rem; }
  .il-stat-status { grid-column: span 2; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
  .il-stat-status .il-stat-pills { margin-bottom: 0; flex: 1; }
  .il-stat-status .il-stat-label { order: -1; flex-shrink: 0; }
  .il-stat-status .il-stat-icon  { display: none; }
  .il-stat { padding: 0.75rem 0.88rem 0.7rem; } .il-stat-val { font-size: 1.02rem; }
  .pay-banner-grid { grid-template-columns: 1fr 1fr; }
  .coal-itc-bar { grid-template-columns: 1fr 1fr; }
  .tax-inv-banner { padding: 0.68rem 0.9rem; gap: 0.55rem; }
  .item-mob-row3 { grid-template-columns: 1fr 1fr; }
  .item-mob-row3 .item-mob-field:last-child { grid-column: 1 / -1; }
  .inv-lh-grid { grid-template-columns: 1fr; }
  .dash-greeting { padding: 0.9rem 1rem; }
  .dash-greeting-name { font-size: 1rem; }
  .dash-date-num { font-size: 2rem; }
  .dash-kpi-row { grid-template-columns: repeat(2,1fr); gap: 0.55rem; }
  .dash-kpi { padding: 0.88rem 0.9rem; gap: 0.65rem; }
  .dash-kpi-value { font-size: 1.28rem; }
  .dash-kpi-icon { width: 36px; height: 36px; font-size: 0.95rem; }
  .dash-actions { grid-template-columns: repeat(4,1fr); gap: 0.45rem; }
  .dash-action { padding: 0.78rem 0.3rem; font-size: 0.68rem; }
  .dash-action i { font-size: 1.18rem; }
  .dash-chart { height: 110px; }
  .dash-chart-val { display: none; }
  .dash-collection { gap: 1.2rem; }
  .dash-rate-circle { width: 84px; height: 84px; }
  .dash-rate-pct { font-size: 1.12rem; }
}
@media (max-width: 480px) {
  .pg-grid, .pg-grid-3 { grid-template-columns: 1fr; }
  .pg-f2, .pg-f3 { grid-column: span 1; }
  .il-stats { gap: 0.4rem; }
  .il-stat { padding: 0.65rem 0.7rem 0.6rem; } .il-stat-val { font-size: 0.92rem; }
  .dash-kpi-row { gap: 0.45rem; }
  .dash-kpi { padding: 0.78rem; }
  .dash-kpi-value { font-size: 1.1rem; }
  .dash-mini-row { grid-template-columns: repeat(3,1fr); }
  .dash-actions { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 400px) {
  .page-wrap { padding: 0.9rem 0.8rem calc(var(--bnav-h) + 0.9rem); }
  .bnav-item span { font-size: 0.48rem; }
  .qa-grid { grid-template-columns: 1fr; }
}
@media print {
  body { background: white; color: black; padding: 0; }
  .topbar, .sidebar, .bottom-nav, .no-print, .flash-wrap,
  .pwa-prompt, .sidebar-backdrop, .page-header { display: none !important; }
  .page-wrap { margin-left: 0 !important; padding: 0 !important; }
  .card, .stat-card { border: 1px solid #ddd !important; box-shadow: none !important; background: white !important; }
  .vi-bar, .vi-screen { display: none !important; }
}

/* ── UTILITY ─────────────────────────────────────────────────── */
.mono-text { font-family: 'JetBrains Mono', monospace; }
.outfit    { font-family: 'Outfit', sans-serif; }


/* ── MICRO-INTERACTIONS & POLISH ─────────────────────────────── */

/* Page entry animation */
.page-wrap > * {
  animation: fadeUp 0.22s var(--ease) both;
}
.page-wrap > *:nth-child(2) { animation-delay: 0.04s; }
.page-wrap > *:nth-child(3) { animation-delay: 0.08s; }
.page-wrap > *:nth-child(4) { animation-delay: 0.1s;  }

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

/* Card hover lift — consistent across all card types */
.card, .stat-card, .il-stat, .dash-kpi, .dash-mini-tile,
.pg-mob-card, .ilm-card, .item-mob-card {
  will-change: transform;
}

/* Table row hover — smooth */
.table-hover > tbody > tr:hover > * {
  transition: background var(--t-fast);
}

/* Focus-visible ring — accessible */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Number display: use tnum for alignment */
.table td:not(:first-child) { font-variant-numeric: tabular-nums; }

/* Better form focus states */
.form-control:focus, .form-select:focus {
  transform: none;
}

/* Input group refinement */
.input-group .form-control,
.input-group .form-select {
  border-radius: var(--r) !important;
}
.input-group .input-group-text:first-child {
  border-radius: var(--r) 0 0 var(--r) !important;
}
.input-group .form-control:not(:first-child),
.input-group .form-select:not(:first-child) {
  border-left: none;
  border-radius: 0 var(--r) var(--r) 0 !important;
}

/* Divider with label */
.divider-label {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--muted); margin: 1rem 0;
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Search bar styling */
.search-bar {
  position: relative;
}
.search-bar i {
  position: absolute; left: 0.75rem; top: 50%;
  transform: translateY(-50%); color: var(--muted);
  font-size: 0.88rem; pointer-events: none;
  z-index: 2;
}
.search-bar .form-control {
  padding-left: 2.2rem;
}

/* Section heading in pages */
.sec-head {
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); margin-bottom: 0.6rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.sec-head::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Amount display — rupee numbers get special treatment */
.amt-rupee {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

/* Topbar brand glow on hover */
.topbar-brand:hover .brand-icon-wrap {
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: box-shadow var(--t-mid);
}

/* Better card headers */
.card-header {
  letter-spacing: 0.1px;
}

/* Page header title with subtle underline */
.page-header {
  position: relative;
}

/* Sidebar active item — left accent bar */
.sidebar-links a.active {
  position: relative;
}
.sidebar-links a.active::before {
  content: '';
  position: absolute; left: -0.5rem; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; min-height: 18px;
  background: var(--primary); border-radius: 2px;
}

/* Bottom nav active indicator — refined */
.bnav-item.active::before {
  background: var(--primary);
  box-shadow: 0 0 6px rgba(139,46,15,0.4);
}

/* Mobile card actions hover */
.pg-mob-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

/* Alert refinements */
.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(26,92,42,0.2); }
.alert-danger  { background: var(--danger-dim);  color: var(--danger);  border: 1px solid rgba(139,21,21,0.2); }
.alert-warning { background: var(--warn-dim);    color: var(--warn);    border: 1px solid rgba(122,53,0,0.2);  }
.alert-info    { background: var(--info-dim);    color: var(--info);    border: 1px solid rgba(18,78,115,0.2); }

/* Table number column alignment */
.text-end { font-variant-numeric: tabular-nums; }

/* Smooth loading for the whole page */
html {
  -webkit-text-size-adjust: 100%;
}
