:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: rgba(15, 30, 49, 0.88);
  --panel-strong: #10243a;
  --line: rgba(151, 181, 205, 0.18);
  --text: #edf7ff;
  --muted: #94a9bb;
  --cyan: #46d7e8;
  --green: #4de3a1;
  --amber: #ffc86a;
  --red: #ff7f8f;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 191, 211, 0.18), transparent 32rem),
    radial-gradient(circle at 92% 18%, rgba(77, 227, 161, 0.11), transparent 28rem),
    linear-gradient(145deg, #050b14, var(--bg) 48%, #091a2a);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
}

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 80px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.eyebrow, .step-label { margin: 0 0 9px; color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 60px); letter-spacing: -.045em; line-height: 1; }
.lead { max-width: 720px; margin: 16px 0 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.security-chip { display: flex; align-items: center; gap: 10px; white-space: nowrap; padding: 11px 15px; border: 1px solid rgba(77,227,161,.25); border-radius: 999px; color: #bdf9de; background: rgba(77,227,161,.07); font-size: 13px; }
.security-chip span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); }

.card { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.auth-card { max-width: 520px; margin: 70px auto 0; padding: 34px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .72fr); gap: 22px; align-items: start; }
.login-card, .policy-card, .pool-card { padding: 30px; }
.pool-card { margin-top: 22px; }
.card-heading { margin-bottom: 26px; }
.card-heading h2 { margin: 0; font-size: 24px; }
.card-heading p:not(.step-label) { margin: 9px 0 0; color: var(--muted); line-height: 1.55; }
.row-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }

