:root {
  --bg: #fbfbfa;
  --bg-secondary: #f6f5f2;
  --bg-tertiary: #faf9f7;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #20201d;
  --muted: #737069;
  --muted-light: #9a968d;
  --separator: #e7e3dc;
  --separator-soft: #f0ede7;
  --brand: #18533f;
  --brand-deep: #113b2e;
  --brand-bg: #e9f1ec;
  --danger: #b64a3e;
  --warning: #b9803c;
  --shadow: 0 12px 30px rgba(39, 36, 28, 0.055);
  --shadow-soft: 0 6px 18px rgba(39, 36, 28, 0.04);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg-secondary);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(24, 83, 63, 0.42);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -48px;
  z-index: 200;
  border-radius: 7px;
  padding: 9px 12px;
  background: var(--brand-deep);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  top: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg-secondary);
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--brand);
  font-weight: 600;
  margin: 0 0 12px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-weight: 620;
  margin-bottom: 10px;
  letter-spacing: 0;
}

.muted,
.panel-head p,
.table-card h4 + p {
  color: var(--muted);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 7px;
  width: 100%;
  min-width: 0;
  border: 1px dashed var(--separator);
  border-radius: 8px;
  padding: 18px;
  background: var(--bg-tertiary);
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
}

.empty-state p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state button {
  margin-top: 4px;
}

.empty-state.warn {
  border-color: rgba(185, 128, 60, 0.38);
  background: #fffaf3;
}

.empty-state.danger {
  border-color: rgba(182, 74, 62, 0.32);
  background: #fff6f4;
}

.flow-grid > .empty-state,
.segment-grid > .empty-state {
  grid-column: 1 / -1;
}

.form,
.form-card {
  display: grid;
  gap: 16px;
}

.login-advanced {
  border-top: 1px solid var(--separator);
  padding-top: 12px;
}

.login-advanced summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.login-advanced[open] summary {
  margin-bottom: 12px;
}

.login-advanced .muted {
  font-size: 13px;
  margin: 8px 0 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(24, 83, 63, 0.42);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(24, 83, 63, 0.08);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(24, 83, 63, 0.42);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

.primary,
.secondary,
.ghost {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 560;
}

.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(24, 83, 63, 0.13);
}

.primary:hover {
  background: var(--brand-deep);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 27, 24, 0.42);
  backdrop-filter: blur(3px);
}

