/* ==========================================================================
   Ajath BillBook — Enterprise GST Billing, Inventory & Accounting Suite
   Inspired by myBillBook (mybillbook.in/app/dashboard)
   ========================================================================== */

:root {
  --brand-primary: #4f46e5;
  --brand-primary-hover: #4338ca;
  --brand-primary-soft: #eef2ff;
  --brand-accent: #0ea5e9;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #312e81;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   App Shell Layout (myBillBook Sidebar + Main Workspace)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-block-size: 100dvh;
}

/* Sidebar */
.app-sidebar {
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  inset-block-start: 0;
  block-size: 100dvh;
  overflow-y: auto;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.company-switcher {
  padding: 16px;
  border-block-end: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.company-switcher:hover {
  background-color: var(--sidebar-hover);
}

.company-avatar {
  inline-size: 40px;
  block-size: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.company-meta {
  min-inline-size: 0;
  flex: 1;
}

.company-meta h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-meta p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #94a3b8;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-cta-wrap {
  padding: 14px 16px 8px;
}

.btn-create-invoice-main {
  inline-size: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, var(--brand-primary), #3b82f6);
  color: #ffffff;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-create-invoice-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.kbd-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
}

.sidebar-nav {
  padding: 8px 10px 20px;
  flex: 1;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 14px 10px 6px;
}

.nav-item {
  inline-size: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  margin-block-end: 2px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: start;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item svg {
  inline-size: 18px;
  block-size: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--brand-primary);
  color: #ffffff;
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
}

.nav-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.sidebar-footer {
  padding: 12px 16px;
  border-block-start: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #34d399;
}

.sync-dot {
  inline-size: 8px;
  block-size: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Main Content Area & Top Header
   ========================================================================== */
.app-main {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.top-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  cursor: pointer;
}

.page-title-group h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.page-title-group p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.header-search-wrap {
  position: relative;
  flex: 1;
  max-inline-size: 380px;
}

.header-search-input {
  inline-size: 100%;
  padding: 8px 14px 8px 34px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  font-size: 13px;
  color: var(--text-main);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.header-search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.header-search-icon {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons & Badges
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #15803d;
}

.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover {
  background-color: #fecaca;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-paid {
  background-color: var(--success-bg);
  color: var(--success);
}

.badge-unpaid {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.badge-partial {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.badge-draft,
.badge-open {
  background-color: var(--info-bg);
  color: var(--info);
}

/* ==========================================================================
   Complex Layout Containment (modern-web-guidance: interactions-in-complex-layouts)
   ========================================================================== */
.workspace-body {
  padding: 22px 24px 48px;
  flex: 1;
}

.containment-region {
  /* Apply containment boundaries to isolate layout/paint mutations */
  content-visibility: auto;
  contain-intrinsic-size: auto 300px auto 800px;
}

@supports not (content-visibility: auto) {
  .containment-region {
    /* Manual fallback for containment */
    contain: layout style paint;
  }
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* ==========================================================================
   Dashboard Metrics & Quick Action Strip (myBillBook Dashboard Style)
   ========================================================================== */
.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding-block-end: 16px;
}

.quick-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}

.quick-action-chip:hover {
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.quick-action-chip .chip-icon {
  inline-size: 24px;
  block-size: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
  margin-block-end: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 4px;
  block-size: 100%;
  background: var(--brand-primary);
}

.kpi-card.kpi-collect::before {
  background: var(--success);
}

.kpi-card.kpi-pay::before {
  background: var(--danger);
}

.kpi-card.kpi-bank::before {
  background: var(--brand-accent);
}

.kpi-card.kpi-stock::before {
  background: var(--warning);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
}

.kpi-value {
  font-size: 23px;
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 0 4px;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Dashboard Split Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(300px, 1fr);
  gap: 20px;
  margin-block-end: 20px;
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-block-end: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 16px 18px;
}

/* ==========================================================================
   Responsive Data Table (modern-web-guidance: responsive-table)
   ========================================================================== */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 80vh);
  container-type: inline-size;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.table-wrapper:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: -2px;
}

table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

caption.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sticky column headers (desktop) */
thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

thead th {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 11px 14px;
  text-align: start;
  border-block-end: 1px solid var(--border-color);
  white-space: nowrap;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover td,
tbody tr:hover th {
  background-color: #f8fafc;
}

tbody th,
tbody td {
  padding: 11px 14px;
  border-block-end: 1px solid var(--border-color);
  vertical-align: middle;
  text-align: start;
}

/* Sticky row headers (desktop) */
tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: white; /* Required to cover background during scroll */
  font-weight: 600;
  color: var(--text-main);
}

.num-col {
  text-align: end !important;
  font-variant-numeric: tabular-nums;
}

/* Responsive Stacked Layout when container width < 600px */
@container (width < 600px) {
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    /* MANDATORY: Hide column header from layout and screen readers. */
    display: none;
  }

  tr {
    margin-block-end: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  /* Sticky row headers at the top of each block/card */
  tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: #eef2ff;
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    text-align: end;
  }

  /* Inject labels via CSS custom properties */
  td:nth-child(2)::before {
    content: var(--label-2, "Details") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }

  td:nth-child(3)::before {
    content: var(--label-3, "Info") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }

  td:nth-child(4)::before {
    content: var(--label-4, "Amount") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }

  td:nth-child(5)::before {
    content: var(--label-5, "Balance") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }

  td:nth-child(6)::before {
    content: var(--label-6, "Status") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }

  td:nth-child(7)::before {
    content: var(--label-7, "Actions") ": ";
    font-weight: 600;
    color: var(--text-secondary);
    text-align: start;
  }
}

/* ==========================================================================
   Form Validation After Interaction (modern-web-guidance: validate-input-after-interaction)
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  margin-block-end: 14px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-block-end: 3px;
}

/* MANDATORY: Place format hints above the input so autocomplete popovers don't cover them during editing */
.hint,
.rules-list {
  display: block;
  color: #5f6368;
  font-size: 0.78rem;
  margin-block-end: 0.25rem;
}

.field input,
.field select,
.field textarea,
.form-control {
  inline-size: 100%;
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
}

.error-msg {
  display: none;
  color: #d93025;
  font-size: 0.8rem;
  margin-block-start: 0.25rem;
  font-weight: 500;
}

/* DO: Only show error styles after user interaction (:user-invalid) */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: #d93025;
  background-color: #fce8e6;
}

/* DO: Reveal the error message using the adjacent sibling selector */
input:user-invalid + .error-msg,
select:user-invalid + .error-msg,
textarea:user-invalid + .error-msg {
  display: block;
}

/* DO: Highlight rules/hint when error is shown using modern :has() selector */
.field:has(input:user-invalid) .hint,
.field:has(input:user-invalid) .rules-list {
  color: #d93025;
  font-weight: 600;
}

/* DO: Provide a clear success indication on :user-valid */
.field input[required]:user-valid {
  border-color: #188038;
}

/* ==========================================================================
   Native Light-Dismiss Dialogs (modern-web-guidance: light-dismiss-a-dialog)
   ========================================================================== */
dialog {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0;
  max-inline-size: min(680px, 94vw);
  inline-size: 100%;
  max-block-size: 90dvh;
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
}

dialog.dialog-xl {
  max-inline-size: min(1020px, 96vw);
}

/* Style the backdrop to indicate the dialog is modal */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-header {
  padding: 16px 20px;
  border-block-end: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  position: sticky;
  inset-block-start: 0;
  z-index: 5;
}

.dialog-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.dialog-body {
  padding: 20px;
  overflow-y: auto;
  max-block-size: calc(90dvh - 130px);
}

.dialog-footer {
  padding: 14px 20px;
  border-block-start: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Invoice Builder Workspace (myBillBook Voucher Entry Layout)
   ========================================================================== */
.invoice-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-block-end: 16px;
}

.line-items-table input,
.line-items-table select {
  padding: 6px 8px;
  font-size: 12.5px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  inline-size: 100%;
}

.invoice-summary-split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 24px;
  margin-block-start: 20px;
}

.totals-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
}

