:root {
  --background: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-sunken: #eef1f5;
  --text: #1f2937;
  --text-strong: #344054;
  --text-muted: #475467;
  --text-secondary: #667085;
  --text-tertiary: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --primary-chip: #dbeafe;
  --primary-contrast: #ffffff;
  --toggle-knob: #ffffff;
  --success: #16803c;
  --success-soft: #ecfdf3;
  --success-chip: #dcfce7;
  --danger: #c4322b;
  --danger-soft: #fef3f2;
  --warning: #9a6700;
  --warning-soft: #fff8db;
  --warning-surface: #fffcf2;
  --focus-ring: rgba(37, 99, 235, .12);
  --backdrop: rgba(15, 23, 42, .42);
  --panel: var(--surface);
  --muted: var(--text-secondary);
  --accent: var(--primary);
  --warn: var(--warning);
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --floating-shadow: 0 8px 24px rgba(16, 24, 40, .16);
}

:root[data-theme="dark"] {
  --background: #0b111b;
  --surface: #121b29;
  --surface-muted: #172231;
  --surface-hover: #1d2a3b;
  --surface-sunken: #0f1724;
  --text: #e7edf6;
  --text-strong: #d5deea;
  --text-muted: #b4c0d0;
  --text-secondary: #8f9db2;
  --text-tertiary: #728197;
  --border: #263449;
  --border-strong: #3a4b63;
  --primary: #75a7ff;
  --primary-hover: #91b9ff;
  --primary-soft: #172b4d;
  --primary-border: #31558e;
  --primary-chip: #1c365f;
  --primary-contrast: #09111d;
  --toggle-knob: #dce6f3;
  --success: #4ade80;
  --success-soft: #123422;
  --success-chip: #163c29;
  --danger: #fb7185;
  --danger-soft: #3b1821;
  --warning: #f5c451;
  --warning-soft: #3a2d12;
  --warning-surface: #292313;
  --focus-ring: rgba(117, 167, 255, .2);
  --backdrop: rgba(2, 6, 15, .72);
  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 10px 30px rgba(0, 0, 0, .12);
  --floating-shadow: 0 12px 32px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { background: var(--background); color: var(--text); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.grain { display: none; }
.hidden { display: none !important; }

.shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0 0 48px;
}

.masthead {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
}
.masthead-brand { display: flex; flex: 0 0 auto; align-items: baseline; gap: 12px; }
h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -.01em;
  font-weight: 650;
}
h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -.01em;
  font-weight: 650;
}
h3 { font-size: 16px; }
.eyebrow {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.status-rail { display: flex; align-items: center; gap: 9px; color: var(--text-secondary); font-size: 13px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.health-dot.ok { background: #22a559; }
.theme-toggle { display: inline-flex; min-height: 32px; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-secondary); font-size: 11px; font-weight: 600; transition: color .15s, border-color .15s, background .15s; }
.theme-toggle:hover { border-color: var(--primary); background: var(--surface-muted); color: var(--text); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-toggle-icon { position: relative; width: 13px; height: 13px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 50%; }
.theme-toggle-icon::before, .theme-toggle-icon::after { content: ""; position: absolute; inset: -4px 5px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.theme-toggle-icon::after { transform: rotate(90deg); }
[data-theme="dark"] .theme-toggle-icon { border: 0; background: var(--primary); }
[data-theme="dark"] .theme-toggle-icon::before { display: block; inset: -2px auto auto 5px; width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--surface); }
[data-theme="dark"] .theme-toggle-icon::after { display: none; }

.login-panel {
  min-height: calc(100vh - 116px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 80px;
  align-items: center;
  max-width: 920px;
  margin: 0 auto;
}
.auth-loading {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
}
.loading-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); animation: loading-pulse 1.2s ease-in-out infinite; }
@keyframes loading-pulse { 50% { opacity: .35; transform: scale(.8); } }
.login-copy h2 { max-width: 560px; margin-top: 10px; font-size: 32px; line-height: 1.3; }
.login-copy p:last-child { max-width: 560px; margin: 18px 0 0; color: var(--text-secondary); line-height: 1.7; }

.form-card, .panel, dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-card { padding: 28px; display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: var(--text-strong); font-size: 13px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
textarea { resize: vertical; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; line-height: 1.55; }

.primary, .ghost {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}
.primary { background: var(--primary); color: var(--primary-contrast); }
.primary:hover { background: var(--primary-hover); }
.primary:disabled { cursor: not-allowed; opacity: .45; }
.ghost { border-color: var(--border-strong); background: var(--surface); color: var(--text-strong); }
.ghost:hover { background: var(--surface-muted); border-color: var(--text-tertiary); }
.error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.form-hint { margin: -4px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }

.tabs { display: flex; gap: 24px; padding: 0; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 15px 2px 13px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab.active { border-color: var(--primary); color: var(--primary); }
.header-tabs { min-height: 68px; align-self: stretch; margin: 0 auto 0 28px; border: 0; }
.header-tabs .tab { min-height: 68px; padding: 2px 2px 0; }

.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.list { display: grid; }
.list-item { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--border); color: var(--text-strong); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.status-bar-panel { margin-bottom: 0; padding: 16px 18px 12px; background: linear-gradient(135deg, var(--surface) 0%, var(--surface-muted) 100%); }
.status-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.status-bar-head h2 { margin-top: 2px; font-size: 16px; }
.status-bar-actions { display: flex; align-items: center; gap: 10px; }
.sample-time { color: var(--text-secondary); font-size: 10px; text-align: right; }
.status-bar { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(420px, 1fr); gap: 0 12px; }
.status-resource-grid { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.status-resource { min-width: 0; padding: 9px 11px; border-radius: 7px; background: var(--surface); }
.status-resource:first-child { padding-left: 11px; }
.status-resource > span, .status-resource small, .status-business small { display: block; color: var(--text-secondary); font-size: 10px; }
.status-resource strong { display: block; margin: 3px 0; overflow: hidden; color: var(--text-strong); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.status-business-grid { min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.status-business { min-width: 0; padding: 8px 10px; border: 0; border-radius: 7px; background: var(--surface); color: inherit; text-align: left; }
.status-business:is(button) { transition: background .15s, transform .15s; }
.status-business:is(button):hover { background: var(--primary-soft); }
.status-business:is(button):hover { transform: translateY(-1px); }
.status-business.deploying { background: var(--warning-surface); }
.status-business strong { display: block; color: var(--text); font-size: 21px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; }
.status-business span { display: block; margin-top: 3px; color: var(--text-strong); font-size: 11px; font-weight: 600; }
.status-business small { overflow: hidden; margin-top: 1px; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 4px; margin: 8px 0 6px; overflow: hidden; border-radius: 99px; background: var(--border); }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.service-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.service-status { flex-wrap: wrap; }
.service-status .version-mismatch { color: var(--warning); border-color: var(--warning); }
#serviceVersionDialog { width: min(620px, calc(100% - 32px)); }
#serviceVersionContent { overflow: auto; font-size: 12px; }
.service-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 7px; background: var(--surface-muted); color: var(--text-muted); font-size: 10px; }
.service-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.service-pill.ok i { background: var(--success); }
.service-meta { margin-left: auto; color: var(--text-secondary); font-size: 10px; }

.overview-secondary-grid { display: grid; grid-template-columns: minmax(390px, .72fr) minmax(0, 1.28fr); gap: 14px; margin-top: 14px; align-items: stretch; }
.attention-panel { padding: 15px 16px 16px; }
.attention-head { margin-bottom: 10px; }
.attention-head .eyebrow { margin-bottom: 2px; }
.attention-content { min-height: 106px; }
.attention-summary { display: flex; min-height: 46px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-muted); }
.attention-summary > i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.attention-summary.warn > i { background: var(--warning); box-shadow: 0 0 0 5px var(--warning-soft); }
.attention-summary span { display: grid; gap: 1px; }
.attention-summary strong { color: var(--text); font-size: 12px; }
.attention-summary small { color: var(--text-secondary); font-size: 9px; }
.attention-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.attention-item { min-width: 0; min-height: 52px; padding: 7px 5px; border: 0; border-radius: 7px; background: var(--surface-muted); color: inherit; text-align: center; transition: background .15s, transform .15s; }
.attention-item:hover { background: var(--surface-muted); }
.attention-item.has-items { background: var(--warning-surface); }
.attention-item.has-items:hover { background: var(--warning-soft); }
.attention-item:hover { transform: translateY(-1px); }
.attention-item strong { display: block; font-size: 17px; line-height: 1.2; font-weight: 650; }
.attention-item.has-items strong { color: var(--warning); }
.attention-item span { display: block; margin-top: 3px; overflow: hidden; color: var(--text-secondary); font-size: 9px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.search-field { width: min(320px, 100%); }
.search-field input { padding-block: 8px; }
.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.filter-field { width: 130px; }
.filter-field select { padding-block: 8px; }
.list-count { margin-left: auto; color: var(--text-secondary); font-size: 11px; }
.data-table { overflow: hidden; border: 1px solid var(--border); border-radius: 7px; }
.data-table-head, .data-table-row { display: grid; align-items: center; column-gap: 14px; }
.data-table-head { min-height: 36px; padding: 0 14px; background: var(--surface-muted); color: var(--text-secondary); font-size: 10px; font-weight: 600; }
.data-table-row { width: 100%; min-height: 52px; padding: 7px 14px; border: 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-strong); text-align: left; transition: background .15s; }
.data-table-row:hover, .data-table-row.active { background: var(--primary-soft); }
.data-table-row:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--primary); outline-offset: -2px; }
.data-table-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table-row strong { font-size: 12px; font-weight: 650; }
.data-table-row small { display: block; overflow: hidden; margin-top: 1px; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.account-grid { grid-template-columns: minmax(155px, 1.05fr) minmax(150px, .9fr) minmax(330px, 1.9fr) minmax(170px, 1.1fr) minmax(175px, auto); }
.account-row { display: block; min-height: 0; padding: 0; }
.account-desktop-grid { display: grid; min-height: 60px; padding: 8px 14px; align-items: center; column-gap: 14px; }
.account-desktop-grid > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-mobile-summary { display: none; }
.account-primary-line, .subscription-primary-line, .device-primary-line, .device-runtime-line { display: flex; min-width: 0; align-items: center; gap: 6px; }
.account-primary-line strong, .device-primary-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-primary-line .badge { flex: 0 0 auto; }
.subscription-primary-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subscription-primary-line > span { color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.subscription-expiry.warn { color: var(--warning); }
.subscription-expiry.danger { color: var(--danger); }
.device-primary-line > span { overflow: hidden; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-runtime-line { gap: 4px; margin-top: 3px !important; }
.device-runtime-line > span { min-width: 0; overflow: hidden; padding: 2px 5px; border-radius: 5px; background: var(--surface-sunken); color: var(--text-muted); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.device-runtime-line > span:last-child { flex: 1 1 auto; background: transparent; text-align: right; }
.plugin-task-cell strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plugin-task-cell small.active { color: var(--primary); }
.plugin-task-cell small.warn { color: var(--warning); }
.quick-actions { display: flex; justify-content: flex-end; gap: 6px; overflow: visible !important; }
.quick-actions button { white-space: nowrap; }
.danger-ghost { color: var(--danger); }
.list-pagination { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding-top: 12px; color: var(--text-secondary); font-size: 11px; }
.list-pagination > div { display: flex; gap: 7px; }

.accounts-head { margin: 0 0 18px; }
.accounts-head .eyebrow { margin-bottom: 4px; }
.accounts-panel { padding-bottom: 16px; }
.account-detail-route .shell { width: min(1440px, calc(100% - 48px)); }
.account-detail-page { min-height: calc(100vh - 92px); margin-top: 16px; overflow: clip; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.account-detail-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 14px; padding: 7px 12px 7px 24px; background: var(--surface); box-shadow: 0 5px 14px rgba(16, 24, 40, .07); }
.account-detail-identity { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: space-between; gap: 14px; }
.account-detail-title { display: flex; min-width: 0; align-items: baseline; gap: 12px; }
.account-detail-title h2 { overflow: hidden; margin: 0; font-size: 18px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.account-detail-title span { flex: 0 0 auto; color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.account-detail-identity > .badge, .account-detail-toolbar .dialog-corner-close { flex: 0 0 auto; }
.account-detail-loading-title { color: var(--text-secondary); font-size: 12px; }
.detail-panel { min-height: 0; padding: 20px 24px 32px; }
.detail-loading { min-height: 220px; display: grid; place-items: center; }
.dialog-corner-close { display: grid; width: 34px; min-height: 34px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-secondary); font-size: 22px; line-height: 1; }
.dialog-corner-close:hover { border-color: var(--primary); color: var(--primary); }
.dialog-error { min-height: 220px; display: grid; place-items: center; gap: 12px; padding: 24px; color: var(--danger); }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 600; text-transform: lowercase; white-space: nowrap; }
.badge.on { color: var(--success); background: var(--success-soft); }
.badge.off { color: var(--danger); background: var(--danger-soft); }
.badge.ready { color: var(--primary); background: var(--primary-soft); }
.badge.warn { color: var(--warning); background: var(--warning-soft); }
.badge.muted { color: var(--text-muted); background: var(--surface-sunken); }
.badge-group { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; margin: 16px 0; }
.detail-cell { min-width: 0; padding: 13px 14px; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.detail-cell:nth-child(3n) { border-right: 0; }
.detail-cell:nth-last-child(-n + 3) { border-bottom: 0; }
.detail-cell span { display: block; margin-bottom: 4px; color: var(--text-secondary); font-size: 11px; text-transform: none; }
.detail-cell strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.account-summary-grid { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; padding: 11px 13px; border-radius: 7px; background: var(--surface-muted); }
.account-summary-grid > span { display: inline-flex; min-width: 0; max-width: 100%; align-items: baseline; gap: 6px; white-space: nowrap; }
.account-summary-grid small, .device-meta-flow small { flex: 0 0 auto; color: var(--text-secondary); font-size: 11px; }
.account-summary-grid strong, .device-meta-flow strong { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.action-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0 24px; }
.action-row button { width: 100%; }
.account-admin-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; margin-top: 10px; color: var(--text-secondary); font-size: 11px; }
.account-admin-summary strong { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.account-admin-summary small { color: var(--text-tertiary); }
.detail-section + .detail-section { margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.section-head h3 { margin: 0; }
.section-head span { color: var(--text-secondary); font-size: 11px; }
.device-list { display: grid; gap: 8px; }
.device-card { padding: 13px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.device-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.device-card h4 { margin: 0; font-size: 13px; font-weight: 650; }
.device-card-detail { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; margin-top: 9px; }
.device-meta-flow { display: flex; min-width: 0; align-items: baseline; flex-wrap: wrap; gap: 5px 16px; }
.device-meta-flow > span { display: inline-flex; min-width: 0; max-width: 100%; align-items: baseline; gap: 5px; white-space: nowrap; }
.device-ip-history { min-width: 0; }
.device-ip-history summary { display: inline-flex; align-items: baseline; gap: 5px; color: var(--text-secondary); cursor: pointer; list-style: none; white-space: nowrap; }
.device-ip-history summary::-webkit-details-marker { display: none; }
.device-ip-history summary::after { content: "›"; color: var(--text-tertiary); font-size: 14px; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
.device-ip-history[open] { flex-basis: 100%; }
.device-ip-history[open] summary::after { transform: rotate(-90deg); }
.device-ip-history-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.device-ip-history-list > span { display: grid; gap: 2px; min-width: 180px; padding: 7px 9px; border-radius: 6px; background: var(--surface); }
.device-ip-history-list > span > strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.device-ip-history-list > span > small { color: var(--text-secondary); font-size: 9px; }
.device-fingerprint strong { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.device-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.compact { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.danger-link { border: 0; background: transparent; color: var(--danger); padding: 5px 0; font-size: 12px; font-weight: 600; white-space: nowrap; }
.danger-link:hover { text-decoration: underline; }
.plugin-list { display: grid; gap: 6px; }
.plugin-row { display: grid; gap: 3px; padding: 9px 11px; border-radius: 7px; background: var(--surface-muted); }
.plugin-row-head { display: flex; min-width: 0; align-items: center; gap: 9px; }
.plugin-row-head > strong { min-width: 0; flex: 1 1 auto; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.plugin-row p { overflow: hidden; margin: 0; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.plugin-no-config { color: var(--text-secondary); font-size: 10px; white-space: nowrap; }
.account-detail-page .plugin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.collapsible-section { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-muted); }
.collapsible-section > summary { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 13px; cursor: pointer; list-style: none; }
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section > summary > span { display: flex; min-width: 0; align-items: baseline; gap: 10px; }
.collapsible-section > summary strong { color: var(--text); font-size: 15px; }
.collapsible-section > summary small { overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.collapsible-section > summary > i { width: 8px; height: 8px; flex: 0 0 auto; border-right: 2px solid var(--text-tertiary); border-bottom: 2px solid var(--text-tertiary); transform: rotate(45deg); transition: transform .15s; }
.collapsible-section[open] > summary > i { transform: rotate(225deg); }
.runtime-policy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 0 13px 8px; }
.runtime-policy-item { display: flex; min-width: 0; min-height: 42px; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 6px; background: var(--surface); }
.runtime-policy-item strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.runtime-policy-note { margin: 0; padding: 0 13px 11px; color: var(--text-secondary); font-size: 9px; }
.repo-section > .repo-section-body { padding: 0 13px 13px; }
.repo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.repo-toolbar > div { display: flex; gap: 7px; }
.repo-toolbar > span { color: var(--text-secondary); font-size: 10px; }
.repo-device-sources { display: grid; gap: 7px; margin-bottom: 8px; }
.repo-device-source-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.repo-device-source-row > div { display: flex; align-items: center; gap: 8px; }
.repo-device-source-row > div:first-child { min-width: 0; flex-direction: column; align-items: flex-start; gap: 2px; }
.repo-device-source-row strong { font-size: 11px; }
.repo-device-source-row small { color: var(--text-secondary); font-size: 9px; }
.repo-token-list { display: grid; gap: 7px; }
.repo-token-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.repo-token-row > div:first-child { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.repo-token-row strong { font-size: 12px; }
.repo-token-row code { color: var(--text-secondary); font: 10px "SFMono-Regular", Consolas, monospace; }
.repo-token-row p { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 10px; }
.repo-token-actions { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 8px; }
.repo-downloads { margin-top: 9px; color: var(--text-secondary); font-size: 10px; }
.repo-downloads summary { cursor: pointer; }
.repo-downloads > div { display: grid; margin-top: 7px; border-top: 1px solid var(--border); }
.repo-download-row { display: grid; grid-template-columns: 70px 70px minmax(0, 1fr) auto; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); align-items: center; }
.repo-download-row strong { color: var(--text); }
.repo-download-row code { overflow: hidden; color: var(--text-secondary); font: 9px "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; }
.repo-download-row small { white-space: nowrap; }
.repo-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 7px; color: var(--text-secondary); font-size: 11px; }
.api-key-section > .api-key-section-body { padding: 0 13px 13px; }
.api-key-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.api-key-toolbar span { color: var(--text-secondary); font-size: 10px; }
.api-key-list { display: grid; gap: 7px; }
.api-key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); }
.api-key-row > div:first-child { display: flex; min-width: 0; align-items: baseline; gap: 8px; }
.api-key-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.api-key-row code { color: var(--text-secondary); font: 10px "SFMono-Regular", Consolas, monospace; }
.api-key-row p { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.api-key-dialog { width: min(680px, calc(100% - 32px)); }
.api-key-form { gap: 14px; }
.api-key-scopes { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 7px; }
.api-key-scopes legend { padding: 0 5px; color: var(--text-strong); font-size: 12px; font-weight: 650; }
.api-key-scope-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; }
.api-key-scope-grid label { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 11px; cursor: pointer; }
.api-key-scope-grid input { width: auto; margin: 0; }
.api-key-secret-dialog { width: min(560px, calc(100% - 32px)); }
.toggle-control { position: relative; display: inline-flex; cursor: pointer; }
.toggle-control input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.toggle-control span { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.toggle-control span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--toggle-knob); box-shadow: 0 1px 2px rgba(16,24,40,.2); transition: transform .15s; }
.toggle-control input:checked + span { background: var(--success); }
.toggle-control input:checked + span::after { transform: translateX(14px); }
.toggle-control input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.toggle-control input:disabled + span { opacity: .5; cursor: not-allowed; }

.workbench-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.workbench-heading p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; }
.workbench-account-tools { display: flex; align-items: flex-end; gap: 8px; }
.workbench-account-tools label { min-width: 280px; gap: 4px; color: var(--text-secondary); font-size: 10px; }
.workbench-account-tools select { min-height: 36px; padding-block: 7px; }
.workbench-layout { display: grid; grid-template-columns: minmax(270px, 330px) minmax(0, 1fr); gap: 14px; align-items: start; }
.workbench-layout > .panel { padding: 16px; }
.workbench-section-head, .workbench-conversation-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workbench-section-head h3, .workbench-conversation-head h3 { margin: 0; color: var(--text); font-size: 15px; }
.workbench-section-head span, .workbench-conversation-head span { color: var(--text-secondary); font-size: 10px; }
.workbench-count { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary) !important; font-weight: 650; }
.workbench-kind-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 13px 0 8px; padding: 3px; border-radius: 7px; background: var(--surface-sunken); }
.workbench-kind-tabs button { min-height: 30px; border: 0; border-radius: 5px; background: transparent; color: var(--text-secondary); font-size: 11px; font-weight: 650; }
.workbench-kind-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.workbench-search input { min-height: 34px; padding: 7px 9px; font-size: 11px; }
.workbench-directory { display: grid; gap: 5px; min-height: 360px; max-height: 590px; margin-top: 9px; overflow-y: auto; }
.workbench-contact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 7px; border-radius: 7px; background: var(--surface-muted); transition: background .15s, box-shadow .15s; }
.workbench-contact:hover { background: var(--surface-hover); }
.workbench-contact.selected { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-border); }
.workbench-contact label { display: flex; min-width: 0; align-items: center; gap: 8px; cursor: pointer; }
.workbench-contact input { width: 15px; height: 15px; flex: 0 0 auto; accent-color: var(--primary); }
.workbench-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: var(--primary-chip); color: var(--primary); font-size: 11px; font-weight: 750; }
.workbench-avatar.group { background: var(--success-chip); color: var(--success); }
.workbench-contact-copy { min-width: 0; }
.workbench-contact-copy strong, .workbench-contact-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workbench-contact-copy strong { color: var(--text-strong); font-size: 11px; }
.workbench-contact-copy small { color: var(--text-secondary); font: 9px "SFMono-Regular", Consolas, monospace; }
.workbench-event-link { min-height: 25px; border: 0; border-radius: 5px; padding: 3px 6px; background: transparent; color: var(--primary); font-size: 9px; font-weight: 650; }
.workbench-event-link:hover { background: var(--primary-chip); }
.workbench-directory-empty, .workbench-events-empty { display: grid; align-content: center; justify-items: center; gap: 4px; min-height: 220px; color: var(--text-secondary); text-align: center; }
.workbench-directory-empty strong, .workbench-events-empty strong { color: var(--text-muted); font-size: 12px; }
.workbench-directory-empty span, .workbench-events-empty span { max-width: 320px; font-size: 10px; }
.workbench-directory-page, .workbench-event-page { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--text-secondary); font-size: 9px; }
.workbench-directory-page > div, .workbench-event-page { display: flex; justify-content: flex-end; gap: 6px; }
.workbench-conversation-panel { min-width: 0; }
.workbench-event-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.workbench-event-tools input { width: 160px; min-height: 30px; padding: 4px 8px; font-size: 10px; }
.workbench-event-tools select { width: auto; min-height: 30px; padding: 4px 26px 4px 8px; font-size: 10px; }
.workbench-events { display: grid; gap: 6px; min-height: 310px; max-height: 470px; margin-top: 13px; overflow-y: auto; }
.workbench-event { display: grid; gap: 5px; width: 100%; border: 0; border-radius: 8px; padding: 9px 11px; background: var(--surface-muted); color: inherit; text-align: left; }
.workbench-event:hover { background: var(--surface-hover); }
.workbench-event.outgoing { background: var(--primary-soft); }
.workbench-event-main, .workbench-event-main > span, .workbench-event-foot { display: flex; min-width: 0; align-items: center; gap: 7px; }
.workbench-event-main, .workbench-event-foot { justify-content: space-between; }
.workbench-event-main b { color: var(--text-strong); font-size: 10px; }
.workbench-event-main i, .workbench-event-main time, .workbench-event-foot span, .workbench-event-foot i { color: var(--text-secondary); font-size: 9px; font-style: normal; }
.workbench-event > strong { overflow: hidden; color: var(--text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.workbench-event-foot { overflow: hidden; }
.workbench-event-foot span, .workbench-event-foot i { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workbench-event-foot i.active { color: var(--success); }
.workbench-event-foot i.failed { color: var(--danger); }
.workbench-composer { display: grid; gap: 8px; margin-top: 12px; padding: 11px; border-radius: 9px; background: var(--surface-sunken); }
.workbench-recipient-bar { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.workbench-recipients { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; color: var(--text-secondary); font-size: 10px; }
.workbench-recipients button { display: inline-flex; max-width: 180px; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 3px 5px 3px 8px; background: var(--primary-chip); color: var(--primary); font-size: 9px; }
.workbench-recipients button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workbench-recipients button i { font-size: 14px; font-style: normal; line-height: 1; }
.workbench-compose-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 7px; align-items: stretch; }
.workbench-compose-row label { min-width: 0; }
.workbench-compose-row select, .workbench-compose-row input, .workbench-compose-row textarea { height: 100%; min-height: 40px; padding: 7px 9px; font-size: 11px; }
.workbench-compose-row textarea { max-height: 110px; resize: vertical; }
.workbench-compose-row .primary { min-width: 74px; }
.workbench-send-status { display: flex; flex-wrap: wrap; gap: 5px; }
.workbench-send-status > span { display: inline-flex; max-width: 100%; gap: 5px; border-radius: 5px; padding: 3px 6px; background: var(--surface); font-size: 9px; }
.workbench-send-status strong, .workbench-send-status i { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workbench-send-status i { color: var(--text-secondary); font-style: normal; }
.workbench-send-status .completed i { color: var(--success); }
.workbench-send-status .failed i, .workbench-send-status .expired i { color: var(--danger); }
.workbench-event-dialog { width: min(840px, calc(100% - 32px)); }
.workbench-event-dialog pre { max-height: 70vh; margin: 0; overflow: auto; border-radius: 7px; padding: 14px; background: #111827; color: #d1fae5; font: 11px/1.6 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.audit-head { align-items: flex-end; }
.audit-head p { margin: 4px 0 0; color: var(--text-secondary); font-size: 11px; }
.audit-tools { display: flex; align-items: flex-end; gap: 8px; }
.audit-tools label { min-width: 180px; }
.audit-tools select { padding-block: 7px; }
.audit-list { display: grid; min-height: 120px; font-size: 12px; }
.audit-row { display: grid; grid-template-columns: 150px 150px minmax(0, 1fr) 130px; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); color: var(--text-secondary); }
.audit-row strong { color: var(--text-strong); font-weight: 600; }
.audit-ip { text-align: right; overflow-wrap: anywhere; }
.audit-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; }
.ghost:disabled { cursor: not-allowed; opacity: .45; }
.empty { margin: 16px 0; color: var(--text-secondary); font-size: 13px; }
.release-panel { margin: 0; padding: 15px 16px 16px; }
.release-panel > .panel-head { margin-bottom: 10px; }
.release-status { min-height: 80px; }
.release-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(210px, .85fr); gap: 14px; }
.release-columns h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; color: var(--text-secondary); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.release-columns h3 span { color: var(--text-muted); font-size: 9px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.release-current-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 7px; }
.release-card { display: grid; gap: 7px; padding: 10px 11px; border: 0; border-radius: 8px; background: var(--surface-muted); }
.release-card.current { box-shadow: inset 2px 0 var(--success); }
.release-card-head, .release-card-version, .release-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.release-card-head > span:first-child { color: var(--text-secondary); font-size: 9px; font-weight: 650; }
.release-current-dot { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-size: 9px; font-weight: 650; }
.release-current-dot::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.release-card-version strong { color: var(--text); font-size: 18px; letter-spacing: -.02em; }
.release-card-version small { color: var(--text-secondary); font-size: 9px; }
.release-card footer { justify-content: flex-start; color: var(--text-secondary); font-size: 9px; }
.release-card footer span + span::before { margin-right: 6px; color: var(--text-tertiary); content: "·"; }
.release-card code, .release-history-row code, .release-online-row code { overflow: hidden; color: var(--text-secondary); font: 9px "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.release-history { margin-top: 8px; }
.release-subhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.release-subhead h4 { margin: 0; color: var(--text-secondary); font-size: 10px; font-weight: 650; }
.release-history-list { display: grid; }
.release-history-list.expanded { max-height: 250px; padding-right: 4px; overflow-y: auto; overscroll-behavior: contain; }
.release-history-row { display: grid; grid-template-columns: 48px 62px minmax(0, 1fr) auto; gap: 7px; align-items: center; min-height: 32px; border-top: 1px solid var(--border); }
.release-history-row > .badge { justify-self: start; }
.release-history-row small { color: var(--text-muted); font-size: 9px; white-space: nowrap; }
.release-history-toggle { min-height: 24px; border: 0; padding: 2px 0; background: transparent; color: var(--primary); font-size: 9px; }
.release-online-list { display: grid; max-height: 190px; gap: 7px; padding-right: 4px; overflow-y: auto; overscroll-behavior: contain; }
.release-online-row { display: grid; grid-template-columns: 52px minmax(44px, 1fr) auto; gap: 9px; align-items: center; min-height: 24px; }
.release-online-row strong { color: var(--text-strong); font-size: 11px; }
.release-online-row b { color: var(--text-secondary); font-size: 9px; font-weight: 500; }
.release-online-meter { height: 4px; overflow: hidden; border-radius: 999px; background: var(--border); }
.release-online-meter i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

dialog { width: min(620px, calc(100% - 32px)); padding: 0; color: var(--text); }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.dialog-form { padding: 24px; display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.renewal-dialog { width: min(580px, calc(100% - 32px)); }
.renewal-form { gap: 14px; }
.renewal-form .panel-head { margin-bottom: 0; }
.renewal-form .panel-head .form-hint { margin-top: 3px; }
.renewal-current { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: var(--border); }
.renewal-current > span { padding: 11px 13px; background: var(--surface-muted); }
.renewal-current small, .renewal-current strong { display: block; }
.renewal-current small { margin-bottom: 3px; color: var(--text-secondary); font-size: 10px; }
.renewal-current strong { color: var(--text-strong); font-size: 13px; }
.renewal-periods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; border: 0; }
.renewal-periods legend { grid-column: 1 / -1; margin-bottom: 7px; padding: 0; color: var(--text-strong); font-size: 13px; font-weight: 600; }
.renewal-periods label { display: block; min-width: 0; cursor: pointer; }
.renewal-periods input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.renewal-periods span { display: grid; min-height: 38px; padding: 7px 5px; place-items: center; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; transition: border-color .15s, background .15s, color .15s; }
.renewal-periods input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.renewal-periods input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.renewal-preview { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 14px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary-soft); }
.renewal-preview small, .renewal-preview strong { display: block; }
.renewal-preview small { margin-bottom: 2px; color: var(--text-secondary); font-size: 10px; }
.renewal-preview strong { color: var(--primary); font-size: 20px; letter-spacing: .01em; }
.renewal-preview p { max-width: 220px; margin: 0; color: var(--text-muted); font-size: 10px; line-height: 1.5; text-align: right; }
.renewal-payment { border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.renewal-payment summary { padding: 10px 12px; color: var(--text-secondary); cursor: pointer; font-size: 11px; font-weight: 600; }
.renewal-payment[open] summary { border-bottom: 1px solid var(--border); }
.renewal-payment .form-row { padding: 12px; }
.token-dialog code { display: block; border: 1px solid var(--border); border-radius: 6px; padding: 14px; background: var(--surface-muted); color: var(--text-strong); overflow-wrap: anywhere; font: 12px/1.6 "SFMono-Regular", Consolas, monospace; }
.token-dialog p { margin: 0; color: var(--text-secondary); }
.token-dialog p code { display: inline; border: 0; padding: 0; background: transparent; }
.switch-line { display: flex; align-items: center; gap: 8px; }
.switch-line input { width: auto; }
.account-admins-dialog { width: min(540px, calc(100% - 32px)); }
.account-admins-form { gap: 14px; }
.admin-inheritance-note { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary-soft); }
.admin-inheritance-note strong { color: var(--primary); font-size: 12px; }
.admin-inheritance-note span { color: var(--text-muted); font-size: 11px; line-height: 1.55; }
.admin-inheritance-note code { padding: 1px 4px; border-radius: 4px; background: var(--surface); color: var(--primary); font: 11px "SFMono-Regular", Consolas, monospace; }
.admin-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.admin-add-row .ghost { min-width: 66px; }
.account-admin-list { display: flex; min-height: 74px; max-height: 220px; align-content: flex-start; flex-wrap: wrap; gap: 7px; overflow-y: auto; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.account-admin-chip { display: inline-flex; max-width: 100%; height: 30px; align-items: center; gap: 5px; padding: 4px 5px 4px 9px; border: 1px solid var(--primary-border); border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.account-admin-chip code { overflow: hidden; font: 11px "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.account-admin-chip button { display: grid; width: 20px; min-height: 20px; padding: 0; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-secondary); font-size: 16px; line-height: 1; }
.account-admin-chip button:hover { background: var(--primary-chip); color: var(--danger); }
.account-admin-empty { width: 100%; margin: auto 0; color: var(--text-secondary); font-size: 11px; text-align: center; }
.admin-input-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: -7px; color: var(--text-secondary); font-size: 10px; }
.admin-input-meta .invalid { color: var(--danger); font-weight: 650; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.deployment-dialog { width: min(760px, calc(100% - 32px)); }
.deployment-form { gap: 14px; }
.deployment-summary { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr); gap: 14px; }
.deployment-state { display: flex; align-items: center; gap: 11px; padding: 15px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.deployment-state > span { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #98a2b3; }
.deployment-state.busy > span { background: #dc2626; }
.deployment-state.draining > span { background: #d97706; animation: loading-pulse 1.2s ease-in-out infinite; }
.deployment-state.safe > span, .deployment-state.idle > span { background: var(--success); }
.deployment-state strong, .deployment-state small { display: block; }
.deployment-state small { margin-top: 2px; color: var(--text-secondary); font-size: 11px; }
.deployment-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 7px; }
.deployment-counts span { display: grid; align-content: center; padding: 11px 12px; border-left: 1px solid var(--border); }
.deployment-counts span:first-child { border-left: 0; }
.deployment-counts strong { font-size: 20px; line-height: 1.2; }
.deployment-counts small { color: var(--text-secondary); font-size: 10px; }
.deployment-work { max-height: 360px; overflow-y: auto; }
.deployment-list { display: grid; gap: 7px; }
.deployment-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-muted); }
.deployment-item > div strong, .deployment-item > div small { display: block; }
.deployment-item > div small, .deployment-item > small { color: var(--text-secondary); font-size: 10px; }
.deployment-item > p { grid-column: 1 / -1; overflow: hidden; margin: 3px 0 0; color: var(--text-strong); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.deployment-item > small { grid-column: 1 / -1; }
.deployment-empty { margin: 0; padding: 24px; border: 1px dashed var(--border-strong); border-radius: 7px; color: var(--text-secondary); text-align: center; }
.deployment-note { display: grid; gap: 3px; padding: 11px 13px; border-radius: 7px; background: var(--primary-soft); color: var(--text-muted); font-size: 11px; }
.deployment-note strong { color: var(--primary); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; margin: 0; padding: 11px 15px; border: 0; border-radius: 7px; background: var(--text); color: var(--surface); box-shadow: var(--floating-shadow); font-size: 13px; z-index: 20; }

@media (max-width: 1100px) {
  .account-grid { grid-template-columns: minmax(120px, 1fr) minmax(110px, .8fr) minmax(230px, 1.65fr) minmax(140px, 1fr) minmax(155px, auto); }
  .account-desktop-grid, .data-table-head { column-gap: 9px; }
  .device-runtime-line > span { padding-inline: 4px; font-size: 8px; }
  .quick-actions { gap: 4px; }
  .quick-actions .compact { padding-inline: 8px; }
}

@media (max-width: 900px) {
  .login-panel { grid-template-columns: 1fr; }
  .login-panel { max-width: 560px; gap: 32px; padding: 52px 0; }
  .status-bar { grid-template-columns: 1fr; }
  .overview-secondary-grid { grid-template-columns: 1fr; }
  .release-columns { grid-template-columns: 1fr; }
  .status-business-grid { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); border-left: 0; }
  .attention-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attention-item:nth-child(4) { border-left: 0; border-top: 1px solid var(--border); }
  .attention-item:nth-child(5) { border-top: 1px solid var(--border); }
  .action-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .action-row button:nth-child(-n + 3) { grid-column: span 2; }
  .action-row button:nth-child(n + 4) { grid-column: span 3; }
  .device-card-detail { grid-template-columns: 1fr; }
  .device-actions { justify-content: flex-start; }
  .account-detail-page .plugin-list { grid-template-columns: 1fr; }
  .workbench-layout { grid-template-columns: 280px minmax(0, 1fr); }
}

@media (max-width: 620px) {
  body { font-size: 13px; }
  .shell { width: min(100% - 20px, 1280px); padding-bottom: 20px; }
  .masthead { min-height: 56px; flex-wrap: wrap; gap: 0 8px; }
  .masthead-brand { display: block; }
  .masthead .eyebrow { display: none; }
  h1 { font-size: 16px; white-space: nowrap; }
  h2 { font-size: 18px; }
  .status-rail { gap: 6px; font-size: 11px; white-space: nowrap; }
  .health-dot { width: 7px; height: 7px; }
  .status-rail .theme-toggle { width: 30px; min-height: 30px; justify-content: center; padding: 0; }
  .status-rail .theme-toggle-label { display: none; }
  #logoutButton { min-height: 30px; padding: 5px 9px; font-size: 11px; }
  .tabs { gap: 22px; margin-bottom: 14px; overflow-x: auto; }
  .tab { padding: 11px 1px 9px; font-size: 13px; }
  .header-tabs { width: 100%; min-height: 42px; order: 3; margin: 0; }
  .header-tabs .tab { min-height: 42px; padding: 9px 1px 7px; }
  .workbench-heading { display: grid; gap: 10px; margin-bottom: 12px; }
  .workbench-heading h2 { font-size: 18px; }
  .workbench-heading p { font-size: 9px; }
  .workbench-account-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .workbench-account-tools label { min-width: 0; }
  .workbench-account-tools label span { display: none; }
  .workbench-account-tools select, #workbenchSync { min-height: 34px; font-size: 10px; }
  .workbench-layout { grid-template-columns: 1fr; gap: 10px; }
  .workbench-layout > .panel { padding: 11px; }
  .workbench-directory { min-height: 0; max-height: 300px; }
  .workbench-contact { padding: 6px; }
  .workbench-avatar { width: 28px; height: 28px; }
  .workbench-events { min-height: 260px; max-height: 420px; }
  .workbench-conversation-head { display: grid; }
  .workbench-event-tools { justify-content: flex-start; }
  .workbench-event-tools input { width: 100%; }
  .workbench-event-tools select { flex: 1 1 100px; min-width: 0; }
  .workbench-compose-row { grid-template-columns: 78px minmax(0, 1fr); }
  .workbench-compose-row .primary { grid-column: 1 / -1; min-height: 36px; }
  .workbench-recipients { max-height: 54px; overflow-y: auto; }
  .workbench-event-dialog { width: calc(100% - 20px); }
  .workbench-event-dialog .dialog-form { padding: 14px; }
  .workbench-event-dialog pre { max-height: 78vh; font-size: 9px; }
  .detail-grid, .form-row { grid-template-columns: 1fr; }
  .renewal-dialog { width: calc(100% - 20px); }
  .renewal-form { padding: 18px; }
  .renewal-periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .renewal-periods label:last-child { grid-column: 1 / -1; }
  .renewal-preview { align-items: flex-start; flex-direction: column; gap: 5px; }
  .renewal-preview p { max-width: none; text-align: left; }
  .account-admins-dialog { width: calc(100% - 20px); }
  .account-admins-form { padding: 18px; }
  .admin-input-meta { display: grid; gap: 2px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .deployment-dialog { width: calc(100% - 20px); }
  .deployment-form { padding: 16px; }
  .deployment-summary { grid-template-columns: 1fr; }
  .deployment-counts strong { font-size: 17px; }
  .deployment-counts small { font-size: 8px; }
  .deployment-work { max-height: 45vh; }
  .deployment-form .dialog-actions { display: flex; }
  .panel { padding: 13px; }
  .status-bar-panel { margin-bottom: 12px; padding: 12px; }
  .status-bar-head { align-items: center; margin-bottom: 8px; }
  .status-bar-head h2 { font-size: 15px; }
  .status-bar-head .eyebrow { font-size: 10px; }
  .status-bar-actions { display: flex; gap: 6px; }
  .status-bar-actions .sample-time { max-width: 118px; font-size: 9px; line-height: 1.25; }
  .status-bar-actions .compact { min-height: 28px; padding: 4px 8px; font-size: 10px; }
  .status-bar { gap: 0; }
  .status-resource-grid, .status-business-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-resource { padding: 7px 8px; border-left: 0; border-top: 1px solid var(--border); }
  .status-resource:nth-child(odd) { padding-left: 0; }
  .status-resource:nth-child(-n + 2) { border-top: 0; }
  .status-resource > span, .status-resource small, .status-business small { font-size: 9px; }
  .status-resource strong { margin: 2px 0; font-size: 11px; }
  .meter { height: 3px; margin: 5px 0 4px; }
  .status-business-grid { margin-top: 6px; padding-top: 6px; }
  .status-business { padding: 6px 8px; }
  .status-business:nth-child(odd) { padding-left: 0; }
  .status-business strong { font-size: 18px; }
  .status-business span { margin-top: 1px; font-size: 10px; }
  .service-status { flex-wrap: wrap; }
  .service-status { gap: 4px; margin-top: 6px; padding-top: 7px; }
  .service-pill { padding: 2px 5px; font-size: 8px; }
  .service-meta { flex-basis: auto; margin-left: auto; font-size: 8px; }
  .attention-panel { padding: 12px; }
  .attention-head { margin-bottom: 8px; }
  .attention-head h2 { font-size: 15px; }
  .attention-head .eyebrow { font-size: 10px; }
  .attention-head .compact { min-height: 28px; padding: 4px 8px; font-size: 10px; }
  .attention-summary { min-height: 42px; padding: 7px 9px; }
  .attention-summary strong { font-size: 11px; }
  .attention-summary small { font-size: 8px; }
  .attention-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .attention-item { min-height: 48px; padding: 6px 3px; border: 0; text-align: center; }
  .attention-item:nth-child(odd), .attention-item:nth-child(4), .attention-item:last-child { grid-column: auto; border: 0; }
  .attention-item strong { font-size: 16px; }
  .attention-item span { margin-top: 3px; font-size: 9px; white-space: nowrap; }
  .accounts-head { align-items: flex-end; margin-bottom: 12px; }
  .accounts-head h2 { font-size: 18px; }
  .accounts-head .eyebrow { font-size: 10px; }
  #openCreateAccount { min-height: 34px; padding: 6px 10px; font-size: 11px; }
  .accounts-panel { padding: 12px; }
  .list-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 106px auto; gap: 7px; margin-bottom: 10px; }
  .search-field, .filter-field { width: auto; }
  .search-field input, .filter-field select { min-height: 34px; padding: 6px 8px; font-size: 11px; }
  .list-count { margin-left: 0; font-size: 9px; white-space: nowrap; }
  .data-table { overflow: visible; border: 0; border-radius: 0; }
  .data-table-head { display: none; }
  .data-table-body { display: grid; gap: 6px; }
  .data-table-row { border: 1px solid var(--border); border-radius: 7px; }
  .account-desktop-grid { display: none; }
  .account-mobile-summary { display: grid; gap: 8px; padding: 10px; }
  .mobile-account-primary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 7px; align-items: center; }
  .mobile-account-identity { display: flex; min-width: 0; gap: 7px; align-items: baseline; overflow: hidden; }
  .mobile-account-identity strong, .mobile-account-identity small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-account-identity strong { flex: 0 1 auto; color: var(--text); font-size: 13px; font-weight: 700; }
  .mobile-account-identity small { flex: 1 1 auto; margin: 0; font-size: 9px; }
  .mobile-plan { padding: 2px 6px; border-radius: 999px; background: var(--surface-muted); color: var(--text-muted); font-size: 9px; font-weight: 650; white-space: nowrap; }
  .mobile-plan.warn { background: var(--warning-soft); color: var(--warning); }
  .mobile-plan.danger { background: var(--danger-soft); color: var(--danger); }
  .mobile-account-device-chips { display: flex; min-width: 0; gap: 4px; overflow: hidden; }
  .mobile-account-device-chips span { min-width: 0; flex: 0 1 auto; overflow: hidden; padding: 3px 5px; border-radius: 5px; background: var(--surface-sunken); color: var(--text-muted); font-size: 8.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-account-device-chips span:first-child { flex-shrink: 1; color: var(--text-strong); font-weight: 650; }
  .mobile-account-device-chips span:last-child { margin-left: auto; flex-shrink: 0; }
  .mobile-account-work { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; }
  .mobile-account-work strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-account-work span { flex: 0 0 auto; color: var(--text-strong); font-size: 10px; font-weight: 650; white-space: nowrap; }
  .mobile-account-work strong { color: var(--text-secondary); font-size: 9px; font-weight: 500; text-align: right; }
  .mobile-account-work strong.active { color: var(--primary); }
  .mobile-account-work strong.warn { color: var(--warning); }
  .badge { padding: 2px 6px; font-size: 9px; }
  .mobile-account-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 96px)); justify-content: center; gap: 7px; }
  .mobile-account-actions .compact { width: 100%; min-height: 30px; padding: 4px 10px; font-size: 10px; }
  .list-pagination { min-height: 38px; padding-top: 8px; font-size: 9px; }
  .list-pagination .compact { min-height: 28px; padding: 4px 8px; font-size: 10px; }
  .account-detail-route .shell { width: min(100% - 20px, 1280px); }
  .account-detail-page { min-height: calc(100vh - 116px); margin-top: 10px; }
  .account-detail-toolbar { gap: 8px; padding: 5px 8px 5px 14px; }
  .account-detail-identity { gap: 8px; }
  .account-detail-title { gap: 8px; }
  .account-detail-title h2 { font-size: 15px; }
  .account-detail-title span { font-size: 9px; }
  .detail-panel { padding: 14px 18px 18px; }
  .dialog-corner-close { width: 32px; min-height: 32px; font-size: 21px; }
  .detail-cell { border-right: 0; border-bottom: 1px solid var(--border) !important; }
  .detail-cell:last-child { border-bottom: 0 !important; }
  .account-summary-grid { gap: 7px 14px; padding: 10px 11px; }
  .account-summary-grid > span { max-width: 100%; }
  .account-summary-grid small { font-size: 9px; }
  .account-summary-grid strong { font-size: 10px; }
  .action-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
  .action-row button { min-height: 32px; padding-inline: 5px; font-size: 10px; }
  .action-row button:nth-child(-n + 3) { grid-column: span 2; }
  .action-row button:nth-child(n + 4) { grid-column: span 3; }
  .collapsible-section > summary > span { display: grid; gap: 2px; }
  .runtime-policy-grid { grid-template-columns: 1fr; }
  .device-card { padding: 11px; }
  .device-card-detail { gap: 8px; }
  .device-meta-flow { gap: 4px 11px; }
  .device-meta-flow small, .device-meta-flow strong { font-size: 9px; }
  .device-ip-history-list { display: grid; grid-template-columns: 1fr; }
  .device-ip-history-list > span { min-width: 0; }
  .device-actions { gap: 6px; }
  .device-actions .compact, .device-actions .danger-link { min-height: 27px; padding: 4px 7px; font-size: 9px; }
  .plugin-row { padding: 8px 9px; }
  .plugin-row-head { gap: 7px; }
  .plugin-row-head > strong { font-size: 11px; }
  .plugin-row .badge { font-size: 8px; }
  .plugin-row .compact { min-height: 27px; padding: 4px 7px; font-size: 9px; }
  .plugin-row p { font-size: 9px; }
  .repo-toolbar { align-items: flex-start; display: grid; }
  .repo-toolbar > div { display: grid; grid-template-columns: 1fr 1fr; }
  .repo-device-source-row { align-items: flex-start; flex-direction: column; }
  .repo-device-source-row > div:last-child { width: 100%; }
  .repo-device-source-row button { flex: 1; }
  .repo-token-row { grid-template-columns: minmax(0, 1fr) auto; }
  .repo-token-actions { grid-column: 1 / -1; grid-row: auto; }
  .repo-download-row { grid-template-columns: 56px minmax(0, 1fr); }
  .repo-download-row code, .repo-download-row small { grid-column: 1 / -1; }
  .api-key-toolbar { align-items: flex-start; }
  .api-key-row { grid-template-columns: minmax(0, 1fr) auto; }
  .api-key-row .danger-link { grid-column: 1 / -1; justify-self: start; }
  .api-key-scope-grid { grid-template-columns: 1fr; }
  .api-key-form .form-row { grid-template-columns: 1fr; }
  #auditTab .panel { padding: 12px; }
  .audit-head { align-items: flex-start; display: grid; gap: 9px; margin-bottom: 10px; }
  .audit-head h2 { font-size: 17px; }
  .audit-head p { font-size: 9px; }
  .audit-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 7px; }
  .audit-tools label { min-width: 0; gap: 3px; font-size: 9px; }
  .audit-tools select { min-height: 32px; padding: 5px 8px; font-size: 10px; }
  #refreshAudit { min-height: 32px; padding: 5px 10px; font-size: 10px; }
  .audit-list { min-height: 80px; font-size: 10px; }
  .audit-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 8px 0; }
  .audit-time { grid-column: 1 / 2; grid-row: 1; font-size: 9px; }
  .audit-row strong { grid-column: 1 / 2; grid-row: 2; font-size: 10px; }
  .audit-subject { grid-column: 1 / -1; grid-row: 3; overflow-wrap: anywhere; }
  .audit-ip { grid-column: 2 / 3; grid-row: 1 / 3; align-self: center; text-align: right; font-size: 9px; }
  .audit-pagination { min-height: 38px; margin-top: 8px; padding-top: 8px; gap: 8px; font-size: 9px; }
  .audit-pagination .ghost { min-height: 28px; padding: 4px 8px; font-size: 10px; }
  .list-item { display: grid; gap: 3px; }
}
