/* Workbench 3.2 — reference-style admin UI. Shared shell and admin pages; chat.css owns the message center. */
/* 1. Tokens: all themes use the same geometry. Yellow marks selection and primary actions. */
:root {
  color-scheme: light;
  --canvas: #f7f7f5;
  --surface: #fff;
  --surface-soft: #fafaf9;
  --hover: #f3f3f0;
  --line: #e7e7e2;
  --line-strong: #d5d5ce;
  --ink: #252623;
  --muted: #777971;
  --accent: #ffe024;
  --accent-hover: #f5d200;
  --accent-ink: #302b00;
  --accent-soft: #fff9cf;
  --accent-border: #e3c429;
  --success: #298254;
  --success-bg: #eaf6ef;
  --warning: #8a650b;
  --warning-bg: #fff7df;
  --danger: #be4343;
  --danger-bg: #fceeee;
  --bubble-out: #fff1a6;
  --bubble-in: #fff;
  --shadow: 0 8px 30px rgb(0 0 0 / 8%);
  --sidebar-width: 240px;
}
:root[data-resolved-theme="dark"] {
  color-scheme: dark;
  --canvas: #191a1c;
  --surface: #222326;
  --surface-soft: #27282b;
  --hover: #303134;
  --line: #36373b;
  --line-strong: #515257;
  --ink: #eeefeb;
  --muted: #acafa7;
  --accent: #ffe024;
  --accent-hover: #f5d200;
  --accent-ink: #292500;
  --accent-soft: #39351f;
  --accent-border: #8d7d2f;
  --success: #83cfa4;
  --success-bg: #233c2e;
  --warning: #e3c474;
  --warning-bg: #3a3222;
  --danger: #f09595;
  --danger-bg: #422d30;
  --bubble-out: #4b4320;
  --bubble-in: #2d2e32;
  --shadow: 0 8px 30px rgb(0 0 0 / 28%);
}
/* 2. Base controls and accessible focus states. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--canvas); }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .46; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
input, select, textarea { min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; padding: 9px 11px; outline: none; }
input, select { min-height: 38px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .9; }
input:focus, textarea:focus, select:focus { border-color: var(--accent-border); box-shadow: 0 0 0 2px var(--accent-soft); }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; padding: 0; margin: 0; accent-color: #ba9d00; flex-shrink: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-border); outline-offset: 3px; }
label { display: block; font-size: 13px; font-weight: 500; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.icon { display: inline-block; vertical-align: middle; width: 18px; height: 18px; flex: 0 0 18px; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); font-size: 13px; line-height: 1.45; font-weight: 500; white-space: nowrap; }
.button:not(:disabled):hover { background: var(--hover); border-color: var(--muted); }
.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.button.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.danger, .text-button.danger { color: var(--danger); }
.button.danger:not(:disabled):hover { border-color: var(--danger); background: var(--danger-bg); }
.button.small { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 7px; width: 34px; height: 34px; color: var(--muted); }
.icon-button:hover { background: var(--hover); color: var(--ink); }
.text-button { background: transparent; border: 0; padding: 3px 4px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.text-button:not(:disabled):hover { text-decoration: underline; text-underline-offset: 4px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 4px; font-size: 12px; line-height: 1.6; background: var(--hover); color: var(--muted); white-space: nowrap; font-weight: 400; }
.status-pill.online { color: var(--success); background: var(--success-bg); }
.status-pill.warn, .status-pill.owner { color: var(--warning); background: var(--warning-bg); }
.status-pill.bad { color: var(--danger); background: var(--danger-bg); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.online { background: var(--success); }
.dot.error { background: var(--danger); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; color: var(--ink); background: var(--hover); font-size: 15px; font-weight: 500; }
.avatar.lavender, .avatar.peach, .avatar.rose { background: var(--accent-soft); }
.avatar.blue, .avatar.mint { background: var(--surface-soft); border: 1px solid var(--line); }
.avatar.large { width: 52px; height: 52px; flex-basis: 52px; font-size: 21px; }
/* 3. Login: a real form rather than a promotional landing page. */
.login-screen { min-height: 100dvh; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 17px; font-weight: 650; line-height: 1.4; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--accent); color: var(--accent-ink); border-radius: 50%; font-size: 23px; font-weight: 500; flex-shrink: 0; }
.brand small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 400; }
.login-brand { padding: 24px 32px; }
.login-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px 100px; }
.login-form { width: 400px; max-width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 34px; }
.login-form h1 { font-size: 24px; font-weight: 600; margin-bottom: 5px; }
.login-form > .muted { font-size: 13px; margin-bottom: 28px; }
.login-form > label { margin: 18px 0 7px; }
.login-form input { width: 100%; min-height: 42px; }
.password-field { position: relative; }
.password-field input { padding-right: 56px; }
.password-field button { position: absolute; right: 10px; top: 8px; color: var(--muted); }
.login-submit { width: 100%; min-height: 42px; margin-top: 10px; }
.form-error { font-size: 12px; line-height: 1.7; color: var(--danger); margin-top: 10px; overflow-wrap: anywhere; }
.form-error:empty { margin-top: 8px; }
.login-note { display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line); margin-top: 25px; padding-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.login-note .icon { margin-top: 3px; width: 16px; }
.login-footer { margin-top: 23px; color: var(--muted); font-size: 12px; }
/* 4. Application shell: independent navigation and main-content scrolling. */
.workspace { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); z-index: 40; }
.sidebar > .brand { padding: 22px 16px 17px; flex-shrink: 0; }
.account-context { margin: 0 16px 13px; }
.account-context label { color: var(--muted); font-size: 11px; margin: 0 0 5px; }
.account-select { width: 100%; min-height: 34px; height: 34px; padding: 4px 9px; border-color: var(--line); background: var(--surface-soft); font-size: 12px; text-overflow: ellipsis; }
.sidebar nav { overflow-y: auto; padding: 0 8px 15px; flex: 1; }
.nav-group { margin: 0 0 17px; }
.nav-group-title { color: var(--muted); font-size: 11px; padding: 4px 9px 8px; }
.nav-item { display: flex; align-items: center; width: 100%; min-height: 43px; gap: 12px; border: 0; border-radius: 24px; background: transparent; color: var(--muted); padding: 10px 12px; text-align: left; font-size: 14px; margin-bottom: 3px; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: var(--accent); color: var(--accent-ink); font-weight: 550; }
.nav-icon { width: 20px; height: 20px; }
.nav-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; padding: 0 5px; min-width: 18px; text-align: center; font-size: 11px; }
.sidebar-bottom { border-top: 1px solid var(--line); padding: 13px 12px max(8px, env(safe-area-inset-bottom)); }
.theme-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.theme-heading small { font-size: 10px; }
.theme-switch { display: flex; padding: 3px; border: 1px solid var(--line); background: var(--hover); border-radius: 8px; }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: 1; background: none; border: 1px solid transparent; border-radius: 5px; padding: 7px 4px; font-size: 11px; color: var(--muted); }
.theme-switch .icon { width: 14px; height: 14px; flex-basis: 14px; }
.theme-switch button[aria-pressed="true"] { border-color: var(--accent-border); color: var(--ink); background: var(--accent-soft); }
.logout-button { display: flex; align-items: center; gap: 11px; width: 100%; background: transparent; color: var(--muted); border: 0; padding: 13px 7px 8px; font-size: 13px; }
.logout-button:hover { color: var(--danger); }
.main-shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.servicebar { display: flex; align-items: center; gap: 12px; height: 56px; flex-shrink: 0; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.connection-health { display: flex; gap: 9px; align-items: center; min-width: 0; }
.connection-health strong { display: block; font-weight: 500; font-size: 12px; }
.connection-health small { display: block; font-size: 11px; line-height: 1.4; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-button { display: flex; align-items: center; gap: 9px; margin-left: auto; border: 0; background: transparent; padding: 3px; text-align: left; }
.profile-button .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; }
.profile-meta strong { display: block; font-size: 12px; font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-meta small { display: block; font-size: 10px; color: var(--muted); line-height: 1.4; }
.profile-button > [data-icon] { color: var(--muted); }
.profile-button .icon { width: 14px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 24px 20px; flex-shrink: 0; }
.breadcrumb { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 11px; margin-bottom: 10px; }
.breadcrumb span:last-child { color: var(--ink); }
.topbar h1 { font-size: 23px; line-height: 1.4; font-weight: 650; letter-spacing: .2px; }
#page-description { color: var(--muted); font-size: 12px; margin-top: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; padding-top: 15px; }
.role-chip { font-size: 11px; padding: 5px 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip:hover { border-color: var(--line-strong); }
.page-content { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 24px; outline: none; }
.page-caption { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 0 0 17px; }
.page-caption h2 { font-size: 16px; font-weight: 550; margin-bottom: 3px; }
.page-caption p { color: var(--muted); font-size: 12px; }
.caption-stats { display: flex; gap: 16px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.caption-stats strong { color: var(--ink); font-weight: 600; margin-right: 3px; }
.page-intro { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent-border); border-radius: 5px; padding: 12px 15px; color: var(--muted); font-size: 12px; margin-bottom: 18px; line-height: 1.8; }
.nav-backdrop, .menu-toggle { display: none; }
/* 5. Account table, filters, actual counters and pagination. */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 16px 18px; min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-top .icon { color: var(--muted); width: 18px; height: 18px; }
.stat-value { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.stat-value strong { font-size: 27px; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-value span { font-size: 11px; color: var(--muted); }
.table-panel, .account-table { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.account-table { overflow-x: auto; }
.filter-form { display: flex; align-items: center; gap: 12px; padding: 18px; flex-wrap: wrap; }
.filter-form label { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.filter-form input, .filter-form select { font-size: 12px; min-height: 36px; }
.filter-form .search-input { flex: 1; min-width: 190px; }
.filter-form .search-input input { width: 100%; }
.filter-form select { min-width: 126px; }
.search-input { position: relative; }
.search-input > .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.search-input input { padding-left: 35px; }
.account-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.selection-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.selection-count { color: var(--muted); font-size: 12px; margin-right: 6px; }
.selection-count b { color: var(--ink); font-weight: 500; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.data-table th { font-size: 12px; font-weight: 400; color: var(--muted); background: var(--surface-soft); white-space: nowrap; }
.data-table th, .data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table td small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.accounts-grid { min-width: 950px; }
.accounts-grid th, .accounts-grid td { padding: 12px 12px; }
.accounts-grid .check-cell { width: 38px; padding-left: 18px; padding-right: 6px; }
.accounts-grid .account-name-cell { width: 228px; }
.account-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-identity strong { display: block; font-weight: 550; font-size: 13px; max-width: 186px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-identity .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 14px; }
.accounts-grid .row-current td:first-child { box-shadow: inset 3px 0 var(--accent-border); }
.accounts-grid .row-current { background: var(--accent-soft); }
.accounts-grid .row-selected { background: var(--surface-soft); }
.account-note { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.device-state { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.row-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.current-label { color: var(--muted); font-size: 11px; }
.table-empty { text-align: center; padding: 44px 20px !important; color: var(--muted); }
.table-pagination { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pagination-actions { display: flex; align-items: center; gap: 8px; }
.pagination-actions .button { min-width: 30px; min-height: 30px; padding: 5px 8px; }
.pagination-actions select { font-size: 12px; padding: 4px 8px; min-height: 30px; }
.page-number { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--ink); border-radius: 4px; }
.table-note { padding: 11px 2px; color: var(--muted); font-size: 11px; display: flex; align-items: flex-start; gap: 7px; }
.table-note .icon { width: 14px; height: 16px; flex-basis: 14px; margin-top: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 22px 0 12px; }
.section-title h2 { font-size: 16px; font-weight: 550; }
.section-title p { font-size: 12px; color: var(--muted); margin-top: 3px; }
#members-panel:empty { display: none; }
.members-intro { font-size: 12px; color: var(--muted); padding: 14px 17px; }
/* Shared filter controls used by the audit page. */
.filter-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 9px 10px; font-size: 12px; color: var(--muted); }
.filter-tab.active { color: var(--ink); border-bottom-color: var(--accent-border); font-weight: 550; }
.filter-tab:hover { color: var(--ink); }
/* 7. Devices, templates, log details, overview and image library. */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head h3 { font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }
.card-head p { font-size: 11px; margin-top: 3px; }
.card-head > .status-pill { margin-left: auto; }
.card-text { font-size: 13px; line-height: 1.9; color: var(--ink); padding: 13px 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 87px minmax(0, 1fr); gap: 11px 14px; font-size: 12px; margin: 14px 0 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 17px; margin-top: 17px; border-top: 1px solid var(--line); }
.card-actions .button { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.chips span { border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; color: var(--muted); font-size: 11px; }
.toolbar { display: flex; align-items: center; gap: 15px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.toolbar .filter-tab { font-size: 13px; }
.table-clip { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-result { max-width: 410px; font-size: 12px; }
.log-result pre { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 5px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 380px; overflow-y: auto; font-size: 11px; }
.log-result summary { cursor: pointer; overflow-wrap: anywhere; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.overview-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-entry { display: flex; align-items: center; gap: 12px; text-align: left; padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; }
.quick-entry:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.quick-entry strong { display: block; font-size: 13px; font-weight: 500; }
.quick-entry small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.health-list { margin-top: 7px; }
.health-row { display: flex; align-items: center; gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.health-row:last-child { border: 0; }
.health-row .status-pill { margin-left: auto; }
.health-row strong { font-weight: 500; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.media-card { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--surface); min-width: 0; padding: 8px; }
.media-card img { display: block; width: 100%; height: 140px; object-fit: contain; background: var(--surface-soft); border-radius: 3px; }
.media-card p { color: var(--muted); font-size: 11px; margin: 8px 0; }
.media-card .button { width: 100%; min-height: 30px; font-size: 11px; padding: 5px; }
/* 8. Empty/error/loading states and dialogs. */
.chat-empty { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 48px 30px; min-height: 260px; flex: 1; }
.empty-icon { display: flex; justify-content: center; align-items: center; color: var(--muted); width: 48px; height: 48px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.empty-icon .icon { width: 23px; height: 23px; }
.chat-empty h2 { font-size: 17px; font-weight: 550; }
.chat-empty p { font-size: 12px; max-width: 370px; color: var(--muted); margin-top: 10px; line-height: 1.9; }
.chat-empty .button { margin-top: 20px; }
.empty-list { color: var(--muted); text-align: center; font-size: 12px; padding: 45px 20px; line-height: 2; }
.loading-state { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 100px 20px; color: var(--muted); font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--muted); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { min-height: 68px; margin: 16px; background: var(--hover); border-radius: 5px; }
dialog { width: min(570px, calc(100vw - 28px)); max-height: 90vh; max-height: 90dvh; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); color: var(--ink); overflow-y: auto; }
dialog::backdrop { background: rgb(0 0 0 / 38%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 21px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 17px; font-weight: 600; }
#modal-body { padding: 21px; }
#modal-body form > label { margin: 16px 0 6px; }
#modal-body form > label:first-child { margin-top: 0; }
#modal-body form > input, #modal-body form > textarea, #modal-body form > select, #modal-body > textarea, #modal-body > select { width: 100%; font-size: 13px; }
#modal-body form > textarea { resize: vertical; }
.modal-text { font-size: 13px; line-height: 1.9; color: var(--muted); overflow-wrap: anywhere; }
.modal-text strong { color: var(--ink); }
.inline-warning { margin: 15px 0; padding: 12px 13px; font-size: 12px; color: var(--warning); background: var(--warning-bg); border-radius: 5px; line-height: 1.85; }
.send-preview { border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); margin: 15px 0; padding: 15px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-footer { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 23px; padding-top: 17px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-help { font-size: 11px; line-height: 1.85; color: var(--muted); margin-top: 7px; }
.settings-form { width: min(760px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-soft); }
.settings-form > label:not(.check-label) { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 600; }
.settings-form > label:first-child { margin-top: 0; }
.settings-form > input, .settings-form > textarea { width: 100%; font-size: 13px; }
.settings-form > textarea { resize: vertical; }
.form-section { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 20px; }
.check-label { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.9; }
.check-label input { margin-top: 4px; }
.flex-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.break-word { overflow-wrap: anywhere; }
.sensitive-code { min-height: 240px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.85; resize: vertical; background: var(--surface-soft); }
.toast-region { position: fixed; top: 68px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(410px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--surface); padding: 13px 16px; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); color: var(--danger); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
/* 9. Responsive rules: same controls and permissions, mobile navigation drawer. */
@media  (max-width: 1400px) {
.topbar-actions .role-chip { display: none; }
}
@media  (max-width: 1120px) and (min-width: 961px) {
:root { --sidebar-width: 216px; }
.sidebar > .brand { font-size: 15px; padding-left: 14px; gap: 9px; }
.stat-card { padding: 13px; }
.stat-value span { display: none; }
.filter-form { gap: 8px; }
.filter-form select { min-width: 110px; }
}
@media  (max-width: 960px) {
.workspace { grid-template-columns: minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; transform: translateX(-100%); visibility: hidden; transition: transform .15s ease, visibility .15s; height: 100dvh; }
.nav-open .sidebar { transform: translateX(0); visibility: visible; }
.nav-backdrop { position: fixed; inset: 0; z-index: 35; display: block; border: 0; background: rgb(0 0 0 / 32%); width: 100vw; height: 100dvh; }
.menu-toggle { display: inline-flex; }
.servicebar { padding: 0 16px; }
.topbar { padding: 15px 18px 18px; }
.page-content { padding: 0 18px 20px; }
.overview-grid { grid-template-columns: 1fr; }
}
@media  (max-width: 720px) {
.servicebar { height: 54px; padding: 0 12px; gap: 8px; }
.connection-health small { max-width: 175px; font-size: 10px; }
.connection-health strong { font-size: 11px; }
.profile-meta, .profile-button > [data-icon] { display: none; }
.profile-button .avatar { width: 28px; height: 28px; flex-basis: 28px; }
.topbar { padding: 13px 14px 15px; gap: 10px; align-items: flex-end; }
.topbar h1 { font-size: 20px; }
.breadcrumb { display: none; }
#page-description { display: none; }
.topbar-actions { padding: 0; gap: 7px; }
.topbar .button { font-size: 12px; min-height: 34px; padding: 7px 9px; }
.topbar #refresh-page span:not([data-icon]) { display: none; }
.topbar #refresh-page { padding: 7px; }
.page-content { padding: 0 12px 16px; }
.stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card { padding: 12px 14px; }
.stat-value { margin-top: 5px; gap: 7px; }
.stat-value strong { font-size: 23px; }
.stat-value span { font-size: 10px; }
.filter-form { padding: 12px; gap: 10px; }
.filter-form .search-input { flex-basis: 100%; }
.filter-form label { flex: 1; min-width: 105px; }
.filter-form select { width: 100%; min-width: 0; }
.account-toolbar { padding: 10px 12px; }
.selection-actions { gap: 6px; }
.selection-actions .button, .account-toolbar > .button { font-size: 11px; padding: 5px 8px; }
.selection-count { width: 100%; margin: 0; }
.account-toolbar > .button { margin-left: auto; }
.table-pagination { padding: 12px; flex-wrap: wrap; gap: 10px; }
.table-pagination > span { font-size: 11px; }
.pagination-actions { gap: 6px; margin-left: auto; }
.table-note { font-size: 10px; }
.section-title h2 { font-size: 14px; }
.section-title .button { font-size: 11px; padding: 6px 8px; }
.section-title p { font-size: 11px; }
.cards-grid { grid-template-columns: 1fr; }
.card { padding: 16px; }
.card-head { gap: 9px; }
.card-head h3 { font-size: 14px; }
.card-head > .status-pill { font-size: 11px; }
.page-caption h2 { font-size: 14px; }
.page-caption p { font-size: 11px; }
.caption-stats { font-size: 11px; gap: 10px; }
.page-intro { font-size: 11px; margin-bottom: 14px; }
.toolbar { gap: 8px; overflow-x: auto; }
.toolbar .filter-tab { font-size: 12px; white-space: nowrap; }
.data-table { font-size: 12px; }
.data-table th { font-size: 11px; }
.account-table > .data-table { min-width: 580px; }
.accounts-grid { min-width: 950px; }
.media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.overview-links { gap: 9px; }
.quick-entry { padding: 12px; gap: 9px; }
.quick-entry small { font-size: 10px; }
.toast-region { top: 64px; right: 16px; max-height: 30vh; overflow: hidden; }
.toast { font-size: 12px; }
.login-brand { padding: 22px; }
.login-main { padding: 30px 20px 80px; }
.login-form { padding: 27px 24px; }
.chat-empty { min-height: 230px; padding: 30px 20px; }
}
@media  (max-height: 600px) and (max-width: 720px) {
.topbar { padding-top: 8px; padding-bottom: 8px; }
}
@media  (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
