/* Home Gateway UI v3 — semantic colors from the supplied 2026-09-05 guide. */
:root {
  --primitive-blue-600: #005fb8;
  --primitive-gray-050: #fafbfc;
  --primitive-white: #ffffff;
  --bg: #fafbfc;
  --surface: #ffffff;
  --panel: #f8f8f8;
  --line: #e2e8ee;
  --line-strong: #7f8ea3;
  --text: #273957;
  --heading: #022034;
  --muted: #596983;
  --accent: #005fb8;
  --accent-hover: #0258a8;
  --accent-pressed: #03498c;
  --on-accent: #ffffff;
  --accent-soft: #edf6ff;
  --success: #146c43;
  --success-soft: #eaf7ef;
  --warning: #8a4b08;
  --warning-soft: #fff4e5;
  --danger: #b42318;
  --danger-solid: #b42318;
  --on-danger: #ffffff;
  --danger-hover: #912018;
  --danger-soft: #fff0ee;
  --info: #005fb8;
  --info-soft: #edf6ff;
  --neutral-soft: #ecf0f3;
  --hover: #eef2f6;
  --overlay: rgba(2, 32, 52, .40);
  --focus: #005fb8;
  --nav-bg: #f8f8f8;
  --nav-text: #3b3b3b;
  --nav-muted: #596983;
  --nav-selected: #edf6ff;
  --nav-active: #005fb8;
  --nav-focus: #005fb8;
  --nav-hover: #edf0f3;
  --nav-expanded: 240px;
  --nav-compact: 64px;
  --toolbar-height: 64px;
  --status-height: 32px;
  --radius: 6px;
  --radius-surface: 8px;
  --shadow-float: 0 12px 36px rgba(2, 32, 52, .16);
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}

:root[data-theme="navy"] {
  --accent: #082f7e; --accent-hover: #1849a9; --accent-pressed: #06235e;
  --nav-bg: #030313; --nav-text: #d0d9e2; --nav-muted: #9aabc2;
  --nav-selected: #25334a; --nav-active: #ffffff; --nav-focus: #84caff; --nav-hover: #192438;
}
:root[data-theme="dark"] {
  --bg: #111820; --surface: #19232e; --panel: #151e28; --line: #334355;
  --line-strong: #8494a8; --text: #e0e9f3; --heading: #f5f8fc; --muted: #acbdd0;
  --accent: #84caff; --accent-hover: #abdafa; --accent-pressed: #6bb8ef;
  --on-accent: #10263a; --accent-soft: #203b51; --hover: #253443;
  --success: #8eddb4; --success-soft: #17392d; --warning: #f7cc8d; --warning-soft: #49331a;
  --danger: #ffb4aa; --danger-hover: #ffc7c0; --danger-soft: #482622;
  --info: #84caff; --info-soft: #203b51; --neutral-soft: #2c3a49;
  --nav-bg: #151e28; --nav-text: #e0e9f3; --nav-muted: #acbdd0;
  --nav-selected: #203b51; --nav-active: #84caff; --nav-focus: #84caff; --nav-hover: #253443;
  --focus: #84caff; --overlay: rgba(0, 0, 0, .65);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font-size: .875rem; line-height: 1.57; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { flex: 0 0 auto; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-150%); background: var(--surface); border: 2px solid var(--focus); border-radius: var(--radius); padding: 8px 12px; }
.skip-link:focus { transform: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--nav-expanded) minmax(0, 1fr); }
.global-navigation { position: sticky; top: 0; z-index: 40; height: 100vh; height: 100dvh; min-width: 0; display: flex; flex-direction: column; background: var(--nav-bg); border-right: 1px solid var(--line); overflow: hidden; }
.brand-row { min-height: var(--toolbar-height); padding: 0 8px 0 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.brand { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 7px; background: var(--accent); color: white; font-size: .8125rem; font-weight: 750; letter-spacing: .04em; }
.brand-copy, .identity-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong, .identity-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.brand-copy small, .identity-copy small { color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { position: relative; width: 40px; min-height: 40px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius); background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--hover); border-color: var(--line); }
.primary-navigation { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.nav-item[href="/dashboard/settings"] { margin-top: auto; }
.nav-item { position: relative; width: 100%; min-height: 40px; padding: 0 10px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: var(--radius); color: var(--nav-text); background: transparent; text-align: left; cursor: pointer; white-space: nowrap; }
.nav-item:hover { background: var(--nav-hover); text-decoration: none; }
.nav-item[aria-current="page"] { color: var(--nav-active); background: var(--nav-selected); font-weight: 650; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -1px; width: 3px; height: 22px; border-radius: 2px; background: var(--accent); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; background: var(--danger-solid); color: var(--on-danger); font-size: .75rem; font-weight: 700; }
.navigation-footer { padding: 8px; border-top: 1px solid var(--line); }
.identity-block { min-height: 48px; padding: 6px 8px; display: flex; align-items: center; gap: 10px; }
.identity-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; background: #dfe8f2; color: #234e73; font-weight: 700; }
.logout-form { margin: 2px 0 0; }
.logout-button { color: var(--muted); }

.app-shell[data-nav="compact"] { grid-template-columns: var(--nav-compact) minmax(0, 1fr); }
.app-shell[data-nav="compact"] .global-navigation { width: var(--nav-compact); }
.app-shell[data-nav="compact"] .brand-row { padding: 0 8px; justify-content: center; }
.app-shell[data-nav="compact"] .brand { display: none; }
.app-shell[data-nav="compact"] .nav-collapse svg { transform: rotate(180deg); }
.app-shell[data-nav="compact"] .nav-label,
.app-shell[data-nav="compact"] .brand-copy,
.app-shell[data-nav="compact"] .identity-copy { display: none; }
.app-shell[data-nav="compact"] .nav-item { padding: 0; justify-content: center; gap: 0; }
.app-shell[data-nav="compact"] .identity-block { justify-content: center; padding-inline: 0; }
.app-shell[data-nav="compact"] .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; }