form { display: grid; gap: 18px; }
label { display: grid; gap: 9px; color: #cfe0ec; font-size: 14px; font-weight: 700; }
input {
  width: 100%;
  border: 1px solid rgba(151,181,205,.25);
  border-radius: 13px;
  outline: none;
  padding: 14px 15px;
  color: var(--text);
  background: rgba(4, 13, 24, .74);
  font: inherit;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(70,215,232,.11); }
button { border: 0; border-radius: 13px; padding: 13px 17px; font: inherit; font-weight: 800; cursor: pointer; transform: translateZ(0); transition: transform .18s cubic-bezier(.2,.9,.25,1.45), opacity .16s, background .16s, box-shadow .16s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(2px) scale(.955); }
button:focus-visible { outline: 3px solid rgba(70,215,232,.32); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .55; transform: none; }
.primary { color: #042027; background: linear-gradient(135deg, var(--cyan), #77f2cf); }
.ghost { color: #d8e8f2; background: rgba(151,181,205,.11); border: 1px solid var(--line); }
.small { padding: 9px 13px; font-size: 13px; }
.button-row { display: flex; gap: 10px; }
.button-row .primary { flex: 1; }
.field-help { margin: -8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 28px; }
.step { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; color: #708799; background: rgba(4,13,24,.5); font-size: 12px; font-weight: 800; }
.step b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: rgba(151,181,205,.12); }
.step.active { color: #d7fbff; background: rgba(70,215,232,.1); }
.step.active b { color: #032029; background: var(--cyan); }
.step.done { color: #bff6dc; }
.step.done b { color: #05251a; background: var(--green); }

.policy-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.policy-card li { position: relative; padding-left: 22px; color: #bdd0de; line-height: 1.55; }
.policy-card li::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(77,227,161,.45); }
code { color: var(--cyan); }
.privacy-note { display: grid; gap: 5px; margin-top: 26px; padding: 17px; border: 1px solid rgba(255,200,106,.2); border-radius: 14px; background: rgba(255,200,106,.06); }
.privacy-note strong { color: var(--amber); }
.privacy-note span { color: var(--muted); font-size: 13px; }

.notice { margin: 0 0 20px; padding: 14px 17px; border: 1px solid rgba(70,215,232,.28); border-radius: 14px; color: #d9fbff; background: rgba(70,215,232,.09); }
.notice.error { color: #ffe0e4; border-color: rgba(255,127,143,.3); background: rgba(255,127,143,.09); }
.notice.success { color: #d7ffed; border-color: rgba(77,227,161,.3); background: rgba(77,227,161,.09); }
.hidden { display: none !important; }

.complete-panel { text-align: center; padding: 14px 0 4px; }
.success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 50%; color: #04251a; background: var(--green); font-size: 30px; font-weight: 900; box-shadow: 0 0 32px rgba(77,227,161,.28); }
.complete-panel h3 { margin: 0 0 18px; font-size: 21px; }
.details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; text-align: left; }
.detail { padding: 13px; border-radius: 12px; background: rgba(4,13,24,.55); }
.detail small { display: block; color: var(--muted); margin-bottom: 5px; }
.detail strong { overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #7890a3; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
td { color: #c6d8e5; font-size: 13px; }
.status { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.status-ready { color: #bff7dd; background: rgba(77,227,161,.12); }
.status-warming { color: #ffe2a9; background: rgba(255,200,106,.12); }
.status-restricted, .status-unavailable { color: #ffc2ca; background: rgba(255,127,143,.12); }
.status-review_required, .status-unchecked { color: #cfe2ef; background: rgba(151,181,205,.12); }
.empty { margin: 24px 0 4px; color: var(--muted); text-align: center; }

.console-nav { position: sticky; top: 10px; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; padding: 10px; background: rgba(10,24,40,.93); }
.view-tabs { display: flex; gap: 6px; min-width: 0; }
.view-tab { position: relative; color: var(--muted); background: transparent; }
.view-tab.active { color: #eaffff; background: rgba(70,215,232,.13); box-shadow: inset 0 0 0 1px rgba(70,215,232,.18); }
.alert-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; vertical-align: 1px; background: var(--red); box-shadow: 0 0 12px rgba(255,127,143,.85); }
.console-view { animation: view-in .24s ease-out both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.monitor-overview, .monitor-card { padding: 28px; }
.monitor-card { margin-top: 22px; }
.monitor-actions, .log-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.updated-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.health-banner { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(151,181,205,.06); }
.health-banner strong { display: block; margin-bottom: 5px; }
.health-banner p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.health-indicator { flex: 0 0 auto; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 14px rgba(151,181,205,.5); }
.health-healthy { border-color: rgba(77,227,161,.25); background: rgba(77,227,161,.07); }
.health-healthy .health-indicator { background: var(--green); box-shadow: 0 0 14px rgba(77,227,161,.8); }
.health-warning { border-color: rgba(255,200,106,.28); background: rgba(255,200,106,.07); }
.health-warning .health-indicator { background: var(--amber); box-shadow: 0 0 14px rgba(255,200,106,.75); }
.health-error { border-color: rgba(255,127,143,.3); background: rgba(255,127,143,.08); }
.health-error .health-indicator { background: var(--red); box-shadow: 0 0 14px rgba(255,127,143,.8); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(4,13,24,.5); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { margin-bottom: 9px; font-size: 12px; font-weight: 750; }
.metric-card strong { display: block; overflow-wrap: anywhere; color: #f3fbff; font-size: 22px; }
.metric-card small { margin-top: 7px; overflow-wrap: anywhere; font-size: 11px; line-height: 1.45; }
.health-notices { display: grid; gap: 8px; margin-top: 14px; }
.health-notice { padding: 11px 13px; border-radius: 12px; color: #c7d9e5; background: rgba(151,181,205,.07); font-size: 13px; line-height: 1.55; }
.health-notice.warning { color: #ffe4b2; background: rgba(255,200,106,.09); }
.health-notice.error { color: #ffd6dc; background: rgba(255,127,143,.1); }
.health-notice.healthy { color: #cff9e6; background: rgba(77,227,161,.08); }

.summary-chip { align-self: flex-start; flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; color: #cfe0ec; background: rgba(151,181,205,.1); font-size: 12px; font-weight: 800; }
.task-list { display: grid; gap: 12px; }
.task-item { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(4,13,24,.48); }
.task-top, .task-meta, .task-counts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.task-top { justify-content: space-between; }
.task-title { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 16px; }
.task-meta { margin-top: 7px; color: var(--muted); font-size: 11px; }
.task-meta span:not(:last-child)::after { content: "·"; margin-left: 10px; color: #526a7d; }
.task-progress-track { height: 9px; margin: 16px 0 11px; overflow: hidden; border-radius: 999px; background: rgba(151,181,205,.12); }
.task-progress-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--green)); transition: width .35s ease; }
.task-counts { justify-content: space-between; color: #bed1de; font-size: 12px; }
.task-counts .bad, .task-error { color: #ffadb8; }
.task-error { margin: 11px 0 0; padding: 9px 11px; border-radius: 10px; background: rgba(255,127,143,.08); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.task-status { display: inline-flex; flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.task-status.running, .task-status.queued { color: #c5faff; background: rgba(70,215,232,.12); }
.task-status.completed { color: #bff7dd; background: rgba(77,227,161,.12); }
.task-status.paused { color: #ffe2a9; background: rgba(255,200,106,.12); }
.task-status.failed, .task-status.cancelled { color: #ffc2ca; background: rgba(255,127,143,.12); }

.monitor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.sender-monitor-list, .error-list { display: grid; gap: 10px; }
.sender-item, .error-item { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(4,13,24,.48); }
.sender-top, .error-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sender-name, .error-type { min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 800; }
.sender-file, .sender-reason, .error-message, .error-time { color: var(--muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.sender-file { margin-top: 5px; }
.sender-reason, .error-message { margin: 9px 0 0; }
.error-item { border-left: 3px solid var(--red); }
.error-source { flex: 0 0 auto; color: #ffb5be; font-size: 11px; }
.error-time { display: block; margin-top: 8px; }

.live-log { height: min(52vh, 480px); overflow: auto; padding: 14px; border: 1px solid rgba(151,181,205,.17); border-radius: 15px; color: #b9cad5; background: #030810; font: 12px/1.65 Consolas, "SFMono-Regular", monospace; overscroll-behavior: contain; }
.log-line { margin: 0; padding: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid rgba(151,181,205,.035); }
.log-line.warn { color: #ffd78d; }
.log-line.error { color: #ff9eaa; }
.log-line.debug { color: #7890a3; }
.log-placeholder { margin: 0; color: #65798a; }

@media (max-width: 820px) {
  .shell { width: min(100% - 22px, 680px); padding-top: 30px; }
  .hero { display: block; }
  .security-chip { width: fit-content; margin-top: 20px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .metric-grid, .monitor-split { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .login-card, .policy-card, .pool-card, .auth-card, .monitor-overview, .monitor-card { padding: 22px; }
  .monitor-split { gap: 0; }
  .metric-card { display: grid; grid-template-columns: minmax(0,1fr) auto; column-gap: 12px; align-items: center; }
  .metric-card span { margin-bottom: 0; }
  .metric-card strong { grid-row: span 2; grid-column: 2; text-align: right; }
  .metric-card small { grid-column: 1; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 16px, 680px); padding-top: 20px; padding-bottom: 40px; }
  h1 { font-size: 38px; }
  .row-heading { display: block; }
  .row-heading > button { margin-top: 14px; }
  .button-row { flex-direction: column; }
  .details { grid-template-columns: 1fr; }
  .console-nav { align-items: stretch; padding: 8px; }
  .view-tabs { flex: 1; }
  .view-tab { flex: 1; padding-inline: 10px; }
  .console-nav > .ghost { align-self: center; }
  .monitor-actions, .log-actions { justify-content: flex-start; margin-top: 14px; }
  .monitor-heading .monitor-actions { align-items: stretch; }
  .updated-time { width: 100%; }
  .task-counts { align-items: flex-start; flex-direction: column; gap: 5px; }
  .live-log { height: 56vh; padding: 11px; font-size: 11px; }
}

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