:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light dark;
  --bg: #f8faf9;
  --surface: #fff;
  --sidebar: #f3f6f4;
  --ink: #17241e;
  --muted: #586961;
  --line: #dce5df;
  --hover: #edf3ef;
  --accent: #18674e;
  --accent-hover: #11513d;
  --accent-ink: #fff;
  --tint: #e3f1e9;
  --danger: #aa342d;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a16;
    --surface: #18221d;
    --sidebar: #151e19;
    --ink: #eef4ef;
    --muted: #b1c1b7;
    --line: #34443b;
    --hover: #26352d;
    --accent: #a4dbc0;
    --accent-hover: #b8ebd0;
    --accent-ink: #163126;
    --tint: #263d32;
    --danger: #f5a49e;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; color: var(--ink); background: var(--bg); }
h1, h2, p { margin: 0; }
button, input, textarea, select { font: inherit; }
button, input, textarea, select { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); }
button { min-height: 36px; padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
button:hover { background: var(--hover); }
button:disabled { opacity: .56; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { background: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { width: 100%; min-width: 0; padding: 8px 11px; font-size: 14px; }
textarea { resize: vertical; min-height: 116px; line-height: 1.55; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.layout { min-height: 100dvh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 710; letter-spacing: -.035em; padding: 4px 8px; }
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 23px; }
nav { display: grid; gap: 4px; margin-top: 33px; }
nav button, .logout { display: flex; align-items: center; gap: 10px; min-height: 40px; background: transparent; border-color: transparent; text-align: left; color: var(--muted); }
nav button[aria-current="page"] { background: var(--tint); color: var(--accent); }
.logout { margin-top: auto; }
[data-icon] { display: inline-grid; place-items: center; }
[data-icon] svg { width: 17px; height: 17px; }
.topbar { min-height: 61px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); }
.online { display: flex; align-items: center; gap: 7px; }
.online i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.content { max-width: 1320px; margin: auto; padding: 37px 32px; }
.heading { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 25px; }
h1 { font-size: clamp(25px, 3vw, 32px); line-height: 1.2; letter-spacing: -.04em; }
h2 { font-size: 19px; letter-spacing: -.025em; }
.heading p { margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.actions, .filters, .pagination, .form-actions { display: flex; gap: 8px; align-items: center; }
.actions { flex: 0 0 auto; }
.filters { flex-wrap: wrap; margin-bottom: 14px; }
.filters input { max-width: 280px; }
.filters select { width: auto; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13px; text-align: left; }
th, td { padding: 12px 15px; }
th { background: var(--sidebar); color: var(--muted); white-space: nowrap; font-weight: 650; }
td { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
td:last-child { text-align: right; white-space: nowrap; }
td:nth-last-child(2) { font-variant-numeric: tabular-nums; }
.cell-title { min-width: 124px; font-weight: 650; }
.cell-detail { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 400; }
.tag { display: inline-block; white-space: nowrap; border-radius: 6px; padding: 3px 7px; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--tint); }
.tag.quiet { color: var(--muted); background: var(--hover); }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.pagination { justify-content: flex-end; margin-top: 12px; }
#notice, .error { color: var(--danger); font-size: 13px; line-height: 1.6; }
#notice { margin: 0 0 14px; }
#notice.success { color: var(--accent); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 50% 18%, var(--tint), var(--bg) 64%); }
.login-content { width: min(100%, 400px); }
.login-content .brand { justify-content: center; margin-bottom: 20px; }
.login-form, .settings-card { display: grid; gap: 19px; padding: 26px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.login-form h1 { font-size: 24px; }
.settings-card { max-width: 480px; }
dialog { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 22px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); }
dialog::backdrop { background: #101b16a0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
#close-dialog { min-height: 32px; font-size: 19px; }
#dialog-body form, .dialog-details { display: grid; gap: 13px; }
#dialog-error { margin-top: 12px; }
.form-actions { justify-content: flex-end; flex-wrap: wrap; }
.danger { color: var(--danger); margin-right: auto; }
.help, .details { color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; border-radius: var(--radius); padding: 12px; background: var(--sidebar); }
@media (max-width: 740px) {
  .layout { display: block; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); padding: 12px 14px 5px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  nav { margin: 6px 0 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-column: 1 / -1; grid-row: 2; }
  nav button, .logout { white-space: nowrap; padding: 0 8px; }
  .topbar { min-height: 40px; padding: 0 18px; }
  .content { padding: 24px 18px; }
  .heading { flex-wrap: wrap; }
  th, td { padding: 9px; }
  .cell-title { min-width: 0; }
  #panel[data-page="resources"] :is(th, td):nth-child(n+3):nth-child(-n+5),
  #panel[data-page="devices"] :is(th, td):nth-child(3),
  #panel[data-page="tasks"] :is(th, td):nth-child(3),
  #panel[data-page="tasks"] :is(th, td):nth-child(4) { display: none; }
}
@media (prefers-contrast: more) {
  :root { --line: var(--muted); }
}
