:root {
  --bg: #07111f;
  --bg-elevated: #0a1627;
  --surface: #0d1b2e;
  --surface-raised: #11223a;
  --surface-hover: #172a44;
  --border: rgba(157, 181, 215, 0.15);
  --border-strong: rgba(157, 181, 215, 0.28);
  --text: #f1f6fc;
  --text-soft: #c4d0df;
  --muted: #8294aa;
  --primary: #36d0c5;
  --primary-strong: #1cb3ae;
  --primary-soft: rgba(54, 208, 197, 0.12);
  --blue: #6ea8ff;
  --blue-soft: rgba(110, 168, 255, 0.12);
  --warning: #f5bb56;
  --warning-soft: rgba(245, 187, 86, 0.12);
  --danger: #ff6e7c;
  --danger-strong: #e75062;
  --danger-soft: rgba(255, 110, 124, 0.11);
  --success: #62d69a;
  --success-soft: rgba(98, 214, 154, 0.12);
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.26);
  --shadow-small: 0 10px 28px rgba(0, 0, 0, 0.2);
  --radius: 16px;
  --radius-small: 10px;
  --sidebar-width: 256px;
  --topbar-height: 72px;
  --transition: 160ms ease;
  --chart-cpu: #5ac8fa;
  --chart-memory: #7ee787;
  --chart-disk: #ffbf69;
  --chart-download: #b392f0;
  --chart-upload: #f778ba;
  --chart-grid: rgba(142, 173, 202, 0.2);
}

html[data-resolved-theme="light"] {
  --bg: #e9f1f5;
  --bg-elevated: #f5f9fb;
  --surface: #ffffff;
  --surface-raised: #eef4f7;
  --surface-hover: #e2edf2;
  --border: rgba(25, 57, 73, 0.23);
  --border-strong: rgba(25, 57, 73, 0.4);
  --text: #102a38;
  --text-soft: #294958;
  --muted: #486472;
  --primary: #076e6b;
  --primary-strong: #055b58;
  --primary-soft: rgba(8, 127, 123, 0.1);
  --blue: #286eb9;
  --blue-soft: rgba(40, 110, 185, 0.1);
  --warning: #956000;
  --warning-soft: rgba(179, 112, 0, 0.12);
  --danger: #b72d42;
  --danger-strong: #922134;
  --danger-soft: rgba(183, 45, 66, 0.1);
  --success: #167649;
  --success-soft: rgba(22, 118, 73, 0.1);
  --shadow: 0 22px 55px rgba(32, 70, 88, 0.14);
  --shadow-small: 0 10px 28px rgba(32, 70, 88, 0.12);
  --chart-cpu: #167da4;
  --chart-memory: #177847;
  --chart-disk: #a45c00;
  --chart-download: #6043a8;
  --chart-upload: #a32d72;
  --chart-grid: rgba(42, 72, 88, 0.58);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  color-scheme: dark;
  background: var(--bg);
  scroll-behavior: smooth;
}

html[data-resolved-theme="light"] body {
  background:
    radial-gradient(circle at 85% -20%, rgba(40, 146, 186, 0.11), transparent 35rem),
    var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -20%, rgba(40, 146, 186, 0.12), transparent 35rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #031517;
  background: var(--primary);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 9px 14px;
  color: #042626;
  background: var(--primary);
  border-radius: 8px;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform var(--transition);
  min-height: 44px;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #061a1b;
  background: linear-gradient(145deg, #77eadf, #24b8b7);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 11px 11px 11px 3px;
  box-shadow: 0 7px 24px rgba(43, 200, 192, 0.24);
  font-size: 20px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.brand-large .brand-mark {
  width: 46px;
  height: 46px;
  font-size: 24px;
}

.brand-large strong {
  font-size: 17px;
}

/* Login */
.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

.login-backdrop,
.grid-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-glow {
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(122, 158, 191, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 158, 191, 0.09) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(circle at center, black 0, transparent 72%);
}

.orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(3px);
}

.orb-one {
  top: -280px;
  left: -160px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(28, 179, 174, 0.21), transparent 67%);
}

.orb-two {
  right: -180px;
  bottom: -350px;
  width: 760px;
  height: 760px;
  background: radial-gradient(circle, rgba(84, 98, 215, 0.18), transparent 65%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 455px);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
}

.language-toggle,
.theme-toggle {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  place-items: center;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.language-toggle:hover,
.theme-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  border-color: var(--border-strong);
}

.theme-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  padding: 0 9px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.theme-toggle small { font-size: 10px; font-weight: 800; }

.login-language-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
}

.login-theme-toggle {
  position: absolute;
  top: 20px;
  right: 76px;
}

.login-heading {
  margin: 42px 0 28px;
}

.login-heading h1 {
  margin: 0;
  font-size: clamp(25px, 5vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.login-heading > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: -8px 0 22px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.auth-tabs button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-weight: 750;
  cursor: pointer;
}

.auth-tabs button.is-active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.filter-bar select,
.setting-control input,
.setting-control select,
.setting-control textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field input:hover,
.field select:hover,
.filter-bar select:hover,
.setting-control input:hover,
.setting-control select:hover,
.setting-control textarea:hover {
  border-color: rgba(157, 181, 215, 0.44);
}

.field input:focus,
.field select:focus,
.filter-bar select:focus,
.setting-control input:focus,
.setting-control select:focus,
.setting-control textarea:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 208, 197, 0.12);
}

.setting-control textarea {
  min-height: 84px;
  resize: vertical;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
}

.form-error {
  margin: -4px 0 0;
  padding: 9px 11px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(255, 110, 124, 0.25);
  border-radius: 8px;
  font-size: 13px;
}

.security-note {
  display: flex;
  gap: 10px;
  margin-top: 26px;
  padding-top: 22px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.security-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

/* Layout */
.app-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 20px 17px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
}

.sidebar > .brand {
  height: 46px;
  padding: 0 9px;
}

.main-nav {
  flex: 1;
  margin-top: 22px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav-label {
  margin: 19px 10px 7px;
  color: #667a92;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 9px 11px;
  color: #93a7be;
  border-radius: 9px;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}

.nav-link > span:first-child {
  display: inline-grid;
  width: 22px;
  place-items: center;
  color: #71869e;
  font-size: 17px;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-link.is-active {
  color: #eafffc;
  background: linear-gradient(90deg, rgba(54, 208, 197, 0.16), rgba(54, 208, 197, 0.06));
}

.nav-link.is-active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -17px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 5px 5px 0;
  content: "";
}

.nav-link.is-active > span:first-child {
  color: var(--primary);
}

html[data-resolved-theme="light"] .nav-label {
  color: #4a6471;
}

html[data-resolved-theme="light"] .nav-link {
  color: #355563;
}

html[data-resolved-theme="light"] .nav-link > span:first-child {
  color: #456b79;
}

html[data-resolved-theme="light"] .nav-link:hover {
  color: #102a38;
  background: #e2edf2;
}

html[data-resolved-theme="light"] .nav-link.is-active {
  color: #064e4c;
  background: #d7eceb;
  box-shadow: inset 0 0 0 1px rgba(7, 110, 107, 0.28);
}

html[data-resolved-theme="light"] .nav-link.is-active > span:first-child {
  color: #055b58;
}

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  font-size: 10px;
}

