:root {
  --ink: #172b4d;
  --muted: #536580;
  --line: #dbe3ef;
  --surface: #ffffff;
  --canvas: #f2f5fa;
  --accent: #245dcc;
  --accent-dark: #1949a6;
  --green: #18704e;
  --amber: #89550e;
  --red: #b33042;
  --radius: 12px;
  --shadow: 0 24px 80px rgb(19 39 71 / 18%);
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

body { line-height: 1.5; }
button, input, select, textarea { accent-color: var(--accent); }
button, a, input, select, textarea, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid #3978e5; outline-offset: 3px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 1px; }
button:disabled { pointer-events: none; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 100; padding: 12px 18px; transform: translateY(-160%); background: white; color: var(--accent-dark); border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }
.app-shell { grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { padding: 28px 14px 18px; background: #172e52; color: #f4f7fd; overflow-y: auto; }
.brand { padding: 0 12px 28px; }
.brand-mark { background: #356edf; border-radius: 12px 12px 12px 4px; }
.brand small { color: #b5c6df; font-size: 12px; letter-spacing: 0; text-transform: none; }
.nav { gap: 5px; }
.nav-item { min-height: 46px; padding: 10px 12px; grid-template-columns: 30px 1fr; color: #c3d1e6; border-radius: 8px; font-size: 14px; transition: background .15s; }
.nav-item span { display: grid; place-items: center; width: 22px; height: 24px; border: 1px solid #647b9b; border-radius: 5px; font-size: 11px; letter-spacing: 0; opacity: 1; }
.nav-item:hover { background: #243f66; color: white; }
.nav-item.is-active { background: #e6efff; color: #173d79; box-shadow: none; font-weight: 700; }
.nav-item.is-active span { border-color: #9bb8e5; }
.sidebar-status { border-color: #3b5274; margin-top: 28px; padding-inline: 12px; }
.sidebar-status small { color: #b5c6df; font-size: 11px; overflow-wrap: anywhere; }
.sidebar-status strong { font-size: 12px; }
.main { padding: 28px clamp(18px, 3vw, 44px) 48px; }
.topbar { align-items: center; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
h1 { font-size: clamp(26px, 2.4vw, 34px); line-height: 1.3; font-weight: 750; }
h2 { font-size: 20px; line-height: 1.4; }
.eyebrow { font-size: 12px; color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 600; }
.top-actions, .button-row, .selection-actions { flex-wrap: wrap; }
.button { min-height: 40px; padding: 9px 14px; font-size: 13px; border-radius: 7px; font-weight: 600; }
.button-secondary:hover, .mini-button:hover { border-color: #91acd4; background: #f0f5ff; }
.button-danger-ghost { border-color: #e7bdc4; background: #fffafb; }
.button-danger:hover { background: #932336; }
.button-danger-ghost:hover { background: #fff0f2; }
.text-button { min-height: 36px; font-size: 13px; }
.view.is-visible { animation: none; }
.metric-grid { border: 0; border-radius: 0; background: transparent; gap: 14px; margin-bottom: 24px; }
.metric, .metric:last-child { border: 1px solid var(--line); border-radius: 10px; padding: 20px; min-height: 140px; background: white; }
.metric small { font-size: 13px; }
.metric strong { font-size: 34px; font-variant-numeric: tabular-nums; }
.metric span { color: var(--muted); font-size: 12px; }
.dashboard-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 24px; }
.panel { border-radius: 12px; }
.panel-dark { background: white; border-color: var(--line); color: var(--ink); }
.flow-list button { border-color: var(--line); color: var(--ink); padding: 18px 0; grid-template-columns: 36px minmax(0, 1fr); }
.flow-list button span { display: grid; place-items: center; align-self: start; height: 32px; border-radius: 8px; background: #edf3ff; color: var(--accent); padding: 0; font-size: 13px; }
.flow-list small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.flow-list button:hover strong { color: var(--accent-dark); }
.activity-item { padding-block: 18px; }
.activity-item time, .activity-item small { font-size: 12px; }
.section-toolbar { align-items: flex-start; }
.table-controls { flex-wrap: wrap; gap: 12px; padding: 18px; }
.search-field { min-width: min(240px, 100%); }
.search-field input, .table-controls select { min-height: 42px; }
.search-field span { font-size: 12px; top: 11px; letter-spacing: 0; text-transform: none; }
.selection-actions { flex-wrap: wrap; }
.selection-actions span { font-size: 12px; }
.bulk-bar { flex-wrap: wrap; background: #f7f9fd; padding-block: 12px; gap: 8px; }
.bulk-bar .button-danger, .bulk-bar .button-danger-ghost { border-style: dashed; }
.table-pager, th { background: #f7f9fd; }
th { font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; }
td { font-size: 13px; padding-block: 17px; }
tbody tr:hover { background: #f3f7ff; }
.primary-cell small, .cell-note { font-size: 11px; line-height: 1.6; }
.mini-button { min-height: 32px; font-size: 12px; border-radius: 6px; }
.badge { font-size: 11px; }
.badge.unsupported, .badge.cancelled { background: #edf0f5; color: #536580; }
.badge.unknown, .badge.not_checked { background: #edf0f5; color: #536580; }
.task-card { border-radius: 10px; grid-template-columns: 22px minmax(120px, .75fr) minmax(180px, 1.4fr) auto; }
.progress-meta { font-size: 12px; gap: 8px; }
.modal { border-radius: 16px; }
.modal::backdrop { background: rgb(14 30 54 / 55%); }
.modal-heading { gap: 16px; }
.modal-heading h2 { overflow-wrap: anywhere; }
.icon-button { flex-shrink: 0; width: 40px; height: 40px; border-radius: 8px; }
.field span, .field select, .field input, .field textarea { font-size: 13px; }
.field input, .field textarea, .field select { color: var(--ink); min-width: 0; }
.field small, .modal-heading small, .notice { font-size: 12px; }
.notice { color: #234776; background: #edf4ff; line-height: 1.7; }
.method-grid input:checked + span { background: #edf3ff; }
.method-grid input:focus-visible + span { outline: 3px solid #3978e5; outline-offset: 2px; }
.drop-zone.dragging { background: #edf3ff; }
.drop-zone input { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone:focus-within { outline: 3px solid #3978e5; outline-offset: 2px; }
.proxy-pool-tabs button.is-active, .probe-tabs button.is-active { background: #245dcc; border-color: #245dcc; }
.definition-list dd, .detail-hero h2 { overflow-wrap: anywhere; }
.login-shell { grid-template-columns: minmax(0, 46%) minmax(0, 54%); }
.login-context { background: #172e52; }
.login-context .brand { padding: 0; }
.login-context .eyebrow { color: #b5c6df; }
.context-copy h1 { font-size: clamp(30px, 3.4vw, 52px); line-height: 1.4; }
.context-copy h1 span { white-space: normal; }
.context-note { color: #b5c6df; line-height: 1.8; max-width: 32em; }
.context-status { border-color: #3b5274; }
.context-status > span { background: #b5c6df; box-shadow: none; }
.context-status small { color: #b5c6df; font-size: 12px; }
.login-card { border: 0; border-radius: 14px; padding: 40px; box-shadow: 0 12px 40px rgb(19 39 71 / 8%); }
.login-card h2 { font-size: 26px; }
.login-card header > p:last-child, .password-toggle, .form-error { font-size: 13px; }
.login-card .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(36 93 204 / 12%); }
.login-button { height: 48px; font-size: 14px; }
.login-panel footer { color: var(--muted); font-size: 12px; text-transform: none; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 192px minmax(0, 1fr); }
  .main { padding-inline: 20px; }
  .topbar { align-items: flex-start; }
  .top-actions { justify-content: flex-end; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-card { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; }
  .task-card > :nth-child(3) { grid-column: 2 / -1; grid-row: 2; }
  .settings-layout, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-context { min-height: 210px; padding: 26px; }
  .context-copy { margin: 26px 0 0; }
  .context-copy h1 { font-size: 30px; }
  .login-panel { min-height: 440px; padding-bottom: 66px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 16px 12px 10px; overflow: visible; }
  .sidebar .brand { display: flex; padding: 0 6px 14px; }
  .sidebar .brand-mark { width: 34px; height: 34px; }
  .nav { display: flex; overflow-x: auto; gap: 6px; padding: 4px 4px 10px; scroll-padding-inline: 4px; }
  .nav-item { display: flex; flex: 0 0 auto; width: auto; min-height: 44px; gap: 8px; white-space: nowrap; overflow: visible; }
  .nav-item span { display: none; }
  .sidebar-status { display: none; }
  .main { padding: 22px 14px 40px; }
  .topbar { flex-direction: column; gap: 16px; padding-bottom: 18px; margin-bottom: 20px; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .sync-state { flex: 1 1 100%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric, .metric:last-child { min-height: 120px; padding: 14px; border: 1px solid var(--line); }
  .metric strong { font-size: 28px; }
  .section-toolbar { flex-direction: column; gap: 12px; }
  .section-toolbar .button-row { width: 100%; }
  .table-controls { padding: 14px; align-items: stretch; }
  .table-controls > .search-field { flex: 1 1 100%; }
  .table-controls > select { flex: 1 1 130px; min-width: 0; }
  .selection-actions { width: 100%; margin-left: 0; }
  .bulk-bar { padding-inline: 14px; }
  .bulk-bar .button { flex: 0 1 auto; }
  .button, .mini-button { min-height: 44px; }
  .table-pager { padding-inline: 14px; }
  .activity-item { grid-template-columns: 10px minmax(0, 1fr); }
  .activity-item time { grid-column: 2; }
  .form-grid, .method-grid, .settings-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-timeline li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions > .button { flex: 1 1 auto; }
  .login-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Operations console redesign — 2026-09-18 */
:root {
  --ink: #0b1728;
  --muted: #536376;
  --line: #d7e0e6;
  --surface: #ffffff;
  --canvas: #f3f6f8;
  --route: #0f6b78;
  --route-soft: #e7f2f3;
  --accent: #2457c5;
  --accent-dark: #183f95;
  --green: #14805e;
  --amber: #b46b12;
  --red: #b83b3b;
  --shadow: 0 18px 45px rgb(11 23 40 / 10%);
  font-family: "Segoe UI Variable Text", "Microsoft YaHei UI", "Segoe UI", sans-serif;
}

body { background: var(--canvas); color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app-shell { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 24px 16px 18px; background: var(--ink); }
.brand { padding: 0 10px 24px; }
.brand-mark { position: relative; overflow: hidden; background: var(--route); border-radius: 9px 9px 9px 2px; }
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-top: 2px solid rgb(255 255 255 / 80%); border-bottom: 2px solid rgb(255 255 255 / 45%); transform: skewY(-18deg); }
.nav { display: grid; gap: 18px; }
.nav-group { display: grid; gap: 4px; }
.nav-group-system { margin-top: auto; }
.nav-group-label { margin: 0 12px 4px; color: #8194ad; font-size: 11px; font-weight: 650; }
.nav-subitems { display: grid; gap: 2px; margin: 0 0 4px 42px; padding-left: 10px; border-left: 1px solid #34475f; }
.nav-item { min-height: 42px; border-radius: 7px; }
.nav-subitem { display: block; width: calc(100% - 4px); min-height: 34px; padding: 7px 10px; color: #98abc2; font-size: 12px; text-align: left; }
.nav-subitem.is-active { color: #d9f3f1; background: rgb(15 107 120 / 35%); box-shadow: inset 2px 0 #60c5c9; }
.nav-advanced { color: #91a2b8; }
.nav-item.is-active { color: #fff; background: var(--route); box-shadow: inset 3px 0 #79d0d2; }
.nav-item.is-active span { border-color: rgb(255 255 255 / 55%); }
.sidebar-status { margin-top: 24px; background: rgb(255 255 255 / 4%); border: 1px solid #34475f; border-radius: 8px; }

.main { padding: 0 clamp(20px, 3vw, 46px) 52px; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 88px; margin: 0 calc(clamp(20px, 3vw, 46px) * -1) 28px; padding: 18px clamp(20px, 3vw, 46px); background: rgb(243 246 248 / 94%); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.command-heading { display: grid; gap: 2px; }
.command-heading p { order: 2; margin: 0; color: var(--muted); font-size: 12px; }
.command-heading h1 { order: 1; font-size: clamp(23px, 2vw, 30px); }
.top-actions { align-items: center; }
.sync-state { color: var(--muted); background: transparent; border: 0; }
.command-primary { background: var(--route); }
.command-primary:hover { background: #0b5964; }

.route-board { display: grid; grid-template-columns: minmax(0, 1fr) 210px; min-height: 220px; overflow: hidden; background: var(--ink); color: #fff; border-radius: 4px 18px 4px 4px; }
.route-board-copy { align-self: center; max-width: 720px; padding: clamp(28px, 5vw, 64px); }
.route-board-copy > p { margin: 0 0 12px; color: #83d3d3; font-weight: 650; }
.route-board-copy h2 { max-width: 19ch; margin: 0 0 16px; font-size: clamp(28px, 4vw, 48px); line-height: 1.18; letter-spacing: -.025em; }
.route-board-copy span { display: block; max-width: 62ch; color: #b8c5d3; line-height: 1.75; }
.route-signal { position: relative; min-height: 220px; background: linear-gradient(145deg, #0f6b78 0 46%, #104958 46% 56%, #12354a 56%); }
.route-signal::before { content: ""; position: absolute; inset: 25% -30% 25% 12%; border: 1px solid rgb(255 255 255 / 35%); border-radius: 50%; transform: rotate(-18deg); }
.route-signal i { position: absolute; width: 12px; height: 12px; background: #9ee3df; border: 3px solid #0b3540; border-radius: 50%; box-shadow: 0 0 0 5px rgb(158 227 223 / 12%); }
.route-signal i:nth-child(1) { left: 22%; top: 68%; }
.route-signal i:nth-child(2) { left: 43%; top: 48%; }
.route-signal i:nth-child(3) { left: 65%; top: 34%; }
.route-signal i:nth-child(4) { left: 79%; top: 18%; background: #fff; }
.workflow-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-top: 0; }
.workflow-map li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; padding: 24px; border-right: 1px solid var(--line); }
.workflow-map li:last-child { border-right: 0; }
.workflow-map li > span, .builder-step-number { display: grid; place-items: center; width: 30px; height: 30px; color: var(--route); background: var(--route-soft); border-radius: 50%; font-weight: 750; }
.workflow-map strong, .workflow-map small { display: block; }
.workflow-map small { margin-top: 6px; color: var(--muted); line-height: 1.55; }
.workspace-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 22px; padding: 20px 24px; background: var(--surface); border-left: 4px solid var(--route); box-shadow: 0 8px 24px rgb(11 23 40 / 6%); }
.workspace-actions strong, .workspace-actions small { display: block; }
.workspace-actions small { margin-top: 4px; color: var(--muted); }
.operations-note { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; margin-top: 18px; padding: 18px 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.operations-note p { margin: 0; color: var(--muted); }

.checkout-region-modal { width: min(1080px, calc(100vw - 28px)); }
.checkout-builder { max-height: min(88vh, 900px); padding: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 96px; }
.checkout-builder > .modal-heading { padding: 24px 28px 18px; border-bottom: 1px solid var(--line); }
.checkout-builder > .modal-heading p { margin: 0 0 4px; color: var(--route); font-size: 13px; font-weight: 700; }
.checkout-builder h2, .checkout-builder h3, .route-board h2 { text-wrap: balance; }
.builder-progress { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 14px 28px; list-style: none; background: #eef3f5; border-bottom: 1px solid var(--line); }
.builder-progress li { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.builder-progress span { display: grid; place-items: center; width: 24px; height: 24px; background: #dbe4e8; border-radius: 50%; }
.builder-progress .is-current { color: var(--route); }
.builder-progress .is-current span { color: #fff; background: var(--route); }
.builder-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 18px; padding: 26px 28px; border-bottom: 1px solid var(--line); }
.builder-step-content > h3 { margin: 2px 0 4px; font-size: 17px; }
.builder-step-content > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.builder-account-summary { display: block; padding: 14px 16px; color: #0b5964; background: var(--route-soft); border-left: 3px solid var(--route); }
.checkout-advanced-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; padding-top: 14px; }
.checkout-review { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 0 0 16px; background: var(--line); border: 1px solid var(--line); }
.checkout-review div { min-width: 0; padding: 14px; background: var(--surface); }
.checkout-review dt { color: var(--muted); font-size: 11px; }
.checkout-review dd { margin: 5px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.checkout-builder > .modal-actions { position: sticky; bottom: 0; padding: 18px 28px; background: rgb(255 255 255 / 96%); border-top: 1px solid var(--line); }

.checkout-stage-rail { display: grid; grid-template-columns: repeat(7, minmax(72px, 1fr)); gap: 0; margin: 16px 0; padding: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; list-style: none; }
.checkout-stage-rail li { position: relative; min-width: 76px; padding: 26px 6px 8px; color: var(--muted); font-size: 11px; text-align: center; border-top: 2px solid #cdd7dd; }
.checkout-stage-rail li::before { content: ""; position: absolute; top: -6px; left: calc(50% - 5px); width: 10px; height: 10px; background: #cdd7dd; border-radius: 50%; }
.checkout-stage-rail li.is-complete { color: var(--green); border-color: var(--green); }
.checkout-stage-rail li.is-complete::before { background: var(--green); }
.checkout-stage-rail li.is-active { color: var(--route); border-color: var(--route); font-weight: 700; }
.checkout-stage-rail li.is-active::before { background: var(--route); box-shadow: 0 0 0 5px rgb(15 107 120 / 13%); }
.checkout-stage-rail li.is-failed { color: var(--red); border-color: var(--red); font-weight: 700; }
.checkout-stage-rail li.is-failed::before { background: var(--red); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 208px minmax(0, 1fr); }
  .route-board { grid-template-columns: minmax(0, 1fr) 140px; }
  .workflow-map { grid-template-columns: 1fr; }
  .workflow-map li { border-right: 0; border-bottom: 1px solid var(--line); }
  .workflow-map li:last-child { border-bottom: 0; }
  .checkout-review { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .nav { display: flex; gap: 6px; }
  .nav-group { display: flex; flex: 0 0 auto; gap: 6px; }
  .nav-group-label, .nav-subitems { display: none; }
  .nav-item { width: auto; }
  .route-board { grid-template-columns: 1fr; }
  .route-board-copy { padding: 28px 22px; }
  .route-signal { min-height: 90px; }
  .workspace-actions { align-items: stretch; flex-direction: column; }
  .workspace-actions .button-row { width: 100%; }
  .workspace-actions .button { flex: 1; }
  .operations-note { grid-template-columns: 1fr; gap: 6px; }
  .builder-progress { padding-inline: 18px; }
  .builder-step { grid-template-columns: 1fr; padding: 22px 18px; }
  .builder-step-number { width: 26px; height: 26px; }
  .checkout-advanced-grid, .checkout-review { grid-template-columns: 1fr; }
  .checkout-review div { border-right: 0; border-bottom: 1px solid var(--line); }
  .checkout-review div:last-child { border-bottom: 0; }
  .checkout-builder > .modal-heading, .checkout-builder > .modal-actions { padding-inline: 18px; }
}