.action-dialog {
  width: min(520px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow-y: auto;
  border: 1px solid var(--separator);
  border-radius: 10px;
  padding: 24px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(24, 25, 22, 0.2);
}

.action-dialog h3 {
  margin-bottom: 16px;
}

.action-dialog .detail-list {
  margin-bottom: 14px;
}

.risk-warning {
  border-left: 3px solid var(--danger);
  margin: 14px 0;
  padding: 10px 12px;
  color: var(--danger);
  background: #fff6f4;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.one-time-secret-value {
  display: block;
  border: 1px dashed rgba(24, 83, 63, 0.35);
  border-radius: 8px;
  padding: 14px;
  font-size: 20px;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
  color: var(--brand-deep);
  background: var(--brand-bg);
}

.secondary {
  color: var(--brand);
  background: var(--brand-bg);
  border-color: rgba(15, 76, 58, 0.18);
}

.secondary:hover {
  border-color: rgba(24, 83, 63, 0.28);
  background: #dfece5;
}

.ghost {
  color: var(--muted);
  background: #fff;
  border-color: var(--separator);
}

.ghost:hover {
  color: var(--text);
  border-color: #d8d2c8;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--separator);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: grid;
  gap: 8px;
  margin-bottom: 28px;
  padding: 0 10px;
}

.brand strong {
  font-size: 15px;
  font-weight: 650;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 18px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group-title {
  margin: 0 10px 3px;
  color: var(--muted-light);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.mobile-nav-control {
  display: none;
}

.nav-item {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 520;
}

.nav-item.active {
  color: var(--brand);
  background: var(--brand-bg);
  font-weight: 650;
  box-shadow: inset 3px 0 0 rgba(24, 83, 63, 0.2);
}

.nav-item:hover {
  color: var(--text);
  background: rgba(24, 83, 63, 0.05);
}

.main {
  width: 100%;
  padding: 24px 28px 28px;
  min-width: 0;
  max-width: 1240px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.topbar h2 {
  font-size: 22px;
  font-weight: 680;
  margin-bottom: 6px;
}

.topbar p {
  color: var(--muted);
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.compact-input {
  width: 220px;
}

.panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.panel > * {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 18px 20px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.panel-head h3 {
  font-size: 18px;
  font-weight: 660;
  margin-bottom: 6px;
}

.panel-head p {
  margin-bottom: 0;
}

.usage-hero {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 12px;
}

.hero-summary,
.health-card,
.segment-card {
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: #fff;
}

.hero-summary {
  padding: 20px;
  background: var(--brand);
  color: #fff;
}

.hero-summary span {
  color: rgba(255, 255, 255, 0.72);
}

.hero-summary strong {
  display: block;
  font-size: 42px;
  font-weight: 500;
  margin: 12px 0 6px;
}

.health-card {
  padding: 16px;
}

.health-card span,
.segment-card span,
.card-title-row span {
  color: var(--muted);
  font-size: 13px;
}

.health-card strong,
.segment-card strong {
  display: block;
  font-size: 28px;
  margin: 9px 0 7px;
  font-weight: 500;
}

.health-card.good {
  border-color: rgba(15, 76, 58, 0.28);
}

.health-card.warn {
  border-color: rgba(199, 135, 61, 0.36);
}

.health-card.danger {
  border-color: rgba(184, 51, 42, 0.28);
}

.health-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
}

.warn .dot {
  background: var(--warning);
}

.danger .dot {
  background: var(--danger);
}

.segment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.segment-card {
  padding: 16px;
}

.segment-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}

.segment-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upsell-head-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.upsell-alignment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.upsell-alignment.good { border-color: rgba(15, 76, 58, 0.28); background: var(--brand-bg); }
.upsell-alignment.warn { border-color: rgba(199, 135, 61, 0.5); background: #fffaf1; }
.upsell-alignment span { color: var(--muted); text-align: right; }

.upsell-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.upsell-tier-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}

.upsell-tier-card > span { color: var(--muted); font-size: 13px; }
.upsell-tier-card > strong { font-size: 28px; line-height: 1; }
.upsell-tier-card > p { margin: 0; color: var(--muted); font-size: 12px; }
.upsell-tier-card.danger { border-color: rgba(180, 61, 55, 0.45); background: rgba(180, 61, 55, 0.035); }
.upsell-tier-card.danger > strong { color: var(--danger); }
.upsell-tier-card.warn { border-color: rgba(199, 135, 61, 0.5); background: #fffaf1; }
.upsell-tier-card.warn > strong, .upsell-tier-card.attention > strong { color: var(--warning); }
.upsell-tier-card.attention { border-color: rgba(199, 135, 61, 0.28); }

.upsell-priority-card { display: grid; gap: 14px; }
.upsell-priority-card .card-title-row > div { display: grid; gap: 4px; }
.upsell-priority-card .card-title-row p { margin: 0; color: var(--muted); font-size: 12px; }
.upsell-warning-list { display: grid; gap: 10px; }

.upsell-warning-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.25fr) repeat(3, minmax(130px, 1fr));
  gap: 12px;
  align-items: center;
  border: 1px solid var(--separator-soft);
  border-left: 3px solid var(--separator);
  border-radius: 7px;
  padding: 12px;
  background: var(--bg-tertiary);
}

.upsell-warning-row.danger { border-left-color: var(--danger); }
.upsell-warning-row.warn, .upsell-warning-row.attention { border-left-color: var(--warning); }
.upsell-warning-row.good { border-left-color: var(--brand); }
.upsell-warning-main, .upsell-warning-fact { display: grid; gap: 5px; min-width: 0; }
.upsell-warning-main { grid-template-columns: auto 1fr; align-items: start; }
.upsell-warning-main > div { display: grid; gap: 4px; min-width: 0; }
.upsell-warning-main strong, .upsell-warning-main span, .upsell-warning-fact strong { overflow-wrap: anywhere; }
.upsell-warning-main > div > span:not(.badge), .upsell-warning-fact > span, .upsell-warning-source, .upsell-contact { color: var(--muted); font-size: 11px; }
.upsell-warning-fact strong { font-size: 12px; font-weight: 620; }
.upsell-warning-source { grid-column: 1 / 3; line-height: 1.45; }
.upsell-contact { grid-column: 3 / 5; line-height: 1.45; text-align: right; overflow-wrap: anywhere; }
.upsell-row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 7px; }
.upsell-row-actions button { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
.upsell-action-saving { color: var(--muted); font-size: 12px; }
.upsell-empty { padding: 20px 4px; text-align: center; }
.upsell-empty p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  min-width: 0;
}

.flow-grid > * {
  min-width: 0;
}

.business-dashboard-head {
  align-items: flex-start;
}

.business-dashboard-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.business-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.business-action-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.business-action-card.good { border-color: rgba(15, 76, 58, 0.26); }
.business-action-card.warn { border-color: rgba(199, 135, 61, 0.46); }
.business-action-card.danger { border-color: rgba(180, 61, 55, 0.46); background: rgba(180, 61, 55, 0.025); }

.business-action-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.business-action-card-head > div {
  display: grid;
  gap: 6px;
}

.business-action-card-head > div > span,
.business-action-card > p,
.business-action-item span,
.business-action-empty {
  color: var(--muted);
}

.business-action-card-head > div > strong {
  font-size: 28px;
  font-weight: 580;
}

.business-action-card.danger .business-action-card-head > div > strong { color: var(--danger); }
.business-action-card > p { margin: 0; min-height: 34px; font-size: 12px; line-height: 1.45; }

.business-action-list {
  display: grid;
  gap: 7px;
}

.business-action-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--separator-soft);
  border-radius: 7px;
  background: var(--bg-tertiary);
  text-align: left;
}

