:root {
  --bg-page: #F6F6F3;
  --bg-card: #FFFFFF;
  --bg-subtle: #F1F1EC;
  --bg-hover: #EAEAE4;
  --border-light: #E5E5DF;
  --border-mid: #D1D1C8;
  --text-main: #181817;
  --text-body: #4A4A45;
  --text-muted: #76766F;

  --green-bg: #ECFDF5;
  --green-border: #A7F3D0;
  --green-text: #065F46;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --red-text: #991B1B;

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

/* =========================================================================
   UTILITIES & TYPOGRAPHY
   ========================================================================= */
.brand-wordmark {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  color: var(--text-main);
  text-decoration: none;
}

.subtle-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.mono-sm, .mono-val, .mono-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-body);
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.helper-text {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-body);
}

.text-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

.text-link:hover {
  color: var(--text-main);
  text-decoration: underline;
}

/* =========================================================================
   SIGN IN / SIGN UP OVERLAY
   ========================================================================= */
.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-page);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}

.screen-overlay.active {
  display: flex;
}

.signin-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.signin-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 3px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.signin-form, .form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 0.58rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus {
  border-color: var(--text-main);
}

input[readonly] {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.auth-aux-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.remember-me-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  color: var(--text-body);
}

.remember-me-wrap input,
.legal-consent-label input {
  accent-color: var(--text-main);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.btn-text-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.btn-text-link:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.password-match-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.password-match-tag.match {
  background: var(--green-bg);
  color: var(--green-text);
}

.password-match-tag.mismatch {
  background: var(--red-bg);
  color: var(--red-text);
}

.legal-consent-box {
  padding: 0.65rem 0.75rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.legal-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-body);
  cursor: pointer;
}

.legal-consent-label a {
  color: var(--text-main);
  font-weight: 600;
}

.forgot-notice-box {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.btn-primary {
  width: 100%;
  padding: 0.68rem 1rem;
  background: var(--text-main);
  color: #fff;
  border: 1px solid var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-inline {
  display: inline-block;
  width: auto;
}

.btn-sm-dark {
  padding: 0.55rem 1rem;
  background: var(--text-main);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm-dark:hover {
  opacity: 0.88;
}

.btn-outline-sm {
  padding: 0.42rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}

.btn-outline-sm:hover {
  background: var(--bg-subtle);
}

.mini-close-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.auth-error {
  min-height: 1rem;
  font-size: 0.8rem;
  color: var(--red-text);
  text-align: center;
}

.signin-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light);
}

.foot-links {
  display: flex;
  gap: 0.85rem;
}

/* =========================================================================
   WORKSPACE SHELL & TOP HEADER
   ========================================================================= */
.workspace-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.header-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tool-switcher {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
}

.tool-btn {
  padding: 0.45rem 1.05rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tool-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tool-btn:disabled, .tool-btn.tool-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid;
}

.status-pill.online {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green-text);
}

.status-pill.offline {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

.pill-badge {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-body);
}

.user-name-tag {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.server-error-banner {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-text);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: center;
}

/* =========================================================================
   MAIN TOOL VIEWPORT & CARDS
   ========================================================================= */
.tool-view {
  display: none;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.15rem 1.25rem 2rem;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

/* =========================================================================
   INVENTORY LAYOUT (SPEARPOINT)
   ========================================================================= */
.inventory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1rem;
  align-items: start;
}

.inv-main-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.tables-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tables-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.table-pill-wrap {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  overflow: hidden;
}

.table-pill-wrap.active {
  background: var(--text-main);
  border-color: var(--text-main);
}

