:root {
  color-scheme: dark;
  --ink: #0a0a0a;
  --sidebar: #141414;
  --surface: #141414;
  --surface-raised: #1c1c1c;
  --line: #2c2c2c;
  --text: #ffffff;
  --text-soft: #a3a3a3;
  --text-muted: #737373;
  --paper: #f3f3f3;
  --text-on-light: #111111;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --radius: 8px;
  --sidebar-width: 256px;
  --topbar-height: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--ink);
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

body > .topbar,
body > .notification-placeholder,
body > .footer {
  display: none;
}

body > .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea,
summary {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

::selection {
  background: var(--paper);
  color: var(--text-on-light);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: var(--space-2);
  left: var(--space-2);
  min-height: 44px;
  padding: 10px var(--space-2);
  transform: translateY(-160%);
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text-on-light);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  width: 100%;
  height: 100dvh;
  padding: var(--space-3) var(--space-2);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: block;
  padding: 0 var(--space-1) var(--space-3);
  color: var(--text);
  text-decoration: none;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.brand-caption {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.nav-section + .nav-section {
  margin-top: var(--space-3);
}

.nav-section-title {
  margin: 0 0 var(--space-1);
  padding: 0 var(--space-1);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.nav-link:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--text-on-light);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3) var(--space-1) 0;
  border-top: 1px solid var(--line);
}

.sidebar-mode {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.sidebar-note {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
}

.sidebar-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1);
  align-items: center;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--line);
}

.sidebar-user-name,
.sidebar-user-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.sidebar-user-role {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-logout:hover {
  border-color: var(--text-soft);
  color: var(--text);
}

.workspace {
  min-width: 0;
}

.workspace > .topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: var(--topbar-height);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}

.topbar-context {
  min-width: 0;
}

.topbar-title {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-subtitle {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-2);
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px var(--space-1);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.operator,
.mobile-operator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 160px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--space-1);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-4);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.page-heading {
  min-width: 0;
}

.overline {
  margin: 0 0 var(--space-1);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--text);
  line-height: 1.2;
}

