:root {
    --brand-navy: #1e3a5f;
    --brand-primary: #2563eb;
    --brand-primary-hover: #1d4ed8;
    --topbar-bg: #152238;
    --topbar-fg: #f1f5f9;
    --topbar-muted: #cbd5e1;
    --bg: #0c1222;
    --bg2: #111827;
    --card: rgba(21, 32, 51, 0.96);
    --card2: #151f33;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #059669;
    --accent2: #3b82f6;
    --border: rgba(148,163,184,.18);
    --danger: #dc2626;
    --success: #059669;
    --success-fg: #6ee7b7;
    --warning: #d97706;
    --warning-fg: #fcd34d;
    --info: #2563eb;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.35);
    --shadow: 0 16px 40px rgba(0,0,0,.28);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
    --tally-panel-bg: rgba(15, 23, 42, 0.45);
    --tally-panel-border: rgba(56, 189, 248, 0.22);
    --tally-status-bg: rgba(255, 255, 255, 0.06);
    --tally-status-fg: var(--text);
    --tally-hint-bg: rgba(245, 158, 11, 0.14);
    --tally-hint-fg: #fde68a;
    --tally-hint-border: rgba(245, 158, 11, 0.45);
    --tally-token-bg: rgba(15, 23, 42, 0.55);
    --tally-token-fg: #f8fafc;
    --tally-token-border: rgba(148, 163, 184, 0.45);
    --tally-pill-check-bg: rgba(148, 163, 184, 0.18);
    --tally-pill-check-fg: #e2e8f0;
    --tally-pill-ready-bg: rgba(34, 197, 94, 0.18);
    --tally-pill-ready-fg: #bbf7d0;
    --tally-pill-warn-bg: rgba(245, 158, 11, 0.18);
    --tally-pill-warn-fg: #fde68a;
    --tally-pill-offline-bg: rgba(239, 68, 68, 0.16);
    --tally-pill-offline-fg: #fecaca;
  }
  html[data-theme="light"] {
    --topbar-bg: #1e3a5f;
    --topbar-fg: #f8fafc;
    --topbar-muted: #cbd5e1;
    --bg: #e4eaf3;
    --bg2: #eef2f8;
    --card: #ffffff;
    --card2: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #047857;
    --accent2: #1d4ed8;
    --brand-primary: #1d4ed8;
    --border: rgba(30, 58, 95, 0.12);
    --danger: #b91c1c;
    --success: #047857;
    --success-fg: #065f46;
    --warning: #b45309;
    --warning-fg: #92400e;
    --info: #1d4ed8;
    --focus-ring: 0 0 0 3px rgba(29, 78, 216, 0.28);
    --shadow-sm: 0 2px 10px rgba(30, 58, 95, 0.06);
    --shadow: 0 12px 32px rgba(30, 58, 95, 0.08);
    --tally-panel-bg: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    --tally-panel-border: rgba(2, 132, 199, 0.28);
    --tally-status-bg: #ffffff;
    --tally-status-fg: #1e293b;
    --tally-hint-bg: #fffbeb;
    --tally-hint-fg: #78350f;
    --tally-hint-border: rgba(217, 119, 6, 0.35);
    --tally-token-bg: #ffffff;
    --tally-token-fg: #0f172a;
    --tally-token-border: #cbd5e1;
    --tally-pill-check-bg: #e2e8f0;
    --tally-pill-check-fg: #334155;
    --tally-pill-ready-bg: #dcfce7;
    --tally-pill-ready-fg: #14532d;
    --tally-pill-warn-bg: #fef3c7;
    --tally-pill-warn-fg: #92400e;
    --tally-pill-offline-bg: #fee2e2;
    --tally-pill-offline-fg: #991b1b;
  }
  * { box-sizing: border-box; }
  html {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  html::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  body {
    margin: 0;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background:
      radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.07), transparent 42%),
      radial-gradient(circle at 88% 100%, rgba(30, 58, 95, 0.06), transparent 40%),
      linear-gradient(180deg, var(--bg2), var(--bg));
    color: var(--text);
    overflow-x: hidden;
  }
  .topbar-stack {
    position: sticky;
    top: 0;
    z-index: 1100;
    width: 100%;
  }
  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
    position: relative;
    z-index: 1;
  }
  body.has-dev-plan-toggle .topbar {
    border-bottom: none;
  }
  .mobile-menu-btn {
    display: none;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.06);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
    transition: transform .2s ease, opacity .2s ease;
  }
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }
  .mobile-menu-icon::before { top: -6px; }
  .mobile-menu-icon::after { top: 6px; }
  body.sidebar-open .mobile-menu-icon { background: transparent; }
  body.sidebar-open .mobile-menu-icon::before { top: 0; transform: rotate(45deg); }
  body.sidebar-open .mobile-menu-icon::after { top: 0; transform: rotate(-45deg); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1040;
    backdrop-filter: blur(2px);
  }
  body.sidebar-open .sidebar-overlay { display: block; }

  /* Mobile sidebar header + close */
  .sidebar-mobile-header {
    display: none;
  }
  .sidebar-close-btn {
    display: none;
  }

  /* Capacitor / native app safe areas */
  html.capacitor-native .topbar {
    padding-top: max(14px, env(safe-area-inset-top));
  }
  html.capacitor-native .page {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
/* Add to CSS */
.toast-success {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--success, #047857);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm, 8px);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-sm, 0 4px 12px rgba(0,0,0,0.15));
  z-index: 9999;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

  html[data-theme="light"] .topbar {
    background: var(--topbar-bg);
    color: var(--topbar-fg);
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  html[data-theme="light"] .topbar .clock-box,
  html[data-theme="light"] .topbar .clock-box strong,
  html[data-theme="light"] .topbar .brand-title-sub {
    color: var(--topbar-muted);
  }
  html[data-theme="light"] .topbar .clock-box strong { color: var(--topbar-fg); }
  /* Topbar light theme mein bhi dark hai, is liye gradient wordmark bana rehta hai. */
  html[data-theme="light"] .topbar .brand-title-main,
  html[data-theme="light"] .topbar .ao-wordmark {
    background: none;
    -webkit-text-fill-color: unset;
    color: #f8fafc;
  }
  html[data-theme="light"] .topbar .eyebrow { color: #93c5fd; }
  .brand-wrap { display: flex; align-items: center; gap: 12px; }
  .brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
    background: transparent;
  }
  .brand-mark-img,
  .brand-mark-svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
  }
  .brand-mark-svg { box-shadow: 0 2px 8px rgba(37, 99, 235, .35); border-radius: inherit; }
  .eyebrow {
    margin: 0;
    font-size: 11px;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: .1em;
  }
  h1 { margin: 2px 0 0; font-size: 20px; }
  /* "AO" do-akshar ka wordmark hai — monogram ke liye positive tracking chahiye,
     aur gradient dono theme ke dark topbar par padhne layak rehta hai. */
  .brand-title-main {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #f8fafc;
  }
  .ao-wordmark {
    display: block;
    margin: 0;
    font-family: "Playfair Display", Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: #f7f4ee;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    white-space: nowrap;
  }
  .ao-w-orbit { color: #c9a36a; }
  .brand-title-sub,
  .ao-tagline {
    margin: 2px 0 0;
    font-size: 12px;
    color: #93c5fd;
    font-weight: 600;
    letter-spacing: .02em;
  }
  .ao-hero-logo {
    display: block;
    width: min(220px, 72vw);
    height: auto;
    margin: 0 auto 8px;
    border-radius: 24px;
  }
  .ao-dialog-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
  }
  .topbar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
    flex-shrink: 0;
  }
  .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .topbar-toolbar .topbar-clock {
    flex-shrink: 0;
    text-align: right;
    line-height: 1.15;
    white-space: nowrap;
    order: 1;
  }
  .topbar-toolbar .voice-btn { order: 2; }
  .topbar-toolbar .top-actions { order: 3; }
  .topbar-more-btn {
    display: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.06);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    align-items: center;
    justify-content: center;
  }
  .brand-text { min-width: 0; }
  .topbar .clock-box { display: flex; flex-direction: column; font-size: 11px; color: var(--topbar-muted, var(--muted)); }
  .topbar .clock-box strong { font-size: 16px; color: var(--topbar-fg, var(--text)); }
  .clock-box { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
  .clock-box strong { font-size: 16px; color: var(--text); }
  .theme-btn, button {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    color: #fff;
    background: var(--brand-primary);
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s, filter 0.15s;
  }
  .theme-btn:hover { filter: brightness(1.06); }
  .theme-btn.voice-btn { min-width: 110px; }
  .theme-btn--success { background: #047857; border-color: rgba(255,255,255,0.12); }
  .theme-btn--secondary {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.22);
    color: #f8fafc;
  }
  .theme-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
  }
  .theme-btn--ai {
    background: #1e40af;
    border-color: rgba(255, 255, 255, 0.18);
  }
  .theme-btn--ai:hover { background: #1d4ed8; }
  .theme-btn--danger {
    background: #b91c1c;
    border-color: rgba(255, 255, 255, 0.15);
  }
  #themeToggle { background: rgba(255, 255, 255, 0.1); border-color: rgba(255,255,255,0.2); color: #e2e8f0; }
  .page {
    max-width: 1250px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .hero {
    display: none !important;
  }
  .hero-copy, .hero-stats, .sidebar, .panel-area, .mini-card {
    box-shadow: var(--shadow);
  }
  .hero-copy, .hero-stats, .sidebar, .panel-area {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    backdrop-filter: blur(14px);
  }
  .hero-copy h2 { margin: 6px 0 8px; font-size: 22px; line-height: 1.35; }
  .hero-copy p { color: var(--muted); margin: 0; line-height: 1.6; }
  .hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
  .hero-badges span {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    background: rgba(255,255,255,.03);
  }
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .stat-card {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
  }
  .stat-card span { font-size: 11px; color: var(--muted); }
  .stat-card strong { display: block; margin-top: 6px; font-size: 20px; }
  .dashboard-layout {
    display: grid;
    grid-template-columns: minmax(220px, 252px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    width: 100%;
  }
  .sidebar {
    position: sticky;
    top: 12px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 24px);
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    overflow: hidden;
  }
  .sidebar-nav-scroll {
    flex: 1 1 auto;
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 220px);
    padding-right: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar-nav-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  .beta-tag {
    font-size: 9px;
    padding: 2px 5px;
    margin-left: 4px;
    border-radius: 4px;
    background: rgba(245,158,11,.2);
    color: #fbbf24;
    vertical-align: middle;
    letter-spacing: .04em;
  }
  .live-notice-banner {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(56,189,248,.35);
    background: rgba(56,189,248,.1);
    font-size: 13px;
    color: var(--text);
  }
  .nav-group-label {
    margin: 0 0 6px 4px;
    font-size: 10px;
    letter-spacing: .14em;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 700;
  }
  .nav-accordion {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, .02);
    overflow: hidden;
  }
  .nav-accordion-summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background .15s;
  }
  .nav-accordion-summary::-webkit-details-marker { display: none; }
  .nav-accordion-summary::marker { content: ""; }
  .nav-accordion-summary:hover {
    background: rgba(255, 255, 255, .04);
  }
  .nav-accordion-summary::after {
    content: "▾";
    font-size: 13px;
    color: var(--muted);
    transition: transform .2s ease;
    flex-shrink: 0;
    margin-left: 8px;
  }
  .nav-accordion:not([open]) .nav-accordion-summary::after {
    transform: rotate(-90deg);
  }
  .nav-accordion[open] .nav-accordion-summary {
    border-bottom: 1px solid var(--border);
    color: var(--accent2);
  }
  .nav-accordion-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 6px 8px;
  }
  .sidebar-label {
    margin: 0 0 10px;
    font-size: 11px;
    letter-spacing: .12em;
    color: var(--muted);
    text-transform: uppercase;
  }
  .tab-list { display: flex; flex-direction: column; gap: 7px; }
  .tab-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--text);
    border: 1px solid transparent;
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
    transition: background .15s, border-color .15s;
  }
  .tab-btn:hover {
    background: rgba(255,255,255,.04);
    border-color: var(--border);
  }
  .tab-btn.active {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--accent2);
    font-weight: 600;
  }
  html[data-theme="light"] .tab-btn.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
  }
  .sidebar-install-btn {
    background: rgba(4, 120, 87, 0.14) !important;
    border-color: rgba(4, 120, 87, 0.35) !important;
    color: #34d399 !important;
  }
  html[data-theme="light"] .sidebar-install-btn {
    background: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #047857 !important;
  }
  .sidebar-tally-card {
    flex: 0 1 auto;
    max-height: 38vh;
    overflow-y: auto;
    border: 1px solid var(--tally-panel-border, var(--border));
    border-radius: 12px;
    background: var(--tally-panel-bg, rgba(0,0,0,.15));
    font-size: 12px;
    scrollbar-width: thin;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  .sidebar-tally-card:not([open]) {
    max-height: none;
    overflow: visible;
  }
  .sidebar-tally-card summary {
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    list-style: none;
  }
  .sidebar-tally-card[open] summary {
    color: var(--accent2, #0284c7);
    border-bottom: 1px solid var(--tally-panel-border, var(--border));
  }
  .sidebar-tally-card summary::-webkit-details-marker { display: none; }
  .sidebar-tally-body { padding: 0 12px 12px; }
  .sidebar-tally-body .tally-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
  }
  .sidebar-tally-body .tally-actions-stack > * {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .sidebar-tally-body .tally-dl-link + .tally-dl-link,
  .sidebar-tally-body .tally-dl-link + .tally-connect-btn,
  .sidebar-tally-body .tally-connect-btn + .tally-test-http-btn {
    margin-top: 10px;
  }
  .tally-dl-link {
    display: block;
    text-align: center;
    background: #3b82f6;
    color: #fff;
    padding: 9px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    line-height: 1.35;
  }
  .tally-token-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
    margin-top: 6px;
  }
  .tally-token-label {
    display: block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
  }
  .tally-token-input {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
    color: var(--tally-token-fg);
    background: var(--tally-token-bg);
    border: 1px solid var(--tally-token-border);
    padding: 8px 10px;
    border-radius: 8px;
  }
  .tally-token-input::placeholder { color: var(--muted); opacity: 0.85; }
  .tally-token-input.tally-token-error {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.55);
    background: rgba(127, 29, 29, 0.25);
  }
  .tally-token-hint {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--muted);
  }
  .tally-reload-token-btn {
    margin-top: 8px;
    width: 100%;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card2);
    color: var(--text);
    cursor: pointer;
  }
  .tally-reload-token-btn:hover {
    border-color: var(--accent2);
    background: rgba(56, 189, 248, 0.08);
  }
  .tally-copy-btn, .tally-reset-btn {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
  }
  .tally-copy-btn { background: #22c55e; color: #fff; }
  .tally-reset-btn {
    margin-top: 8px;
    width: 100%;
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.35);
    font-weight: 600;
  }
  html[data-theme="light"] .tally-reset-btn {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
  }
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
  }
  .modal-overlay.hidden { display: none !important; }
  #payrollSlipModal.modal-overlay:not(.hidden) {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }
  #payrollSlipModal .modal-box {
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #payrollSlipModal .modal-box::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  body.role-staff-limited .hero { display: none !important; }
  body.role-staff-limited .sidebar-tally-card { display: none !important; }
  body.role-staff-limited .nav-group-main,
  body.role-staff-limited .nav-group-business,
  body.role-staff-limited .nav-group-accounting { display: none !important; }
  body.role-staff-limited .nav-group-staff { display: block !important; }
  body.role-staff-limited .nav-group-settings .nav-group-label { display: none; }
  .modal-box {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .modal-box::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  .panel-area {
    min-height: 760px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  #bankReconPanel .table-wrap {
    width: 100%;
    max-width: 100%;
  }
  #bankReconPanel .table-wrap td:nth-child(2) {
    max-width: min(380px, 42vw);
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 12px;
  }
  #bankReconPanel .live-notice-banner {
    line-height: 1.45;
  }
  .panel { display: none; }
  .panel.active { display: block; }
  .panel-header {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }
  .panel-header > div:first-child { flex: 1; min-width: 0; }
  .panel-header h3 {
    margin: 4px 0 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
  }
  .panel-header .eyebrow,
  .panel-header .helper-text:first-child {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .overview-grid, .voice-grid, .grid-2, .media-grid {
    display: grid;
    gap: 12px;
  }
  .overview-grid, .voice-grid, .grid-2, .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-card {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
  }
  .mini-card h4 { margin: 0 0 8px; }
  .mini-card p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
  select,
  textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.85);
    color: var(--text);
    outline: none;
    color-scheme: dark;
  }
  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    max-width: 18px;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    flex: 0 0 18px;
    accent-color: var(--brand-primary, #2563eb);
    vertical-align: middle;
  }
  input[type="radio"] {
    border-radius: 50%;
  }
  html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
  html[data-theme="light"] select,
  html[data-theme="light"] textarea {
    background: #fff;
    color-scheme: light;
    border-color: rgba(30, 58, 95, 0.14);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  }
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    border-color: var(--brand-primary);
    box-shadow: var(--focus-ring);
  }
  select {
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% + 2px), calc(100% - 12px) calc(50% + 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 32px;
  }
  select option {
    background: #1e293b;
    color: #f8fafc;
  }
  html[data-theme="light"] select option {
    background: #fff;
    color: #111827;
  }
  textarea { resize: vertical; min-height: 100px; }
  .btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
  }
  button.secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
  }

  /* Close / Cancel — red hover (modals, AI widget, sidebar) */
  .btn-close,
  button.btn-close,
  #liveAiCloseBtn,
  .sidebar-close-btn {
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  }
  .btn-close:hover,
  button.btn-close:hover,
  #liveAiCloseBtn:hover,
  .sidebar-close-btn:hover {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
  }
  .modal-btn.btn-close,
  .modal-btn.btn-cancel.btn-close {
    background: var(--card2);
    color: var(--text);
    border: 1px solid var(--border);
  }
  .modal-btn.btn-close:hover,
  .modal-btn.btn-cancel.btn-close:hover {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
  }
  .helper-text, .status, .result {
    color: var(--muted);
    font-size: 13px;
  }
  .result-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px dashed var(--border);
    background: rgba(255,255,255,.03);
    white-space: pre-line;
  }
  .project-list { display: grid; gap: 10px; margin-top: 10px; }
  .project-card {
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card2);
  }
  .project-card h4 { margin: 0 0 8px; }
  .project-card p { margin: 4px 0; color: var(--muted); }
  .expense-box {
    margin-top: 16px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card2);
  }
  .table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .table-wrap::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  table { width: 100%; border-collapse: collapse; min-width: 520px; }
  th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
  }
  thead { background: rgba(255,255,255,.03); }
  thead th {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }
  html[data-theme="light"] thead {
    background: #f1f5f9;
  }
  html[data-theme="light"] thead th {
    color: #475569;
  }
  .gallery-viewer {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card2);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .gallery-viewer img {
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
    display: block;
  }
  .gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 12px;
  }
  .gallery-thumb-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--card2);
    cursor: pointer;
    aspect-ratio: 1;
  }
  .gallery-thumb-card.active-thumb {
    border-color: var(--accent2);
    box-shadow: 0 0 0 2px rgba(56,189,248,.25);
  }
  .gallery-thumb-card .thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
    border-radius: 0;
  }
  .gallery-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(239,68,68,.95);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
  }
  #galleryPanel .btn-row {
    margin-top: 8px;
  }
  #galleryUploadBtn {
    width: 100%;
    max-width: 100%;
  }

  .thumb {
    width: 120px;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
  }
  .thumb.active-thumb { border-color: var(--accent2); }
  .todo-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 8px;
  }
  .todo-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .todo-list li span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    line-height: 1.45;
    font-size: 14px;
  }
  .todo-list button {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    width: auto;
    min-height: 38px;
  }
  #todoPanel #todoInput {
    margin-bottom: 10px;
  }
  #todoPanel .btn-row button {
    flex: 1 1 calc(50% - 8px);
  }
  .qr-box, .image-preview-box {
    min-height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px dashed var(--border);
    background: rgba(255,255,255,.03);
    padding: 12px;
  }
  #previewImage { display: none; max-width: 100%; border-radius: 12px; }
  .ao-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
  }
  .ao-file-pick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--brand-primary, #2563eb);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
  }
  .media-preview-box {
    margin-top: 15px;
    border: 2px dashed var(--border, #444);
    padding: 10px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
  .search-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 7px;
  }
  .search-list li {
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.03);
  }
  .invoice-total {
    margin-top: 10px;
    font-weight: 700;
    font-size: 15px;
  }
  .del-btn{
  background-color: red;
  }
  
  .calc-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

