:root {
  color-scheme: light;
  --canvas: oklch(0.975 0.004 255);
  --surface: oklch(1 0 0);
  --surface-subtle: oklch(0.955 0.009 255);
  --ink: oklch(0.20 0.035 255);
  --muted: oklch(0.45 0.025 255);
  --line: oklch(0.88 0.012 255);
  --navy: oklch(0.27 0.065 255);
  --brand: oklch(0.74 0.19 54);
  --brand-dark: oklch(0.58 0.18 48);
  --success: oklch(0.49 0.115 155);
  --success-soft: oklch(0.94 0.035 155);
  --warning: oklch(0.55 0.13 75);
  --warning-soft: oklch(0.95 0.04 78);
  --danger: oklch(0.50 0.16 25);
  --danger-soft: oklch(0.95 0.035 25);
  --info-soft: oklch(0.94 0.025 255);
  --shadow: 0 18px 50px oklch(0.20 0.035 255 / 0.08);
  --radius: 20px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; left: 16px; top: -80px; z-index: 20;
  background: var(--ink); color: white; padding: 12px 16px; border-radius: 10px;
}
.skip-link:focus { top: 16px; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }

.login-shell {
  min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(24px, 5vw, 64px); background: var(--navy); color: white;
  position: relative; overflow: hidden;
}
.login-shell::after {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -220px; bottom: -260px; border: 100px solid oklch(0.74 0.19 54 / 0.16);
  pointer-events: none;
}
.login-brand, .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.login-brand { font-size: 1.2rem; font-weight: 750; }
.login-brand img, .brand img { border-radius: 12px; box-shadow: 0 8px 22px oklch(0 0 0 / 0.18); }
.login-panel {
  align-self: center; width: min(100%, 470px); position: relative; z-index: 1;
  padding: clamp(28px, 4vw, 48px); border-radius: 28px; background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 80px oklch(0 0 0 / 0.24);
}
.product-name { margin: 0 0 22px; color: var(--brand-dark); font-weight: 750; }
.login-panel h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.login-copy { margin: 18px 0 30px; color: var(--muted); max-width: 40ch; line-height: 1.55; }
form { display: grid; gap: 9px; }
label { font-size: .9rem; font-weight: 700; margin-top: 8px; }
input {
  width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 13px;
  padding: 0 15px; background: var(--surface); color: var(--ink);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
input:hover { border-color: var(--muted); }
input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px oklch(0.74 0.19 54 / .12); outline: none; }
.form-error { min-height: 21px; margin: 2px 0 0; color: var(--danger); font-size: .9rem; }
.login-footnote { align-self: end; margin: 24px 0 0; color: oklch(0.84 0.015 255); font-size: .85rem; }

.primary-button, .secondary-button, .quiet-button, .sync-state, .section-nav button {
  border: 0; min-height: 44px; border-radius: 12px; cursor: pointer; font-weight: 700;
  transition: transform 160ms var(--ease), background 180ms var(--ease), color 180ms var(--ease), border-color 180ms var(--ease);
}
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; text-decoration: none; }
.primary-button { background: var(--brand); color: white; box-shadow: 0 8px 20px oklch(0.58 0.18 48 / .22); }
.primary-button:hover { background: var(--brand-dark); transform: translateY(-1px); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .58; cursor: wait; transform: none; }
.secondary-button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.secondary-button:hover { border-color: var(--navy); }
.quiet-button { background: transparent; padding: 0 12px; color: var(--muted); }
.quiet-button:hover { background: var(--surface-subtle); color: var(--ink); }

.app-shell { min-height: 100vh; }
.topbar {
  min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 10px clamp(18px, 4vw, 54px); background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.02rem; }