.totals-row.grand-total {
  border-block-start: 2px solid var(--text-main);
  margin-block-start: 8px;
  padding-block-start: 12px;
  font-size: 17px;
  font-weight: 800;
  color: var(--brand-primary);
}

/* Filter Bar & Tabs */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-block-end: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.tab-pills {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: var(--radius-sm);
  gap: 3px;
  flex-wrap: wrap;
}

.tab-pill {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 5px;
  cursor: pointer;
}

.tab-pill.active {
  background: #ffffff;
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Printable A4 GST Tax Invoice Paper
   ========================================================================== */
.invoice-paper {
  background: #ffffff;
  color: #0f172a;
  padding: 32px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-inline-size: 840px;
  margin: 0 auto;
  font-size: 12.5px;
  line-height: 1.45;
}

.invoice-paper.theme-thermal {
  max-inline-size: 340px;
  font-family: var(--font-mono);
  padding: 18px;
}

.inv-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-block-end: 2px solid var(--brand-primary);
  padding-block-end: 16px;
  margin-block-end: 16px;
}

.inv-party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-block-end: 16px;
}

.inv-party-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 14px;
}

.inv-table {
  inline-size: 100%;
  border-collapse: collapse;
  margin-block-end: 16px;
}

.inv-table th {
  background: var(--brand-primary);
  color: #ffffff;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  border: 1px solid var(--brand-primary);
}

.inv-table td {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.hsn-summary-table {
  inline-size: 100%;
  border-collapse: collapse;
  margin-block-top: 12px;
  font-size: 11px;
}

.hsn-summary-table th,
.hsn-summary-table td {
  border: 1px solid #cbd5e1;
  padding: 5px 8px;
}

.hsn-summary-table th {
  background: #f1f5f9;
  color: #334155;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  inset-block-end: 20px;
  inset-inline-end: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  border-inline-start: 4px solid #10b981;
}

/* Embedded Mode inside workspace.ajath.com */
body.embed-mode .workspace-return-banner {
  display: none !important;
}

.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  text-decoration: none;
}