/* Invoice Blocked State */
.blocked-invoice {
  opacity: 0.35 !important;
  pointer-events: none !important; /* Complete click/touch disable */
  user-select: none !important;
  filter: grayscale(80%); /* Optional: visually greyed out feel ke liye */
  transition: all 0.3s ease;
}
/* ================= THEME-AWARE PROFILE SETTINGS ================= */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;             /* Pure container ki full width lega */
  max-width: 100%;        /* Width limit hata di */
  margin-top: 24px;       /* Upar se gap ke liye */
  margin-bottom: 24px;    /* Niche gap ke liye */
  box-sizing: border-box;  /* Perfect alignment ke liye */
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  color: var(--text);
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.profile-card-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* Grid Layout */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 640px) {
  .profile-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .full-width {
    grid-column: span 2;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted); /* Light Grey text for labels */
}

.form-group label span {
  color: #f87171; /* Red asterisk */
}

/* Theme-aware Inputs (dark/light dono theme me sahi dikhte hain) */
.form-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  background-color: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease-in-out;
}

.form-input::placeholder {
  color: var(--muted);
}

.form-input:focus {
  background-color: var(--card2);
  border-color: #3b82f6; /* Blue Glow */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* Dark Blue Save Button */
.btn-save-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 11px 22px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 20px;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

@media (min-width: 640px) {
  .btn-save-profile {
    width: auto;
  }
}

.btn-save-profile:hover {
  background-color: #1d4ed8;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-save-profile:active {
  transform: translateY(1px);
}
  
  .calc-btn.op { background: var(--accent2); }
  .calc-btn.equal { background: var(--accent); }
  .calc-btn.danger { background: var(--danger); }
  .wide { grid-column: span 4; }
  .media-grid h4, .media-grid h3 { margin-bottom: 8px; }

/* Invoice / form helpers */
.eway-bill-section {
  margin: 12px 0;
  padding: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.eway-bill-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.eway-bill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.eway-bill-row input { flex: 1 1 140px; min-width: 0; }
.eway-distance-input { flex: 0 1 120px !important; }

.acc-mode-section {
  margin-top: 15px;
  padding: 12px;
  background: var(--card2);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px 25px;
  flex-wrap: wrap;
}
.acc-mode-section strong {
  font-size: 14px;
  color: var(--muted);
  flex: 0 0 auto;
}
.acc-mode-section label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}

.panel-search-input {
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}
.sales-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.sales-date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 140px;
}
.sales-date-field input[type="date"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.sales-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.sales-quick-btn.active,
.voucher-quick-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}
.sales-date-filter-label {
  margin: 8px 0 0;
}
.panel-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.panel-pagination-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.report-tab-btn,
.contractor-subtab-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.report-tab-btn.active,
.contractor-subtab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.voice-btn.voice-active {
  background: #16a34a !important;
  color: #fff !important;
  animation: voicePulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.15); }
}

.voice-buffer-hint {
  font-size: 0.85rem;
  color: #16a34a;
  margin-top: 6px;
  min-height: 1.2em;
}