.business-action-item:hover { border-color: var(--brand); background: var(--brand-bg); }
.business-action-item strong, .business-action-item span { overflow-wrap: anywhere; }
.business-action-item strong { font-size: 13px; font-weight: 650; }
.business-action-item span { font-size: 11px; line-height: 1.35; }
.business-action-empty { padding: 10px 0; font-size: 13px; }
.business-action-error { grid-column: 1 / -1; }
.business-action-error > span { color: var(--muted); }
.business-action-error button { justify-self: start; }

.business-metric-title {
  padding-top: 4px;
}

.business-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.business-metric-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.business-metric-card.warn {
  border-color: rgba(199, 135, 61, 0.46);
  background: rgba(199, 135, 61, 0.025);
}

.business-metric-card > span,
.business-metric-card > small,
.business-metric-note {
  color: var(--muted);
}

.business-metric-card > span { font-size: 12px; }
.business-metric-card > strong { font-size: 23px; font-weight: 580; }
.business-metric-card > small { line-height: 1.35; overflow-wrap: anywhere; }
.business-metric-note { margin: -2px 0 0; font-size: 12px; line-height: 1.5; }

.dashboard-section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--separator);
}

.dashboard-section-title h3,
.dashboard-section-title p { margin: 0; }
.dashboard-section-title p { margin-top: 4px; font-size: 13px; }

.flow-card {
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.flow-card.good {
  border-color: rgba(15, 76, 58, 0.26);
}

.flow-card.warn {
  border-color: rgba(199, 135, 61, 0.36);
}

.flow-card.danger {
  border-color: rgba(180, 61, 55, 0.42);
  background: rgba(180, 61, 55, 0.04);
}

.flow-card.danger strong {
  color: var(--danger);
}

.flow-card span,
.flow-card p {
  color: var(--muted);
}

.flow-card strong {
  display: block;
  font-size: 24px;
  font-weight: 560;
  margin: 8px 0 6px;
}

.flow-card p {
  margin-bottom: 0;
  font-size: 13px;
}

.policy-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.policy-form-wide {
  grid-column: 1 / -1;
}

.policy-note,
.policy-status {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.policy-note {
  color: var(--muted);
  background: var(--bg-tertiary);
}

.policy-status {
  color: var(--muted);
  border: 1px solid var(--separator);
  background: #fff;
}

.policy-status.good {
  color: var(--brand);
  border-color: rgba(15, 76, 58, 0.26);
  background: var(--brand-bg);
}

.policy-status.warn {
  color: var(--warning);
  border-color: rgba(199, 135, 61, 0.36);
  background: #fff8ed;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-help.danger {
  color: var(--danger);
}

.policy-confirmation {
  border: 1px solid rgba(24, 83, 63, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: var(--brand-bg);
}

.policy-confirmation > strong {
  display: block;
  margin-bottom: 10px;
}

.policy-confirmation ul {
  display: grid;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.policy-confirmation li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.policy-confirmation-warnings {
  border-top: 1px solid rgba(184, 51, 42, 0.18);
  color: var(--danger);
  margin-top: 12px;
  padding-top: 10px;
  font-size: 13px;
}

.policy-confirmation-warnings p {
  margin: 6px 0 0;
}

.policy-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.compact-policy-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--separator);
}

.compact-policy-form + .compact-policy-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-policy-form button {
  justify-self: start;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
}

.badge.good {
  color: var(--brand);
  background: var(--brand-bg);
}

.badge.warn {
  color: var(--warning);
  background: #fff4e4;
}

.badge.danger {
  color: var(--danger);
  background: rgba(180, 61, 55, 0.1);
}

.invite-list {
  display: grid;
  gap: 10px;
}

.invite-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 12px;
  background: var(--bg-tertiary);
}

.invite-card > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.invite-card span,
.invite-card small {
  color: var(--muted);
}

.invite-card code {
  display: block;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--separator-soft);
  border-radius: 8px;
  padding: 6px 8px;
  overflow-wrap: anywhere;
}

