

/* =====================================================================
   PART 3 — CRM DASHBOARD (authenticated app)
   ---------------------------------------------------------------------
   B2. App shell
   B3. Sidebar (solid black)
   B4. Navbar (solid gray)
   B5. CRM footer (solid gray)
   B6. Quick actions
   B7. Stat grid
   B8. Grid + cards
   B9. Charts
   B10. Stock overview
   B11. Alerts
   B12. Tables
   B13. Sidebar backdrop (mobile)
   B14. Shared buttons
   B15. Select wrapper
   B16. Page toolbar
   B17. Customer cells / row actions
   B18. Table footer / pagination
   B19. Table empty state
   B20. Modal
   B21. Modal form
   B22. View / confirm bodies
   B23. Form helpers + toast
   B24. Flash messages
   B25. Invoice Cash page (line items, totals, view)
   B26. Read-only balance preview
   B27. Receipt mode cards — icon vertical centering
   ===================================================================== */


/* --- B2. App shell ----------------------------------------------- */
.crm-app {
  display: flex;
  min-height: 100vh;
  background: var(--body-bg);
}

.crm-main-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.crm-main {
  flex: 1 1 auto;
  padding: 26px 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}


/* --- B3. Sidebar (SOLID BLACK) ----------------------------------- */
.crm-sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: #000000;
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--sidebar-border);
  transition: width .25s cubic-bezier(.4,0,.2,1),
              flex-basis .25s cubic-bezier(.4,0,.2,1);
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand .brand-mark {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: center;
  line-height: 0;
}

.sidebar-brand .brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-self: center;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand .brand-text strong {
  display: block;
  font-size: 18.75px;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -.01em;
}

.sidebar-brand .brand-text em {
  display: block;
  font-style: normal;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #ffffff;
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--secondary-15);
  border-radius: 6px;
}

.nav-divider {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);   /* 2× brighter than --sidebar-border (0.12 → 0.25) */
  margin: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: background .18s ease, color .18s ease;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #ffffff; }
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, .85);
}
.nav-icon {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: .9;
}
.nav-label {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-chevron {
  display: grid; place-items: center;
  flex-shrink: 0;
  opacity: .55;
  transition: transform .22s ease;
}
.nav-group.open .nav-chevron { transform: rotate(180deg); }

.nav-sub {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0 6px 12px;
  margin-left: 18px;
  border-left: 1px solid var(--sidebar-border);
  margin-top: 2px;
}
.nav-group.open .nav-sub { display: flex; }

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.8px;
  color: var(--sidebar-text-dim);
  transition: background .18s, color .18s;
}
.nav-sub-item:hover { background: var(--sidebar-hover); color: #ffffff; }
.nav-sub-item.is-active {
  color: #ffffff;
  background: var(--secondary-12);
}

.nav-sub-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  flex-shrink: 0;
}
.nav-sub-item.is-active .nav-sub-dot {
  opacity: 1;
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--secondary-15);
}

.sidebar-foot {
  flex-shrink: 0;
  padding: 14px 22px;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-foot-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--sidebar-text-dim);
  white-space: nowrap;
}
.foot-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25), 0 0 10px rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

@media (min-width: 1101px) {
  .crm-sidebar.collapsed {
    width: var(--sidebar-w-compact);
    flex-basis: var(--sidebar-w-compact);
  }
  .crm-sidebar.collapsed .brand-text,
  .crm-sidebar.collapsed .nav-label,
  .crm-sidebar.collapsed .nav-chevron,
  .crm-sidebar.collapsed .sidebar-foot-text,
  .crm-sidebar.collapsed .nav-sub { display: none; }
  .crm-sidebar.collapsed .sidebar-brand { justify-content: center; padding: 20px 0; }
  .crm-sidebar.collapsed .nav-item { justify-content: center; padding: 11px 0; }
  .crm-sidebar.collapsed .nav-item.is-active::before { left: -6px; }
}


/* --- B4. Navbar (SOLID GRAY) ------------------------------------- */
.crm-navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: #676464;
  border-bottom: 1px solid var(--bar-border);
  color: #ffffff;
  flex-shrink: 0;
}