.speak-card-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(59,130,246,.15);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.help-plan-badge {
  display: inline-block;
  margin: 10px 0 0;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.help-plan-badge.pro {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.35);
}
.help-plan-badge.business {
  background: rgba(234, 179, 8, 0.12);
  color: #fde047;
  border-color: rgba(234, 179, 8, 0.35);
}

.manual-card > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.btn-row button,
.theme-btn,
.tab-btn {
  min-height: 42px;
  touch-action: manipulation;
}

button.bk-save-busy,
button.bk-save-btn.bk-save-busy,
button.bk-save-btn[disabled],
.btn-row button.bk-save-busy,
.inv-action-row button.bk-save-busy {
  cursor: not-allowed !important;
  opacity: 0.68 !important;
  pointer-events: none !important;
  filter: grayscale(0.15);
  user-select: none;
}
button.bk-save-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  cursor: not-allowed;
}
button.bk-save-busy {
  position: relative;
}

/* ================================================================== */
/* 🟢 LIVE AI — Accounts Orbit Smart AI Assistant styles (NAYA FEATURE)     */
/* Pasand na aaye to yeh poora block (yahan se "LIVE AI styles END"     */
/* comment tak) delete kar dena — baaki design bilkul pehle jaisa hi    */
/* rahega.                                                              */
/* ================================================================== */
.live-ai-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  backdrop-filter: blur(12px);
}
.live-ai-widget.hidden { display: none; }
.live-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.95), rgba(37, 99, 235, 0.85));
  border-bottom: 1px solid var(--border);
  color: #f8fafc;
}
.live-ai-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.live-ai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.live-ai-dot.listening { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: liveAiPulse 1s infinite; }
@keyframes liveAiPulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.live-ai-header-actions { display: flex; gap: 6px; }
.live-ai-header-actions button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.live-ai-header-actions button:hover { background: var(--border); color: var(--text); }
.live-ai-header-actions #liveAiCloseBtn:hover { background: #ef4444 !important; border-color: #dc2626 !important; color: #fff !important; }
.live-ai-live-btn.active { color: #ef4444; background: rgba(239,68,68,.15); font-weight: 700; }
.live-ai-model-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 6px;
}
.live-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.live-ai-messages::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.live-ai-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}
.live-ai-msg-bot {
  align-self: flex-start;
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
}
.live-ai-msg-user {
  align-self: flex-end;
  background: var(--accent2);
  color: #fff;
}
.live-ai-msg-action {
  align-self: flex-start;
  background: rgba(34,197,94,.12);
  border: 1px dashed var(--accent);
  color: var(--text);
  font-size: 12px;
}
.live-ai-typing { padding: 0 14px 8px; font-size: 12px; color: var(--muted); }
.live-ai-typing.hidden { display: none; }
.live-ai-typing-dots::after {
  content: "";
  animation: liveAiDots 1.2s steps(4, end) infinite;
}
@keyframes liveAiDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
.live-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.live-ai-chip {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.live-ai-chip:hover {
  background: rgba(59, 130, 246, .15);
  border-color: rgba(59, 130, 246, .45);
}
.live-ai-msg-interim {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 14px 8px;
  font-style: italic;
}
.live-ai-input-row {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.live-ai-input-row input {
  flex: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}
.live-ai-mic-btn, .live-ai-send-btn {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  padding: 8px 10px;
  color: #fff;
}
.live-ai-mic-btn { background: var(--card2); border: 1px solid var(--border); color: var(--text); }
.live-ai-mic-btn.listening { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.live-ai-send-btn { background: var(--accent); }
/* 🟢 LIVE AI styles END */

/* ================================================================== */
/* 🟢 KHATA PRO — Tally-style advanced accounting module styles         */
/* ================================================================== */
.khata-subtab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.khata-subtab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.khata-subpanel { display: none; margin-top: 16px; }
.khata-subpanel.active { display: block; }
.contractor-subpanel { display: none; margin-top: 16px; }
.contractor-subpanel.active { display: block; }

.est-subpanel { display: none; margin-top: 8px; }
.est-subpanel.active { display: block; }
.est-subtab-btn.active { font-weight: 700; }
#estimatePanel .est-actions-cell { min-width: 200px; }
.payroll-subpanel { display: none; margin-top: 16px; }
.payroll-subpanel.active { display: block; }
.payroll-subtab-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.payroll-subtab-btn.active {
  background: var(--brand-primary, #2563eb);
  color: #fff;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: var(--shadow-sm);
}
.payroll-summary-bar {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  margin-bottom: 12px;
}
.payroll-no-access {
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
}
.payroll-self-mark.active {
  background: var(--success, #047857) !important;
  color: #fff !important;
  border-color: rgba(4, 120, 87, 0.5) !important;
}
#payrollEmpSub .grid-2,
#payrollAttSub,
#payrollSalSub,
#payrollSetSub {
  overflow: visible;
}
#payrollPanel select,
#payrollPanel .payroll-att-status {
  pointer-events: auto;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
  -webkit-appearance: menulist;
  appearance: auto;
  background-image: none;
  padding-right: 12px;
}
.payroll-link-hint {
  grid-column: 1 / -1;
  margin: -4px 0 0;
}
.payroll-weekly-off-field {
  grid-column: 1 / -1;
}
.payroll-weekly-off-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
}
.payroll-weekly-off-picks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}
.payroll-emp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.meet-quick-btns .theme-btn { min-width: 180px; }
.meet-live-banner {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12), rgba(34, 197, 94, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 14px;
}
.meet-schedule-card { margin-bottom: 4px; }
.meet-invite-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin-top: 12px;
}
.meet-invite-mode label { font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.meet-staff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.meet-staff-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  font-size: 13px;
  cursor: pointer;
}
.meet-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card2);
}
.meet-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.meet-badge {
  font-size: 11px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}