.ops-teacher-form {
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  margin-top: 12px;
}

.wide-card {
  grid-column: 1 / -1;
}

.table-card,
.form-card,
.settings-card {
  min-width: 0;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.settings-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.table-card h4 {
  margin-bottom: 0;
  font-size: 15px;
  font-weight: 650;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  min-height: 32px;
}

.table {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  font-size: 13px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--separator);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 650;
  background: #f7f6f2;
}

tbody tr:hover {
  background: var(--bg-tertiary);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr 150px 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg-tertiary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.conversion-list {
  display: grid;
  gap: 12px;
}

.conversion-workflow {
  display: grid;
  gap: 16px;
}

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

.conversion-view-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  background: var(--bg-tertiary);
}

.conversion-view-tab {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.conversion-view-tab.active {
  border-color: var(--separator);
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-soft);
}

.conversion-view-count {
  display: inline-flex;
  justify-content: center;
  min-width: 22px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-secondary);
  font-size: 12px;
}

.conversion-active-view {
  display: grid;
  gap: 18px;
}

.conversion-group {
  display: grid;
  gap: 12px;
}

.conversion-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.conversion-group-head h4,
.conversion-group-head p {
  margin: 0;
}

.conversion-group-head p,
.conversion-group-count {
  color: var(--muted);
  font-size: 13px;
}

.conversion-group-count {
  white-space: nowrap;
}

.conversion-card {
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.conversion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
}

.conversion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conversion-state-note {
  margin: 10px 0 0;
  color: var(--muted);
}

.conversion-state-note.good {
  color: var(--brand);
}

.status-pending,
.status-waiting_manual_xml,
.status-new,
.status-triaged,
.status-in_progress,
.status-warning {
  color: var(--warning);
}

.status-activated,
.status-ingest_ready,
.status-committed,
.status-fixed,
.status-info {
  color: var(--brand);
}

.status-failed,
.status-wont_fix,
.status-duplicate,
.status-error {
  color: var(--danger);
}

