@font-face {
  font-family: "NightCorp Display";
  src: url("assets/AnoxicSC-Medium.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Source Han Sans TC UI";
  src: url("assets/fonts/SourceHanSansTC-VF.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  size-adjust: 108%;
  unicode-range: U+2E80-2FFF, U+3000-303F, U+3100-312F, U+31A0-31BF, U+31C0-31EF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF;
}

:root {
  --paper: #f2f1e7;
  --surface: #fbfaf2;
  --surface-strong: #ffffff;
  --ink: #17180c;
  --muted: #666243;
  --line: #d7d3a7;
  --line-strong: #918b45;
  --navy: #121309;
  --navy-2: #766d00;
  --cyan: #bca900;
  --cyan-bg: #fff8c7;
  --amber: #d88912;
  --amber-bg: #fff0cf;
  --violet: #6b6fd6;
  --brand: #ffeb00;
  --brand-hover: #fff237;
  --brand-ink: #080909;
  --brand-text: #766d00;
  --brand-soft: #fff8c7;
  --brand-border: #b8a300;
  --sidebar-bg: #070808;
  --sidebar-ink: #edf5f7;
  --sidebar-muted: #aeb6a0;
  --rack-bg: #dedcc5;
  --rack-inset: #ebe9d8;
  --rack-rail: #716d4e;
  --rack-dash: #b7b38e;
  --row-bg: #fffef7;
  --row-border: #c7c28f;
  --table-head: #eae8d7;
  --table-ink: #41412c;
  --notice: #8e81d8;
  --signal-live: #d6bd00;
  --online-bg: #fff8c7;
  --online-text: #625700;
  --online-border: #b8a300;
  --attention-bg: #fff0cf;
  --attention-text: #855306;
  --attention-border: #dca84f;
  --danger: #ba4b45;
  --shadow: 0 18px 44px rgba(29, 48, 62, 0.11);
  --sidebar: 246px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #080909;
  --surface: #0d0f0f;
  --surface-strong: #141716;
  --ink: #f4f4ee;
  --muted: #a8ada6;
  --line: #30342f;
  --line-strong: #5b6158;
  --navy: #050606;
  --navy-2: #ffeb00;
  --cyan: #ffeb00;
  --cyan-bg: #373200;
  --amber: #ff9d00;
  --amber-bg: #3c2700;
  --violet: #9b9eed;
  --brand-hover: #fff45c;
  --brand-text: #ffeb00;
  --brand-soft: #2c2900;
  --brand-border: #d1bf00;
  --sidebar-bg: #050606;
  --sidebar-ink: #f4f4ee;
  --sidebar-muted: #a8ada6;
  --rack-bg: #080909;
  --rack-inset: #171a18;
  --rack-rail: #9d9b76;
  --rack-dash: #45473c;
  --row-bg: #141716;
  --row-border: #5a5b40;
  --table-head: #080909;
  --table-ink: #d8e1d0;
  --notice: #9b9eed;
  --signal-live: #ffeb00;
  --online-bg: #2c2900;
  --online-text: #fff25b;
  --online-border: #d1bf00;
  --attention-bg: #342300;
  --attention-text: #ffbd54;
  --attention-border: #9c6500;
  --shadow: 0 20px 54px rgba(0, 0, 0, .34);
}

html[data-tenant="rain"] {
  --paper: #edf7fa;
  --surface: #f8fcfd;
  --surface-strong: #ffffff;
  --ink: #0b2531;
  --muted: #52707c;
  --line: #c1dce5;
  --line-strong: #6eaec3;
  --navy: #06222d;
  --navy-2: #087da4;
  --cyan: #20add8;
  --cyan-bg: #d9f5ff;
  --brand: #53d3ff;
  --brand-hover: #79ddff;
  --brand-ink: #041117;
  --brand-text: #087a9e;
  --brand-soft: #d9f5ff;
  --brand-border: #20a9d4;
  --sidebar-bg: #04141b;
  --sidebar-ink: #eafaff;
  --sidebar-muted: #91b5c1;
  --rack-bg: #d7eaf0;
  --rack-inset: #e8f5f8;
  --rack-rail: #537b89;
  --rack-dash: #9fc4cf;
  --row-bg: #fbfeff;
  --row-border: #9bc9d8;
  --table-head: #dfedf2;
  --table-ink: #214653;
  --notice: #53d3ff;
  --signal-live: #27bce8;
  --online-bg: #d9f5ff;
  --online-text: #086887;
  --online-border: #20a9d4;
}

html[data-theme="dark"][data-tenant="rain"] {
  --paper: #040c10;
  --surface: #07151b;
  --surface-strong: #0b2028;
  --ink: #eafaff;
  --muted: #8db2bf;
  --line: #1e4553;
  --line-strong: #347b94;
  --navy: #02090c;
  --navy-2: #53d3ff;
  --cyan: #53d3ff;
  --cyan-bg: #073546;
  --brand: #53d3ff;
  --brand-hover: #82e2ff;
  --brand-ink: #041117;
  --brand-text: #53d3ff;
  --brand-soft: #073546;
  --brand-border: #39bce7;
  --sidebar-bg: #02090d;
  --sidebar-ink: #eafaff;
  --sidebar-muted: #86abb8;
  --rack-bg: #040c10;
  --rack-inset: #0c2028;
  --rack-rail: #79a7b6;
  --rack-dash: #244e5d;
  --row-bg: #0b2028;
  --row-border: #2b6579;
  --table-head: #040c10;
  --table-ink: #d7f4fc;
  --notice: #70dcff;
  --signal-live: #53d3ff;
  --online-bg: #073546;
  --online-text: #9be9ff;
  --online-border: #39bce7;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", "Source Han Sans TC UI", "Noto Sans TC", "Microsoft JhengHei UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.auth-loading { visibility: hidden; }

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 38%, transparent); outline-offset: 2px; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 14px; background: var(--ink); color: white; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 22px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: 1px solid rgba(255,255,255,.08);
  z-index: 20;
}

.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand-block strong { display: block; color: var(--brand); font: 400 20px/1 "NightCorp Display", "Segoe UI Variable", sans-serif; letter-spacing: .08em; }
.brand-block span { display: block; margin-top: 2px; color: var(--sidebar-muted); font: 700 9px/1.2 Consolas, monospace; letter-spacing: .16em; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }

.nav-list { display: grid; gap: 6px; margin-top: 26px; }
.nav-item { width: 100%; min-height: 46px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--sidebar-muted); text-align: left; cursor: pointer; }
.nav-item svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.is-active { background: var(--brand); color: var(--brand-ink); }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 10px; background: rgba(255,255,255,.12); font: 700 11px/1 Consolas, monospace; text-align: center; }
.nav-item.is-active .nav-count { background: color-mix(in srgb, var(--brand-ink) 13%, transparent); color: var(--brand-ink); }