.brand small { color: var(--muted); margin-top: 1px; font-size: .75rem; }
.topbar-meta, .account { display: flex; align-items: center; gap: 10px; }
.account { padding-left: 12px; border-left: 1px solid var(--line); font-size: .88rem; }
.sync-state { display: flex; align-items: center; gap: 8px; background: var(--surface-subtle); padding: 0 13px; font-size: .84rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-state[data-state="ok"] .status-dot { background: var(--success); }
.sync-state[data-state="warning"] .status-dot { background: var(--warning); }

.section-nav {
  display: flex; gap: 6px; padding: 10px clamp(18px, 4vw, 54px); background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 72px; z-index: 9; overflow-x: auto;
}
.section-nav button { flex: 0 0 auto; padding: 0 15px; background: transparent; color: var(--muted); }
.section-nav button:hover { color: var(--ink); background: var(--surface-subtle); }
.section-nav button[aria-current="page"] { color: var(--ink); background: var(--info-soft); }

main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 80px; outline: none; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { margin: 0; font-size: 2rem; line-height: 1.1; letter-spacing: -.03em; text-wrap: balance; }
.page-heading p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; text-wrap: pretty; }
.heading-meta { flex: 0 0 auto; font-size: .85rem; font-variant-numeric: tabular-nums; }

.summary-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--navy); color: white;
  border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; box-shadow: var(--shadow);
}

.resource-panel {
  margin: 0 0 22px; padding: 24px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 26px oklch(0.20 0.035 255 / .04);
}
.section-title { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 20px; }
.section-title h2 { margin: 0; font-size: 1.15rem; }
.section-title p { margin: 5px 0 0; color: var(--muted); }
.resource-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.resource-card { min-width: 0; padding: 17px; border-radius: 16px; background: var(--surface-subtle); }
.resource-card strong { display: block; margin-top: 9px; font-size: 1.12rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.resource-card small, .resource-label { color: var(--muted); }
.resource-label { font-size: .78rem; font-weight: 700; }
.resource-card small { display: block; margin-top: 5px; line-height: 1.35; }
.resource-meter { width: 100%; height: 6px; margin-top: 14px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--line); }
.resource-meter::-webkit-progress-bar { background: var(--line); }
.resource-meter::-webkit-progress-value, .resource-meter::-moz-progress-bar { background: var(--brand); border-radius: 99px; }

.traffic-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--navy); color: white;
  border-radius: var(--radius); overflow: hidden; margin: 0 0 16px; box-shadow: var(--shadow);
}
.traffic-summary > div { min-height: 92px; padding: 18px 22px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid oklch(1 0 0 / .14); }
.traffic-summary > div:last-child { border: 0; }
.traffic-summary strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.traffic-summary span { color: oklch(0.84 0.015 255); margin-top: 4px; font-size: .8rem; }
.network-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.network-strip > div { padding: 16px; background: var(--surface); }
.traffic-list { display: grid; gap: 10px; }
.traffic-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.traffic-row h2 { margin: 0; font-size: 1rem; }
.traffic-facts { flex: 1; max-width: 620px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; }
.summary-strip > div { min-height: 100px; display: flex; flex-direction: column; justify-content: center; padding: 20px 24px; border-right: 1px solid oklch(1 0 0 / .14); }
.summary-strip > div:last-child { border: 0; }
.summary-strip strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.summary-strip span { color: oklch(0.84 0.015 255); margin-top: 4px; font-size: .84rem; }

