:root {
  --bg: #080b11;
  --panel: rgba(19, 24, 34, 0.86);
  --panel-strong: #151b26;
  --line: rgba(255, 255, 255, 0.08);
  --line-bright: rgba(116, 255, 185, 0.3);
  --text: #f5f8fb;
  --muted: #8e99aa;
  --green: #74ffb9;
  --green-strong: #3cdb8e;
  --cyan: #72d9ff;
  --amber: #ffc970;
  --red: #ff7388;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(42, 96, 78, 0.18), transparent 28%),
    radial-gradient(circle at 92% 16%, rgba(26, 82, 111, 0.16), transparent 25%),
    linear-gradient(145deg, #080b11 0%, #0b0f16 52%, #090d13 100%);
  overflow-x: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .09;
  pointer-events: none;
}

.ambient-one { top: -18rem; left: -12rem; background: var(--green); }
.ambient-two { right: -15rem; bottom: -20rem; background: var(--cyan); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(520px, 100%);
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(25, 32, 43, .94), rgba(13, 18, 26, .94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-mark {
  width: 58px;
  height: 58px;
  padding: 12px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  border: 1px solid rgba(116, 255, 185, .25);
  border-radius: 16px;
  background: rgba(116, 255, 185, .06);
}

.brand-mark span { flex: 1; border-radius: 4px 4px 2px 2px; background: var(--green); box-shadow: 0 0 16px rgba(116, 255, 185, .35); }
.brand-mark span:nth-child(1) { height: 46%; opacity: .65; }
.brand-mark span:nth-child(2) { height: 82%; }
.brand-mark span:nth-child(3) { height: 62%; opacity: .8; }
.brand-mark.compact { width: 42px; height: 42px; padding: 9px; border-radius: 12px; }

.eyebrow {
  margin: 18px 0 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .18em;
}

h1, h2, p { margin-top: 0; }
.login-card h1 { margin-bottom: 12px; font-size: clamp(32px, 6vw, 48px); letter-spacing: -.045em; }
.login-copy { max-width: 410px; margin-bottom: 30px; color: var(--muted); line-height: 1.7; }
label { display: block; margin-bottom: 8px; color: #cbd3de; font-size: 13px; font-weight: 650; }

.input-action { display: flex; gap: 10px; }
input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: rgba(4, 7, 11, .55);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus { border-color: rgba(116, 255, 185, .6); box-shadow: 0 0 0 3px rgba(116, 255, 185, .08); background: rgba(5, 9, 13, .8); }
input::placeholder { color: #596474; }

.button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 720;
  white-space: nowrap;
  transition: transform .18s, opacity .18s, border-color .18s, background .18s;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #05110b; background: var(--green); box-shadow: 0 8px 30px rgba(116, 255, 185, .14); }
.button.primary:hover { background: #90ffca; }
.button.secondary { color: var(--text); border-color: var(--line); background: rgba(255, 255, 255, .05); }
.button.secondary:hover, .button.ghost:hover { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); }
.button.ghost { color: var(--muted); border-color: var(--line); background: transparent; }

.login-hint, .field small { margin: 13px 0 0; color: #697587; font-size: 12px; line-height: 1.5; }
code { color: #b7c2d0; }
.form-error { min-height: 20px; margin: 14px 0 0; color: var(--red); font-size: 13px; }

.app-shell { width: min(1540px, 100%); margin: 0 auto; padding: 0 28px 40px; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .eyebrow { margin: 0 0 3px; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 10px; }

.status-pill { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 12px; font-weight: 700; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #6f7988; }
.status-pill.ready i { background: var(--green); box-shadow: 0 0 12px rgba(116,255,185,.7); }
.status-pill.syncing i { background: var(--cyan); box-shadow: 0 0 12px rgba(114,217,255,.7); animation: pulse 1.2s infinite; }
.status-pill.warning i { background: var(--amber); }
.status-pill.error i { background: var(--red); }

.page-grid { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
.panel, .metric-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 12px 40px rgba(0,0,0,.14); backdrop-filter: blur(16px); }

.hero { grid-column: 1 / -1; min-height: 248px; padding: 38px 44px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; position: relative; background: linear-gradient(118deg, rgba(18,27,32,.96), rgba(17,24,34,.88)); }
.hero::before { content: ""; position: absolute; width: 460px; height: 460px; right: -80px; top: -190px; border: 1px solid rgba(116,255,185,.1); border-radius: 50%; }
.hero-copy { max-width: 700px; position: relative; z-index: 1; }
.hero-copy .eyebrow { margin-top: 0; }
.hero h2 { margin-bottom: 12px; font-size: clamp(30px, 4vw, 50px); letter-spacing: -.05em; }
.hero p:last-child { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.hero-orbit { width: 164px; height: 164px; flex: 0 0 164px; display: grid; place-items: center; position: relative; margin-right: 45px; }
.orbit-ring { position: absolute; inset: 0; border: 1px solid rgba(116,255,185,.24); border-radius: 50%; box-shadow: inset 0 0 50px rgba(116,255,185,.04); }
.orbit-ring::before, .orbit-ring::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(114,217,255,.13); }
.orbit-ring::before { inset: 16px; }
.orbit-ring::after { inset: 34px; }
.orbit-core { width: 82px; height: 82px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: rgba(116,255,185,.08); box-shadow: 0 0 55px rgba(116,255,185,.12); }
.orbit-core span { color: var(--green); font-size: 25px; font-weight: 800; line-height: 1; }
.orbit-core small { margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }

.metrics { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card { min-height: 130px; padding: 23px; display: flex; flex-direction: column; justify-content: center; }
.metric-label { margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 27px; letter-spacing: -.04em; }
.metric-card strong.metric-time { font-size: 18px; letter-spacing: -.02em; }
.metric-card small { margin-top: 8px; color: #667184; font-size: 11px; }

.progress-panel { grid-column: 1; padding: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading .eyebrow { margin: 0 0 5px; }
.section-heading h2, .domain-panel h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.progress-number { color: var(--green); font-size: 27px; font-weight: 800; }
.progress-track { height: 8px; margin: 24px 0; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.055); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-strong), var(--green), var(--cyan)); box-shadow: 0 0 20px rgba(116,255,185,.2); transition: width .4s ease; }
.progress-detail { display: grid; grid-template-columns: minmax(0, 1.8fr) 1fr 1fr; gap: 18px; }
.progress-detail div { min-width: 0; }
.progress-detail span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.progress-detail strong { display: block; overflow: hidden; color: #dce3eb; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.error-banner { margin-top: 18px; padding: 12px 14px; border: 1px solid rgba(255,115,136,.22); border-radius: 10px; color: #ff9cab; background: rgba(255,115,136,.07); font-size: 12px; line-height: 1.5; }

.config-panel { grid-column: 1; padding: 28px; }
.notice { margin: 22px 0 0; padding: 13px 15px; display: flex; gap: 9px; border: 1px solid rgba(255,201,112,.2); border-radius: 11px; color: #dfc28f; background: rgba(255,201,112,.06); font-size: 12px; }
.notice strong { color: var(--amber); }
.config-form { margin-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { min-width: 0; }
.span-2 { grid-column: 1 / -1; }
.field small { display: block; margin-top: 7px; }
.type-field { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.type-field legend { width: 100%; margin-bottom: 8px; color: #cbd3de; font-size: 13px; font-weight: 650; }
.check-card { margin: 0; padding: 13px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.02); cursor: pointer; }
.check-card:has(input:checked) { border-color: rgba(116,255,185,.26); background: rgba(116,255,185,.05); }
.check-card input { width: 16px; min-height: 16px; accent-color: var(--green); }
.check-card span { display: flex; flex-direction: column; gap: 2px; }
.check-card strong { font-size: 12px; }
.check-card small { color: var(--muted); font-size: 10px; font-weight: 400; }
.switch-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.switch-row { margin: 0; padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row > span { display: flex; flex-direction: column; gap: 3px; }
.switch-row strong { font-size: 12px; }
.switch-row small { color: var(--muted); font-size: 10px; font-weight: 400; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { width: 38px; height: 21px; padding: 3px; flex: 0 0 auto; border-radius: 999px; background: #303947; transition: background .2s; }
.switch-row i::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; transition: transform .2s; }
.switch-row input:checked + i { background: var(--green-strong); }
.switch-row input:checked + i::after { transform: translateX(17px); }
.form-actions { min-height: 45px; display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.form-message { flex: 1; margin: 0; color: var(--green); font-size: 12px; }
.form-message.error { color: var(--red); }

.side-column { grid-column: 2; grid-row: 4 / span 2; display: flex; flex-direction: column; gap: 18px; }
.domain-panel, .activity-panel { padding: 24px; }
.domain-panel .eyebrow { margin-top: 0; }
.domain-state { margin-top: 20px; padding: 13px; overflow-wrap: anywhere; border: 1px solid rgba(116,255,185,.16); border-radius: 10px; color: var(--green); background: rgba(116,255,185,.04); font-size: 12px; }
.domain-state.empty { border-color: var(--line); color: var(--muted); background: rgba(255,255,255,.02); }
.manifest-link { margin-top: 12px; display: inline-block; color: var(--cyan); font-size: 12px; text-decoration: none; }
.manifest-link:hover { text-decoration: underline; }
.manifest-link.second-link { margin-left: 12px; }
.compact-notice { display: block; line-height: 1.55; }
.mini-steps { margin: 22px 0 0; padding: 0; display: grid; gap: 12px; list-style: none; }
.mini-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.mini-steps span { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: #b5bfcd; font-size: 10px; }
.activity-panel { min-height: 360px; flex: 1; display: flex; flex-direction: column; }
.compact-heading { margin-bottom: 17px; }
.text-button { padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.text-button:hover { color: var(--text); }
.log-list { min-height: 0; max-height: 520px; overflow: auto; display: flex; flex-direction: column-reverse; gap: 1px; scrollbar-width: thin; scrollbar-color: #313a47 transparent; }
.log-item { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.045); }
.log-item time { display: block; margin-bottom: 4px; color: #596474; font-size: 9px; }
.log-item p { margin: 0; color: #aeb8c6; font-family: "Cascadia Code", Consolas, monospace; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.log-item.error p { color: #ff97a7; }
.empty-state { margin: auto; color: #596474; font-size: 12px; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 48px)); padding: 13px 17px; transform: translateY(20px); opacity: 0; pointer-events: none; border: 1px solid rgba(116,255,185,.2); border-radius: 11px; color: #dffced; background: #17241f; box-shadow: var(--shadow); font-size: 12px; transition: opacity .2s, transform .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255,115,136,.25); color: #ffd9df; background: #2a181e; }

@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

@media (max-width: 1050px) {
  .page-grid { grid-template-columns: 1fr; }
  .progress-panel, .config-panel, .side-column { grid-column: 1; }
  .side-column { grid-row: auto; display: grid; grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .app-shell { padding: 0 16px 28px; }
  .topbar { padding: 14px 0; align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; flex-wrap: wrap; }
  .status-pill { margin-right: auto; }
  .hero { min-height: 280px; padding: 28px; }
  .hero-orbit { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 112px; padding: 18px; }
  .metric-card strong { font-size: 22px; }
  .progress-detail { grid-template-columns: 1fr 1fr; }
  .progress-detail > div:first-child { grid-column: 1 / -1; }
  .config-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: 1; }
  .type-field { grid-template-columns: 1fr; }
  .side-column { display: flex; }
  .login-card { padding: 30px 24px; }
  .input-action { flex-direction: column; }
}

@media (max-width: 450px) {
  .metrics { grid-template-columns: 1fr; }
  .top-actions .button { flex: 1; }
  .status-pill { width: 100%; }
  .hero h2 { font-size: 31px; }
}
