:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --surface: #fcfaf4;
  --ink: #171c20;
  --muted: #4f5a5c;
  --accent: #294852;
  --accent-hover: #203d46;
  --border: #d8d6cb;
  --control-border: #a6aaa3;
  --nav: #263c46;
  --nav-active: #405763;
  --nav-text: #f5f6f4;
  --error: #862c29;
  --error-bg: #fae9e5;
  --ok: #245744;
  --ok-bg: #e5efe8;
  --radius: 12px;
  --radius-panel: 16px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 100%;
  line-height: 1.55;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a { color: var(--accent); }

h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.8rem, 6vw, 2.45rem); line-height: 1.14; font-weight: 730; letter-spacing: -.035em; }
h2 { font-size: 1.13rem; line-height: 1.32; font-weight: 720; }
p + p { margin-block-start: .6rem; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button, input, select, textarea { color: inherit; }
button[disabled] { cursor: default; }
[id] { scroll-margin-block-start: 1rem; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid #275f78;
  outline-offset: 3px;
}

.shell-header :focus-visible { outline-color: #c9e2ed; }
.skip-link {
  position: absolute;
  z-index: 2;
  inset-block-start: .4rem;
  inset-inline-start: .4rem;
  translate: 0 -200%;
  background: var(--surface);
  padding: .6rem;
}
.skip-link:focus { translate: 0; }

.shell-header { background: var(--nav); color: var(--nav-text); }
.shell-inner {
  max-width: 68rem;
  min-height: 68px;
  padding: .55rem clamp(.85rem, 4vw, 2rem);
  margin-inline: auto;
  display: flex;
  gap: .25rem 1rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  min-height: 44px;
  gap: .55rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  font-weight: 720;
  white-space: nowrap;
  font-size: 1.12rem;
}
.wordmark-latin { font-weight: 650; font-size: .87em; letter-spacing: .075em; }
.wordmark-mark {
  display: grid;
  width: 28px;
  height: 28px;
  grid-template-columns: repeat(3, 3px);
  gap: 2px;
  place-content: center;
  align-items: end;
  border-radius: 8px;
  background: #dce8e6;
  color: #25434c;
}
.wordmark-mark i { background: currentColor; height: 7px; border-radius: 2px; }
.wordmark-mark i:nth-child(2) { height: 10px; }
.wordmark-mark i:nth-child(3) { height: 14px; }
.shell-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem; }
.shell-nav a, .nav-control {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: .35rem .7rem;
  border: 0;
  border-radius: 8px;
  font-size: .91rem;
  text-decoration: none;
  color: inherit;
  background: transparent;
}
.shell-nav a[aria-current="page"] { background: var(--nav-active); font-weight: 650; }
.shell-nav a:hover, .nav-control:hover { background: var(--nav-active); }

.shell-main { max-width: 68rem; margin: 0 auto; padding: clamp(1.4rem, 4.5vw, 3.25rem) clamp(.85rem, 4vw, 2rem) 3rem; }
.shell-narrow { max-width: 34rem; }
.page-heading { display: flex; justify-content: space-between; align-items: start; gap: .85rem; margin-bottom: 1.25rem; }
.page-heading p { margin-block-start: .42rem; overflow-wrap: anywhere; }
.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--surface);
  padding: clamp(.95rem, 3.4vw, 1.45rem);
}
.auth { padding: clamp(1.1rem, 6vw, 2rem); }
.auth h1 + p, .action-card h2 + p { margin-top: .5rem; }
.auth-back { margin-top: .55rem; }
.summary { display: grid; gap: .9rem; }
.card + .card, .summary + .card, .subnav + .card { margin-top: .9rem; }
.summary .card + .card { margin-top: 0; }
.section-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: .3rem .75rem; }
.section-heading h2 + p { margin-top: .25rem; }
.range-switch {
  display: flex;
  padding: .14rem;
  gap: .1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 9px;
  font-size: .77rem;
  white-space: nowrap;
}
.range-switch a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding-inline: .52rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 7px;
}
.range-switch a[aria-current="true"] { background: var(--nav-active); color: var(--accent); font-weight: 690; }
.range-switch a:hover { color: var(--ink); }
.muted { color: var(--muted); }
.metric-detail { color: var(--muted); font-size: .91rem; margin-top: .2rem; }
.pill {
  align-self: center;
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: 999px;
  padding: .15rem .65rem;
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 650;
}
.pill-online { background: var(--ok-bg); color: var(--ok); border-color: #bccfc3; }
.quota-card { background: #eef1e9; }
.quota-number {
  margin: .4rem 0 .15rem;
  font-size: clamp(2.15rem, 7vw, 3rem);
  font-weight: 730;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  line-height: 1.18;
}
.quota-number span { color: var(--muted); font-size: 1.08rem; font-weight: 640; letter-spacing: 0; }
.quota-meter { appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: #d4ded9; accent-color: var(--accent); }
.quota-meter::-webkit-progress-bar { background: #d4ded9; border-radius: inherit; }
.quota-meter::-webkit-progress-value { background: var(--accent); border-radius: inherit; }
.quota-meter::-moz-progress-bar { background: var(--accent); border-radius: inherit; }
.period-details { display: grid; gap: .5rem; margin-top: .7rem; }
.period-details div { display: flex; justify-content: space-between; gap: .3rem .75rem; flex-wrap: wrap; font-size: .93rem; }
.period-details dt { color: var(--muted); }
.period-details dd { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.notice {
  margin-block: .6rem;
  border: 1px solid #d6c49b;
  border-radius: var(--radius);
  background: #f8f0d9;
  color: #624711;
  padding: .55rem .8rem;
  overflow-wrap: anywhere;
}
.shell-main > .notice:first-child { margin-top: 0; }
.notice-error { color: var(--error); background: var(--error-bg); border-color: #e5b8b3; }
.notice-success { color: var(--ok); background: var(--ok-bg); border-color: #b6cbbb; }
.action-feedback { margin-top: .5rem; color: var(--muted); }
.action-feedback:empty { display: none; }
.empty-state { color: var(--muted); margin-block: .8rem .3rem; }

.stack { display: grid; gap: .35rem; }
.field-help { color: var(--muted); font-size: .875rem; }
.auth-form { margin-top: 1.2rem; }
.auth-form label:not(:first-of-type) { margin-top: .55rem; }
.auth-form .button { margin-top: .6rem; }
.invite-code { margin-bottom: .45rem; }
.invite-code .field-help { display: block; margin-top: .35rem; }
label { font-weight: 650; }
input:not([type="hidden"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  padding: .5rem .65rem;
  background: white;
}
textarea { resize: vertical; }
textarea[readonly], input[readonly] { background: var(--surface); }
textarea[translate="no"], input[translate="no"], code {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: .92rem;
}
.button, .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
}
.text-link { text-underline-offset: .2em; overflow-wrap: anywhere; }
.button {
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  padding: .46rem .74rem;
  font-size: .94rem;
  font-weight: 650;
  text-align: center;
}
.button:hover { background: var(--paper); }
.button-primary { background: var(--accent); color: white; border-color: transparent; }
.button-primary:hover { background: var(--accent-hover); }
.button-danger { color: var(--error); border-color: #b16b66; }
.button-danger:hover { background: var(--error-bg); }
.button-small { min-height: 44px; }
.actions, .record-actions, .clipboard-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.actions, .clipboard-row { margin-top: .8rem; }
.clipboard-row input { width: auto; flex: 1 1 17rem; }

.config-source, .add-device { margin-top: .65rem; }
.config-source label { display: block; margin-top: .55rem; }
.device-form, .invite-form { display: grid; gap: .6rem; align-items: end; margin-top: .65rem; }
.record-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.record {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .7rem;
  align-items: start;
  padding: .65rem 0;
  border-top: 1px solid var(--border);
}
.record-body { min-width: 0; flex: 1 1 9rem; align-self: center; overflow-wrap: anywhere; }
.record-body .muted { display: block; font-size: .88rem; }
summary { min-height: 44px; padding-block: .58rem; font-weight: 650; color: var(--accent); }
.confirm-action { max-width: 24rem; }
.confirm-action summary { padding-inline: .3rem; }
.confirm-action p { font-size: .91rem; margin: 0 0 .5rem; color: var(--muted); }

.subnav { display: flex; flex-wrap: wrap; gap: .35rem .75rem; }
.subnav a { display: inline-flex; min-height: 44px; align-items: center; text-underline-offset: .22em; }
.steps { margin: .55rem 0 0; padding-inline-start: 1.35rem; }
.steps li + li { margin-top: .42rem; }
.steps .text-link { display: inline; }
.recover-list { margin-top: .55rem; }
.recover-list > div { padding: .5rem 0; }
.recover-list dt { font-weight: 690; }
.recover-list dd { color: var(--muted); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 46rem) {
  .summary { grid-template-columns: minmax(0, 1fr) minmax(0, .84fr); }
  .device-form { grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr) auto; }
  .invite-form { grid-template-columns: minmax(0, 1fr) auto; }
}
