:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #1b2927;
  background: #f3f6f4;
  --muted: #536661;
  --line: #d8e3de;
  --primary: #0e5b48;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
[hidden] { display: none !important; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.25; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
input, select, button { min-height: 44px; border-radius: 8px; }
button { padding: 0 14px; background: var(--primary); color: white; border: 1px solid transparent; white-space: nowrap; }
button:hover:not(:disabled) { background: #0a4638; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 2px solid #17816b; outline-offset: 2px; }
.plain, .outline { background: #fff; color: var(--primary); }
.plain:hover:not(:disabled), .outline:hover:not(:disabled) { background: #eaf4ee; }
.outline, input, select { border: 1px solid #aebfb7; }
input, select { padding: 0 10px; min-width: 0; width: 100%; color: inherit; background: #fff; }
label { display: block; font-size: .875rem; font-weight: 650; margin-bottom: 4px; }

.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 12px; padding: 10px 20px; min-height: 62px; margin: auto; max-width: 1180px; }
.brand-mark { width: 22px; height: 24px; border: 2px solid var(--primary); border-radius: 4px; position: relative; flex: none; }
.brand-mark::after { content: ''; position: absolute; right: 4px; bottom: 8px; width: 4px; border-top: 2px solid var(--primary); }
.brand { font-weight: 750; white-space: nowrap; }
.account { margin-left: auto; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: .875rem; }
.account span { overflow: hidden; text-overflow: ellipsis; }

main { padding: 32px 20px 56px; max-width: 1180px; margin: auto; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.loading { color: var(--muted); text-align: center; padding: 48px 0; }
.signin { max-width: 420px; margin: min(9vh, 80px) auto 0; padding: 28px; }
.signin .muted { margin-top: 8px; }
.signin form { display: flex; flex-direction: column; margin-top: 22px; }
.signin input + label { margin-top: 14px; }
.signin button { width: 100%; margin-top: 14px; }
.notice { color: #9c3524; font-size: .9rem; }
.notice:not(:empty) { margin-top: 12px; }

.inventory-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
#feed-time { margin-top: 6px; font-size: .875rem; }
#feed-time.stale { color: #9c3524; font-weight: 650; }
.metrics { margin: 20px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metrics > div { padding: 12px 16px; }
.metrics dt { color: var(--muted); font-size: .875rem; }
.metrics dd { color: #113b31; font-size: 1.6rem; line-height: 1.3; font-weight: 750; font-variant-numeric: tabular-nums; }
.device-panel { overflow: hidden; }
.filters { display: grid; grid-template-columns: minmax(190px, 2fr) repeat(3, minmax(108px, 1fr)); gap: 12px; padding: 16px; }
.filters details { grid-column: 1 / -1; }
.filters summary { color: var(--primary); font-size: .875rem; width: fit-content; min-height: 30px; display: list-item; }
.extra-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.result-count { font-size: .875rem; padding: 0 16px 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
thead { color: #3d554d; background: #edf4f0; }
th, td { padding: 12px 14px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
td .muted { display: block; font-size: .8rem; margin-top: 3px; }
td button { font-size: .875rem; }
.status { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #edf2f0; color: #3f5c55; white-space: nowrap; font-size: .8rem; }
.status.online, .status.fresh { background: #e2f4e9; color: #14503b; }
.status.offline, .status.cached, .status.revoked { background: #fff0de; color: #824519; }
.empty { text-align: center; border-top: 1px solid var(--line); color: var(--muted); padding: 32px 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

dialog { width: min(560px, calc(100vw - 24px)); max-height: min(85vh, 800px); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px 20px; color: inherit; }
dialog::backdrop { background: #0c2d25aa; }
.detail-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; }
dialog dl > div { display: grid; grid-template-columns: minmax(110px, .75fr) minmax(0, 1.4fr); gap: 10px; border-top: 1px solid var(--line); padding: 9px 0; font-size: .9rem; }
dialog dt { color: var(--muted); }
dialog dd { overflow-wrap: anywhere; }

@media (max-width: 730px) {
  .topbar-inner, main { padding-left: 12px; padding-right: 12px; }
  main { padding-top: 22px; }
  .account { gap: 4px; }
  .account button { padding: 0 8px; }
  .metrics { gap: 6px; }
  .metrics > div { padding: 8px; }
  .metrics dt { font-size: .75rem; }
  .metrics dd { font-size: 1.4rem; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; }
  .search-field { grid-column: 1 / -1; }
  .extra-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; padding: 12px; border-top: 1px solid var(--line); }
  td { border: 0; padding: 0; }
  td:nth-child(3) { display: none; }
  td:nth-child(6) { grid-column: 1 / -1; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); padding-bottom: 3px; }
}
