:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --line: #dce1e5;
  --line-strong: #c8d0d6;
  --text: #172026;
  --muted: #65717a;
  --green: #16784b;
  --green-soft: #e7f5ee;
  --blue: #2469a0;
  --blue-soft: #eaf3f9;
  --amber: #9a650d;
  --amber-soft: #fff4d8;
  --red: #b33a3a;
  --red-soft: #fcecec;
  --sidebar: #172026;
  --sidebar-muted: #9da8af;
  --shadow: 0 10px 28px rgb(23 32 38 / 8%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

.boot-state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  background: var(--surface);
}

.login-panel {
  padding: 48px clamp(28px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 17px;
  font-weight: 750;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--green);
  color: white;
}

.login-panel h1 {
  margin: 56px 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}

.login-panel > p { margin: 0 0 30px; color: var(--muted); line-height: 1.6; }
.auth-switch {
  height: 42px;
  margin-bottom: 22px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.auth-switch button {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
}

.auth-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgb(23 32 38 / 9%);
}

.login-form { display: grid; gap: 18px; }

.login-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0%) 50%, rgb(255 255 255 / 75%)),
    repeating-linear-gradient(0deg, transparent 0 39px, rgb(255 255 255 / 60%) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgb(255 255 255 / 60%) 39px 40px),
    #dfe9e3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-board {
  width: min(720px, 75%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 14px;
}

.flow-step {
  min-height: 116px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: rgb(255 255 255 / 90%);
  border: 1px solid rgb(23 120 75 / 20%);
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
}

