@charset "UTF-8";

:root {
  --sidebar-width: 15rem;
  --brand: #6366f1;
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-soft: #eef0ff;
  --accent-line: rgba(99, 102, 241, .18);
  --selection: linear-gradient(135deg, rgba(99, 102, 241, .14), rgba(14, 165, 233, .11));
  --canvas: #f6f7fc;
  --surface: #fcfdff;
  --canvas-glow: radial-gradient(640px 380px at 14% 0%, rgba(139, 92, 246, .14), transparent 65%),
    radial-gradient(600px 360px at 88% 2%, rgba(56, 189, 248, .13), transparent 65%),
    linear-gradient(180deg, #f6f7fc 0%, #f9fafe 100%);
  --paper: rgba(255, 255, 255, .96);
  --line: rgba(99, 102, 241, .11);
  --ink: #17182b;
  --nav-ink: #2d3154;
  --muted: #606685;
  --quiet: #7c819f;
  --hover: #f2f4ff;
  --field-line: rgba(99, 102, 241, .20);
  --success-strong: #059669;
  --success-tint: rgba(16, 185, 129, .11);
  --success-line: rgba(16, 185, 129, .20);
  --amber: #f59e0b;
  --amber-ink: #92400e;
  --amber-tint: #fffbeb;
  --amber-line: rgba(245, 158, 11, .27);
  --red: #ef4444;
  --red-deep: #9f1239;
  --red-tint: #fff1f2;
  --red-line: rgba(239, 68, 68, .24);
  --blue-ink: #075985;
  --blue-tint: rgba(56, 189, 248, .12);
  --blue-line: rgba(56, 189, 248, .26);
  --shadow: 0 12px 28px -12px rgba(79, 70, 229, .11), 0 2px 8px rgba(15, 23, 42, .03);
  --primary: linear-gradient(180deg, #272940 0%, #141526 100%);
  --primary-hover: linear-gradient(180deg, #363951 0%, #1d1f34 100%);
  --primary-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 18px -4px rgba(20, 21, 38, .34);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--nav-ink);
  background: var(--canvas-glow);
  font-synthesis: none;
  color-scheme: light;
  scrollbar-color: var(--accent-line) transparent;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; font-size: .9375rem; line-height: 1.5; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a, input, textarea, select { touch-action: manipulation; }
a { color: var(--accent-ink); text-underline-offset: .2em; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3, p, dl { margin: 0; }
h1, h2, h3 { color: var(--ink); }
h1 { font-size: clamp(1.55rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -.04em; }
h2 { font-size: 1.06rem; line-height: 1.4; }
.muted { color: var(--muted); }

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--canvas-glow);
}
.login-card {
  width: min(100%, 26rem);
  padding: clamp(1.6rem, 5vw, 2.7rem);
  background: var(--paper);
  border: 1px solid rgba(99, 102, 241, .14);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 #fff, 0 22px 48px -16px rgba(67, 56, 202, .18), 0 4px 14px rgba(15, 23, 42, .06);
}
.login-brand { display: flex; align-items: center; gap: .65rem; font-weight: 650; margin-bottom: 1.1rem; }
.login-card h1 { margin-bottom: 1.65rem; }
.brand-mark {
  display: block;
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .65rem;
  background: var(--paper);
  object-fit: contain;
  border: 1px solid var(--line);
}

.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 8;
  padding: .55rem .8rem;
  transform: translateY(-200%);
  background: var(--paper);
  border-radius: .4rem;
}
.skip-link:focus { transform: translateY(0); }
.admin-console { margin-left: var(--sidebar-width); min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  padding: 1.5rem 1rem 1.2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: rgba(252, 253, 255, .82);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  color: var(--nav-ink);
}
.sidebar-brand { display: flex; gap: .75rem; align-items: center; padding: .15rem .45rem 1.45rem; }
.sidebar-brand strong { display: block; color: var(--ink); font-size: 1.08rem; font-weight: 800; white-space: nowrap; }
.sidebar-brand div span { display: block; margin-top: .14rem; color: var(--accent); font-size: .74rem; font-weight: 700; }
.side-health-card {
  margin-top: auto;
  padding: .75rem .85rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .06), rgba(56, 189, 248, .06));
  border: 1px solid rgba(99, 102, 241, .14);
  font-size: .74rem;
  color: #565c7a;
  line-height: 1.55;
}
.side-health-card strong { display: block; color: var(--ink); font-size: .78rem; margin-bottom: .22rem; }
.navigation { display: grid; gap: .32rem; }
.navigation > * {
  min-width: 0;
  min-height: 2.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .58rem .85rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #4a4f70;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background .15s, color .15s, border-color .15s;
}
.navigation a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.navigation a[aria-current="page"] {
  background: var(--selection);
  border-color: var(--accent-line);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .14);
}
.pending-nav { color: var(--muted); }
.pending-nav span { color: var(--muted); font-size: .68rem; }
.session-bar {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .85rem;
  padding: .7rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(255, 255, 255, .74);
  border-bottom: 1px solid rgba(99, 102, 241, .09);
  backdrop-filter: blur(14px);
}
.operator {
  display: inline-flex; align-items: center; gap: .45rem; min-width: 0;
  padding: .36rem .82rem; border-radius: 999px;
  background: rgba(99, 102, 241, .08); border: 1px solid rgba(99, 102, 241, .14);
}
.operator-role { color: var(--accent-ink); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.operator-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--accent-ink); }
.session-error { position: absolute; top: 100%; right: 1rem; box-shadow: var(--shadow); }
.main-content { max-width: 94rem; margin: 0 auto; padding: clamp(.95rem, 2.2vw, 1.85rem) clamp(1rem, 2.8vw, 2.25rem); min-width: 0; }
.page-heading { margin-bottom: 1rem; }
.page-heading p { color: var(--muted); margin-top: .32rem; font-size: .86rem; }
.page-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1rem;
}
.page-heading h1 { overflow-wrap: anywhere; font-size: clamp(1.38rem, 2.1vw, 1.72rem); }
.return-link { display: inline-block; margin-bottom: .8rem; font-size: .86rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: .55rem .88rem;
  border: 1px solid transparent;
  border-radius: 999px;
  text-align: center;
  line-height: 1.35;
  font-weight: 650;
  white-space: nowrap;
}
.primary { background: var(--primary); color: #fff; box-shadow: var(--primary-shadow); }
.primary:not(:disabled):hover { background: var(--primary-hover); }
.secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.secondary:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.compact { min-height: 2.15rem; padding: .36rem .65rem; font-size: .82rem; }
.danger { color: #fff; background: var(--red-deep); }
.danger:not(:disabled):hover { background: #881337; }
.danger-outline { color: var(--red-deep); border-color: var(--red-line); background: var(--paper); }
.danger-outline:hover { background: var(--red-tint); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .95rem; }
.metrics.exec-metrics { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .95rem; }
.metric {
  min-height: 6.8rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: left;
}
.metric-sub {
  margin: .38rem 0 0;
  font-size: .78rem;
  color: var(--quiet);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.metric-sub.ok { color: var(--success-strong); font-weight: 650; }
.metric-sub.warn { color: var(--amber-ink); font-weight: 650; }
.exec-split-val { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem; }
.exec-online-sub { font-size: .98rem; font-weight: 700; color: var(--success-strong); }
.metric-value.exec-ok { color: var(--success-strong); }
.metric-value.exec-warn { color: var(--amber-ink); }
.exec-monitor-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.exec-monitor-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.expiry-strip { margin-top: .95rem; }
.customers-overview-page .customer-results-panel { margin-top: 1.05rem; }
.customer-list-head { padding: 1.05rem 1.2rem .2rem; display: flex; align-items: center; justify-content: space-between; }
.customer-list-title { font-size: 1rem; font-weight: 800; color: var(--ink); }
.row-quick-ops { display: inline-flex; align-items: center; gap: .6rem; white-space: nowrap; }
.op-link-btn {
  appearance: none; border: 0; background: transparent; padding: 0;
  color: var(--accent); font: inherit; font-size: .82rem; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.op-link-btn:hover { text-decoration: underline; color: var(--accent-ink); }
.metric:first-child {
  background:
    radial-gradient(200px 110px at 90% 0%, rgba(99, 102, 241, .15), transparent 72%),
    linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
  border-color: rgba(99, 102, 241, .24);
}
.metric-title { color: var(--quiet); font-size: .86rem; font-weight: 650; }
.metric-value {
  display: block;
  margin: .4rem 0 0;
  color: var(--ink);
  font-size: clamp(1.5rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric:first-child .metric-value { color: var(--ink); }
.metric-pending .metric-value { color: var(--muted); font-size: 1.02rem; margin-top: .85rem; font-weight: 550; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.form-stack { display: grid; gap: .92rem; }
.field { display: grid; gap: .38rem; min-width: 0; font-size: .875rem; }
.field > span { font-weight: 650; }
input, select, textarea {
  min-width: 0;
  width: 100%;
  min-height: 2.5rem;
  padding: .5rem .72rem;
  color: var(--nav-ink);
  background: #fafbfd;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--quiet); opacity: 1; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
  outline: none;
}
.filters {
  display: grid;
  grid-template-columns: minmax(9rem, 1.65fr) repeat(4, minmax(5rem, 1fr)) auto;
  align-items: end;
  gap: .65rem;
  padding: .75rem 1.2rem .9rem;
  border-bottom: 1px solid rgba(99, 102, 241, .09);
}
.list-summary { padding: .75rem 1.2rem .35rem; color: var(--quiet); font-size: .82rem; font-weight: 600; }
.table-wrap { max-width: 100%; overflow-x: auto; border-radius: 0 0 20px 20px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
th, td { padding: .74rem 1rem; vertical-align: middle; }
th { background: transparent; white-space: nowrap; font-size: .78rem; font-weight: 700; color: var(--quiet); border-bottom: 1px solid rgba(99, 102, 241, .10); }
td { border-top: 1px solid rgba(99, 102, 241, .07); overflow-wrap: anywhere; }
tbody tr:hover { background: rgba(99, 102, 241, .035); }
td a { font-weight: 700; }
.customer-table tbody td:first-child a { color: var(--ink); text-decoration: none; }
.customer-table tbody td:first-child a:hover { color: var(--accent); text-decoration: underline; }
.customer-table th, .customer-table td { padding-inline: .7rem; }
.customer-table .date-cell, .ledger-table .date-cell { white-space: normal; }
.customer-table tbody td:nth-child(5), .deal-table tbody td:nth-child(3) {
  white-space: nowrap;
  overflow-wrap: normal;
  color: var(--accent);
  font-weight: 700;
}
.cell-note { display: block; margin-top: .15rem; color: var(--muted); font-size: .75rem; }
.log-table { min-width: 46rem; }
.date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.points-cell { font-variant-numeric: tabular-nums; }
.mobile-cell-label { display: none; }
.empty-state { padding: 1.1rem 1rem; color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .27rem;
  min-height: 1.55rem;
  padding: .12rem .46rem;
  background: var(--canvas);
  color: var(--nav-ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  white-space: nowrap;
}
.chip.normal, .chip.online, .chip.success { background: var(--success-tint); border-color: var(--success-line); color: var(--success-strong); }
.chip.plan { background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(14, 165, 233, .11)); border-color: rgba(99, 102, 241, .18); color: var(--accent); font-weight: 700; }
.chip.insufficient_points { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber-ink); }
.chip.paused, .chip.deleted, .chip.expired, .chip.failure { background: var(--red-tint); border-color: var(--red-line); color: var(--red-deep); }
.chip.online::before, .chip.offline::before {
  content: "";
  width: .37rem;
  height: .37rem;
  border-radius: 50%;
  background: var(--quiet);
}
.chip.online::before { background: var(--success-strong); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.details-panel { padding: 1.1rem; min-width: 0; }
.details-panel h2 { margin-bottom: .78rem; }
.details-panel .table-wrap { border: 1px solid var(--line); border-radius: .48rem; }
.full-width { grid-column: 1 / -1; }
.definition-list { display: grid; gap: .52rem; }
.definition-list > div { display: grid; grid-template-columns: minmax(6.5rem, .75fr) minmax(0, 1.25fr); gap: .55rem; align-items: baseline; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; overflow-wrap: anywhere; }
.inline-note { margin-top: .7rem; color: var(--muted); font-size: .82rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.panel-actions .button:disabled { cursor: not-allowed; }
.pending-cycle-panel { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.pending-cycle-panel h3 { font-size: .875rem; }
.pending-cycles { display: grid; gap: .4rem; padding: 0; margin: .5rem 0 0; list-style: none; }
.pending-cycles li { display: grid; gap: .2rem; padding: .52rem .65rem; border-radius: .45rem; background: var(--canvas); }
.pending-cycles span { color: var(--muted); font-size: .81rem; font-variant-numeric: tabular-nums; }
.ledger-entry-details { min-width: 9rem; }
.ledger-entry-details summary { cursor: pointer; color: var(--accent-ink); }
.ledger-entry-details dl { margin-top: .65rem; }
.ledger-entry-details .definition-list > div { grid-template-columns: minmax(6rem, auto) minmax(0, 1fr); }
.change-details { min-width: 7rem; }
.change-details summary { color: var(--accent-ink); cursor: pointer; }
.change-list { display: grid; gap: .25rem; margin: .4rem 0; padding: 0; list-style: none; }
.change-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: .35rem; }
.change-list li span:first-child { color: var(--muted); white-space: nowrap; }
.audit-origin { margin-top: .2rem; color: var(--muted); font-size: .76rem; }
.audit-origin p { max-width: 12rem; overflow-wrap: anywhere; }

dialog {
  width: min(31rem, calc(100% - 1.4rem));
  max-height: calc(100dvh - 1.4rem);
  padding: 0;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--nav-ink);
  box-shadow: 0 20px 80px rgba(15, 23, 42, 27%);
}
dialog::backdrop { background: rgba(15, 23, 42, 55%); }
.wide-dialog { width: min(66rem, calc(100% - 1.4rem)); }
.wide-dialog .table-wrap { border: 1px solid var(--line); border-radius: .48rem; }
.dialog-panel { padding: 1.2rem; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; }
.dialog-heading h2 { font-size: 1.2rem; }
.icon-button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: .45rem;
  background: var(--canvas);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}
.icon-button:hover { background: var(--accent-soft); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .55rem; }
.dialog-note { color: var(--muted); overflow-wrap: anywhere; }
.password-once {
  display: block;
  padding: .75rem;
  border: 1px solid var(--accent-line);
  border-radius: .45rem;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font: .94rem ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
}
.error-message, .notice {
  padding: .62rem .75rem;
  border: 1px solid var(--red-line);
  border-radius: .47rem;
  color: var(--red-deep);
  background: var(--red-tint);
  overflow-wrap: anywhere;
}
.notice {
  margin-bottom: .85rem;
  color: var(--nav-ink);
  background: var(--success-tint);
  border-color: var(--success-line);
}

@media (max-width: 67rem) {
  :root { --sidebar-width: 12.5rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 60rem) {
  .responsive-table, .responsive-table tbody { display: block; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .responsive-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    padding: .65rem .8rem;
    gap: .55rem .75rem;
  }
  .responsive-table tr:nth-child(even) { background: var(--hover); }
  .responsive-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .responsive-table td:first-child, .ledger-table td:last-child { grid-column: 1 / -1; }
  .customer-table td:first-child a { font-size: 1rem; }
  .mobile-cell-label { display: block; color: var(--muted); font-size: .75rem; margin-bottom: .12rem; }
}

@media (max-width: 45rem) {
  :root { --sidebar-width: 6.65rem; }
  .sidebar { padding: .8rem .37rem; }
  .sidebar-brand { justify-content: center; padding: 0 .05rem .85rem; }
  .sidebar-brand .brand-mark, .sidebar-brand div span, .side-health-card { display: none; }
  .sidebar-brand strong { font-size: .91rem; }
  .navigation > * { align-items: flex-start; flex-direction: column; font-size: .76rem; padding: .48rem .43rem; }
  .pending-nav span { font-size: .64rem; }
  .session-bar { padding: .5rem .65rem; gap: .45rem; min-height: 3.35rem; }
  .operator { align-items: flex-start; flex-direction: column; justify-content: center; gap: 0; line-height: 1.28; }
  .operator-name { max-width: 100%; font-size: .83rem; }
  .operator-role { font-size: .67rem; }
  .main-content { padding: .85rem; }
  .page-heading p { font-size: .83rem; }
  .metrics { gap: .5rem; }
  .metric { min-height: 6.85rem; padding: .65rem .55rem; }
  .metric-title { font-size: .76rem; }
  .details-grid { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .details-panel { padding: .75rem; }
  .definition-list > div { grid-template-columns: minmax(5.4rem, .8fr) minmax(0, 1.2fr); font-size: .82rem; }
  .ledger-entry-details .definition-list > div { grid-template-columns: minmax(6rem, .75fr) minmax(0, 1.25fr); }
}

@media (max-width: 40rem) {
  .admin-console { margin-left: 0; }
  .sidebar { position: static; width: auto; padding: .7rem .85rem; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { justify-content: flex-start; padding: 0 .2rem .55rem; }
  .sidebar-brand .brand-mark { display: block; transform: scale(.8); }
  .navigation { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .navigation > * { padding: .35rem .3rem; justify-content: center; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters > :first-child, .filters .button { grid-column: 1 / -1; }
  .wide-dialog .dialog-panel { padding: .85rem; }
}

@media (max-width: 22rem) {
  .metrics { grid-template-columns: minmax(0, 1fr); }
}

.expiry-panel { margin-top: 1rem; }
.expiry-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.expiry-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--canvas);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.expiry-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.expiry-card > span:first-child { font-size: .86rem; font-weight: 650; margin-right: auto; }
.expiry-card strong { font-size: 1.35rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.expiry-unit { color: inherit; opacity: .78; font-size: .78rem; font-weight: 600; }
.expiry-card.due_today, .chip.expiry-chip.due_today { color: var(--red-deep); background: var(--red-tint); border-color: var(--red-line); }
.expiry-card.due_7d, .chip.expiry-chip.due_7d { color: var(--amber-ink); background: var(--amber-tint); border-color: var(--amber-line); }
.expiry-card.due_30d, .chip.expiry-chip.due_30d { color: var(--blue-ink); background: var(--blue-tint); border-color: var(--blue-line); }
.expiry-card.due_today:hover { border-color: var(--red); }
.expiry-card.due_7d:hover { border-color: var(--amber); }
.expiry-card.due_30d:hover { border-color: var(--blue-ink); }
.expiry-row-marker { margin-top: .24rem; }
.staff-customer-filters { grid-template-columns: minmax(8rem, 1.5fr) repeat(5, minmax(0, 1fr)) auto; }

.permission-fields {
  min-inline-size: 0;
  margin: 0;
  padding: .28rem .7rem .64rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
}
.permission-fields legend { padding-inline: .24rem; font-weight: 650; font-size: .875rem; }
.permission-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .16rem .46rem; }
.permission-option {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2.35rem;
  padding: .25rem;
  font-size: .83rem;
  cursor: pointer;
}
.permission-option input {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
}
.staff-permission-list, .staff-row-actions, .deal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.staff-row-actions { gap: .42rem; }
.staff-row-actions .button { min-height: 2.2rem; }
.deal-actions { margin-bottom: .65rem; }
.deal-page { display: grid; gap: .75rem; }
.deal-page .page-heading { margin-bottom: .35rem; }
.customer-id-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .55rem; max-width: 36rem; }
.customer-id-form .error-message { grid-column: 1 / -1; }
#customer-operation-form + .inline-note { overflow-wrap: anywhere; }
.deal-table { font-variant-numeric: tabular-nums; }
.deal-amount { display: block; max-inline-size: 18rem; overflow-x: auto; overflow-wrap: normal; white-space: nowrap; font-weight: 650; }
.deal-table th, .deal-table td, .admin-table th, .admin-table td { padding-inline: .65rem; }

@media (max-width: 67rem) {
  .staff-customer-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .staff-customer-filters > .button { grid-column: 1 / -1; }
}

@media (max-width: 60rem) {
  .admin-table td:last-child, .deal-table td:last-child, .deal-table .deal-amount-cell { grid-column: 1 / -1; }
}

@media (max-width: 40rem) {
  .staff-customer-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-id-form { grid-template-columns: minmax(0, 1fr); }
  .expiry-cards { gap: .35rem; }
  .expiry-card { padding: .5rem .4rem; gap: .2rem .22rem; }
  .expiry-card > span:first-child, .expiry-unit { font-size: .72rem; }
  .expiry-card strong { font-size: 1.18rem; }
}
.navigation [hidden] { display: none; }
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  margin-block: 1rem;
}
.model-grid > * { min-width: 0; overflow-wrap: anywhere; }
.model-grid .panel-actions { flex-wrap: wrap; }
.model-history-scroll { overflow-x: auto; max-width: 100%; }
.model-history { min-width: 38rem; }

.cost-page-stack, .monitor-page { display: grid; min-width: 0; gap: 1rem; }
.cost-page-stack > *, .monitor-page > * { min-width: 0; }
.cost-page-stack > .page-heading, .monitor-page > .page-heading { margin-bottom: .2rem; }
.cost-top-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cost-overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cost-top-metrics > .metrics:last-child .metric:first-child { background: var(--paper); border-color: var(--line); }
.cost-top-metrics > .metrics:last-child .metric:first-child .metric-value { color: var(--ink); }
.cost-metric .metric-value { font-size: clamp(1.22rem, 2.2vw, 2rem); }
.cost-metric:has(.cost-long-value) { container-type: inline-size; }
.cost-metric .cost-long-value {
  font-size: clamp(.75rem, 6.5cqi, 1.2rem);
  overflow-wrap: normal;
  white-space: nowrap;
  overflow-x: auto;
}
.cost-metric-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin: .62rem 0 0; }
.cost-metric-meta > span:not(.chip) { color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.chip.cost-actual { color: var(--nav-ink); background: var(--success-tint); border-color: var(--success-line); }
.chip.cost-estimated { color: var(--amber-ink); background: var(--amber-tint); }
.chip.cost-unpriced { color: var(--muted); background: var(--canvas); }
.cost-metric-meta > .cost-unpriced-text { color: var(--amber-ink); }
.cost-filters { display: grid; gap: .7rem; align-items: end; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cost-date-range { grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.cost-filters > .error-message { grid-column: 1 / -1; }
.cost-period-label { margin-bottom: .55rem; color: var(--muted); font-size: .84rem; }
.cost-result-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cost-result-facts > div { display: flex; flex-direction: column; gap: .12rem; }
.cost-result-facts dd { font-variant-numeric: tabular-nums; font-weight: 650; }
#cost-calls-title { scroll-margin-top: 5rem; }
.cost-group-table, .cost-call-table, .cost-price-table, .cost-rate-table { font-variant-numeric: tabular-nums; }
.cost-group-table th, .cost-group-table td, .cost-call-table th, .cost-call-table td,
.cost-price-table th, .cost-price-table td, .cost-rate-table th, .cost-rate-table td { padding-inline: .65rem; }
.cost-amount, .cost-token-list { min-width: 0; }
.cost-call-table .date-cell { white-space: normal; min-width: 6.4rem; }
.cost-call-table .chip.failed { color: var(--red-deep); background: var(--red-tint); border-color: var(--red-line); }
.cost-token-list { gap: .13rem; font-size: .75rem; }
.cost-token-list > div { grid-template-columns: auto minmax(0, 1fr); font-size: inherit; gap: .4rem; }
.cost-token-list dd { text-align: right; }
.cost-text-button {
  min-height: auto;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-ink);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .2em;
  white-space: normal;
  overflow-wrap: anywhere;
}
.cost-merchant-tasks { margin-top: .3rem; }
.cost-task-list { margin: .25rem 0 0; padding-left: 1rem; color: var(--muted); font-size: .78rem; }
.cost-pager, .cost-pager-buttons, .cost-subheading-row, .cost-customer-failures {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}
.cost-pager, .cost-subheading-row { justify-content: space-between; }
.cost-pager { margin-top: .75rem; font-size: .84rem; }
.cost-pager button:disabled { cursor: default; }
.cost-subheading { font-size: .91rem; line-height: 1.4; }
.cost-subheading-row { margin-block: .9rem .5rem; }
.cost-section-note { color: var(--muted); margin-bottom: .55rem; font-size: .84rem; }
.cost-customer-failures { margin-block: .78rem .95rem; gap: .4rem 1rem; color: var(--muted); font-size: .84rem; }
.cost-customer-failures + .cost-subheading { margin-bottom: .45rem; }

.monitor-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .4rem 1rem;
  margin-top: .85rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  color: var(--ink);
  background: var(--paper);
}
.monitor-page .monitor-banner { margin-top: 0; }
.monitor-normal { background: var(--success-tint); color: var(--nav-ink); border-color: var(--success-line); }
.monitor-warning { background: var(--amber-tint); color: var(--amber-ink); border-color: var(--amber-line); }
.monitor-error { background: var(--red-tint); color: var(--red-deep); border-color: var(--red-line); }
.monitor-alert-panel { display: grid; gap: .55rem; }
.monitor-alerts { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.monitor-alerts li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .55rem; overflow-wrap: anywhere; }
.monitor-alerts li > span:last-child { min-width: 0; }
.monitor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.monitor-grid .definition-list { font-variant-numeric: tabular-nums; }
.monitor-grid .definition-list > div { grid-template-columns: minmax(4.5rem, .88fr) minmax(0, 1.12fr); }
.monitor-grid > [data-monitor-dimension="sync"] {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .9rem;
}
.monitor-grid > [data-monitor-dimension="sync"] > :is(h2, p) { margin: 0; }
.monitor-grid > [data-monitor-dimension="sync"] .definition-list > div { display: flex; }
.monitor-service-title { margin-bottom: .38rem; font-size: .86rem; }
.monitor-service + .monitor-service { margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.monitor-utilization { display: grid; min-width: 0; gap: .2rem; }
.monitor-meter { accent-color: var(--brand); width: 100%; height: .55rem; }

@media (max-width: 72rem) {
  .cost-top-metrics { grid-template-columns: minmax(0, 1fr); }
  .cost-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 60rem) {
  .cost-call-table .date-cell { min-width: 0; }
  .cost-token-list { max-width: 12rem; }
}

@media (max-width: 45rem) {
  .cost-page-stack, .monitor-page, .cost-top-metrics { gap: .68rem; }
  .cost-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-result-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-filters > .button { grid-column: 1 / -1; }
  .customer-cost-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-metric:has(.cost-long-value) { grid-column: 1 / -1; }
  .monitor-grid { grid-template-columns: minmax(0, 1fr); gap: .68rem; }
  .monitor-banner { padding: .65rem .75rem; }
  .cost-metric-meta { gap: .3rem; }
}

@media (max-width: 22rem) {
  .customer-cost-metrics, .cost-overview-metrics, .cost-filters { grid-template-columns: minmax(0, 1fr); }
  .cost-date-range { grid-column: auto; }
}

@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
  .primary, .danger, .chip { border-color: ButtonText; }
  .navigation a[aria-current="page"] { border-color: Highlight; }
}
