:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f6fb;
  color: #182439;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --line: #dce4ef;
  --line-soft: #e9eef5;
  --text: #182439;
  --muted: #526078;
  --brand: #2855d9;
  --brand-dark: #2048bd;
  --brand-soft: #eaf0ff;
  --ink: #1e2c45;
  --blue: #1769e0;
  --green: #16803c;
  --yellow: #9a6100;
  --red: #b42318;
  --radius: 12px;
  --control-h: 38px;
  --control-sm-h: 30px;
  --sidebar-width: 232px;
  --shadow-soft: 0 12px 32px rgba(27, 49, 84, .10);
}

/* Client workspace refresh · 2026-08-03 */
.clients-page .page-head,
.client-detail-page .page-head { min-height: 74px; }
.clients-page .page-actions .ti,
.client-detail-page .page-actions .ti,
.client-detail-page .section-head .ti,
.clients-page .client-row-actions .ti { font-size: 16px; }
.section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.client-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.client-overview-card {
  min-width: 0;
  padding: 15px 16px;
  min-height: 86px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  column-gap: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--workspace-panel, #fff);
}
.client-overview-card.primary { border-color: var(--workspace-info-edge, #d6e1fb); background: var(--workspace-info-bg, #f3f6ff); }
.client-overview-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--workspace-raised, #f1f4f8);
  color: var(--workspace-muted-text, #4d5868);
  font-size: 20px;
  line-height: 1;
  justify-self: center;
  align-self: center;
}
.client-overview-icon .ti {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 22px;
}
.client-overview-icon .ti::before {
  width: 22px;
  height: 22px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}
.client-overview-card.primary .client-overview-icon { background: var(--brand-soft); color: var(--brand-dark); }
.client-overview-card div { min-width: 0; }
.client-overview-card div > small,
.client-overview-card div > span { display: block; }
.client-overview-card div > small { min-height: 18px; line-height: 18px; }
.client-overview-card strong { display: block; margin: 2px 0 1px; font-size: 24px; line-height: 1.1; }
.client-overview-card div > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.client-directory-panel.panel { padding: 0; overflow: visible; }
.client-directory-head {
  padding: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
}
.client-directory-head p { margin-top: 4px; font-size: 13px; }
.client-search-form {
  width: min(480px, 48%);
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  overflow: hidden;
}
.client-search-form > .ti { justify-self: center; color: var(--workspace-subtle-text, #8b96a6); font-size: 17px; }
.client-search-form input {
  min-width: 0;
  height: 40px;
  padding: 8px 4px;
  border: 0;
  outline: 0;
  box-shadow: none;
}
.client-search-form input:focus { outline: 0; box-shadow: none; }
.client-search-form button { min-height: 40px; height: 40px; border-radius: 0; }
.client-search-clear { width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }

.client-list-head,
.client-directory-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.35fr) minmax(235px, 1.25fr) minmax(175px, .9fr) minmax(135px, .7fr) 135px;
  column-gap: 18px;
  align-items: center;
}
.client-list-head {
  padding: 9px 18px;
  color: var(--muted);
  background: var(--workspace-soft, #fafbfc);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 800;
}
.client-directory-row {
  min-height: 92px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .16s ease;
}
.client-directory-row:hover { background: var(--workspace-soft, #fbfcfe); }
.client-identity-cell { min-width: 0; display: flex; align-items: center; gap: 11px; }
.client-avatar,
.client-detail-avatar {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #18202d;
  color: #fff;
  font-size: 17px;
  font-weight: 850;
}
.client-avatar { width: 42px; height: 42px; flex: 0 0 42px; }
.client-identity-copy { min-width: 0; }
.client-name-line { display: flex; align-items: baseline; gap: 7px; }
.client-name-line a { max-width: 210px; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.client-name-line small { color: var(--workspace-subtle-text, #9aa4b2); }
.client-tg-line,
.client-note {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-tg-line .ti { margin-right: 4px; }
.client-tg-line.is-bound { color: var(--workspace-ok-text, #147a3b); }
.client-note { color: var(--workspace-subtle-text, #8590a0); }
.client-finance-cell,
.client-business-cell { min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.client-value,
.client-business-cell div { min-width: 0; }
.client-value small,
.client-business-cell small { display: block; margin-bottom: 3px; font-size: 10px; }
.client-value strong,
.client-business-cell strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.client-value.is-danger strong { color: var(--red); }
.client-scale-cell { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.client-scale-cell span { display: flex; align-items: center; gap: 5px; }
.client-scale-cell .ti { width: 15px; font-size: 14px; }
.client-scale-cell strong { color: var(--ink); }
.client-row-actions { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.client-row-actions > .button,
.client-row-actions > .client-more-menu > summary {
  height: 34px;
  min-height: 34px;
  align-items: center;
}
.client-row-actions .ti {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 17px;
}
.client-more-menu { position: relative; }
.client-more-menu > summary { list-style: none; background: var(--workspace-raised, #eef1f5); color: var(--workspace-strong-text, #3f4a59); }
.client-more-menu[open] > summary { background: var(--workspace-raised, #dfe5ec); color: var(--ink); }
.client-more-menu > summary::-webkit-details-marker { display: none; }
.client-more-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: 172px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--workspace-panel, #fff);
  box-shadow: var(--shadow-soft);
}
.client-more-popover a,
.client-more-popover button {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}
.client-more-popover a:hover,
.client-more-popover button:hover { background: var(--workspace-raised, #f3f5f8); text-decoration: none; }
.client-more-popover form { margin: 0; }
.client-more-popover .danger-text { color: var(--red); }
.client-list-footer { min-height: 58px; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.compact-pagination { margin: 0; }
.compact-pagination .button { min-height: 32px; padding: 7px 10px; font-size: 12px; }
.client-empty-state { min-height: 190px; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--muted); }
.client-empty-state .ti { font-size: 30px; }

.client-tg-details { padding: 0; }
.client-tg-details > summary { min-height: 60px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.client-tg-details > summary::-webkit-details-marker { display: none; }
.client-tg-details > summary > span { display: flex; align-items: center; gap: 9px; }
.client-tg-details > summary .ti-brand-telegram { color: var(--workspace-info-text, #1686c8); font-size: 20px; }
.client-tg-details > summary small { margin-left: 4px; }
.client-tg-details[open] > summary > .ti { transform: rotate(180deg); }
.client-tg-details .section-head,
.client-tg-details .table-wrap { margin-inline: 18px; }
.client-tg-details .table-wrap { margin-bottom: 18px; }

.client-form-dialog { width: min(590px, calc(100vw - 28px)); max-height: calc(100vh - 38px); padding: 20px; background: var(--workspace-panel, #fff); overflow-y: auto; }
.client-form-dialog label { display: grid; gap: 6px; color: var(--workspace-muted-text, #556173); font-size: 12px; font-weight: 800; }
.client-form-dialog label input,
.client-form-dialog label select,
.client-form-dialog label textarea { width: 100%; color: var(--text); font-weight: 550; }
.dialog-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) 34px; align-items: start; gap: 11px; margin-bottom: 4px; }
.dialog-head h2 { margin-top: 1px; }
.dialog-head p { margin-top: 3px; font-size: 12px; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: var(--workspace-error-bg, #feecee); color: var(--brand-dark); font-size: 20px; }
.dialog-head .icon-button { background: var(--workspace-raised, #eef1f5); color: var(--workspace-muted-text, #4d5868); }
.dialog-tip { padding: 11px 12px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid var(--workspace-info-edge, #dbe7f6); border-radius: 8px; background: var(--workspace-info-bg, #f7faff); color: var(--workspace-muted-text, #526078); font-size: 12px; }
.dialog-tip .ti { margin-top: 1px; color: var(--workspace-info-text, #1769e0); font-size: 16px; }
.dialog-tip strong { display: block; margin-bottom: 1px; color: var(--workspace-strong-text, #263247); }

.client-detail-hero { display: grid; gap: 12px; }
.client-profile-strip { padding: 14px 16px; display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 13px; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--workspace-panel, #fff); }
.client-detail-avatar { width: 50px; height: 50px; font-size: 20px; }
.client-profile-copy { min-width: 0; }
.client-profile-copy > div { display: flex; align-items: baseline; gap: 7px; }
.client-profile-copy > div strong { font-size: 17px; }
.client-profile-copy > div span { color: var(--workspace-subtle-text, #9aa4b2); font-size: 12px; }
.client-profile-copy p { max-width: 760px; margin-top: 4px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.client-profile-tg { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--muted); font-size: 11px; }
.client-profile-tg.is-bound { color: var(--workspace-ok-text, #147a3b); }
.client-profile-rates { display: flex; align-items: center; gap: 0; }
.client-profile-rates span { min-width: 108px; padding: 2px 16px; border-left: 1px solid var(--line-soft); }
.client-profile-rates small,
.client-profile-rates strong { display: block; }
.client-profile-rates strong { margin-top: 2px; font-size: 15px; }
.client-finance-dashboard { border: 1px solid var(--line); border-radius: 10px; background: var(--workspace-panel, #fff); overflow: hidden; }
.client-primary-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.client-metric-card { min-width: 0; min-height: 112px; padding: 15px; display: flex; align-items: flex-start; gap: 10px; border-right: 1px solid var(--line-soft); }
.client-metric-card:last-child { border-right: 0; }
.metric-icon { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 8px; background: var(--workspace-raised, #eef2f6); color: var(--workspace-muted-text, #586577); font-size: 16px; }
.client-metric-card.is-danger .metric-icon { background: var(--workspace-error-bg, #feecee); color: var(--red); }
.client-metric-card div { min-width: 0; }
.client-metric-card small,
.client-metric-card span { display: block; }
.client-metric-card strong { display: block; margin: 5px 0 4px; overflow: hidden; font-size: 20px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.client-metric-card.is-danger strong { color: var(--red); }
.client-metric-card div > span { color: var(--muted); font-size: 10px; }
.client-secondary-metrics { min-height: 58px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); background: var(--workspace-soft, #fafbfc); }
.client-secondary-metrics span { padding: 10px 15px; border-right: 1px solid var(--line-soft); }
.client-secondary-metrics span:last-child { border-right: 0; }
.client-secondary-metrics small,
.client-secondary-metrics strong { display: block; }
.client-secondary-metrics strong { margin-top: 2px; font-size: 14px; }
.client-detail-nav {
  position: sticky;
  z-index: 12;
  top: 0;
  min-height: 48px;
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--workspace-glass, rgba(255,255,255,.96));
  box-shadow: 0 5px 18px rgba(15, 23, 42, .05);
  overflow-x: auto;
}
.client-detail-nav a { min-height: 36px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 7px; color: var(--workspace-muted-text, #586577); font-size: 12px; font-weight: 800; white-space: nowrap; }
.client-detail-nav a:hover,
.client-detail-nav a.active { background: var(--workspace-raised, #f1f3f6); color: var(--ink); text-decoration: none; }
.client-detail-section { scroll-margin-top: 64px; }
.client-detail-section .section-head h2 { margin-top: 0; }
.client-detail-grid { align-items: start; }
.client-detail-page .client-detail-section .table-wrap { max-height: 520px; }
.client-detail-page #pricing .table-wrap,
.client-detail-page #settlement .table-wrap { max-height: 360px; }
.client-detail-page .client-ledger-wrap { max-height: none; }

@media (max-width: 1320px) {
  .client-list-head,
  .client-directory-row { grid-template-columns: minmax(240px, 1.25fr) minmax(250px, 1.15fr) minmax(185px, .85fr) 145px; }
  .client-list-head span:nth-child(4),
  .client-scale-cell { display: none; }
  .client-primary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .client-metric-card:nth-child(3) { border-right: 0; }
  .client-metric-card:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .client-profile-rates span { min-width: 96px; padding-inline: 12px; }
}
@media (max-width: 1040px) {
  .client-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .client-directory-head { align-items: stretch; flex-direction: column; gap: 13px; }
  .client-search-form { width: 100%; }
  .client-list-head { display: none; }
  .client-directory-row { grid-template-columns: minmax(230px, 1.1fr) minmax(250px, 1fr) 140px; row-gap: 10px; }
  .client-business-cell { grid-column: 1 / 3; padding-left: 53px; }
  .client-row-actions { grid-column: 3; grid-row: 1 / 3; }
  .client-profile-strip { grid-template-columns: 50px minmax(0, 1fr); }
  .client-profile-rates { grid-column: 1 / 3; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .client-profile-rates span:first-child { border-left: 0; padding-left: 0; }
}
@media (max-width: 720px) {
  .clients-page .page-actions,
  .client-detail-page .page-actions { width: 100%; justify-content: stretch; }
  .clients-page .page-actions .button,
  .client-detail-page .page-actions .button { flex: 1 1 auto; }
  .client-overview { grid-template-columns: 1fr; }
  .client-overview-card { padding-block: 12px; }
  .client-directory-row { grid-template-columns: 1fr; padding: 15px; }
  .client-finance-cell,
  .client-business-cell { grid-column: 1; padding: 10px 0 0; border-top: 1px solid var(--line-soft); }
  .client-row-actions { grid-column: 1; grid-row: auto; justify-content: stretch; }
  .client-row-actions > .button { flex: 1; }
  .client-more-menu { margin-left: auto; }
  .client-list-footer { align-items: stretch; flex-direction: column; }
  .compact-pagination { justify-content: space-between; }
  .client-tg-details > summary small { display: none; }
  .client-profile-strip { grid-template-columns: 44px minmax(0, 1fr); }
  .client-detail-avatar { width: 44px; height: 44px; }
  .client-profile-rates { overflow-x: auto; }
  .client-profile-rates span { min-width: 104px; }
  .client-primary-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-metric-card,
  .client-metric-card:nth-child(3) { min-height: 102px; border-right: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
  .client-metric-card:nth-child(-n+2) { border-top: 0; }
  .client-metric-card:nth-child(2n) { border-right: 0; }
  .client-secondary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .client-secondary-metrics span:nth-child(3) { border-right: 0; }
  .client-secondary-metrics span:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .client-form-dialog .split { grid-template-columns: 1fr; }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.18; letter-spacing: 0; font-weight: 800; }
h2 { font-size: 18px; line-height: 1.35; font-weight: 800; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 800; }
p { color: var(--muted); line-height: 1.55; }
small, .muted { color: var(--muted); font-size: 12px; line-height: 1.45; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--workspace-soft, #f7f9fb);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  word-break: break-all;
}
.finance-lookup-code {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
  word-break: normal;
}
.finance-actions-cell {
  min-width: 230px;
  width: 230px;
}
.finance-transfer-origin { display: block; margin-top: 3px; }
.finance-paid-actions,
.finance-confirm-form {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}
.finance-paid-actions .inline,
.finance-confirm-form.inline {
  align-items: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0;
}
.finance-paid-actions .table-button,
.finance-confirm-form .table-button {
  height: 30px;
  padding-inline: 10px;
  white-space: nowrap;
}
.finance-lookup-popover {
  width: min(420px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  box-shadow: var(--shadow-soft);
}
.finance-transfer-popover {
  width: min(520px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--workspace-panel, #fff);
  box-shadow: var(--shadow-soft);
}
.finance-transfer-popover::backdrop { background: rgba(16, 23, 34, .28); }
.finance-transfer-form { display: grid; gap: 12px; margin: 0; }
.finance-transfer-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.finance-transfer-form select,
.finance-transfer-form input,
.finance-transfer-form textarea { width: 100%; }
.finance-transfer-summary { margin: 0; }
.finance-lookup-popover::backdrop {
  background: rgba(16, 23, 34, .18);
}
.finance-lookup-form {
  display: grid;
  gap: 10px;
  margin: 0;
}
.finance-lookup-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.finance-lookup-form input[name="lookup_id"] {
  width: 100%;
  height: 34px;
  padding: 6px 9px;
}
.finance-lookup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.finance-confirm-form input {
  height: 30px;
  padding: 5px 8px;
  width: 104px;
}
.finance-confirm-form input[name="tx_hash"] {
  width: 154px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  max-width: 100%;
  padding: 1px 5px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #4775f0, var(--brand-strong, var(--brand-dark)));
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 3px 8px #2855d92e;
}
.brand strong, .login-brand strong { display: block; color: var(--text); font-size: 16px; line-height: 1.2; }
.brand small, .login-brand small { display: block; margin-top: 3px; font-size: 11px; }

.nav {
  display: grid;
  align-content: start;
  gap: 15px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 2px 2px 4px;
}
.nav-section { display: grid; gap: 2px; }
.nav-section-title {
  padding: 4px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.nav-item, .nav-group summary, .nav-child {
  display: flex;
  align-items: center;
  min-height: 37px;
  min-width: 0;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}
.nav-item > .ti, .nav-label > .ti { flex: 0 0 18px; color: var(--workspace-muted-text, #596b86); font-size: 18px; text-align: center; }
.nav a:hover, .nav-group summary:hover, .logout:hover {
  background: var(--surface-soft);
  color: var(--brand-dark);
  text-decoration: none;
}
.nav a.active, .nav-group.has-current > summary {
  color: var(--brand-dark);
  font-weight: 750;
}
.nav a.active { background: var(--brand-soft); }
.nav-item.active > .ti, .nav-group.has-current .nav-label > .ti { color: inherit; }
.nav-group { min-width: 0; margin: 0; }
.nav-group summary {
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group .nav-label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.nav-chevron { color: var(--muted); font-size: 14px; transition: transform .15s ease; }
.nav-group[open] .nav-chevron { transform: rotate(180deg); }
.nav-children { margin: 2px 0 4px 17px; padding-left: 8px; border-left: 1px solid var(--line); }
.nav-child { min-height: 32px; padding: 6px 9px; color: var(--muted); font-size: 12px; }
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 12px 3px 1px;
  border-top: 1px solid var(--line);
}
.sidebar-user { display: flex; align-items: center; gap: 9px; min-width: 0; }
.workspace-user-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 17px;
}
.sidebar-user > span:last-child { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { font-size: 11px; }
.logout {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
}
.workspace-mobile-bar { display: none; }
.skip-link {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 8px;
  transform: translateY(-140%);
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--button-fill, var(--ink));
  color: #fff;
}
.skip-link:focus { transform: none; }
.workspace-page :is(a, button, summary, [tabindex="0"]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.app-shell {
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 25px clamp(18px, 2.1vw, 36px) 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.page-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}
.page-heading { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading p { margin-top: 6px; max-width: 820px; }
.page-heading :is(p, .eyebrow):empty, .page-actions:empty { display: none; }
.eyebrow {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.button, button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--button-fill, var(--ink));
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  white-space: nowrap;
}
.button.primary, button[type="submit"] { background: var(--brand); }
.secondary { background: #4d5868; }
.danger-button { background: var(--danger-fill, var(--red)); }
.delete-button {
  background: var(--workspace-panel, #fff);
  color: var(--red);
  border: 1px solid var(--workspace-error-edge, #fecaca);
}
.delete-button:hover {
  background: var(--workspace-error-bg, #fef2f2);
}
.action-col {
  width: 110px;
  text-align: right;
}
.action-col form {
  display: inline-flex;
  margin: 0;
}
.tg-admin-table-wrap {
  overflow: visible;
  border: 0;
  background: transparent;
}
.tg-admin-table {
  min-width: 0;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 13px;
}
.tg-admin-table thead th {
  padding: 0 10px 2px;
  background: transparent;
  border: 0;
}
.tg-admin-table tbody tr {
  background: var(--workspace-soft, #f8fafc);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.tg-admin-table tbody td {
  padding: 10px 12px;
  border: 0;
  vertical-align: middle;
}
.tg-admin-table tbody td:first-child {
  border-radius: 8px 0 0 8px;
}
.tg-admin-table tbody td:last-child {
  border-radius: 0 8px 8px 0;
}
.tg-admin-table code {
  display: inline-flex;
  max-width: 100%;
  background: var(--workspace-panel, #fff);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}
.tg-admin-table .action-col {
  width: 92px;
  text-align: right;
}
.tg-admin-table .delete-button {
  min-height: 32px;
  padding: 7px 13px;
  border-radius: 7px;
  background: var(--danger-fill, var(--red));
  color: #fff;
  border: 1px solid var(--red);
  font-size: 13px;
  line-height: 1;
}
.tg-admin-table .delete-button:hover {
  background: #8f1d15;
  border-color: var(--workspace-error-edge, #8f1d15);
}
.button:hover { text-decoration: none; background: #273140; }
.button.secondary:hover { background: #3f4a59; }
.button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(215, 25, 32, .22);
  outline-offset: 2px;
}
.button.disabled {
  opacity: .45;
  pointer-events: none;
}
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.table-button {
  min-height: var(--control-sm-h);
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}
.check-row {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--workspace-panel, #fff);
  font-size: 13px;
  font-weight: 800;
  color: var(--workspace-strong-text, #3f4a59);
}
.check-row input {
  width: auto;
  min-height: 0;
}
.modal-card {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .22);
}
.modal-card::backdrop {
  background: rgba(15, 23, 42, .42);
}
.icon-button {
  min-width: 34px;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border-radius: 7px;
  font-size: 20px;
  line-height: 1;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.client-modal-actions {
  align-items: center;
  justify-content: space-between;
}
.modal-save-actions {
  display: flex;
  gap: 8px;
}
.modal-danger-action {
  min-width: 0;
}
.compact-danger-button {
  min-height: 38px;
  padding-inline: 12px;
}
.modal-unbind-form {
  display: none;
}
.panel, .metrics div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel { padding: 18px; min-width: 0; box-shadow: 0 1px 0 rgba(15, 23, 42, .02); }
.alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 800;
}
.alert.error {
  background: var(--workspace-error-bg, #fef2f2);
  border: 1px solid var(--workspace-error-edge, #fecaca);
  color: var(--red);
}
.alert.success {
  background: var(--workspace-ok-bg, #f0fdf4);
  border: 1px solid var(--workspace-ok-edge, #bbf7d0);
  color: var(--green);
}
.panel-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-title p, .section-head p { margin-top: 4px; font-size: 13px; }
.panel-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--workspace-error-bg, #fff1f2);
  color: var(--brand-dark);
  font-weight: 900;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.workflow-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.workflow-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--workspace-muted-text, #4b5565);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-weight: 800;
}
.workflow-tabs a span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--workspace-raised, #e8edf3);
  font-size: 12px;
}
.workflow-tabs a.active {
  background: var(--workspace-panel, #fff);
  border-color: var(--line);
  color: var(--brand-dark);
}
.workflow-tabs a.active span { background: var(--brand); color: #fff; }
.manager-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.create-panel { position: sticky; top: 18px; }
.category-grid, .product-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.category-card, .product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
  display: grid;
  gap: 12px;
}
.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.id-pill, .code-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--workspace-raised, #eef2f7);
  color: var(--workspace-strong-text, #3b4656);
  font-size: 12px;
  font-weight: 800;
}
.code-pill { background: var(--workspace-panel, #fff); border: 1px solid var(--line); }
.card-metrics, .stock-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.card-metrics div, .stock-summary div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 10px;
  min-height: 70px;
}
.card-metrics small, .stock-summary small {
  display: block;
  margin-bottom: 7px;
}
.card-metrics strong, .stock-summary strong {
  font-size: 24px;
  line-height: 1;
}
.stock-summary .available {
  border-color: var(--workspace-info-edge, #b9d4ff);
  background: var(--workspace-info-bg, #f3f7ff);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
form { display: grid; gap: 10px; }
.stack { grid-template-columns: 1fr; }
label {
  display: grid;
  gap: 6px;
  min-width: 0;
}
label > span {
  color: var(--workspace-muted-text, #586477);
  font-size: 12px;
  font-weight: 800;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--workspace-edge, #cfd7e3);
  border-radius: 7px;
  padding: 10px 11px;
  font: inherit;
  background: var(--workspace-panel, #fff);
  color: var(--text);
  min-height: 38px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid #2855d92b;
  border-color: var(--brand);
}
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.split.compact { align-items: end; }
.catalog-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.catalog-form.refined {
  grid-template-columns: repeat(4, minmax(0, 1fr)) 150px;
}
.form-grid, .compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.inventory-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 18px;
  align-items: start;
}
.inventory-upload-panel {
  margin-bottom: 18px;
}
.inventory-upload-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, .8fr) 160px;
  gap: 10px;
  align-items: end;
}
.inventory-textarea-field {
  grid-column: 1 / -1;
}
.inventory-upload-form textarea {
  min-height: 160px;
}
.inventory-upload-form > button[type="submit"] {
  min-height: 38px;
}
.inventory-board-panel {
  min-height: 620px;
}
.inventory-board-panel .table-wrap {
  max-height: 560px;
}
.inventory-board-panel .inventory-table {
  min-width: 1120px;
}
.inventory-board-panel .inventory-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--workspace-panel, #fff);
}
.table-wrap.spaced { margin-top: 14px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 780px;
}
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--workspace-muted-text, #596579);
  background: var(--workspace-soft, #f8fafc);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}
td strong { font-weight: 760; }
tr:last-child td { border-bottom: 0; }
.inventory-table td:first-child strong,
.inventory-table td:first-child small {
  display: block;
}
.inventory-table td:first-child small { margin-top: 5px; }
.inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.service-entry-panel textarea {
  min-height: 150px;
}
.service-entry-panel select,
.client-picker {
  max-width: 420px;
}
.native-client-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.client-search-picker {
  position: relative;
  max-width: 560px;
  display: grid;
  gap: 8px;
}
.client-search-input {
  padding-left: 12px;
}
.client-selected {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  background: var(--workspace-soft, #f8fafc);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.client-selected.is-selected {
  background: var(--workspace-ok-bg, #f0fdf4);
  border-color: var(--workspace-ok-edge, #bbf7d0);
  color: var(--workspace-ok-text, #166534);
}
.client-selected strong {
  color: inherit;
}
.client-selected span {
  font-size: 12px;
  font-weight: 800;
}
.client-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
  padding: 6px;
}
.client-search-result {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  justify-content: flex-start;
  display: grid;
  gap: 2px;
  text-align: left;
}
.client-search-result:hover,
.client-search-result.active {
  background: var(--workspace-error-bg, #fff1f2);
  color: var(--brand-dark);
}
.client-search-result span,
.client-search-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.client-search-empty {
  padding: 12px;
}
.historical-import-mini {
  width: min(620px, calc(100vw - 288px));
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
}
.historical-import-mini .mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--workspace-strong-text, #313b4a);
  font-size: 12px;
  line-height: 1.2;
}
.historical-import-mini .mini-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.historical-import-mini .mini-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(230px, 1fr);
  gap: 6px;
  align-items: center;
}
.historical-import-mini select,
.historical-import-mini input[type="file"] {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 13px;
}
.historical-import-mini input[type="file"] {
  width: 150px;
  min-width: 0;
}
.historical-upload-form {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.historical-import-mini .small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}
.service-entry-panel textarea {
  min-height: 148px;
  resize: vertical;
}
.service-edit-panel .table-wrap {
  margin-top: 2px;
}
.service-edit-table {
  min-width: 1220px;
  table-layout: fixed;
}
.service-edit-table th:nth-child(1) { width: 72px; }
.service-edit-table th:nth-child(2) { width: 180px; }
.service-edit-table th:nth-child(3) { width: 210px; }
.service-edit-table th:nth-child(4) { width: 240px; }
.service-edit-table th:nth-child(5) { width: 190px; }
.service-edit-table th:nth-child(6) { width: 190px; }
.service-edit-clear-table {
  min-width: 1180px;
}
.service-edit-clear-table th:nth-child(1) { width: 180px; }
.service-edit-clear-table th:nth-child(2) { width: 190px; }
.service-edit-clear-table th:nth-child(3) { width: 390px; }
.service-edit-clear-table th:nth-child(4) { width: 160px; }
.service-edit-clear-table th:nth-child(5) { width: 180px; }
.service-edit-table .check-col {
  text-align: center;
}
.service-edit-table .check-col input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}
.service-edit-table input {
  min-width: 0;
  width: 100%;
}
.service-edit-table td:last-child,
.service-edit-table th:last-child {
  width: 86px;
  text-align: right;
}
.service-edit-table th,
.service-edit-table td {
  padding: 10px;
  vertical-align: middle;
}
.service-edit-table input {
  min-height: 34px;
  padding: 7px 9px;
}
.service-note-textarea {
  min-height: 54px;
  max-height: 130px;
}
.service-confirm-modal {
  width: min(680px, calc(100vw - 32px));
}
.confirm-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.confirm-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--workspace-soft, #f8fafc);
}
.confirm-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.confirm-summary strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
}
.confirm-detail-list {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 10px 12px;
  margin-bottom: 14px;
  max-height: 260px;
  overflow: auto;
}
.confirm-phrase {
  display: grid;
  gap: 8px;
  margin: -2px 0 14px;
  font-weight: 800;
  color: var(--text);
}
.confirm-phrase input {
  width: 100%;
  min-height: 38px;
}
.confirm-phrase input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(204, 45, 39, 0.12);
}
.confirm-detail-list ol {
  margin: 0;
  padding-left: 20px;
}
.confirm-detail-list li {
  padding: 4px 0;
  line-height: 1.45;
}
.client-ledger-wrap {
  overflow-x: hidden;
}
.client-ledger-table {
  min-width: 0;
  table-layout: fixed;
}
.client-ledger-table th:nth-child(1) { width: 86px; }
.client-ledger-table th:nth-child(2) { width: 220px; }
.client-ledger-table th:nth-child(3) { width: 92px; }
.client-ledger-table th:nth-child(4) { width: 118px; }
.client-ledger-table th:nth-child(5) { width: 142px; }
.client-ledger-table th:nth-child(6) { width: 82px; }
.client-ledger-table th:nth-child(8) { width: 92px; }
.client-ledger-table th,
.client-ledger-table td {
  padding: 10px 10px;
  vertical-align: top;
}
.client-ledger-table tbody tr:hover {
  background: var(--workspace-soft, #fbfdff);
}
.ledger-date-cell {
  color: var(--workspace-muted-text, #536173);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
  word-break: keep-all;
}
.ledger-account-cell strong,
.ledger-account-cell span,
.ledger-note-cell {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ledger-account-cell strong {
  color: var(--text);
  font-weight: 900;
  white-space: nowrap;
}
.ledger-account-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}
.ledger-account-cell em {
  display: block;
  margin-top: 4px;
  color: var(--workspace-warn-text, #9a3412);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wrong-recharge-account-label {
  color: var(--workspace-error-text, #b42318);
}
.ledger-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--workspace-raised, #f1f5f9);
  color: var(--workspace-strong-text, #334155);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.ledger-money-cell strong {
  font-size: 13.5px;
  font-weight: 900;
  white-space: nowrap;
}
.ledger-balance-cell {
  display: grid;
  gap: 5px;
}
.ledger-balance-cell div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ledger-balance-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.ledger-balance-cell strong {
  font-weight: 900;
  white-space: nowrap;
}
.ledger-note-cell {
  color: var(--workspace-muted-text, #475569);
  font-size: 12.5px;
  line-height: 1.45;
  max-height: 3.05em;
  white-space: normal;
}
.ledger-actions {
  min-width: 0;
  text-align: right;
}
.ledger-action-menu {
  display: inline-block;
  text-align: left;
}
.ledger-action-menu[open] {
  position: relative;
  z-index: 120;
}
.ledger-action-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 56px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--danger);
  background: var(--workspace-panel, #fff);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.ledger-action-panel {
  position: fixed;
  z-index: 122;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 14px;
  width: min(440px, calc(100vw - 24px));
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--workspace-panel, #fff);
  box-shadow: -20px 0 56px rgba(15, 23, 42, 0.2);
  animation: ledger-drawer-in 180ms ease-out;
}
.ledger-action-backdrop {
  position: fixed;
  z-index: 121;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.42);
  cursor: default;
  animation: ledger-backdrop-in 160ms ease-out;
}
.ledger-action-drawer-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.ledger-action-drawer-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ledger-action-drawer-head span {
  color: var(--danger);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.ledger-action-drawer-head strong {
  overflow: hidden;
  color: var(--workspace-strong-text, #111827);
  font-size: 20px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-action-drawer-head small {
  color: var(--workspace-muted-text, #64748b);
  font-size: 13px;
}
.ledger-action-close {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--workspace-muted-text, #475569);
  background: var(--workspace-panel, #fff);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.ledger-action-close:hover {
  color: var(--workspace-strong-text, #111827);
  background: var(--workspace-soft, #f8fafc);
}
.ledger-action-drawer-note {
  padding: 11px 12px;
  border: 1px solid var(--workspace-warn-edge, #fed7aa);
  border-radius: 8px;
  color: var(--workspace-warn-text, #9a3412);
  background: var(--workspace-warn-bg, #fff7ed);
  font-size: 12px;
  line-height: 1.55;
}
.ledger-action-menu form {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--workspace-soft, #f8fafc);
}
.ledger-action-form-head {
  display: grid;
  gap: 3px;
}
.ledger-action-form-head strong {
  color: var(--workspace-strong-text, #1f2937);
  font-size: 15px;
}
.ledger-action-form-head span {
  color: var(--workspace-muted-text, #64748b);
  font-size: 12px;
}
.ledger-action-menu input,
.ledger-action-menu select {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 13px;
}
.ledger-action-menu form .button {
  width: 100%;
  min-height: 40px;
}
body.ledger-drawer-open {
  overflow: hidden;
}
@keyframes ledger-drawer-in {
  from { transform: translateX(24px); opacity: .7; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes ledger-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (max-width: 640px) {
  .ledger-action-panel {
    width: 100vw;
    max-width: none;
    padding: 18px;
  }
}
.bulk-tag-bar,
.service-save-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.bulk-tag-bar {
  justify-content: flex-start;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}
.bulk-tag-bar > span {
  color: var(--workspace-muted-text, #586477);
  font-size: 12px;
  font-weight: 800;
}
.bulk-recharge-bar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.bulk-recharge-bar input {
  width: 140px;
  min-height: 32px;
  padding: 6px 9px;
}
.tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
.tag-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--workspace-panel, #fff);
  color: var(--workspace-strong-text, #3b4656);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-check input {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
}
.tag-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--workspace-error-bg, #fee2e2);
  color: var(--workspace-error-text, #991b1b);
  font-size: 13px;
  font-weight: 800;
}
.tag-note.neutral {
  min-height: 24px;
  background: var(--workspace-raised, #eef2f7);
  color: var(--workspace-strong-text, #344054);
  font-size: 12px;
}
.service-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.service-meta small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
tr[data-blocked-clear="1"] {
  background: var(--workspace-warn-bg, #fff7ed);
}
tr[data-blocked-clear="1"] input,
tr[data-blocked-clear="1"] .tag-check {
  opacity: .72;
}
.clear-return-panel {
  padding: 14px;
}
.clear-return-panel .section-head {
  margin-bottom: 6px;
}
.clear-return-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}
.clear-return-toolbar .button,
.clear-return-toolbar button {
  width: auto;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1;
}
.clear-return-toolbar .button.secondary,
.clear-return-toolbar button.secondary {
  background: #4d5868;
  color: #fff;
}
.clear-return-toolbar .import-inline-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  width: auto;
}
.clear-return-toolbar input[type="file"] {
  width: 210px;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}
.compact-table th,
.compact-table td {
  padding: 8px 10px;
  vertical-align: middle;
}
.compact-table input {
  min-height: 32px;
  padding: 6px 9px;
}
.compact-table button {
  min-height: 32px;
  padding: 6px 10px;
}
.clear-return-table {
  min-width: 1480px;
}
.clear-return-table .inline {
  flex-wrap: nowrap;
}
.clear-return-table input[name^="returned_balance_"],
.clear-return-table input[name^="cumulative_recharge_"],
.clear-return-table input[name^="total_spend_"] {
  width: 120px;
}
.cycle-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--workspace-info-bg, #eef4ff);
  border: 1px solid var(--workspace-info-edge, #c9d8ff);
  color: var(--workspace-info-text, #315bb5);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}
.cycle-hint::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--workspace-control, #111827);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}
.cycle-hint:hover::after,
.cycle-hint:focus::after {
  opacity: 1;
}
.clear-bulk-form {
  display: grid;
  gap: 12px;
}
.bulk-return-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.bulk-return-submit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}
.activity-log-panel {
  padding: 14px;
}
.activity-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) repeat(3, minmax(130px, .75fr)) 150px 150px auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.activity-filter-form input,
.activity-filter-form select,
.activity-filter-form button,
.activity-filter-form .button {
  min-height: 34px;
  padding: 7px 10px;
}
.activity-log-wrap {
  max-height: 680px;
}
.activity-log-table {
  min-width: 1380px;
}
.activity-log-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.activity-log-table td:first-child strong,
.activity-log-table td:first-child small,
.activity-log-table td:nth-child(2) small,
.activity-log-table td:nth-child(8) small {
  display: block;
}
.activity-log-table td:nth-child(4),
.activity-log-table td:nth-child(9) {
  max-width: 260px;
}
.activity-log-table code {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-note {
  display: grid;
  gap: 3px;
  max-height: 74px;
  overflow: hidden;
}
.log-note span,
.log-note small {
  overflow-wrap: anywhere;
}
.status.recharge { background: var(--workspace-info-bg, #dbeafe); color: var(--workspace-info-text, #1e40af); }
.status.clear { background: var(--workspace-error-bg, #fee2e2); color: var(--workspace-error-text, #991b1b); }
.status.shipment, .status.completed { background: var(--workspace-ok-bg, #dcfce7); color: var(--workspace-ok-text, #166534); }
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}
.record-pagination {
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 0;
}
.record-pagination-links,
.record-page-jump,
.record-page-jump label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.record-pagination .button {
  min-height: 36px;
  padding: 7px 12px;
}
.record-page-jump input {
  width: 68px;
  min-height: 36px;
  padding: 6px 8px;
  text-align: center;
}
@media (max-width: 760px) {
  .record-pagination,
  .record-pagination-links {
    justify-content: center;
  }
  .record-pagination-links {
    flex-wrap: wrap;
  }
  .record-page-jump {
    width: 100%;
    justify-content: center;
  }
}

/* Unified form experience · 2026-08-19 */
.ui-form {
  --form-control-border: var(--workspace-edge, #cbd5e1);
  --form-control-hover: var(--workspace-info-edge, #9eabbc);
  --form-focus-ring: var(--workspace-focus-ring, #2855d92b);
}
.ui-form.stack {
  gap: 14px;
}
.ui-form .split,
.ui-form .form-grid,
.ui-form .compact-grid {
  gap: 12px;
}
.ui-form label {
  position: relative;
  gap: 7px;
  color: var(--workspace-muted-text, #435064);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
}
.ui-form label > span:first-child {
  color: var(--workspace-muted-text, #435064);
  font-size: 12px;
  font-weight: 800;
}
.ui-form .ui-field-required > :is(.ui-field-label, span:first-child)::after {
  content: " *";
  color: var(--focus, var(--brand));
  font-weight: 900;
}
.ui-form :is(input, select, textarea) {
  border-color: var(--form-control-border);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  box-shadow: 0 1px 1px rgba(15, 23, 42, .02);
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.ui-form :is(input, select, textarea):hover:not(:disabled):not([readonly]) {
  border-color: var(--form-control-hover);
}
.ui-form :is(input, select, textarea):focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--form-focus-ring);
}
.ui-form :is(input, select, textarea)::placeholder {
  color: var(--workspace-subtle-text, #8a95a5);
  opacity: 1;
}
.ui-form :is(input, select, textarea):disabled,
.ui-form :is(input, select, textarea)[readonly] {
  border-color: var(--workspace-edge, #e2e7ed);
  background: var(--workspace-raised, #f3f5f8);
  color: var(--workspace-muted-text, #697386);
  cursor: not-allowed;
}
.ui-form textarea {
  min-height: 96px;
  padding-block: 11px;
}
.ui-form input[type="file"] {
  padding: 5px;
  background: var(--workspace-soft, #f8fafc);
}
.ui-form input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: var(--workspace-raised, #e9edf3);
  color: var(--workspace-strong-text, #334155);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ui-form :is(input[type="checkbox"], input[type="radio"]) {
  width: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--brand);
  box-shadow: none;
}
.ui-form .ui-field-invalid :is(input, select, textarea),
.ui-form :is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--workspace-error-edge, #d92d20);
  background: var(--workspace-soft, #fffafa);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .1);
}
.ui-form.ui-form-filter {
  align-items: end;
  gap: 9px;
}
.ui-form.ui-form-filter :is(input, select, button, .button) {
  min-height: 38px;
}
.ui-form.ui-form-dialog {
  gap: 14px;
}
.ui-form.ui-form-dialog .modal-actions,
.ui-form.ui-form-dialog .dialog-actions,
.ui-form.ui-form-dialog .client-modal-actions {
  position: sticky;
  z-index: 3;
  bottom: -18px;
  margin: 4px -18px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--workspace-glass, rgba(255, 255, 255, .97));
  box-shadow: 0 -8px 22px rgba(15, 23, 42, .05);
  backdrop-filter: blur(8px);
}
.modal-card {
  border-radius: 12px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, .25);
}
.modal-card::backdrop {
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px);
}
.ui-form button[type="submit"],
.ui-form input[type="submit"] {
  min-height: 38px;
}
.ui-form button.is-submitting {
  min-width: 102px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.ui-submit-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: ui-submit-spin .72s linear infinite;
}
@keyframes ui-submit-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .ui-form *,
  .ui-submit-spinner {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
@media (max-width: 760px) {
  .ui-form .split,
  .ui-form .form-grid,
  .ui-form .compact-grid {
    grid-template-columns: 1fr;
  }
  .ui-form .span-2,
  .ui-form .span-3 {
    grid-column: auto;
  }
  .ui-form.ui-form-filter {
    align-items: stretch;
  }
  .ui-form.ui-form-filter > :is(input, select, button, .button, label) {
    width: 100%;
    max-width: none;
  }
  .ui-form.ui-form-dialog .modal-actions,
  .ui-form.ui-form-dialog .dialog-actions,
  .ui-form.ui-form-dialog .client-modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .ui-form.ui-form-dialog .modal-actions button,
  .ui-form.ui-form-dialog .dialog-actions button,
  .ui-form.ui-form-dialog .client-modal-actions button {
    width: 100%;
  }
}
.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.action-cell.nowrap {
  flex-wrap: nowrap;
  min-width: max-content;
}
.management-table {
  min-width: 1080px;
}
.management-table th,
.management-table td {
  padding: 9px 8px;
  vertical-align: middle;
}
.management-table input,
.management-table select {
  min-height: 34px;
  padding: 7px 9px;
}
.management-table button,
.management-table .button {
  min-height: 34px;
  padding: 7px 10px;
}
.management-table .id-pill {
  min-height: 22px;
  padding: 2px 8px;
}
.category-table {
  min-width: 880px;
}
.category-table td:nth-child(3),
.category-table td:nth-child(4),
.product-table td:nth-child(5),
.product-table td:nth-child(6),
.product-table td:nth-child(7) {
  text-align: center;
}
.product-table {
  min-width: 1500px;
}
.product-table th:nth-child(3),
.product-table td:nth-child(3) {
  min-width: 190px;
}
.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  min-width: 150px;
}
.product-table th:nth-child(12),
.product-table td:nth-child(12) {
  min-width: 180px;
}
.product-table .available-count {
  color: var(--workspace-info-text, #1e40af);
}
.wide-inline { min-width: 520px; }
.inline-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr repeat(7, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}
details summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 800;
  margin-bottom: 8px;
  white-space: nowrap;
}
.stock-edit-form {
  min-width: 320px;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
}
.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 230px;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--workspace-raised, #e7ebf0);
  color: var(--workspace-strong-text, #344054);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
}
.status.active, .status.confirmed, .status.paid { background: var(--workspace-ok-bg, #dcfce7); color: var(--workspace-ok-text, #166534); }
.status.hidden, .status.pending, .status.pending_clear, .status.needs_review, .status.reserved { background: var(--workspace-warn-bg, #fef3c7); color: var(--workspace-warn-text, #92400e); }
.status.needs_account, .status.cancelled, .status.disabled { background: var(--workspace-error-bg, #fee2e2); color: var(--workspace-error-text, #991b1b); }
.status.available { background: var(--workspace-info-bg, #dbeafe); color: var(--workspace-info-text, #1e40af); }
.status.assigned { background: var(--workspace-raised, #e5e7eb); color: var(--workspace-strong-text, #374151); }
.status.dry_run, .status.needs_card, .status.processing, .status.pending_recharge, .status.unfreezing { background: var(--workspace-warn-bg, #fef3c7); color: var(--workspace-warn-text, #92400e); }
.status.succeed, .status.normal, .status.authorized { background: var(--workspace-ok-bg, #dcfce7); color: var(--workspace-ok-text, #166534); }
.status.failed, .status.freezing, .status.frozen, .status.risk_frozen, .status.system_frozen, .status.canceling, .status.cancelled, .status.deleted { background: var(--workspace-error-bg, #fee2e2); color: var(--workspace-error-text, #991b1b); }
.credit-card-bound-table .status.available,
.credit-card-bill-table .status.available { background: var(--workspace-ok-bg, #dcfce7); color: var(--workspace-ok-text, #166534); }
.status.uncleared { background: var(--workspace-raised, #e5e7eb); color: var(--workspace-strong-text, #374151); }
.status.needs_adjustment { background: var(--workspace-error-bg, #fee2e2); color: var(--workspace-error-text, #991b1b); }
.status.adjusted { background: var(--workspace-info-bg, #dbeafe); color: var(--workspace-info-text, #1e40af); }
.credit-card-metrics { margin-bottom: 16px; }
.secret-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.secret-grid input[readonly] {
  background: var(--workspace-soft, #f8fafc);
  border-color: var(--workspace-edge, #cbd5e1);
  font-weight: 800;
}
.card-secret-panel {
  border-color: var(--workspace-warn-edge, #f59e0b);
  box-shadow: 0 12px 30px rgba(245, 158, 11, .12);
}
.credit-card-toolbar,
.credit-card-upload-strip,
.credit-card-upload-left,
.credit-card-upload-right,
.credit-card-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.credit-card-upload-strip {
  justify-content: space-between;
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--workspace-edge, #dfe5ec);
  border-radius: 7px;
  background: linear-gradient(180deg, var(--workspace-soft, #fbfcfe), var(--workspace-soft, #f7f9fc));
}
.credit-card-upload-left,
.credit-card-upload-right {
  min-width: 0;
}
.credit-card-add-row[hidden] {
  display: none;
}
.credit-card-upload-left > span {
  color: var(--workspace-muted-text, #586477);
  font-size: 12px;
  font-weight: 800;
}
.credit-card-provider-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--workspace-muted-text, #586477);
  font-size: 12px;
  font-weight: 800;
}
.credit-card-provider-choice select,
.credit-card-row-actions .table-select {
  width: auto;
  min-width: 100px;
  min-height: 32px;
  padding: 5px 26px 5px 8px;
  font-size: 12px;
}
.credit-card-row-actions form.inline {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.credit-card-selection-count {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--workspace-edge, #cbd5e1);
  border-radius: 7px;
  background: var(--workspace-panel, #fff);
  color: var(--workspace-strong-text, #334155);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.credit-card-upload-strip input[type="file"] {
  width: auto;
  min-height: 36px;
  padding: 5px 8px;
  background: var(--workspace-panel, #fff);
}
.credit-card-upload-strip .button,
.credit-card-upload-strip button,
.credit-card-toolbar .button,
.credit-card-toolbar button {
  width: 92px;
  min-height: 32px;
  padding: 7px 12px;
}
.credit-card-table-wrap {
  overflow-x: auto;
}
.credit-card-table {
  min-width: 980px;
}
.credit-card-table .select-col { width: 46px; }
.cc-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.cc-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cc-check span {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--workspace-edge, #cbd5e1);
  border-radius: 6px;
  background: var(--workspace-panel, #fff);
  box-shadow: inset 0 0 0 2px #fff;
}
.cc-check input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
}
.cc-check input:checked + span::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px 0 0 4px;
  border-left: 2px solid var(--workspace-edge, #fff);
  border-bottom: 2px solid var(--workspace-edge, #fff);
  transform: rotate(-45deg);
}

.credit-card-table .account-col { width: 20%; }
.credit-card-table .id-col { width: 19%; }
.credit-card-table .amount-col { width: 12%; }
.credit-card-table .status-col { width: 11%; }
.credit-card-table .card-col { width: 25%; }
.credit-card-table .op-col { width: 13%; }
.credit-card-add-row td {
  background: var(--workspace-soft, #fbfdff);
  padding-top: 8px;
  padding-bottom: 8px;
}
.credit-card-add-row input {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 13px;
}
.credit-card-row-actions {
  min-width: 160px;
}
.credit-card-row-actions .inline {
  margin: 0;
}
button.danger,
.table-button.danger {
  background: var(--danger-fill, var(--red));
  color: #fff;
}
.copy-card-button {
  white-space: nowrap;
}
.replace-card-button {
  background: var(--brand);
  color: #fff;
}
.credit-card-client-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 180px;
}
.credit-card-client-hover .client-current {
  color: var(--brand-dark);
  font-weight: 900;
  white-space: nowrap;
}
.credit-card-client-hover .client-current::before {
  content: "▶";
  margin-right: 6px;
  color: var(--focus, var(--brand));
  font-size: 11px;
}
.client-history-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: none;
  width: max-content;
  max-width: 360px;
  padding: 9px 10px;
  border: 1px solid var(--workspace-edge, #d9e1eb);
  border-radius: 7px;
  background: var(--workspace-control, #111827);
  color: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .22);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  white-space: normal;
}
.client-history-tip.is-visible {
  display: block;
}
.client-history-tip::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: var(--workspace-control, #111827);
  transform: rotate(45deg);
}
.client-history-tip.is-above::before {
  top: auto;
  bottom: -6px;
}
.replace-card-dialog {
  width: min(660px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .24);
}
.replace-card-dialog::backdrop {
  background: rgba(15, 23, 42, .42);
}
.replace-card-dialog-body {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}
.replace-card-panel {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--workspace-edge, #dbe3ef);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
}
.replace-card-auto-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--workspace-soft, #f8fafc);
}
.replace-card-auto-panel form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.replace-card-auto-panel .table-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding-inline: 16px;
}
.auto-replace-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--workspace-error-edge, #fecaca);
  border-radius: 8px;
  background: var(--workspace-error-bg, #fff7f7);
  color: var(--workspace-error-text, #991b1b);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}
.auto-replace-confirm input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0;
}
.replace-card-panel strong {
  display: block;
  font-size: 15px;
}
.replace-card-panel small {
  display: block;
  margin-top: 4px;
  color: var(--workspace-muted-text, #64748b);
  line-height: 1.45;
}
.reissue-mode-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--workspace-edge, #dbe3ef);
  border-radius: 8px;
  background: var(--workspace-soft, #f8fafc);
}
.reissue-mode-fieldset legend {
  padding: 0 6px;
  color: var(--workspace-strong-text, #334155);
  font-size: 13px;
  font-weight: 900;
}
.replace-card-panel-head {
  display: grid;
  gap: 2px;
}
.reissue-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.reissue-mode-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--workspace-edge, #dbe3ef);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  color: var(--workspace-strong-text, #334155);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}
.reissue-mode-options label:has(input:checked) {
  border-color: var(--workspace-info-edge, #93b4e8);
  background: var(--workspace-info-bg, #eff6ff);
  color: var(--workspace-info-text, #1e3a8a);
}
.reissue-mode-options input {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;
  margin: 0;
}
.manual-replace-form {
  display: grid;
  gap: 14px;
}
.dialog-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.dialog-title-row strong {
  display: block;
  font-size: 17px;
}
.dialog-title-row small {
  display: block;
  margin-top: 4px;
}
.icon-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 0;
  background: var(--workspace-raised, #eef2f6);
  color: var(--workspace-strong-text, #344154);
  font-size: 20px;
  line-height: 1;
}
.manual-replace-form > label,
.manual-replace-two-col label {
  display: grid;
  gap: 6px;
  color: var(--workspace-strong-text, #344154);
  font-size: 13px;
  font-weight: 800;
}
.manual-replace-form > label input,
.manual-replace-two-col input {
  width: 100%;
  height: 38px;
}
.manual-replace-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}
@media (max-width: 720px) {
  .replace-card-auto-panel {
    grid-template-columns: 1fr;
  }
  .replace-card-auto-panel form {
    align-items: stretch;
    flex-direction: column;
  }
  .reissue-mode-options {
    grid-template-columns: 1fr;
  }
  .manual-replace-two-col {
    grid-template-columns: 1fr;
  }
}
.card-copy-grid {
  display: grid;
  grid-template-columns: 32px minmax(96px, 1fr) 44px;
  gap: 4px 6px;
  align-items: center;
  max-width: 300px;
  font-size: 12px;
}
.card-copy-grid span {
  color: var(--workspace-muted-text, #64748b);
  font-weight: 800;
}
.card-copy-grid strong {
  font-size: 12px;
  white-space: nowrap;
}
.mini-copy-button {
  width: 42px;
  min-height: 24px;
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
}

.error-text {
  color: var(--workspace-error-text, #b91c1c);
}

.credit-card-job {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--workspace-info-edge, #bfdbfe);
  border-radius: 8px;
  background: var(--workspace-info-bg, #eff6ff);
  color: var(--workspace-info-text, #1e3a8a);
}
.credit-card-job-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-weight: 800;
}
.credit-card-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--workspace-info-bg, #dbeafe);
}
.credit-card-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width .25s ease;
}
.module-tabs.credit-card-tabs {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 0 0 8px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  border-bottom-color: var(--workspace-edge, #f8fafc);
  background: var(--workspace-soft, #f8fafc);
}
.module-tabs.credit-card-tabs button,
.module-tabs.credit-card-tabs a {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--workspace-muted-text, #475569);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
}
.module-tabs.credit-card-tabs button:hover,
.module-tabs.credit-card-tabs a:hover {
  background: var(--workspace-raised, #eef2f6);
  text-decoration: none;
}
.module-tabs.credit-card-tabs button.is-active,
.module-tabs.credit-card-tabs a.is-active {
  background: var(--workspace-control, #111827);
  color: #fff;
}
.module-tabs.credit-card-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--workspace-raised, #e9eef5);
  color: var(--workspace-muted-text, #526071);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.module-tabs.credit-card-tabs .is-active span {
  background: rgba(255,255,255,.18);
  color: #fff;
}
.credit-card-bound-toolbar,
.credit-card-bound-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin: 0 0 10px 0;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 8px;
  background: var(--workspace-panel, #fff);
}
.credit-card-bound-toolbar div:first-child {
  display: grid;
  gap: 2px;
}
.credit-card-bound-search {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: min(100%, 520px);
}
.credit-card-bound-search input {
  min-width: 320px;
  height: 38px;
}
.credit-card-bound-table {
  min-width: 1060px;
  table-layout: fixed;
}
.credit-card-bound-table-wrap {
  border-color: var(--workspace-edge, #e5eaf0);
}
.credit-card-bound-table th:nth-child(1),
.credit-card-bound-table td:nth-child(1) { width: 20%; }
.credit-card-bound-table th:nth-child(2),
.credit-card-bound-table td:nth-child(2) { width: 15%; }
.credit-card-bound-table th:nth-child(3),
.credit-card-bound-table td:nth-child(3) { width: 16%; }
.credit-card-bound-table th:nth-child(4),
.credit-card-bound-table td:nth-child(4) { width: 8%; }
.credit-card-bound-table th:nth-child(5),
.credit-card-bound-table td:nth-child(5) { width: 11%; }
.credit-card-bound-table th:nth-child(6),
.credit-card-bound-table td:nth-child(6) { width: 12%; }
.credit-card-bound-table th:nth-child(7),
.credit-card-bound-table td:nth-child(7) { width: 18%; }
.credit-card-bound-table th,
.credit-card-table th,
.credit-card-bill-table th {
  background: var(--workspace-soft, #f9fafb);
  color: var(--workspace-muted-text, #526071);
  font-size: 12px;
}
.credit-card-bound-table td,
.credit-card-table td,
.credit-card-bill-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}
.credit-card-bound-table .actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
}
.credit-card-bound-table .actions .inline {
  margin: 0;
}
.credit-card-bound-table .table-button {
  min-height: 30px;
  padding-inline: 9px;
}
.credit-card-bound-table .copy-card-button {
  background: var(--workspace-control, #111827);
}
.credit-card-bound-pager {
  margin: 10px 0 0 0;
  border-radius: 8px;
  background: var(--workspace-soft, #f8fafc);
}
.credit-card-bound-pager > div {
  display: flex;
  gap: 8px;
  align-items: center;
}
.button.disabled {
  opacity: .45;
  pointer-events: none;
}
.credit-card-bill-table {
  min-width: 0;
}
.credit-card-difference-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 13px;
}
.credit-card-difference-table th,
.credit-card-difference-table td {
  padding: 10px 8px;
  vertical-align: middle;
}
.credit-card-difference-table th:nth-child(1),
.credit-card-difference-table td:nth-child(1) { width: 32px; }
.credit-card-difference-table th:nth-child(2),
.credit-card-difference-table td:nth-child(2) { width: 17%; }
.credit-card-difference-table th:nth-child(3),
.credit-card-difference-table td:nth-child(3) { width: 16%; }
.credit-card-difference-table th:nth-child(4),
.credit-card-difference-table td:nth-child(4) { width: 8%; }
.credit-card-difference-table th:nth-child(5),
.credit-card-difference-table td:nth-child(5) { width: 15%; }
.credit-card-difference-table th:nth-child(6),
.credit-card-difference-table td:nth-child(6) { width: 12%; }
.credit-card-difference-table th:nth-child(7),
.credit-card-difference-table td:nth-child(7) { width: 8%; }
.credit-card-difference-table th:nth-child(8),
.credit-card-difference-table td:nth-child(8) { width: 7%; }
.credit-card-difference-table th:nth-child(9),
.credit-card-difference-table td:nth-child(9) { width: 10%; }
.credit-card-consumption-cell {
  min-width: 0;
  white-space: normal;
}

.credit-card-account-cell strong,
.credit-card-account-cell small,
.credit-card-current-card-cell strong,
.credit-card-current-card-cell small,
.credit-card-time-cell strong,
.credit-card-time-cell small {
  display: block;
}
.credit-card-account-cell,
.credit-card-current-card-cell,
.credit-card-time-cell {
  overflow-wrap: anywhere;
}
.credit-card-current-card-cell .status {
  display: inline-flex;
  margin-top: 4px;
}
.credit-card-account-cell strong,
.credit-card-current-card-cell strong {
  overflow-wrap: anywhere;
}
.credit-card-difference-table small {
  font-size: 11px;
}
.credit-card-difference-table .status {
  white-space: nowrap;
}

.credit-card-cell-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  white-space: nowrap;
}
.credit-card-cell-line strong {
  min-width: 0;
}
.credit-card-cell-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  white-space: nowrap;
  min-height: 22px;
}
.credit-card-calibrate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--workspace-edge, #cfd8e5);
  border-radius: 6px;
  background: var(--workspace-panel, #ffffff);
  color: var(--workspace-error-text, #b91c1c);
  font-size: 13px;
  font-weight: 760;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.credit-card-calibrate-button:hover {
  border-color: var(--workspace-error-edge, #ef4444);
  background: var(--workspace-error-bg, #fff7f7);
}
.credit-card-plus-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--workspace-edge, #cfd8e5);
  border-radius: 6px;
  background: var(--workspace-panel, #ffffff);
  color: var(--workspace-error-text, #b91c1c);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.credit-card-plus-button:hover {
  border-color: var(--workspace-error-edge, #ef4444);
  background: var(--workspace-error-bg, #fff7f7);
}
.credit-card-count-note {
  display: inline-flex;
}
.credit-card-warning-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--workspace-warn-text, #8a4b00);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}
.credit-card-warning-mark span {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 16px;
  color: var(--workspace-strong-text, #111827);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  z-index: 0;
}
.credit-card-warning-mark span::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #facc15;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.credit-card-warning-mark span::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -2;
  background: var(--workspace-control, #111827);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.credit-card-calibration-dialog {
  width: min(740px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}
.credit-card-calibration-dialog::backdrop {
  background: rgba(15, 23, 42, 0.32);
}
.credit-card-calibration-dialog .credit-card-calibration-card {
  margin: 0;
}
.credit-card-mapping-dialog {
  width: min(860px, calc(100vw - 32px));
}
.credit-card-mapping-warning {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--workspace-warn-edge, #fde68a);
  border-radius: 7px;
  background: var(--workspace-warn-bg, #fffbeb);
  color: var(--workspace-warn-text, #92400e);
  font-size: 13px;
  line-height: 1.55;
}
.credit-card-mapping-field,
.credit-card-mapping-confirm-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.credit-card-mapping-field textarea {
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.credit-card-mapping-preview {
  display: grid;
  gap: 4px;
  max-height: 150px;
  margin: 10px 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--workspace-edge, #dbe4f0);
  border-radius: 7px;
  background: var(--workspace-soft, #f8fafc);
  color: var(--muted);
  font-size: 12px;
}
.credit-card-mapping-preview strong { color: var(--text); }
.credit-card-mapping-preview.is-error { border-color: var(--workspace-error-edge, #fecaca); background: var(--workspace-error-bg, #fef2f2); color: var(--workspace-error-text, #b91c1c); }
.credit-card-mapping-confirm-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin: 10px 0 16px;
}
.credit-card-calibration-card {
  padding: 18px;
  border: 1px solid var(--workspace-edge, #dbe4f0);
  border-radius: 8px;
  background: var(--workspace-panel, #ffffff);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.20);
}
.credit-card-calibration-card-head,
.credit-card-calibration-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.credit-card-calibration-card-head strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
}
.credit-card-calibration-card-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.credit-card-card-close,
.credit-card-line-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.credit-card-card-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
}
.credit-card-card-close:hover,
.credit-card-line-remove:hover {
  background: var(--workspace-raised, #f3f4f6);
  color: var(--red);
}
.credit-card-calibration-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(240px, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.credit-card-calibration-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}
.credit-card-calibration-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.credit-card-spend-lines {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  max-height: min(45vh, 360px);
  overflow: auto;
}
.credit-card-spend-line {
  display: grid;
  grid-template-columns: minmax(130px, 1.1fr) minmax(190px, 1.5fr) minmax(90px, .7fr) minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--workspace-edge, #e5e7eb);
  border-radius: 8px;
  background: var(--workspace-soft, #f9fafb);
}
.credit-card-spend-line input,
.credit-card-calibration-grid input {
  height: 36px;
}
.credit-card-calibration-footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.credit-card-calibration-footer strong {
  margin-right: auto;
  color: var(--text);
}
.credit-card-calibration-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 230px;
}
.credit-card-calibration-form,
.credit-card-calibration-sync-form {
  display: flex;
  align-items: center;
  gap: 6px;
}
.credit-card-calibration-form input {
  width: 118px;
  height: 32px;
  min-width: 0;
}
.credit-card-adjust-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.credit-card-inline-adjust {
  margin-top: 0;
}
.credit-card-inline-adjust summary {
  list-style: none;
}
.credit-card-inline-adjust summary::-webkit-details-marker {
  display: none;
}
.credit-card-adjust-trigger {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}
.credit-card-adjust-trigger::before {
  content: "▸";
  font-size: 10px;
  line-height: 1;
}
.credit-card-inline-adjust[open] .credit-card-adjust-trigger::before {
  content: "▾";
}
.credit-card-inline-adjust .credit-card-calibration-form {
  margin-top: 5px;
}
.credit-card-difference-warning {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--workspace-warn-bg, #fff4d6);
  color: var(--workspace-warn-text, #9a4f00);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}
.table-button.compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}
.credit-card-bill-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  margin: 0 0 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-soft, #f8fafc);
}
.credit-card-bill-toolbar div:first-child {
  display: grid;
  gap: 2px;
}
.credit-card-bill-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 0 0 10px 0;
  color: var(--workspace-muted-text, #64748b);
  font-size: 12px;
}
.credit-card-bill-actions strong {
  color: var(--workspace-strong-text, #1f2937);
  font-size: 13px;
}
.credit-card-bill-toolbar small,
.muted {
  color: var(--workspace-muted-text, #64748b);
  font-size: 12px;
}
.status.unknown {
  background: var(--workspace-raised, #f1f5f9);
  color: var(--workspace-muted-text, #475569);
}

.danger-zone {
  border-color: var(--workspace-error-edge, #fecaca);
  background: var(--workspace-error-bg, #fff7f7);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metrics div { padding: 16px; min-height: 90px; }
.metrics small { display: block; margin-bottom: 8px; }
.metrics strong { font-size: 27px; line-height: 1; }
.danger { color: var(--workspace-error-text, #dc2626); }
.dashboard-metrics div,
.tg-metrics div {
  min-height: 82px;
}
.profit-dashboard {
  display: grid;
  gap: 14px;
}
.profit-periods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.profit-period {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-soft, #fbfcfe);
  padding: 14px;
}
.profit-period-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.profit-period-head small,
.profit-grid small,
.profit-grid span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}
.profit-period-head strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  line-height: 1;
}
.profit-period-head > span {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--workspace-info-bg, #eef4ff);
  color: var(--workspace-muted-text, #31506d);
  font-size: 12px;
  font-weight: 800;
}
.profit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.profit-grid div {
  min-height: 82px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 10px;
}
.profit-grid strong {
  display: block;
  margin: 6px 0;
  font-size: 20px;
  line-height: 1.1;
}
.profit-grid span {
  font-size: 12px;
  line-height: 1.35;
}
.dashboard-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
.dashboard-focus {
  display: grid;
  grid-template-rows: auto 1fr;
}
.focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.focus-grid div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-soft, #fbfcfe);
  padding: 12px;
  min-height: 78px;
}
.focus-grid small {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
}
.focus-grid strong {
  font-size: 24px;
  line-height: 1;
}
.compact-feed {
  display: grid;
  gap: 8px;
}
.compact-feed a,
.compact-feed div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: var(--workspace-panel, #fff);
}
.compact-feed a:hover {
  border-color: var(--brand);
  text-decoration: none;
}
.compact-feed strong,
.compact-feed small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compact-feed small {
  grid-column: 2;
  color: var(--muted);
}
.compact-commands {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.tool-page {
  min-height: 100vh;
  background: var(--workspace-soft, #f5f6f8);
  color: var(--text);
}
.tool-shell {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 28px 0 40px;
  display: grid;
  gap: 18px;
}
.tool-head {
  min-height: 112px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
}
.tool-head h1 {
  font-size: 34px;
  line-height: 1.08;
}
.tool-head p {
  margin-top: 8px;
  max-width: 620px;
}
.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 18px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .05);
}
.twofa-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 220px minmax(0, .95fr);
  gap: 16px;
  align-items: stretch;
}
.tool-input,
.tool-output {
  display: grid;
  gap: 10px;
}
.tool-input label,
.tool-output h2 {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}
.tool-input textarea,
.tool-output textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}
.tool-actions,
.tool-output-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.twofa-status {
  display: grid;
  gap: 12px;
}
.twofa-status div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--workspace-soft, #fbfcfe);
  padding: 16px;
  display: grid;
  align-content: center;
  min-height: 100px;
}
.twofa-status small {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}
.twofa-status strong {
  font-size: 34px;
  line-height: 1;
}
.tool-note {
  min-height: 24px;
  font-size: 13px;
}
.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.quick-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-strip a, .mini-list a, .count-grid a {
  background: var(--workspace-panel, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
}
.quick-strip a:hover, .mini-list a:hover, .count-grid a:hover {
  border-color: var(--brand);
  text-decoration: none;
}
.quick-strip strong, .quick-strip span, .mini-list span, .mini-list strong {
  display: block;
}
.quick-strip span { margin-top: 6px; color: var(--muted); }
.mini-list { display: grid; gap: 8px; }
.mini-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.count-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.count-grid a strong {
  display: block;
  margin: 4px 0;
  font-size: 24px;
}
.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filters select { min-width: 150px; }
.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.code-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-soft, #f8fafc);
  padding: 12px;
  margin-bottom: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ship-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.ship-main {
  min-width: 0;
}
.ship-product-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.ship-product-option {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.ship-product-option strong,
.ship-product-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ship-product-option span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ship-product-option.active {
  border-color: var(--brand);
  background: var(--workspace-error-bg, #fff5f5);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.ship-stock-head {
  margin-top: 4px;
}
.manual-ship-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) 90px minmax(180px, 1fr) repeat(2, minmax(150px, 1fr));
  gap: 10px;
  align-items: start;
}
.manual-ship-form > .client-search-picker {
  max-width: none;
  min-width: 0;
}
.field-with-help {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}
.field-with-help > span {
  display: block;
  margin-bottom: 6px;
}
.field-with-help input,
.field-with-help select,
.field-with-help textarea {
  display: block;
  padding-right: 44px;
}
.field-with-help .check-row {
  padding-right: 44px;
}
.field-help {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--workspace-edge, #cfd7e3);
  border-radius: 999px;
  background: var(--workspace-soft, #f8fafc);
  color: var(--workspace-muted-text, #586477);
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  cursor: help;
  box-shadow: 0 0 0 3px #fff;
  z-index: 3;
}
.field-help:hover,
.field-help:focus,
.field-help.is-open {
  border-color: var(--brand);
  background: var(--workspace-error-bg, #fff5f5);
  color: var(--focus, var(--brand));
}
.field-help::after {
  content: attr(data-tip);
  position: absolute;
  right: -1px;
  top: calc(100% + 8px);
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid var(--workspace-edge, #e3e8f0);
  border-radius: 8px;
  background: var(--workspace-control, #111827);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 20;
}
.field-help::before {
  content: "";
  position: absolute;
  right: 5px;
  top: calc(100% + 3px);
  border: 6px solid transparent;
  border-bottom-color: var(--workspace-edge, #111827);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 21;
}
.field-help:hover::after,
.field-help:hover::before,
.field-help:focus::after,
.field-help:focus::before,
.field-help.is-open::after,
.field-help.is-open::before {
  opacity: 1;
  visibility: visible;
}
.field-with-label .field-help {
  top: auto;
  bottom: 9px;
  transform: none;
}
.client-settings-form .split > *,
.client-settings-form .field-with-help {
  min-width: 0;
}
.client-settings-form .field-with-help input,
.client-settings-form .field-with-help select {
  min-height: 38px;
  padding-right: 46px;
}
.client-settings-form .field-with-help .field-help {
  top: 9px;
  right: 12px;
  transform: none;
  display: inline-flex;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
}
.textarea-field .field-help {
  top: auto;
  bottom: 10px;
  transform: none;
}
.manual-ship-form .textarea-field {
  grid-column: 1 / -1;
}
.manual-ship-form .textarea-field textarea {
  grid-column: 1 / -1;
  min-height: 120px;
  resize: vertical;
}
.compact-note-textarea {
  min-height: 46px;
  max-height: 130px;
  resize: vertical;
}
.manual-ship-form .manual-ship-submit {
  justify-self: start;
}
.ship-action-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}
.ship-selected-count {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-soft, #f8fafc);
}
.ship-selected-count strong {
  font-size: 32px;
  line-height: 1;
  color: var(--focus, var(--brand));
}
.ship-selected-count span {
  color: var(--muted);
  font-weight: 700;
}
.ship-stock-list {
  display: grid;
  gap: 8px;
  max-height: 720px;
  overflow: auto;
  padding-right: 4px;
}
.ship-stock-row {
  display: grid;
  grid-template-columns: 30px 70px minmax(220px, 1fr) minmax(340px, 2fr) 58px max-content 72px;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  cursor: pointer;
}
.ship-stock-row:has(input:checked) {
  border-color: var(--brand);
  background: var(--workspace-error-bg, #fff5f5);
}
.ship-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.ship-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ship-check > span {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--workspace-edge, #cbd5e1);
  border-radius: 6px;
  background: var(--workspace-panel, #fff);
  box-shadow: inset 0 0 0 2px #fff;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.ship-stock-row:hover .ship-check > span {
  border-color: var(--workspace-edge, #94a3b8);
}
.ship-check input:focus-visible + span {
  outline: 2px solid rgba(220, 38, 38, .28);
  outline-offset: 2px;
}
.ship-check input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
}
.ship-check input:checked + span::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px 0 0 4px;
  border-left: 2px solid var(--workspace-edge, #fff);
  border-bottom: 2px solid var(--workspace-edge, #fff);
  transform: rotate(-45deg);
}
.stock-row-id {
  color: var(--muted);
  font-weight: 800;
}
.stock-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.stock-row-main strong,
.stock-row-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stock-row-main small {
  color: var(--muted);
}
.stock-row-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  justify-content: flex-start;
}
.stock-row-meta,
.stock-row-recharge,
.stock-row-origin,
.stock-row-card,
.stock-row-price {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--workspace-raised, #eef2f7);
  color: var(--workspace-strong-text, #344054);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
}
.stock-row-badges:empty {
  display: block;
}
.stock-row-price {
  background: var(--workspace-error-bg, #fee2e2);
  color: var(--workspace-error-text, #991b1b);
  justify-self: end;
}
.stock-row-recharge {
  background: var(--workspace-ok-bg, #dcfce7);
  color: var(--workspace-ok-text, #166534);
}
.stock-row-origin {
  background: var(--workspace-violet-bg, #e0e7ff);
  color: var(--workspace-violet-text, #3730a3);
}
.stock-row-card {
  background: var(--workspace-raised, #f1f5f9);
  color: var(--workspace-muted-text, #475569);
}
.stock-row-card.status-card {
  background: var(--workspace-warn-bg, #fef3c7);
  color: var(--workspace-warn-text, #92400e);
}
.hint-box {
  margin-top: 12px;
  border: 1px solid var(--workspace-warn-edge, #fde68a);
  background: var(--workspace-warn-bg, #fffbeb);
  color: var(--workspace-warn-text, #713f12);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}
.hint-box code {
  background: var(--workspace-warn-bg, #fff7d6);
  border-color: var(--workspace-warn-edge, #f5d76e);
}
.command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.command-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--workspace-soft, #fbfcfe);
}
.command-grid strong, .command-grid code {
  display: block;
  margin-top: 6px;
}
.empty-state {
  border: 1px dashed var(--workspace-edge, #c9d2df);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: var(--workspace-panel, #fff);
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}
.login-panel {
  width: min(420px, calc(100vw - 32px));
  background: var(--workspace-panel, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.form-error {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
}
.compact-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.compact-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.template-board {
  display: grid;
  gap: 14px;
}
.template-editor {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 14px;
  align-items: stretch;
}
.template-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.template-heading h3 {
  margin: 0 0 4px;
  font-size: 17px;
}
.template-heading p, #message-templates .section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.template-editor textarea {
  min-height: 168px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.template-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip {
  min-height: 28px;
  padding: 4px 8px;
  background: var(--workspace-panel, #fff);
  border: 1px solid var(--workspace-edge, #dce3ec);
  border-radius: 6px;
  color: var(--workspace-muted-text, #4b5565);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}
.tag-chip:hover {
  background: var(--workspace-error-bg, #fff5f5);
  border-color: var(--workspace-error-edge, #f0b3b7);
  color: var(--brand-dark);
}
.template-preview {
  border: 1px solid var(--workspace-edge, #dce3ec);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}
.template-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.template-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--workspace-strong-text, #202938);
}
.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}
@media (max-width: 1280px) {
  .category-grid, .product-board { grid-template-columns: 1fr; }
  .manager-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .count-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .twofa-workbench {
    grid-template-columns: 1fr;
  }
  .twofa-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metrics, .profit-periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2, .quick-strip, .command-grid, .dashboard-band, .manager-layout, .inventory-tools, .ship-layout, .grid.two, .template-editor {
    grid-template-columns: 1fr;
  }
  .historical-import-mini {
    width: 100%;
  }
  .historical-import-mini .mini-controls {
    grid-template-columns: minmax(160px, 1fr) auto;
  }
  .historical-upload-form {
    grid-column: 1 / -1;
  }
  .ship-product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manual-ship-form { grid-template-columns: 1fr 100px; }
  .manual-ship-form > input,
  .manual-ship-form > select,
  .manual-ship-form > .client-search-picker,
  .manual-ship-form > .field-with-help,
  .manual-ship-form .manual-ship-submit {
    grid-column: 1 / -1;
  }
  .ship-action-panel { position: static; order: -1; }
  .create-panel { position: static; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  .catalog-form, .catalog-form.refined { grid-template-columns: 1fr 1fr; }
  .inventory-upload-form { grid-template-columns: 1fr; }
  .activity-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: span 1; }
}
@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .profit-periods,
  .profit-grid {
    grid-template-columns: 1fr;
  }
  .tool-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }
  .tool-head {
    display: grid;
    padding: 18px;
  }
  .tool-head h1 {
    font-size: 28px;
  }
  .twofa-status {
    grid-template-columns: 1fr;
  }
  .tool-actions,
  .tool-output-head {
    align-items: stretch;
    flex-direction: column;
  }
  .tool-actions button,
  .tool-output-head button,
  .tool-head .button {
    width: 100%;
  }
  .credit-card-calibration-grid,
  .credit-card-spend-line {
    grid-template-columns: 1fr;
  }
  .credit-card-calibration-card-head,
  .credit-card-calibration-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .credit-card-calibration-footer strong {
    margin-right: 0;
  }
  .historical-import-mini .mini-controls {
    grid-template-columns: 1fr auto;
  }
  .historical-import-mini input[type="file"] {
    width: 100%;
  }
  .metrics, .split, .card-metrics, .stock-summary, .form-grid, .compact-grid, .count-grid {
    grid-template-columns: 1fr;
  }
  .filters { flex-direction: column; align-items: stretch; }
  .wide-inline { min-width: 420px; }
  .inline-form, .catalog-form, .catalog-form.refined, .activity-filter-form, .compact-form { grid-template-columns: 1fr; }
  .ship-product-list { grid-template-columns: 1fr; }
  .manual-ship-form { grid-template-columns: 1fr; }
  .manual-ship-form > input,
  .manual-ship-form > select,
  .manual-ship-form > .client-search-picker,
  .manual-ship-form > .field-with-help,
  .manual-ship-form .manual-ship-submit {
    grid-column: 1 / -1;
  }
  .ship-stock-list { max-height: none; }
  .ship-stock-row {
    grid-template-columns: 30px 58px minmax(0, 1fr) 64px;
    min-height: 70px;
  }
  .stock-row-badges {
    grid-column: 3 / 4;
  }
  .stock-row-catalog { display: none; }
  .stock-row-recharge,
  .stock-row-origin,
  .stock-row-card {
    grid-column: 3 / 4;
    justify-self: start;
  }
  .stock-row-price { justify-self: end; }
  .workflow-tabs { overflow-x: auto; }
  .workflow-tabs a { white-space: nowrap; }
  .clear-return-panel .table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .clear-return-table {
    min-width: 0;
    display: block;
    width: 100%;
    border-collapse: separate;
  }
  .clear-return-table thead {
    display: none;
  }
  .clear-return-table tbody {
    display: grid;
    gap: 12px;
  }
  .clear-return-table tr {
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--workspace-panel, #fff);
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .clear-return-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 0;
    border: 0;
  }
  .clear-return-table td::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .clear-return-entry-table td:nth-child(1)::before,
  .clear-completed-table td:nth-child(1)::before { content: "客户"; }
  .clear-return-entry-table td:nth-child(2)::before,
  .clear-completed-table td:nth-child(2)::before { content: "绑定群"; }
  .clear-return-entry-table td:nth-child(3)::before,
  .clear-completed-table td:nth-child(3)::before { content: "户名"; }
  .clear-return-entry-table td:nth-child(4)::before,
  .clear-completed-table td:nth-child(4)::before { content: "广告账户"; }
  .clear-return-entry-table td:nth-child(5)::before,
  .clear-completed-table td:nth-child(5)::before { content: "标签"; }
  .clear-return-entry-table td:nth-child(6)::before { content: "状态"; }
  .clear-return-entry-table td:nth-child(7)::before { content: "清零时间"; }
  .clear-return-entry-table td:nth-child(8)::before { content: "最近回填"; }
  .clear-return-entry-table td:nth-child(9)::before,
  .clear-completed-table td:nth-child(6)::before { content: "清零余额"; }
  .clear-return-entry-table td:nth-child(10)::before { content: "总充值"; }
  .clear-return-entry-table td:nth-child(11)::before { content: "总消耗"; }
  .clear-completed-table td:nth-child(7)::before { content: "总充值"; }
  .clear-completed-table td:nth-child(8)::before { content: "总消耗"; }
  .clear-completed-table td:nth-child(9)::before { content: "清零时间"; }
  .clear-completed-table td:nth-child(10)::before { content: "回填时间"; }
  .clear-return-table input[name^="returned_balance_"],
  .clear-return-table input[name^="cumulative_recharge_"],
  .clear-return-table input[name^="total_spend_"] {
    width: 100%;
  }
.bulk-return-actions {
    display: grid;
    justify-content: stretch;
  }
  .bulk-return-submit {
    display: grid;
    justify-content: stretch;
    margin-left: 0;
  }
}

/* Telegram operations workspace · 2026-08-03 */
.telegram-page { scroll-behavior: smooth; }
.telegram-page .page-head { min-height: 74px; }
.telegram-page .page-actions { display: flex; align-items: center; gap: 8px; }
.telegram-page .page-actions .button { gap: 7px; }
.telegram-page .panel { border-color: var(--workspace-edge, #e0e5eb); box-shadow: none; }
.telegram-page [id] { scroll-margin-top: 58px; }
.tg-section-nav {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: -4px 0 12px;
  padding: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--workspace-glass, rgba(255, 255, 255, .94));
  box-shadow: 0 5px 18px rgba(15, 23, 42, .04);
  backdrop-filter: blur(10px);
}
.tg-section-nav a { min-height: 31px; padding: 7px 12px; display: inline-flex; align-items: center; border-radius: 6px; color: var(--workspace-muted-text, #5d6879); font-size: 12px; font-weight: 800; white-space: nowrap; }
.tg-section-nav a:hover,
.tg-section-nav a.active { background: var(--workspace-error-bg, #fceced); color: var(--brand-dark); text-decoration: none; }
.tg-overview-grid { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tg-overview-card { min-width: 0; min-height: 82px; padding: 13px 14px; display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--workspace-panel, #fff); }
.tg-overview-card.attention { border-color: var(--workspace-error-edge, #f2c7c9); background: var(--workspace-soft, #fffafa); }
.tg-overview-icon,
.tg-section-icon,
.tg-command-grid article > span,
.tg-template-icon { display: grid; place-items: center; border-radius: 8px; background: var(--workspace-raised, #f1f4f8); color: var(--workspace-muted-text, #566274); }
.tg-overview-icon { width: 42px; height: 42px; font-size: 20px; }
.tg-overview-card.attention .tg-overview-icon { background: var(--workspace-error-bg, #feecee); color: var(--brand-dark); }
.tg-overview-icon .ti,
.tg-section-icon .ti,
.tg-command-grid article > span .ti,
.tg-template-icon .ti { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.tg-overview-icon .ti::before,
.tg-section-icon .ti::before,
.tg-command-grid article > span .ti::before,
.tg-template-icon .ti::before { margin: 0; line-height: 1; }
.tg-overview-card div { min-width: 0; }
.tg-overview-card small,
.tg-overview-card strong,
.tg-overview-card div > span { display: block; }
.tg-overview-card small { color: var(--muted); font-size: 11px; font-weight: 800; }
.tg-overview-card strong { margin: 2px 0; font-size: 22px; line-height: 1.1; }
.tg-overview-card div > span { overflow: hidden; color: var(--workspace-subtle-text, #8a94a4); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tg-page-alert { margin: 0 0 12px; display: flex; align-items: center; gap: 7px; }
.tg-control-grid { margin-bottom: 12px; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 12px; }
.tg-control-card { margin: 0; padding: 16px; }
.tg-card-head { min-height: 46px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: start; gap: 11px; }
.tg-section-icon { width: 40px; height: 40px; color: var(--workspace-muted-text, #536073); font-size: 19px; }
.tg-card-head h2,
.tg-section-heading h2 { margin: 1px 0 2px; font-size: 18px; line-height: 1.2; }
.tg-card-head p,
.tg-section-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.tg-card-head .eyebrow,
.tg-section-heading .eyebrow { font-size: 10px; }
.tg-card-head > .status { margin-top: 2px; }
.tg-card-head > button { gap: 5px; }
.tg-status-list { margin: 13px 0 0; border-top: 1px solid var(--line-soft); }
.tg-status-list > div { min-height: 40px; display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.tg-status-list > div:last-child { border-bottom: 0; }
.tg-status-list dt { color: var(--muted); font-size: 11px; font-weight: 750; }
.tg-status-list dd { margin: 0; min-width: 0; color: var(--text); font-size: 12px; text-align: right; }
.tg-status-list dd code { max-width: 100%; padding: 4px 7px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.tg-status-list dd a { display: inline-flex; align-items: center; gap: 3px; font-weight: 750; }
.tg-admin-list { margin-top: 13px; display: grid; border-top: 1px solid var(--line-soft); }
.tg-admin-row { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.tg-admin-row:last-child { border-bottom: 0; }
.tg-admin-row > span { display: inline-flex; align-items: center; gap: 8px; color: var(--workspace-muted-text, #536073); }
.tg-admin-row > span > .ti { font-size: 16px; }
.tg-admin-row code { color: var(--text); font-weight: 750; }
.tg-admin-row .delete-button { min-width: 68px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: #fff; }
.tg-empty-row { padding: 20px; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: 12px; }
.tg-command-panel,
.tg-template-panel,
.tg-batch-panel { margin: 0 0 12px; padding: 0; overflow: hidden; }
.tg-section-heading { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line-soft); }
.tg-section-count { padding: 5px 9px; border-radius: 999px; background: var(--workspace-raised, #f1f4f8); color: var(--workspace-muted-text, #647084); font-size: 10px; font-weight: 800; white-space: nowrap; }
.tg-command-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tg-command-grid article { min-width: 0; min-height: 74px; padding: 13px 16px; display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px; border-right: 1px solid var(--line-soft); }
.tg-command-grid article:last-child { border-right: 0; }
.tg-command-grid article > span { width: 36px; height: 36px; font-size: 17px; }
.tg-command-grid article strong,
.tg-command-grid article code { display: block; }
.tg-command-grid article strong { margin-bottom: 4px; font-size: 12px; }
.tg-command-grid article code { overflow: hidden; color: var(--workspace-muted-text, #687487); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tg-template-heading { align-items: flex-end; }
.tg-template-search { width: min(340px, 42%); min-height: 36px; padding: 0 9px; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--workspace-panel, #fff); color: var(--workspace-subtle-text, #8a95a5); }
.tg-template-search input { min-height: 34px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.tg-template-search input:focus { outline: 0; box-shadow: none; }
.tg-template-search:focus-within { border-color: var(--workspace-edge, #aeb8c6); box-shadow: 0 0 0 3px rgba(23, 105, 224, .08); }
.tg-template-search kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--workspace-soft, #f5f7f9); color: var(--workspace-subtle-text, #7b8696); font: 10px/1.3 inherit; }
.tg-template-list { background: var(--workspace-panel, #fff); }
.tg-template-card { border-bottom: 1px solid var(--line-soft); }
.tg-template-card:last-of-type { border-bottom: 0; }
.tg-template-card > summary { min-height: 62px; padding: 10px 16px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 44px 18px; align-items: center; gap: 11px; cursor: pointer; list-style: none; }
.tg-template-card > summary::-webkit-details-marker { display: none; }
.tg-template-card > summary:hover { background: var(--workspace-soft, #fafbfc); }
.tg-template-card[open] > summary { background: var(--workspace-error-bg, #fffafb); border-bottom: 1px solid var(--workspace-error-edge, #f2d8da); }
.tg-template-icon { width: 36px; height: 36px; font-size: 17px; }
.tg-template-card[open] .tg-template-icon { background: var(--workspace-error-bg, #feecee); color: var(--brand-dark); }
.tg-template-summary { min-width: 0; }
.tg-template-summary strong,
.tg-template-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-template-summary strong { margin-bottom: 3px; font-size: 13px; }
.tg-template-summary small { color: var(--muted); font-size: 10px; }
.tg-template-meta { padding: 4px 8px; border-radius: 999px; background: var(--workspace-raised, #f1f4f8); color: var(--workspace-muted-text, #697588); font-size: 10px; white-space: nowrap; }
.tg-template-edit { color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.tg-template-chevron { color: var(--workspace-subtle-text, #8994a4); transition: transform .2s ease; }
.tg-template-card[open] .tg-template-chevron { transform: rotate(180deg); }
.tg-template-content { padding: 15px 16px 16px; display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(300px, .78fr); gap: 14px; background: var(--workspace-soft, #fafbfc); }
.tg-template-editor,
.tg-template-preview { min-width: 0; }
.tg-template-toolbar { min-height: 32px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--workspace-muted-text, #4f5b6c); font-size: 11px; font-weight: 800; }
.tg-template-toolbar button { gap: 5px; }
.tg-template-editor textarea { width: 100%; min-height: 170px; resize: vertical; background: var(--workspace-panel, #fff); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.6; }
.tg-token-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.tg-token-bar .tag-list { flex: 1 1 auto; }
.tg-token-bar > button { flex: 0 0 auto; gap: 6px; }
.tg-template-preview { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--workspace-panel, #fff); }
.tg-template-preview > span { display: flex; align-items: center; gap: 6px; color: var(--workspace-muted-text, #697587); font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.tg-template-preview pre { margin: 10px 0 0; max-height: 234px; overflow: auto; color: var(--workspace-strong-text, #313a48); font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.tg-template-empty { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--workspace-subtle-text, #8994a4); }
.tg-template-empty[hidden] { display: none; }
.tg-template-empty .ti { margin-bottom: 4px; font-size: 24px; }
.tg-template-empty strong { color: var(--workspace-muted-text, #566173); font-size: 13px; }
.tg-template-empty span { font-size: 11px; }
.tg-table-empty { min-height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--workspace-subtle-text, #8994a4); }
.tg-table-empty .ti { margin-bottom: 3px; font-size: 23px; }
.tg-table-empty strong { color: var(--workspace-muted-text, #566173); font-size: 12px; }
.tg-table-empty span { font-size: 10px; }
.tg-admin-dialog::backdrop { background: rgba(15, 23, 42, .52); backdrop-filter: blur(2px); }
.tg-admin-dialog .dialog-actions { margin-top: 2px; }
.tg-admin-dialog .dialog-actions button { gap: 6px; }

@media (max-width: 1120px) {
  .tg-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-control-grid { grid-template-columns: 1fr; }
  .tg-command-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-command-grid article:nth-child(2) { border-right: 0; }
  .tg-command-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .tg-template-content { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .telegram-page .app-shell { padding: 12px; }
  .telegram-page .page-actions { width: 100%; }
  .telegram-page .page-actions .button { flex: 1 1 0; justify-content: center; }
  .tg-section-nav { margin-top: 0; }
  .tg-overview-grid { grid-template-columns: 1fr; }
  .tg-section-heading { align-items: stretch; flex-direction: column; gap: 10px; }
  .tg-template-search { width: 100%; }
  .tg-template-card > summary { grid-template-columns: 36px minmax(0, 1fr) 18px; }
  .tg-template-meta,
  .tg-template-edit { display: none; }
  .tg-command-grid { grid-template-columns: 1fr; }
  .tg-command-grid article { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .tg-command-grid article:last-child { border-bottom: 0; }
  .tg-token-bar { align-items: stretch; flex-direction: column; }
  .tg-token-bar > button { width: 100%; justify-content: center; }
  .tg-status-list > div { grid-template-columns: 92px minmax(0, 1fr); }
}

.statement-page {
  background: var(--statement-bg);
  color: var(--statement-text);
  --statement-bg: #f3f5f8;
  --statement-surface: #ffffff;
  --statement-soft: #f8fafc;
  --statement-soft-2: #f4f7fb;
  --statement-border: #dbe3ee;
  --statement-border-strong: #d7dee8;
  --statement-text: #111827;
  --statement-muted: #647084;
  --statement-chip-bg: #edf4ff;
  --statement-chip-text: #1d4ed8;
  --statement-active-bg: #eef4fb;
  --statement-active-border: #9ec5ff;
  --statement-hover: #f8fbff;
  --statement-hero-bg: linear-gradient(135deg, #ffffff 0%, #f8fafc 68%, #eef6ff 100%);
  --statement-shadow: 0 8px 22px rgba(15, 23, 42, .045);
  --statement-hero-shadow: 0 12px 32px rgba(15, 23, 42, .07);
  --statement-balance-bg: #f0f7ff;
  --statement-negative-bg: #fff5f5;
  --statement-negative-border: #f8b4b4;
}
.statement-page[data-statement-theme="dark"] {
  color-scheme: dark;
  --statement-bg: #141922;
  --statement-surface: #202733;
  --statement-soft: #18212d;
  --statement-soft-2: #263241;
  --statement-border: #384658;
  --statement-border-strong: #46576d;
  --statement-text: #f3f7fb;
  --statement-muted: #b3bfcc;
  --statement-chip-bg: #203955;
  --statement-chip-text: #b7d6ff;
  --statement-active-bg: #233954;
  --statement-active-border: #6aa7f8;
  --statement-hover: #26313f;
  --statement-hero-bg: linear-gradient(135deg, #202733 0%, #1a2431 58%, #243a54 100%);
  --statement-shadow: 0 10px 28px rgba(0, 0, 0, .24);
  --statement-hero-shadow: 0 16px 40px rgba(0, 0, 0, .26);
  --statement-balance-bg: #1d3148;
  --statement-negative-bg: #3a2129;
  --statement-negative-border: #b65a65;
}
.statement-page[data-statement-theme="midnight"] {
  color-scheme: dark;
  --statement-bg: #070a12;
  --statement-surface: #101722;
  --statement-soft: #0c121d;
  --statement-soft-2: #162131;
  --statement-border: #253247;
  --statement-border-strong: #33445d;
  --statement-text: #f5f8fc;
  --statement-muted: #a7b4c5;
  --statement-chip-bg: #162945;
  --statement-chip-text: #c7ddff;
  --statement-active-bg: #1a2c48;
  --statement-active-border: #4d8df2;
  --statement-hover: #162031;
  --statement-hero-bg: linear-gradient(135deg, #101722 0%, #0e1622 58%, #192b46 100%);
  --statement-shadow: 0 12px 34px rgba(0, 0, 0, .34);
  --statement-hero-shadow: 0 18px 48px rgba(0, 0, 0, .38);
  --statement-balance-bg: #122744;
  --statement-negative-bg: #301b24;
  --statement-negative-border: #984654;
}
.statement-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 44px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}
.statement-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--statement-border-strong);
  border-radius: 8px;
  background: var(--statement-hero-bg);
  box-shadow: var(--statement-hero-shadow);
}
.statement-title {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
}
.statement-hero .eyebrow {
  margin: 0;
}
.statement-hero h1 {
  font-size: 34px;
  line-height: 1.08;
}
.statement-hero p {
  font-size: 14px;
}
.statement-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.statement-meta span,
.statement-result-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--statement-border);
  border-radius: 7px;
  background: var(--statement-soft);
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 800;
}
.statement-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 8px;
  min-width: max-content;
}
.statement-tool-links {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-soft);
}
.statement-tool-links span,
.statement-tool-links a {
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}
.statement-tool-links span {
  color: var(--statement-muted);
}
.statement-tool-links a {
  background: var(--statement-active-bg);
  color: var(--statement-text);
  box-shadow: inset 0 0 0 1px var(--statement-active-border);
}
.statement-tool-links a:hover {
  text-decoration: none;
}
.statement-theme-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-soft);
}
.statement-theme-switch button {
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 6px;
  background: transparent;
  color: var(--statement-muted);
  font-size: 12px;
}
.statement-theme-switch button.is-active {
  background: var(--statement-active-bg);
  color: var(--statement-text);
  box-shadow: inset 0 0 0 1px var(--statement-active-border);
}
.statement-page input,
.statement-page select,
.statement-page textarea {
  background: var(--statement-soft);
  border-color: var(--statement-border);
  color: var(--statement-text);
}
.statement-page code {
  background: var(--statement-soft);
  border-color: var(--statement-border);
  color: var(--statement-text);
}
.statement-page .button {
  background: var(--statement-text);
  color: var(--statement-surface);
}
.statement-page[data-statement-theme="dark"] .button,
.statement-page[data-statement-theme="midnight"] .button {
  background: #e5edf7;
  color: #0b1220;
}
.statement-page .field-help {
  background: var(--statement-soft);
  border-color: var(--statement-border);
  color: var(--statement-muted);
}
.statement-page .danger {
  color: #ef4444;
}
.migration-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 6px;
  padding: 0 7px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  white-space: nowrap;
}
.migration-pill::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(320px, calc(100vw - 48px));
  padding: 8px 10px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 40;
}
.migration-pill::before {
  content: "";
  position: absolute;
  left: 12px;
  bottom: calc(100% + 3px);
  border: 6px solid transparent;
  border-top-color: #111827;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 41;
}
.migration-pill:hover::after,
.migration-pill:hover::before,
.migration-pill:focus::after,
.migration-pill:focus::before {
  opacity: 1;
  visibility: visible;
}
.statement-page[data-statement-theme="dark"] .migration-pill,
.statement-page[data-statement-theme="midnight"] .migration-pill {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
}
.statement-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) repeat(3, minmax(190px, 1fr));
  gap: 10px;
}
.statement-summary > div {
  min-height: 102px;
  padding: 15px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  display: grid;
  align-content: space-between;
  gap: 8px;
  box-shadow: var(--statement-shadow);
}

.statement-summary small {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  line-height: 1.25;
  color: var(--statement-muted);
  font-weight: 800;
  position: relative;
}
.statement-summary strong {
  font-size: 23px;
  line-height: 1;
  color: var(--statement-text);
}
.statement-balance {
  position: relative;
  background: var(--statement-balance-bg) !important;
  border-color: var(--statement-active-border) !important;
}
.statement-balance.is-negative {
  background: var(--statement-negative-bg) !important;
  border-color: var(--statement-negative-border) !important;
}
.statement-balance strong {
  font-size: 36px;
}
.statement-balance span {
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 800;
}
.statement-checkout-form {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
}
.statement-checkout-form button {
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
}
.statement-summary .field-help {
  position: static;
  transform: none;
  flex: 0 0 auto;
}
.statement-summary .field-help::after {
  right: auto;
  left: 0;
  max-width: min(100%, 320px);
}
.statement-summary .field-help::before { display: none; }
.statement-formula {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  box-shadow: var(--statement-shadow);
}
.statement-formula div {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--statement-border);
  border-radius: 7px;
  background: var(--statement-soft);
}
.statement-formula span {
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 800;
}
.statement-formula strong {
  color: var(--statement-text);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}
.statement-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  box-shadow: var(--statement-shadow);
}
.statement-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--statement-muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.statement-tabs a:hover,
.statement-tabs a.is-active {
  background: var(--statement-active-bg);
  color: var(--statement-text);
  text-decoration: none;
}
.statement-tabs a.is-active {
  box-shadow: inset 0 0 0 1px var(--statement-active-border);
}
.statement-tabs [data-nav-count] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--statement-soft-2);
  color: var(--statement-muted);
  font-size: 11px;
  line-height: 1;
}
.statement-tabs a.is-active [data-nav-count] {
  background: var(--statement-active-bg);
  color: var(--statement-chip-text);
}
.statement-filter-bar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, .95fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  box-shadow: var(--statement-shadow);
}
.statement-range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.statement-sort-buttons {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-soft);
}
.statement-range-buttons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--statement-border);
  border-radius: 7px;
  background: var(--statement-soft);
  color: var(--statement-muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.statement-sort-buttons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
  color: var(--statement-muted);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}
.statement-sort-buttons a:hover,
.statement-sort-buttons a.is-active,
.statement-range-buttons a:hover,
.statement-range-buttons a.is-active {
  background: var(--statement-active-bg);
  color: var(--statement-text);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--statement-active-border);
}
.statement-date-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: end;
}
.statement-date-form label {
  gap: 4px;
}
.statement-date-actions {
  display: flex;
  gap: 6px;
  align-items: end;
  justify-content: flex-end;
}
.statement-date-form label span {
  color: var(--statement-muted);
  font-size: 11px;
  font-weight: 800;
}
.statement-date-form input,
.statement-date-form button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}
.statement-filter-note {
  grid-column: 1 / -1;
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 700;
}
.statement-tools {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  box-shadow: var(--statement-shadow);
}
.statement-tools label {
  display: grid;
  gap: 5px;
}
.statement-tools label span {
  color: var(--statement-muted);
  font-size: 12px;
  font-weight: 800;
}
.statement-result-count {
  min-height: 38px;
  justify-content: center;
  gap: 5px;
  background: var(--statement-soft);
}
.statement-result-count strong {
  color: var(--statement-text);
}
.statement-section {
  padding: 16px;
  border: 1px solid var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
  box-shadow: var(--statement-shadow);
}
.statement-table-wrap {
  max-height: none;
  overflow-x: auto;
  border-color: var(--statement-border);
  border-radius: 8px;
  background: var(--statement-surface);
}
.statement-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
}
.statement-table th,
.statement-table td {
  border-bottom-color: var(--statement-border);
}
.statement-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--statement-soft-2);
  color: var(--statement-muted);
  font-size: 12px;
}
.statement-table td {
  vertical-align: middle;
  color: var(--statement-text);
  white-space: normal;
  overflow-wrap: anywhere;
}
.statement-table tbody tr {
  background: var(--statement-surface);
}
.statement-table tbody tr:hover {
  background: var(--statement-hover);
}
.statement-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--statement-chip-bg);
  color: var(--statement-chip-text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.statement-table tr[hidden] {
  display: none;
}
.statement-section[hidden] {
  display: none;
}
.segmented {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--workspace-control, #eef3f8);
}
.segmented label {
  display: block;
  margin: 0;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--workspace-raised, #fff);
  color: var(--workspace-muted-text, #586477);
  font-weight: 800;
  cursor: pointer;
}
.segmented input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(215, 25, 32, .18);
}
@media (max-width: 980px) {
  .credit-card-upload-strip {
    align-items: stretch;
  }
  .credit-card-upload-left,
  .credit-card-upload-right {
    width: 100%;
  }
  .credit-card-selection-count,
  .credit-card-upload-strip input[type="file"],
  .credit-card-upload-strip .button,
  .credit-card-upload-strip button {
    width: 100%;
  }
  .statement-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }
  .statement-hero {
    display: grid;
    padding: 18px;
  }
  .statement-actions {
    justify-content: flex-start;
    min-width: 0;
  }
  .statement-tool-links {
    flex-wrap: wrap;
  }
  .statement-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .statement-balance {
    grid-column: 1 / -1;
  }
  .statement-filter-bar {
    grid-template-columns: 1fr;
  }
  .statement-date-actions {
    justify-content: flex-start;
  }
  .statement-tools {
    grid-template-columns: 1fr;
  }
  .statement-formula {
    grid-template-columns: 1fr;
  }
  .statement-result-count {
    justify-content: flex-start;
  }
}
@media (max-width: 560px) {
  .confirm-summary {
    grid-template-columns: 1fr;
  }
  .statement-summary {
    grid-template-columns: 1fr;
  }
  .statement-date-form {
    grid-template-columns: 1fr;
  }
  .statement-date-actions {
    justify-content: stretch;
  }
  .statement-date-actions button {
    flex: 1;
  }
}

.shipment-orders-wrap {
  overflow-x: hidden;
}

.shipment-orders-table {
  table-layout: fixed;
  width: 100%;
}

.shipment-orders-table th,
.shipment-orders-table td {
  vertical-align: top;
}

.shipment-orders-table small {
  display: block;
  margin-top: 3px;
}

.shipment-orders-table code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-family: inherit;
}

.shipment-orders-table .cell-clip {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shipment-orders-table .cell-clip-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
  white-space: normal;
}

.shipment-cancel-button {
  margin-top: 6px;
  padding: 4px 10px;
  min-height: 26px;
}

.ship-col-order { width: 15%; }
.ship-col-mode { width: 5%; }
.ship-col-client { width: 7%; }
.ship-col-amount { width: 6%; }
.ship-col-product { width: 20%; }
.ship-col-type { width: 6%; }
.ship-col-identifier { width: 10%; }
.ship-col-snapshot { width: 17%; }
.ship-col-source { width: 8%; }
.ship-col-time { width: 6%; }

.profit-analytics-head {
  align-items: flex-start;
  gap: 16px;
}

.profit-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 420px;
}

.profit-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profit-quick-buttons a,
.profit-filter button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--workspace-panel, #fff);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profit-quick-buttons a.active,
.profit-quick-buttons a:hover,
.profit-filter button {
  background: var(--workspace-control, #111827);
  border-color: var(--workspace-edge, #111827);
  color: #fff;
}

.profit-filter label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.profit-filter input {
  width: 134px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--text);
}

.profit-summary-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.profit-summary-row > div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px;
  min-height: 88px;
  background: var(--workspace-panel, #fff);
}

.profit-summary-row small,
.profit-summary-row span,
.profit-chart-title span,
.profit-chart-title small,
.profit-daily-list small {
  color: var(--muted);
  font-size: 12px;
}

.profit-summary-row strong {
  display: block;
  margin: 5px 0 3px;
  font-size: 22px;
}

.profit-total-card strong {
  font-size: 30px;
}

.profit-chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.profit-chart-card,
.profit-daily-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--workspace-panel, #fff);
  padding: 14px;
}

.profit-chart-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.profit-chart-title strong,
.profit-chart-title span {
  display: block;
}

.profit-kline {
  width: 100%;
  height: 280px;
  display: block;
  background: linear-gradient(180deg, var(--workspace-soft, #f8fafc), var(--workspace-panel, #fff));
  border-radius: 8px;
}

.profit-kline .grid-line {
  stroke: var(--workspace-edge, #e5e7eb);
  stroke-width: 1;
}

.profit-kline .zero-line {
  stroke: var(--workspace-subtle-text, #94a3b8);
  stroke-width: 1.3;
  stroke-dasharray: 5 5;
}

.profit-kline g.up line,
.profit-kline g.up rect {
  stroke: var(--workspace-ok-text, #16a34a);
  fill: #22c55e;
}

.profit-kline g.down line,
.profit-kline g.down rect {
  stroke: var(--workspace-error-text, #dc2626);
  fill: #ef4444;
}

.profit-kline g line {
  stroke-width: 1.5;
}

.profit-chart-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.profit-daily-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.profit-daily-list > div {
  display: grid;
  grid-template-columns: 54px 90px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.profit-daily-list strong,
.profit-daily-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-upload-form .field-with-help input,
.inventory-upload-form .field-with-help textarea {
  padding-right: 52px;
}

.inventory-upload-form .field-with-label .field-help {
  right: 14px;
  width: 20px;
  height: 20px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

.inventory-upload-form label:not(.textarea-field) .field-help {
  top: auto;
  bottom: 10px;
  transform: none;
}

.inventory-upload-form .textarea-field .field-help {
  top: auto;
  bottom: 12px;
  transform: none;
}



.profit-kline .profit-line {
  fill: none;
  stroke: var(--workspace-info-text, #2563eb);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profit-kline g.up circle {
  fill: #16a34a;
  stroke: var(--workspace-panel, #fff);
  stroke-width: 1.5;
}

.profit-kline g.down circle {
  fill: #dc2626;
  stroke: var(--workspace-panel, #fff);
  stroke-width: 1.5;
}

.card-reuse-options {
  border: 1px solid var(--workspace-error-edge, #f4c7c7);
  border-radius: 8px;
  background: var(--workspace-error-bg, #fff7f7);
  padding: 10px 12px;
}
.card-reuse-options summary {
  cursor: pointer;
  color: var(--workspace-error-text, #b91c1c);
  font-weight: 700;
  font-size: 13px;
}
.card-reuse-options .auto-replace-confirm {
  margin-top: 10px;
}
.card-reuse-options small {
  display: block;
  color: var(--workspace-error-text, #7a4b4b);
  line-height: 1.5;
}

/* 2026-07-25 dashboard information hierarchy and responsive pass */
.dashboard-overview {
  display: grid;
  gap: 12px;
}
.dashboard-overview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}
.dashboard-overview-head h2 {
  margin-top: 2px;
}
.dashboard-eyebrow {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}
.dashboard-work-head {
  margin-top: 4px;
}
.dashboard-finance-metrics {
  gap: 10px;
}
.metrics .dashboard-metric-card,
.dashboard-action-card {
  display: grid;
  align-content: space-between;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.metrics .dashboard-metric-card {
  padding: 14px 16px;
  min-height: 102px;
}
.dashboard-metric-card > span,
.dashboard-action-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.dashboard-metric-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: clamp(22px, 1.8vw, 28px);
  line-height: 1;
}
.dashboard-metric-card small,
.dashboard-action-card small {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.dashboard-metric-card:hover,
.dashboard-action-card:hover {
  border-color: var(--workspace-edge, #b8c2ce);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}
.dashboard-metric-card:focus-visible,
.dashboard-action-card:focus-visible,
.profit-quick-buttons a:focus-visible,
.profit-custom-range summary:focus-visible {
  outline: 3px solid rgba(23, 105, 224, .24);
  outline-offset: 2px;
}
.dashboard-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.dashboard-action-card {
  min-height: 90px;
  padding: 13px 15px;
  border-left: 3px solid var(--workspace-edge, #cbd5e1);
}
.dashboard-action-card strong {
  margin: 4px 0;
  font-size: 26px;
  line-height: 1;
}
.dashboard-action-card.attention {
  border-color: var(--workspace-error-edge, #fecaca);
  border-left-color: var(--brand);
  background: var(--workspace-soft, #fffafa);
}
.dashboard-action-card.attention strong,
.dashboard-action-card.attention small {
  color: var(--brand-dark);
}
.profit-definition {
  margin-top: 6px;
}
.profit-definition summary,
.profit-custom-range summary {
  width: fit-content;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.profit-definition p {
  max-width: 760px;
  margin-top: 7px;
  padding: 9px 11px;
  border-left: 3px solid var(--workspace-info-edge, #bfdbfe);
  background: var(--workspace-soft, #f8fbff);
  font-size: 12px;
}
.profit-filter {
  display: grid;
  justify-items: end;
  min-width: 0;
}
.profit-quick-buttons a[aria-current="page"] {
  box-shadow: 0 0 0 2px rgba(17, 24, 39, .12);
}
.profit-custom-range {
  position: relative;
}
.profit-custom-range summary {
  margin-left: auto;
  padding: 5px 0;
}
.profit-custom-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--workspace-panel, #fff);
  box-shadow: var(--shadow-soft);
}
.profit-summary-groups {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr);
  gap: 14px;
  margin-top: 16px;
}
.profit-summary-block {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--workspace-soft, #fafbfc);
}
.profit-summary-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}
.profit-summary-label strong {
  font-size: 13px;
}
.profit-summary-label span {
  color: var(--muted);
  font-size: 11px;
}
.profit-summary-row {
  margin-top: 0;
}
.profit-summary-core {
  grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr));
}
.profit-cashflow-block {
  background: var(--workspace-soft, #f8fafc);
}
.profit-cashflow-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.profit-cashflow-row > div {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--workspace-panel, #fff);
}
.profit-cashflow-row small,
.profit-cashflow-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.profit-cashflow-row strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 20px;
}
.profit-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 11px;
}
.profit-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.profit-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.profit-chart-legend .positive { background: #22c55e; }
.profit-chart-legend .negative { background: #ef4444; }
.profit-chart-legend .trend {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #2563eb;
}
.profit-kline g:focus {
  outline: none;
}
.profit-kline g:focus rect,
.profit-kline g:focus circle {
  stroke: var(--workspace-strong-text, #111827);
  stroke-width: 3;
}
.profit-chart-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}
.profit-chart-footer strong {
  font-size: 11px;
  font-weight: 700;
}
.profit-chart-footer span:last-child {
  text-align: right;
}
.profit-daily-list {
  max-height: 326px;
}
.profit-daily-list > .profit-daily-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 9px 0;
}
.profit-daily-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.profit-daily-row-head strong {
  font-size: 14px;
  overflow: visible;
}
.profit-daily-components {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 10px;
}
.profit-daily-components span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.profit-daily-components b {
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .dashboard-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profit-summary-groups {
    grid-template-columns: 1fr;
  }
  .profit-cashflow-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 980px) {
  .profit-analytics-head {
    display: grid;
  }
  .profit-filter {
    width: 100%;
    justify-items: start;
  }
  .profit-custom-range summary {
    margin-left: 0;
  }
  .profit-summary-core {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .profit-chart-layout {
    grid-template-columns: 1fr;
  }
  .profit-daily-list {
    max-height: 380px;
  }
}
@media (max-width: 760px) {
  .dashboard-overview-head {
    display: grid;
    gap: 2px;
  }
  .dashboard-finance-metrics,
  .dashboard-action-grid {
    grid-template-columns: 1fr;
  }
  .profit-quick-buttons {
    width: 100%;
  }
  .profit-quick-buttons a {
    flex: 1 1 calc(25% - 6px);
    text-align: center;
  }
  .profit-custom-range,
  .profit-custom-controls {
    width: 100%;
  }
  .profit-custom-controls {
    display: grid;
    grid-template-columns: 1fr;
  }
  .profit-filter input,
  .profit-custom-controls button {
    width: 100%;
  }
  .profit-summary-core,
  .profit-cashflow-row {
    grid-template-columns: 1fr;
  }
  .profit-summary-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .profit-chart-title {
    display: grid;
  }
  .profit-kline {
    height: 220px;
  }
  .profit-chart-footer {
    grid-template-columns: 1fr 1fr;
  }
  .profit-chart-footer strong {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }
}

/* 2026-07-25 inventory workspace */
.inventory-workbench {
  padding: 0;
  overflow: visible;
}
.inventory-workbench-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 15px 18px;
  list-style: none;
  border-radius: var(--radius);
}
.inventory-workbench-summary::-webkit-details-marker { display: none; }
.inventory-workbench-summary span {
  display: grid;
  gap: 3px;
}
.inventory-workbench-summary strong {
  color: var(--text);
  font-size: 16px;
}
.inventory-workbench-summary small {
  color: var(--muted);
  font-weight: 500;
}
.inventory-workbench-summary b {
  color: var(--muted);
  font-size: 12px;
}
.inventory-workbench[open] .inventory-workbench-summary {
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.inventory-workbench-body { padding: 16px 18px 18px; }
.inventory-compact-upload {
  grid-template-columns: minmax(220px, .9fr) minmax(200px, .75fr) minmax(300px, 1.4fr) 150px;
  align-items: end;
}
.inventory-compact-upload label > span,
.inventory-filter-toolbar label > span,
.inventory-drawer-form label > span,
.inventory-ship-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--workspace-muted-text, #596579);
  font-size: 12px;
  font-weight: 750;
}
.inventory-compact-upload label > span small {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 500;
}
.inventory-compact-upload .inventory-textarea-field {
  grid-column: auto;
}
.inventory-compact-upload textarea {
  min-height: 72px;
  resize: vertical;
}
.inventory-upload-action {
  display: grid;
  gap: 8px;
  align-self: end;
}
.inventory-upload-action small {
  color: var(--muted);
  text-align: center;
}
.inventory-upload-action button {
  min-height: 42px;
  align-self: end;
}
.inventory-compact-upload .credit-card-inventory-warning {
  grid-column: 1 / -1;
}
.catalog-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.inventory-catalog-field,
.inventory-filter-product,
.inventory-drawer-form label {
  position: relative;
}
.catalog-search-picker {
  position: relative;
  min-width: 0;
}
.catalog-search-input {
  width: 100%;
  padding-right: 34px;
  background:
    linear-gradient(45deg, transparent 50%, var(--workspace-muted-text, #697586) 50%) calc(100% - 17px) 50% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--workspace-muted-text, #697586) 50%, transparent 50%) calc(100% - 12px) 50% / 5px 5px no-repeat,
    var(--workspace-panel, #fff);
}
.catalog-search-results {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  left: 0;
  width: min(560px, calc(100vw - 42px));
  max-height: 330px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--workspace-edge, #cfd7e3);
  border-radius: 12px;
  background: var(--workspace-panel, #fff);
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
}
.catalog-search-group {
  position: sticky;
  top: -6px;
  z-index: 1;
  padding: 8px 9px 5px;
  background: var(--workspace-panel, #fff);
  color: var(--workspace-subtle-text, #8a94a5);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.catalog-search-result {
  display: grid;
  width: 100%;
  min-height: 0;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  justify-content: stretch;
  justify-items: start;
  text-align: left;
}
.catalog-search-result:hover,
.catalog-search-result.active,
.catalog-search-result[aria-selected="true"] {
  background: var(--workspace-error-bg, #fff1f1);
  color: var(--workspace-error-text, #991b1b);
}
.catalog-search-result strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-search-result span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.catalog-search-empty {
  padding: 18px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.inventory-workspace {
  min-height: 0;
  padding: 0;
  overflow: visible;
}
.inventory-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 18px 10px;
}
.inventory-board-head h2 {
  margin: 0 0 3px;
  font-size: 17px;
}
.inventory-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.inventory-status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
  padding: 0 18px 10px;
}
.inventory-status-strip a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--workspace-soft, #f8fafc);
  color: var(--text);
  text-decoration: none;
}
.inventory-status-strip a:hover {
  border-color: var(--workspace-error-edge, #e8b7b9);
  background: var(--workspace-error-bg, #fff7f7);
}
.inventory-status-strip a.active {
  border-color: rgba(215, 25, 32, .35);
  background: var(--workspace-error-bg, #fff1f1);
  color: var(--workspace-error-text, #a3151a);
  box-shadow: inset 3px 0 0 var(--brand);
}
.inventory-status-strip small {
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-status-strip strong { font-size: 18px; }
.inventory-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(125px, .65fr) 115px 125px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--workspace-soft, #f8fafc);
}
.inventory-filter-toolbar input,
.inventory-filter-toolbar select,
.inventory-filter-toolbar .catalog-search-input {
  min-height: 36px;
}
.inventory-filter-actions {
  display: flex;
  gap: 6px;
}
.inventory-filter-actions button,
.inventory-filter-actions .button {
  min-height: 36px;
  padding: 8px 13px;
}
.inventory-board-panel .inventory-table-wrap {
  max-height: 620px;
  margin: 0 18px;
  border-radius: 10px;
}
.inventory-board-panel .inventory-compact-table {
  min-width: 960px;
  table-layout: fixed;
}
.inventory-compact-table .inventory-col-stock { width: 28%; }
.inventory-compact-table .inventory-col-product { width: 15%; }
.inventory-compact-table .inventory-col-meta { width: 12%; }
.inventory-compact-table .inventory-col-price { width: 11%; }
.inventory-compact-table .inventory-col-status { width: 9%; }
.inventory-compact-table .inventory-col-owner { width: 14%; }
.inventory-compact-table .inventory-col-actions { width: 120px; }
.inventory-compact-table th,
.inventory-compact-table td {
  padding: 8px 10px;
  vertical-align: top;
}
.inventory-compact-table tbody tr:hover { background: var(--workspace-soft, #fffafa); }
.inventory-compact-table td > strong,
.inventory-compact-table td > small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-compact-table td > small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.inventory-stock-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inventory-stock-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-copy-button {
  flex: 0 0 auto;
  min-height: 0;
  padding: 3px 6px;
  border: 1px solid var(--workspace-edge, #d8dee8);
  border-radius: 5px;
  background: var(--workspace-panel, #fff);
  color: var(--workspace-muted-text, #647084);
  font-size: 10px;
}
.inventory-secret-preview {
  display: -webkit-box !important;
  max-width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: var(--workspace-muted-text, #647084);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.35;
  white-space: normal !important;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.inventory-board-panel .inventory-compact-actions {
  display: flex;
  min-width: 0;
  gap: 5px;
  flex-wrap: nowrap;
}
.inventory-compact-actions .table-button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
}
.inventory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px 17px;
}
.inventory-pagination > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.inventory-edit-drawer,
.inventory-ship-dialog {
  border: 0;
  background: var(--workspace-panel, #fff);
  box-shadow: -18px 0 50px rgba(15, 23, 42, .2);
}
.inventory-edit-drawer::backdrop,
.inventory-ship-dialog::backdrop {
  background: rgba(15, 23, 42, .12);
}
.inventory-edit-drawer {
  width: min(470px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
}
.inventory-drawer-shell {
  display: flex;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
}
.inventory-drawer-head {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--workspace-glass, rgba(255, 255, 255, .96));
}
.inventory-drawer-head small,
.inventory-ship-form header small {
  color: var(--focus, var(--brand));
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}
.inventory-drawer-head h2,
.inventory-ship-form header h2 {
  margin: 3px 0;
  font-size: 20px;
}
.inventory-drawer-head p,
.inventory-ship-form header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.inventory-drawer-form { padding-bottom: 76px; }
.inventory-drawer-form section {
  display: grid;
  gap: 11px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line-soft);
}
.inventory-drawer-form section h3 {
  margin: 0 0 2px;
  color: var(--workspace-strong-text, #344054);
  font-size: 13px;
}
.inventory-drawer-form textarea { resize: vertical; }
.inventory-drawer-form .split { gap: 10px; }
.inventory-drawer-actions {
  position: fixed;
  z-index: 4;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(470px, 100vw);
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 22px;
  border-top: 1px solid var(--line-soft);
  background: var(--workspace-glass, rgba(255, 255, 255, .97));
}
.inventory-drawer-delete {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -62px 22px 88px;
}
.inventory-drawer-delete small {
  color: var(--muted);
  font-size: 11px;
}
/* Button contrast guard: keep text readable across combined utility classes. */
button[type="submit"],
button.secondary,
.button.secondary {
  color: #fff;
}
button.danger-button,
.button.danger-button {
  border-color: var(--red);
  background: var(--danger-fill, var(--red));
  color: #fff;
}
button.danger-button:hover:not(:disabled),
.button.danger-button:hover {
  border-color: var(--workspace-error-edge, #991b1b);
  background: #991b1b;
  color: #fff;
}
.inventory-ship-dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  border-radius: 14px;
}
.inventory-ship-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}
.inventory-ship-form header { margin-bottom: 2px; }
.inventory-ship-form footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 3px;
}
@media (max-width: 1200px) {
  .inventory-compact-upload { grid-template-columns: 1fr 1fr; }
  .inventory-compact-upload .inventory-textarea-field { grid-column: 1 / -1; }
  .inventory-upload-action {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .inventory-filter-toolbar {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(110px, .7fr)) auto;
  }
  .inventory-keyword-field { grid-column: 1 / -2; }
}
@media (max-width: 900px) {
  .inventory-status-strip {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }
  .inventory-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inventory-keyword-field { grid-column: auto; }
  .inventory-filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .inventory-workbench-body,
  .inventory-board-head,
  .inventory-status-strip,
  .inventory-filter-toolbar {
    padding-right: 12px;
    padding-left: 12px;
  }
  .inventory-compact-upload,
  .inventory-filter-toolbar {
    grid-template-columns: 1fr;
  }
  .inventory-compact-upload .inventory-textarea-field,
  .inventory-upload-action,
  .inventory-filter-actions {
    grid-column: 1;
  }
  .inventory-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inventory-board-panel .inventory-table-wrap { margin: 0 12px; }
  .inventory-board-head { align-items: flex-start; }
  .inventory-board-head > .muted { display: none; }
  .inventory-pagination { padding: 12px; }
  .inventory-pagination > .muted { display: none; }
  .inventory-edit-drawer { width: 100vw; }
  .inventory-drawer-actions { width: 100vw; }
}

/* 2026-07-25 compact dashboard + Tabler sidebar icons */
.dashboard-page .page-head { min-height: 74px; }
.dashboard-page .page-actions { min-width: 0; }
.dashboard-profit-filter,
.dashboard-profit-filter.ui-form.ui-form-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.dashboard-profit-filter .profit-quick-buttons {
  flex-wrap: wrap;
  width: auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.dashboard-profit-filter .profit-quick-buttons a {
  flex: none;
  min-height: 31px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: none;
}
.dashboard-profit-filter .profit-quick-buttons a:hover,
.dashboard-profit-filter .profit-quick-buttons a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.dashboard-profit-filter .profit-custom-range {
  position: relative;
  width: auto;
}
.dashboard-profit-filter .profit-custom-range summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 39px;
  margin: 0;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  list-style: none;
  white-space: nowrap;
}
.dashboard-profit-filter .profit-custom-range summary::-webkit-details-marker { display: none; }
.dashboard-profit-filter .profit-custom-range summary:hover,
.dashboard-profit-filter .profit-custom-range[open] summary { color: var(--brand-dark); border-color: var(--workspace-info-edge, #a9bdf3); }
.dashboard-profit-filter .profit-custom-controls {
  position: absolute;
  z-index: 12;
  top: calc(100% + 7px);
  right: 0;
  width: max-content;
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}
.dashboard-profit-filter .profit-custom-controls button { background: var(--brand); }

.dashboard-page .profit-analytics {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.dashboard-overdue-alert {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.2fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--workspace-error-edge, #fecaca);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  background: var(--workspace-error-bg, #fff8f8);
  box-shadow: 0 8px 24px rgba(185, 28, 28, .07);
}
.dashboard-overdue-alert > div:first-child { display: flex; align-items: flex-start; gap: 12px; }
.dashboard-overdue-alert strong { color: var(--workspace-error-text, #8f1d1d); }
.dashboard-overdue-alert p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dashboard-overdue-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 9px;
  background: var(--workspace-error-bg, #fee2e2);
  color: var(--red);
  font-size: 20px;
}
.dashboard-overdue-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dashboard-overdue-items a { min-width: 0; padding: 7px 9px; border: 1px solid var(--workspace-error-edge, #fee2e2); border-radius: 7px; background: var(--workspace-panel, #fff); }
.dashboard-overdue-items a strong,
.dashboard-overdue-items a span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-overdue-items a strong { font-size: 12px; }
.dashboard-overdue-items a span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.dashboard-funding {
  padding: 0;
  overflow: hidden;
  border-color: var(--workspace-edge, #d9e2ec);
}
.dashboard-funding-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(135deg, var(--workspace-panel, #fff) 0%, var(--workspace-soft, #f8fbff) 100%);
}
.dashboard-funding-head h2 {
  margin-top: 2px;
  font-size: 20px;
}
.dashboard-funding-head p {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.dashboard-funding-head .button {
  flex: 0 0 auto;
  min-height: 34px;
}
.dashboard-funding-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
}
.dashboard-funding-metrics small,
.dashboard-funding-metrics strong,
.dashboard-funding-metrics span { display: block; }
.dashboard-funding-metrics small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.dashboard-funding-metrics strong {
  margin: 5px 0 3px;
  overflow: hidden;
  font-size: clamp(21px, 1.8vw, 27px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-funding-metrics span { color: var(--muted); font-size: 11px; }
.dashboard-funding-metrics .clear strong,
.funding-clear-positive { color: var(--workspace-ok-text, #147a45); }
.dashboard-funding-metrics .covered strong { color: var(--workspace-info-text, #285f9e); }
.dashboard-funding-metrics .attention strong { color: var(--brand-dark); }
.dashboard-funding-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.dashboard-funding-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dashboard-funding-filters button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--workspace-panel, #fff);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.dashboard-funding-filters button:hover { border-color: var(--workspace-edge, #aeb9c7); background: var(--workspace-soft, #f8fafc); color: var(--text); }
.dashboard-funding-filters button.active { border-color: var(--workspace-edge, #1f2937); background: var(--workspace-control, #1f2937); color: #fff; }
.dashboard-funding-search { flex: 0 0 250px; }
.dashboard-funding-search input {
  width: 100%;
  height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}
.dashboard-funding-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--workspace-warn-edge, #f0ddb4);
  background: var(--workspace-warn-bg, #fffaf0);
  color: var(--workspace-warn-text, #715b2f);
  font-size: 11px;
}
.dashboard-funding-table-wrap {
  max-height: 510px;
  overflow: auto;
}
.dashboard-funding-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
}
.dashboard-funding-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 34px;
  padding: 7px 12px;
  background: var(--workspace-soft, #f6f8fb);
  box-shadow: inset 0 -1px 0 var(--line);
  color: var(--workspace-muted-text, #667085);
  font-size: 11px;
}
.dashboard-funding-table th:nth-child(1) { width: 22%; }
.dashboard-funding-table th:nth-child(2),
.dashboard-funding-table th:nth-child(3),
.dashboard-funding-table th:nth-child(5) { width: 14%; }
.dashboard-funding-table th:nth-child(4) { width: 22%; }
.dashboard-funding-table th:nth-child(6) { width: 14%; }
.dashboard-funding-table td {
  height: 54px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.dashboard-funding-table tbody tr:hover { background: var(--workspace-soft, #fafcff); }
.dashboard-funding-table td:first-child small,
.dashboard-funding-table td:last-child small,
.dashboard-funding-table td:nth-child(4) small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.dashboard-funding-table td:nth-child(2) strong,
.dashboard-funding-table td:nth-child(3) strong,
.dashboard-funding-table td:nth-child(5) strong {
  font-size: 15px;
  white-space: nowrap;
}
.funding-coverage-line {
  width: 100%;
  max-width: 150px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--workspace-raised, #edf0f4);
}
.funding-coverage-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #58a778, #238653);
}
.funding-net-zero { color: var(--workspace-ok-text, #147a45); }
.funding-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--workspace-raised, #f1f3f5);
  color: var(--workspace-muted-text, #59636e);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.funding-state.uncovered { background: var(--workspace-error-bg, #fff0f0); color: var(--workspace-error-text, #b4232d); }
.funding-state.partial { background: var(--workspace-warn-bg, #fff7e6); color: var(--workspace-warn-text, #a26000); }
.funding-state.covered { background: var(--workspace-info-bg, #eaf4ff); color: var(--workspace-info-text, #285f9e); }
.funding-state.reserve { background: var(--workspace-ok-bg, #eaf8f0); color: var(--workspace-ok-text, #147a45); }
.dashboard-funding-table [data-funding-empty] td {
  height: 90px;
  color: var(--muted);
  text-align: center;
}
.dashboard-funding-footer {
  padding: 8px 14px;
  background: var(--workspace-soft, #fafbfc);
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}
.dashboard-profit-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-soft);
}
.dashboard-profit-metric {
  min-width: 0;
  padding: 13px 16px 12px;
  border-right: 1px solid var(--line-soft);
}
.dashboard-profit-metric:last-child {
  border-right: 0;
}
.dashboard-profit-metric small,
.dashboard-profit-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.dashboard-profit-metric small {
  font-weight: 800;
}
.dashboard-profit-metric strong {
  display: block;
  margin: 5px 0 3px;
  overflow: hidden;
  font-size: clamp(19px, 1.65vw, 25px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-profit-metric.cashflow {
  background: var(--workspace-soft, #fafbfc);
}

.dashboard-daily-section {
  padding: 12px 16px 0;
}
.dashboard-daily-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.dashboard-daily-head h2 {
  font-size: 16px;
}
.dashboard-daily-head p,
.dashboard-daily-meta > span {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.dashboard-daily-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.dashboard-daily-meta .profit-definition {
  position: relative;
  margin: 0;
}
.dashboard-daily-meta .profit-definition p {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  right: 0;
  width: min(520px, calc(100vw - 40px));
  margin: 0;
  border: 1px solid var(--workspace-info-edge, #bfdbfe);
  border-left-width: 3px;
  box-shadow: var(--shadow-soft);
}
.profit-daily-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}
.profit-daily-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}
.profit-daily-table th,
.profit-daily-table td {
  height: 31px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.profit-daily-table th:first-child,
.profit-daily-table td:first-child {
  width: 17%;
  text-align: left;
}
.profit-daily-table th:not(:first-child),
.profit-daily-table td:not(:first-child) {
  text-align: right;
}
.profit-daily-table thead th {
  height: 30px;
  background: var(--workspace-soft, #f8fafc);
  color: var(--workspace-muted-text, #667085);
  font-size: 11px;
  font-weight: 800;
}
.profit-daily-table tbody tr:hover {
  background: var(--workspace-soft, #fafcff);
}
.profit-daily-table tfoot th {
  height: 33px;
  border-bottom: 0;
  background: var(--workspace-soft, #fafbfc);
  color: var(--text);
}
.profit-positive {
  color: var(--workspace-ok-text, #169c46);
}

.dashboard-profit-chart {
  margin: 12px 16px 14px;
  padding: 12px 14px 9px;
}
.dashboard-profit-chart .profit-chart-title {
  margin-bottom: 5px;
}
.dashboard-profit-chart .profit-chart-title strong {
  font-size: 14px;
}
.dashboard-profit-chart .profit-chart-title span,
.dashboard-profit-chart .profit-chart-title small {
  font-size: 11px;
}
.dashboard-profit-chart .profit-chart-legend {
  margin: 0 0 3px;
}
.dashboard-profit-chart .profit-kline {
  height: 150px;
  background: var(--workspace-panel, #fff);
}
.dashboard-profit-chart .profit-chart-footer {
  margin-top: 2px;
}

.dashboard-compact-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.dashboard-summary-group {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
.dashboard-summary-group + .dashboard-summary-group {
  border-left: 1px solid var(--line);
}
.dashboard-summary-group > div {
  min-width: 0;
  padding: 11px 13px;
  border-right: 1px solid var(--line-soft);
}
.dashboard-summary-group > div:last-child {
  border-right: 0;
}
.dashboard-summary-heading {
  background: var(--workspace-soft, #fafbfc);
}
.dashboard-summary-group small,
.dashboard-summary-group strong {
  display: block;
}
.dashboard-summary-group small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-summary-group strong {
  margin-top: 4px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-summary-heading strong {
  margin: 0 0 4px;
  font-size: 14px;
}

.dashboard-compact-overview {
  padding: 12px 14px;
}
.dashboard-compact-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.dashboard-compact-overview-head h2 {
  font-size: 15px;
}
.dashboard-compact-overview-head p,
.dashboard-compact-overview-head > span {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.dashboard-compact-overview-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
}
.dashboard-compact-overview-grid a {
  min-width: 0;
  padding: 10px 11px;
  border-right: 1px solid var(--line-soft);
  background: var(--workspace-panel, #fff);
  color: var(--text);
  text-decoration: none;
}
.dashboard-compact-overview-grid a:last-child {
  border-right: 0;
}
.dashboard-compact-overview-grid a:hover {
  background: var(--workspace-soft, #f8fafc);
}
.dashboard-compact-overview-grid a.attention {
  background: var(--workspace-error-bg, #fff8f8);
  box-shadow: inset 0 -3px 0 var(--brand);
}
.dashboard-compact-overview-grid small,
.dashboard-compact-overview-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-compact-overview-grid small {
  color: var(--muted);
  font-size: 10px;
}
.dashboard-compact-overview-grid strong {
  margin-top: 4px;
  font-size: 16px;
}

@media (max-width: 1280px) {
  .dashboard-overdue-alert { grid-template-columns: 1fr auto; }
  .dashboard-overdue-items { grid-column: 1 / -1; }
  .dashboard-profit-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dashboard-profit-metric:nth-child(3) {
    border-right: 0;
  }
  .dashboard-profit-metric:nth-child(-n+3) {
    border-bottom: 1px solid var(--line-soft);
  }
  .dashboard-compact-summary {
    grid-template-columns: 1fr;
  }
  .dashboard-summary-group + .dashboard-summary-group {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .dashboard-compact-overview-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .dashboard-compact-overview-grid a:nth-child(4) {
    border-right: 0;
  }
  .dashboard-compact-overview-grid a:nth-child(-n+4) {
    border-bottom: 1px solid var(--line-soft);
  }
}
@media (max-width: 900px) {
  .dashboard-daily-head,
  .dashboard-daily-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .dashboard-daily-meta {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .dashboard-profit-chart .profit-kline {
    height: 135px;
  }
  .dashboard-funding-toolbar,
  .dashboard-funding-note { align-items: stretch; flex-direction: column; }
  .dashboard-funding-search { flex-basis: auto; width: 100%; }
}
@media (max-width: 760px) {
  .dashboard-overdue-alert { grid-template-columns: 1fr; }
  .dashboard-overdue-items { grid-template-columns: 1fr; }
  .dashboard-profit-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-funding-head { align-items: stretch; flex-direction: column; }
  .dashboard-funding-head .button { align-self: flex-start; }
  .dashboard-profit-metric,
  .dashboard-profit-metric:nth-child(3) {
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
  }
  .dashboard-profit-metric:nth-child(even) {
    border-right: 0;
  }
  .dashboard-profit-metric:nth-last-child(-n+2) {
    border-bottom: 0;
  }
  .dashboard-summary-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-summary-heading {
    grid-column: 1 / -1;
  }
  .dashboard-summary-group > div {
    border-bottom: 1px solid var(--line-soft);
  }
  .dashboard-summary-group > div:nth-child(odd):not(.dashboard-summary-heading) {
    border-right: 0;
  }
  .dashboard-compact-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-compact-overview-grid a:nth-child(even) {
    border-right: 0;
  }
  .dashboard-compact-overview-grid a:not(:nth-last-child(-n+2)) {
    border-bottom: 1px solid var(--line-soft);
  }
}

/* Shared workspace surfaces and controls */
.workspace-page button, .workspace-page input, .workspace-page textarea, .workspace-page select { font-family: inherit; }
.app-shell .button:not(.secondary, .table-button, .danger-button, .delete-button, .disabled),
.app-shell .button.primary { background: var(--brand); }
.app-shell .button:not(.secondary, .table-button, .danger-button, .delete-button, .disabled):hover,
.app-shell button[type="submit"]:not(.secondary, .danger-button, .delete-button, :disabled):hover { background: var(--brand-strong, var(--brand-dark)); }
.app-shell :is(.button, button).secondary:not(.danger-button) {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.app-shell :is(.button, button).secondary:not(.danger-button):hover {
  border-color: var(--workspace-info-edge, #a9bdf3);
  background: var(--surface-soft);
  color: var(--brand-dark);
}
.workspace-page .panel { box-shadow: 0 2px 6px #1b315405; }
.workspace-page table { font-variant-numeric: tabular-nums; }
.workspace-page thead th { background: var(--workspace-soft, #f4f7fc); }
.management-table-wrap { margin-block: 10px; }
.management-table-wrap .management-table.compact-table { min-width: 620px; }
.workspace-page .table-wrap tbody tr:hover { background-color: var(--workspace-soft, #f8faff); }
.workspace-page .workflow-tabs a.active,
.workspace-page .workflow-tabs a:hover { color: var(--brand-dark); }
.statement-hero, .tool-panel, .tool-head { border-radius: var(--radius); }

.login {
  min-height: 100svh;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse at 12% 8%, var(--workspace-info-bg, #dbe7ff) 0%, transparent 56%),
    radial-gradient(ellipse at 90% 100%, var(--workspace-info-bg, #e1eafb) 0%, transparent 48%),
    var(--bg);
}
.login-panel {
  width: min(425px, 100%);
  padding: clamp(24px, 5vw, 38px);
  border-radius: 20px;
  box-shadow: 0 20px 56px #2440741c;
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-panel h1 { margin-bottom: 23px; font-size: 27px; }
.login-form { display: grid; gap: 7px; }
.login-form label { font-size: 13px; font-weight: 750; }
.login-field { position: relative; margin-bottom: 7px; }
.login-field > .ti {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 17px;
  pointer-events: none;
}
.login-field input { width: 100%; min-height: 45px; padding-left: 36px; font: inherit; }
.login-form .form-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 3px;
  padding: 9px 11px;
  border: 1px solid var(--workspace-error-edge, #f5c3c3);
  border-radius: 8px;
  background: var(--workspace-error-bg, #fff4f4);
  color: var(--red);
}
.login-form button {
  min-height: 44px;
  justify-content: space-between;
  margin-top: 4px;
  font: inherit;
  font-weight: 750;
}
.login-form button:hover { background: var(--brand-strong, var(--brand-dark)); }

/* Dashboard */
.dashboard-section-heading { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dashboard-section-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 20px;
}
.dashboard-funding { border-color: var(--line); }
.dashboard-funding-head { align-items: center; background: var(--surface); padding: 17px 18px; border-bottom: 0; }
.dashboard-funding-head h2 { margin: 0; }
.dashboard-funding-metrics {
  gap: 9px;
  padding: 0 18px 15px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-funding-metrics > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  box-shadow: none;
}
.dashboard-funding-metrics > .clear { background: var(--workspace-ok-bg, #f0faf5); border-color: var(--workspace-ok-edge, #d4eadd); }
.dashboard-funding-metrics > .covered { background: var(--workspace-info-bg, #eff5ff); border-color: var(--workspace-info-edge, #dce7fb); }
.dashboard-funding-metrics > .attention { background: var(--workspace-error-bg, #fff5f3); border-color: var(--workspace-error-edge, #f2deda); }
.dashboard-funding-metric-label { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.dashboard-funding-metric-label i { flex: 0 0 auto; color: var(--muted); font-size: 16px; }
.dashboard-funding-metrics .attention strong,
.dashboard-funding-metrics .attention .ti { color: var(--red); }
.dashboard-funding-metrics .clear .ti { color: var(--green); }
.dashboard-funding-metrics .covered .ti { color: var(--brand-dark); }
.dashboard-funding-toolbar { padding-inline: 18px; }
.dashboard-funding-filters button { min-height: 34px; font-size: 12px; border-radius: 8px; white-space: normal; }
.dashboard-funding-filters button.active,
.dashboard-funding-filters button.active:hover {
  border-color: var(--workspace-info-edge, #c9d7fb);
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.dashboard-funding-search { position: relative; }
.dashboard-funding-search > .ti { position: absolute; top: 9px; left: 9px; color: var(--muted); font-size: 16px; pointer-events: none; }
.dashboard-funding-search input { height: 34px; padding-left: 31px; }
.dashboard-funding-note { padding-inline: 18px; }
.dashboard-funding-table-wrap { border: 0; border-radius: 0; }
.dashboard-funding-table-wrap:focus-visible { outline-offset: -2px; }
.dashboard-funding-table [hidden] { display: none; }
.dashboard-funding-footer { text-align: left; padding-inline: 18px; }
.dashboard-operating > .muted { margin-bottom: 5px; }
.dashboard-operating .table-wrap { margin-top: 11px; }
.dashboard-operating table { min-width: 565px; }
.dashboard-operating tfoot tr { border-top: 1px solid var(--line); background: var(--surface-soft); }
.dashboard-profit-metric:first-child { background: var(--brand-soft); }
.dashboard-profit-metric:first-child strong:not(.danger) { color: var(--brand-dark); }

@media (max-width: 1150px) {
  .page-head { align-items: flex-start; flex-wrap: wrap; }
  .page-actions { justify-content: flex-start; }
  .dashboard-profit-filter, .dashboard-profit-filter.ui-form.ui-form-filter { justify-content: flex-start; }
}
@media (max-width: 900px) {
  .credit-card-bound-search { min-width: 0; flex-wrap: wrap; }
  .credit-card-bound-search input[type="search"] { min-width: 0; flex: 1 1 160px; }
  .workspace-navigation { position: sticky; z-index: 20; top: 0; background: var(--surface); }
  .workspace-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 61px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
  }
  .workspace-mobile-bar .brand { padding: 0; }
  .workspace-menu-toggle {
    display: none;
    gap: 6px;
    min-height: 39px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
  }
  .workspace-menu-toggle .ti { font-size: 17px; }
  .nav-collapsible .workspace-menu-toggle { display: flex; }
  .workspace-menu-toggle[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-dark); }
  .sidebar {
    position: static;
    width: 100%;
    max-height: calc(100dvh - 67px);
    padding: 10px 14px 12px;
    gap: 7px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand, .nav-collapsible:not(.nav-open) .sidebar { display: none; }
  .nav { display: grid; grid-template-columns: 1fr; gap: 9px; }
  .sidebar-footer { padding-top: 8px; }
  .app-shell { margin-left: 0; padding: 17px 14px 26px; gap: 14px; }
  .dashboard-funding-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .page-head, .dashboard-page .page-head { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 12px; }
  .page-heading p { font-size: 13px; }
  .dashboard-profit-filter, .dashboard-profit-filter.ui-form.ui-form-filter { align-items: stretch; width: 100%; }
  .dashboard-profit-filter .profit-quick-buttons { min-width: 0; }
  .dashboard-profit-filter .profit-custom-controls {
    position: static;
    width: auto;
    margin-top: 5px;
    box-shadow: none;
  }
  .dashboard-profit-filter .profit-custom-range { width: 100%; }
  .dashboard-profit-filter .profit-custom-range summary { width: fit-content; }
  .dashboard-funding-head { align-items: flex-start; gap: 10px; padding: 14px 12px; }
  .dashboard-funding-head h2 { font-size: 17px; }
  .dashboard-funding-head .button { min-height: 32px; padding: 7px 10px; font-size: 12px; }
  .dashboard-funding-metrics { padding: 0 12px 12px; gap: 7px; }
  .dashboard-funding-metrics > div { padding: 8px 9px; }
  .dashboard-funding-metrics strong,
  .dashboard-profit-metric strong { white-space: normal; overflow-wrap: anywhere; }
  .dashboard-funding-toolbar, .dashboard-funding-note, .dashboard-funding-footer { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-chevron { transition: none; }
}