.flow-step svg { color: var(--green); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.app-shell.ops-home {
  color: #edf3fa;
  --bg: #0b111c;
  --surface: #101927;
  --surface-muted: #151f2e;
  --line: #253145;
  --line-strong: #304057;
  --text: #edf3fa;
  --muted: #8291a7;
  --green: #5da3e6;
  --green-soft: #17344f;
  --blue: #6eaee8;
  --blue-soft: #14263a;
  --amber: #e2b45f;
  --amber-soft: #352c1c;
  --red: #ef8c8c;
  --red-soft: #3a2025;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 22px 16px;
  background: var(--sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar .brand { padding: 0 8px 24px; border-bottom: 1px solid rgb(255 255 255 / 10%); }
.nav-section { margin-top: 22px; }
.nav-label { margin: 0 10px 8px; color: var(--sidebar-muted); font-size: 11px; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; }

.nav-item {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
}

.nav-item:hover { color: white; background: rgb(255 255 255 / 6%); }
.nav-item.active { color: white; background: rgb(59 158 109 / 24%); }
.nav-item svg { width: 18px; height: 18px; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgb(255 255 255 / 10%); }

.user-chip { padding: 8px; display: grid; grid-template-columns: 32px 1fr; gap: 9px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #d3a13d; color: #172026; font-weight: 800; }
.user-chip strong, .user-chip span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 13px; }
.user-chip span { margin-top: 2px; font-size: 11px; color: var(--sidebar-muted); }

.main { grid-column: 2; min-width: 0; }
.topbar { height: 68px; padding: 0 clamp(20px, 4vw, 48px); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: 0; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.app-shell.ops-home .topbar p { color: #8291a7; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.balance-pill { min-height: 36px; padding: 0 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; font-weight: 700; }
.balance-pill { cursor: pointer; color: inherit; background: transparent; }

.page { width: min(1320px, 100%); margin: 0 auto; padding: 30px clamp(20px, 4vw, 48px) 56px; }
.app-shell.ops-home .main { background: #0b111c; }
.app-shell.ops-home .topbar { color: #edf3fa; background: #0b111c; border-color: #253145; }
.app-shell.ops-home .topbar .icon-btn,
.app-shell.ops-home .topbar .balance-pill { color: #edf3fa; background: #111a28; border-color: #2a374b; }
.app-shell.ops-home tbody tr:hover { background: #151f2e; }
.app-shell.ops-home .btn-secondary,
.app-shell.ops-home .icon-btn { color: #d7e1ec; background: #151f2e; border-color: #304057; }
.app-shell.ops-home .btn-secondary:hover,
.app-shell.ops-home .icon-btn:hover { background: #1a2637; }
.app-shell.ops-home .btn-primary { background: #5da3e6; color: #07111e; border-color: #69aeea; }
.app-shell.ops-home .btn-primary:hover { background: #76b7f0; }
.app-shell.ops-home .alert-info { color: #b8dbf6; background: #14263a; border-color: #285178; }
.app-shell.ops-home .alert-warning { color: #f0cf86; background: #352c1c; border-color: #624d24; }
.app-shell.ops-home .alert-danger { color: #f1a2a2; background: #3a2025; border-color: #6b333a; }
.ops-dashboard { width: min(1480px, 100%); color: #edf3fa; background: #0b111c; }
.ops-hero { min-height: 130px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.ops-kicker { color: #68aee8; font-size: 11px; font-weight: 800; }
.ops-hero h2 { margin: 12px 0 8px; font-size: 31px; letter-spacing: 0; }
.ops-hero p { margin: 0; color: #8291a7; font-size: 13px; }
.ops-hero-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.ops-button { min-height: 40px; padding: 0 14px; border: 1px solid #2a374b; border-radius: 5px; color: #d9e3ef; background: #121b2a; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.ops-button:hover { background: #182436; }
.ops-button.primary { color: white; background: #276fbc; border-color: #3b82ce; }
.ops-stats { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ops-stat { position: relative; min-height: 174px; padding: 21px; border: 1px solid #28354a; border-radius: 6px; background: #111a28; overflow: hidden; }
.ops-stat::after { content: ''; position: absolute; inset: 0 0 0 auto; width: 3px; background: #4fbf8d; }
.ops-stat.blue::after { background: #5da3e6; }
.ops-stat.amber::after { background: #d29b2f; }
.ops-stat.violet::after { background: #9b7be8; }
.ops-stat-label { color: #98a7ba; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 750; }
.ops-stat strong { display: block; margin-top: 22px; font-size: 27px; font-variant-numeric: tabular-nums; }
.ops-stat > span { display: block; margin-top: 7px; color: #7f8da1; font-size: 11px; line-height: 1.5; }
.ops-stat button { margin-top: 14px; padding: 0; border: 0; color: #72afe6; background: transparent; font-size: 11px; font-weight: 700; }
.ops-panel { margin-top: 18px; border: 1px solid #28354a; border-radius: 6px; background: #101927; overflow: hidden; }
.ops-panel-head { min-height: 76px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #253145; }
.ops-panel-head span { color: #5fa6df; font-size: 10px; font-weight: 800; }
.ops-panel-head h3 { margin: 6px 0 0; font-size: 16px; }
.ops-legend { display: inline-flex; align-items: center; gap: 18px; color: #8a99ad; font-size: 11px; }
.ops-legend span { color: #8a99ad; display: inline-flex; align-items: center; gap: 7px; }
.ops-legend span::before { content: ''; width: 18px; height: 3px; border-radius: 2px; background: #36c99a; }
.ops-legend .planned::before { background: #d29b2f; }
.ops-consumption-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #253145; background: #192434; }
.ops-consumption-summary div { min-height: 66px; padding: 13px 16px; border-right: 1px solid #253145; }
.ops-consumption-summary div:last-child { border-right: 0; }
.ops-consumption-summary span { display: block; color: #7f8da1; font-size: 10px; }
.ops-consumption-summary strong { display: block; margin-top: 7px; font-size: 14px; }
#ops-consumption-chart { width: 100%; height: 270px; display: block; }
.ops-supply-strip { margin-top: 18px; display: grid; grid-template-columns: 1.1fr repeat(5, 1fr); border: 1px solid #28354a; border-radius: 6px; background: #101927; overflow: hidden; }
.ops-supply-strip > div { min-height: 105px; padding: 18px; border-right: 1px solid #253145; display: flex; flex-direction: column; justify-content: center; }
.ops-supply-strip > div:last-child { border-right: 0; }
.ops-supply-strip small { color: #77869a; font-size: 10px; }
.ops-supply-strip strong { margin-top: 8px; font-size: 13px; }
.ops-supply-strip span:not(.ops-live) { margin-top: 6px; color: #8291a5; font-size: 10px; }
.ops-live { width: 9px; height: 9px; margin-bottom: 9px; border-radius: 50%; background: #68778b; box-shadow: 0 0 0 4px rgb(104 119 139 / 12%); }
.ops-live.on { background: #36c99a; box-shadow: 0 0 0 4px rgb(54 201 154 / 12%); }
.ops-inventory-controls { display: flex; align-items: center; gap: 10px; }
.ops-inventory-controls .input { width: 110px; color: #edf3fa; background: #151f2e; border-color: #304057; }
.ops-stock-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #101927; }
.ops-stock-grid > div { min-height: 108px; padding: 18px 20px; border-right: 1px solid #253145; display: flex; flex-direction: column; justify-content: center; }
.ops-stock-grid > div:last-child { border-right: 0; }
.ops-stock-grid small { color: #77869a; font-size: 10px; }
.ops-stock-grid strong { margin-top: 8px; font-size: 19px; font-variant-numeric: tabular-nums; }
.ops-stock-grid span { margin-top: 6px; color: #8291a5; font-size: 10px; line-height: 1.5; }
.ops-actions-row { margin-top: 18px; min-height: 92px; padding: 18px 20px; border: 1px solid #28354a; border-radius: 6px; background: #101927; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.ops-actions-row h3 { margin: 0 0 7px; font-size: 15px; }
.ops-actions-row p { margin: 0; color: #8291a5; font-size: 11px; }
.ops-actions-row > div:last-child { display: flex; gap: 9px; }
.ops-link { padding: 0; border: 0; color: #72afe6; background: transparent; font-size: 11px; font-weight: 750; }
.ops-orders { margin-bottom: 8px; }
.ops-dashboard .table-wrap { background: #101927; }
.ops-dashboard table { color: #d7e1ec; }
.ops-dashboard th { color: #77869a; background: #151f2e; border-color: #253145; }
.ops-dashboard td { border-color: #253145; }
.ops-dashboard tbody tr:hover { background: #151f2e; }
.ops-dashboard .badge.ready,
.ops-dashboard .badge.taken { color: #6ed3aa; background: #173428; }
.ops-dashboard .badge.failed { color: #ef8c8c; background: #3a2025; }
.ops-dashboard .badge.pending,
.ops-dashboard .badge.processing { color: #e4b55b; background: #352c1c; }
.ops-dashboard .icon-btn { color: #d7e1ec; background: #151f2e; border-color: #304057; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 22px; }
.page-heading h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: 0; }
.page-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--blue-soft); color: var(--blue); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-value { margin-top: 18px; font-size: 26px; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.stat-note { margin-top: 5px; color: var(--muted); font-size: 11px; }

.section { margin-top: 22px; }
.section-head { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-head h3 { margin: 0; font-size: 15px; letter-spacing: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.panel-body { padding: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 16px; color: var(--muted); background: var(--surface-muted); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 650; text-align: left; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; }
.numeric { font-variant-numeric: tabular-nums; white-space: nowrap; }
.order-id { display: grid; gap: 5px; }
.order-id span:last-child { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font: 11px "Segoe UI", "Microsoft YaHei", sans-serif; }
.row-actions { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.orders-list { display: grid; }
.order-card {
  min-width: 0;
  padding: 15px 16px;
  display: grid;
  grid-template-columns: minmax(150px, 1.05fr) minmax(160px, 1.25fr) minmax(230px, 1.4fr) minmax(130px, auto);
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.order-card:last-child { border-bottom: 0; }
.order-main, .order-status, .order-facts, .order-card-actions { min-width: 0; }
.order-no { font-weight: 750; overflow-wrap: anywhere; }
.order-sub { margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.order-status .badge {
  max-width: 100%;
  height: auto;
  min-height: 24px;
  padding: 5px 8px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.order-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.order-facts span { min-width: 0; }
.order-facts small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}
.order-facts strong {
  display: block;
  font-size: 13px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.order-card-actions { display: flex; justify-content: flex-end; }
.order-card-actions .row-actions { justify-content: flex-end; }

.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.pending, .badge.processing { color: var(--amber); background: var(--amber-soft); }
.badge.ready, .badge.taken, .badge.active, .badge.claimable { color: var(--green); background: var(--green-soft); }
.badge.failed, .badge.disabled { color: var(--red); background: var(--red-soft); }
.badge.claimed { color: var(--blue); background: var(--blue-soft); }
.badge.unused { color: var(--blue); background: var(--blue-soft); }

.btn { min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: #11673f; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-muted); }
.btn-danger { background: var(--red); color: white; }
.btn-small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.compact-input { width: 92px; min-height: 30px; padding: 0 8px; }
.icon-btn { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-muted); }
.icon-btn svg { width: 17px; height: 17px; }

.field { display: grid; gap: 7px; }
.field label { font-size: 12px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 11px; line-height: 1.5; }
.input-like {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  overflow-wrap: anywhere;
}
.agent-invite-panel { margin: 16px 0; }
.purchase-quote {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}
.purchase-quote div { min-width: 0; }
.purchase-quote small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}
.purchase-quote strong { font-size: 14px; }
.purchase-quote > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 9px 11px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; outline: none; }
.textarea { min-height: 94px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(22 120 75 / 10%); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-stack { display: grid; gap: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.inline-field { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.pool-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.switch-row { min-height: 58px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-muted); display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--green); flex: 0 0 auto; }
.switch-row span { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pool-config-page { color: var(--text); }
.pool-config-form { gap: 24px; }
.pool-config-block { display: grid; gap: 16px; padding-top: 2px; border-top: 1px solid var(--line); }
.pool-config-block:first-child { padding-top: 0; border-top: 0; }
.hub-tabs {
  width: min(460px, 100%);
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-muted);
}
.hub-tabs-single {
  grid-template-columns: 1fr;
}
.hub-tabs label {
  min-height: 40px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.hub-tabs label.active { color: white; background: #5da3e6; }
.hub-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.hub-tabs-single-label {
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: white;
  background: #5da3e6;
  font-size: 13px;
  font-weight: 800;
}
.inline-suffix { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.inline-suffix span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.product-choice label {
  width: min(640px, 100%);
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-muted);
}
.product-choice input { width: 16px; height: 16px; accent-color: var(--green); }
.product-choice span { display: grid; gap: 5px; }
.product-choice small { color: var(--muted); }
.wide-save { width: 100%; }
.pool-group-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.pool-group-choices label {
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 700;
}
.pool-group-choices input { width: 15px; height: 15px; accent-color: var(--green); flex: 0 0 auto; }
.pool-group-choices span { min-width: 0; overflow-wrap: anywhere; }
.pool-group-choices small { color: var(--muted); font-weight: 500; }

.capacity-band { display: grid; gap: 14px; }
.capacity-band .section-head { margin: 0; }
.capacity-meter { width: 100%; height: 14px; overflow: hidden; appearance: none; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); }
.capacity-meter::-webkit-progress-bar { background: var(--surface-muted); }
.capacity-meter::-webkit-progress-value { background: var(--green); transition: width .25s ease; }
.capacity-meter::-moz-progress-bar { background: var(--green); }
.capacity-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.capacity-summary span { min-width: 0; color: var(--muted); font-size: 12px; }
.capacity-summary strong { display: block; margin-top: 5px; color: var(--text); font-size: 15px; }

.product-row { padding: 20px; display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; border-bottom: 1px solid var(--line); }
.product-row:last-child { border-bottom: 0; }
.product-main { display: flex; gap: 14px; align-items: center; }
.product-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 6px; background: var(--green-soft); color: var(--green); flex: 0 0 auto; }
.product-main h3 { margin: 0 0 5px; font-size: 15px; }
.product-main p { margin: 0; color: var(--muted); font-size: 12px; }
.price { font-size: 23px; font-weight: 800; white-space: nowrap; }
.price small { color: var(--muted); font-size: 11px; font-weight: 500; }
.app-shell.ops-home .section-head h3,
.app-shell.ops-home .section-head strong,
.app-shell.ops-home .price { color: #edf3fa; }
.app-shell.ops-home .panel .field-hint,
.app-shell.ops-home .section-head p { color: #9aa9bd; }

.empty { min-height: 180px; padding: 30px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.empty svg { width: 28px; height: 28px; }

.alert { padding: 13px 14px; border-radius: 5px; border: 1px solid; display: flex; align-items: flex-start; gap: 10px; font-size: 12px; line-height: 1.55; }
.alert svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.alert-info { color: #1c567b; background: var(--blue-soft); border-color: #bed8e9; }
.alert-warning { color: #7a520c; background: var(--amber-soft); border-color: #ead39e; }
.alert-danger { color: #8f3030; background: var(--red-soft); border-color: #ecc5c5; }

.code-block { margin: 0; padding: 16px; overflow-x: auto; color: #d6e2dd; background: #18231f; border-radius: 5px; font: 12px/1.65 "Cascadia Code", Consolas, monospace; white-space: pre; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgb(23 32 38 / 55%); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 20px 70px rgb(0 0 0 / 24%); }
.modal-head { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 18px; display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-muted); border-top: 1px solid var(--line); }

#toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 13px 14px; background: #172026; color: white; border-radius: 5px; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-menu { display: none; }

@media (max-width: 980px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: minmax(320px, 440px) 1fr; }
  .flow-board { grid-template-columns: repeat(2, 1fr); }
  .capacity-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-supply-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-supply-strip > div { border-bottom: 1px solid #253145; }
  .ops-stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-stock-grid > div { border-bottom: 1px solid #253145; }
  .order-card { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
  .order-card-actions, .order-card-actions .row-actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .login-layout { display: block; background: var(--surface); }
  .login-panel { min-height: 100vh; border-right: 0; }
  .login-visual { display: none; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .app-shell.menu-open .sidebar { transform: translateX(0); }
  .main { grid-column: auto; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 16px; }
  .topbar h1 { font-size: 16px; }
  .page { padding: 22px 16px 40px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { margin-top: 12px; font-size: 22px; }
  .page-heading { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .pool-switches { grid-template-columns: 1fr; }
  .product-row { grid-template-columns: 1fr; }
  .product-row > .btn { width: 100%; }
  .endpoint { grid-template-columns: 62px 1fr; }
  .endpoint .btn { grid-column: 1 / -1; }
  .balance-pill span { display: none; }
  .ops-dashboard { padding-top: 20px; }
  .ops-hero { min-height: 112px; align-items: flex-start; }
  .ops-hero h2 { font-size: 25px; }
  .ops-consumption-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-consumption-summary div:nth-child(2) { border-right: 0; }
  .ops-consumption-summary div:nth-child(-n+2) { border-bottom: 1px solid #253145; }
  #ops-consumption-chart { height: 210px; }
  .ops-actions-row { align-items: flex-start; flex-direction: column; }
  .ops-actions-row > div:last-child { width: 100%; }
  .ops-actions-row .ops-button { flex: 1; }
  .ops-inventory-controls { width: 100%; flex-wrap: wrap; }
  .ops-inventory-controls .input { flex: 1; min-width: 120px; }
  .order-card { grid-template-columns: 1fr; }
  .order-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-heading { display: block; }
  .page-heading > .btn { width: 100%; margin-top: 14px; }
  .redeem-form { grid-template-columns: 1fr; }
  .redeem-form .btn { width: 100%; }
  td, th { padding-left: 12px; padding-right: 12px; }
  .capacity-summary { grid-template-columns: 1fr; }
  .ops-hero { display: block; }
  .ops-hero-actions { display: block; }
  .ops-hero .ops-button { width: 100%; margin-top: 18px; }
  .ops-stats { grid-template-columns: 1fr; }
  .ops-supply-strip { grid-template-columns: 1fr; }
  .ops-supply-strip > div { border-right: 0; }
  .ops-stock-grid { grid-template-columns: 1fr; }
  .ops-stock-grid > div { border-right: 0; }
  .ops-panel-head { align-items: flex-start; }
  .ops-legend { display: none; }
  .order-facts { grid-template-columns: 1fr; }
  .order-card .btn { width: 100%; }
  .order-card .row-actions { width: 100%; }
}