h1 {
  margin-bottom: var(--space-1);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 730;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: var(--space-1);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3 {
  margin-bottom: var(--space-1);
  font-size: 15px;
  font-weight: 700;
}

.page-description {
  max-width: 704px;
  margin: 0;
  color: var(--text-soft);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button-secondary {
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--text-soft);
  background: var(--surface-raised);
}

.section {
  margin-top: var(--space-4);
}

.section:first-child {
  margin-top: 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.section-copy {
  max-width: 640px;
  color: var(--text-soft);
  font-size: 13px;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
}

.status-card {
  display: flex;
  min-width: 0;
  min-height: 184px;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-card[data-state="attention"] {
  border-color: var(--text);
  background: var(--surface-raised);
}

.card-kicker {
  margin: 0 0 var(--space-2);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-value {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 720;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.status-detail {
  margin: var(--space-1) 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  margin-top: var(--space-3);
  padding: 4px var(--space-1);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.badge-strong {
  border-color: var(--text);
  background: var(--paper);
  color: var(--text-on-light);
}

.badge-muted {
  color: var(--text-soft);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(288px, 0.75fr);
  gap: var(--space-2);
  align-items: stretch;
}

.panel {
  min-width: 0;
  padding: var(--space-3);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.attention-list {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.attention-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  min-height: 72px;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sidebar);
}

.attention-title {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.attention-description {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 12px;
}

.text-link {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 4px;
}

.text-link:hover {
  color: var(--paper);
}

.empty-state {
  display: flex;
  min-height: 224px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-3);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--sidebar);
}

.empty-state.compact {
  min-height: 176px;
}

.empty-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.empty-description {
  max-width: 520px;
  margin: var(--space-1) 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.quick-link {
  display: flex;
  min-width: 0;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.quick-link:hover {
  border-color: var(--text-soft);
  background: var(--surface-raised);
}

.quick-link-title {
  font-size: 14px;
  font-weight: 720;
}

.quick-link-description {
  color: var(--text-soft);
  font-size: 12px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
}

.mobile-topbar {
  display: none;
}

.mobile-menu {
  position: relative;
}

.mobile-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 44px;
  padding: 10px var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu summary::marker {
  content: "";
}

.mobile-menu[open] summary {
  border-color: var(--text-soft);
  background: var(--surface-raised);
}

.mobile-menu-panel {
  position: absolute;
  top: 52px;
  left: 0;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100dvh - 80px);
  padding: var(--space-1);
  overflow-y: auto;
  border: 1px solid var(--text-soft);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: 0 16px 32px var(--ink);
}

.mobile-menu-panel .nav-link {
  width: 100%;
}

.mobile-menu-footer {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-1) var(--space-1);
  border-top: 1px solid var(--line);
}

.mobile-menu-footer .sidebar-logout {
  width: 100%;
}

.mobile-brand {
  min-width: 0;
  text-align: center;
}

.mobile-brand strong,
.mobile-brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-brand strong {
  font-size: 13px;
}

.mobile-brand span {
  color: var(--text-soft);
  font-size: 11px;
}

.mobile-operator {
  max-width: 88px;
  font-size: 11px;
}

.sidebar-logout-form {
  margin: 0;
}

.sidebar-logout-form input[type="hidden"] {
  display: none;
}

.sidebar-logout-form .sidebar-logout {
  appearance: none;
  min-height: 36px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.sidebar-logout-form .sidebar-logout:hover {
  border-color: var(--text-soft);
  color: var(--text);
}

.legacy-page > * {
  min-width: 0;
}

.legacy-page > * + * {
  margin-top: var(--space-3);
}

.legacy-page > .hero {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.legacy-page > .hero + * {
  margin-top: 0;
}

.legacy-page .hero h2 {
  max-width: 760px;
  margin-bottom: var(--space-1);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 730;
  letter-spacing: -0.035em;
}

.legacy-page .hero > p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--text-soft);
}

.legacy-page .eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legacy-page .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.legacy-page .badge {
  min-height: 26px;
  margin: 0;
  padding: 4px 8px;
  background: transparent;
}

.legacy-page .badge-safe {
  border-color: #5a5a5a;
  color: #d4d4d4;
}

.legacy-page .badge-warn,
.legacy-page .badge-danger {
  border-color: var(--text-soft);
  color: var(--text);
}

.legacy-page .panel,
.legacy-page .card,
.legacy-page .metric-card,
.legacy-page .config-card,
.legacy-page .agent-card,
.legacy-page .locked-card,
.legacy-page .switch-card {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.legacy-page .panel > :first-child,
.legacy-page .card > :first-child,
.legacy-page .metric-card > :first-child,
.legacy-page .config-card > :first-child,
.legacy-page .agent-card > :first-child {
  margin-top: 0;
}

.legacy-page .panel > :last-child,
.legacy-page .card > :last-child,
.legacy-page .metric-card > :last-child,
.legacy-page .config-card > :last-child,
.legacy-page .agent-card > :last-child {
  margin-bottom: 0;
}

.legacy-page .section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.legacy-page .section-head h2,
.legacy-page .section-head p {
  margin-bottom: 0;
}

.legacy-page .grid,
.legacy-page .metrics-grid,
.legacy-page .config-grid,
.legacy-page .agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.legacy-page .status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.legacy-page .grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.legacy-page .metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.legacy-page .status-card {
  min-height: 152px;
}

.legacy-page .status-card.success,
.legacy-page .status-card.warning,
.legacy-page .status-card.danger {
  border-color: var(--line);
  background: var(--surface);
}

.legacy-page .status {
  display: inline-flex;
  width: fit-content;
  margin-bottom: auto;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legacy-page .status.ok,
.legacy-page .status.warn,
.legacy-page .status.danger {
  color: var(--text-soft);
}

.legacy-page .metric-value {
  margin: var(--space-1) 0;
  color: var(--text);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 730;
  letter-spacing: -0.035em;
}

.legacy-page .muted,
.legacy-page .field-hint,
.legacy-page .save-checks,
.legacy-page .settings-summary,
.legacy-page .support-textarea + p {
  color: var(--text-soft);
}

.legacy-page .safety,
.legacy-page .warning,
.legacy-page .danger,
.legacy-page .save-message,
.legacy-page .alert {
  padding: 12px var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
}

.legacy-page .clean-list {
  margin: var(--space-2) 0 0;
  padding-left: 20px;
}

.legacy-page .clean-list li + li {
  margin-top: 6px;
}

.legacy-page .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.legacy-page table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  color: var(--text);
  font-size: 13px;
}

.legacy-page th,
.legacy-page td {
  padding: 12px var(--space-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.legacy-page th {
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legacy-page tr:last-child td {
  border-bottom: 0;
}

.legacy-page .form,
.legacy-page .settings-form,
.legacy-page .filters-form,
.legacy-page .note-form {
  display: grid;
  gap: var(--space-2);
}

.legacy-page .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.legacy-page .field,
.legacy-page .select-wrap,
.legacy-page label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.legacy-page input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.legacy-page select,
.legacy-page textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--ink);
  color: var(--text);
}

.legacy-page textarea {
  min-height: 112px;
  resize: vertical;
}

.legacy-page input:disabled,
.legacy-page select:disabled,
.legacy-page textarea:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.legacy-page .actions,
.legacy-page .form-actions,
.legacy-page .hero-actions,
.legacy-page .filter-actions,
.legacy-page .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.legacy-page button,
.legacy-page .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px var(--space-2);
  border: 1px solid var(--paper);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text-on-light);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.legacy-page button:hover,
.legacy-page .button:hover {
  background: #d4d4d4;
}

.legacy-page button.secondary,
.legacy-page .button.secondary,
.legacy-page .button-secondary {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

.legacy-page button:disabled,
.legacy-page .button[aria-disabled="true"] {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text-muted);
  cursor: not-allowed;
}

.legacy-page .small-button {
  min-height: 34px;
  padding: 6px 10px;
}

.legacy-page .switch-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.legacy-page .switch-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.legacy-page .switch-input {
  width: 20px;
  height: 20px;
  accent-color: var(--paper);
}

.login-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100dvh;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--topbar-height);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.login-brand .brand {
  margin: 0;
}

.login-page {
  width: min(100%, 520px);
  margin: auto;
  padding: var(--space-4) var(--space-2);
}

.login-page .login-panel {
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.login-page .login-panel h2 {
  font-size: clamp(24px, 4vw, 32px);
}

.login-page .login-panel .muted {
  color: var(--text-soft);
}

.login-page .login-panel .eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-page .login-panel .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.login-page .login-panel .badge {
  min-height: 26px;
  margin: 0;
  border-color: var(--line);
  background: transparent;
  color: var(--text-soft);
  box-shadow: none;
}

.login-page .login-panel .badge-warn,
.login-page .login-panel .badge-danger,
.login-page .login-panel .badge-safe {
  border-color: var(--text-soft);
  background: transparent;
  color: var(--text);
}

.login-page .form {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.login-page label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.login-page input {
  width: 100%;
  min-height: 46px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--text);
}

.login-page button {
  min-height: 46px;
  border: 1px solid var(--paper);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text-on-light);
  font-weight: 750;
  cursor: pointer;
  box-shadow: none;
}

.login-page .alert {
  margin-top: var(--space-2);
  padding: 12px var(--space-2);
  border: 1px solid var(--text-soft);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.login-footer {
  flex-wrap: wrap;
}

@media (max-width: 1120px) {
  .status-grid,
  .quick-links,
  .legacy-page .status-grid,
  .legacy-page .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .workspace > .topbar {
    display: none;
  }

  .mobile-topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: var(--space-1);
    align-items: center;
    min-height: 64px;
    padding: 10px var(--space-2);
    border-bottom: 1px solid var(--line);
    background: var(--ink);
  }

  .page {
    padding: var(--space-3) var(--space-2);
  }
}

@media (max-width: 680px) {
  .page-header,
  .section-heading,
  .panel-header,
  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar .button {
    width: 100%;
  }

  .status-grid,
  .quick-links,
  .legacy-page .status-grid,
  .legacy-page .metrics-grid,
  .legacy-page .grid,
  .legacy-page .grid.two,
  .legacy-page .config-grid,
  .legacy-page .agent-grid,
  .legacy-page .form-grid {
    grid-template-columns: 1fr;
  }

  .status-card {
    min-height: 0;
    padding: var(--space-2);
  }

  .status-card .card-kicker {
    margin-bottom: var(--space-1);
  }

  .status-card .badge {
    margin-top: var(--space-2);
  }

  .attention-item {
    grid-template-columns: 1fr;
  }

  .page {
    padding-bottom: var(--space-5);
  }

  .legacy-page .section-head,
  .legacy-page .switch-card,
  .login-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .legacy-page .actions,
  .legacy-page .form-actions,
  .legacy-page .hero-actions,
  .legacy-page .filter-actions,
  .legacy-page .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .legacy-page .actions > *,
  .legacy-page .form-actions > *,
  .legacy-page .hero-actions > *,
  .legacy-page .filter-actions > *,
  .legacy-page .inline-form > * {
    width: 100%;
  }

  .login-brand {
    padding: var(--space-2);
  }

  .login-page .login-panel {
    padding: var(--space-3);
  }
}

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