.sidebar-foot { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.13); }
.demo-stamp { display: inline-block; padding: 5px 8px; color: var(--brand); border: 1px solid var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); font: 700 10px/1 Consolas, monospace; letter-spacing: .12em; }
.sidebar-foot p { margin: 10px 0 0; color: var(--sidebar-muted); font-size: 12px; line-height: 1.6; }
.account-button { margin-top: 12px; padding: 7px 0; border: 0; background: transparent; color: var(--sidebar-muted); font-size: 12px; cursor: pointer; }
.account-button:hover { color: var(--brand); }

.main-content { margin-left: var(--sidebar); padding: 34px clamp(22px, 3vw, 48px) 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.section-label { margin: 0 0 7px; color: var(--navy-2); font: 800 10px/1.2 Consolas, monospace; letter-spacing: .15em; }
h1, h2 { margin: 0; font-weight: 680; letter-spacing: -.025em; }
h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.12; }
h2 { font-size: 20px; line-height: 1.25; }
.subtitle { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; padding-top: 10px; }

.search-box { width: min(300px, 28vw); height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.search-box svg { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #7b8790; }
.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border-radius: 3px; cursor: pointer; font-size: 13px; font-weight: 800; letter-spacing: .02em; transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
.primary-button { border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent); }
.primary-button:hover { background: var(--brand-hover); border-color: var(--brand-hover); transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }
.primary-button:disabled { cursor: wait; opacity: .72; }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-button.is-loading svg { animation: spin .7s linear infinite; }
.secondary-button { border: 1px solid var(--brand-border); background: transparent; color: var(--brand-text); }
.secondary-button:hover { background: var(--brand); color: var(--brand-ink); transform: translateY(-1px); }
.secondary-button:active { transform: translateY(0); }
.theme-toggle { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--navy-2); cursor: pointer; }
.theme-toggle:hover { border-color: var(--line-strong); background: var(--surface-strong); }
.theme-toggle svg { grid-area: 1 / 1; width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.theme-toggle .sun-icon { display: none; }
html[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
html[data-theme="dark"] .theme-toggle .sun-icon { display: block; }

.status-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); }
.status-strip article { min-height: 88px; display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-right: 1px solid var(--line); }
.status-strip article:last-child { border-right: 0; }
.status-strip strong, .status-strip span { display: block; }
.status-strip strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.status-strip div > span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.status-lamp { width: 13px; height: 13px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(97,112,123,.12); }
.status-lamp.online { background: var(--signal-live); box-shadow: 0 0 0 5px color-mix(in srgb, var(--signal-live) 18%, transparent); animation: livePulse 1.65s cubic-bezier(.2,.7,.25,1) infinite; }
.status-lamp.discord { background: var(--notice); box-shadow: 0 0 0 5px color-mix(in srgb, var(--notice) 18%, transparent); }
.metric-icon { width: 36px; height: 36px; display: grid!important; place-items: center; border: 1px solid var(--brand-border); border-radius: 4px; background: var(--brand-soft); color: var(--brand-text); }
.metric-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metric-icon.amber { border-color: var(--attention-border); background: var(--attention-bg); color: var(--attention-text); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 20px; }
.rack-panel, .activity-panel, .device-section { background: var(--surface); border: 1px solid var(--line); }
.panel-heading { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { padding-inline: 18px; }
.panel-heading .section-label { margin-bottom: 5px; }

.filter-group { display: flex; gap: 4px; padding: 4px; background: color-mix(in srgb, var(--brand) 5%, var(--surface)); border: 1px solid var(--line); border-radius: 4px; }
.filter-button { min-width: 58px; min-height: 34px; padding: 0 13px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.filter-button:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-button.is-active { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(31,47,56,.16); }

.rack-frame { display: grid; grid-template-columns: 30px 1fr 30px; margin: 20px; border: 1px solid var(--line-strong); background: var(--rack-bg); box-shadow: inset 0 0 0 5px var(--rack-inset); }
.rack-rail { display: grid; grid-template-rows: repeat(4, 1fr); padding: 8px 0; color: var(--rack-rail); font: 700 8px/1 Consolas, monospace; text-align: center; }
.rack-rail span { display: grid; place-items: center; border-bottom: 1px dashed var(--rack-dash); }
.rack-rail span:last-child { border: 0; }
.tool-list { display: grid; gap: 7px; padding: 8px 0; }
.tool-unit { min-height: 76px; display: grid; grid-template-columns: 44px 13px minmax(180px, 1fr) 58px 92px 72px 18px; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--row-border); background: var(--row-bg); box-shadow: 0 2px 0 color-mix(in srgb, var(--navy) 8%, transparent); text-align: left; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.tool-unit:hover { border-color: var(--navy-2); transform: translateY(-1px); }
.tool-unit[hidden] { display: none; }
.unit-id { color: #66747d; font: 700 10px/1 Consolas, monospace; letter-spacing: .08em; }
.tool-led { width: 10px; height: 10px; border-radius: 50%; }
.tool-led.online { background: var(--signal-live); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal-live) 18%, transparent); animation: livePulse 1.65s cubic-bezier(.2,.7,.25,1) infinite; }
.tool-led.attention { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.tool-identity strong, .tool-identity small, .tool-metric small, .tool-metric strong { display: block; }
.tool-identity strong { font-size: 14px; }
.tool-identity small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.tool-metric { font-variant-numeric: tabular-nums; }
.tool-metric small { color: var(--muted); font-size: 9px; }
.tool-metric strong { margin-top: 5px; font-size: 11px; }
.tool-status, .table-status { display: inline-flex; align-items: center; justify-content: center; min-width: 72px; min-height: 30px; padding: 0 11px; border: 1px solid currentColor; border-radius: 3px; font-size: 11px; font-weight: 850; letter-spacing: .03em; white-space: nowrap; }
.tool-status.online, .table-status.online { border-color: var(--online-border); background: var(--online-bg); color: var(--online-text); }
.tool-status.attention, .table-status.attention { border-color: var(--attention-border); background: var(--attention-bg); color: var(--attention-text); }
.chevron { width: 16px; fill: none; stroke: #78868f; stroke-width: 2; }

.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--brand-border); background: transparent; color: var(--brand-text); border-radius: 50%; cursor: pointer; transition: background-color .15s ease, color .15s ease, transform .15s ease; }
.icon-button:hover { background: var(--brand); color: var(--brand-ink); transform: translateX(2px); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.activity-list { list-style: none; margin: 0; padding: 4px 18px 10px; }
.activity-list li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding: 17px 0; border-bottom: 1px solid #d9dee1; }
.activity-list li:last-child { border-bottom: 0; }
.activity-list li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 32px; bottom: -18px; width: 1px; background: #cbd2d6; }
.event-node { width: 11px; height: 11px; margin-top: 3px; border-radius: 50%; background: var(--muted); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--muted); z-index: 1; }
.event-node.online { background: var(--signal-live); box-shadow: 0 0 0 1px var(--signal-live); }
.event-node.discord { background: var(--notice); box-shadow: 0 0 0 1px var(--notice); }
.event-node.attention { background: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.activity-list strong { font-size: 13px; }
.activity-list p { margin: 5px 0 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.activity-list time { color: #7c8890; font: 700 9px/1 Consolas, monospace; text-transform: uppercase; }

.device-section { margin-top: 20px; }
.device-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th { height: 42px; padding: 0 20px; background: var(--table-head); color: var(--muted); font: 800 9px/1 Consolas, monospace; letter-spacing: .12em; text-align: left; }
td { height: 64px; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--table-ink); font-size: 12px; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.port-count { padding: 4px 6px; border: 1px solid #aeb9bf; color: var(--navy-2); font: 700 9px/1 Consolas, monospace; letter-spacing: .06em; }

.detail-drawer { position: fixed; inset: 0 0 0 auto; width: min(420px, 94vw); padding: 34px 30px; background: var(--surface-strong); box-shadow: -20px 0 60px rgba(20,37,48,.22); transform: translateX(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1); z-index: 60; overflow-y: auto; }
.detail-drawer.is-open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(17,31,41,.35); z-index: 50; }
.drawer-close { position: absolute; top: 22px; right: 22px; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; }
.drawer-close svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.drawer-summary { margin-top: 28px; padding: 18px; background: #edf1f2; border: 1px solid var(--line); }
.drawer-summary dl { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0; }
.drawer-summary dt { color: var(--muted); font-size: 10px; }
.drawer-summary dd { margin: 5px 0 0; font-size: 13px; font-weight: 700; }
.drawer-section { margin-top: 28px; }
.drawer-section h3 { margin: 0 0 12px; font-size: 14px; }
.drawer-section ul { margin: 0; padding: 0; list-style: none; }
.drawer-section li { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.drawer-section li span { color: var(--muted); }

.toast { position: fixed; right: 26px; bottom: 26px; padding: 13px 18px; background: var(--ink); color: white; border-radius: 4px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; z-index: 80; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: none; }

.license-console[hidden], .overview-surface[hidden], .hq-only[hidden] { display: none!important; }
.license-console { display: grid; gap: 20px; }
.console-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--brand-border); }
.license-workbench { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.operation-panel, .license-list-panel, .audit-panel { background: var(--surface); border: 1px solid var(--line); }
.operation-panel { padding: 20px; }
.operation-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.permission-chip { display: inline-flex; min-height: 26px; align-items: center; padding: 0 8px; border: 1px solid var(--brand-border); background: var(--brand-soft); color: var(--brand-text); font: 800 9px/1 Consolas, monospace; letter-spacing: .08em; white-space: nowrap; }
.operation-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.operation-form + .operation-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.operation-form label, .inline-select { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.operation-form label[hidden] { display: none!important; }
.operation-form input:not([type="checkbox"]), .operation-form select, .inline-select select { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface-strong); color: var(--ink); }
.operation-form input:focus, .operation-form select:focus, .inline-select select:focus { outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent); border-color: var(--brand-border); }
.operation-form button { align-self: end; }
.compact-form { grid-template-columns: minmax(0, 1.5fr) minmax(100px, .8fr) auto; }
.license-type-field { grid-column: 1 / -1; margin: 0; padding: 0; border: 0; }
.license-type-field legend { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.license-type-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 4px; border: 1px solid var(--line-strong); background: var(--surface-strong); }
.license-type-options label { position: relative; display: block; cursor: pointer; }
.license-type-options input { position: absolute; opacity: 0; pointer-events: none; }
.license-type-options span { display: grid; min-height: 52px; align-content: center; gap: 3px; padding: 7px 12px; border: 1px solid transparent; color: var(--muted); }
.license-type-options strong, .license-type-options small { display: block; }
.license-type-options strong { color: inherit; font-size: 12px; }
.license-type-options small { font-size: 9px; }
.license-type-options input:checked + span { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-text); box-shadow: inset 3px 0 0 var(--brand); }
.license-type-options input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent); }
.generated-keys { margin-top: 18px; padding: 14px; border: 1px solid var(--brand-border); background: var(--brand-soft); }
.generated-keys-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.generated-keys-heading strong, .generated-keys-heading span { display: block; }
.generated-keys-heading strong { margin-bottom: 4px; font-size: 13px; }
.generated-keys-heading span { color: var(--muted); font-size: 11px; }
.generated-key-actions, .generated-key-list li { display: flex; align-items: center; gap: 8px; }
.generated-key-actions { flex-wrap: wrap; justify-content: flex-end; }
.generated-key-actions button, .generated-key-list button { min-height: 34px; border: 1px solid var(--brand-border); background: var(--surface-raised); color: var(--brand-text); font-weight: 800; cursor: pointer; }
.generated-key-actions button { padding: 0 12px; }
.generated-key-actions button:first-child { background: var(--brand); color: var(--brand-ink); }
.generated-key-actions button:hover, .generated-key-list button:hover { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.generated-key-list { max-height: 260px; margin: 0; padding: 6px 0 0; overflow: auto; list-style-position: inside; }
.generated-key-list li { min-height: 42px; border-bottom: 1px solid var(--line); }
.generated-key-list li:last-child { border-bottom: 0; }
.generated-key-list code { flex: 1; min-width: 0; padding: 7px 0; color: var(--brand-text); font: 700 12px/1.4 Consolas, monospace; user-select: all; overflow-wrap: anywhere; }
.generated-key-list button { flex: 0 0 auto; padding: 0 14px; }
.inline-select { grid-template-columns: auto minmax(180px, 240px); align-items: center; }
.license-table-wrap { overflow-x: auto; }
.license-table { min-width: 1260px; }
.license-table td { height: 70px; }
.license-hint { color: var(--muted); font: 700 11px/1 Consolas, monospace; }
.license-key-cell { min-width: 300px; }
.license-key-cell code { display: block; margin-bottom: 8px; color: var(--brand-text); font: 700 11px/1.4 Consolas, monospace; user-select: all; }
.license-key-cell small { display: block; margin-top: 5px; color: var(--muted); }
.key-copy-button, .license-note-cell button { min-height: 28px; padding: 0 9px; border: 1px solid var(--brand-border); background: var(--brand-soft); color: var(--brand-text); font-size: 10px; font-weight: 800; cursor: pointer; }
.key-copy-button:hover, .license-note-cell button:hover { background: var(--brand); color: var(--brand-ink); }
.license-note-cell { min-width: 150px; }
.license-note-display[hidden], .license-note-editor[hidden] { display: none!important; }
.license-note-display span { display: block; max-width: 220px; margin-bottom: 7px; overflow-wrap: anywhere; }
.license-note-editor { display: grid; min-width: 220px; gap: 7px; }
.license-note-editor input { width: 100%; min-height: 34px; padding: 0 9px; border: 1px solid var(--brand-border); border-radius: 3px; background: var(--surface-strong); color: var(--ink); font-size: 11px; }
.license-note-editor input:focus { outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent); }
.license-note-editor div { display: flex; gap: 6px; }
.license-note-editor .note-save-button { background: var(--brand); color: var(--brand-ink); }
.license-expiry strong, .license-expiry small { display: block; }
.license-expiry small { margin-top: 5px; color: var(--muted); }
.license-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 250px; }
.action-button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 3px; background: transparent; color: var(--ink); font-size: 10px; font-weight: 800; cursor: pointer; }
.action-button:hover { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand-text); }
.action-button.danger { border-color: color-mix(in srgb, var(--danger) 62%, var(--line)); color: var(--danger); }
.action-button.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.empty-cell { padding: 28px!important; color: var(--muted)!important; text-align: center; }
.audit-list { list-style: none; margin: 0; padding: 0 20px 8px; }
.audit-list li:not(.empty-cell) { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(180px, 1fr) auto; gap: 18px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.audit-list li:last-child { border-bottom: 0; }
.audit-list strong, .audit-list span, .audit-list time { font-size: 11px; }
.audit-list span, .audit-list time { color: var(--muted); }
.audit-list time { font: 700 9px/1.3 Consolas, monospace; text-align: right; }

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal-live) 58%, transparent), 0 0 8px color-mix(in srgb, var(--signal-live) 24%, transparent); }
  55% { box-shadow: 0 0 0 7px transparent, 0 0 14px color-mix(in srgb, var(--signal-live) 42%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .status-lamp.online,
  .tool-led.online { animation: none; }
}

html[data-theme="dark"] body { background-image: linear-gradient(color-mix(in srgb, var(--brand) 2%, transparent) 1px, transparent 1px); background-size: 100% 32px; }
html[data-theme="dark"] .status-strip,
html[data-theme="dark"] .rack-panel,
html[data-theme="dark"] .activity-panel,
html[data-theme="dark"] .device-section { border-color: var(--brand-border); }
html[data-theme="dark"] .panel-heading { border-color: color-mix(in srgb, var(--brand-border) 46%, var(--line)); }
html[data-theme="dark"] .nav-item.is-active { background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .nav-item.is-active .nav-count { background: rgba(0,0,0,.16); color: #111; }
html[data-theme="dark"] .metric-icon { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); color: var(--brand); }
html[data-theme="dark"] .metric-icon.amber { background: var(--attention-bg); color: var(--attention-text); }
html[data-theme="dark"] .filter-group { background: #10181e; border-color: var(--line); }
html[data-theme="dark"] .filter-button.is-active { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .icon-button { color: var(--brand); }
html[data-theme="dark"] .rack-frame { background: var(--rack-bg); box-shadow: inset 0 0 0 5px var(--rack-inset); }
html[data-theme="dark"] .rack-rail { color: var(--rack-rail); }
html[data-theme="dark"] .rack-rail span { border-color: var(--rack-dash); }
html[data-theme="dark"] .tool-unit { background: var(--row-bg); border-color: var(--row-border); box-shadow: 0 2px 0 rgba(0,0,0,.22); }
html[data-theme="dark"] .tool-unit:hover { border-color: var(--brand); }
html[data-theme="dark"] .chevron { stroke: #9dabb3; }
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] .secondary-button:hover { background: var(--brand); color: var(--brand-ink); }
html[data-theme="dark"] .activity-list li { border-color: var(--line); }
html[data-theme="dark"] .activity-list li:not(:last-child)::before { background: #43515a; }
html[data-theme="dark"] th { background: var(--table-head); color: var(--muted); }
html[data-theme="dark"] td { color: var(--table-ink); border-color: var(--line); }
html[data-theme="dark"] .port-count { border-color: var(--brand-border); color: var(--brand); }
html[data-theme="dark"] .drawer-summary { background: #080909; border-color: var(--line); }
html[data-theme="dark"] .drawer-close { background: var(--surface-strong); }
html[data-theme="dark"] .drawer-section li { border-color: var(--line); }
html[data-theme="dark"] .drawer-backdrop { background: rgba(0, 0, 0, .58); }
html[data-theme="dark"] .toast { background: #e6eef1; color: #17202a; }

@media (max-width: 1280px) {
  :root { --sidebar: 82px; }
  .sidebar { padding-inline: 12px; }
  .brand-block { justify-content: center; padding-inline: 0; }
  .brand-block > div, .nav-item > span, .sidebar-foot p { display: none; }
  .nav-item { grid-template-columns: 1fr; place-items: center; padding: 0; }
  .sidebar-foot { padding-inline: 0; text-align: center; }
  .demo-stamp { writing-mode: vertical-rl; padding: 7px 5px; }
  .tool-unit { grid-template-columns: 40px 12px minmax(170px, 1fr) 60px 72px 18px; }
  .tool-metric:nth-of-type(5) { display: none; }
}

@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .sidebar { position: sticky; top: 0; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; z-index: 30; }
  .brand-block { padding: 0 14px 0 0; border: 0; border-right: 1px solid rgba(255,255,255,.13); }
  .brand-logo { width: 32px; height: 32px; }
  .nav-list { display: flex; flex: 1; justify-content: space-around; margin: 0; gap: 4px; }
  .nav-item { width: 44px; min-height: 42px; }
  .sidebar-foot { display: none; }
  .main-content { margin-left: 0; padding: 24px 16px 46px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar-actions { padding-top: 0; }
  .search-box { width: 100%; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip article:nth-child(2) { border-right: 0; }
  .status-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .license-workbench { grid-template-columns: 1fr; }
  .console-heading { flex-direction: column; }
}

@media (max-width: 600px) {
  .main-content { padding-inline: 12px; }
  h1 { font-size: 27px; }
  .topbar-actions { display: grid; grid-template-columns: 1fr auto auto; }
  .theme-toggle { grid-column: 2; }
  .primary-button { width: 44px; padding: 0; }
  .primary-button { grid-column: 3; }
  .primary-button span { display: none; }
  .status-strip article { min-height: 76px; padding: 14px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading.compact { flex-direction: row; align-items: center; }
  .rack-frame { grid-template-columns: 20px 1fr 20px; margin: 12px; }
  .tool-unit { grid-template-columns: 34px 10px 1fr 66px 16px; gap: 8px; padding: 10px; }
  .tool-metric { display: none; }
  .tool-status { grid-column: 4; grid-row: 1; }
  .chevron { grid-column: 5; }
  .tool-identity small { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .operation-form, .compact-form { grid-template-columns: 1fr; }
  .inline-select { grid-template-columns: 1fr; }
  .generated-keys-heading { align-items: stretch; flex-direction: column; }
  .generated-key-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .generated-key-actions button:first-child { grid-column: 1 / -1; }
  .audit-list li:not(.empty-cell) { grid-template-columns: 1fr; gap: 6px; }
  .audit-list time { text-align: left; }
}

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