:root {
  color-scheme: light;
  --bg: oklch(1 0 0);
  --canvas: oklch(0.968 0.006 252);
  --canvas-strong: oklch(0.93 0.012 252);
  --ink: oklch(0.205 0.025 252);
  --muted: oklch(0.46 0.026 252);
  --line: oklch(0.875 0.012 252);
  --nav: oklch(0.19 0.07 252);
  --nav-active: oklch(0.27 0.09 252);
  --primary: oklch(0.478 0.136 251.8);
  --primary-hover: oklch(0.42 0.145 251.8);
  --primary-soft: oklch(0.93 0.035 252);
  --success: oklch(0.49 0.135 150);
  --success-soft: oklch(0.94 0.045 150);
  --warning: oklch(0.61 0.15 68);
  --warning-soft: oklch(0.95 0.05 75);
  --danger: oklch(0.53 0.195 28);
  --danger-soft: oklch(0.94 0.045 28);
  --info: oklch(0.53 0.14 236);
  --sidebar: 236px;
  --topbar: 60px;
  --z-sidebar: 30;
  --z-backdrop: 20;
  --z-dialog: 50;
  --z-toast: 60;
  font-family: "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: var(--canvas); color: var(--ink); }
body { font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
svg { width: 18px; height: 18px; display: block; flex: 0 0 auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid oklch(0.72 0.13 252); outline-offset: 2px; }

.login-view { min-height: 100vh; display: grid; grid-template-rows: 1fr auto 1fr; align-items: end; justify-items: center; padding: 40px 20px 24px; background: var(--nav); color: white; }
.login-brand { align-self: end; margin-bottom: 30px; display: flex; align-items: center; gap: 14px; }
.login-brand img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.login-brand strong { display: block; font-size: 26px; line-height: 1.15; }
.login-brand span { display: block; margin-top: 3px; color: oklch(0.78 0.03 252); font-size: 12px; }
.login-form { width: min(100%, 380px); padding: 28px; border-radius: 8px; background: white; color: var(--ink); }
.login-form h1 { margin: 0; font-size: 22px; }
.login-form p { margin: 5px 0 22px; color: var(--muted); }
.login-form label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.login-foot { align-self: end; margin: 0; color: oklch(0.72 0.03 252); font-size: 12px; }
.form-error { margin: 10px 0 0 !important; color: var(--danger) !important; font-size: 13px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px 16px; display: flex; flex-direction: column; background: var(--nav); color: white; z-index: var(--z-sidebar); }
.brand { padding: 0 8px; display: flex; align-items: center; gap: 12px; }
.brand img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; }
.brand strong { display: block; font-size: 18px; line-height: 1.2; }
.brand span { display: block; color: oklch(0.73 0.035 252); font-size: 10px; }
.nav { margin-top: 28px; display: grid; gap: 4px; }
.nav-label { padding: 12px 12px 6px; color: oklch(0.66 0.035 252); font-size: 12px; font-weight: 650; }
.nav a { min-height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 12px; border-radius: 6px; color: oklch(0.82 0.025 252); text-decoration: none; }
.nav a:hover { background: oklch(0.235 0.078 252); color: white; }
.nav a.active { background: var(--nav-active); color: white; }
.nav a svg { width: 17px; height: 17px; stroke-width: 1.8; }
.nav a b { margin-left: auto; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--danger); color: white; text-align: center; font-size: 11px; }
.admin-row { margin-top: auto; padding: 16px 8px 0; display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 10px; border-top: 1px solid oklch(0.34 0.065 252); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: oklch(0.35 0.1 252); font-size: 12px; font-weight: 700; }
.admin-row strong, .admin-row span { display: block; }
.admin-row strong { font-size: 13px; }
.admin-row div span { color: oklch(0.69 0.03 252); font-size: 11px; }

