:root {
  color-scheme: light;
  --canvas: #eef2f3;
  --surface: #f7f9f9;
  --panel: #ffffff;
  --nav: #0d151b;
  --nav-raised: #152129;
  --text: #172129;
  --muted: #687781;
  --line: #d8e1e3;
  --line-strong: #c5d1d4;
  --accent: #0b806f;
  --accent-strong: #076656;
  --accent-soft: #e5f5f1;
  --cyan: #177da5;
  --amber: #a96612;
  --danger: #b83b3b;
  --sidebar-width: 238px;
}

* { box-sizing: border-box; }
html { background: var(--nav); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
button, input, select, textarea { letter-spacing: 0; }
button, .button, a, input, select, textarea { transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
button:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(11, 128, 111, 0.36);
  outline-offset: 2px;
}
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  background: #edf2f3;
  border: 1px solid #e0e7e9;
  border-radius: 4px;
  padding: 2px 5px;
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  height: 100vh;
  flex-direction: column;
  background: var(--nav);
  border-right: 1px solid #233139;
  color: #e8f0f2;
}
.brand {
  display: flex;
  min-height: 84px;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  color: #f3f7f8;
}
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #2ba28f;
  border-radius: 6px;
  background: #10241f;
  color: #59d1bd;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 20px;
  font-weight: 800;
}
.brand-copy { display: grid; min-width: 0; gap: 1px; }
.brand-copy strong { font-size: 15px; font-weight: 760; color: #fff; }
.brand-copy small {
  color: #82929a;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0;
}
.primary-nav {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
  border-top: 1px solid #1d2a31;
}
.primary-nav a {
  position: relative;
  display: grid;
  min-height: 44px;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  padding: 0 12px;
  color: #9dabb2;
  font-weight: 600;
}
.primary-nav a:hover { background: #142028; color: #e8eff1; }
.primary-nav a.active { background: #132a27; color: #76d9c8; }
.primary-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 0 2px 2px 0;
  background: #39bba5;
}
.nav-index {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  color: #52636c;
}
.primary-nav a.active .nav-index { color: #39bba5; }
.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: auto 14px 16px;
  border-top: 1px solid #25323a;
  padding: 16px 8px 0;
}
.sidebar-status > div { display: grid; }
.sidebar-status strong { color: #adbbc1; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.sidebar-status small { color: #65757d; font-size: 11px; }
.live-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #42c9a8;
  box-shadow: 0 0 0 4px rgba(66, 201, 168, 0.1);
  animation: live-pulse 2.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(66, 201, 168, 0.08); }
  50% { box-shadow: 0 0 0 7px rgba(66, 201, 168, 0.16); }
}

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); background: var(--surface); }
.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  height: 54px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 249, 249, 0.96);
  padding: 0 30px;
}
.workspace-context, .account-menu { display: flex; align-items: center; gap: 10px; }
.workspace-context {
  color: #708089;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}
.context-mark { width: 18px; height: 1px; background: var(--accent); }
.account-menu { color: #697981; font-size: 12px; }
.account-menu a {
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  color: #34444c;
  font-weight: 700;
}
.page { width: 100%; max-width: 1540px; margin: 0 auto; padding: 30px 32px 44px; }

.title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 27px; line-height: 1.2; font-weight: 760; }
h2 { margin-bottom: 14px; font-size: 17px; font-weight: 720; }
p { margin: 6px 0 0; color: var(--muted); }
.title-row p { max-width: 680px; }
.create-action { min-width: 118px; }

.account-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 22px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: #f2f6f6;
}
.account-overview > div {
  position: relative;
  display: grid;
  min-height: 104px;
  align-content: center;
  gap: 3px;
  padding: 17px 24px;
}
.account-overview > div + div { border-left: 1px solid var(--line); }
.account-overview span { color: #586870; font-size: 12px; font-weight: 700; }
.account-overview strong { color: #142028; font-family: "SFMono-Regular", Consolas, monospace; font-size: 25px; line-height: 1.15; }
.account-overview small { color: #87949b; font-size: 11px; }
.attribution-node { padding-top: 4px; }
.attribution-node-separated { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 28px; }
.attribution-node-heading { align-items: end; display: flex; justify-content: space-between; margin-bottom: 14px; }
.attribution-node-heading h3 { font-size: 18px; margin: 0; }
.attribution-node-heading span { color: #6f7f87; font-size: 13px; }
.attribution-note, .attribution-warning {
  margin: -8px 0 16px;
  border-left: 3px solid var(--accent);
  background: #f2f8f7;
  color: #52666d;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
}
.attribution-warning { border-left-color: var(--amber); background: #fff9ed; }

.audit-boundary {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  margin: 0 0 22px;
  border-left: 3px solid var(--accent);
  background: #edf7f4;
  padding: 13px 16px;
  color: #53676f;
  font-size: 12px;
  line-height: 1.7;
}
.audit-boundary strong { color: #173c38; }
.audit-filter-panel { padding: 16px 18px; }
.audit-filter-form {
  display: grid;
  grid-template-columns: 150px 150px minmax(190px, 1fr) minmax(190px, 1fr) minmax(220px, 1.25fr) auto;
  align-items: end;
  gap: 12px;
}
.audit-filter-actions { display: flex; gap: 8px; }
.audit-filter-actions button, .audit-filter-actions .button { min-height: 40px; white-space: nowrap; }
.audit-table td { vertical-align: middle; }
.audit-table td > small, .audit-destination small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.audit-destination strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.audit-count { font-family: "SFMono-Regular", Consolas, monospace; font-weight: 800; }
.audit-footnote { margin: 12px 2px 0; color: #74838b; font-size: 11px; line-height: 1.7; }

.panel, .auth-panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
}
.table-panel { overflow: hidden; padding: 0; }
.table-toolbar {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: #fbfcfc;
}
.account-search-form {
  display: grid;
  grid-template-columns: minmax(250px, 390px) auto auto;
  gap: 8px;
}
.account-search-form input { background: #fff; }
.result-count { color: #839097; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.result-count strong { color: #2b3a42; font-size: 13px; }

.team-report-head, .team-report > summary {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(160px, 1.45fr) 80px 80px 80px minmax(130px, 1fr) 120px 52px;
  align-items: center;
  gap: 14px;
}
.team-report-head {
  border-bottom: 1px solid var(--line);
  background: #f3f6f6;
  padding: 10px 18px;
  color: #77858d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.team-report { border-bottom: 1px solid var(--line); }
.team-report:last-child { border-bottom: 0; }
.team-report > summary {
  min-height: 86px;
  padding: 13px 18px;
  cursor: pointer;
  list-style: none;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.team-report > summary::-webkit-details-marker { display: none; }
.team-report > summary:hover { background: #f5faf9; box-shadow: inset 3px 0 0 #38a993; }
.team-report[open] > summary { background: #edf7f4; box-shadow: inset 3px 0 0 var(--accent); }
.team-identity { display: flex; min-width: 0; align-items: center; gap: 11px; }
.team-domain-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9d9d2;
  border-radius: 6px;
  background: #e7f4f1;
  color: #08715f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
}
.team-identity > span:last-child, .team-stat { display: grid; min-width: 0; }
.team-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.team-identity small, .team-stat small, .team-stat em, .team-toggle small { color: #839097; font-size: 10px; font-style: normal; }
.team-stat small { display: none; }
.team-stat strong { color: #26353d; font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; }
.team-stat em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-time { font-size: 11px !important; }
.team-toggle { display: grid; justify-items: center; gap: 5px; color: var(--accent); }
.team-toggle i {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 170ms ease;
}
.team-report[open] .team-toggle i { transform: rotate(225deg); }
.team-members { border-top: 1px solid var(--line); background: #f7f9f9; padding: 0 16px 16px; }
.team-members-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 2px; }
.team-members-heading strong { font-size: 12px; }
.team-members-heading span { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.team-members .account-table { overflow: hidden; border: 1px solid var(--line); background: #fff; }
.team-empty { display: grid; place-items: center; }

table { width: 100%; border-collapse: collapse; }
th, td {
  border-bottom: 1px solid #e2e8ea;
  padding: 13px 14px;
  text-align: left;
  vertical-align: middle;
}
th {
  background: #f3f6f6;
  color: #77858d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
tbody tr { transition: background-color 140ms ease, box-shadow 140ms ease; }
tbody tr:hover { background: #f5faf9; box-shadow: inset 3px 0 0 #38a993; }
tbody tr:last-child td { border-bottom: 0; }
.account-table { table-layout: fixed; }
.account-table th:nth-child(1) { width: 25%; }
.account-table th:nth-child(2) { width: 12%; }
.account-table th:nth-child(3) { width: 17%; }
.account-table th:nth-child(4) { width: 11%; }
.account-table th:nth-child(5) { width: 15%; }
.account-table th:nth-child(6) { width: 14%; }
.account-table th:nth-child(7) { width: 6%; }
.identity-cell { display: flex; min-width: 0; align-items: center; gap: 11px; }
.identity-avatar {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b9d9d2;
  border-radius: 6px;
  background: #e7f4f1;
  color: #08715f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
}
.identity-cell > span:last-child { display: grid; min-width: 0; }
.identity-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.identity-cell small, .cell-meta { display: block; overflow: hidden; color: #839097; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.state-stack { display: grid; justify-items: start; gap: 6px; }
.role-label { color: #40515a; font-size: 11px; font-weight: 750; }
.resource-cell { display: flex; gap: 18px; }
.resource-cell > span { display: grid; }
.resource-cell strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; }
.resource-cell small { color: #849198; font-size: 10px; }
.traffic-value, .login-time { display: block; color: #26353d; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.row-action { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-size: 12px; font-weight: 750; }
.row-action span { font-size: 18px; line-height: 1; transition: transform 150ms ease; }
.row-action:hover span { transform: translateX(2px); }
.empty-state { height: 150px; color: var(--muted); text-align: center; }
.muted { color: var(--muted); font-size: 12px; }

.health-table-wrap { overflow-x: auto; }
.health-table { min-width: 1040px; table-layout: fixed; }
.health-table th:first-child { width: 22%; }
.health-table th:not(:first-child) { width: 26%; }
.health-table td { vertical-align: top; }
.health-node-cell, .health-probe-cell { height: 148px; }
.health-node-cell { display: grid; align-content: start; justify-items: start; gap: 9px; }
.health-node-cell > strong { font-size: 14px; }
.health-node-cell > small { color: var(--muted); line-height: 1.4; }
.health-probe-cell { min-width: 250px; }
.health-probe-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.health-probe-head strong { font-size: 12px; }
.health-primary { margin-bottom: 5px; color: #26353d; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 700; }
.health-meta, .health-message, .health-time { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.health-message { color: var(--amber); }
.health-time { margin-top: 10px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.health-empty { display: grid; min-height: 108px; place-items: center; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 12px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}
.metrics div { display: grid; gap: 3px; padding: 18px 22px; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 25px; }
.metrics span { color: var(--muted); font-size: 12px; }

.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: #34454d; font-size: 12px; font-weight: 700; }
label.inline { display: flex; align-items: center; align-self: end; gap: 8px; }
label small { color: var(--muted); font-size: 11px; font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}
input:hover, select:hover, textarea:hover { border-color: #9eb4b8; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(11, 128, 111, 0.1); }
textarea { min-height: 86px; font-family: "SFMono-Regular", Consolas, monospace; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.check-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.check-list label { display: flex; align-items: center; gap: 8px; }
.check-list input { width: auto; min-height: auto; accent-color: var(--accent); }
.check-list span { color: var(--muted); font-weight: 400; }

.node-state-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.node-toggle { display: flex; min-height: 62px; align-items: center; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 2px; cursor: pointer; }
.node-toggle input, .assignment-account input { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; accent-color: var(--accent); }
.node-toggle > span { display: grid; gap: 2px; }
.node-toggle strong { color: var(--text); font-size: 12px; }
.node-toggle small { color: var(--muted); font-size: 10px; font-weight: 400; }
.node-assignment-section { margin-top: 4px; border-top: 1px solid var(--line-strong); padding-top: 20px; }
.assignment-total { align-self: start; color: var(--accent); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.assignment-total span { font-size: 20px; }
.assignment-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; align-items: center; gap: 10px; margin: 14px 0 12px; }
.assignment-search input { min-height: 42px; }
.assignment-actions { display: flex; gap: 8px; }
.assignment-result-count { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; white-space: nowrap; }
.assignment-list { display: grid; max-height: 390px; overflow-y: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.assignment-account { display: grid; min-width: 0; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 11px 8px; cursor: pointer; }
.assignment-account[hidden] { display: none; }
.assignment-account:nth-child(odd) { border-right: 1px solid var(--line); }
.assignment-account:hover { background: #f5faf9; }
.assignment-avatar { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border: 1px solid #b9d9d2; border-radius: 5px; background: #e7f4f1; color: #08715f; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; font-weight: 800; }
.assignment-identity { display: grid; min-width: 0; gap: 1px; }
.assignment-identity strong, .assignment-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-identity strong { color: var(--text); font-size: 12px; }
.assignment-identity small { color: var(--muted); font-size: 10px; font-weight: 400; }
.assignment-badges { display: flex; gap: 4px; }
.assignment-badges em { border-radius: 999px; background: #e9f1f7; color: var(--cyan); padding: 2px 6px; font-size: 9px; font-style: normal; font-weight: 750; white-space: nowrap; }
.assignment-badges em.disabled { background: #fff0ef; color: var(--danger); }
.assignment-no-results { color: var(--muted); padding: 18px 8px; text-align: center; }

button, .button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: #293941;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
button:hover, .button:hover { border-color: #9fb3b7; background: #f4f7f7; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: #fff; }
.actions { display: flex; align-items: center; gap: 9px; }
.template-actions { margin-bottom: 10px; }
.device-create-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 14px; }
.source-create-form { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.6fr) auto; align-items: end; gap: 12px; margin: 16px 0 20px; }

.flash {
  position: relative;
  margin-bottom: 18px;
  border: 1px solid #e3c88c;
  border-left: 3px solid var(--amber);
  border-radius: 6px;
  background: #fffaf0;
  color: #785018;
  padding: 11px 14px;
}
.status, .traffic-status, .tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.status { background: #e7f6f1; color: #08725f; }
.status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.disabled, .status.expiry-expired { background: #fff0ef; color: var(--danger); }
.status.expiry-permanent { background: #eef2f3; color: #596970; }
.status.expiry-today { background: #fff6e5; color: var(--amber); }
.traffic-status { background: #e7f6f1; color: #08725f; }
.traffic-status.warn { background: #fff6e5; color: var(--amber); }
.traffic-status.critical, .traffic-status.monitor_error { background: #fff0ef; color: var(--danger); }
.traffic-status.stale { background: #edf0f2; color: #59666d; }
.tag { margin-left: 4px; background: #e9f1f7; color: var(--cyan); }
.danger-button { border-color: #ecc7c7; color: var(--danger); }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding: 14px 18px; }
.pagination span { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.subscription-list { display: grid; gap: 12px; }
.data-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
.subscription-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.subscription-item:last-child { border-bottom: 0; padding-bottom: 0; }
.subscription-main { display: grid; min-width: 0; gap: 8px; }
.subscription-main strong { font-size: 13px; }
.subscription-main input, .client-link-row input { font-family: "SFMono-Regular", Consolas, monospace; }
.subscription-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.device-card { align-items: stretch; }
.device-card-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.device-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; }
.client-link-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.client-link-label { display: grid; gap: 4px; min-width: 0; }
.client-link-label span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.delete-device-form { display: flex; align-items: flex-start; justify-content: flex-end; }
.qr-details { position: relative; }
.qr-details summary { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; padding: 8px 13px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; }
.qr-details summary::-webkit-details-marker { display: none; }
.qr-panel { position: absolute; right: 0; top: 44px; z-index: 3; width: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 14px 30px rgba(13, 21, 27, .15); padding: 12px; }
.qr-panel img { display: block; width: 196px; height: 196px; }
.client-download-list { display: grid; }
.client-download-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, auto); align-items: center; gap: 18px; border-bottom: 1px solid var(--line); padding: 16px 0; }
.client-download-row:last-child { border-bottom: 0; padding-bottom: 0; }
.client-download-info { display: grid; gap: 4px; }
.client-download-info > span { color: var(--muted); font-size: 11px; }
.client-download-info p { margin: 0; }
.client-download-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.guest-body { min-height: 100vh; background: #111a20; }
.guest-header { height: 76px; border-bottom: 1px solid var(--line); background: #ffffff; }
.guest-header .brand { width: fit-content; min-height: 76px; }
.guest-header .brand-copy strong { color: var(--text-strong); }
.guest-header .brand-copy small { color: var(--muted); }
.auth-page { width: min(100% - 32px, 430px); margin: 0 auto; padding: 72px 0; }
.auth-panel { position: relative; margin: 0; border-color: #dce5e7; box-shadow: 0 20px 60px rgba(0, 0, 0, .22); padding: 28px; }
.auth-panel::before { content: ""; position: absolute; top: 0; left: 28px; width: 54px; height: 3px; background: var(--accent); }
.auth-panel h1 { margin-bottom: 22px; }

@media (max-width: 1040px) {
  :root { --sidebar-width: 204px; }
  .page { padding-inline: 22px; }
  .account-table { min-width: 980px; table-layout: fixed; }
  .table-panel { overflow-x: auto; }
}

@media (max-width: 760px) {
  html, body { background: var(--surface); }
  .sidebar { position: relative; width: 100%; height: auto; border-right: 0; }
  .brand { min-height: 64px; padding: 0 16px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .primary-nav { display: flex; overflow-x: auto; border-top: 1px solid #1f2c33; padding: 8px 10px 10px; scrollbar-width: none; }
  .primary-nav::-webkit-scrollbar { display: none; }
  .primary-nav a { min-width: max-content; min-height: 40px; grid-template-columns: auto auto; padding: 0 12px; }
  .primary-nav a.active::before { inset: auto 12px 0; width: auto; height: 2px; border-radius: 2px 2px 0 0; }
  .nav-index { display: none; }
  .sidebar-status { display: none; }
  .workspace { margin-left: 0; }
  .workspace-topbar { height: 44px; padding: 0 16px; }
  .workspace-context { display: none; }
  .account-menu { width: 100%; justify-content: space-between; }
  .page { padding: 20px 14px 36px; }
  .title-row { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 20px; }
  h1 { font-size: 24px; }
  .account-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-overview > div { min-height: 88px; padding: 14px 16px; }
  .account-overview > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .account-overview > div:nth-child(4) { border-top: 1px solid var(--line); }
  .account-overview strong { font-size: 21px; }
  .panel, .auth-panel { padding: 16px; }
  .table-panel { padding: 0; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .team-report-head { display: none; }
  .team-report > summary {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    padding: 15px 14px;
  }
  .team-identity { grid-column: 1 / -1; }
  .team-stat { align-content: start; border-top: 1px solid #dfe9e7; padding-top: 10px; }
  .team-stat small { display: block; margin-bottom: 2px; }
  .team-stat em { white-space: normal; }
  .team-toggle { grid-column: 1 / -1; grid-template-columns: auto auto; justify-content: center; justify-items: initial; padding-top: 2px; }
  .team-report[open] .team-toggle i { transform: rotate(225deg) translate(-2px, -2px); }
  .team-members { padding: 0; }
  .team-members-heading { align-items: flex-start; flex-direction: column; gap: 2px; padding: 13px 14px; }
  .team-members .account-table { border: 0; border-top: 1px solid var(--line); }
  .account-search-form, .form-grid, .check-list, .subscription-item, .device-create-form, .client-link-row, .source-create-form, .client-download-row, .node-state-row, .assignment-toolbar, .assignment-list { grid-template-columns: 1fr; }
  .audit-boundary, .audit-filter-form { grid-template-columns: 1fr; }
  .audit-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .assignment-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .assignment-account:nth-child(odd) { border-right: 0; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  button, .button, .qr-details summary { width: 100%; min-height: 44px; }
  .actions { width: 100%; align-items: stretch; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div { border-bottom: 1px solid var(--line); }
  .metrics div + div { border-left: 0; }
  .metrics div:nth-child(even) { border-left: 1px solid var(--line); }
  .subscription-item { gap: 14px; padding-bottom: 16px; }
  .delete-device-form { justify-content: stretch; }
  .subscription-actions { display: grid; width: 100%; grid-template-columns: 1fr; justify-content: stretch; }
  .qr-details { width: 100%; }
  .qr-panel {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }
  .qr-panel img { width: min(240px, 100%); height: auto; margin: 0 auto; }
  .client-download-actions { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .pagination { align-items: stretch; flex-direction: column; }
  table { width: max-content; min-width: 100%; }
  th, td { white-space: nowrap; }
  .account-table { display: block; width: 100%; min-width: 0; table-layout: auto; }
  .account-table thead { display: none; }
  .account-table tbody { display: grid; gap: 10px; padding: 10px 12px 14px; }
  .account-table tr {
    display: grid;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
  }
  .account-table td {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    padding: 11px 12px;
    white-space: normal;
  }
  .account-table td::before {
    content: attr(data-label);
    color: #87949b;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
  }
  .account-table td:first-child { display: block; grid-column: 1 / -1; background: #f7faf9; padding: 14px; }
  .account-table td:first-child::before, .account-table td:last-child::before { display: none; }
  .account-table td:nth-child(even):not(:last-child) { border-right: 1px solid var(--line); }
  .account-table td:nth-child(6), .account-table td:last-child { grid-column: 1 / -1; }
  .account-table td:last-child { border-bottom: 0; padding: 0; }
  .account-table .cell-meta, .account-table .identity-cell small { white-space: normal; }
  .account-table .row-action { width: 100%; min-height: 42px; justify-content: center; background: #f1f7f5; }
  .auth-page { padding: 38px 0; }
}

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