.nav-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  color: #ffffff;
  transition: background .18s;
}
.nav-toggle:hover { background: var(--secondary-08); }

.navbar-title { flex-shrink: 0; min-width: 0; }
.navbar-title h1 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -.01em;
  line-height: 1.2;
  white-space: nowrap;
}
.navbar-title p {
  font-size: 11.5px;
  color: var(--bar-text-muted);
  margin-top: 1px;
  white-space: nowrap;
}

.navbar-search {
  flex: 1 1 auto;
  max-width: 420px;
  position: relative;
  margin-left: auto;
}
.navbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--bar-text-muted);
  pointer-events: none;
}
.navbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: 9px;
  background: var(--bar-input-bg);
  border: 1px solid var(--bar-input-border);
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color .18s, background .18s;
}
.navbar-search input::placeholder { color: var(--bar-text-muted); }
.navbar-search input:focus {
  border-color: var(--secondary-50);
  background: var(--secondary-12);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  color: #ffffff;
  transition: background .18s;
}
.icon-btn:hover { background: var(--secondary-08); }
.badge-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #000000;
  box-shadow: 0 0 0 2px #676464, 0 0 8px rgba(0, 0, 0, .6);
}

/* ---- Fullscreen toggle (navbar) ---------------------------------
   White stroke icon (inherits .icon-btn color). The enter/exit icons
   swap via the .is-fullscreen class — only ONE icon is ever rendered,
   so the grid stays perfectly centered. Visible on every screen size. */
.icon-btn.fs-toggle svg { width: 20px; height: 20px; }

.icon-btn.fs-toggle .fs-icon {
  display: grid;
  place-items: center;
  line-height: 0;
}
.icon-btn.fs-toggle .fs-icon-exit { display: none; }
.icon-btn.fs-toggle.is-fullscreen .fs-icon-enter { display: none; }
.icon-btn.fs-toggle.is-fullscreen .fs-icon-exit  { display: grid; }

.user-menu { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 5px;
  border-radius: 100px;
  transition: background .18s;
}
.user-btn:hover { background: var(--secondary-08); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .40);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta strong {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}
.user-meta em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--bar-text-muted);
  white-space: nowrap;
}
.user-chevron { color: var(--bar-text-muted); display: grid; place-items: center; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 120;
}
.user-menu.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  transition: background .16s;
}
.user-dropdown a:hover { background: var(--primary-05); }
.user-dropdown a.danger { color: #000000; }
.user-dropdown a.danger:hover { background: var(--primary-12); }
.user-dropdown hr {
  border: 0;
  height: 1px;
  background: var(--card-border);
  margin: 5px 8px;
}


/* --- B5. CRM footer (SOLID GRAY) --------------------------------- */
.crm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 26px;
  background: #676464;
  border-top: 1px solid var(--bar-border);
  color: var(--bar-text-muted);
  font-size: 12.5px;
  flex-shrink: 0;
}
.footer-meta { color: var(--bar-text-muted); opacity: .75; }


/* --- B6. Quick actions ------------------------------------------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.qa-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  min-width: 0;
}
.qa-tile:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.qa-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #ffffff;
}
/* Quick Action icon tiles: dark background → keep icon strokes WHITE
   (specificity bumped to beat the later generic .tone-* rules) */
