/* Epari Govindam — Flow Prototype
   Neutral ERP chrome · purple brand only on mark / nav / primary CTA */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Cormorant+Garamond:wght@600&display=swap");

:root {
  --purple-950: #2c1848;
  --purple-900: #3d2463;
  --purple-800: #5b3d8a;
  --purple-700: #6f4fa3;
  --purple-100: #ebe4f5;
  --purple-50: #f7f5fb;

  --gold-300: #c9a84a;
  --gold-400: #b8952f;
  --gold-500: #a68528;
  --gold-600: #8f7222;
  --gold-700: #6e5719;

  /* Content must beat chrome — near-black on white */
  --ink: #14161a;
  --ink-soft: #3d4450;
  --ink-muted: #5c6570;
  --line: #e2e5ea;
  --line-strong: #cdd2d9;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-hover: #eef0f3;
  --danger: #b42318;
  --ok: #17663f;
  --warn: #8a5a00;

  --sidebar-w: 252px;
  --topbar-h: 52px;
  --touch: 40px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface-2);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ——— Shell ——— */
.app {
  display: none;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  transition: grid-template-columns 0.28s ease;
}

html.is-authed .app,
body.is-authed .app {
  display: grid;
}

.app[hidden] {
  display: none !important;
}

.app.nav-collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar-backdrop {
  display: none;
}

/* ——— Sidebar ——— */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-w);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  overflow: hidden;
  z-index: 40;
  transition: transform 0.28s ease, opacity 0.2s ease;
}

.app.nav-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  border-right: 0;
}

.sidebar::before {
  display: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--surface);
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: var(--ink-soft);
  background: var(--surface-2);
  border-color: var(--line);
}

.sidebar-close:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--ink);
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}

html.brand-jweligree .brand {
  flex-wrap: wrap;
  align-items: flex-start;
}

html.brand-jweligree .brand img {
  width: 100%;
  height: auto;
  max-height: none;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: none;
}

html.brand-jweligree .brand-text {
  width: 100%;
}

html.brand-jweligree .brand-text strong {
  display: none;
}

html.brand-jweligree .sidebar-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.brand-text {
  min-width: 0;
}

.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--purple-900);
  line-height: 1.15;
}

.brand-text span {
  display: block;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 2px;
}

.nav-scroll {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 16px;
  background: var(--surface);
}

.nav-group {
  margin-bottom: 12px;
}

.nav-label {
  padding: 8px 12px 4px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  margin: 1px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.active {
  background: var(--purple-50);
  color: var(--purple-800);
  box-shadow: inset 2px 0 0 var(--purple-700);
  font-weight: 500;
}

.nav-item .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  flex-shrink: 0;
}

.nav-item.active .dot {
  opacity: 1;
  background: var(--purple-700);
  box-shadow: none;
}

.sidebar-foot {
  position: relative;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  color: var(--ink-muted);
  background: var(--surface-2);
}

.shop-book {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.7rem;
}

.shop-book select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

.sidebar-foot strong {
  display: block;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar-foot-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

html:not(.brand-jweligree) .jwe-only {
  display: none;
}

.sidebar-foot-actions .btn {
  width: 100%;
  justify-content: center;
}

/* ——— Main ——— */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.title-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.topbar-left h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--purple-900);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}

.menu-toggle .icon-menu {
  display: none;
}

.menu-toggle .icon-collapse {
  display: block;
}

.app.nav-collapsed .menu-toggle .icon-menu {
  display: block;
}

.app.nav-collapsed .menu-toggle .icon-collapse {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink-muted);
  border: 1px solid var(--line);
}