.site-list, .backup-list { display: grid; gap: 16px; }
.site-card, .backup-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  box-shadow: 0 8px 26px oklch(0.20 0.035 255 / .04);
}
.site-card.needs-attention { border-color: oklch(0.78 0.10 75); }
.site-card-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.site-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-avatar {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 15px; display: grid; place-items: center;
  background: var(--info-soft); color: var(--navy); font-weight: 800;
}
.site-card h2, .backup-row h2 { margin: 0; font-size: 1.15rem; }
.domain, .backup-row p { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.site-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.site-facts, .passport-grid, .backup-facts { margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
dl > div { min-width: 0; }
dt { color: var(--muted); font-size: .78rem; margin-bottom: 7px; }
dd { margin: 0; font-weight: 700; min-height: 25px; display: flex; align-items: center; overflow-wrap: anywhere; }
.badge { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 4px 9px; font-size: .75rem; font-weight: 750; background: var(--surface-subtle); color: var(--ink); }
.badge-online, .badge-valid, .badge-verified { background: var(--success-soft); color: oklch(0.35 0.10 155); }
.badge-offline, .badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-unknown, .badge-warning, .badge-stale, .badge-unverified { background: var(--warning-soft); color: oklch(0.43 0.11 75); }
.storage-meter { display: block; width: 100%; height: 6px; appearance: none; border: 0; background: var(--surface-subtle); border-radius: 99px; overflow: hidden; margin-top: 18px; }
.storage-meter::-webkit-progress-bar { background: var(--surface-subtle); }
.storage-meter::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
.storage-meter::-moz-progress-bar { background: var(--brand); border-radius: 99px; }
.passport { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.passport h3 { margin: 0; font-size: .92rem; }
.passport-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.backup-facts { margin: 0; flex: 1; max-width: 680px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.activity-list, .guide-steps { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.activity-list li { display: flex; align-items: center; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border: 0; }
.activity-list strong { font-size: .94rem; }
.activity-list p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.activity-result { display: grid; place-items: center; flex: 0 0 42px; height: 28px; border-radius: 8px; font-size: .68rem; font-weight: 800; background: var(--success-soft); color: oklch(0.35 0.10 155); }
.result-failed, .result-warning { background: var(--warning-soft); color: oklch(0.43 0.11 75); }
.guide-steps { counter-reset: steps; }
.guide-steps li { counter-increment: steps; position: relative; padding: 24px 24px 24px 78px; border-bottom: 1px solid var(--line); }
.guide-steps li:last-child { border: 0; }
.guide-steps li::before { content: counter(steps); position: absolute; left: 24px; top: 23px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--navy); color: white; font-weight: 800; }
.guide-steps h2 { margin: 0; font-size: 1rem; }
.guide-steps p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; max-width: 75ch; }
.safety-note { margin-top: 18px; background: var(--warning-soft); color: oklch(0.36 0.08 75); border-radius: 15px; padding: 18px 20px; }
.safety-note p { margin: 6px 0 0; line-height: 1.5; }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 36px; text-align: center; }
.empty-state h2 { margin: 0; font-size: 1.05rem; }
.empty-state p { color: var(--muted); margin: 8px auto 0; max-width: 55ch; line-height: 1.5; }
.loading-view { display: grid; gap: 14px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface-subtle), var(--surface), var(--surface-subtle)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 12px; }
.heading-skeleton { width: 42%; height: 34px; }
.row-skeleton { width: 100%; height: 145px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .login-shell { padding: 22px; }
  .login-panel { padding: 26px 22px; border-radius: 24px; }
  .topbar { min-height: 64px; padding: 9px 16px; }
  .brand small, .account > span { display: none; }
  .topbar-meta { gap: 4px; }
  .account { padding-left: 4px; }
  .sync-state { padding: 0 10px; }
  .section-nav {
    position: fixed; inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px; top: auto;
    z-index: 10; border: 1px solid var(--line); border-radius: 18px; padding: 6px;
    box-shadow: 0 14px 38px oklch(0.20 0.035 255 / .17); justify-content: space-between;
    overflow: visible;
  }
  .section-nav button { min-width: 0; padding: 0 9px; font-size: .74rem; }
  main { width: min(100% - 28px, 620px); padding: 28px 0 108px; }
  .page-heading { align-items: start; flex-direction: column; gap: 2px; margin-bottom: 22px; }
  .page-heading h1 { font-size: 1.65rem; }
  .heading-meta { margin-top: 2px !important; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip > div { min-height: 86px; padding: 16px; }
  .summary-strip > div:nth-child(2) { border-right: 0; }
  .summary-strip > div:nth-child(-n + 2) { border-bottom: 1px solid oklch(1 0 0 / .14); }
  .site-card, .backup-row { padding: 18px; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .traffic-summary { grid-template-columns: repeat(2, 1fr); }
  .traffic-summary > div:nth-child(2) { border-right: 0; }
  .traffic-summary > div:nth-child(-n + 2) { border-bottom: 1px solid oklch(1 0 0 / .14); }
  .network-strip { grid-template-columns: 1fr 1fr; }
  .traffic-row { align-items: stretch; flex-direction: column; }
  .traffic-facts { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-card-header, .backup-row { align-items: stretch; flex-direction: column; gap: 16px; }
  .site-actions { width: 100%; }
  .site-actions > * { flex: 1; }
  .site-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .passport-grid, .backup-facts { width: 100%; grid-template-columns: 1fr; gap: 14px; }
  .guide-steps li { padding: 20px 18px 20px 64px; }
  .guide-steps li::before { left: 18px; top: 18px; }
}

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