.qa-icon.tone-primary { background: #000000; color: #ffffff; }
.qa-icon.tone-success { background: #000000; color: #ffffff; }
.qa-icon.tone-warning { background: #676464; color: #ffffff; }
.qa-icon.tone-danger  { background: #000000; color: #ffffff; }
.qa-icon.tone-info    { background: #676464; color: #ffffff; }

.qa-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.qa-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qa-text em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tone-primary { background: var(--primary-08); color: #000000; }
.tone-success { background: var(--success-soft); color: #000000; }
.tone-warning { background: var(--warning-soft); color: #676464; }
.tone-danger  { background: var(--danger-soft);  color: #000000; }
.tone-info    { background: var(--info-soft);    color: #676464; }


/* --- B7. Stat grid ----------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  min-width: 0;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-15);
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #ffffff;
}
.stat-icon.tone-primary { background: #000000; }
.stat-icon.tone-success { background: #000000; }
.stat-icon.tone-warning { background: #676464; }
.stat-icon.tone-danger  { background: #000000; }
.stat-icon.tone-info    { background: #676464; }

.stat-body { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-top: 2px;
  letter-spacing: -.02em;
}
.stat-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--accent);
  min-width: 0;
}
.stat-foot span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend {
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.trend-up   { background: var(--success-soft); color: #000000; }
.trend-down { background: var(--danger-soft);  color: #000000; }
.trend-warn { background: var(--warning-soft); color: #676464; }


/* --- B8. Grid + cards -------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1.4fr 1fr; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  flex-wrap: wrap;
}
.card-head h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}
.card-head p { font-size: 12px; color: var(--accent); margin-top: 2px; }
.link-more {
  font-size: 12.5px;
  font-weight: 500;
  color: #676464;
  transition: opacity .18s, color .18s;
}
.link-more:hover { color: #000000; }

.card-body { padding: 8px 20px 20px; flex: 1 1 auto; min-width: 0; }
.card-body.no-pad { padding: 0; }

.legend { display: flex; gap: 14px; align-items: center; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}
.legend-item i.swatch-primary { background: #000000; }
.legend-item i.swatch-info    { background: #676464; }


/* --- B9. Charts -------------------------------------------------- */
.chart-wrap { padding: 4px 10px 6px 4px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .bar {
  transform-origin: center bottom;
  animation: barGrow .7s cubic-bezier(.2,.8,.2,1) both;
}
.chart-svg .bar-b { animation-delay: .08s; }
@keyframes barGrow {
  from { transform: scaleY(.05); opacity: .25; }
  to   { transform: scaleY(1);   opacity: 1; }
}

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 4px 20px 18px;
}
.donut-chart { flex: 0 0 200px; max-width: 200px; }
.donut-svg { width: 100%; height: auto; animation: donutIn .8s ease both; }
@keyframes donutIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

.donut-legend {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.donut-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .label { flex: 1 1 auto; }
.donut-legend strong { font-weight: 600; color: var(--text); font-size: 13.5px; }

.donut-legend .dot.dot-primary { background: #000000; }
.donut-legend .dot.dot-info    { background: #676464; }
.donut-legend .dot.dot-warning { background: #676464; }
.donut-legend .dot.dot-success { background: #000000; }


/* --- B10. Stock overview ----------------------------------------- */
.stock-wrap {
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stock-row { display: flex; flex-direction: column; gap: 7px; }
.stock-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}
.stock-label { color: var(--text-secondary); }
.stock-value { font-weight: 600; color: var(--text); }
.stock-bar {
  height: 8px;
  border-radius: 100px;
  background: var(--primary-08);
  overflow: hidden;
}
.stock-fill {
  display: block;
  height: 100%;
  border-radius: 100px;
  transition: width .9s cubic-bezier(.2,.8,.2,1);
}
.stock-fill.tone-success { background: #000000; }
.stock-fill.tone-warning { background: #676464; }
.stock-fill.tone-danger  { background: #000000; }

.stock-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--grid-line);
  margin-top: 6px;
}
.stock-summary div { display: flex; flex-direction: column; align-items: center; }
.stock-summary strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.stock-summary span { font-size: 11.5px; color: var(--accent); margin-top: 2px; }


/* --- B11. Alerts ------------------------------------------------- */
.alerts-card .card-body { padding: 4px 20px 20px; }
.alerts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.alert-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  background: #ffffff;
  align-items: flex-start;
}
.alert-item .alert-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.alert-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-text strong { font-size: 13px; font-weight: 600; color: var(--text); }
.alert-text span { font-size: 12px; color: var(--accent); line-height: 1.4; }

.alert-item.tone-danger  { border-color: var(--danger-line);  background: var(--danger-soft); }
.alert-item.tone-warning { border-color: var(--warning-line); background: var(--warning-soft); }
.alert-item.tone-info    { border-color: var(--info-line);    background: var(--info-soft); }
.alert-item.tone-success { border-color: var(--success-line); background: var(--success-soft); }

.alert-item.tone-danger  .alert-icon { background: #000000; color: #ffffff; }
.alert-item.tone-warning .alert-icon { background: #676464; color: #ffffff; }
.alert-item.tone-info    .alert-icon { background: #676464; color: #ffffff; }
.alert-item.tone-success .alert-icon { background: #000000; color: #ffffff; }


/* --- B12. Tables ------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--card-border);
  background: var(--primary-05);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--grid-line);
  color: var(--text);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--primary-05); }
.data-table td.muted { color: var(--accent); }
.data-table td.num { text-align: right; }
.data-table th.num { text-align: right; }

.ref {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: #000000;
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.tone-primary { background: var(--primary-08);   color: #000000; }
.pill.tone-success { background: var(--success-soft); color: #000000; }
.pill.tone-warning { background: var(--warning-soft); color: #676464; }
.pill.tone-danger  { background: var(--danger-soft);  color: #000000; }
.pill.tone-info    { background: var(--info-soft);    color: #676464; }


/* --- B13. Sidebar backdrop (mobile) ------------------------------ */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 150;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }


/* --- B14. Shared buttons (CRM base) ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s, border-color .18s, color .18s,
              transform .12s, box-shadow .18s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: #000000;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  transition: background .18s, transform .12s, box-shadow .18s;
}
.btn-primary:hover {
  background: #676464;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--primary-30); color: var(--text); background: var(--primary-05); }

.btn-danger {
  background: #000000;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.btn-danger:hover {
  background: #676464;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}


/* --- B15. Select wrapper ----------------------------------------- */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: 40px;
  padding: 0 36px 0 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}
.select-wrap select:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px var(--primary-12);
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  background: no-repeat center / 14px 14px
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676464' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.select-wrap.sm select {
  height: 34px;
  padding: 0 30px 0 10px;
  border-radius: 8px;
  font-size: 12.5px;
}
.select-wrap.sm::after {
  right: 10px;
  width: 13px; height: 13px;
  background-size: 13px 13px;
}


/* --- B16. Page toolbar ------------------------------------------- */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.toolbar-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 380px;
}
.toolbar-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  pointer-events: none;
}
.toolbar-search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.toolbar-search input::placeholder { color: var(--accent); }
.toolbar-search input:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px var(--primary-12);
}
.toolbar-spacer { flex: 1 1 auto; }


/* --- B17. Customer cells / row actions --------------------------- */
.cust-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cust-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  flex-shrink: 0;
  background: #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .30);
}
.cust-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cust-meta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust-meta em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.act-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--accent);
  background: transparent;
  border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
  cursor: pointer;
}
.act-btn:hover { background: var(--primary-05); color: var(--text); }
.act-btn.act-view:hover { color: #676464; background: var(--info-soft); }
.act-btn.act-edit:hover { color: #000000; background: var(--primary-soft); }
.act-btn.act-del:hover  { color: #000000; background: var(--danger-soft); }


/* --- B18. Table footer / pagination ------------------------------ */
.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--card-border);
  background: var(--primary-05);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.table-foot .foot-left,
.table-foot .foot-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
}
.table-foot .foot-right { justify-content: flex-end; }
.table-foot .foot-center {
  flex: 0 0 auto;
  text-align: center;
  color: var(--text-secondary);
  white-space: nowrap;
}
.table-foot .foot-center strong { color: var(--text); font-weight: 600; }
.per-page-label { color: var(--text-secondary); white-space: nowrap; }

.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .16s, border-color .16s, color .16s;
}
.page-btn:hover:not(:disabled):not(.is-active) {
  border-color: var(--primary-30);
  color: #000000;
  background: var(--primary-05);
}
.page-btn.is-active {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .40);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis {
  min-width: 22px;
  text-align: center;
  color: var(--accent);
  font-weight: 600;
  user-select: none;
}


/* --- B19. Table empty state -------------------------------------- */
.table-empty {
  display: none;
  padding: 56px 20px;
  text-align: center;
  color: var(--accent);
}
.table-empty .empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--gradient-icon-soft);
  color: #676464;
}
.table-empty strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.table-empty span { font-size: 12.5px; }


/* --- B20. Modal -------------------------------------------------- */
.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.crm-modal.open { opacity: 1; visibility: visible; }

.crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.crm-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: calc(100vh - 40px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(.98);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.crm-modal.open .crm-modal-dialog { transform: translateY(0) scale(1); }
.crm-modal-dialog.modal-sm { max-width: 460px; }
.crm-modal-dialog.modal-lg { max-width: 780px; }

.crm-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}
.crm-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.crm-modal-title .modal-icon {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #ffffff;
}
.crm-modal-title .modal-icon.tone-primary { background: #000000; }
.crm-modal-title .modal-icon.tone-info    { background: #676464; }
.crm-modal-title .modal-icon.tone-danger  { background: #000000; }
.crm-modal-title .modal-icon.tone-success { background: #000000; }
.crm-modal-title .modal-icon.tone-warning { background: #676464; }

.crm-modal-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.2;
}
.crm-modal-title p { font-size: 12px; color: var(--accent); margin-top: 2px; }

.crm-modal-close {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--accent);
  transition: background .16s, color .16s;
  flex-shrink: 0;
  cursor: pointer;
}
.crm-modal-close:hover { background: var(--primary-05); color: var(--text); }

.crm-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-width: 0;
}

.crm-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--card-border);
  background: var(--primary-05);
  flex-shrink: 0;
}


/* --- B21. Modal form --------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-field.full { grid-column: 1 / -1; }
.form-field > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .01em;
}
.form-field > label .req { color: #000000; margin-left: 2px; }
.form-field > label .muted { font-weight: 400; color: var(--accent); }

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  font-family: inherit;
}
.form-field textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--accent); }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #000000;
  box-shadow: 0 0 0 3px var(--primary-12);
}

.form-field .select-wrap { width: 100%; }
.form-field .select-wrap select { width: 100%; }


/* --- B22. View / confirm bodies ---------------------------------- */
.view-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 12px;
  background: var(--gradient-soft);
  margin-bottom: 18px;
}
.view-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .02em;
  background: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.view-header-text { min-width: 0; }
.view-header-text h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.view-header-text p {
  font-size: 12.5px;
  color: var(--accent);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
}
.view-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.view-item.full { grid-column: 1 / -1; }
.view-item .view-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.view-item .view-value {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
  white-space: normal;
}
.view-item .view-value.muted { color: var(--accent); font-weight: 400; }

.confirm-body { display: flex; gap: 14px; align-items: flex-start; }
.confirm-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: #000000;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.confirm-text { min-width: 0; }
.confirm-text strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.confirm-text span {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* --- B23. Form helpers + toast ----------------------------------- */
.form-alert {
  grid-column: 1 / -1;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #000000;
  border: 1px solid var(--danger-line);
  font-size: 12.5px;
  font-weight: 500;
}

.field-error {
  font-size: 11.5px;
  color: #000000;
  font-weight: 500;
  margin-top: 2px;
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: #000000;
}

.form-field.has-error input:focus,
.form-field.has-error select:focus,
.form-field.has-error textarea:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.table-error {
  padding: 14px 20px;
  color: #000000;
  background: var(--danger-soft);
  border-bottom: 1px solid var(--danger-line);
  font-size: 12.5px;
}

#toastHost {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Toast: SOLID WHITE surface, BLACK border, BLACK text --------
   No transparency, no glass/blur, no tinted translucent backgrounds. */
.crm-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #000000;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: #000000;
  max-width: 360px;
  animation: toastIn .22s ease;
}

.crm-toast .toast-close {
  margin-left: auto;
  opacity: .55;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: 0;
  color: inherit;
  padding: 0 4px;
}
.crm-toast .toast-close:hover { opacity: 1; }

/* Tone variants keep the EXACT same solid white surface, black border
   and black text — only the inner icon carries the tone colour. */
.crm-toast.tone-success,
.crm-toast.tone-danger,
.crm-toast.tone-warning,
.crm-toast.tone-info {
  background: #ffffff;
  border-color: #000000;
  color: #000000;
}

.crm-toast.tone-success .toast-icon { color: #000000; }
.crm-toast.tone-danger  .toast-icon { color: #000000; }
.crm-toast.tone-warning .toast-icon { color: #676464; }
.crm-toast.tone-info    .toast-icon { color: #676464; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}


/* --- B24. Flash messages ----------------------------------------- */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.flash::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.flash-success { background: var(--success-soft); border-color: var(--success-line); color: #000000; }
.flash-danger  { background: var(--danger-soft);  border-color: var(--danger-line);  color: #000000; }
.flash-warning { background: var(--warning-soft); border-color: var(--warning-line); color: #676464; }
.flash-info    { background: var(--info-soft);    border-color: var(--info-line);    color: #676464; }


/* =====================================================================
   B25. INVOICE CASH PAGE  —  items grid, add-row dropdown, totals, view
   ---------------------------------------------------------------------
   The line-items grid is tuned to fit entirely inside the invoice modal
   WITHOUT any horizontal scrollbar (modal is 775px wide, minus 20px
   modal-body padding on each side = 735px of usable width).
   ===================================================================== */

/* Modal size for invoice forms (25% wider than default) */
.crm-modal-dialog.modal-invoice { max-width: 775px; }

/* ---- Line items grid ---- */
.items-wrap {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  overflow: hidden;
}
.items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}
.items-table thead th {
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 9px 6px;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
.items-table tbody td {
  padding: 4px 3px;
  border-bottom: 1px solid var(--grid-line);
  vertical-align: middle;
}
.items-table tbody tr:last-child td { border-bottom: none; }
.items-table .sr-cell {
  text-align: center;
  color: var(--accent);
  font-weight: 600;
}

/* Column widths — tuned so the whole grid fits inside the 775px modal */
.items-table .col-sr          { width: 32px; text-align: center; }
.items-table .col-date        { width: 116px; }
.items-table .col-particular  { width: auto; }
.items-table .col-qty         { width: 64px; }
.items-table .col-rate        { width: 82px; }
.items-table .col-amount      { width: 96px; text-align: right; }
.items-table .items-actions-th{ width: 60px; }

.items-table input[type="text"],
.items-table input[type="number"],
.items-table input[type="date"] {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 6px;
  border-radius: 6px;
  font: inherit;
  color: inherit;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.items-table input:hover { border-color: var(--card-border); }
.items-table input:focus {
  border-color: #000000;
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-12);
}
.items-table .it-amount {
  text-align: right;
  padding-right: 8px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* ---- Row action cell: [+] before [trash], compact ---- */
.items-table .row-actions-cell {
  white-space: nowrap;
  text-align: right;
  padding-right: 4px;
}
.items-table .row-add,
.items-table .row-del {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  vertical-align: middle;
}
.items-table .row-add { margin-right: 2px; }
.items-table .row-add:hover {
  background: var(--primary-05);
  color: #000000;
  border-color: var(--primary-15);
}
.items-table .row-del:hover {
  background: var(--primary-08);
  color: #000000;
  border-color: var(--primary-20);
}

/* ---- Add-row split button + dropdown ---- */
.items-foot {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}
.add-row-group {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.add-row-group #addItemBtn {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.add-row-group .add-row-toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
  padding: 0 8px;
  min-width: 30px;
}
.add-row-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 150px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 6;
}
.add-row-menu[hidden] { display: none; }
.add-row-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.add-row-menu button:hover { background: var(--primary-05); color: #000000; }

.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

/* ---- Totals ---- */
.totals-wrap { margin-top: 16px; display: flex; justify-content: flex-end; }
.totals-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface-2);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.totals-row + .totals-row { border-top: 1px dashed var(--grid-line); }
.totals-row .val {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}
.totals-row.grand {
  border-top: 2px solid var(--card-border);
  margin-top: 4px;
  padding-top: 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}
.totals-row.grand .val { font-size: 16px; color: #000000; }

/* ---- Amount in words box (used by the View modal only) ---- */
.words-box {
  margin-top: 14px;
  padding: 11px 14px;
  background: var(--primary-05);
  border: 1px dashed var(--primary-20);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.words-box strong {
  display: block;
  font-size: 10.5px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

/* ---- Form section title ---- */
.form-section-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin: 4px 0 0;
}
.form-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grid-line);
}

/* ---- View modal ---- */
.view-invoice-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--grid-line);
}
.view-invoice-head h4 { margin: 0 0 4px; font-size: 17px; color: var(--text); }
.view-invoice-head p  { margin: 0; font-size: 12.5px; color: var(--accent); }
.view-invoice-head .no { text-align: right; }
.view-invoice-head .no strong { display: block; font-size: 18px; letter-spacing: .4px; color: var(--text); }
.view-invoice-head .no span   { font-size: 12px; color: var(--accent); }

.view-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}
.view-items th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10.5px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--surface-2);
  border-bottom: 1px solid var(--card-border);
}
.view-items td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--grid-line);
  vertical-align: top;
}
.view-items td.num,
.view-items th.num { text-align: right; font-variant-numeric: tabular-nums; }
.view-items tr:last-child td { border-bottom: none; }


/* =====================================================================
   B26. READ-ONLY BALANCE PREVIEW
   ---------------------------------------------------------------------
   Scope: the "Entered Amount − Due Amount = Pending Amount" strip
   used inside the New/Edit Receipt dialog. It is a display-only
   calculation, so the whole block is greyed out and marked
   read-only (cursor: not-allowed, no pointer events, no text
   selection).

   Typography (scale 1.25× — 0.10 less than the previous 1.35×):
     • Headers  : 10.5px → 13.125px   (center-aligned)
     • Values   : 13px   → 16.25px    (center-aligned under heading)
     • Operators: − and = centered
     • All use clamp() so they scale down smoothly on narrow
       viewports and never cause horizontal scrolling.

   Colors come from the theme tokens already defined in :root
   (--accent, --surface-2, --card-border) so the design theme is
   preserved exactly.
   ===================================================================== */

.items-wrap.readonly-balance {
  background: var(--surface-2);
  border-color: var(--card-border);
  cursor: not-allowed;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  overflow: hidden;
}

/* ---- Headings: centered ---- */
.items-wrap.readonly-balance .items-table thead th {
  font-size: clamp(9px, 1.8vw, 13.125px);
  color: var(--accent);
  background: var(--surface-2);
  padding: 9px 6px;
  border-bottom-color: var(--card-border);
  text-align: center;
}

/* ---- Values: centered so each sits under its heading ---- */
.items-wrap.readonly-balance .items-table tbody td {
  font-size: clamp(10.5px, 2.22vw, 16.25px);
  color: var(--accent);
  background: var(--surface-2);
  padding: 8px 4px;
  border-bottom-color: var(--card-border);
  line-height: 1.2;
  text-align: center;
}

.items-wrap.readonly-balance .items-table .it-amount {
  color: var(--accent);
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.items-wrap.readonly-balance .items-table .sr-cell {
  color: var(--accent);
  text-align: center;
  opacity: 0.55;
  padding: 8px 2px;
}

/* Extra-tight viewports: keep the whole 5-column grid inside the
   modal without any horizontal overflow. */
@media (max-width: 480px) {
  .items-wrap.readonly-balance .items-table thead th {
    font-size: 8px;
    padding: 6px 3px;
  }
  .items-wrap.readonly-balance .items-table tbody td {
    font-size: 10.5px;
    padding: 6px 3px;
  }
  .items-wrap.readonly-balance .items-table .it-amount {
    padding-left: 3px;
    padding-right: 3px;
  }
}


/* =====================================================================
   B27. RECEIPT MODE CARDS — ICON VERTICAL CENTERING
   ---------------------------------------------------------------------
   Scope: the four "Cash", "Bank Transfer", "UPI" and "Cheque" filter
   cards on the Receipts page (each one carries a [data-mode-card]
   attribute). The icon tile is vertically centered inside the card,
   so it sits on the visual middle of the card instead of being
   top-aligned with the label / heading.

   The generic .stat-card rule above is untouched — the selector below
   is further scoped with [data-mode-card], so no other stat card in
   the app is affected.

   No horizontal overflow is introduced: only the cross-axis alignment
   of the existing flex row changes.
   ===================================================================== */
.stat-card[data-mode-card] {
  align-items: center;
}