.rates {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rates::-webkit-scrollbar {
  display: none;
}

.rate-chip {
  display: flex;
  flex-direction: column;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  min-width: 88px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.rate-chip em {
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 1;
}

.rate-chip strong {
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.content {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1280px;
}

.view {
  display: none;
  animation: fadeIn 0.28s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ——— Typographic helpers ——— */
.lede {
  margin: 0 0 20px;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 400;
}

.section-title {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.section-sub {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.gold-rule {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
  opacity: 1;
}

/* ——— Journey map ——— */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.journey-card {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  text-align: left;
  width: 100%;
}

.journey-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(20, 22, 26, 0.06);
}

.journey-card .num {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  line-height: 1;
  margin-bottom: 8px;
}

.journey-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.journey-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 400;
}

/* ——— Scheme master cards ——— */
.scheme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.scheme-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, transform 0.15s;
  font: inherit;
  color: inherit;
}

.scheme-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(20, 22, 26, 0.06);
}

.scheme-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.scheme-card-top h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.scheme-card-meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.scheme-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.scheme-metric {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.scheme-metric em {
  display: block;
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.scheme-metric strong {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.scheme-metric.gold strong {
  color: var(--gold-700, #8a6d1d);
}

.scheme-card-foot {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

@media (max-width: 640px) {
  .scheme-grid {
    grid-template-columns: 1fr;
  }
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin: 8px 0 24px;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.flow-step:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--ink);
}

.flow-step.active {
  border-color: var(--purple-700);
  background: var(--purple-50);
  color: var(--purple-900);
  font-weight: 500;
}

.flow-step .n {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 600;
  flex-shrink: 0;
}

.flow-step.active .n {
  background: var(--purple-100);
  color: var(--purple-800);
}

.flow-arrow {
  color: var(--ink-muted);
  font-size: 0.9rem;
  align-self: center;
  opacity: 0.8;
}

/* ——— Panels / forms ——— */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.panel-body {
  padding: 18px;
}

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
}

.meta-bar span {
  opacity: 1;
  margin-right: 4px;
  color: var(--ink-muted);
}

.meta-bar strong {
  font-weight: 500;
  color: var(--ink);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 16px;
}

.form-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field.span-2 {
  grid-column: span 2;
}

.field.span-3 {
  grid-column: span 3;
}

.field.span-4 {
  grid-column: span 4;
}

.field label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.field input[readonly] {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.field textarea {
  min-height: 64px;
  resize: vertical;
}

/* ——— Tables ——— */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

table.data th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--surface-2);
  white-space: nowrap;
  border: none;
  border-bottom: 1px solid var(--line);
}

table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tbody tr:hover td {
  background: var(--surface-hover);
}

table.data tbody tr.is-selected td {
  background: var(--surface-2);
}

table.data tbody tr.is-clickable {
  cursor: pointer;
}

table.data tfoot td {
  padding: 10px 12px;
  font-weight: 600;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  color: var(--ink);
}

table.data .num {
  text-align: right;
}

table.data .muted {
  color: var(--ink-muted);
}

table.data td input,
table.data td select {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

table.data td.num input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data td input:focus,
table.data td select:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

table.data tr.account-extra td {
  padding-top: 0;
  background: var(--bg-soft, #f6f7f9);
}

table.data .account-extra-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 0 0 8px;
}

table.data .account-extra-grid .field label {
  font-size: 0.68rem;
}

.accounts-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.accounts-toolbar .section-sub {
  flex: 1;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 26, 0.45);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  max-height: min(92vh, 92dvh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(20, 22, 26, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-body {
  padding: 16px;
}

.modal-dialog .form-grid {
  grid-template-columns: 1fr 1fr;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

/* ——— Split layouts ——— */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.split-sidebar {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

/* ——— Responsive: tablet ——— */
@media (max-width: 1100px) {
  .topbar {
    padding: 8px 16px;
    flex-wrap: wrap;
  }

  .rates {
    width: 100%;
    order: 3;
    justify-content: flex-start;
    padding-bottom: 2px;
  }

  .content {
    padding: 18px 16px 32px;
  }

  .journey-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 960px) {
  .split-2,
  .split-sidebar,
  .form-grid.cols-4,
  .form-grid,
  .modal-dialog .form-grid,
  table.data .account-extra-grid {
    grid-template-columns: 1fr;
  }

  .accounts-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .accounts-toolbar .btn {
    align-self: flex-start;
  }

  .field.span-2,
  .field.span-3,
  .field.span-4 {
    grid-column: span 1;
  }

  .app,
  .app.nav-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    opacity: 1;
    pointer-events: auto;
    box-shadow: 4px 0 24px rgba(42, 45, 52, 0.12);
  }

  .app.nav-collapsed .sidebar {
    transform: translateX(-105%);
    opacity: 1;
    pointer-events: auto;
  }

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

  .app.nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(42, 45, 52, 0.28);
    backdrop-filter: blur(1px);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .menu-toggle .icon-menu {
    display: block;
  }

  .menu-toggle .icon-collapse {
    display: none;
  }

  .app.nav-open .menu-toggle .icon-menu {
    display: none;
  }

  .app.nav-open .menu-toggle .icon-collapse {
    display: block;
  }

  body.nav-lock {
    overflow: hidden;
  }

  .nav-item {
    min-height: var(--touch);
    padding: 12px 14px;
  }

  .journey-grid {
    grid-template-columns: 1fr;
  }

  .stat-row {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-left h1 {
    font-size: 1.25rem;
  }

  .flow-steps {
    flex-direction: column;
    align-items: stretch;
  }

  .flow-arrow {
    display: none;
  }

  .flow-step {
    min-height: var(--touch);
  }

  .actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 12px;
    gap: 8px;
    box-shadow: 0 -6px 20px rgba(42, 10, 74, 0.06);
  }

  .actions .btn {
    flex: 1 1 calc(50% - 8px);
    min-height: var(--touch);
    padding: 12px 14px;
  }

  .meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .table-wrap {
    margin-inline: -4px;
    border-radius: var(--radius-sm);
  }

  table.data {
    font-size: 0.74rem;
  }

  table.data th,
  table.data td {
    padding: 10px 8px;
  }

  .proto-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-body {
    padding: 14px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: var(--touch);
    padding: 10px 12px;
    font-size: 16px; /* avoid iOS zoom */
  }

  .field textarea {
    min-height: 72px;
  }
}

@media (max-width: 480px) {
  .stat-row {
    grid-template-columns: 1fr;
  }

  .badge {
    display: none;
  }

  .rate-chip {
    min-width: 78px;
    padding: 5px 8px;
  }

  .rate-chip strong {
    font-size: 0.74rem;
  }

  .actions .btn {
    flex: 1 1 100%;
  }

  .content {
    padding: 14px 12px 28px;
  }
}

/* ——— Actions ——— */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
}

.settings-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 10px 14px 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
}

.settings-tab:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.settings-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--purple-700);
  background: transparent;
}

.settings-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

@media (max-width: 960px) {
  .settings-tab {
    flex: 1 1 auto;
    text-align: center;
    padding: 12px 10px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--purple-700);
  color: #fff;
  border-color: var(--purple-700);
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--purple-800);
  border-color: var(--purple-800);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--surface-hover);
}

.btn-danger {
  background: #fff;
  border-color: #f0c4c0;
  color: var(--danger);
}

.btn-purple {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-purple:hover {
  background: var(--surface-hover);
  border-color: var(--ink-muted);
}

/* ——— Callouts ——— */
.callout {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.callout strong {
  color: var(--ink);
}

.callout.policy {
  background: var(--surface-2);
  border-color: var(--line);
}

.scheme-math {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.leftover-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.leftover-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leftover-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.leftover-option:has(input:checked) {
  border-color: var(--purple, #6b4ce6);
  background: rgba(107, 76, 230, 0.06);
}

.leftover-option strong {
  color: var(--ink);
  display: block;
}

.leftover-option input {
  margin-top: 3px;
}

/* ——— Customer identity (mobile / PAN) ——— */
.identity-panel {
  margin: 0 0 16px;
}

.identity-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.identity-card.ok {
  background: rgba(23, 102, 63, 0.06);
  border-color: rgba(23, 102, 63, 0.22);
}

.identity-card.warn {
  background: rgba(176, 70, 40, 0.05);
  border-color: #e8c8bc;
}

#rg-metal-remaining.warn {
  color: #b44628;
}

.identity-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.identity-lead {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--ink);
}

.identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.identity-blockers {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.identity-blockers:empty {
  display: none;
}

.identity-blockers li {
  margin: 2px 0;
}

.identity-past {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--surface-2);
}

.identity-past.hidden {
  display: none;
}

.identity-past-list {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.identity-past-list li {
  margin: 2px 0;
}

.identity-past-list button {
  margin-left: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.stat em {
  display: block;
  font-style: normal;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stat strong {
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.stat.gold strong {
  color: var(--ink);
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.tag.gold {
  background: #faf6ea;
  color: var(--gold-700);
  border-color: #e8dfc4;
}

.tag.ok {
  background: rgba(23, 102, 63, 0.1);
  color: var(--ok);
  border-color: rgba(23, 102, 63, 0.22);
}

.tag.past {
  background: #f3efe6;
  color: #7a6540;
  border-color: #e4d9c4;
}

.tag.overdue {
  background: rgba(176, 42, 55, 0.1);
  color: var(--danger, #b02a37);
  border-color: rgba(176, 42, 55, 0.22);
}

.tag.due {
  background: #faf6ea;
  color: var(--gold-700);
  border-color: #e8dfc4;
}

.tag.type-create {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.tag.type-change {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.tag.type-remove {
  background: rgba(176, 42, 55, 0.1);
  color: var(--danger, #b02a37);
  border-color: rgba(176, 42, 55, 0.22);
}

.tag.type-post,
.tag.type-publish {
  background: #faf6ea;
  color: var(--gold-700);
  border-color: #e8dfc4;
}

.tag.type-print,
.tag.type-transfer {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.tag.type-access {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.log-filter-bar {
  flex-wrap: wrap;
  row-gap: 8px;
}

.log-summary {
  max-width: 420px;
}

.log-summary .muted {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
}

/* Purchase type badges — distinct, readable, not purple wash */
.tag.type-ornament {
  background: #eef4fb;
  color: #1a4a7a;
  border-color: #c5d6ea;
}

.tag.type-bullion {
  background: #faf6ea;
  color: var(--gold-700);
  border-color: #e8dfc4;
}

.tag.type-oldgold {
  background: #f3efe9;
  color: #6b4423;
  border-color: #dcc9b4;
}

.purchase-row.type-ornament td:first-child {
  box-shadow: inset 3px 0 0 #3b7cb8;
}

.purchase-row.type-bullion td:first-child {
  box-shadow: inset 3px 0 0 var(--gold-500);
}

.purchase-row.type-oldgold td:first-child {
  box-shadow: inset 3px 0 0 #a67c52;
}

.ledger-note {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.ledger-note code {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ——— Party list ——— */
.party-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.party-list li {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.party-list li:hover,
.party-list li.selected {
  background: var(--surface-hover);
}

.party-list li:last-child {
  border-bottom: none;
}

.party-list strong {
  display: block;
  font-size: 0.85rem;
  color: var(--ink);
}

.party-list span {
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* ——— Proto banner ——— */
.proto-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 18px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.85rem;
  border: 1px solid var(--line);
}

.proto-banner strong {
  color: var(--ink);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* ——— Roles & access ——— */
.role-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.preview-field {
  min-width: 220px;
}

.role-toolbar-hint {
  margin: 0;
  flex: 1;
  min-width: 200px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 400;
}

.role-layout {
  align-items: start;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.72rem;
  min-height: auto;
}

.perm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.perm-bulk {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.perm-matrix {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perm-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.perm-group-head strong {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.perm-group-head label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.perm-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) repeat(4, minmax(64px, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.perm-row:last-child {
  border-bottom: none;
}

.perm-row-label {
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 500;
}

.perm-check {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.perm-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--purple-800);
  cursor: pointer;
}

.perm-check.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.nav-group.is-hidden {
  display: none;
}

.nav-item.is-hidden {
  display: none;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 80;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  font-size: 0.82rem;
  box-shadow: 0 4px 16px rgba(42, 45, 52, 0.16);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

@media (max-width: 960px) {
  .perm-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .perm-row-label {
    grid-column: 1 / -1;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--line);
  }

  .role-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .preview-field {
    min-width: 0;
  }

  .pipeline-board {
    flex-wrap: wrap;
  }

  .pending-table th,
  .pending-table td {
    font-size: 0.72rem;
  }
}

/* ——— Pending queues / product pipeline ——— */
.pipeline-board {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.pipe-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  min-width: 72px;
  transition: border-color 0.15s, background 0.15s;
}

.pipe-chip em {
  font-style: normal;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.pipe-chip strong {
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.pipe-chip.has-work {
  border-color: var(--line-strong);
  background: #fff;
  box-shadow: inset 0 -2px 0 var(--gold-500);
}

.pipe-chip.has-work strong {
  color: var(--ink);
}

.pipe-chip:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.queue-mount {
  margin-bottom: 4px;
}

.pending-panel {
  margin: 0;
}

.pending-table tr.is-selected {
  background: var(--surface-hover);
}

.barcode-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  letter-spacing: 0.02em;
}

.data tbody tr[data-id] {
  cursor: pointer;
}

.data tbody tr.is-selected {
  background: var(--surface-hover);
}

table.data tr.clickable {
  cursor: pointer;
}

table.data tr.clickable:hover td {
  background: var(--surface-hover);
}

.pending-table tr.is-clickable {
  cursor: pointer;
}

.pending-table tr.is-clickable:hover td {
  background: var(--surface-hover);
}

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

.list-toolbar-end {
  justify-content: flex-end;
}

.filter-select {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  min-width: 160px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-head-actions .filter-select {
  min-width: 140px;
  padding: 6px 28px 6px 10px;
  font-size: 0.8rem;
}

.filter-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-date {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  min-width: 132px;
}

.filter-date:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.filter-text {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  min-width: 180px;
}

.filter-text:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.ac-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ac-wrap .ac-field {
  margin: 0;
}

.ac-wrap-block {
  display: block;
  width: 100%;
}

.ac-wrap-block input {
  width: 100%;
  box-sizing: border-box;
}

.ac-option.is-create {
  font-weight: 600;
  color: var(--purple-800);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.ac-option .ac-meta {
  color: var(--ink-soft);
  font-weight: 400;
}

.ac-empty {
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

#ig-goldsmith-suggestions,
#party-ledger-suggestions {
  max-height: 320px;
}

#party-ledger-ac {
  min-width: 260px;
}

.ac-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  padding: 6px 4px 2px;
  border-top: 1px solid var(--line);
}

.ac-pager-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.ac-pager-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.ac-pager-btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

.ac-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.ig-create-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.ig-create-actions .ledger-note {
  flex: 1 1 100%;
  margin: 0;
}

.ac-clear {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.ac-clear:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 220px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 22, 26, 0.1);
  padding: 4px;
}

.ac-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}

.ac-option:hover,
.ac-option.is-active {
  background: var(--surface-hover);
}

.purchase-type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

@media (max-width: 800px) {
  .purchase-type-bar {
    width: 100%;
  }

  .purchase-type-bar .btn {
    flex: 1 1 auto;
  }
}

.detail-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.detail-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.detail-section {
  margin: 20px 0 10px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.detail-section:first-child {
  margin-top: 0;
}

.pending-table .check-col {
  width: 36px;
  text-align: center;
}

.pending-empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.queue-help {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.55;
}

.queue-help li + li {
  margin-top: 8px;
}

.nav-item {
  position: relative;
}

.nav-count {
  margin-left: auto;
  min-width: 1.35rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.flow-step {
  position: relative;
}

.step-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.min-pcs-input {
  width: 5.5rem;
  max-width: 100%;
  text-align: right;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink);
}

.min-pcs-input:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.group-ledger-select {
  min-width: 11rem;
  max-width: 16rem;
  font-size: 0.8rem;
}

.item-ledger-overrides {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: #fff;
}

.item-ledger-overrides > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.item-ledger-overrides > summary .muted {
  font-weight: 400;
  font-size: 0.8rem;
}

.stock-min-table td,
.stock-min-table th {
  white-space: nowrap;
}

.stock-band-red td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}

.stock-band-amber td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}

.stock-band-green td:first-child {
  box-shadow: inset 3px 0 0 var(--ok);
}

.stock-band-grey td:first-child {
  box-shadow: inset 3px 0 0 var(--line-strong);
}

.stock-band-red {
  background: rgba(180, 35, 24, 0.04);
}

.stock-band-amber {
  background: rgba(138, 90, 0, 0.05);
}

.stock-band-green {
  background: rgba(23, 102, 63, 0.04);
}

.tag.band-red {
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.22);
}

.tag.band-amber {
  background: rgba(138, 90, 0, 0.12);
  color: var(--warn);
  border-color: rgba(138, 90, 0, 0.28);
}

.tag.band-green {
  background: rgba(23, 102, 63, 0.1);
  color: var(--ok);
  border-color: rgba(23, 102, 63, 0.22);
}

.tag.band-grey {
  background: var(--surface-2);
  color: var(--ink-muted);
}

.stock-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 12px 0 4px;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.stock-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.swatch-red { background: var(--danger); }
.swatch-amber { background: var(--warn); }
.swatch-green { background: var(--ok); }
.swatch-grey { background: var(--line-strong); }

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface-2);
}

html.is-authed .login-screen,
body.is-authed .login-screen,
html.session-restoring .login-screen,
.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: min(100%, 380px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.login-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.login-screen.brand-jweligree .login-logo {
  width: min(240px, 100%);
  height: auto;
  border-radius: 8px;
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
}

.login-sub {
  margin: 0 0 4px;
  color: var(--ink-muted);
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

@media (max-width: 960px) {
  .stock-legend {
    flex-direction: column;
    gap: 8px;
  }
}

/* ——— Ops dashboard ——— */
.dash-section {
  margin-bottom: 28px;
}

.dash-todos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-todo {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 16px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dash-todo:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.dash-todo-count {
  min-width: 2.4rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.dash-todo.is-high .dash-todo-count {
  background: #fdf2f1;
  border-color: #efc4c0;
  color: var(--danger);
}

.dash-todo-body strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.dash-todo-body span {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.dash-todo-go {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dash-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.dash-chart-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 160px;
}

.dash-chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.dash-chart-card .pipeline-board {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.dash-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
  padding-top: 8px;
}

.dash-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  height: 100%;
}

.dash-bar i {
  display: block;
  width: 100%;
  max-width: 28px;
  border-radius: 3px 3px 0 0;
  background: var(--gold-500);
  min-height: 2px;
}

.dash-bar em {
  font-style: normal;
  font-size: 0.62rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dash-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-donut {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.dash-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.dash-legend .swatch-red {
  background: var(--danger);
}

.dash-legend .swatch-amber {
  background: var(--warn);
}

.dash-legend .swatch-green {
  background: var(--ok);
}