.issue-filters {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  min-width: 0;
  gap: 10px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.issue-filters > * {
  min-width: 0;
}

.filter-reset {
  align-self: stretch;
  white-space: nowrap;
}

.checkbox-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.checkbox-filter input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.issue-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.issue-list,
.issue-detail {
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  box-shadow: var(--shadow-soft);
}

.issue-list {
  display: grid;
  align-content: start;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.issue-item {
  display: grid;
  gap: 7px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--separator);
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
}

.issue-item:last-child {
  border-bottom: 0;
}

.issue-item:hover,
.issue-item.active {
  background: var(--bg-tertiary);
}

.issue-item.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.issue-item-head,
.issue-detail-head,
.issue-status-row,
.issue-event > div,
.issue-comment > div {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.issue-item strong,
.issue-detail h4 {
  font-weight: 500;
}

.issue-item span,
.issue-item small,
.issue-event small,
.issue-comment span,
.issue-comment small {
  color: var(--muted);
}

.issue-item strong,
.issue-item span,
.issue-item small,
.issue-kv span,
.issue-event p,
.issue-event small,
.issue-comment p {
  overflow-wrap: anywhere;
}

.issue-item em {
  font-style: normal;
  white-space: nowrap;
}

.beta-list-badges,
.beta-followup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.issue-detail {
  display: grid;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
}

.issue-detail-head {
  border-bottom: 1px solid var(--separator);
  padding-bottom: 14px;
}

.issue-detail-head p {
  color: var(--muted);
  margin-bottom: 0;
  white-space: pre-wrap;
}

.issue-kv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}

.issue-kv div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.issue-kv strong,
.issue-ai strong {
  color: var(--muted);
  font-size: 13px;
}

.issue-ai {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  padding: 12px 0;
}

.issue-ai p {
  display: grid;
  gap: 4px;
  margin-bottom: 0;
  white-space: pre-wrap;
}

.issue-status-row {
  justify-content: flex-start;
}

.issue-status-row select {
  width: 220px;
}

.issue-section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.issue-section h4 {
  margin-bottom: 0;
}

.issue-event-list,
.issue-comment-list {
  display: grid;
  border-top: 1px solid var(--separator);
}

.issue-event,
.issue-comment {
  display: grid;
  gap: 7px;
  border-bottom: 1px solid var(--separator);
  padding: 10px 0;
  min-width: 0;
}

.issue-event p,
.issue-comment p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.issue-event pre {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg-tertiary);
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.issue-check {
  display: flex;
  width: fit-content;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
}

.issue-check input {
  width: auto;
}

.issue-empty {
  padding: 16px;
}

.tuning-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  min-width: 0;
}

.tuning-layout,
.calibration-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.tuning-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.tuning-param {
  border-bottom: 1px solid var(--separator);
  padding-bottom: 10px;
}

.tuning-param small {
  color: var(--muted);
  line-height: 1.5;
}

.calibration-list {
  display: grid;
  max-height: 640px;
  overflow-y: auto;
}

.calibration-item audio {
  width: 100%;
  margin-top: 4px;
}

.validation-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--separator);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.validation-summary strong {
  color: var(--brand);
  font-size: 28px;
  font-weight: 500;
}

.validation-list {
  display: grid;
  gap: 8px;
}

.validation-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 10px;
}

.validation-item.good {
  border-color: rgba(15, 76, 58, 0.28);
}

.validation-item.warn {
  border-color: rgba(199, 135, 61, 0.36);
}

.compact-inline-form {
  grid-template-columns: 1fr auto;
  margin-bottom: 14px;
}

.join-review-list {
  display: grid;
  gap: 10px;
}

.join-review-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--separator);
  border-radius: 8px;
  padding: 12px;
}

.join-review-card h4 {
  margin-bottom: 6px;
}

.join-review-card p,
.join-review-card small {
  color: var(--muted);
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  top: 18px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 10;
}

.toast.toast-error {
  background: #7f2f28;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    min-width: 0;
    align-content: start;
  }

  .main {
    width: 100%;
    max-width: none;
    min-width: 0;
    overflow-x: hidden;
    padding: 18px 16px 24px;
  }

  .panel-head,
  .table-card,
  .form-card,
  .settings-card,
  .flow-card,
  .health-card,
  .segment-card {
    min-width: 0;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--separator);
    position: static;
    height: auto;
    overflow-y: visible;
    display: grid;
    gap: 12px;
    padding: 14px 16px;
  }

  .sidebar .brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 0 2px;
  }

  .sidebar .brand span {
    text-align: right;
  }

  .conversion-workflow-toolbar,
  .conversion-group-head {
    align-items: stretch;
    flex-direction: column;
  }

  .conversion-view-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  #mainNav {
    display: none;
  }

  .mobile-nav-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .mobile-nav-control label {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
  }

  .mobile-nav-control select {
    min-width: 0;
    padding: 9px 11px;
  }

  nav,
  .panel-head,
  .topbar,
  .topbar-actions,
  .usage-hero,
  .segment-grid,
  .dashboard-grid,
  .ops-grid,
  .flow-grid,
  .policy-form,
  .compact-policy-form,
  .issue-filters,
  .issue-layout,
  .issue-kv,
  .tuning-overview,
  .tuning-layout,
  .calibration-layout,
  .join-review-card,
  .invite-card,
  .inline-form,
  .form-row,
  .business-metric-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .upsell-head-actions,
  .upsell-alignment,
  .upsell-tier-grid,
  .upsell-warning-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .upsell-alignment span { text-align: left; }
  .panel-head > * { min-width: 0; }
  .panel-head p { overflow-wrap: anywhere; }
  .upsell-warning-source { grid-column: auto; }
  .upsell-contact { grid-column: auto; text-align: left; }
  .upsell-row-actions { grid-column: auto; justify-content: stretch; }
  .upsell-row-actions button { flex: 1 1 120px; }
  .filter-reset { justify-self: stretch; }
  #betaSummary { grid-template-columns: 1fr; }

  .wide-field {
    grid-column: auto;
  }

  .issue-list {
    max-height: none;
  }

  .issue-detail-head,
  .issue-status-row {
    display: grid;
  }

  .issue-status-row select {
    width: 100%;
  }

  .compact-input {
    width: 100%;
  }
}

