:root {
  color-scheme: light;
  --background: #f3f5fb;
  --surface: #fff;
  --text: #19203b;
  --muted: #546079;
  --line: #e0e5f0;
  --accent: #353dac;
  --accent-hover: #282f8f;
  --danger: #a12b42;
  --focus: #5b66e1;
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; background: var(--background); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .72; }
a, button, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
h1, h2, h3, p, dl, dd { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
  padding: 0 max(24px, calc((100% - 1130px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  flex-shrink: 0;
  gap: 11px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -.025em;
}

.account { display: flex; min-width: 0; align-items: center; gap: 12px; }
.account-email { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.initial-status { margin: 72px auto 0; padding: 0 20px; text-align: center; color: var(--muted); }
.retry-session { display: block; margin: 14px auto; }

.sign-in {
  display: grid;
  grid-template-columns: 1fr .9fr;
  width: min(1056px, calc(100% - 56px));
  min-height: 484px;
  margin: clamp(44px, 10vh, 116px) auto 60px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 80px -35px #25366c55;
}

.sign-in-intro {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 48px;
  background: radial-gradient(ellipse at 74% 20%, #414eb5 0, transparent 64%), #171d55;
  color: #fff;
}

.sign-in-intro::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background-image: linear-gradient(#cdd5ff13 1px, transparent 1px), linear-gradient(90deg, #cdd5ff13 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(#000, transparent 78%);
}

.orbit {
  position: absolute;
  z-index: -1;
  top: 25px;
  right: -62px;
  display: grid;
  width: 430px;
  height: 218px;
  transform: rotate(-26deg);
}

.orbit span {
  position: absolute;
  inset: 0;
  border: 1px solid #cbd5ff77;
  border-radius: 50%;
}

.orbit span:nth-child(2) { inset: 20px 18px; border-color: #cbd5ff4f; }
.orbit span:nth-child(3) { inset: 39px 42px; border-color: #cbd5ff36; }
.orbit span:first-child::after {
  position: absolute;
  top: 16%;
  left: 14%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b7c5ff;
  box-shadow: 0 0 26px 6px #9baeff72;
  content: "";
}

.intro-copy { max-width: 390px; }
.intro-copy h1 { font-size: clamp(32px, 4vw, 51px); line-height: 1.2; letter-spacing: -.035em; }
.intro-copy p { max-width: 310px; margin-top: 18px; color: #d7defe; }
.sign-in-panel { align-self: center; padding: clamp(36px, 5vw, 68px); }
.sign-in-panel h2 { font-size: clamp(23px, 3vw, 30px); letter-spacing: -.035em; }
.sign-in-help { margin-top: 6px; color: var(--muted); }
.sign-in-panel form { display: grid; gap: 10px; margin-top: 25px; }
.sign-in-panel label { font-size: 14px; font-weight: 650; }
.sign-in-panel label:not(:first-child) { margin-top: 8px; }
.sign-in-panel input {
  width: 100%;
  min-height: 45px;
  padding: 8px 12px;
  border: 1px solid #c9d2e4;
  border-radius: 8px;
  background: #fbfcff;
  color: var(--text);
}

.sign-in-panel input:focus-visible { outline-offset: 1px; }
.sign-in-panel .button-primary { margin-top: 10px; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.button-primary { background: var(--accent); color: #fff; }
.button-primary:not(:disabled):hover { background: var(--accent-hover); }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
.button-text { background: transparent; color: var(--accent); }
.button-secondary:not(:disabled):hover, .button-text:not(:disabled):hover { background: #edf0fb; }
.feedback { font-size: 14px; }
.feedback-error { color: var(--danger); overflow-wrap: anywhere; }

.dashboard { width: min(1130px, calc(100% - 56px)); margin: 44px auto 70px; }
.dashboard h1 { margin-bottom: 24px; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.045em; }
.dashboard h2 { font-size: 22px; letter-spacing: -.02em; }
.dashboard h3 { font-size: 16px; }
.dashboard p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.dashboard .feedback-error { color: var(--danger); }
.dashboard > .feedback { margin: 0 0 16px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }

.workspace-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding: 23px 26px;
  background: linear-gradient(102deg, #eef0ff, var(--surface) 72%);
}

.workspace-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid #d9dffb;
  border-radius: 13px;
  background: #fff;
  color: var(--accent);
}

.workspace-icon span { width: 22px; height: 16px; border: 2px solid currentColor; border-radius: 4px; }
.workspace-icon span::before { display: block; height: 4px; border-bottom: 1px solid currentColor; content: ""; }
.workspace-copy .workspace-status { margin-top: 7px; color: var(--accent); font-weight: 620; }
.devices-panel, .usage-panel { padding: 24px 26px; }
.devices-panel { margin-bottom: 24px; }
.devices-panel .device-feedback { margin-top: 13px; }
.device-pairing { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #f8f9fe; }
.device-download { display: inline-block; margin: 10px 0; color: var(--accent); font-size: 14px; font-weight: 650; }
.device-pairing textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 13px/1.5 ui-monospace, monospace;
}
.device-command-actions, .device-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.device-command-actions { margin-top: 10px; }
.device-list { margin: 15px 0 0; padding: 0; list-style: none; }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.device-row:last-child { padding-bottom: 0; }
.device-identity { min-width: 0; }
.device-name { display: block; overflow-wrap: anywhere; }
.device-state { color: var(--muted); font-size: 13px; }
.device-state-online { color: #246447; }
.device-actions { flex-shrink: 0; }
.device-actions .button { padding-inline: 12px; }
.ssh-host-form { display: grid; gap: 13px; }
.ssh-host-field { min-width: 0; }
.ssh-host-address { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 115px); gap: 12px; }
.ssh-host-field input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}
.ssh-host-field p, #ssh-public-key-help { margin: 2px 0 5px; font-size: 13px; }
.ssh-host-field label, #ssh-public-key-panel label { font-size: 14px; font-weight: 650; }
.ssh-host-field:first-child p { margin-bottom: 0; }
.ssh-host-form .button { min-height: 36px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.usage-actions { display: flex; gap: 8px; }
.usage-actions select {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 23px 0 26px; }
.metrics > div { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #f8f9fe; }
.metrics dt { color: var(--muted); font-size: 13px; }
.metrics dd { margin-top: 4px; font-size: clamp(18px, 2.5vw, 27px); font-weight: 690; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usage-detail h3 { margin-bottom: 8px; }
.usage-detail .feedback { padding: 9px 0; }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 570px; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 650; }
td { overflow-wrap: anywhere; }
th:nth-child(n+3), td:nth-child(n+3) { text-align: right; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.pagination span { color: var(--muted); font-size: 13px; }

@media (max-width: 740px) {
  .topbar { height: 62px; padding-inline: 18px; }
  .sign-in { grid-template-columns: 1fr; width: calc(100% - 34px); margin: 24px auto 34px; border-radius: 16px; }
  .sign-in-intro { min-height: 178px; padding: 28px; }
  .intro-copy h1 { font-size: 32px; }
  .intro-copy p { margin-top: 11px; font-size: 14px; }
  .orbit { right: -125px; top: -45px; }
  .sign-in-panel { padding: 29px; }
  .dashboard { width: calc(100% - 34px); margin-top: 24px; }
  .workspace-panel, .devices-panel, .usage-panel { padding: 17px; }
  .workspace-panel { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  .workspace-panel .launch-button { grid-column: 1 / -1; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .device-row { flex-direction: column; align-items: flex-start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 360px) {
  .brand { gap: 7px; }
  .topbar { padding-inline: 12px; }
  .account { gap: 4px; }
  .account .button { padding-inline: 8px; }
  .sign-in-panel, .sign-in-intro { padding-inline: 20px; }
}

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 0; gap: 12px; }
.language-picker {
  min-height: 36px;
  max-width: 10rem;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

@media (max-width: 600px) {
  .topbar-actions { gap: 5px; }
  .topbar-actions .account { flex-direction: column; align-items: flex-end; gap: 0; }
  .topbar-actions .account-email { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar-actions .account .button { min-height: 28px; padding-block: 2px; }
}