.table-pill {
  padding: 0.42rem 0.78rem;
  border: none;
  background: transparent;
  color: var(--text-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.table-pill.active {
  color: #fff;
}

.table-pill-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 0.3rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.table-pill-wrap.active .table-pill-del {
  color: rgba(255, 255, 255, 0.7);
}

.table-pill-del:hover {
  background-color: #ef4444;
  color: #ffffff !important;
}

.table-add-btn {
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px dashed var(--border-mid);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

.table-add-btn:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

.inline-table-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.inline-table-form input {
  width: 165px;
  padding: 0.4rem 0.65rem;
}

/* Inventory Table */
.table-scroll {
  overflow-x: auto;
  max-height: 430px;
  overflow-y: auto;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.inv-table th {
  text-align: left;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  white-space: nowrap;
}

.inv-table td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.inv-table tbody tr:hover {
  background: var(--bg-page);
  cursor: pointer;
}

.cell-id, .cell-amount, .cell-price {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.measure-tag {
  font-size: 0.72rem;
  padding: 0.16rem 0.45rem;
  border-radius: 5px;
  background: var(--bg-subtle);
  color: var(--text-body);
}

.cell-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.row-adj-btn, .row-del-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-main);
}

.row-adj-btn:hover {
  background: var(--bg-subtle);
}

.row-del-btn {
  color: var(--red-text);
  border-color: var(--red-border);
}

.row-del-btn:hover {
  background: var(--red-bg);
}

.table-empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-muted) !important;
}

/* Add / Update Item Form */
.c-mode-tabs {
  display: flex;
  gap: 0.35rem;
}

.c-mode-btn {
  padding: 0.38rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.c-mode-btn.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
}

.c-form {
  display: none;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.c-form.active {
  display: flex;
}

.c-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 130px;
}

.c-field-grow { flex: 1.8 1 170px; }
.c-field-sm { flex: 0.7 1 95px; }
.c-field-xs { flex: 0.5 1 78px; }

.c-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.btn-c {
  padding: 0.58rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-c-green {
  background: var(--text-main);
  color: #fff;
}

.btn-c-red {
  background: var(--bg-subtle);
  border-color: var(--border-mid);
  color: var(--text-main);
}

.btn-c-delete {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

/* Right Sidebar (Summary / Statistics / History / Filter) */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.b-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 3px;
}

.b-tab {
  border: none;
  background: transparent;
  padding: 0.42rem 0.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.b-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.b-pane {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.b-pane.active {
  display: flex;
}

.stat-hero {
  background: var(--bg-page);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-big {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.va-bar-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  display: flex;
}

.va-bar-seg { height: 100%; }
.seg-healthy { background: #16a34a; }
.seg-low { background: #dc2626; }

.va-legend, .otis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot-healthy { background: #16a34a; }
.dot-low { background: #dc2626; }

.va-location-list, .va-top-items {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.va-loc-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.va-loc-row, .va-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.va-loc-meter {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.va-loc-fill {
  height: 100%;
  background: var(--text-main);
  border-radius: 999px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 460px;
  overflow-y: auto;
}

.activity-card {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.act-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.act-time, .act-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.act-body {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.act-delta {
  font-family: var(--font-mono);
  font-weight: 600;
}

.legend-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
}

.chip-new, .chip-add { background: var(--green-bg); color: var(--green-text); }
.chip-rem, .chip-del { background: var(--red-bg); color: var(--red-text); }

.sort-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.view-opt-btn {
  padding: 0.48rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  font-size: 0.82rem;
  color: var(--text-body);
  cursor: pointer;
}

.view-opt-btn.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
}

/* =========================================================================
   UNPAID / PLAN PICKER
   ========================================================================= */
.unpaid-gate-shell {
  max-width: 780px;
  margin: 1rem auto;
}

.unpaid-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.unpaid-gate-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.25rem 0;
}

.unpaid-gate-lead {
  color: var(--text-muted);
}

.unpaid-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.unpaid-plan-option {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  cursor: pointer;
}

.unpaid-plan-option input { display: none; }

.unpaid-plan-option.selected {
  border-color: var(--text-main);
  background: var(--bg-page);
}

.unpaid-plan-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.unpaid-plan-name { font-size: 1.05rem; }
.unpaid-price { font-size: 1.35rem; font-weight: 700; }
.unpaid-price small { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.unpaid-plan-desc { font-size: 0.85rem; color: var(--text-body); line-height: 1.45; }

.unpaid-payment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
}

.unpaid-action-btns {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.unpaid-order-status {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.unpaid-order-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

/* =========================================================================
   CASHFLOW WORKSPACE (BLACK HORSE · OTIS-1)
   ========================================================================= */
.cf-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.kpi-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-val {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bh-subnav {
  display: inline-flex;
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  flex-wrap: wrap;
}

.bh-subtab {
  border: none;
  background: transparent;
  padding: 0.48rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.bh-subtab.active {
  background: var(--text-main);
  color: #fff;
}

.bh-pane {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.bh-pane.active {
  display: flex;
}

.cf-controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1 160px;
}

.cf-workspace-grid,
.cf-manual-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.cf-panel, .cf-sliders-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.cf-svg-container {
  width: 100%;
  min-height: 220px;
}

.cf-svg-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.cf-slider-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
}

.cf-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cf-range {
  width: 100%;
  accent-color: var(--text-main);
  cursor: pointer;
}

.scenario-cards-grid,
.otis-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.scenario-card, .otis-metric-chip {
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.scenario-card.card-active,
.otis-metric-chip.highlight {
  border-color: var(--text-main);
  background: var(--bg-card);
}

.sc-title, .chip-num {
  font-size: 1.15rem;
  font-weight: 700;
}

.cf-chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.advisory-box {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-page);
}

/* =========================================================================
   CUSTOM COLUMNS, TEXT-ONLY STOCK INPUT & CSV -> SQL IMPORTER MODALS
   ========================================================================= */
.tables-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.table-csv-btn {
  border-style: solid;
  border-color: var(--text-main);
  color: var(--text-main);
  font-weight: 600;
}

.table-csv-btn:hover {
  background: var(--text-main);
  color: #fff;
}

.c-custom-fields-wrap {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border-light);
}

.c-custom-fields-wrap[hidden] {
  display: none !important;
}

/* Inline unit +/- stepper + exact stock input in table rows */
.row-qty-form {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.row-unit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.row-unit-btn.btn-unit-plus:hover {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green-text);
}

.row-unit-btn.btn-unit-minus:hover {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red-text);
}

.row-qty-input {
  width: 66px;
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-align: center;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
}

.row-qty-input:focus {
  outline: none;
  border-color: var(--text-main);
}

.row-qty-save-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--text-main);
  border-radius: var(--radius-sm);
  background: var(--text-main);
  color: #fff;
  cursor: pointer;
}

.row-qty-save-btn:hover {
  opacity: 0.85;
}

.row-del-text-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  background: var(--red-bg);
  color: var(--red-text);
  cursor: pointer;
}

.row-del-text-btn:hover {
  background: var(--red-text);
  color: #fff;
}

/* Full-window CSV Drag Overlay */
.csv-drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(22, 22, 21, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  pointer-events: none;
}

.csv-drag-overlay[hidden] {
  display: none !important;
}

.csv-drag-box {
  border: 2px dashed #fff;
  border-radius: 16px;
  padding: 3rem 3.5rem;
  text-align: center;
  color: #fff;
  background: rgba(22, 22, 21, 0.85);
}

.csv-drag-icon {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

/* Shared Dashboard Modals */
.dash-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(22, 22, 21, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

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

.dash-modal {
  width: 100%;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dash-modal-sm { max-width: 560px; }
.dash-modal-lg { max-width: 960px; }

.dash-modal-head {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dash-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.dash-modal-body {
  padding: 1.15rem 1.35rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dash-modal-foot {
  padding: 0.85rem 1.35rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  background: var(--bg-page);
}

/* Table Schema Customizer */
.schema-default-box {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.schema-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.schema-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  color: var(--text-body);
}

.schema-custom-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.schema-cols-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.schema-col-row {
  display: grid;
  grid-template-columns: 1fr 140px auto;
  gap: 0.5rem;
  align-items: center;
}

.schema-col-row input,
.schema-col-row select {
  padding: 0.48rem 0.65rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  background: var(--bg-card);
  color: var(--text-main);
}

/* CSV Dropzone & Mapper */
.csv-dropzone {
  border: 2px dashed var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.csv-dropzone.drag-over,
.csv-dropzone:hover {
  border-color: var(--text-main);
  background: var(--bg-subtle);
}

.csv-dz-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.csv-dz-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
}

.csv-paste-area {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  resize: vertical;
}

.csv-mapper-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.csv-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.csv-rows-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.csv-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.csv-row-range {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.csv-num-inp {
  width: 72px;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.csv-section-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.csv-col-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 0.6rem;
}

.csv-col-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.csv-col-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.csv-col-src-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-col-sample {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-col-card select,
.csv-col-card input[type="text"] {
  width: 100%;
  padding: 0.36rem 0.5rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--bg-card);
  color: var(--text-main);
}

.csv-preview-scroll {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.csv-preview-table {
  font-size: 0.76rem;
}

.csv-preview-table th,
.csv-preview-table td {
  padding: 0.42rem 0.6rem;
  white-space: nowrap;
}

/* Simplified Visual CSV Preview (Yellow for Rows or Columns; Green only when BOTH are set) */
.csv-simple-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.csv-dest-select {
  width: auto;
  min-width: 132px;
}

.csv-name-inp {
  flex: 1 1 180px;
  padding: 0.44rem 0.65rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--bg-card);
  color: var(--text-main);
}

.csv-highlighter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.csv-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.csv-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.82rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-body);
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.csv-tool-btn:hover {
  border-color: var(--text-main);
}

.csv-tool-btn.active {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #713f12;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.25);
}

.csv-tool-btn.is-set {
  border-color: #16a34a;
  color: #14532d;
}

.csv-tool-btn.is-set.is-ready-tab {
  background: #dcfce7;
}

.csv-set-btn {
  padding: 0.44rem 0.88rem;
  border-radius: var(--radius-sm);
  border: 1px solid #a16207;
  background: #facc15;
  color: #422006;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}

.csv-set-btn:hover {
  background: #eab308;
}

.csv-set-btn.is-ready {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}

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

.swatch-green  { background: #22c55e; border: 1px solid #15803d; }
.swatch-yellow { background: #facc15; border: 1px solid #a16207; }

.csv-state-badge.is-yellow {
  background: #fef9c3;
  color: #713f12;
  border: 1px solid #eab308;
}

.csv-state-badge.is-ready {
  background: #dcfce7;
  color: #14532d;
  border: 1px solid #16a34a;
}

.csv-tool-extras {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.csv-legend-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.77rem;
  color: var(--text-muted);
}

.csv-sheet-scroll {
  max-height: 360px;
  overflow: auto;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  user-select: none;
}

.csv-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.csv-sheet-table th,
.csv-sheet-table td {
  border: 1px solid var(--border-light);
  padding: 0.36rem 0.55rem;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csv-sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-subtle);
  vertical-align: top;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
}

.csv-sheet-corner {
  width: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  cursor: default !important;
}

.csv-col-th-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.csv-col-letter {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.07);
}

.csv-col-hdr-text {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
}

.csv-th-role-select {
  width: 100%;
  font-size: 0.7rem;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
}

.csv-row-num-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
}

.csv-sheet-table tbody tr.row-header-row {
  background: #f4f4f5;
  font-weight: 700;
}

.csv-sheet-table tbody tr.row-header-row .csv-row-num-cell {
  background: #27272a;
  color: #ffffff;
}

.csv-sheet-table tbody td.csv-data-cell {
  cursor: crosshair;
  transition: background 0.08s, opacity 0.08s;
}

/* VIEW 1: ROWS ONLY -> YELLOW */
.csv-sheet-table.mode-rows tbody tr.row-selected .csv-row-num-cell {
  background: #eab308;
  color: #422006;
}

.csv-sheet-table.mode-rows tbody tr.row-selected td.csv-data-cell {
  background: #fef9c3;
  color: #713f12;
  font-weight: 500;
}

.csv-sheet-table.mode-rows tbody tr:not(.row-selected):not(.row-header-row) td.csv-data-cell {
  opacity: 0.42;
}

/* VIEW 2: COLUMNS ONLY -> YELLOW */
.csv-sheet-table.mode-cols thead th.col-selected {
  background: #fef08a;
  border-bottom: 2px solid #ca8a04;
}

.csv-sheet-table.mode-cols thead th.col-selected .csv-col-letter {
  background: #ca8a04;
  color: #ffffff;
}

.csv-sheet-table.mode-cols tbody td.csv-data-cell.col-selected {
  background: #fef9c3;
  color: #713f12;
  font-weight: 500;
}

.csv-sheet-table.mode-cols thead th.col-unselected,
.csv-sheet-table.mode-cols tbody td.csv-data-cell:not(.col-selected) {
  opacity: 0.42;
}

/* VIEW 3: BOTH ROWS & COLUMNS SET -> GREEN READY */
.csv-sheet-table.mode-ready thead th.col-selected {
  background: #bbf7d0;
  border-bottom: 2px solid #16a34a;
}

.csv-sheet-table.mode-ready thead th.col-selected .csv-col-letter {
  background: #16a34a;
  color: #ffffff;
}

.csv-sheet-table.mode-ready tbody tr.row-selected .csv-row-num-cell {
  background: #16a34a;
  color: #ffffff;
}

.csv-sheet-table.mode-ready tbody tr.row-selected td.csv-data-cell.col-selected {
  background: #dcfce7;
  color: #14532d;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.3);
}

.csv-sheet-table.mode-ready thead th.col-unselected,
.csv-sheet-table.mode-ready tbody tr:not(.row-selected):not(.row-header-row) td.csv-data-cell,
.csv-sheet-table.mode-ready tbody td.csv-data-cell:not(.col-selected) {
  opacity: 0.34;
}

/* =========================================================================
   SERVER TIMECLOCK PILL & STATISTICS TAB (SUPPLY VS CONSUMPTION + BOX ADDER)
   ========================================================================= */
.server-clock-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
}

.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.stats-kpi {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stats-kpi-val {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.stats-kpi-val.is-up { color: #16a34a; }
.stats-kpi-val.is-down { color: #dc2626; }

.stats-chart-box {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.45rem;
  min-height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-chart-box svg {
  width: 100%;
  height: auto;
  display: block;
}

.stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.dot-supply { background: #16a34a; }
.dot-cons   { background: #dc2626; }
.dot-spike  { background: #f97316; }
.dot-box    { background: #eab308; }

.stats-spike-note {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.74rem;
  line-height: 1.4;
}

.stats-box-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
}

.stats-box-months {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.stats-mini-lbl {
  display: block;
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stats-box-form input[type="month"],
.stats-box-form input[type="text"] {
  width: 100%;
  padding: 0.36rem 0.48rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  background: var(--bg-card);
  color: var(--text-main);
}

.stats-box-label-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.stats-box-label-row input[type="text"] {
  flex: 1;
}

.stats-boxes-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stats-box-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.36rem 0.55rem;
  border-radius: var(--radius-sm);
  background: #fef9c3;
  border: 1px solid #eab308;
  color: #713f12;
  font-size: 0.74rem;
}

.stats-box-chip-meta {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.stats-box-chip-title {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-box-chip-range {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  opacity: 0.85;
}

.stats-box-del-btn {
  border: none;
  background: transparent;
  color: #713f12;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

.stats-box-del-btn:hover {
  background: #dc2626;
  color: #fff;
}

.stats-daily-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 175px;
  overflow-y: auto;
}

.stats-daily-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.38rem 0.55rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
}

.stats-daily-date {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.stats-daily-nums {
  display: inline-flex;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.stats-daily-sup { color: #16a34a; font-weight: 600; }
.stats-daily-con { color: #dc2626; font-weight: 600; }

/* Staged Append Bar (Step-by-Step Commit to Server) */
.staged-append-bar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-md);
  background: #fefce8;
  border: 1.5px solid #eab308;
  box-shadow: 0 4px 14px rgba(234, 179, 8, 0.14);
}

.staged-append-bar[hidden] {
  display: none !important;
}

.staged-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.staged-bar-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: #422006;
}

.staged-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ca8a04;
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.28);
  flex-shrink: 0;
}

.staged-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.btn-discard-staged {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red-border);
  background: #fff;
  color: var(--red-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-discard-staged:hover {
  background: var(--red-bg);
}

.btn-append-commit {
  padding: 0.44rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid #15803d;
  background: #16a34a;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.btn-append-commit:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-append-commit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.staged-steps-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(161, 98, 7, 0.35);
  max-height: 110px;
  overflow-y: auto;
}

.staged-steps-list[hidden] {
  display: none !important;
}

.staged-step-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(161, 98, 7, 0.35);
  color: #713f12;
}

.stats-live-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.stats-live-pill.is-staged {
  background: #fef9c3;
  color: #854d0e;
  border-color: #facc15;
}

/* Send to Bank + Grayscaled PayMongo Payment Picker */
.unpaid-payment-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pay-methods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.pay-method-tile {
  position: relative;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s, background 0.15s;
}

.pay-method-tile.selected {
  border-color: var(--text-main);
  background: var(--bg-page);
  box-shadow: 0 2px 10px rgba(22, 22, 21, 0.06);
}

.pay-method-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.pay-method-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.pay-method-disabled {
  filter: grayscale(1);
  opacity: 0.56;
  cursor: not-allowed;
  background: #f4f4f5;
  border-style: dashed;
  user-select: none;
}

.pay-unavail-tooltip {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: rgba(24, 24, 27, 0.88);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.pay-method-disabled:hover .pay-unavail-tooltip,
.pay-method-disabled:focus-within .pay-unavail-tooltip {
  opacity: 1;
}

.bank-steps-list {
  margin: 0.35rem 0 0.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-body);
  line-height: 1.45;
}

.bank-receipt-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border-mid);
}

.bank-receipt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.bank-receipt-grid input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--bg-card);
  color: var(--text-main);
}

.bank-receipt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Black Horse Statistical Telemetry Strip */
.bh-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-light);
}

.bh-stat-chip {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.bh-stat-chip strong {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-main);
}

@media (max-width: 720px) {
  .pay-methods-grid,
  .bank-receipt-grid,
  .bh-stat-strip {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1024px) {
  .inventory-layout,
  .cf-workspace-grid,
  .cf-manual-shell {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .unpaid-plans-grid,
  .scenario-cards-grid,
  .otis-metrics-grid {
    grid-template-columns: 1fr;
  }
  .header-shell {
    justify-content: center;
  }
}