/* 评分松紧开关 */
#scoringModeCard { margin-bottom: 16px; }
.scoring-mode-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.scoring-mode-row label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 220px; }
.scoring-mode-row select { padding: 8px 10px; border-radius: 8px; }
#scoringModeHint { font-size: 13px; }

/* 内测申请 / 用户中心 / 运维监控 */
.status-disabled { color: var(--danger); }
.detail-list { display: grid; gap: 8px; margin: 0 0 12px; }
.detail-list > div { display: flex; gap: 12px; font-size: 14px; }
.detail-list dt { color: var(--muted); min-width: 72px; margin: 0; }
.detail-list dd { margin: 0; word-break: break-all; }
.detail-scenario { white-space: pre-wrap; background: var(--surface, #f6f7f9); border-radius: 8px; padding: 12px; color: var(--ink, #333); }
.user-actions { margin: 4px 0 12px; }
.beta-approve-card { margin-top: 14px; }
.beta-followup-card { margin-top: 4px; background: var(--bg-tertiary); }
.beta-followup-card .card-title-row p { margin: 4px 0 0; font-size: 13px; }
.beta-contact-value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--brand); font-weight: 650; }
.overdue-text { color: var(--danger); font-weight: 650; }
#betaSummary { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
#betaSummary .flow-card, #monitorHealth .flow-card { min-height: 84px; }
@media (max-width: 980px) {
  #betaSummary { grid-template-columns: 1fr; }
}

/* 增长分析:趋势折线图 */
.trend-chart { width: 100%; overflow-x: auto; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-grid { stroke: var(--separator-soft); stroke-width: 1; }
.trend-axis { fill: var(--muted-light); font-size: 11px; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.trend-legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.trend-legend-item i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.trend-summary {
  margin: 10px 0 0;
  border-left: 3px solid var(--brand);
  padding: 8px 10px;
  color: var(--muted);
  background: var(--bg-tertiary);
  font-size: 13px;
}

.trend-data-details {
  margin-top: 12px;
}

.trend-data-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.trend-data-details .table {
  margin-top: 10px;
}

/* Optional administrator mapping workspace; ordinary upload stays unchanged. */
#performanceMappingPanel { margin: 16px 0; padding: 16px; border: 1px solid var(--border, #dce5df); border-radius: 12px; }
#performanceMappingPanel summary { cursor: pointer; font-weight: 600; }
#performanceMappingPanel fieldset { margin: 12px 0; padding: 12px; border: 1px solid #dce5df; border-radius: 8px; }
#performanceMappingPanel input, #performanceMappingPanel select { padding: 8px; margin: 4px; max-width: 100%; }
#performanceMappingPanel input[type=number] { width: 95px; }
.mapping-segment { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
#performanceMappingPanel button { margin: 6px; }
#mappingPreview audio { display: block; margin: 8px 0; }
#mappingPreview img { display: block; max-height: 70vh; object-fit: contain; object-position: left; margin: 12px 0; }
#mappingPreview label { display: block; }
#performanceMappingPanel .mapping-segment select { width: auto; min-width: 160px; flex: 1; }
#performanceMappingPanel .mapping-segment button { flex: 0 0 auto; }
#mappingPreview input[type=checkbox] { width: auto; display: inline-block; }