.meet-badge--scheduled { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.meet-badge--ended { background: rgba(148, 163, 184, 0.2); color: #64748b; }
.meet-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.team-meeting-room-modal { z-index: 10050; }
.team-meeting-room-box {
  max-width: 96vw;
  width: 1100px;
  height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.team-meeting-room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.team-meeting-room-header h3 { margin: 0; font-size: 1.05rem; }
.jitsi-meeting-container { flex: 1; min-height: 0; background: #0f172a; }
.team-todo-host select,
.team-todo-host input[type="text"] {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
}
.team-todo-list .team-todo-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.team-todo-item--done { opacity: 0.75; }
.team-todo-main { flex: 1; min-width: 200px; }
.purchase-item-entry .inv-field-item-select {
  min-width: 140px;
  flex: 1 1 160px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 13.5px;
}
.hidden { display: none !important; }
#udharPaymentModal:not(.hidden),
#udharDetailModal:not(.hidden) { display: flex !important; }
.khata-subpanel .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.khata-subpanel input, .khata-subpanel select, .khata-subpanel textarea {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
}
.khata-subpanel textarea { margin-top: 10px; }
.khata-subpanel button#addLedgerBtn,
.khata-subpanel button#addItemBtn,
.khata-subpanel button#saveVoucherBtn {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.khata-badge-debit { color: #22c55e; font-weight: 700; }
.khata-badge-credit { color: #ef4444; font-weight: 700; }
.khata-badge-udhar { color: #f59e0b; font-weight: 700; }
.khata-badge-clear { color: #22c55e; font-weight: 700; }
.khata-badge-neutral { color: var(--muted, #94a3b8); font-weight: 600; }
.khata-badge-return { color: #fbbf24; font-weight: 700; }
.khata-badge-refund { color: #0ea5e9; font-weight: 700; }

.khata-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.khata-pagination-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.khata-page-size {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-weight: 600;
}
.khata-page-indicator {
  padding: 8px 14px;
  font-weight: 700;
}
.khata-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* DEV ONLY — plan UI toggle bar (testing) — permanently off for live */
#devPlanToggleBar,
.dev-plan-toggle,
.bk-plan-test-toggle-wrap,
.ao-plan-test-row {
  display: none !important;
}
.dev-plan-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  font-size: 13px;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
}
.dev-plan-toggle.hidden { display: none; }
.dev-plan-toggle-label {
  font-weight: 700;
  color: #93c5fd;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  white-space: nowrap;
}
.dev-plan-toggle-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.dev-plan-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: #e5e7eb;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.dev-plan-btn:hover { background: rgba(59, 130, 246, 0.35); }
.dev-plan-btn.active {
  background: #3b82f6;
  border-color: #60a5fa;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}
.bk-plan-test-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.bk-plan-test-toggle-wrap.hidden { display: none !important; }
.bk-plan-test-opt {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  user-select: none;
  min-width: 28px;
  text-align: center;
  cursor: pointer;
}
.bk-plan-test-opt.is-active { color: #93c5fd; }
.bk-plan-dev-toggle { width: 44px; height: 24px; }
.bk-plan-dev-toggle .bk-billing-slider::before {
  width: 18px;
  height: 18px;
}
.bk-plan-dev-toggle input:checked + .bk-billing-slider::before {
  transform: translateX(20px);
}
.dev-plan-active-label {
  color: #cbd5e1;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

/* Smart Inventory Tracker */
.inv-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.inv-stat-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.inv-stat-card span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.inv-stat-card strong {
  font-size: 1.15rem;
  color: var(--text);
}
.inv-stat-card.info { border-color: rgba(37, 99, 235, 0.28); background: var(--card2); }
.inv-stat-card.info strong { color: var(--info, #2563eb); }
.inv-stat-card.primary { border-color: rgba(30, 58, 95, 0.35); background: var(--card2); }
.inv-stat-card.primary strong { color: var(--brand-navy, #1e3a5f); }
html:not([data-theme="light"]) .inv-stat-card.primary strong { color: #93c5fd; }
.inv-stat-card.success { border-color: rgba(4, 120, 87, 0.32); background: var(--card2); }
.inv-stat-card.success strong { color: var(--success, #047857); }
.inv-stat-card.warn { border-color: rgba(217, 119, 6, 0.35); background: var(--card2); }
.inv-stat-card.warn strong { color: var(--warning, #d97706); }
.inv-stat-card.danger { border-color: rgba(220, 38, 38, 0.32); background: var(--card2); }
.inv-stat-card.danger strong { color: var(--danger, #dc2626); }

html:not([data-theme="light"]) .inv-stat-card.info strong { color: #60a5fa; }
html:not([data-theme="light"]) .inv-stat-card.success strong { color: #4ade80; }
html:not([data-theme="light"]) .inv-stat-card.warn strong { color: #fbbf24; }
html:not([data-theme="light"]) .inv-stat-card.danger strong { color: #f87171; }

.inv-form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .inv-form-card {
  border-color: rgba(59, 130, 246, 0.22);
  background: #ffffff;
}
.inv-form-card h4 { margin: 0 0 12px; font-size: 1rem; }
.inv-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.inv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.inv-field-span2 { grid-column: 1 / -1; }
.inv-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inv-form-grid input { width: 100%; }

.inv-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.inv-chip-group-compact .inv-chip {
  min-width: 52px;
  padding: 6px 10px;
}
.inv-chip {
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.inv-chip:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.12);
}
.inv-chip.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}
html[data-theme="light"] .inv-chip {
  background: #f8fafc;
  color: #1e293b;
}
html[data-theme="light"] .inv-chip:hover {
  background: #eff6ff;
}
html[data-theme="light"] .inv-chip.active {
  background: #2563eb;
  color: #fff;
}

.inv-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}
.inv-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.inv-table-wrap {
  margin-top: 0;
  max-height: 460px;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.inv-table-wrap::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.inv-table { font-size: 13px; min-width: 980px; }
.inv-table th { white-space: nowrap; position: sticky; top: 0; background: var(--card2); z-index: 1; }
html[data-theme="light"] .inv-table th { background: #f1f5f9; color: #334155; }
.inv-table td:first-child {
  min-width: 160px;
  max-width: 240px;
  word-break: break-word;
  white-space: normal;
}
.inv-table td { vertical-align: middle; }
.inv-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.inv-badge-ok { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.inv-badge-low { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.inv-badge-out { background: rgba(239, 68, 68, 0.2); color: #f87171; }
html[data-theme="light"] .inv-badge-ok { background: rgba(22, 163, 74, 0.12); color: #15803d; }
html[data-theme="light"] .inv-badge-low { background: rgba(217, 119, 6, 0.12); color: #b45309; }
html[data-theme="light"] .inv-badge-out { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.inv-row-low { background: rgba(245, 158, 11, 0.06); }
.inv-row-out { background: rgba(239, 68, 68, 0.06); }
html[data-theme="light"] .inv-row-low { background: rgba(245, 158, 11, 0.08); }
html[data-theme="light"] .inv-row-out { background: rgba(239, 68, 68, 0.06); }
.inv-actions { white-space: nowrap; }
.inv-act-btn {
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  margin-right: 2px;
}
.inv-act-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}
html[data-theme="light"] .inv-act-btn.danger { color: #b91c1c; background: #fef2f2; }
.inv-act-btn:hover { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.45); }
.inv-act-btn.danger:hover { background: rgba(239, 68, 68, 0.35); color: #fff; }

.khata-act-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.khata-act-btn {
  border: 1px solid var(--border);
  background: rgba(37, 99, 235, 0.1);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.khata-act-btn:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.4);
}
html[data-theme="light"] .khata-act-btn {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a5f;
}
html[data-theme="light"] .khata-act-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}
.khata-act-btn.danger {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fecaca;
}
.khata-act-btn.danger:hover {
  background: rgba(239, 68, 68, 0.42);
  border-color: rgba(239, 68, 68, 0.7);
  color: #fff;
}

.subscription-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid rgba(37, 99, 235, 0.25);
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}
html[data-theme="light"] .subscription-banner {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #1e3a5f;
}
.subscription-banner.trial {
  border-color: rgba(4, 120, 87, 0.35);
  background: rgba(4, 120, 87, 0.08);
}
html[data-theme="light"] .subscription-banner.trial {
  background: #ecfdf5;
  border-bottom-color: #a7f3d0;
  color: #065f46;
}
.subscription-banner.expired {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}
.subscription-banner.staff {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.08);
}
html[data-theme="light"] .subscription-banner.staff {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
  color: #1e3a5f;
}
.subscription-banner.hidden { display: none; }
.subscription-banner-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.2);
  color: inherit;
  font-weight: 700;
  cursor: pointer;
}
.subscription-paywall {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.subscription-paywall.hidden { display: none; }
.subscription-paywall-card {
  max-width: 480px;
  width: 100%;
  background: var(--card, #1e293b);
  border: 1px solid var(--border, #334155);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
}
body.staff-mode .owner-only-plan { display: none !important; }

.pay-btn-pro {
  background: var(--success, #047857) !important;
  color: #fff !important;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
.pay-btn-pro:hover { filter: brightness(1.06); }
@media (max-width: 640px) {
  .khata-subpanel .grid-2 { grid-template-columns: 1fr; }
  #khataProSubTabs { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .inv-form-grid { grid-template-columns: 1fr; }
  .inv-field-span2 { grid-column: auto; }
}

/* ==========================================
   Searchable State Dropdown Styling
   ========================================== */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-select-trigger:hover {
  border-color: #3b82f6;
  background: var(--card);
}

.custom-select-trigger .arrow-icon {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.custom-select-wrapper.open .arrow-icon {
  transform: rotate(180deg);
}

.custom-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  z-index: 999;
  overflow: hidden;
}

.custom-select-wrapper.open .custom-select-dropdown {
  display: block;
}

.select-search-box {
  padding: 8px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.select-search-box input {
  width: 100%;
  padding: 8px 12px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.select-search-box input:focus {
  border-color: #3b82f6;
}

.select-options-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.select-options-list::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.select-options-list li {
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.select-options-list li:hover,
.select-options-list li.selected {
  background: #3b82f6;
  color: #ffffff;
}

.select-options-list li.no-result {
  color: var(--muted);
  text-align: center;
  cursor: default;
}
.select-options-list li.no-result:hover {
  background: transparent;
}

.staff-mode-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #86efac;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.staff-mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: staff-pulse 1.5s ease-in-out infinite;
}
@keyframes staff-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
body.staff-mode .hero h2::after {
  content: none;
}

/* Voucher form — India GST Purchase */
.voucher-form-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.voucher-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.voucher-type-select {
  width: 100%;
  margin-bottom: 14px;
}
.voucher-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
}
.voucher-purchase-section {
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(34,197,94,.35);
  background: rgba(34,197,94,.08);
}
.voucher-pay-receipt-section {
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.08);
}
.voucher-adjust-section {
  margin: 12px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(245,158,11,.35);
  background: rgba(245,158,11,.08);
}
.voucher-effect-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.voucher-effect-summary strong { color: var(--text); }
#voucherDnCnItemSection { margin-top: 12px; }
.voucher-journal-section {
  margin-top: 12px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(139,92,246,.35);
  background: rgba(139,92,246,.06);
}
.journal-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
}
.jn-balance-pill {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}
.jn-balance-pill span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.jn-balance-pill strong { font-size: 18px; color: var(--text); }
.jn-dr-pill strong { color: #3b82f6; }
.jn-cr-pill strong { color: #22c55e; }
.jn-balance-status {
  flex: 1 1 180px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
}
.jn-balance-status.balanced {
  background: rgba(34,197,94,.15);
  color: #22c55e;
}
.jn-balance-status.unbalanced {
  background: rgba(239,68,68,.12);
  color: #ef4444;
}
.journal-simple-tip {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(59,130,246,.08);
  border: 1px solid rgba(59,130,246,.2);
}
.journal-dual-entry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 768px) {
  .journal-dual-entry { grid-template-columns: 1fr; }
}
.journal-side {
  padding: 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jn-debit-side {
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.35);
}
.jn-credit-side {
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.35);
}
.journal-side-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.journal-side-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.journal-ledger-select,
.journal-amt-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.journal-side-btn { width: 100%; margin-top: 2px; }
.journal-simple-table { margin-top: 0; }
.voucher-field {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.voucher-field-span2 {
  grid-column: 1 / -1;
}
.voucher-party-grid,
.voucher-stock-grid {
  margin-top: 10px;
}
.voucher-field .inv-party-autocomplete input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

/* Mobile sidebar scroll fix */
body.sidebar-open {
  overflow: hidden;
}
body.sidebar-open .sidebar {
  touch-action: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  max-height: 100dvh;
}
body.sidebar-open .sidebar-nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}
body.sidebar-open .sidebar-tally-card {
  flex-shrink: 0;
}

/* ================================================================== */
/* RESPONSIVE — Phone, Tablet, Desktop                                */
/* ================================================================== */

/* ---- Mobile: tables as cards (readable, no tiny scroll) ---- */
@media (max-width: 768px) {
  .table-wrap.mobile-ready {
    overflow: visible;
    border: none;
    background: transparent;
    margin: 0;
  }
  .table-wrap.mobile-ready::after {
    display: none !important;
  }
  .table-wrap.mobile-ready table {
    min-width: 0 !important;
    width: 100%;
    display: block;
  }
  .table-wrap.mobile-ready thead {
    display: none;
  }
  .table-wrap.mobile-ready tbody {
    display: block;
  }
  .table-wrap.mobile-ready tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card2);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
  }
  .table-wrap.mobile-ready tbody tr:hover {
    background: var(--card2);
  }
  .table-wrap.mobile-ready tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid rgba(148,163,184,.12);
    white-space: normal;
    text-align: right;
    font-size: 13px;
    word-break: break-word;
  }
  .table-wrap.mobile-ready tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }
  .table-wrap.mobile-ready tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: left;
    flex: 0 0 38%;
    max-width: 42%;
    line-height: 1.35;
  }
  .table-wrap.mobile-ready tbody td[colspan] {
    display: block;
    text-align: center;
    padding: 16px 8px;
    border: none;
  }
  .table-wrap.mobile-ready tbody td[colspan]::before {
    display: none;
  }
  .table-wrap.mobile-ready tbody td button,
  .table-wrap.mobile-ready tbody td .del-btn,
  .table-wrap.mobile-ready tbody td .inv-act-btn {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 36px;
    padding: 6px 12px !important;
    font-size: 12px !important;
    margin: 2px;
  }

  .inv-table-wrap.mobile-ready table {
    min-width: 0 !important;
  }

  .gallery-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .gallery-viewer img {
    max-height: 45vh;
  }

  .todo-list li {
    flex-direction: row;
    align-items: center;
  }
  .todo-list button {
    width: auto !important;
    flex: 0 0 auto !important;
  }

  .qr-box {
    min-height: 180px;
    padding: 16px;
  }
  .qr-box canvas,
  .qr-box img {
    max-width: 100% !important;
    height: auto !important;
  }

  #calcPanel .calc-grid {
    gap: 8px;
  }

  .manual-card .card-text p {
    font-size: 13px;
    line-height: 1.55;
  }

  .panel {
    overflow-x: hidden;
  }
  #ledgerPanel {
    overflow: visible;
  }
  #ledgerPanel .table-wrap {
    overflow: visible;
    max-height: none;
  }
  #ledgerPanel table {
    min-width: 0;
  }

  #khataVoucherPanel .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .gallery-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---- Legacy table scroll fallback (desktop only uses normal table) ---- */
@media (max-width: 768px) {
  .table-wrap:not(.mobile-ready) {
    margin-left: -2px;
    margin-right: -2px;
    border-radius: 10px;
  }
  .table-wrap:not(.mobile-ready) table {
    min-width: 560px;
    font-size: 12px;
  }
  .table-wrap:not(.mobile-ready) th,
  .table-wrap:not(.mobile-ready) td {
    padding: 8px 10px;
    vertical-align: middle;
  }
  .table-wrap th {
    font-size: 11px;
    white-space: nowrap;
  }
  /* Table ke andar buttons chhote + side by side */
  .table-wrap button,
  table button,
  table .del-btn,
  .inv-act-btn {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 34px;
    padding: 5px 10px !important;
    font-size: 11px !important;
    display: inline-block;
    margin: 2px;
    white-space: nowrap;
  }
  table td:last-child {
    white-space: nowrap;
  }
  /* Pagination — full width mat lo */
  .khata-pagination .btn-row,
  .panel-pagination-bar .btn-row {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
  }
  .khata-pagination .btn-row button,
  .panel-pagination-bar .btn-row button {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 80px !important;
    padding: 8px 14px !important;
  }
  .khata-page-indicator,
  #salesPageIndicator {
    padding: 6px 10px !important;
    font-size: 13px;
  }
  .table-scroll-hint {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    padding: 6px 8px 2px;
  }
  .table-wrap::after {
    content: "← Table ko side me scroll karein →";
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    padding: 8px 6px 4px;
    border-top: 1px dashed var(--border);
    background: rgba(0,0,0,.12);
  }
}

@media (min-width: 769px) {
  .table-scroll-hint,
  .table-wrap::after { display: none; }
}

/* Large tablet / small laptop */
@media (max-width: 1100px) {
  .top-actions .theme-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* Tablet + phone — drawer sidebar */
@media (max-width: 980px) {
  .mobile-menu-btn { display: inline-flex; }
  .clock-box { display: none; }

  .hero,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-layout {
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    max-height: 100dvh;
    z-index: 1200;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform .28s ease;
    box-shadow: 8px 0 32px rgba(0,0,0,.35);
    padding-top: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    padding: max(14px, env(safe-area-inset-top)) 14px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
  }
  .sidebar-mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .sidebar-mobile-brand strong {
    display: block;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
  }
  .sidebar-mobile-brand .ao-wordmark {
    font-size: 18px;
    color: #0f172a;
  }
  .sidebar-mobile-brand .ao-w-orbit { color: #c9a36a; }
  .sidebar-mobile-brand .ao-tagline {
    margin: 2px 0 0;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: none;
    -webkit-text-fill-color: #64748b;
  }
  .sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: block;
    object-fit: cover;
    flex-shrink: 0;
  }
  .sidebar-close-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card2);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .sidebar-overlay {
    z-index: 1150;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-nav-scroll {
    flex: 1 1 auto;
    min-height: 45vh;
    max-height: none;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding-bottom: 12px;
  }

  .sidebar-tally-card {
    flex: 0 1 auto;
    max-height: 32vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar-tally-card:not([open]) {
    max-height: none;
    overflow: visible;
  }
  .sidebar-tally-card::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .sidebar .tab-btn {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 14px;
    touch-action: manipulation;
  }

  .panel-area {
    min-height: auto;
    width: 100%;
    padding: 12px;
  }

  .live-ai-widget {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
    left: max(16px, env(safe-area-inset-left));
    width: auto;
    height: min(70vh, 520px);
  }
}

/* Small tablet + phone */
@media (max-width: 768px) {
  h1 { font-size: 15px; line-height: 1.2; }
  .brand-title-main { font-size: 21px; letter-spacing: -0.03em; }
  .ao-wordmark { font-size: 20px; }
  .brand-title-sub { font-size: 11px; }
  .hero-copy h2 { font-size: 19px; }
  .brand-wrap .eyebrow { display: none; }

  .clock-box { display: none; }

  .page { padding: 10px; }

  /* Topbar — compact single row + overflow menu */
  .topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    flex-wrap: nowrap;
  }
  .mobile-menu-btn { flex-shrink: 0; }
  .brand-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .brand-wrap h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .brand-mark { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
  .topbar-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
    position: static;
  }
  .topbar-more-btn { display: inline-flex; order: 3; }
  .topbar-toolbar .voice-btn {
    min-width: 0;
    padding: 8px 10px;
    font-size: 11px;
    max-width: 88px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top-actions {
    display: none;
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 10px 12px 12px;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    z-index: 1099;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    max-height: min(70vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  html[data-theme="light"] .top-actions {
    background: rgba(255, 255, 255, 0.98);
  }
  body.topbar-more-open .top-actions {
    display: flex;
  }
  .top-actions .theme-btn,
  .top-actions .staff-mode-banner {
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
  }
  .top-actions .bk-plan-test-toggle-wrap {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    min-height: 44px;
  }
  .top-actions .staff-mode-banner {
    justify-content: center;
  }

  .dev-plan-toggle {
    grid-template-columns: 1fr;
    padding: 8px 10px;
    font-size: 11px;
    gap: 8px;
    text-align: center;
  }
  .dev-plan-toggle-label,
  .dev-plan-active-label {
    text-align: center;
    white-space: normal;
  }
  .dev-plan-toggle-actions {
    justify-content: center;
  }
  .dev-plan-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .staff-mode-banner {
    font-size: 10px;
    padding: 4px 8px;
  }

  .hero-stats,
  .voice-grid,
  .media-grid,
  .inv-form-grid {
    grid-template-columns: 1fr;
  }

  /* Overview KPI cards — 2 column; baaki grids 1 column */
  .overview-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  #overviewPanel > .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

.overview-records-hub {
  margin: 18px 0 20px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card2);
}
.overview-records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.overview-records-totals {
  margin-bottom: 12px;
}
.overview-rec-total-card {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
}
.overview-rec-total-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.overview-rec-total-card strong {
  font-size: 1.05rem;
  color: #38bdf8;
}
.overview-rec-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.overview-rec-tab {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.overview-rec-tab.active {
  background: rgba(56,189,248,.15);
  border-color: rgba(56,189,248,.45);
  color: #7dd3fc;
}
.overview-rec-pane { display: none; }
.overview-rec-pane.active { display: block; }
.overview-rec-pane-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.overview-rec-pane-toolbar .panel-search-input {
  flex: 1;
  min-width: 180px;
  max-width: 100%;
  margin-top: 0;
}
.overview-customer-search {
  margin-top: 8px;
  align-items: center;
}
.overview-customer-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  font-size: 13px;
  line-height: 1.5;
}

  .inv-field-span2 { grid-column: auto; }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }
  .panel-header h3 { font-size: 16px; }
  .panel-search-input {
    max-width: 100%;
    margin-top: 8px;
  }

  /* Form buttons — wrap 2 per row */
  .panel > .btn-row > button,
  .panel .inv-form-card .btn-row > button,
  .panel .expense-box .btn-row > button,
  .expense-box .btn-row > button {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
  }

  .khata-pagination {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .subscription-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
    font-size: 12px;
    gap: 8px;
  }
  .subscription-banner-btn {
    width: auto;
    align-self: flex-start;
  }

  .subscription-paywall-card {
    padding: 20px 16px;
  }

  .toast-success {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    text-align: center;
  }

  .calc-grid { gap: 6px; }
  .calc-btn {
    min-height: 48px;
    font-size: 16px;
  }

  /* todo-list mobile — row layout (column rule hatao) */

  .inv-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .inv-toolbar input[type="search"] {
    min-width: 0;
    width: 100%;
  }

  .inv-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-pagination-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #staffPanel > .btn-row:first-of-type {
    flex-direction: column;
    align-items: stretch;
  }
  #staffPanel > .btn-row:first-of-type select,
  #staffPanel > .btn-row:first-of-type button {
    width: 100%;
  }

  .eway-bill-row { flex-direction: column; }
  .eway-distance-input {
    flex: 1 1 auto !important;
    width: 100%;
  }

  .acc-mode-section {
    flex-direction: column;
    gap: 10px;
  }
  .acc-mode-section label { width: 100%; }

  .custom-select-dropdown { max-height: 50vh; }

  .mini-card { padding: 10px; }
  .mini-card h2 { font-size: 1.1rem; margin: 4px 0; }
  .mini-card h3 { font-size: 1rem; margin: 4px 0; }
}

/* Phone */
@media (max-width: 480px) {
  .hero { display: none; }

  h1 { font-size: 13px; }
  .panel-header h3 { font-size: 14px; }

  .brand-mark { width: 32px; height: 32px; border-radius: 8px; }

  .topbar-toolbar .voice-btn {
    font-size: 10px;
    padding: 8px;
    max-width: 72px;
  }

  .hero-stats { grid-template-columns: 1fr; }

  .stat-card strong { font-size: 16px; }

  /* Sirf form wale buttons full width — table/pagination nahi */
  .panel > .btn-row > button:only-child,
  .panel > .btn-row > button:nth-last-child(1):nth-first-child(1) {
    flex: 1 1 100%;
  }

  .report-tab-btn,
  .contractor-subtab-btn {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
    white-space: normal;
    font-size: 11px;
    padding: 8px 6px;
  }

  #reportTabs,
  #contractorPanel > .btn-row:first-of-type {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .inv-stats-grid { grid-template-columns: 1fr; }

  .inv-chip {
    padding: 7px 10px;
    font-size: 11px;
  }

  .modal-box {
    padding: 16px;
    border-radius: 12px;
  }

  .live-ai-widget {
    height: min(78vh, 560px);
    border-radius: 14px 14px 0 0;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
  }

  .live-ai-input-row input,
  input, select, textarea {
    font-size: 16px;
  }

  .gallery-viewer img {
    max-height: 45vh;
    object-fit: contain;
  }

  .qr-box { min-height: 150px; }

  .subscription-paywall-card h3 { font-size: 1.05rem; }

  .panel-area { padding: 10px; }
}

/* Landscape phone */
@media (max-width: 900px) and (orientation: landscape) {
  .sidebar { width: min(280px, 50vw); }
  .live-ai-widget { height: min(85vh, 400px); }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .tab-btn {
    padding: 10px 12px;
    font-size: 14px;
  }
  .inv-act-btn {
    padding: 8px 10px;
    min-width: 36px;
    min-height: 36px;
  }
}

/* ——— Official Payroll Salary Slip ——— */
.payroll-slip-modal-box {
  background: #fff !important;
  color: #111 !important;
}
.payroll-slip-doc {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  color: #111;
  line-height: 1.45;
}
.payroll-slip-header {
  text-align: center;
  margin-bottom: 14px;
  border-bottom: 2px solid #111;
  padding-bottom: 10px;
}
.payroll-slip-co-name {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.payroll-slip-co-addr,
.payroll-slip-co-meta {
  margin: 2px 0;
  font-size: 12px;
  color: #333;
}
.payroll-slip-title {
  margin: 10px 0 0;
  font-size: 14px;
}
.payroll-slip-info-table,
.payroll-slip-ledger-table,
.payroll-slip-daily-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.payroll-slip-info-table td,
.payroll-slip-ledger-table th,
.payroll-slip-ledger-table td,
.payroll-slip-daily-table th,
.payroll-slip-daily-table td {
  border: 1px solid #222;
  padding: 6px 8px;
  vertical-align: top;
}
.payroll-slip-info-table .lbl {
  width: 18%;
  font-weight: 600;
  background: #f5f5f5;
}
.payroll-slip-info-table .val {
  width: 32%;
}
.payroll-slip-ledger-table th {
  background: #f0f0f0;
  font-size: 12px;
  text-align: left;
}
.payroll-slip-ledger-table .amt {
  text-align: right;
  white-space: nowrap;
  width: 18%;
}
.payroll-slip-total-row td {
  background: #fafafa;
}
.payroll-slip-net-block {
  border: 2px solid #111;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.payroll-slip-net-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  margin-bottom: 6px;
}
.payroll-slip-net-amt {
  font-size: 18px;
}
.payroll-slip-words {
  margin: 0;
  font-size: 12px;
  color: #333;
}
.payroll-slip-footer {
  margin-top: 8px;
}
.payroll-slip-note {
  font-size: 11px;
  color: #444;
  margin: 0 0 20px;
}
.payroll-slip-sign-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  min-height: 60px;
}
.payroll-slip-sign {
  text-align: right;
  font-size: 12px;
  border-top: 1px solid #111;
  padding-top: 4px;
  min-width: 180px;
}
.payroll-slip-daily {
  margin-top: 14px;
  font-size: 12px;
}
.payroll-slip-warning {
  margin-top: 12px;
  padding: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
  color: #9a3412;
  font-size: 13px;
}

@media print {
  body.printing-payroll-slip {
    background: #fff !important;
  }
  body.printing-payroll-slip > *:not(#payrollSlipModal) {
    display: none !important;
  }
  body.printing-payroll-slip #payrollSlipModal {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: #fff !important;
    padding: 0 !important;
    backdrop-filter: none !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  body.printing-payroll-slip #payrollSlipModal.hidden {
    display: block !important;
  }
  body.printing-payroll-slip .payroll-slip-modal-box {
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 12mm !important;
    margin: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }
  body.printing-payroll-slip .payroll-slip-actions,
  body.printing-payroll-slip .payroll-slip-screen-only {
    display: none !important;
  }
  body.printing-payroll-slip .payroll-slip-doc {
    page-break-inside: avoid;
  }
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}

/* Language selector */
.bk-lang-host { display: inline-flex; align-items: center; }
.bk-lang-wrap { display: inline-flex; align-items: center; gap: 6px; }
.bk-lang-label {
  font-size: 11px;
  color: var(--muted);
  display: none;
}
.bk-lang-select {
  min-width: 108px;
  padding: 8px 10px !important;
  font-size: 12px !important;
  cursor: pointer;
}
@media (max-width: 768px) {
  .bk-lang-select { min-width: 88px; padding: 8px 6px !important; font-size: 11px !important; }
}
.bk-lang-toggle {
  min-width: 64px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  font-weight: 700;
}
@media (max-width: 768px) {
  .top-actions .bk-lang-toggle {
    min-width: 44px !important;
    padding: 10px 8px !important;
    font-size: 12px !important;
  }
}

/* ── App Lock (Security) ── */
body.app-lock-active { overflow: hidden; }
.app-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.app-lock-overlay.hidden { display: none !important; }
.app-lock-inner {
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.app-lock-icon { font-size: 48px; margin-bottom: 8px; }
.app-lock-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; color: var(--text); }
.app-lock-sub { margin: 0 0 20px; font-size: 13px; color: var(--muted); }
.app-lock-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.app-lock-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  transition: background 0.15s;
}
.app-lock-dot.filled { background: var(--accent); }
.app-lock-error {
  color: #f87171;
  font-size: 13px;
  margin: 0 0 12px;
  min-height: 18px;
}
.app-lock-error.hidden { display: none; }
.app-lock-bio-btn {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.app-lock-bio-btn.hidden { display: none; }
.app-lock-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.app-lock-keypad button {
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}
.app-lock-keypad button:active { background: var(--card2); }
.app-lock-keypad .app-lock-empty { visibility: hidden; border: none; background: transparent; }
.app-lock-back { font-size: 18px !important; }
.app-lock-logout {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.security-lock-card { padding: 18px 20px; }
.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.security-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.security-toggle input { opacity: 0; width: 0; height: 0; }
.security-toggle-slider {
  position: absolute;
  inset: 0;
  background: #475569;
  border-radius: 28px;
  cursor: pointer;
  transition: 0.2s;
}
.security-toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.security-toggle input:checked + .security-toggle-slider { background: #22c55e; }
.security-toggle input:checked + .security-toggle-slider::before { transform: translateX(20px); }

/* ================= INVOICE / SALES VOUCHER (app theme) ================= */
#invoicePanel.active {
  padding-bottom: 28px;
}
.inv-voucher-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow: visible;
}
.inv-vch-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.inv-vch-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.inv-date-clickable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.inv-date-clickable:hover {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.1);
}
.inv-date-chip-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  cursor: pointer;
  max-width: 100%;
  min-height: 36px;
}
.inv-date-chip-wrap .inv-date-clickable {
  pointer-events: none;
  user-select: none;
}
.inv-date-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
  z-index: 2;
}
.inv-date-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.inv-vch-no { color: var(--accent2); }
.inv-vch-editable {
  min-width: 7.5rem;
  max-width: 11rem;
  text-align: center;
  cursor: text;
  font: inherit;
  outline: none;
}
.inv-vch-editable:focus {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.inv-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.inv-party-grid { margin-bottom: 12px; }
.inv-party-autocomplete {
  position: relative;
  width: 100%;
}
.inv-party-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 500;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.inv-party-suggest.hidden { display: none; }
.inv-party-suggest li {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.inv-party-suggest li:last-child { border-bottom: none; }
.inv-party-suggest li:hover,
.inv-party-suggest li.active {
  background: rgba(34, 197, 94, 0.12);
}
.inv-party-suggest .party-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.ao-suggest-wrap {
  position: relative;
  min-width: 0;
  overflow: visible;
}
.overview-customer-search {
  overflow: visible;
}
.ao-suggest-float {
  position: fixed !important;
  max-height: 260px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.inv-item-entry .ao-suggest-wrap,
.inv-item-entry .ao-item-suggest {
  flex: 2 1 180px;
  min-width: 140px;
}
.inv-item-entry .ao-suggest-wrap input,
.inv-item-entry .ao-item-suggest input {
  width: 100%;
  flex: 1 1 auto;
  max-width: 100%;
}
.grid-2 > .ao-suggest-wrap,
.inv-field .ao-suggest-wrap,
.modify-form-grid .ao-suggest-wrap {
  width: 100%;
}
.inv-full-span { grid-column: 1 / -1; }
.gst-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px 4px 12px;
  border-radius: 999px;
  background: var(--card2);
  border: 1px solid var(--border);
}
.gst-toggle-label { font-size: 12px; font-weight: 700; color: var(--text); }
.gst-toggle-wrap input { display: none; }
.gst-toggle-slider {
  position: relative;
  width: 42px;
  height: 24px;
  background: #64748b;
  border-radius: 999px;
  transition: 0.2s;
}
.gst-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.gst-toggle-wrap input:checked + .gst-toggle-slider { background: var(--accent); }
.gst-toggle-wrap input:checked + .gst-toggle-slider::before { transform: translateX(18px); }

/* Plan billing — Monthly / Yearly slide toggle */
.bk-billing-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bk-billing-opt {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s;
  user-select: none;
}
.bk-billing-opt.active { color: var(--accent); }
.bk-billing-toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}
.bk-billing-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.bk-billing-slider {
  position: absolute;
  inset: 0;
  background: #475569;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.bk-billing-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.bk-billing-toggle input:checked + .bk-billing-slider { background: var(--accent); }
.bk-billing-toggle input:checked + .bk-billing-slider::before { transform: translateX(24px); }
.bk-billing-save {
  font-size: 11px;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
}
.inv-advanced-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}
.inv-advanced-box summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.inv-acc-mode {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
}
.inv-tally-mode-block {
  display: block;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 120, 215, 0.35);
  border-radius: 10px;
  background: rgba(0, 120, 215, 0.06);
}
.inv-tally-mode-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.inv-tally-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}
.inv-tally-hint { margin: 8px 0 0; font-size: 12px; }
.inv-khata-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #86efac;
  line-height: 1.45;
}
.inv-acc-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  vertical-align: middle;
}
.inv-acc-badge-optional {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}
.tally-http-gate {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  color: #fcd34d;
}
.tally-http-gate--ready {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}
.tally-http-gate--try {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
  color: #93c5fd;
}
#tallySyncBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.25);
}
.tally-status-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card2);
}
.tally-status-chip.tally-status-online {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}
.tally-status-chip.tally-status-offline {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
}
.tally-once-banner {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}
.tally-http-hint {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.45;
  background: var(--tally-hint-bg);
  border: 1px solid var(--tally-hint-border);
  color: var(--tally-hint-fg);
}
.tally-setup-steps {
  margin: 8px 0 10px 18px;
  padding: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}
.tally-setup-steps strong { color: var(--accent2, #0284c7); }
.sidebar-tally-body .tally-actions-stack {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 12px;
}
.sidebar-tally-body .tally-actions-stack > .tally-dl-link,
.sidebar-tally-body .tally-actions-stack > .tally-connect-btn,
.sidebar-tally-body .tally-actions-stack > .tally-test-http-btn {
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}
.sidebar-tally-body .tally-actions-stack > * + * {
  margin-top: 0;
}
.sidebar-tally-body .tally-dl-link + .tally-dl-link {
  margin-top: 10px !important;
}
.sidebar-tally-body .tally-dl-link + .tally-connect-btn {
  margin-top: 10px !important;
}
.sidebar-tally-body .tally-connect-btn + .tally-test-http-btn {
  margin-top: 10px !important;
}
.tally-test-http-btn {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(2, 132, 199, 0.45);
  background: rgba(2, 132, 199, 0.1);
  color: var(--accent2, #0284c7);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.tally-test-http-btn:hover {
  background: rgba(2, 132, 199, 0.18);
  border-color: rgba(2, 132, 199, 0.65);
}
html[data-theme="light"] .tally-test-http-btn {
  background: #eff6ff;
  color: #0369a1;
  border-color: #93c5fd;
}
.tally-dl-link {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  background: #3b82f6;
  color: #fff;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.35;
}
.tally-dl-link:hover {
  filter: brightness(1.08);
}
.tally-dl-primary {
  font-weight: 700;
  font-size: 13px;
}
.tally-dl-secondary {
  background: #2563eb;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
html[data-theme="light"] .tally-dl-secondary {
  background: #1d4ed8;
}
.tally-connect-btn {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}
.tally-connect-btn:hover { filter: brightness(1.08); }
.tally-dl-link-secondary {
  display: block;
  font-size: 12px;
  opacity: 0.9;
}
.tally-setup-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.tally-setup-pill--checking {
  background: var(--tally-pill-check-bg);
  color: var(--tally-pill-check-fg);
  border: 1px solid var(--border);
}
.tally-setup-pill--ready {
  background: var(--tally-pill-ready-bg);
  color: var(--tally-pill-ready-fg);
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.tally-setup-pill--warn {
  background: var(--tally-pill-warn-bg);
  color: var(--tally-pill-warn-fg);
  border: 1px solid var(--tally-hint-border);
}
.tally-setup-pill--offline {
  background: var(--tally-pill-offline-bg);
  color: var(--tally-pill-offline-fg);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.tally-setup-lead {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}
.tally-setup-lead strong { color: var(--accent2, #0284c7); }
.tally-http-hint-warn {
  border: 1px solid var(--tally-hint-border);
  background: var(--tally-hint-bg);
  color: var(--tally-hint-fg);
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.45;
}
.tally-agent-sidebar-status {
  font-size: 12px;
  font-weight: 500;
  margin: 10px 0 0;
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--tally-status-bg);
  border: 1px solid var(--tally-panel-border, var(--border));
  color: var(--tally-status-fg);
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .tally-agent-sidebar-status {
  border-color: #cbd5e1;
}
.tally-token-label {
  color: var(--text);
  font-weight: 700;
}
.tally-token-hint {
  color: var(--muted);
}
.tally-copy-btn {
  font-weight: 700;
  flex-shrink: 0;
}
.inv-item-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--card2);
  border: 1px solid var(--border);
}
.inv-entry-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.inv-item-entry input,
.inv-item-entry select {
  flex: 1 1 120px;
  min-width: 0;
}
.inv-field-hsn { flex: 0 1 100px; max-width: 110px; }
.inv-field-qty { flex: 0 1 70px; max-width: 80px; }
.inv-field-price { flex: 0 1 130px; max-width: 150px; }
.inv-field-gst { flex: 0 1 72px; max-width: 80px; }
.inv-unit-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 4px;
}
.inv-add-btn {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.inv-save-btn {
  background: #22c55e;
  color: #fff;
  font-weight: 700;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
}
.inv-save-btn:hover { background: #16a34a; }
.inv-save-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.inv-voucher-card.gst-off .inv-field-gst { display: none; }
.inv-table-wrap { margin-bottom: 12px; }
.inv-items-table { width: 100%; }
.inv-items-table th,
.inv-items-table td {
  font-size: 13px;
  padding: 8px 10px;
}
.inv-amt-cell { font-weight: 700; color: var(--accent); text-align: right; }
.inv-total-row td {
  background: rgba(34,197,94,.08);
  border-top: 2px solid var(--border);
}
.inv-tax-footer {
  margin-bottom: 14px;
  gap: 12px;
  align-items: stretch;
}
.inv-tax-footer.grid-2 {
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  .inv-tax-footer.grid-2 {
    grid-template-columns: 1.2fr 0.8fr;
  }
}
.inv-info-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 0;
  min-width: 0;
  overflow: visible;
}
.inv-tax-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.inv-tax-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.inv-tax-table th,
.inv-tax-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: right;
  word-break: break-word;
}
.inv-tax-table th:nth-child(1),
.inv-tax-table td:nth-child(1) { width: 34%; text-align: center; }
.inv-tax-table th:nth-child(2),
.inv-tax-table td:nth-child(2) { width: 33%; }
.inv-tax-table th:nth-child(3),
.inv-tax-table td:nth-child(3) { width: 33%; color: var(--accent); font-weight: 600; }
.inv-info-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inv-tax-desc {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}
.inv-tax-table thead th { background: rgba(255,255,255,.04); font-weight: 700; }

/* Purchase panel — invoice jaisa full page */
#purchasePanel.active { padding-bottom: 28px; }
.purchase-panel-card { margin-bottom: 12px; }
.purchase-item-entry .pv-field-item { flex: 2 1 180px; min-width: 140px; }
@media (max-width: 768px) {
  .purchase-item-entry select,
  .purchase-item-entry input { flex: 1 1 100%; max-width: 100%; }
}
.inv-info-text { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
#invoicePanel #invoiceStatus {
  margin: 10px 0 6px;
  line-height: 1.4;
}
.inv-action-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.inv-row-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}
.inv-row-actions button {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  background: var(--card2);
  color: var(--text);
}
.inv-row-edit:hover { border-color: #f59e0b; color: #f59e0b; }
.inv-row-del:hover { border-color: var(--danger); color: var(--danger); }
.inv-voucher-card.blocked-invoice .inv-btn-quit {
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
}
@media (max-width: 768px) {
  .inv-vch-header-row { flex-direction: column; }
  .inv-add-btn { margin-left: 0; width: 100%; }
  .inv-item-entry input,
  .inv-item-entry select { flex: 1 1 100%; max-width: 100%; }
  .inv-tax-footer { grid-template-columns: 1fr; }
  .inv-action-row button { flex: 1 1 calc(50% - 4px); min-width: 120px; }
}

/* ===== Overview — Modification-style cards ===== */
#overviewPanel .overview-section-card,
#overviewPanel .overview-alert-card {
  margin-bottom: 14px;
}
#overviewPanel .overview-date-label {
  color: #38bdf8;
  font-weight: 600;
}
#overviewPanel .overview-alert-warn {
  border-color: rgba(245, 158, 11, 0.45) !important;
  background: rgba(245, 158, 11, 0.1) !important;
  font-size: 13px;
  line-height: 1.5;
}
#overviewPanel .overview-alert-danger {
  border-color: rgba(239, 68, 68, 0.45) !important;
  background: rgba(239, 68, 68, 0.1) !important;
  font-size: 13px;
  line-height: 1.5;
}
.overview-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
.overview-stat-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  background: var(--card);
  min-height: 96px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.overview-stat-compact {
  min-height: 72px;
  padding: 12px;
}
.overview-stat-icon {
  font-size: 20px;
  line-height: 1;
}
.overview-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}
.overview-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: auto;
  word-break: break-word;
}
#overviewPanel .stat-sales .overview-stat-value { color: #10b981; }
#overviewPanel .stat-expense .overview-stat-value { color: #ef4444; }
#overviewPanel .stat-profit .overview-stat-value { color: #3b82f6; }
#overviewPanel .stat-udhar .overview-stat-value { color: #f59e0b; }
#overviewPanel .stat-cash .overview-stat-value { color: #10b981; }
#overviewPanel .stat-upi .overview-stat-value { color: var(--info, #2563eb); }
#overviewPanel .stat-credit .overview-stat-value { color: #f59e0b; }
#overviewPanel .stat-collection .overview-stat-value { color: #3b82f6; }
#overviewPanel .stat-purchase .overview-stat-value { color: #f59e0b; }
#overviewPanel .stat-payment .overview-stat-value { color: #ef4444; }
#overviewPanel .stat-receipt .overview-stat-value { color: #22c55e; }
.overview-daily-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.overview-daily-bills {
  font-size: 12px;
  color: var(--muted);
}
#overviewPanel .overview-refresh-btn,
#overviewPanel .overview-tool-card,
#overviewRecPicker .modify-type-card,
#overviewRecordsHub .modify-type-card {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  text-align: left;
}
#overviewPanel .overview-refresh-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
}
.overview-rec-totals-row {
  margin-bottom: 4px;
}
#overviewRecPicker .modify-type-grid,
#overviewTypeGrid,
#overviewPanel .overview-tool-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}
#overviewRecPicker .modify-type-card,
#overviewPanel .overview-tool-card {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 980px) {
  .overview-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #overviewRecPicker .modify-type-grid,
  #overviewTypeGrid,
  #overviewPanel .overview-tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
#overviewRecPicker .modify-type-card,
#overviewRecordsHub .modify-type-card {
  cursor: pointer;
}
.business-records-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.business-records-header-actions {
  margin: 0;
  flex-wrap: wrap;
}
#businessRecordsPanel .overview-rec-pane[hidden] { display: none !important; }
#businessRecordsPanel .overview-rec-pane.active { display: block; }
.overview-rec-detail.hidden { display: none !important; }
.overview-rec-detail {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}
.overview-rec-detail-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.overview-rec-detail-bar strong {
  flex: 1;
  font-size: 15px;
  color: var(--text);
}
.overview-rec-back-btn,
.overview-rec-refresh-btn {
  padding: 8px 14px !important;
  font-size: 13px !important;
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
}
.overview-rec-pane[hidden] { display: none !important; }
.overview-rec-pane.active { display: block; }
.overview-rec-pane-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.overview-rec-pane-toolbar .panel-search-input {
  flex: 1;
  min-width: 180px;
  max-width: 100%;
  margin-top: 0;
}
.overview-customer-search {
  margin-top: 8px;
  align-items: center;
}
.overview-customer-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.12);
  font-size: 13px;
  line-height: 1.5;
}
#businessRecordsPanel .sales-filter-row button.secondary,
#businessRecordsPanel .overview-rec-pane-toolbar .secondary,
#businessRecordsPanel .panel-pagination-bar button,
#overviewRecordsHub .sales-filter-row button.secondary,
#overviewRecordsHub .overview-rec-pane-toolbar .secondary,
#overviewRecordsHub .panel-pagination-bar button {
  background: var(--card) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.bk-apply-filter-btn,
#businessRecordsPanel [id$="ApplyDateBtn"],
#overviewRecordsHub [id$="ApplyDateBtn"] {
  background: #0284c7 !important;
  color: #fff !important;
  border: 1px solid #0369a1 !important;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}
.bk-apply-filter-btn:hover,
#businessRecordsPanel [id$="ApplyDateBtn"]:hover,
#overviewRecordsHub [id$="ApplyDateBtn"]:hover {
  background: #0369a1 !important;
}
.sales-bill-btn {
  padding: 4px 10px !important;
  font-size: 12px !important;
  white-space: nowrap;
  background: rgba(34, 197, 94, 0.12) !important;
  color: #16a34a !important;
  border: 1px solid rgba(34, 197, 94, 0.35) !important;
}
html[data-theme="light"] .sales-bill-btn {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}
.sales-bill-btn:hover {
  filter: brightness(0.95);
}
#businessRecordsPanel #ovCustomerViewBtn,
#overviewRecordsHub #ovCustomerViewBtn {
  white-space: nowrap;
  min-height: 40px;
}

html[data-theme="light"] .overview-customer-summary {
  background: #f1f5f9;
  color: #0f172a;
}
html[data-theme="light"] .overview-customer-summary .overview-customer-hint {
  color: #475569 !important;
}

/* Table amount total bar */
.table-amount-total-bar {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}
.table-amount-total-bar.hidden {
  display: none !important;
}
.table-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.table-total-row-sub {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.table-total-row strong {
  font-size: 1.1rem;
  font-weight: 800;
}
.table-total-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.table-total-grand {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.table-total-grand strong {
  color: #38bdf8;
  font-size: 1rem;
}

/* ——— Desktop topbar: live time → voice → actions ——— */
@media (min-width: 769px) {
  .topbar { justify-content: flex-start; }
  .brand-wrap { flex: 1; min-width: 0; }
  .topbar-more-btn { display: none !important; }
  .topbar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
  }
  .topbar-toolbar .topbar-clock {
    display: flex !important;
    order: 1;
  }
  .topbar-toolbar .voice-btn { order: 2; }
  .top-actions {
    display: flex !important;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    margin-left: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    gap: 10px;
    order: 3;
  }
  .top-actions .theme-btn,
  .top-actions .staff-mode-banner {
    width: auto;
    min-height: 0;
    padding: 10px 14px;
    font-size: inherit;
    text-align: center;
  }
}

/* ——— Phone UI polish (header, filters, tables, forms) ——— */
@media (max-width: 768px) {
  .subscription-banner {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.45;
  }
  #subscriptionBannerText {
    flex: 1;
    min-width: 0;
    word-break: break-word;
  }

  .sales-filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .sales-date-field {
    min-width: 0;
    width: 100%;
  }
  .sales-filter-row > button {
    width: 100%;
    min-height: 44px;
  }
  .sales-filter-row > button.secondary {
    width: 100%;
  }
  .sales-quick-filters {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .sales-quick-filters button {
    min-height: 40px;
    font-size: 11px;
    padding: 8px 6px;
    white-space: normal;
    line-height: 1.2;
  }

  .overview-rec-pane-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .overview-rec-pane-toolbar .panel-search-input,
  .panel-search-input {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .business-records-header {
    flex-direction: column;
    align-items: stretch;
  }
  .business-records-header-actions {
    width: 100%;
  }
  .business-records-header-actions button {
    flex: 1 1 calc(50% - 4px);
    min-height: 44px;
  }

  .table-wrap.mobile-ready {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    clear: both;
  }
  .table-wrap.mobile-ready table,
  .table-wrap.mobile-ready tbody {
    display: block;
    width: 100%;
  }
  .panel-pagination-bar,
  .khata-pagination {
    position: relative;
    z-index: 3;
    clear: both;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card2);
    box-sizing: border-box;
  }
  .panel-pagination-bar .khata-pagination-left,
  .khata-pagination .khata-pagination-left {
    width: 100%;
    justify-content: space-between;
  }
  .panel-pagination-bar .btn-row,
  .khata-pagination .btn-row {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .panel-pagination-bar .btn-row button,
  .khata-pagination .btn-row button {
    flex: 1 1 0;
    min-width: 0 !important;
    min-height: 44px;
  }

  .inv-toolbar {
    gap: 10px;
  }
  .inv-filter-chips {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .inv-chip {
    min-height: 38px;
    padding: 8px 6px;
    font-size: 11px;
  }

  .panel-area {
    padding: 10px 8px;
  }
  .panel,
  .mini-card,
  .modify-panel-card {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .inv-form-grid,
  .grid-2,
  .inv-field-span2 {
    grid-template-columns: 1fr !important;
  }

  .modify-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .modify-type-card {
    padding: 12px 10px;
  }
  .modify-type-desc {
    font-size: 10px;
  }

  .panel-header .btn-row button {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .topbar-toolbar .voice-btn {
    max-width: 64px;
    font-size: 9px;
    padding: 7px 6px;
  }
  .modify-type-grid {
    grid-template-columns: 1fr;
  }
  .sales-quick-filters {
    grid-template-columns: 1fr;
  }
  .inv-filter-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modify-actions {
    flex-direction: column;
  }
  .modify-actions button {
    width: 100%;
    min-height: 44px;
  }
}

/* ——— Mobile: date inputs & voucher/modify forms ——— */
input[type="date"]:not(.inv-date-input-hidden) {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

input[type="date"].inv-date-input-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  pointer-events: none;
  overflow: hidden;
  border: none;
}

@media (max-width: 768px) {
  input[type="date"]:not(.inv-date-input-hidden) {
    min-height: 44px;
    height: 44px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.2;
    -webkit-appearance: none;
    appearance: none;
    display: block;
  }

  /* Header date chip = source of truth — hide duplicate Bill/Voucher Date row */
  #purchasePanel .inv-party-grid > label:has(#pvDateInput),
  #paymentVoucherPanel .inv-party-grid > label:has(#pmvDateInput),
  #receiptVoucherPanel .inv-party-grid > label:has(#rcvDateInput) {
    display: none !important;
  }

  .inv-voucher-card .inv-vch-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .inv-voucher-card .inv-vch-meta {
    justify-content: flex-start;
  }
  .inv-meta-chip {
    padding: 10px 14px;
    font-size: 14px;
    max-width: 100%;
    white-space: normal;
  }
  .inv-date-chip-wrap {
    min-height: 44px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .inv-date-overlay {
    min-height: 44px;
    font-size: 16px;
  }
  .inv-vch-editable {
    min-height: 44px;
    max-width: none;
    flex: 1 1 8rem;
    font-size: 16px;
  }

  .inv-party-grid,
  .voucher-party-grid,
  .voucher-stock-grid,
  .voucher-form-card .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .voucher-field {
    min-width: 0;
    width: 100%;
  }
  .voucher-field input:not([type="hidden"]),
  .voucher-field select,
  .voucher-field textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .modify-form-grid {
    grid-template-columns: 1fr !important;
  }
  .modify-form-grid label,
  .modify-form-grid .modify-span2 {
    grid-column: auto !important;
    min-width: 0;
    width: 100%;
  }
  .modify-form-grid input,
  .modify-form-grid select,
  .modify-form-grid textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .modify-date-filters {
    grid-template-columns: 1fr !important;
  }
  .modify-date-field input[type="date"] {
    width: 100%;
  }

  .modify-edit-card {
    padding: 12px;
    overflow-x: hidden;
  }

  .inv-voucher-card {
    padding: 12px 10px;
    overflow-x: hidden;
  }

  .inv-action-row,
  .purchase-panel-card > .btn-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .inv-action-row button,
  .purchase-panel-card > .btn-row button {
    width: 100%;
    min-height: 44px;
    flex: 1 1 auto !important;
  }

  .companies-table-wrap { overflow-x: auto; }
  .companies-table { font-size: 13px; min-width: 720px; }
  .companies-table .co-actions-cell { white-space: nowrap; }
  .companies-table .co-actions-cell button { margin-right: 6px; }
  .companies-table .co-active-btn { opacity: 0.85; cursor: default; }
  .companies-add-grid textarea { resize: vertical; min-height: 52px; }

  .sales-date-field input[type="date"] {
    min-height: 44px;
    height: 44px;
  }
}

.companies-table-wrap { overflow-x: auto; }
.companies-table { font-size: 13px; min-width: 720px; }
.companies-table .co-actions-cell { white-space: nowrap; }
.companies-table .co-actions-cell button { margin-right: 6px; }
.companies-table .co-active-btn { opacity: 0.85; cursor: default; }
.companies-add-grid textarea { resize: vertical; min-height: 52px; }

.bk-team-alert-bar {
  position: fixed;
  bottom: 20px;
  right: 16px;
  left: 16px;
  max-width: 420px;
  margin-left: auto;
  z-index: 10050;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  color: #ecfdf5;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  padding: 14px 16px;
  animation: bkAlertPop 0.35s ease;
}
.bk-team-alert-bar.hidden { display: none; }
.bk-team-alert-inner { display: flex; flex-direction: column; gap: 10px; }
.bk-team-alert-text { font-size: 14px; line-height: 1.4; }
.bk-team-alert-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bk-team-alert-actions .theme-btn { flex: 1; min-width: 120px; }
@keyframes bkAlertPop {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* —— Professional UI polish (v2) —— */
html[data-theme="light"] .sidebar,
html[data-theme="light"] .panel-area {
  box-shadow: var(--shadow-sm);
}
html[data-theme="light"] .nav-accordion {
  background: #f8fafc;
  border-color: rgba(30, 58, 95, 0.1);
}
html[data-theme="light"] .nav-accordion-summary:hover {
  background: #f1f5f9;
}
html[data-theme="light"] .tab-btn:hover {
  background: #f1f5f9;
  border-color: rgba(30, 58, 95, 0.08);
}
.panel-area {
  border-radius: var(--radius-lg, 16px);
}
.mini-card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
html[data-theme="light"] .mini-card:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: var(--shadow-sm);
}
.beta-tag {
  background: rgba(37, 99, 235, 0.12);
  color: #60a5fa;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
html[data-theme="light"] .beta-tag {
  background: #eff6ff;
  color: #1d4ed8;
}
.khata-badge-debit { color: var(--success-fg, #34d399); }
.khata-badge-clear { color: var(--success-fg, #34d399); }
.khata-badge-udhar { color: var(--warning-fg, #fbbf24); }
html[data-theme="light"] .khata-badge-debit,
html[data-theme="light"] .khata-badge-clear { color: var(--success, #047857); }
html[data-theme="light"] .khata-badge-udhar { color: var(--warning, #b45309); }
#overviewPanel .stat-sales .overview-stat-value,
#overviewPanel .stat-cash .overview-stat-value,
#overviewPanel .stat-receipt .overview-stat-value { color: var(--success, #047857); }
html:not([data-theme="light"]) #overviewPanel .stat-sales .overview-stat-value,
html:not([data-theme="light"]) #overviewPanel .stat-cash .overview-stat-value,
html:not([data-theme="light"]) #overviewPanel .stat-receipt .overview-stat-value { color: #34d399; }
#overviewPanel .stat-profit .overview-stat-value,
#overviewPanel .stat-collection .overview-stat-value { color: var(--info, #2563eb); }
#overviewPanel .stat-udhar .overview-stat-value,
#overviewPanel .stat-credit .overview-stat-value,
#overviewPanel .stat-purchase .overview-stat-value { color: var(--warning, #d97706); }
#overviewPanel .stat-expense .overview-stat-value,
#overviewPanel .stat-payment .overview-stat-value { color: var(--danger, #dc2626); }
.theme-btn:focus-visible,
.tab-btn:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.tally-copy-btn {
  background: var(--success, #047857) !important;
  color: #fff !important;
}
.bk-team-alert-bar {
  background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
  color: #f8fafc;
}

/* Business Mail (Business ₹299) */
.bm-status-banner {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 12px;
  border: 1px solid var(--border, #334155);
}
.bm-status-ok {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.35);
}
.bm-status-warn {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.35);
}
.bm-settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.bm-settings-label {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #94a3b8);
}
.bm-settings-label input {
  width: 100%;
}
.bm-subtabs .bm-subtab-btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
}
.bm-subtabs .bm-subtab-btn.active {
  background: var(--primary, #2563eb);
  color: #fff;
}
.bm-subpanel { display: none; }
.bm-subpanel.active { display: block; }
.bm-compose-card {
  background: var(--card, rgba(15, 23, 42, 0.6));
  border: 1px solid var(--border, #334155);
  border-radius: 12px;
  padding: 16px;
}
html[data-theme="light"] .bm-compose-card {
  background: #f8fafc;
}
.bm-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  margin-bottom: 4px;
}
.bm-msg-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bm-msg-card {
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bm-msg-card:hover,
.bm-msg-card:focus-visible {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}
.bm-msg-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.bm-msg-subject {
  font-weight: 600;
  font-size: 15px;
}
.bm-msg-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.bm-msg-del {
  background: transparent !important;
  border: 1px solid var(--border, #334155) !important;
  color: var(--danger, #dc2626) !important;
  border-radius: 8px;
  padding: 4px 8px !important;
  font-size: 14px;
  line-height: 1;
  min-height: 32px;
  cursor: pointer;
}
.bm-msg-del:hover {
  border-color: var(--danger, #dc2626) !important;
  background: rgba(220, 38, 38, 0.1) !important;
}
.bm-msg-meta {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  margin: 4px 0 6px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.bm-msg-preview {
  font-size: 13px;
  margin: 0;
  color: var(--text-muted, #cbd5e1);
  line-height: 1.4;
}
.bm-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.bm-badge-fail {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger, #f87171);
}
.bm-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted, #94a3b8);
}
.bm-detail-box {
  position: relative;
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--primary, #2563eb);
  background: var(--card, rgba(15, 23, 42, 0.85));
}
.bm-detail-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted, #94a3b8);
}
.bm-detail-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  margin: 12px 0 0;
  max-height: 420px;
  overflow: auto;
  color: var(--text);
}
.bm-detail-err {
  color: var(--danger, #f87171);
  font-size: 13px;
  margin: 8px 0 0;
}
.bm-detail-delivery {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  margin: 6px 0 0;
  word-break: break-all;
}
.bm-status-sub {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
}
.grid-span-2 {
  grid-column: 1 / -1;
}
@media (min-width: 640px) {
  .grid-span-2 { grid-column: span 1; }
}
.bm-manual-log {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}
.bm-manual-log summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent2, #1d4ed8);
}
.bm-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.bm-pass-wrap input {
  width: 100%;
  padding-right: 42px;
}
.bm-pass-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px 8px !important;
  min-width: 0;
  line-height: 1;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
}

/* —— Header-match polish: navy + orbit blue so page header jaisa official lage —— */
html[data-theme="light"] body {
  background:
    radial-gradient(circle at 10% -8%, rgba(59, 130, 246, 0.10), transparent 38%),
    radial-gradient(circle at 92% 108%, rgba(99, 102, 241, 0.08), transparent 42%),
    linear-gradient(180deg, #eef2f8, #e4eaf3);
}
html[data-theme="light"] .sidebar {
  background:
    linear-gradient(90deg, #3b82f6, #6366f1) top / 100% 3px no-repeat,
    #ffffff;
  border-color: rgba(30, 58, 95, 0.10);
  box-shadow: 0 10px 28px rgba(21, 34, 56, 0.06);
}
html[data-theme="light"] .panel-area {
  border-color: rgba(30, 58, 95, 0.10);
  box-shadow: 0 10px 28px rgba(21, 34, 56, 0.05);
}
html[data-theme="light"] .panel-header h3 {
  color: #152238;
}
html[data-theme="light"] .panel-header .eyebrow,
html[data-theme="light"] .panel-header .helper-text:first-child {
  color: #3b82f6;
  letter-spacing: 0.1em;
}
html[data-theme="light"] .tab-btn.active {
  background: linear-gradient(135deg, #eff6ff 0%, #eef2ff 100%);
  border-color: rgba(59, 130, 246, 0.32);
  color: #1e3a5f;
  box-shadow: inset 3px 0 0 #3b82f6;
}
html[data-theme="light"] .nav-accordion[open] .nav-accordion-summary {
  color: #1d4ed8;
  background: #f8fafc;
}
html[data-theme="light"] .subscription-banner,
html[data-theme="light"] .subscription-banner.staff {
  background: #152238;
  color: #e2e8f0;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] .subscription-banner.trial {
  background: #0f2a24;
  color: #bbf7d0;
  border-bottom-color: rgba(52, 211, 153, 0.25);
}
html[data-theme="light"] .subscription-banner-btn {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.22);
  color: #f8fafc;
  border-radius: 999px;
}
html[data-theme="light"] .modify-panel-card,
html[data-theme="light"] .overview-section-card {
  background: #ffffff;
  border-color: rgba(30, 58, 95, 0.10);
  box-shadow: 0 8px 20px rgba(21, 34, 56, 0.04);
}
html[data-theme="light"] .voucher-label {
  color: #1e3a5f;
}
html[data-theme="light"] .overview-stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(30, 58, 95, 0.10);
  padding-left: 16px;
  box-shadow: inset 3px 0 0 #3b82f6;
}
html[data-theme="light"] .overview-stat-card.stat-expense,
html[data-theme="light"] .overview-stat-card.stat-payment {
  box-shadow: inset 3px 0 0 #dc2626;
}
html[data-theme="light"] .overview-stat-card.stat-sales,
html[data-theme="light"] .overview-stat-card.stat-cash,
html[data-theme="light"] .overview-stat-card.stat-receipt {
  box-shadow: inset 3px 0 0 #047857;
}
html[data-theme="light"] .overview-stat-card.stat-udhar,
html[data-theme="light"] .overview-stat-card.stat-credit,
html[data-theme="light"] .overview-stat-card.stat-purchase {
  box-shadow: inset 3px 0 0 #d97706;
}
html[data-theme="light"] .overview-stat-icon,
html[data-theme="light"] .modify-type-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef4ff;
  font-size: 18px;
  margin-bottom: 8px;
}
html[data-theme="light"] .modify-type-card {
  background: #ffffff;
  border-color: rgba(30, 58, 95, 0.10);
}
html[data-theme="light"] .modify-type-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: #f8fbff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 58, 95, 0.08);
}
.sidebar-brand-icon.brand-mark-svg {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
.app-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 12000;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #152238;
  color: #f8fafc;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  font-size: 14px;
  line-height: 1.45;
}
.app-toast.error { background: #7f1d1d; }
.app-toast.success { background: #14532d; }
.app-toast.info { background: #1e3a5f; }
.ao-dialog {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}
.ao-dialog.hidden { display: none; }
.ao-dialog-card {
  width: min(440px, 100%);
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
  padding: 20px 20px 16px;
}
.ao-dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ao-dialog-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: block;
  object-fit: cover;
  background: none;
}
.ao-dialog-head strong { display: block; font-size: 15px; }
.ao-dialog-head small { color: #64748b; font-size: 12px; }
.ao-dialog-msg {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #1e293b;
}
.ao-dialog-ok {
  display: block;
  margin-left: auto;
  min-width: 88px;
  border: 0;
  border-radius: 999px;
  background: #1e3a5f;
  color: #fff;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
}
