:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #555555;
  --line: #e0e0e0;
  --canvas: #ffffff;
  --panel: #ffffff;
  --nav: #f7f8fa;
  --nav-soft: #eef1f5;
  --accent: #059669;
  --accent-strong: #047857;
  --accent-soft: #d1fae5;
  --teal: #059669;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --blue: #2563eb;
  --code: #1e293b;
  --header-height: 50px;
  --sidebar-width: 260px;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

html { scroll-behavior: smooth; }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.shell { min-height: 100vh; }

.sidebar {
  background: var(--nav);
  border-right: 1px solid var(--line);
  bottom: 0;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  left: 0;
  padding: 0 8px 16px;
  position: fixed;
  top: 0;
  width: var(--sidebar-width);
  z-index: 100;
}

.brand { align-items: center; color: inherit; display: flex; gap: 9px; min-width: 0; text-decoration: none; }
.sidebar > .brand { background: var(--panel); border-bottom: 1px solid var(--line); height: var(--header-height); margin: 0 -8px; padding: 0 20px; }
.brand-mark { align-items: center; background: var(--accent-strong); border-radius: 5px; color: #ffffff; display: inline-flex; flex: 0 0 auto; font-size: 10px; font-weight: 800; height: 28px; justify-content: center; letter-spacing: .02em; width: 28px; }
.brand strong, .brand small { display: block; }
.brand strong { color: var(--ink); font-size: 14px; line-height: 1.2; }
.brand small { color: #666666; font-size: 10px; line-height: 1.2; margin-top: 2px; }

.sidebar nav { display: grid; gap: 0; overflow-y: auto; padding: 12px 0; }
.nav-group-title { color: #666666; font-size: 10px; font-weight: 600; letter-spacing: .1em; padding: 10px 14px 4px; text-transform: uppercase; }
.nav-item { align-items: center; border-left: 2px solid transparent; color: var(--muted); display: flex; font-size: 13px; font-weight: 400; gap: 8px; line-height: 22px; padding: 5px 14px; text-decoration: none; }
.nav-item i { display: none; }
.nav-item:hover { background: #f0f2f4; color: var(--ink); }
.nav-item.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent-strong); font-weight: 500; }

.sidebar-foot { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 10px; margin-top: auto; padding: 15px 14px 0; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: var(--ink); font-size: 11px; line-height: 1.3; }
.sidebar-foot small { color: #666666; font-size: 10px; line-height: 1.3; margin-top: 2px; }
.health-dot { background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px rgba(5, 150, 105, .12); height: 7px; width: 7px; }

.shell > main { margin-left: var(--sidebar-width); min-width: 0; padding: 74px 32px 60px; }
.topbar { align-items: center; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; height: var(--header-height); justify-content: space-between; left: var(--sidebar-width); padding: 0 32px; position: fixed; right: 0; top: 0; z-index: 90; }
.header-context { align-items: center; display: flex; gap: 9px; }
.mobile-brand { color: var(--ink); display: none; font-size: 14px; font-weight: 700; }
.version-badge { border: 1px solid var(--line); border-radius: 10px; color: var(--accent-strong); font-size: 10px; font-weight: 700; line-height: 18px; padding: 1px 8px; }
.eyebrow { color: var(--accent-strong); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.35; }
.page-hero { border-bottom: 1px solid var(--line); margin-bottom: 28px; padding: 12px 0 20px; }
.page-hero > p { color: var(--muted); line-height: 1.7; margin-top: 2px; }
.top-actions { align-items: center; display: flex; gap: 10px; }
.preview-badge { background: #e7eceb; border-radius: 99px; color: #4f6266; font-size: 11px; font-weight: 700; padding: 8px 12px; }
.avatar { align-items: center; background: var(--accent-soft); border-radius: 50%; color: var(--accent); display: inline-flex; font-size: 10px; font-weight: 700; height: 30px; justify-content: center; width: 30px; }
.user-label strong, .user-label small { display: block; text-align: right; }
.user-label strong { font-size: 11px; }
.user-label small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.logout-form { margin: 0; }

.notice { align-items: flex-start; background: #eff6ff; border: 1px solid #bfdbfe; border-left: 3px solid var(--blue); border-radius: 4px; display: flex; gap: 11px; margin-bottom: 22px; padding: 12px 14px; }
.notice-mark { align-items: center; background: #dbeafe; border-radius: 50%; color: var(--blue); display: inline-flex; flex: 0 0 auto; font-family: Georgia, serif; font-size: 12px; font-weight: 700; height: 20px; justify-content: center; width: 20px; }
.notice strong { font-size: 12px; }
.notice p { color: #42526b; font-size: 12px; line-height: 1.55; margin-top: 2px; }

.metrics { display: grid; gap: 32px; grid-template-columns: repeat(4, minmax(0, max-content)); margin-top: 16px; }
.metrics article { min-width: 110px; }
.metric-label { color: #666666; display: block; font-size: 10px; font-weight: 500; letter-spacing: .04em; line-height: 1.4; text-transform: uppercase; }
.metrics strong { color: var(--accent); display: block; font-size: 22px; font-weight: 700; line-height: 1.4; }
.metrics small { color: #666666; display: block; font-size: 10px; line-height: 1.4; margin-top: 2px; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); min-height: 0; overflow: hidden; padding: 14px; }
.panel-head { align-items: center; background: var(--nav); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin: -14px -14px 0; min-height: 43px; padding: 9px 14px; }
.panel-head h2 { font-size: 16px; font-weight: 600; }
.status { border-radius: 9px; font-size: 9px; font-weight: 600; letter-spacing: .03em; line-height: 17px; padding: 1px 7px; text-transform: uppercase; }
.status.healthy { background: var(--accent-soft); color: var(--accent-strong); }
dl { display: grid; gap: 0; margin: 10px 0 0; }
dl div { align-items: center; border-bottom: 1px solid #eeeeee; display: flex; justify-content: space-between; padding: 9px 0; }
dl div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { color: var(--ink); font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 500; margin: 0; }
.empty-state { align-items: center; display: flex; flex-direction: column; justify-content: center; min-height: 205px; text-align: center; }
.empty-state span { align-items: center; background: var(--nav); border: 1px solid var(--line); border-radius: 6px; color: #777777; display: inline-flex; font-size: 10px; font-weight: 700; height: 38px; justify-content: center; margin-bottom: 12px; width: 38px; }
.empty-state strong { font-size: 13px; }
.empty-state p { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 5px; max-width: 310px; }
footer { border-top: 1px solid var(--line); color: #666666; display: flex; font-size: 10px; justify-content: space-between; margin-top: 40px; padding: 16px 0 0; }

.button { align-items: center; border: 1px solid transparent; border-radius: 4px; cursor: pointer; display: inline-flex; font: inherit; font-size: 11px; font-weight: 600; justify-content: center; min-height: 38px; padding: 0 14px; }
.button.primary { background: var(--accent-strong); color: #ffffff; }
.button.primary:hover { background: #047857; }
.button.quiet { background: var(--nav); border-color: var(--line); color: #444444; min-height: 34px; }
.button.quiet:hover { background: var(--nav-soft); color: var(--ink); }
.flash { border: 1px solid; border-left-width: 3px; border-radius: 4px; font-size: 12px; font-weight: 600; margin: 0 0 16px; padding: 11px 13px; }
.flash.success { background: #ecfdf5; border-color: #a7f3d0; border-left-color: var(--success); color: #047857; }
.flash.danger { background: #fef2f2; border-color: #fecaca; border-left-color: var(--danger); color: #b91c1c; }

.inventory, .management { margin-top: 40px; scroll-margin-top: 66px; }
.section-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; margin-bottom: 12px; padding-bottom: 8px; }
.section-head > p { color: var(--muted); font-size: 11px; }
.revision-badge, .count-badge { background: var(--nav); border: 1px solid var(--line); border-radius: 9px; color: #666666; font-size: 10px; font-weight: 600; line-height: 17px; padding: 1px 7px; }
.revision-badge { background: var(--accent-soft); border-color: #a7f3d0; color: var(--accent); }
.table-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.table-panel { min-height: 0; padding: 14px; }
.wide-panel { width: 100%; }
.panel-head h3 { font-size: 13px; font-weight: 600; }
.filter-form { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-form input[type="search"], .filter-form select { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font: inherit; font-size: 11px; min-height: 38px; outline: none; padding: 8px 10px; }
.filter-form input[type="search"] { flex: 1 1 210px; min-width: 160px; }
.filter-form select { flex: 0 1 170px; }
.filter-form input[type="search"]:focus, .filter-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5, 150, 105, .1); }
.filter-form .button { min-height: 38px; }
.table-wrap { margin: 12px -14px 0; overflow-x: auto; }
table { border-collapse: collapse; min-width: 520px; width: 100%; }
th { background: var(--nav); border-bottom: 1px solid var(--line); color: #666666; font-size: 10px; font-weight: 600; letter-spacing: .05em; padding: 6px 10px; text-align: left; text-transform: uppercase; }
td { border-bottom: 1px solid var(--line); color: #444444; font-size: 12px; padding: 8px 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafafa; }
td strong, td small { display: block; }
td strong { color: var(--ink); font-size: 12px; }
td small { color: #888888; font-size: 10px; margin-top: 2px; }
td code { color: var(--accent); font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.status.compact, .kind-badge { background: var(--nav-soft); color: #555555; display: inline-flex; font-size: 9px; padding: 1px 7px; }
.status.compact.online { background: var(--accent-soft); color: #047857; }
.status.compact.warning { background: #fffbeb; color: var(--warning); }
.status.compact.offline { background: #fef2f2; color: var(--danger); }
.status.compact.unknown { background: #f1f5f9; color: #64748b; }
.kind-badge { border-radius: 4px; font-weight: 700; text-transform: uppercase; }
.access-control { min-width: 230px; }
.access-control summary { color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 600; }
.access-control form { display: grid; gap: 10px; margin-top: 10px; }
.access-control p { color: var(--muted); font-size: 10px; line-height: 1.45; }
.access-options { border: 1px solid var(--line); border-radius: 4px; display: grid; max-height: 170px; overflow-y: auto; padding: 5px 9px; }
.access-options > label { align-items: center; color: var(--ink); cursor: pointer; display: flex; font-size: 11px; gap: 8px; padding: 7px 0; }
.access-options > label + label { border-top: 1px solid #eeeeee; }
.access-options input { accent-color: var(--accent); }
.access-options span, .access-options small { display: block; }
.access-options span small { color: var(--muted); font-size: 9px; margin-top: 1px; text-transform: uppercase; }
.access-control .button { justify-self: start; }
.empty-cell { color: var(--muted); padding: 26px 12px; text-align: center; }
.pagination { align-items: center; border-top: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; margin-top: 14px; padding-top: 12px; }
.page-summary { color: var(--muted); font-size: 10px; }
.page-actions { align-items: center; display: flex; gap: 9px; }
.page-actions a, .page-actions .disabled, .page-actions strong { border-radius: 4px; font-size: 10px; font-weight: 600; padding: 5px 8px; }
.page-actions a { background: var(--nav); border: 1px solid var(--line); color: #444444; text-decoration: none; }
.page-actions .disabled { color: #a0adaf; }
.page-actions strong { color: var(--accent); }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-panel { min-height: 0; }
.form-heading { align-items: center; background: var(--nav); border-bottom: 1px solid var(--line); display: flex; gap: 10px; margin: -14px -14px 14px; padding: 10px 14px; }
.form-heading > span { align-items: center; background: var(--accent-soft); border-radius: 8px; color: var(--accent); display: inline-flex; flex: 0 0 auto; font-size: 9px; font-weight: 700; height: 24px; justify-content: center; width: 24px; }
.form-heading h3 { font-size: 13px; }
.form-heading p, .form-help, .empty-form { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 4px; }
.stack-form { display: grid; gap: 12px; }
.stack-form label { color: #555555; display: grid; font-size: 10px; font-weight: 600; gap: 5px; letter-spacing: .04em; text-transform: uppercase; }
.stack-form input, .stack-form select { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); font: inherit; font-size: 12px; min-height: 38px; outline: none; padding: 8px 10px; width: 100%; }
.stack-form input:focus, .stack-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(5, 150, 105, .1); }
.empty-form { background: var(--nav); border: 1px solid var(--line); border-radius: 4px; padding: 14px; }

.login-page { background: var(--canvas); min-height: 100vh; }
.public-header { align-items: center; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; height: var(--header-height); justify-content: space-between; left: 0; padding: 0 20px; position: fixed; right: 0; top: 0; z-index: 100; }
.login-layout { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); min-height: 100vh; padding-top: var(--header-height); }
.login-intro { background: var(--nav); border-right: 1px solid var(--line); color: var(--ink); display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.login-brand { width: max-content; }
.login-intro h1 { font-size: clamp(28px, 3vw, 36px); line-height: 1.08; margin: 10px 0 18px; max-width: 520px; }
.login-intro > p { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 520px; }
.login-points { color: #444444; display: grid; font-size: 12px; gap: 10px; list-style: none; margin: 26px 0 0; padding: 0; }
.login-points li { align-items: center; display: flex; gap: 10px; }
.login-points li::before { background: var(--accent); border-radius: 50%; content: ""; height: 7px; width: 7px; }
.login-card { align-self: center; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: none; justify-self: center; max-width: 440px; padding: 30px 32px; width: calc(100% - 40px); }
.login-card h2 { font-size: 22px; margin: 4px 0; }
.login-card .form-help { margin-bottom: 20px; }
.token-shell { align-items: center; display: flex; margin: 0 auto; max-width: 680px; min-height: 100vh; padding: 90px 20px 40px; }
.token-shell .login-card { max-width: 680px; width: 100%; }
.token-shell .login-card h1 { font-size: 24px; margin: 4px 0 8px; }
.token-shell .login-card > p { color: var(--muted); font-size: 12px; line-height: 1.6; margin-bottom: 22px; }
.token-shell label { color: #555555; display: grid; font-size: 10px; font-weight: 600; gap: 6px; letter-spacing: .04em; margin-top: 14px; text-transform: uppercase; }
.token-details { margin: 14px 0 0; }
.token-details dd { max-width: 70%; text-align: right; }
.token-details code { color: var(--accent); font-size: 11px; overflow-wrap: anywhere; }
.token-value { background: var(--code); border: 1px solid #334155; border-radius: 6px; color: #d1fae5; font: 500 12px/1.55 "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace; outline: none; padding: 13px; resize: vertical; text-transform: none; width: 100%; }
.token-actions { display: grid; gap: 8px; margin-top: 22px; }
.token-shell .button { margin-top: 22px; text-decoration: none; width: 100%; }
.token-actions .button { margin-top: 0; }
.bootstrap-box { background: #fffbeb; border: 1px solid #fde68a; border-left: 3px solid var(--warning); border-radius: 4px; margin-top: 20px; padding: 13px; }
.bootstrap-box strong { font-size: 11px; }
.bootstrap-box p { color: #785b17; font-size: 10px; line-height: 1.5; margin: 5px 0 10px; }
.bootstrap-box code { background: var(--code); border-radius: 6px; color: #d1fae5; display: block; font-size: 9px; line-height: 1.55; overflow-wrap: anywhere; padding: 11px; white-space: pre-wrap; }

.error-page { align-items: center; background: var(--canvas); display: flex; justify-content: center; min-height: 100vh; padding: 74px 24px 24px; }
.error-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); max-width: 520px; padding: 32px; }
.status-mark { align-items: center; background: #fef2f2; border-radius: 50%; color: var(--danger); display: inline-flex; font-size: 14px; font-weight: 700; height: 30px; justify-content: center; margin-bottom: 20px; width: 30px; }
.error-card h1 { font-size: 24px; margin: 4px 0 10px; }
.error-card p { color: var(--muted); font-size: 13px; line-height: 1.6; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 980px) {
  .shell > main { padding-left: 24px; padding-right: 24px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, max-content)); }
  .table-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .login-intro { padding: 32px; }
  .login-points { gap: 8px; }
}

@media (max-width: 768px) {
  .shell { padding-top: var(--header-height); }
  .sidebar { border-bottom: 1px solid var(--line); border-right: 0; bottom: auto; min-height: 0; overflow-x: auto; padding: 0; position: sticky; top: var(--header-height); width: 100%; z-index: 80; }
  .sidebar > .brand, .nav-group-title, .sidebar-foot { display: none; }
  .sidebar nav { display: flex; min-width: max-content; overflow: visible; padding: 8px; }
  .nav-item { border-bottom: 2px solid transparent; border-left: 0; padding: 5px 12px; white-space: nowrap; }
  .nav-item.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  .shell > main { margin-left: 0; padding: 24px 16px 40px; }
  .inventory, .management { scroll-margin-top: 112px; }
  .topbar { left: 0; padding: 0 16px; }
  .mobile-brand { display: inline; }
  .grid, .table-grid, .form-grid { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { border-bottom: 1px solid var(--line); border-right: 0; padding: 34px 24px; }
  .login-intro h1 { font-size: 32px; }
  .login-points { display: none; }
  .login-card { margin: 32px auto; }
  .token-shell { padding: 82px 16px 32px; }
}

@media (max-width: 520px) {
  .user-label { display: none; }
  .topbar .version-badge { display: none; }
  .metrics { gap: 14px 28px; grid-template-columns: repeat(2, minmax(0, max-content)); }
  .page-hero { padding-top: 4px; }
  .login-intro { padding: 28px 20px; }
  .login-intro h1 { font-size: 28px; }
  .login-intro > p { font-size: 12px; }
  .login-card { padding: 24px 20px; width: calc(100% - 24px); }
  .public-header .version-badge { display: none; }
  .section-head { align-items: flex-start; gap: 8px; }
  .section-head > p { max-width: 160px; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