.sidebar-backdrop { display: none; }
.app-frame { min-width: 0; min-height: 100vh; background: var(--bg); }
.topbar { position: sticky; top: 0; height: var(--topbar); padding: 0 24px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); background: color-mix(in oklch, white 96%, transparent); z-index: 10; }
.breadcrumbs { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.breadcrumbs svg { width: 14px; height: 14px; }
.breadcrumbs strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.service-state { display: inline-flex; align-items: center; gap: 7px; color: oklch(0.37 0.11 150); font-size: 13px; font-weight: 650; }
.service-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.menu-button { display: none !important; }

.main { min-height: calc(100vh - var(--topbar)); }
.page-head { min-height: 94px; padding: 24px 32px 18px; display: flex; align-items: flex-start; gap: 16px; }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 730; text-wrap: balance; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; text-wrap: pretty; }
.page-actions { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.workspace { padding: 24px 32px 36px; display: grid; gap: 26px; }
.workspace.with-band { padding-top: 24px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, .8fr); }
.split-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); }
.column { min-width: 0; display: grid; align-content: start; gap: 28px; }
.section { min-width: 0; }
.section + .section { padding-top: 2px; }
.section-head { min-height: 34px; display: flex; align-items: center; gap: 9px; }
.section-head h2 { margin: 0; font-size: 16px; line-height: 1.3; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-head .link-button { margin-left: auto; }

.metric-band { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { min-height: 88px; padding: 16px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric { color: inherit; text-decoration: none; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: inline-block; margin-top: 3px; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric small { margin-left: 7px; color: var(--muted); font-size: 11px; }
.metric small.warn { color: oklch(0.43 0.12 63); }
.metric small.bad { color: var(--danger); }

.button { min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 6px; font-size: 13px; font-weight: 680; text-decoration: none; }
.button svg { width: 16px; height: 16px; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--canvas-strong); color: var(--ink); }
.button.secondary:hover { background: oklch(0.895 0.016 252); }
.button.danger { background: var(--danger); color: white; }
.button.ghost { padding: 0 7px; background: transparent; color: var(--primary); }
.button.wide { width: 100%; }
.button.compact { min-height: 30px; padding: 0 9px; font-size: 12px; }
.icon-button { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--canvas); color: var(--ink); }
.icon-button.inverse { color: oklch(0.74 0.03 252); }
.icon-button.inverse:hover { background: var(--nav-active); color: white; }
.link-button { padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 650; }

.input-icon { min-height: 38px; padding: 0 11px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); }
.input-icon:focus-within { border-color: var(--primary); }
.input-icon svg { width: 16px; height: 16px; }
.input-icon input { min-width: 0; width: 100%; height: 36px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.filterbar { min-height: 54px; padding: 8px 0; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.filterbar .input-icon { width: min(300px, 100%); }
.field, select, textarea, input[type="text"], input[type="number"], input[type="password"] { border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
.field, select, input[type="text"], input[type="number"], input[type="password"] { min-height: 36px; padding: 0 11px; }
textarea { width: 100%; min-height: 104px; padding: 10px 11px; resize: vertical; }
input::placeholder, textarea::placeholder { color: oklch(0.48 0.02 252); opacity: 1; }
.field:focus, select:focus, textarea:focus, input:focus { border-color: var(--primary); outline: 0; }
.input-icon input[type="text"], .input-icon input[type="password"] { padding: 0; border: 0; }
.field-group { display: grid; gap: 7px; }
.field-group label { font-size: 13px; font-weight: 650; }
.field-group small { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.toolbar-spacer { margin-left: auto; }

.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 38px; padding: 0 12px; color: var(--muted); text-align: left; font-size: 12px; font-weight: 650; }
.data-table td { height: 50px; padding: 6px 12px; border-top: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.data-table tbody tr:hover { background: var(--canvas); }
.data-table .right { text-align: right; }
.data-table .actions { overflow: visible; }
.data-table .actions > div { display: flex; justify-content: flex-end; gap: 4px; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.empty-cell { height: 120px !important; text-align: center; color: var(--muted); white-space: normal !important; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 680; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.success { color: oklch(0.34 0.11 150); background: var(--success-soft); }
.pill.warning { color: oklch(0.41 0.12 63); background: var(--warning-soft); }
.pill.danger { color: oklch(0.41 0.17 28); background: var(--danger-soft); }
.pill.info { color: oklch(0.4 0.13 236); background: oklch(0.94 0.04 236); }
.pill.neutral { color: var(--muted); background: var(--canvas-strong); }

.trend { padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.trend-total { display: flex; align-items: baseline; gap: 8px; }
.trend-total strong { font-size: 24px; }
.trend-total span { color: var(--muted); font-size: 12px; }
.trend-row { display: grid; grid-template-columns: 82px minmax(100px, 1fr) 34px; align-items: center; gap: 10px; font-size: 12px; }
.trend-row time { color: var(--muted); }
progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--canvas-strong); }
progress::-webkit-progress-bar { background: var(--canvas-strong); }
progress::-webkit-progress-value { background: var(--primary); }
progress::-moz-progress-bar { background: var(--primary); }

.event-list { border-top: 1px solid var(--line); }
.event-row { min-height: 64px; padding: 11px 0; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: start; gap: 11px; border-bottom: 1px solid var(--line); }
.event-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: var(--canvas); color: var(--muted); }
.event-icon.warn { background: var(--warning-soft); color: var(--warning); }
.event-icon.bad { background: var(--danger-soft); color: var(--danger); }
.event-icon svg { width: 15px; height: 15px; }
.event-row strong { display: block; font-size: 13px; }
.event-row p { max-width: 45ch; margin: 2px 0 0; color: var(--muted); font-size: 12px; text-wrap: pretty; }
.event-row time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

.status-breakdown { padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.status-line { display: grid; grid-template-columns: 82px minmax(80px, 1fr) 40px; align-items: center; gap: 10px; font-size: 12px; }
.status-line strong { text-align: right; }
.release-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.release-row { min-height: 72px; padding: 12px 0; display: grid; grid-template-columns: minmax(150px, 1fr) 110px 160px auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.release-row strong, .release-row small { display: block; }
.release-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.upload-zone { min-height: 150px; padding: 22px; display: grid; place-items: center; text-align: center; border: 1px dashed oklch(0.72 0.03 252); border-radius: 8px; background: var(--canvas); }
.upload-zone svg { width: 28px; height: 28px; color: var(--primary); }
.upload-zone strong { display: block; margin-top: 8px; }
.upload-zone p { margin: 3px 0 12px; color: var(--muted); font-size: 12px; }
.file-summary { margin-top: 10px; color: var(--muted); font-size: 12px; }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 36px; }
.settings-section { padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.settings-section + .settings-section { padding-top: 24px; }
.settings-section h2 { margin: 0 0 5px; font-size: 16px; }
.settings-section > p { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.toggle-row { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-row strong, .toggle-row span { display: block; }
.toggle-row span { color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch b { position: absolute; inset: 0; border-radius: 999px; background: oklch(0.75 0.02 252); transition: background 180ms ease-out; }
.switch b::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: transform 180ms ease-out; }
.switch input:checked + b { background: var(--primary); }
.switch input:checked + b::after { transform: translateX(18px); }
.switch input:focus-visible + b { outline: 3px solid oklch(0.72 0.13 252); outline-offset: 2px; }
.facts { margin: 0; display: grid; }
.facts div { min-height: 48px; padding: 8px 0; display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 40px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 650; }
.tabs button.active { border-bottom-color: var(--primary); color: var(--ink); }
.json-preview { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "Cascadia Mono", Consolas, monospace; color: var(--muted); font-size: 11px; }
.pagination { min-height: 48px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 12px; }
.skeleton { height: 14px; border-radius: 4px; background: var(--canvas-strong); animation: pulse 1.2s ease-in-out infinite alternate; }
.loading-block { padding: 34px 0; display: grid; gap: 12px; }

dialog { width: min(560px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; border: 0; border-radius: 8px; overflow: auto; color: var(--ink); }
dialog::backdrop { background: oklch(0.12 0.035 252 / .64); }
.dialog-body { position: relative; padding: 26px; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-body h2 { margin: 0; padding-right: 38px; font-size: 19px; }
.dialog-body > div > p { margin: 5px 0 20px; color: var(--muted); font-size: 13px; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; width: min(360px, calc(100vw - 36px)); display: grid; gap: 8px; z-index: var(--z-toast); }
.toast { padding: 12px 14px; border-radius: 6px; background: var(--ink); color: white; font-size: 13px; animation: toast-in 180ms ease-out; }
.toast.error { background: var(--danger); }

@keyframes pulse { from { opacity: .52; } to { opacity: 1; } }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1180px) {
  .metric-band { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .dashboard-grid, .split-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform 200ms cubic-bezier(.22, 1, .36, 1); }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; display: block; border: 0; background: oklch(0.12 0.035 252 / .6); opacity: 0; pointer-events: none; transition: opacity 180ms ease-out; z-index: var(--z-backdrop); }
  .shell.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .menu-button { display: grid !important; }
  .page-head { padding: 20px 18px 16px; }
  .workspace { padding: 18px 18px 28px; }
  .metric { padding: 14px 16px; }
  .filterbar { align-items: stretch; flex-wrap: wrap; }
  .filterbar .input-icon { width: 100%; }
  .toolbar-spacer { margin-left: 0; }
  .release-row { grid-template-columns: minmax(130px, 1fr) 100px auto; }
  .release-row > :nth-child(3) { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 12px; }
  .breadcrumbs > span, .breadcrumbs svg, .service-state { display: none; }
  .page-head { display: block; }
  .page-head h1 { font-size: 21px; }
  .page-actions { margin: 14px 0 0; justify-content: flex-start; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-right: 1px solid var(--line); }
  .metric:nth-child(even) { border-right: 0; }
  .metric:nth-child(4) { border-bottom: 1px solid var(--line); }
  .metric strong { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .release-row { grid-template-columns: 1fr auto; }
  .release-row > :nth-child(2), .release-row > :nth-child(3) { display: none; }
  .facts div { grid-template-columns: 100px 1fr; }
  .dialog-body { padding: 22px 18px; }
}

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