.ws-badge:hover {
  background: #d1fae5;
}

/* ==========================================================================
   myBillBook Exact Dashboard, Parties & Tabbed Party Modal Styles
   ========================================================================== */
.myb-promo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-block-end: 22px;
}

.myb-promo-card {
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.myb-promo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.myb-promo-card.promo-orange {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

.myb-promo-card.promo-green {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.myb-promo-card.promo-blue {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.myb-promo-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.myb-promo-desc {
  font-size: 12.5px;
  color: #475569;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.myb-promo-link {
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.myb-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 12px;
}

.myb-overview-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.myb-last-update {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #475569;
}

.myb-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-block-end: 22px;
}

.myb-overview-card {
  border-radius: 10px;
  padding: 18px 20px;
  position: relative;
  border: 1px solid transparent;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.myb-overview-card:hover {
  box-shadow: var(--shadow-md);
}

.myb-overview-card.card-collect {
  background: linear-gradient(135deg, #eefbf3 0%, #f8fafc 100%);
  border-color: #bbf7d0;
}

.myb-overview-card.card-pay {
  background: linear-gradient(135deg, #fef2f2 0%, #f8fafc 100%);
  border-color: #fecaca;
}

.myb-overview-card.card-cash {
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
  border-color: #bae6fd;
}

.myb-overview-label {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-block-end: 8px;
}

.myb-overview-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

/* Scan & Record Bills (Mira AI) Widget */
.myb-scan-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.myb-scan-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  margin: 14px 0;
}

.myb-scan-tab {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.myb-scan-tab.active {
  background: #ffffff;
  color: #ea580c;
  box-shadow: var(--shadow-sm);
}

.myb-dropzone {
  background: #fff7ed;
  border: 1.5px dashed #fb923c;
  border-radius: 10px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.myb-dropzone:hover {
  background: #ffedd5;
}

/* Parties View Styles (Screenshot 2) */
.myb-sharedledger-banner {
  background: linear-gradient(90deg, #1e1b18 0%, #44403c 55%, #1c1917 100%);
  color: #ffffff;
  border-radius: 10px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-block-end: 18px;
}

.myb-party-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-block-end: 16px;
}

.myb-party-summary-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.myb-party-summary-card.active {
  border: 1.5px solid #4c3cce;
  background: #f5f3ff;
}

.myb-bulk-upload-card {
  background: linear-gradient(90deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-block-start: 18px;
}

/* Create New Party Multi-Tab Modal (Screenshots 3 & 4) */
dialog.dialog-party {
  max-inline-size: min(820px, 95vw);
}

.myb-party-modal-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-block-size: 430px;
}

.myb-party-modal-sidebar {
  border-inline-end: 1px solid var(--border-color);
  padding: 16px 12px;
  background: #ffffff;
}

.myb-party-modal-tab {
  inline-size: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-align: start;
  margin-block-end: 4px;
}

.myb-party-modal-tab:hover {
  background: #f8fafc;
}

.myb-party-modal-tab.active {
  background: #ede9fe;
  color: #4c3cce;
  font-weight: 700;
}

.myb-party-modal-section-label {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  padding: 14px 12px 8px;
}

.myb-party-modal-content {
  padding: 20px 24px;
  background: #f8fafc;
  overflow-y: auto;
  max-block-size: 68dvh;
}

.myb-party-form-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  margin-block-end: 14px;
}

.myb-radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.myb-radio-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #ffffff;
}

.myb-radio-card:has(input:checked) {
  border-color: #4c3cce;
  background: #f5f3ff;
  color: #4c3cce;
  font-weight: 600;
}

.myb-dashed-shipping-btn {
  inline-size: 100%;
  background: #f8fafc;
  border: 1.5px dashed #93c5fd;
  color: #0284c7;
  font-weight: 600;
  font-size: 13px;
  padding: 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.myb-dashed-shipping-btn:hover {
  background: #eff6ff;
}

@media (max-width: 960px) {
  .myb-promo-grid,
  .myb-overview-grid,
  .myb-party-summary-grid,
  .myb-party-modal-layout {
    grid-template-columns: 1fr;
  }
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset-inline-start: -280px;
    inline-size: 260px;
    transition: inset-inline-start 0.25s ease;
  }

  .app-sidebar.open {
    inset-inline-start: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .dashboard-grid,
  .invoice-summary-split,
  .inv-party-grid {
    grid-template-columns: 1fr;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
  }

  .app-sidebar,
  .top-header,
  .workspace-body,
  .dialog-header,
  .dialog-footer,
  .no-print,
  .toast-container {
    display: none !important;
  }

  dialog[open] {
    position: static !important;
    max-inline-size: 100% !important;
    max-block-size: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  dialog[open] .dialog-body {
    padding: 0 !important;
    max-block-size: none !important;
    overflow: visible !important;
  }

  .invoice-paper {
    border: none !important;
    padding: 0 !important;
    max-inline-size: 100% !important;
  }
}