.workspace { min-width: 0; min-height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.workspace-toolbar { position: sticky; top: 0; z-index: 30; min-height: var(--toolbar-height); display: flex; align-items: center; gap: 10px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.mobile-menu { display: none; }
.command-trigger { min-height: 40px; min-width: 260px; display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; }
.command-trigger:hover { border-color: #9ea7b3; }
.command-trigger span { flex: 1; }
kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--panel); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.toolbar-spacer, .status-spacer { flex: 1; }
.notification-button { color: var(--muted); }
.toolbar-badge { position: absolute; top: 1px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 9px; background: var(--danger-solid); color: var(--on-danger); font-size: .75rem; font-weight: 700; }
.role-chip { padding: 3px 8px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--panel); font-size: .75rem; text-transform: uppercase; }

#main-content { min-width: 0; }
.page-container { width: min(100%, 1440px); margin: 0 auto; padding: 24px; }
.breadcrumbs { min-height: 22px; display: flex; align-items: center; gap: 4px; margin-bottom: 8px; color: var(--muted); font-size: .8125rem; }
.breadcrumbs a { color: var(--muted); }
.page-header { min-height: 60px; display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.page-heading { min-width: 0; flex: 1; }
.page-heading h1 { margin: 0; font-size: 1.5rem; line-height: 1.33; font-weight: 600; color: var(--heading); letter-spacing: -.01em; }
.page-heading h1:focus { outline: none; }
.page-heading p { margin: 5px 0 0; color: var(--muted); max-width: 760px; }
.page-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.button { min-height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: var(--radius); font-weight: 600; cursor: pointer; white-space: nowrap; }
a.button:hover { text-decoration: none; }
.button.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { color: var(--text); background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover { background: var(--panel); }
.button.subtle { color: var(--accent); background: transparent; }
.button.subtle:hover { background: var(--accent-soft); }
.button.danger { color: white; background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: var(--danger-hover); }
.button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; color: var(--muted); background: var(--neutral-soft); border-color: var(--line); opacity: 1; }
.button-full { width: 100%; min-height: 40px; }
.inline-form { display: inline-flex; margin: 0; }
.manifest-editor { width: 100%; min-height: 360px; resize: vertical; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.notification-message { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
.pagination { min-height: 48px; padding: 8px 12px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric { min-width: 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8125rem; }
.metric-value { display: block; margin-top: 8px; font-size: 26px; line-height: 1.1; font-weight: 680; }
.metric-detail { display: block; margin-top: 6px; color: var(--muted); font-size: .8125rem; }

.section { margin-top: 24px; }
.section:first-child { margin-top: 0; }
.section-header { min-height: 32px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.section-header h2 { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--heading); }
.section-header p { margin: 2px 0 0; color: var(--muted); font-size: .8125rem; }
.section-link { font-size: .8125rem; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.surface-padded { padding: 18px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-list { margin: 0; display: grid; grid-template-columns: minmax(130px, .6fr) minmax(0, 1.4fr); }
.detail-list dt, .detail-list dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { min-width: 0; font-weight: 520; overflow-wrap: anywhere; }
.detail-list dt:last-of-type, .detail-list dd:last-of-type { border-bottom: 0; }

.attention-list, .compact-list { margin: 0; padding: 0; list-style: none; }
.attention-item, .compact-item { min-height: 58px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.attention-item:last-child, .compact-item:last-child { border-bottom: 0; }
.attention-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); }
.attention-icon.danger { background: var(--danger-soft); color: var(--danger); }
.item-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.item-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.command-bar { min-height: 52px; padding: 8px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.search-field { position: relative; flex: 1 1 260px; max-width: 440px; }
.search-field svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { width: 100%; height: 34px; padding: 0 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.result-count { color: var(--muted); font-size: .8125rem; white-space: nowrap; }
.select { height: 34px; padding: 0 30px 0 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }

.data-table-wrap { min-width: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.data-table th { position: sticky; top: 0; z-index: 1; height: 40px; padding: 0 12px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); text-align: left; font-size: .75rem; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; }
.data-table td { height: 52px; padding: 9px 12px; 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: #fafbfd; }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.primary-cell { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.object-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); background: var(--panel); }
.primary-cell-copy { min-width: 0; display: flex; flex-direction: column; }
.primary-cell-copy a, .primary-cell-copy strong { color: var(--text); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary-cell-copy a:hover { color: var(--accent); }
.primary-cell-copy small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }

.status-badge { width: fit-content; min-height: 24px; padding: 2px 7px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; border-radius: 12px; font-size: .75rem; font-weight: 620; white-space: nowrap; }
.status-success { color: var(--success); background: var(--success-soft); border-color: #b9dfc8; }
.status-warning { color: var(--warning); background: var(--warning-soft); border-color: #ead58a; }
.status-danger { color: var(--danger); background: var(--danger-soft); border-color: #f3b7b1; }
.status-info { color: var(--info); background: var(--info-soft); border-color: #b8d8f0; }
.status-neutral { color: var(--muted); background: var(--neutral-soft); border-color: #d9dde2; }
.pill-list { display: flex; gap: 4px; flex-wrap: wrap; }
.pill { padding: 2px 7px; border-radius: 10px; background: var(--neutral-soft); color: var(--muted); font-size: .75rem; }
.security-flow { margin: 0; padding: 0; display: grid; gap: 0; list-style: none; counter-reset: security-step; }
.security-flow li { position: relative; min-height: 42px; padding: 6px 0 6px 38px; display: flex; align-items: center; counter-increment: security-step; }
.security-flow li::before { content: counter(security-step); position: absolute; left: 0; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #b8d8f0; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-size: .75rem; font-weight: 700; }
.security-flow li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 32px; bottom: -4px; width: 1px; background: var(--line-strong); }

.notice { margin: 0 0 16px; padding: 11px 12px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid; border-radius: var(--radius); }
.notice strong { display: block; margin-bottom: 2px; }
.notice-info { color: var(--info); background: var(--info-soft); border-color: #b8d8f0; }
.notice-success { color: var(--success); background: var(--success-soft); border-color: #b9dfc8; }
.notice-warning { color: var(--warning); background: var(--warning-soft); border-color: #ead58a; }
.notice-danger { color: var(--danger); background: var(--danger-soft); border-color: #f3b7b1; }
.empty-state { min-height: 160px; padding: 28px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 8px 0 2px; color: var(--text); font-size: 15px; }
.empty-state p { max-width: 520px; margin: 0 0 12px; }

.section-tabs { margin-bottom: 18px; display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.section-tabs a { position: relative; min-height: 38px; padding: 8px 12px; color: var(--muted); white-space: nowrap; }
.section-tabs a:hover { color: var(--text); text-decoration: none; background: var(--neutral-soft); }
.section-tabs a[aria-current="page"] { color: var(--accent); font-weight: 650; }
.section-tabs a[aria-current="page"]::after { content: ""; position: absolute; height: 2px; left: 8px; right: 8px; bottom: -1px; background: var(--accent); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.field small { color: var(--muted); }
.field-error { color: var(--danger); font-size: .8125rem; }
.approval-card { padding: 16px; border-bottom: 1px solid var(--line); }
.approval-card:last-child { border-bottom: 0; }
.approval-header { display: flex; align-items: flex-start; gap: 12px; }
.approval-header .item-copy { min-width: 180px; }
.approval-meta { margin: 12px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.meta-block { min-width: 0; }
.meta-block small { display: block; color: var(--muted); font-size: .75rem; }
.meta-block strong, .meta-block code { overflow-wrap: anywhere; }
.approval-form { padding-top: 12px; display: grid; grid-template-columns: minmax(110px, .6fr) minmax(160px, 1fr) auto auto; gap: 8px; align-items: end; border-top: 1px solid var(--line); }

.log-view { max-height: 540px; margin: 0; padding: 14px; overflow: auto; color: #d6deeb; background: #16212c; border-radius: var(--radius); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .94em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.details-menu { position: relative; }
.details-menu > summary { list-style: none; }
.details-menu > summary::-webkit-details-marker { display: none; }
.details-menu[open] .menu-popover { display: flex; }
.menu-popover { position: absolute; z-index: 20; right: 0; top: calc(100% + 5px); min-width: 170px; padding: 5px; display: none; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.menu-popover a, .menu-popover button { width: 100%; min-height: 40px; padding: 6px 8px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 5px; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.menu-popover a:hover, .menu-popover button:hover { background: var(--panel); text-decoration: none; }
.menu-popover .danger-command { color: var(--danger); }

.status-bar { min-width: 0; height: var(--status-height); padding: 0 12px; display: flex; align-items: center; gap: 12px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); font-size: .75rem; }
.status-bar .status-badge { min-height: 20px; padding-block: 0; }

dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-float); }
dialog::backdrop { background: var(--overlay); }
.command-dialog { width: min(620px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 64px)); margin-top: 12vh; border-radius: 10px; overflow: hidden; }
.command-header { min-height: 54px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.command-header input { min-width: 0; flex: 1; height: 36px; border: 0; outline: 0; font-size: 15px; }
.command-results { max-height: 480px; padding: 6px; overflow-y: auto; }
.command-result { min-height: 48px; padding: 7px 9px; display: flex; align-items: center; gap: 10px; border-radius: var(--radius); color: var(--text); }
.command-result:hover, .command-result[data-active="true"] { background: var(--accent-soft); text-decoration: none; }
.command-result span { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.command-result strong, .command-result small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-result small { color: var(--muted); font-size: .75rem; }
.command-empty { padding: 32px; color: var(--muted); text-align: center; }
.confirm-dialog { width: min(430px, calc(100vw - 32px)); border-radius: 10px; }
.confirm-dialog form { padding: 22px; }
.dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: var(--danger-soft); }
.confirm-dialog h2 { margin: 14px 0 4px; font-size: 18px; }
.confirm-dialog p { margin: 0; color: var(--muted); white-space: pre-line; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }
.toast-region { position: fixed; z-index: 100; right: 16px; bottom: 42px; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 10px 12px; display: flex; gap: 8px; color: white; background: #242a31; border-radius: var(--radius); box-shadow: var(--shadow-float); }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-shell { width: min(100%, 980px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 56px; align-items: center; }
.auth-introduction h1 { max-width: 620px; margin: 12px 0; font-size: clamp(32px, 4.3vw, 50px); line-height: 1.1; letter-spacing: -.035em; }
.auth-introduction > p:not(.eyebrow) { max-width: 620px; color: var(--muted); font-size: 16px; }
.brand-mark-large { width: 42px; height: 42px; }
.eyebrow { margin: 12px 0 0; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .08em; }
.auth-benefits { margin: 24px 0 0; padding: 0; display: grid; gap: 14px; list-style: none; }
.auth-benefits li { display: flex; align-items: flex-start; gap: 11px; }
.auth-benefits svg { margin-top: 2px; color: var(--accent); }
.auth-benefits span { display: flex; flex-direction: column; }
.auth-benefits small { color: var(--muted); }
.auth-card { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: none; }
.auth-card-header { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.auth-card h2 { margin: 3px 0 0; font-size: 20px; }
.auth-form { display: grid; gap: 14px; }
.auth-help { margin: 16px 0; color: var(--muted); font-size: .8125rem; }
.auth-meta { padding-top: 12px; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: .75rem; }

.drawer-overlay { display: none; }

@media (max-width: 1199px) and (min-width: 720px) {
  .app-shell { grid-template-columns: var(--nav-compact) minmax(0, 1fr); }
  .global-navigation { width: var(--nav-compact); }
  .brand-row { padding: 0 8px; justify-content: center; }
  .brand { display: none; }
  .nav-label, .brand-copy, .identity-copy { display: none; }
  .nav-item { padding: 0; justify-content: center; gap: 0; }
  .identity-block { justify-content: center; padding-inline: 0; }
  .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 9px; }
  .nav-collapse { display: none; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 719px) {
  .app-shell { display: block; }
  .global-navigation { position: fixed; left: 0; width: min(86vw, 320px); transform: translateX(-105%); transition: transform 180ms ease; box-shadow: var(--shadow-float); }
  body[data-drawer="open"] { overflow: hidden; }
  body[data-drawer="open"] .global-navigation { transform: translateX(0); }
  .drawer-overlay { position: fixed; inset: 0; z-index: 35; background: var(--overlay); }
  body[data-drawer="open"] .drawer-overlay { display: block; }
  .nav-collapse { display: none; }
  .mobile-menu { display: inline-grid; }
  .workspace { min-height: 100vh; }
  .workspace-toolbar { padding: 0 12px; }
  .command-trigger { min-width: 0; width: 38px; justify-content: center; padding: 0; }
  .command-trigger span, .command-trigger kbd, .role-chip { display: none; }
  .page-container { padding: 16px 12px 24px; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .button.primary { flex: 1; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { padding: 12px; }
  .metric-value { font-size: 22px; }
  .split-grid, .detail-grid { grid-template-columns: 1fr; }
  .command-bar { align-items: stretch; flex-wrap: wrap; }
  .search-field { max-width: none; flex-basis: 100%; }
  .data-table-wrap { overflow: visible; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { min-height: 30px; height: auto; padding: 4px 0 4px 42%; border: 0; position: relative; }
  .data-table td::before { content: attr(data-label); position: absolute; left: 0; width: 38%; color: var(--muted); font-size: .75rem; text-transform: uppercase; }
  .data-table td:first-child { padding-left: 0; margin-bottom: 6px; }
  .data-table td:first-child::before { display: none; }
  .table-actions { justify-content: flex-start; }
  .approval-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approval-form { grid-template-columns: 1fr 1fr; }
  .approval-form .field { grid-column: 1 / -1; }
  .status-bar span:nth-of-type(2), .status-bar span:nth-last-of-type(1) { display: none; }
  .auth-page { padding: 20px; place-items: start center; }
  .auth-shell { grid-template-columns: 1fr; gap: 28px; }
  .auth-introduction h1 { font-size: 34px; }
  .auth-benefits { display: none; }
  .auth-card { padding: 20px; }
}

@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .approval-meta { grid-template-columns: 1fr; }
  .approval-form { grid-template-columns: 1fr; }
  .status-bar { gap: 6px; }
}

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

@media (forced-colors: active) {
  .status-badge, .nav-item[aria-current="page"], .notice { border: 1px solid CanvasText; }
}

/* Shared components: restrained borders, stable controls and readable themes. */
.surface, .metric { border-radius: var(--radius-surface); }
.brand { color: var(--nav-text); }
.brand-copy small, .identity-copy small, .navigation-footer .logout-button { color: var(--nav-muted); }
.global-navigation .identity-copy, .global-navigation .icon-button { color: var(--nav-text); }
.global-navigation .icon-button:hover { background: var(--nav-hover); border-color: transparent; }
.global-navigation :focus-visible { outline-color: var(--nav-focus); }
.nav-item[aria-current="page"]::before { background: var(--nav-focus); }
.brand-row, .navigation-footer { border-color: color-mix(in srgb, var(--nav-muted) 20%, transparent); }
.primary-navigation { gap: 6px; min-height: 0; overflow-y: auto; }
.nav-item { padding-block: 8px; }
.button { line-height: 1.4; transition: background-color 120ms ease, border-color 120ms ease; }
.button:active { transform: none; }
.button.primary:active { background: var(--accent-pressed); }
.button.secondary { background: var(--panel); border-color: var(--line); }
.button.secondary:hover { border-color: var(--line-strong); }
.button.stop-control { color: var(--text); background: var(--panel); border-color: var(--line-strong); }
.button.stop-control:hover { color: var(--warning); background: var(--warning-soft); }
.button.danger { color: var(--on-danger); background: var(--danger-solid); border-color: var(--danger-solid); }
.button.danger:hover { background: #912018; }
.status-badge { min-height: 26px; font-size: .75rem; padding: 3px 8px; border: 0; font-weight: 500; }
.status-neutral { color: var(--muted); background: var(--neutral-soft); }
.field input, .field select, .field textarea, .manifest-editor, .command-bar select {
  border-color: var(--line-strong); background-color: var(--surface); border-radius: 6px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-width: 0; }
select { min-height: 40px; padding: 7px 30px 7px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background-color: var(--surface); cursor: pointer; }
select:focus-visible, input:focus-visible, textarea:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.field { min-width: 0; }
.field label { font-weight: 500; }
.theme-control { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.theme-control select { width: 116px; border-color: transparent; background-color: var(--panel); font-size: .8125rem; }
.theme-control select:hover { border-color: var(--line-strong); }
.role-chip { font-size: .75rem; text-transform: none; padding: 5px 9px; }
.drawer-close { display: none; }
.section-link { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; }
.page-header { min-height: 0; margin-bottom: 20px; align-items: center; }
.page-heading p { margin-top: 6px; }
.data-table thead th { background: var(--panel); color: var(--muted); font-weight: 500; }
.data-table td { min-height: 48px; padding-block: 13px; }
.data-table tbody tr:hover { background: var(--hover); }
.table-actions { flex-wrap: wrap; }
.menu-popover { max-width: min(280px, calc(100vw - 32px)); }
.menu-popover form { margin: 0; }
.menu-popover button { min-height: 40px; }
.section-tabs a { min-height: 40px; }
.status-bar { min-height: var(--status-height); height: auto; flex-wrap: wrap; }
.password-field { display: flex; align-items: center; position: relative; }
.password-field input { padding-right: 44px; }
.password-field button { position: absolute; right: 2px; }
.auth-card { border-radius: 12px; }
.auth-introduction h1 { color: var(--heading); font-size: clamp(2rem, 3.5vw, 2.625rem); font-weight: 600; line-height: 1.25; letter-spacing: -.02em; }
.auth-introduction p { line-height: 1.7; }
.auth-shell { max-width: 940px; }
.dialog-icon { background: var(--warning-soft); color: var(--warning); }
.command-dialog { max-height: calc(100dvh - 48px); }
.command-header input { background: var(--surface); color: var(--text); }
.command-header input:focus-visible { outline-offset: -2px; }
.compact-item time { flex-shrink: 0; color: var(--muted); font-size: .8125rem; }
.form-status { color: var(--muted); font-size: .8125rem; }

/* Home: application cards and links occupy the primary workspace. */
.portal-status { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 40px; margin: -4px 0 24px; font-size: .8125rem; color: var(--muted); }
.status-divider { margin: 0 8px; color: var(--line-strong); }
.status-inline-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; color: var(--warning); background: var(--warning-soft); }
.launchpad-layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 28px; align-items: start; }
.portal-apps, .portal-links { min-width: 0; }
.section-count { font-size: .8125rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
.launcher-toolbar { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.launcher-toolbar .search-field { min-height: 40px; max-width: 420px; min-width: 0; flex: 1; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 11px; }
.launcher-toolbar input { min-width: 0; width: 100%; height: auto; min-height: 38px; padding: 8px 22px; background: transparent; border: 0; border-radius: 0; }
.launcher-toolbar .search-field:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
.launcher-toolbar input:focus-visible { outline: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.filter-chip { min-height: 32px; padding: 4px 11px; color: var(--muted); font-size: .8125rem; font-weight: 500; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; }
.filter-chip:hover { background: var(--hover); }
.filter-chip[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 -2px var(--accent); }
.app-tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.app-tile { min-width: 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; transition: border-color 120ms ease; }
.app-tile:hover, .app-tile:focus-within { border-color: var(--line-strong); }
.app-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.app-tile-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; color: var(--accent); background: var(--accent-soft); border-radius: 9px; }
.app-tile h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.5; font-weight: 600; color: var(--heading); overflow-wrap: anywhere; }
.app-tile h3 a { color: inherit; }
.app-tile h3 a:hover { color: var(--accent); text-decoration: underline; }
.app-tile-description { margin: 0 0 14px; color: var(--muted); font-size: .8125rem; line-height: 1.55; flex: 1; overflow-wrap: anywhere; }
.app-tile-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--muted); padding-bottom: 13px; }
.app-tile-meta > span, .app-detail-link { display: inline-flex; align-items: center; gap: 4px; }
.app-detail-link { min-height: 24px; }
.app-tile-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.app-tile-actions > .button.primary, .app-tile-actions > form:first-child { flex: 1; }
.app-tile-actions > form:first-child .button { width: 100%; }
.app-tile-actions .details-menu { margin-left: auto; }
.portal-links .section-header { margin-bottom: 14px; }
.portal-links > .section-header > svg { color: var(--muted); }
.shortcut-list { display: grid; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.shortcut-link { min-width: 0; min-height: 78px; display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); border-bottom: 1px solid var(--line); }
.shortcut-link:first-child { border-radius: 8px 8px 0 0; }
.shortcut-link:last-child { border: 0; border-radius: 0 0 8px 8px; }
.shortcut-link:hover { background: var(--accent-soft); text-decoration: none; }
.shortcut-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; color: var(--accent); background: var(--accent-soft); border-radius: 6px; }
.shortcut-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.shortcut-copy strong { font-weight: 500; font-size: .875rem; color: var(--heading); }
.shortcut-copy small { color: var(--muted); font-size: .75rem; line-height: 1.6; }
.shortcut-link > svg { color: var(--muted); }
.shortcut-unavailable, .shortcut-unavailable:hover { background: var(--panel); }
.shortcut-unavailable .shortcut-icon { color: var(--muted); background: var(--neutral-soft); }
.portal-tip { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; padding: 4px; color: var(--muted); }
.portal-tip p { margin: -2px 0 0; font-size: .75rem; line-height: 1.7; }
.portal-events { margin-top: 28px; }
.portal-events .compact-item { min-height: 58px; padding: 12px 16px; gap: 12px; }
.portal-events .item-copy strong { font-weight: 500; }
.portal-events .item-copy small { font-size: .75rem; }
.portal-attention .attention-item > svg { color: var(--warning); }
.portal-attention .attention-list { border-left: 3px solid var(--warning); }
.inline-empty { padding: 16px; color: var(--muted); margin: 0; font-size: .8125rem; }
.filter-empty { padding: 24px; color: var(--muted); text-align: center; }
.filter-empty strong { color: var(--heading); }

@media (min-width: 1680px) {
  .page-container { max-width: 1600px; }
  .app-tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .launchpad-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; }
  .app-tile { padding: 14px; }
  .shortcut-link { padding-inline: 12px; gap: 9px; }
}
@media (max-width: 900px) {
  .launchpad-layout { grid-template-columns: 1fr; gap: 24px; }
  .shortcut-list { display: flex; overflow-x: auto; }
  .shortcut-link { flex: 0 0 195px; min-height: 64px; border-bottom: 0; border-right: 1px solid var(--line); border-radius: 0 !important; }
  .shortcut-link:last-child { border-right: 0; }
  .shortcut-copy small { display: none; }
  .portal-tip { display: none; }
}
@media (max-width: 719px) {
  .app-shell[data-nav="compact"] .global-navigation { width: min(86vw, 320px); }
  .app-shell[data-nav="compact"] .nav-label, .app-shell[data-nav="compact"] .brand-copy, .app-shell[data-nav="compact"] .identity-copy { display: flex; }
  .app-shell[data-nav="compact"] .nav-item { padding: 8px 10px; justify-content: flex-start; gap: 12px; }
  .global-navigation .brand, .app-shell[data-nav="compact"] .brand { display: flex; }
  .global-navigation .brand-row { padding-right: 44px; }
  .drawer-close { position: absolute; right: 4px; top: 12px; display: inline-grid; }
  .global-navigation[aria-hidden="true"] { visibility: hidden; }
  .theme-control > svg, .role-chip { display: none; }
  .theme-control select { width: 108px; min-height: 44px; }
  .workspace-toolbar { min-height: 64px; height: auto; gap: 6px; }
  .command-trigger { width: 44px; height: 44px; min-width: 44px; }
  .page-header { flex-direction: row; align-items: start; gap: 10px; }
  .page-actions { width: auto; }
  .page-actions .button { min-width: 40px; padding-inline: 10px; }
  .portal-status { gap: 8px; margin-bottom: 20px; }
  .portal-events .compact-item time { font-size: .75rem; }
  .data-table td { padding-block: 6px; min-height: 36px; overflow-wrap: anywhere; }
  .status-bar { position: static; gap: 8px; padding: 6px 12px; }
  .button, .icon-button, .filter-chip { min-height: 44px; }
  .icon-button { min-width: 44px; }
  .nav-item, .field input:not([type="checkbox"]):not([type="radio"]), .field select { min-height: 44px; }
  .launcher-toolbar input { min-height: 42px; }
  .filter-chip { padding-inline: 9px; }
  .launcher-toolbar .search-field { flex-basis: auto; }
  .auth-page { padding: 24px 16px; }
  .auth-shell { gap: 24px; }
  .auth-introduction h1 { font-size: 2rem; }
}
@media (max-width: 480px) {
  .app-tile-grid, .shortcut-list { grid-template-columns: 1fr; }
  .app-tile { padding: 16px; }
  .app-tile-top { margin-bottom: 8px; }
  .app-tile-description { margin-bottom: 8px; }
  .launcher-toolbar { flex-wrap: wrap; gap: 6px; }
  .launcher-toolbar .search-field { flex-basis: 100%; }
  .launcher-toolbar .result-count { display: none; }
  .portal-events .compact-item { align-items: flex-start; flex-wrap: wrap; }
  .portal-events .compact-item time { padding-left: 29px; }
  .page-heading h1 { font-size: 1.375rem; }
}
@media (forced-colors: active) {
  .filter-chip[aria-pressed="true"], .app-tile, .shortcut-list, .button, .app-tile-icon { border: 1px solid CanvasText; }
  .filter-chip[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* Public destinations keep their own authentication and open in a new tab. */
.external-mark { font-size: .8em; color: var(--muted); }
.shortcut-copy .external-status { margin-top: 5px; font-size: 11px; }
.external-status[data-link-status="healthy"] { color: var(--success, #287548); }
.external-status[data-link-status="unhealthy"] { color: var(--danger, #bc3434); }
.external-status[data-link-status="auth_required"] { color: var(--warning, #946000); }

.authenticator-qr { background: white; padding: 12px; max-width: 100%; height: auto; }