.sidebar-foot {
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.connection-card strong,
.connection-card small {
  display: block;
}

.connection-card strong {
  font-size: 12px;
}

.connection-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--muted);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(130, 148, 170, 0.09);
}

.status-online {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft), 0 0 13px rgba(98, 214, 154, 0.4);
}

.status-offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.status-warning {
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}

.server-indicator {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
}

.server-indicator span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}

.task-trigger,
.user-chip {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.task-trigger {
  position: relative;
  padding: 7px 10px;
  color: var(--text-soft);
}

.assistant-mark {
  display: inline-grid;
  min-width: 25px;
  height: 22px;
  place-items: center;
  color: #071b1c;
  background: linear-gradient(145deg, #79e9df, #27bdb7);
  border-radius: 7px 7px 7px 2px;
  font-size: 9px;
  font-weight: 900;
}

.task-pulse {
  width: 8px;
  height: 8px;
  background: var(--muted);
  border-radius: 50%;
}

.task-pulse.is-active {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

.count-badge {
  min-width: 20px;
  padding: 1px 6px;
  color: #061c1c;
  background: var(--primary);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.user-menu-wrap {
  position: relative;
}

.user-chip {
  padding: 4px 7px;
  border-radius: 9px;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.04);
}

.avatar {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #061a1b;
  background: linear-gradient(145deg, #83eee3, #36bbb6);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 850;
}

.user-copy {
  text-align: left;
}

.user-copy strong,
.user-copy small {
  display: block;
}

.user-copy strong {
  max-width: 140px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.user-copy small {
  color: var(--muted);
  font-size: 10px;
}

.popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  right: 0;
  min-width: 255px;
  padding: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-small);
}

.steam-link-panel {
  display: grid;
  gap: 4px;
  padding: 8px 9px 12px;
  border-bottom: 1px solid var(--border);
}

.steam-link-panel .nav-label {
  margin: 0 0 3px;
}

.steam-link-panel strong {
  font-size: 12px;
}

.steam-link-panel small {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.steam-link-panel .button {
  width: 100%;
  margin-top: 7px;
}

.popover button {
  width: 100%;
  padding: 9px 10px;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
}

.popover button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.main-content {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 34px) clamp(22px, 3vw, 46px) 48px;
}

.view {
  min-width: 0;
  width: min(100%, 1480px);
  margin: 0 auto;
  animation: view-in 220ms ease;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
}

.page-header > *,
.panel-header > *,
.topbar > *,
.row-actions > * {
  min-width: 0;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.page-subtitle {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.header-actions > * {
  min-width: 0;
}

/* Buttons and shared components */
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.button-primary {
  color: #041c1d;
  background: linear-gradient(145deg, #5cddd4, #27bbb7);
  box-shadow: 0 8px 20px rgba(39, 187, 183, 0.16);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(145deg, #70e5dc, #30c6c1);
}

.button-secondary {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border-strong);
}

.button-secondary:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
}

.button-danger {
  color: white;
  background: var(--danger-strong);
}

.button-large {
  min-height: 48px;
  padding: 11px 18px;
}

.button-small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.full-width {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-size: 20px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-toggle,
.mobile-brand {
  display: none;
}

.panel {
  min-width: 0;
  margin-bottom: 20px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-header h2,
.drawer-header h2,
.dialog h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.text-link {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-success {
  color: #8ce9b7;
  background: var(--success-soft);
  border-color: rgba(98, 214, 154, 0.2);
}

.tag-danger {
  color: #ff9eaa;
  background: var(--danger-soft);
  border-color: rgba(255, 110, 124, 0.2);
}

.tag-warning {
  color: #ffd88e;
  background: var(--warning-soft);
  border-color: rgba(245, 187, 86, 0.2);
}

.tag-info {
  color: #a9caff;
  background: var(--blue-soft);
  border-color: rgba(110, 168, 255, 0.2);
}

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.notice strong,
.notice p {
  display: block;
  margin: 0;
}

.notice p {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 12px;
}

.notice-info {
  background: var(--blue-soft);
  border-color: rgba(110, 168, 255, 0.25);
}

.notice-warning {
  background: var(--warning-soft);
  border-color: rgba(245, 187, 86, 0.28);
}

.notice-danger,
.notice-critical {
  background: var(--danger-soft);
  border-color: rgba(255, 110, 124, 0.27);
}

.notice-critical {
  position: relative;
  overflow: hidden;
  border-width: 1px 1px 1px 4px;
}

.notice-critical strong {
  color: #ffb5be;
  font-size: 15px;
}

.notice-symbol {
  display: inline-grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  color: #28070c;
  background: var(--danger);
  border-radius: 50%;
  font-weight: 900;
}

.subtle {
  background: rgba(255, 110, 124, 0.065);
}

/* Overview */
.overview-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.overview-summary-card {
  margin-bottom: 0;
  padding: 20px;
}

.overview-summary-header {
  margin-bottom: 14px;
}

.overview-summary-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}

.overview-summary-item {
  min-width: 0;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.overview-summary-primary {
  background: color-mix(in srgb, var(--primary-soft) 72%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.overview-summary-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.overview-summary-item > strong,
.overview-summary-item > small {
  display: block;
  overflow-wrap: anywhere;
}

.overview-summary-item > strong {
  margin: 9px 0 4px;
  color: var(--text);
  font-size: clamp(19px, 2.2vw, 26px);
  line-height: 1.1;
}

.overview-summary-item > strong small,
.overview-summary-item > small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  position: relative;
  min-height: 146px;
  padding: 20px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(17, 35, 59, 0.95), rgba(11, 25, 43, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric-card::after {
  position: absolute;
  right: -45px;
  bottom: -70px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(110, 168, 255, 0.06), transparent 70%);
  border-radius: 50%;
  content: "";
}

.metric-primary {
  border-color: rgba(54, 208, 197, 0.25);
  background: linear-gradient(145deg, rgba(18, 50, 65, 0.92), rgba(11, 29, 47, 0.96));
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric-card > strong {
  display: block;
  margin: 17px 0 5px;
  overflow: hidden;
  font-size: clamp(22px, 2.5vw, 29px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.metric-card > strong small {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.metric-card > small {
  color: var(--muted);
  font-size: 11px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.server-control-slot {
  display: block;
  min-width: 0;
}

.server-control-slot > .panel,
.overview-grid > .resource-panel {
  margin-bottom: 0;
}

.server-control-slot > .panel {
  display: grid;
  grid-template-columns: minmax(170px, 0.24fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding-block: 17px;
}

.server-control-slot .panel-header,
.resource-panel .panel-header {
  margin-bottom: 14px;
}

.server-control-slot .action-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
}

.server-control-slot .action-button {
  min-height: 58px;
  padding: 9px 11px;
}

.resource-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.resource-panel-toolbar {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
}

.resource-mode-tabs {
  margin: 0;
}

.resource-mode-tabs button {
  min-width: 72px;
}

.resource-mode-panel {
  min-width: 0;
}

.resource-row {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.resource-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.resource-copy span {
  color: var(--text-soft);
  font-size: 13px;
}

.resource-copy strong {
  font-size: 13px;
}

.resource-row small {
  color: var(--muted);
  font-size: 10px;
}

.resource-network {
  grid-column: auto;
}

.resource-network .resource-copy {
  gap: 14px;
}

.resource-network .resource-copy strong {
  max-width: 72%;
  color: var(--primary);
  text-align: right;
}

.game-metrics-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  transition: border-color 180ms ease, background 180ms ease;
}

.game-metrics-panel.is-stale {
  padding: 16px;
  border-color: rgba(255, 190, 92, 0.38);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(47, 38, 25, 0.74), rgba(11, 25, 43, 0.93));
}

html[data-resolved-theme="light"] .game-metrics-panel.is-stale {
  color: var(--text);
  background: #fff8e8;
  border-color: #956000;
}

.game-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.game-metrics-header {
  align-items: center;
}

.game-metrics-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.game-stat {
  min-width: 0;
  padding: 16px;
  background: rgba(4, 15, 28, 0.34);
  border: 1px solid rgba(147, 177, 210, 0.11);
  border-radius: 11px;
}

.game-stat > span,
.game-stat > strong,
.game-stat > small {
  display: block;
}

.game-stat > span {
  color: var(--text-soft);
  font-size: 12px;
}

.game-stat > strong {
  margin: 9px 0 4px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(17px, 2vw, 23px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.game-stat > small {
  color: var(--muted);
  font-size: 10px;
}

.metric-diagnostic {
  margin: 15px 0 0;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(110, 168, 255, 0.055);
  border: 1px solid rgba(110, 168, 255, 0.1);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.55;
}

.metric-diagnostic.is-warning,
.game-metrics-panel.is-stale .metric-diagnostic {
  color: #ffd99d;
  background: rgba(255, 190, 92, 0.07);
  border-color: rgba(255, 190, 92, 0.18);
}

html[data-resolved-theme="light"] .metric-diagnostic.is-warning,
html[data-resolved-theme="light"] .game-metrics-panel.is-stale .metric-diagnostic {
  color: #775000;
  background: #fff2d5;
  border-color: #956000;
}

.progress-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  max-width: 100%;
  background: linear-gradient(90deg, var(--primary-strong), #67ded6);
  border-radius: inherit;
  transition: width 450ms ease;
}

.progress-bar.is-warning {
  background: linear-gradient(90deg, #d9982d, var(--warning));
}

.progress-bar.is-danger {
  background: linear-gradient(90deg, var(--danger-strong), var(--danger));
}

.action-grid {
  display: grid;
  gap: 10px;
}

.viewer-self-service-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
}

.action-button {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  overflow-wrap: anywhere;
}

.action-button > span:last-child {
  min-width: 0;
}

.action-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.055);
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.action-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.action-button > span:first-child {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 8px;
}

.action-safe > span:first-child {
  color: var(--success);
  background: var(--success-soft);
}

.action-danger > span:first-child {
  color: var(--danger);
  background: var(--danger-soft);
}

.action-button strong,
.action-button small {
  display: block;
}

.action-button strong {
  color: var(--text);
  font-size: 13px;
}

.action-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* Tables */
.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover:not(.no-hover) td {
  background: rgba(255, 255, 255, 0.018);
}

.align-right {
  text-align: right;
}

.cell-primary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cell-avatar {
  display: inline-grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  color: #bfe2ff;
  background: linear-gradient(145deg, rgba(74, 125, 182, 0.25), rgba(58, 101, 151, 0.12));
  border: 1px solid rgba(110, 168, 255, 0.15);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
}

.cell-primary strong,
.cell-primary small {
  display: block;
}

.cell-primary strong {
  color: var(--text);
  font-size: 13px;
}

.cell-primary small,
.mono {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.row-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.row-select {
  min-width: 175px;
  min-height: 34px;
  padding: 5px 9px;
  color: var(--text-soft);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11px;
}

/* Settings */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-field {
  display: flex;
  min-height: 42px;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(54, 208, 197, 0.1);
}

.search-field input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  min-height: 42px;
}

.search-field input::placeholder {
  color: #62768d;
}

.filter-bar select {
  width: auto;
  min-width: 160px;
}

.settings-directory {
  position: sticky;
  z-index: 18;
  top: calc(var(--topbar-height) + 8px);
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 8px;
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(14px);
}

.settings-directory-label {
  flex: 0 0 auto;
  padding-left: 6px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
}

.settings-directory-links {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.settings-directory-link {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.settings-directory-link small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.settings-directory-link:hover,
.settings-directory-link.is-active {
  color: var(--text);
  background: var(--surface-hover);
  border-color: var(--primary);
}

.settings-groups {
  display: grid;
  gap: 18px;
}

.settings-group {
  margin: 0;
  scroll-margin-top: calc(var(--topbar-height) + 86px);
}

.settings-group .panel-header {
  margin-bottom: 7px;
}

.settings-group-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, 0.7fr);
  gap: 26px;
  align-items: center;
  padding: 17px 0;
  border-top: 1px solid var(--border);
}

.setting-label-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.setting-copy label,
.setting-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.setting-copy p {
  max-width: 680px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.setting-control {
  min-width: 0;
}

.setting-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.switch-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text-soft);
  font-size: 12px;
}

.setting-row.is-changed {
  position: relative;
}

.setting-row.is-changed::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: -22px;
  width: 3px;
  background: var(--primary);
  border-radius: 3px;
  content: "";
}

.setting-row.is-filtered {
  display: none;
}

.request-reason {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: rgba(110, 168, 255, 0.055);
  border: 1px solid rgba(110, 168, 255, 0.16);
  border-radius: 11px;
}

/* Approvals and requests */
.request-list {
  display: grid;
  gap: 14px;
}

.request-card {
  margin: 0;
}

.request-card-head,
.registration-row,
.registration-controls,
.request-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-cancel-button {
  min-width: 132px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 18%, transparent);
}

.request-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 16px 0 0;
}

.request-settings > div {
  min-width: 0;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.request-settings dt {
  color: var(--muted);
  font-size: 10px;
}

.request-settings dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.request-reason-copy {
  margin: 12px 0 0;
  padding: 10px 12px;
  color: var(--text-soft);
  background: var(--blue-soft);
  border-radius: 8px;
  font-size: 12px;
}

.request-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Announcements */
.notice-announcement {
  align-items: center;
  background: linear-gradient(120deg, rgba(54, 208, 197, 0.12), rgba(110, 168, 255, 0.09));
  border-color: rgba(54, 208, 197, 0.28);
}

.announcement-banner-copy {
  min-width: 0;
}

.announcement-banner-copy p,
.announcement-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.announcement-banner-copy small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.announcement-publisher {
  margin-bottom: 18px;
}

.announcement-form,
.announcement-list {
  display: grid;
  gap: 14px;
}

.announcement-channel-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.announcement-channel-fieldset legend {
  width: 100%;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.announcement-channel-fieldset .check-field {
  min-height: 64px;
  align-items: center;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.announcement-channel-fieldset .check-field:has(input:checked) {
  background: rgba(54, 208, 197, 0.075);
  border-color: rgba(54, 208, 197, 0.32);
}

.announcement-channel-fieldset .check-field input {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.announcement-channel-fieldset strong,
.announcement-channel-fieldset small {
  display: block;
}

.announcement-channel-fieldset small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.announcement-form-actions {
  display: flex;
  justify-content: flex-end;
}

.announcement-item {
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.023);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.announcement-item-head,
.announcement-item-meta,
.announcement-channel-statuses {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.announcement-item-head {
  justify-content: space-between;
}

.announcement-item-meta {
  color: var(--muted);
  font-size: 10px;
}

.announcement-message {
  margin: 12px 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.announcement-channel-statuses {
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.announcement-channel-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
}

.announcement-task-link {
  min-height: 44px;
  margin-left: auto;
}

.registration-row {
  padding: 12px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.registration-controls .row-select {
  min-width: 135px;
}

.identifier-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

.copy-button {
  min-height: 30px;
  padding: 3px 7px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(54, 208, 197, 0.2);
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
}

.identity-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.identity-title .tag {
  padding: 1px 6px;
  font-size: 9px;
}

/* Saves */
.save-list {
  display: grid;
  gap: 10px;
}

.save-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(110px, auto)) auto;
  gap: 18px;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.save-item.is-current {
  background: linear-gradient(90deg, var(--primary-soft), rgba(255, 255, 255, 0.018));
  border-color: rgba(54, 208, 197, 0.25);
}

.save-name {
  min-width: 0;
}

.save-name strong,
.save-name small,
.save-meta strong,
.save-meta small {
  display: block;
}

.save-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-name small,
.save-meta small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.save-meta strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

/* Tasks */
.segmented {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.segmented button {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.is-active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.operations-tabs {
  display: flex;
  width: min(100%, 520px);
  margin-bottom: 22px;
}

.operations-tabs button {
  flex: 1 1 0;
}

.tab-count {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  margin-left: 5px;
  place-items: center;
  padding: 1px 6px;
  color: #041c1d;
  background: var(--primary);
  border-radius: 999px;
  font-size: 10px;
}

.operations-panel {
  min-width: 0;
}

.operations-panel .request-list,
.operations-panel .task-list {
  min-width: 0;
}

.operations-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.operations-panel-header h2,
.operations-panel-header p {
  margin: 0;
}

.operations-panel-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-item {
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.task-item.is-outcome-uncertain {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  background: color-mix(in srgb, var(--warning) 5%, var(--surface));
}

.task-item.is-outcome-uncertain .task-icon {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.task-item.is-cancelled {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--muted) 4%, var(--surface));
}

.task-item.is-cancelled .task-icon {
  color: var(--text-soft);
  background: color-mix(in srgb, var(--muted) 12%, var(--surface));
}

.task-outcome-warning {
  padding: 9px 10px;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.5;
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-title {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.task-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 8px;
}

.task-title strong,
.task-title small {
  display: block;
}

.task-title strong {
  font-size: 13px;
}

.task-title small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.task-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 14px;
}

.task-progress .progress-track {
  height: 6px;
}

.task-progress span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.task-progress .progress-track.is-indeterminate .progress-bar {
  width: 34%;
  animation: task-progress-indeterminate 1.35s ease-in-out infinite;
}

@keyframes task-progress-indeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(300%); }
}

.task-message {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.nas-task-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.task-phase-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(118px, 100%), 1fr));
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.task-phase-steps li {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task-phase-steps li.is-complete {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 8%, transparent);
}

.task-phase-steps li.is-current {
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  background: color-mix(in srgb, var(--primary) 11%, transparent);
}

.task-phase-steps li.is-uncertain {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 48%, transparent);
  background: color-mix(in srgb, var(--warning) 10%, transparent);
}

.task-phase-steps li.is-failed {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
}

.task-phase-steps li.is-cancelled {
  color: var(--text-soft);
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--muted) 9%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .task-progress .progress-track.is-indeterminate .progress-bar { animation: none; transform: translateX(95%); }
}

.nas-task-steps li {
  position: relative;
  min-width: 0;
  padding: 8px 7px 8px 19px;
  overflow: hidden;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.nas-task-steps li::before {
  position: absolute;
  top: 10px;
  left: 7px;
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  content: "";
}

.nas-task-steps li.is-complete {
  color: var(--success);
  border-color: rgba(98, 214, 154, 0.14);
}

.nas-task-steps li.is-complete::before {
  background: var(--success);
}

.nas-task-steps li.is-current {
  color: #ffd99d;
  background: var(--warning-soft);
  border-color: rgba(245, 187, 86, 0.22);
}

.nas-task-steps li.is-current::before {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 187, 86, 0.13);
}

.nas-task-steps li.is-failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 110, 124, 0.2);
}

.nas-task-steps li.is-failed::before {
  background: var(--danger);
}

.task-actions {
  margin-top: 12px;
}

.compact-list .task-item {
  padding: 13px;
  background: rgba(255, 255, 255, 0.018);
}

.loading-panel,
.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state.small {
  min-height: 100px;
}

.empty-state p,
.loading-panel p {
  margin: 0;
}

.empty-state strong {
  color: var(--text-soft);
}

.spinner {
  display: inline-block;
  width: 23px;
  height: 23px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* AI governance */
.ai-governance-header-actions {
  align-items: center;
}

.ai-workflow-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.ai-workflow-nav a {
  display: grid;
  min-width: 0;
  min-height: 68px;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-content: center;
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  box-shadow: var(--shadow-small);
}

.ai-workflow-nav a:hover,
.ai-workflow-nav a:focus-visible {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.ai-workflow-nav a > span {
  display: grid;
  width: 32px;
  height: 32px;
  grid-row: 1 / 3;
  align-self: center;
  place-items: center;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 42%, var(--border));
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.ai-workflow-nav strong,
.ai-workflow-nav small {
  overflow-wrap: anywhere;
}

.ai-workflow-nav strong {
  font-size: 12px;
}

.ai-workflow-nav small {
  color: var(--muted);
  font-size: 10px;
}

.ai-workflow-panel {
  scroll-margin-top: calc(var(--topbar-height) + 16px);
}

.ai-workflow-heading {
  display: flex;
  min-width: 0;
  gap: 11px;
  align-items: center;
}

.ai-workflow-step {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 42%, var(--border));
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
}

.choice-fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.choice-fieldset legend {
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
}

.provider-grid,
.mode-grid,
.ai-runtime-grid,
.ai-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.provider-card,
.mode-grid label {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 76px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.mode-grid label {
  grid-template-columns: auto minmax(0, 1fr);
}

.provider-card:has(input:checked),
.mode-grid label:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.provider-card input,
.mode-grid input {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0;
  appearance: none;
  place-content: center;
  accent-color: var(--primary);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}

.provider-card input::before,
.mode-grid input::before {
  width: 14px;
  height: 14px;
  content: "";
  background: var(--primary);
  border-radius: 50%;
  transform: scale(0);
  transition: transform var(--transition);
}

.provider-card input:checked::before,
.mode-grid input:checked::before {
  transform: scale(1);
}

.provider-card strong,
.provider-card small,
.mode-grid strong,
.mode-grid small {
  display: block;
  overflow-wrap: anywhere;
}

.provider-card small,
.mode-grid small {
  color: var(--muted);
  font-size: 10px;
}

.provider-card > small {
  grid-column: 2 / -1;
}

.choice-fieldset:disabled label {
  cursor: default;
  opacity: 0.82;
}

.provider-card.is-unavailable {
  border-style: dashed;
  opacity: 0.72;
}

.ai-runtime-grid {
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1.1fr);
  align-items: stretch;
}

.ai-signal-resources,
.ai-signal-facts {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ai-signal-resources { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-signal-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.ai-signal-gauge {
  display: grid;
  min-width: 0;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ai-signal-gauge svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.ai-gauge-track,
.ai-gauge-meter { fill: none; stroke-width: 5; }
.ai-gauge-track { stroke: var(--border-strong); }
.ai-gauge-meter { stroke: var(--primary); stroke-linecap: round; }
.ai-signal-gauge-copy strong,
.ai-signal-gauge-copy small,
.ai-signal-fact strong,
.ai-signal-fact small { display: block; overflow-wrap: anywhere; }
.ai-signal-gauge-copy strong,
.ai-signal-fact strong { color: var(--text); font-size: 15px; }
.ai-signal-gauge-copy small,
.ai-signal-fact small { color: var(--muted); font-size: 10px; font-weight: 750; }
.ai-signal-fact {
  min-width: 0;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}
.ai-signal-fact.is-good strong { color: var(--success); }
.ai-signal-fact.is-warning strong { color: var(--warning); }

.ai-history-toolbar,
.ai-policy-nav {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.ai-history-toolbar .is-active,
.ai-policy-nav-link:hover,
.ai-policy-nav-link:focus-visible {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.ai-history-chart-wrap {
  min-width: 0;
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ai-history-chart-wrap .history-chart { width: 100%; min-height: 190px; }

.ai-policy-nav {
  position: sticky;
  z-index: 3;
  top: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.ai-policy-nav-link {
  min-height: 44px;
  padding: 8px 13px;
  color: var(--text-soft);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.ai-policy-cards,
.ai-policy-group { display: grid; gap: 14px; min-width: 0; }
.ai-policy-group { scroll-margin-top: 86px; }
.ai-policy-group-title { margin: 6px 0 0; font-size: 16px; }
.ai-policy-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 12px;
}

.ai-governance-setting-card {
  display: grid;
  min-width: 0;
  gap: 11px;
  padding: 15px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.ai-governance-setting-card[data-governance-mode="auto"] { border-color: color-mix(in srgb, var(--success) 60%, var(--border)); }
.ai-governance-setting-card[data-governance-mode="suggest"] { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); }
.ai-setting-card-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ai-setting-card-head h4 { margin: 0; font-size: 15px; }
.ai-setting-card-head small { display: block; margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.ai-setting-description { margin: 0; color: var(--text-soft); font-size: 12px; line-height: 1.55; }
.ai-setting-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0; }
.ai-setting-facts > div { min-width: 0; padding: 8px 9px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 9px; }
.ai-setting-facts dt { color: var(--muted); font-size: 10px; font-weight: 750; }
.ai-setting-facts dd { margin: 3px 0 0; color: var(--text); font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }

.ai-mode-segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ai-mode-option {
  min-width: 0;
  min-height: 44px;
  padding: 7px 5px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.ai-mode-option.is-selected { color: var(--primary-strong); background: var(--primary-soft); border-color: var(--primary); }

.ai-change-comparison { display: grid; gap: 6px; margin-top: 9px; }
.ai-change-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}
.ai-before-value { color: var(--muted); text-decoration: line-through; }
.ai-after-value { color: var(--text); font-weight: 850; }
.ai-change-arrow { color: var(--muted); }
.ai-performance-comparison { margin-top: 10px; padding: 10px; background: var(--primary-soft); border: 1px solid var(--border); border-radius: 10px; }
.ai-performance-deltas { display: grid; gap: 6px; margin-top: 7px; }
.ai-performance-deltas > div { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto auto auto; gap: 7px; align-items: center; }
.ai-performance-deltas .is-improved { color: var(--success); }
.ai-performance-deltas .is-regressed { color: var(--warning); }

@media (max-width: 560px) {
  .ai-setting-facts { grid-template-columns: 1fr; }
  .ai-change-row {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }
  .ai-change-row > strong { grid-column: 1 / -1; }
  .ai-performance-deltas > div {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }
  .ai-performance-deltas > div > span:first-child { grid-column: 1 / -1; }
}

.ai-setting-mode { width: 100%; min-width: 118px; min-height: 44px; }
.ai-mode-note { display: block; margin-top: 5px; color: var(--muted); line-height: 1.4; }

.ai-runtime-grid .metric-card,
.ai-activity-card {
  min-width: 0;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ai-runtime-grid .metric-card small,
.ai-runtime-grid .metric-card strong,
.ai-activity-card small,
.ai-activity-card strong,
.ai-activity-card p {
  display: block;
  overflow-wrap: anywhere;
}

.ai-runtime-grid .metric-card small,
.ai-activity-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.ai-runtime-grid .metric-card strong {
  margin-top: 4px;
  font-size: 19px;
}

.ai-activity-card p {
  margin: 5px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  white-space: pre-wrap;
}

.ai-policy-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ai-policy-card {
  min-width: 0;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.assistant-setting-diff {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
}

.assistant-setting-diff > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
}

.assistant-setting-diff dt { color: var(--muted); }
.assistant-setting-diff dd { margin: 0; color: var(--text); font-weight: 750; overflow-wrap: anywhere; }
.assistant-draft-reason { margin-top: 8px; }

.ai-policy-card strong,
.ai-policy-card small,
#ai-policy-table td > strong,
#ai-policy-table td > small {
  display: block;
  overflow-wrap: anywhere;
}

#ai-policy-table td > small {
  margin-top: 3px;
  color: var(--muted);
}

.ai-decision-card {
  grid-column: 1 / -1;
}

.ai-decision-head,
.ai-decision-meta {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.ai-decision-head {
  justify-content: space-between;
}

.ai-decision-meta {
  color: var(--muted);
}

.ai-summary-card strong {
  margin-top: 5px;
  font-size: 14px;
}

.ai-reason-copy {
  margin-top: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.ai-technical-reason {
  display: inline-block;
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.ai-technical-reason summary {
  min-height: 44px;
  padding: 10px 0;
  cursor: pointer;
}

.ai-technical-reason code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.ai-governance-config .row-actions {
  flex-wrap: wrap;
}

.ai-governance-config .button {
  min-height: 44px;
}

/* Drawer */
.drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(92vw, 430px);
  padding: 24px;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -25px 0 70px rgba(0, 0, 0, 0.35);
  transform: translateX(105%);
  transition: transform 220ms ease;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.drawer > .task-list {
  flex: 1;
  margin-bottom: 18px;
  overflow-y: auto;
}

.drawer-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.assistant-drawer {
  width: min(94vw, 500px);
}

.assistant-guard {
  display: flex;
  gap: 9px;
  margin-bottom: 15px;
  padding: 10px 12px;
  color: var(--text-soft);
  background: var(--success-soft);
  border: 1px solid rgba(98, 214, 154, 0.18);
  border-radius: 9px;
  font-size: 11px;
}

.assistant-guard span {
  color: var(--success);
  font-weight: 900;
}

.assistant-guard p {
  margin: 0;
}

.assistant-messages {
  display: flex;
  min-height: 220px;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 6px 2px 16px;
  overflow-y: auto;
}

.assistant-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.assistant-empty strong {
  color: var(--text-soft);
}

.assistant-empty p {
  max-width: 300px;
  margin: 5px 0 0;
  font-size: 12px;
}

.assistant-message {
  display: grid;
  max-width: 88%;
  gap: 4px;
  align-self: flex-start;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px 12px 12px 12px;
}

.assistant-message.is-user {
  align-self: flex-end;
  background: var(--primary-soft);
  border-color: rgba(54, 208, 197, 0.18);
  border-radius: 12px 4px 12px 12px;
}

.assistant-message.is-warning {
  background: var(--warning-soft);
  border-color: rgba(245, 187, 86, 0.2);
}

.assistant-message.is-error {
  background: var(--danger-soft);
  border-color: rgba(255, 110, 124, 0.2);
}

.assistant-message-role {
  color: var(--primary);
  font-size: 9px;
  font-weight: 850;
}

.assistant-message p {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-draft {
  margin-bottom: 12px;
  padding: 12px;
  background: var(--blue-soft);
  border: 1px solid rgba(110, 168, 255, 0.2);
  border-radius: 10px;
}

.assistant-draft strong,
.assistant-draft p {
  display: block;
  margin: 0;
}

.assistant-draft p {
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.assistant-command {
  background: var(--warning-soft);
  border-color: rgba(245, 187, 86, 0.24);
}

.assistant-command > div > small {
  display: block;
  margin: -5px 0 11px;
  color: #e7c990;
  font-size: 10px;
  line-height: 1.5;
}

.assistant-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.assistant-form textarea {
  width: 100%;
  min-height: 48px;
  max-height: 140px;
  padding: 10px 11px;
  resize: vertical;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
}

.drawer-scrim,
.nav-scrim {
  position: fixed;
  z-index: 90;
  inset: 0;
  visibility: hidden;
  background: rgba(2, 8, 15, 0.62);
  border: 0;
  opacity: 0;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.drawer-scrim.is-open,
.nav-scrim.is-open {
  visibility: visible;
  opacity: 1;
}

/* Dialogs */
.dialog {
  width: min(calc(100% - 30px), 510px);
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow-y: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(2, 8, 15, 0.74);
  backdrop-filter: blur(5px);
}

.dialog form {
  display: grid;
  gap: 19px;
  padding: 25px;
}

.dialog-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  font-size: 19px;
  font-weight: 900;
}

.dialog-icon.danger {
  color: #33070d;
  background: var(--danger);
  box-shadow: 0 8px 25px rgba(255, 110, 124, 0.18);
}

.dialog-heading p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.confirm-context {
  padding: 12px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 2px;
}

.steam-link-dialog {
  width: min(620px, calc(100vw - 28px));
}

.steam-link-dialog .notice {
  margin-bottom: 15px;
}

.steam-link-dialog input[readonly] {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.steam-link-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: 13px;
}

.check-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

/* Toast */
.toast-region {
  position: fixed;
  z-index: 300;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(calc(100vw - 32px), 390px);
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  background: rgba(17, 35, 59, 0.97);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  box-shadow: var(--shadow-small);
  animation: toast-in 220ms ease;
  pointer-events: auto;
}

.toast.is-error {
  border-color: rgba(255, 110, 124, 0.35);
}

.toast.is-success {
  border-color: rgba(98, 214, 154, 0.35);
}

.toast.is-warning {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
}

.toast-mark {
  display: inline-grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
}

.toast.is-error .toast-mark {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast.is-warning .toast-mark {
  color: var(--warning);
  background: var(--warning-soft);
}

.toast-copy strong,
.toast-copy small {
  display: block;
}

.toast-copy strong {
  font-size: 12px;
}

.toast-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Responsive */
@media (max-width: 1120px) {
  .page-header {
    display: block;
  }

.header-actions {
    width: 100%;
    margin-top: 17px;
    justify-content: flex-start;
  }

  .header-actions .button {
    flex: 1 1 160px;
  }

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

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

  .server-control-slot .action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .save-item {
    grid-template-columns: minmax(220px, 1fr) repeat(2, auto) auto;
  }

  .save-item .save-meta:nth-of-type(4) {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 62px;
  }

  .topbar {
    left: 0;
    padding: 0 14px;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .mobile-brand {
    display: block;
    margin-left: 3px;
    font-size: 13px;
    font-weight: 800;
  }

  .server-indicator {
    margin-right: auto;
    margin-left: 12px;
  }

  .server-indicator span:last-child {
    display: none;
  }

  .user-copy,
  .user-chip > span:last-child,
  .task-trigger > span:nth-child(2) {
    display: none;
  }

  .sidebar {
    z-index: 120;
    width: min(84vw, var(--sidebar-width));
    box-shadow: 25px 0 70px rgba(0, 0, 0, 0.38);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .nav-scrim {
    z-index: 110;
  }

  .main-content {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 26px) 17px 42px;
  }

  .overview-summary-grid {
    grid-template-columns: 1fr;
  }

  .server-control-slot > .panel {
    grid-template-columns: 1fr;
  }

  .resource-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-workflow-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-header {
    align-items: flex-start;
  }

  .setting-row {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .switch-control {
    justify-content: flex-start;
  }

  .setting-row.is-changed::before {
    left: -22px;
  }

  .save-item {
    grid-template-columns: minmax(180px, 1fr) auto auto;
  }

  .save-item .save-meta {
    display: none;
  }
}

@media (max-width: 620px) {
  .nas-task-steps {
    grid-template-columns: 1fr 1fr;
  }

  .login-view {
    padding: 14px;
  }

  .login-card {
    padding: 25px 21px;
  }

  .login-heading {
    margin: 34px 0 24px;
  }

  .page-header {
    display: block;
  }

  .header-actions,
  .page-header > .button {
    width: 100%;
    margin-top: 17px;
  }

  .header-actions .button {
    flex: 1;
  }

  .metric-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .metric-card {
    min-height: 127px;
  }

  .panel {
    padding: 17px;
    border-radius: 13px;
  }

  .overview-summary-items,
  .resource-list,
  .server-control-slot .action-grid {
    grid-template-columns: 1fr;
  }

  .ai-workflow-nav {
    grid-template-columns: 1fr;
  }

  .resource-network {
    grid-column: auto;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-bar select {
    width: 100%;
  }

  .settings-directory {
    top: calc(var(--topbar-height) + 5px);
    margin-right: -5px;
    margin-left: -5px;
    padding: 6px;
  }

  .settings-directory-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .settings-group {
    scroll-margin-top: calc(var(--topbar-height) + 75px);
  }

  .notice {
    padding: 13px;
  }

  .notice-announcement {
    align-items: stretch;
    flex-direction: column;
  }

  .notice-announcement .button,
  .announcement-form-actions .button {
    width: 100%;
  }

  .announcement-channel-fieldset {
    grid-template-columns: 1fr;
  }

  .announcement-item-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .announcement-task-link {
    width: 100%;
    margin-left: 0;
  }

  .steam-link-actions,
  .steam-link-dialog .dialog-actions {
    grid-template-columns: 1fr;
  }

  .steam-link-actions {
    display: grid;
  }

  .steam-link-dialog .dialog-actions {
    display: grid;
  }

  .save-item {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .save-item .save-meta {
    display: none;
  }

  .save-actions {
    justify-content: stretch;
  }

  .save-actions .button {
    flex: 1;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .button {
    width: 100%;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }
}

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

/* Device-independent adaptive delivery: safe areas, containers and foldables. */
.view {
  container-type: inline-size;
}

.login-view {
  padding-top: max(28px, env(safe-area-inset-top));
  padding-right: max(28px, env(safe-area-inset-right));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  padding-left: max(28px, env(safe-area-inset-left));
}

.topbar {
  padding-right: max(28px, env(safe-area-inset-right));
}

.sidebar {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(17px, env(safe-area-inset-left));
}

.main-content {
  padding-right: max(clamp(22px, 3vw, 46px), env(safe-area-inset-right));
  padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px));
}

.drawer {
  padding-top: max(24px, env(safe-area-inset-top));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.toast-region {
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
}

.numeric-control {
  display: grid;
  width: min(100%, 420px);
  gap: 8px;
}

.numeric-exact-row {
  display: grid;
  grid-template-columns: 48px minmax(92px, 1fr) 48px;
  gap: 8px;
}

.numeric-step-button {
  min-width: 48px;
  padding: 0;
  font-size: 0;
}

.numeric-step-button::before {
  font-size: 22px;
  line-height: 1;
}

.numeric-step-button:first-child::before { content: "−"; }
.numeric-step-button:last-child::before { content: "+"; }

.numeric-range {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--primary);
}

.numeric-bounds {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.numeric-bounds span:last-child { text-align: right; }
.numeric-current {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.maintenance-diff {
  display: grid;
  gap: 8px;
  max-height: 230px;
  margin: 10px 0 16px;
  overflow-y: auto;
}

.maintenance-diff > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.maintenance-diff dt { color: var(--text-soft); font-weight: 750; }
.maintenance-diff dd { margin: 0; overflow-wrap: anywhere; text-align: right; }

.maintenance-delay-control {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.maintenance-delay-control input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--primary);
}

.telemetry-history {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.resource-mode-panel.telemetry-history {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.telemetry-history-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.telemetry-history-header h3 { margin: 0 0 4px; }
.telemetry-range { flex-wrap: wrap; }
.telemetry-range button { min-width: 60px; }

.telemetry-history-charts {
  display: grid;
  gap: 14px;
}

.telemetry-chart-card {
  min-width: 0;
  margin: 0;
  padding: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.telemetry-chart-card figcaption,
.telemetry-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.telemetry-chart-card figcaption {
  justify-content: space-between;
  margin-bottom: 7px;
}

.telemetry-chart-card figcaption span,
.telemetry-legend {
  color: var(--muted);
  font-size: 11px;
}

.telemetry-legend span { display: inline-flex; gap: 6px; align-items: center; }
.telemetry-legend i {
  width: 14px;
  height: 3px;
  background: var(--series);
  border-radius: 99px;
}

.telemetry-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 170px;
  overflow: visible;
}

.telemetry-chart .chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.telemetry-chart .chart-label { fill: var(--muted); font-size: 10px; }
.telemetry-chart .chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.telemetry-chart .chart-break { stroke: color-mix(in srgb, var(--muted) 50%, transparent); stroke-width: 1; }
.telemetry-chart .chart-isolated { stroke: var(--surface); stroke-width: 1.5; }
.telemetry-chart .chart-gap { fill: var(--muted); font-size: 11px; text-anchor: middle; }

/* Light appearance keeps informational and interactive states distinguishable. */
html[data-resolved-theme="light"] .panel,
html[data-resolved-theme="light"] .task-item,
html[data-resolved-theme="light"] .save-item,
html[data-resolved-theme="light"] .table-wrap tbody tr {
  box-shadow: 0 8px 24px rgba(24, 59, 76, 0.08);
}

html[data-resolved-theme="light"] .metric-card {
  background: linear-gradient(145deg, #ffffff, #f2f7f9);
  border-color: var(--border-strong);
  box-shadow: 0 8px 24px rgba(24, 59, 76, 0.1);
}

html[data-resolved-theme="light"] .metric-primary {
  background: linear-gradient(145deg, #f2fbfa, #e8f5f4);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
}

html[data-resolved-theme="light"] .game-stat,
html[data-resolved-theme="light"] .overview-summary-item,
html[data-resolved-theme="light"] .telemetry-chart-card,
html[data-resolved-theme="light"] .request-settings > div,
html[data-resolved-theme="light"] .action-button,
html[data-resolved-theme="light"] .button-secondary,
html[data-resolved-theme="light"] .segmented,
html[data-resolved-theme="light"] th {
  background: var(--bg-elevated);
}

html[data-resolved-theme="light"] .action-button:hover:not(:disabled),
html[data-resolved-theme="light"] .button-secondary:hover:not(:disabled),
html[data-resolved-theme="light"] tbody tr:hover:not(.no-hover) td {
  background: var(--surface-hover);
}

html[data-resolved-theme="light"] .pill,
html[data-resolved-theme="light"] .tag {
  color: var(--text-soft);
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

html[data-resolved-theme="light"] .tag-success { color: #0d623a; background: #e4f5eb; border-color: #70af8c; }
html[data-resolved-theme="light"] .tag-danger { color: #942338; background: #fbe8ec; border-color: #cf7d8b; }
html[data-resolved-theme="light"] .tag-warning { color: #775000; background: #fff2d5; border-color: #c89a3f; }
html[data-resolved-theme="light"] .tag-info { color: #175b9d; background: #e8f2fc; border-color: #79a7d3; }

html[data-resolved-theme="light"] .nav-badge,
html[data-resolved-theme="light"] .count-badge,
html[data-resolved-theme="light"] .tab-count {
  color: #ffffff;
  background: var(--primary-strong);
}

html[data-resolved-theme="light"] :focus-visible {
  outline-width: 3px;
  outline-color: #006461;
  box-shadow: 0 0 0 3px rgba(0, 100, 97, 0.16);
}

html[data-resolved-theme="light"] .button:disabled,
html[data-resolved-theme="light"] .action-button:disabled,
html[data-resolved-theme="light"] input:disabled,
html[data-resolved-theme="light"] select:disabled,
html[data-resolved-theme="light"] textarea:disabled {
  opacity: 0.76;
  color: #3e5966;
}

html[data-resolved-theme="light"] .progress-track {
  background: #d6e2e7;
  border: 1px solid #c1d1d8;
}

.ai-policy-group-row th {
  padding-top: 12px;
  padding-bottom: 10px;
  color: var(--text-soft);
  background: var(--surface-raised);
  border-top: 1px solid var(--border-strong);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.ai-policy-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.ai-policy-legend .notice {
  min-width: 0;
  margin: 0;
}

#ai-policy-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

#view-ai-governance { overflow-x: clip; }
#view-ai-governance .table-wrap { min-width: 0; max-width: 100%; }

@container (max-width: 760px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .save-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .save-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .save-actions .button {
    min-width: 44px;
    flex: 1 1 180px;
  }

  .request-settings {
    grid-template-columns: 1fr;
  }

  .telemetry-history-header {
    display: grid;
  }

  .telemetry-range {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .telemetry-range button { min-width: 0; }

  .panel-header,
  .resource-panel-toolbar {
    align-items: stretch;
  }

  .resource-panel-toolbar {
    width: 100%;
    justify-content: flex-start;
  }
}

@container (max-width: 520px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .resource-mode-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .topbar-actions {
    gap: 6px;
  }

  .topbar .theme-toggle small,
  .topbar .task-trigger > span:nth-child(2),
  .topbar .user-copy,
  .topbar .user-chip > span:last-child {
    display: none;
  }

  html[data-language="en"] #view-overview .page-header {
    display: block;
  }

  html[data-language="en"] #view-overview .header-actions {
    width: 100%;
    margin-top: 17px;
    justify-content: flex-start;
  }

  html[data-language="en"] #view-overview .header-actions .button {
    flex: 1 1 180px;
  }

  .button,
  .button-small,
  .icon-button,
  .task-trigger,
  .user-chip,
  .copy-button,
  .row-select,
  .nav-link,
  .segmented button,
  .auth-tabs button,
  .popover button,
  .text-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .icon-button,
  .task-trigger,
  .copy-button {
    min-width: 44px;
  }

  .search-field,
  .search-field input {
    min-height: 44px;
  }
}

@media (max-width: 820px) {
  .theme-toggle small { display: none; }

  .topbar {
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .main-content {
    padding-right: max(17px, env(safe-area-inset-right));
    padding-left: max(17px, env(safe-area-inset-left));
  }

  .drawer {
    width: min(100vw, 500px);
  }
}

@media (max-width: 700px) {
  .table-panel {
    overflow: visible;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .table-wrap {
    overflow: visible;
  }

  .table-wrap table,
  .table-wrap tbody {
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .table-wrap tbody tr {
    display: block;
    min-width: 0;
    max-width: 100%;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
  }

  .table-wrap tbody td {
    display: grid;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    min-height: 44px;
    grid-template-columns: minmax(92px, 32%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 9px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    border-bottom: 1px solid var(--border);
    text-align: left;
  }

  .table-wrap tbody td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
  }

  .table-wrap tbody td:last-child {
    border-bottom: 0;
  }

  .table-wrap tbody td[colspan] {
    display: block;
    min-height: 120px;
  }

  .table-wrap tbody td[colspan]::before {
    content: none;
  }

  .table-wrap tbody .ai-policy-group-row {
    padding: 0;
  }

  .table-wrap tbody .ai-policy-group-row th {
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    border: 0;
    border-radius: 11px;
  }

  .table-wrap .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .table-wrap .row-select {
    width: 100%;
    min-width: 0;
  }

  #view-ai-governance .table-wrap,
  #view-ai-governance .table-wrap table,
  #view-ai-governance .table-wrap tbody,
  #view-ai-governance .table-wrap tr,
  #view-ai-governance .table-wrap th,
  #view-ai-governance .table-wrap td,
  #view-ai-governance .table-wrap td > * {
    min-width: 0;
    max-width: 100%;
  }

  #view-ai-governance .table-wrap td,
  #view-ai-governance .table-wrap td > * {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .registration-row,
  .registration-controls {
    align-items: stretch;
  }

  .registration-row {
    flex-direction: column;
  }

  .registration-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .registration-controls .row-select {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 620px) {
  .login-view {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .mobile-brand {
    display: none;
  }

  .topbar-actions {
    gap: 4px;
  }

  .assistant-draft .row-actions,
  .request-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .assistant-form .button {
    width: 100%;
  }

  .dialog {
    width: calc(100% - max(20px, env(safe-area-inset-left) + env(safe-area-inset-right)));
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  }

  .numeric-exact-row {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
  }

  .numeric-bounds { font-size: 10px; }

  .maintenance-diff > div { grid-template-columns: 1fr; }
  .maintenance-diff dd { text-align: left; }
  .maintenance-delay-control { grid-template-columns: 1fr; }

  .telemetry-range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .telemetry-chart-card { padding: 8px; }

  .provider-grid,
  .mode-grid,
  .ai-runtime-grid,
  .ai-activity-grid,
  .ai-policy-summary {
    grid-template-columns: 1fr;
  }

  .ai-signal-resources { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .assistant-setting-diff > div { grid-template-columns: 1fr; }

  .ai-governance-config .row-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .ai-signal-resources { grid-template-columns: 1fr; }
  .ai-signal-gauge { grid-template-columns: 52px minmax(0, 1fr); }
  .ai-signal-facts { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .login-language-toggle {
    top: 12px;
    right: 12px;
  }

  .game-metric-grid {
    grid-template-columns: 1fr;
  }

  .resource-network .resource-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .resource-network .resource-copy strong {
    max-width: 100%;
    text-align: left;
  }

  .main-content {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .login-card,
  .panel,
  .drawer {
    padding-right: 15px;
    padding-left: 15px;
  }

  .page-header h1 {
    font-size: 25px;
  }

  .metric-card {
    padding: 17px;
  }

  .table-wrap tbody td {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}

@media (max-width: 340px) {
  #task-trigger #active-task-count { display: none; }
  #task-trigger #review-request-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    padding: 0 4px;
  }
  :root {
    --topbar-height: 112px;
  }

  .topbar {
    align-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  }

  .server-indicator {
    min-width: 0;
    flex: 1 1 auto;
  }

  .topbar-actions {
    width: 100%;
    flex: 0 0 100%;
    justify-content: space-between;
  }

  .topbar-actions > * {
    width: 44px;
    min-width: 44px;
    flex: 0 0 44px;
  }

  .topbar-actions .task-trigger,
  .topbar-actions .user-chip {
    width: 44px;
    min-width: 44px;
    padding-right: 4px;
    padding-left: 4px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --topbar-height: 54px;
  }

  .login-view {
    place-items: start center;
  }

  .login-card {
    margin: auto;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .login-heading {
    margin: 20px 0 16px;
  }

  .drawer {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .drawer-header {
    margin-bottom: 10px;
  }

  .assistant-guard {
    margin-bottom: 8px;
  }
}

@media (horizontal-viewport-segments: 2) {
  .sidebar {
    width: min(var(--sidebar-width), env(viewport-segment-width 0 0));
  }

  .topbar {
    left: max(var(--sidebar-width), env(viewport-segment-left 1 0));
  }

  .main-content {
    margin-left: max(var(--sidebar-width), env(viewport-segment-left 1 0));
  }

  .drawer {
    right: calc(100vw - env(viewport-segment-right 1 0));
    max-width: env(viewport-segment-width 1 0);
  }
}
