:root {
  --bg: #07111f;
  --bg-deep: #040a12;
  --surface: rgba(13, 27, 46, 0.88);
  --surface-solid: #0d1b2e;
  --surface-raised: #12233a;
  --surface-soft: rgba(27, 49, 78, 0.55);
  --border: rgba(151, 177, 211, 0.16);
  --border-strong: rgba(151, 177, 211, 0.3);
  --text: #f1f6fc;
  --text-muted: #9eb0c8;
  --text-soft: #71849d;
  --blue: #55a8ff;
  --blue-strong: #1684f8;
  --blue-soft: rgba(56, 151, 255, 0.13);
  --green: #42d9a1;
  --green-soft: rgba(66, 217, 161, 0.13);
  --amber: #f7bd58;
  --amber-soft: rgba(247, 189, 88, 0.13);
  --red: #ff6f7c;
  --red-soft: rgba(255, 111, 124, 0.13);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --topbar-height: 76px;
  --sidebar-width: 216px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 85% -10%, rgba(36, 127, 231, 0.16), transparent 32%),
    radial-gradient(circle at 4% 35%, rgba(35, 203, 170, 0.07), transparent 27%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  -webkit-font-smoothing: antialiased;
}

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

button,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(85, 168, 255, 0.55);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.72rem, 2.5vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

small {
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: #03111e;
  background: var(--blue);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

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

.fatal-banner,
.connection-banner {
  position: fixed;
  z-index: 900;
  top: 0;
  right: 0;
  left: 0;
  padding: 10px 18px;
  text-align: center;
  color: #281300;
  background: var(--amber);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.connection-banner {
  font-size: 0.88rem;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one {
  top: 8%;
  right: -130px;
  background: var(--blue);
}

.ambient-two {
  bottom: -160px;
  left: -100px;
  background: var(--green);
}

.eyebrow {
  margin-bottom: 9px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #06111f;
  background: linear-gradient(140deg, #81c6ff, #4be0aa);
  border-radius: 13px;
  box-shadow: 0 8px 24px rgba(43, 163, 255, 0.2);
  font-weight: 900;
  letter-spacing: -0.08em;
}

.brand-mark-large {
  width: 58px;
  height: 58px;
  margin-bottom: 28px;
  border-radius: 18px;
  font-size: 1.38rem;
}

/* Authentication */
.auth-shell {
  display: grid;
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 56px 0;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  gap: clamp(50px, 9vw, 120px);
  align-items: center;
}

.auth-intro {
  max-width: 610px;
}

.auth-intro h1 {
  max-width: 540px;
  margin-bottom: 18px;
  font-size: clamp(2.35rem, 5.4vw, 4.5rem);
  letter-spacing: -0.055em;
}

.auth-lead {
  max-width: 590px;
  margin-bottom: 38px;
  color: var(--text-muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.trust-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 13px;
  list-style: none;
}

.trust-list li {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: #c9d6e6;
  font-size: 0.92rem;
}

.trust-list span {
  display: grid;
  width: 34px;
  height: 28px;
  margin-right: 13px;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(66, 217, 161, 0.18);
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 800;
}

.auth-panel {
  width: 100%;
  min-height: 440px;
  padding: clamp(24px, 4vw, 38px);
  background: linear-gradient(160deg, rgba(20, 40, 66, 0.92), rgba(10, 22, 38, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-card h2 {
  margin-bottom: 9px;
  font-size: 1.75rem;
}

.auth-card > .muted {
  margin-bottom: 27px;
  line-height: 1.6;
}

.loading-state {
  display: grid;
  min-height: 365px;
  place-items: center;
  align-content: center;
  color: var(--text-muted);
  gap: 14px;
}

.loading-state p {
  margin: 0;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(85, 168, 255, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

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

.topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: var(--topbar-height);
  padding: 12px 26px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(6, 15, 27, 0.84);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-brand {
  gap: 13px;
}

.topbar-title,
.topbar-subtitle {
  margin: 0;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 800;
}

.topbar-subtitle {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.topbar-actions {
  gap: 9px;
}

.user-chip,
.revision-chip {
  display: inline-flex;
  min-height: 34px;
  padding: 6px 11px;
  align-items: center;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
}

.workspace {
  display: grid;
  min-height: calc(100vh - var(--topbar-height));
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  display: flex;
  height: calc(100vh - var(--topbar-height));
  padding: 24px 14px;
  flex-direction: column;
  gap: 6px;
  background: rgba(6, 16, 29, 0.52);
  border-right: 1px solid var(--border);
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  align-items: center;
  gap: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: left;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(85, 168, 255, 0.06);
}

.nav-item.is-active {
  color: #eaf5ff;
  background: var(--blue-soft);
  border-color: rgba(85, 168, 255, 0.18);
}

.nav-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: currentColor;
  background: rgba(255, 255, 255, 0.045);
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 800;
}

.content {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 38px clamp(20px, 4vw, 56px) 30px;
}

.view-panel {
  animation: reveal 180ms ease both;
}

.content-monitor-ready {
  width: min(1540px, 100%);
}

.monitor-frame-shell {
  position: relative;
  width: 100%;
  height: max(680px, calc(100dvh - 185px));
  overflow: hidden;
  background: rgba(5, 15, 27, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
}

.monitor-frame-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  background: #07111f;
  border: 0;
}

.monitor-frame-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  color: var(--text-muted);
  background: rgba(7, 17, 31, 0.94);
}

.monitor-frame-loading p {
  margin: 0;
  font-size: 0.86rem;
}

.monitor-help {
  margin: 11px 2px 0;
  color: var(--text-soft);
  font-size: 0.73rem;
  line-height: 1.5;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h1 {
  margin-bottom: 0;
}

.section-heading .eyebrow {
  margin-bottom: 7px;
}

.updated-at {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.78rem;
}

/* Shared controls */
.button {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 17px;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  transition:
    transform 100ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.button:hover:not(:disabled) {
  border-color: rgba(151, 177, 211, 0.48);
  transform: translateY(-1px);
}

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

.button-primary {
  color: #031425;
  background: linear-gradient(140deg, #79c0ff, #4da5ff);
  border-color: transparent;
  box-shadow: 0 9px 24px rgba(30, 140, 255, 0.18);
}

.button-secondary {
  color: #dce8f7;
  background: rgba(34, 57, 87, 0.65);
}

.button-danger {
  color: #fff0f1;
  background: rgba(164, 44, 57, 0.36);
  border-color: rgba(255, 111, 124, 0.38);
}

.button-danger:hover:not(:disabled) {
  background: rgba(190, 49, 64, 0.48);
  border-color: rgba(255, 111, 124, 0.62);
}

.button-quiet {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.button-compact {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.button-block {
  width: 100%;
  margin-top: 7px;
}

.text-button {
  min-height: 36px;
  padding: 5px 3px;
  color: var(--blue);
  background: transparent;
  border: 0;
  font-weight: 700;
}

.text-button:hover {
  color: #9bd0ff;
}

.field {
  display: grid;
  margin-bottom: 18px;
  gap: 8px;
}

.field > span,
.compact-field > span {
  color: #d7e2f0;
  font-size: 0.84rem;
  font-weight: 700;
}

.field small {
  color: var(--text-soft);
  font-size: 0.74rem;
}

input,
textarea,
select {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(5, 15, 27, 0.68);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: rgba(151, 177, 211, 0.48);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(85, 168, 255, 0.11);
}

input::placeholder,
textarea::placeholder {
  color: #536881;
}

textarea {
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
}

.checkbox-line {
  display: flex;
  margin: 6px 0 18px;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.compact-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-field select {
  width: auto;
  min-height: 38px;
  padding: 7px 30px 7px 10px;
  font-size: 0.8rem;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.is-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.is-busy::after {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  content: "";
  color: var(--text);
  animation: spin 650ms linear infinite;
}

/* Status and notices */
.status-badge {
  display: inline-flex;
  min-height: 32px;
  padding: 5px 10px;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  background: rgba(151, 177, 211, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(151, 177, 211, 0.08);
}

.status-ok {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(66, 217, 161, 0.2);
}

.status-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(247, 189, 88, 0.22);
}

.status-danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 111, 124, 0.22);
}

.status-neutral {
  color: var(--text-muted);
}

.notice {
  display: flex;
  min-height: 66px;
  margin-bottom: 20px;
  padding: 15px 17px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-md);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
}

.notice p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

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

.notice-warning {
  background: var(--amber-soft);
  border-color: rgba(247, 189, 88, 0.22);
  border-left-color: var(--amber);
}

.notice-danger {
  background: var(--red-soft);
  border-color: rgba(255, 111, 124, 0.22);
  border-left-color: var(--red);
}

/* Cards and overview */
.metric-grid {
  display: grid;
  margin-bottom: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.panel {
  background: linear-gradient(160deg, rgba(19, 37, 61, 0.82), rgba(10, 23, 40, 0.88));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 42px rgba(0, 0, 0, 0.12);
}

.metric-card {
  min-height: 142px;
  padding: 20px;
}

.metric-card p {
  margin-bottom: 15px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  overflow: hidden;
  margin-bottom: 7px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  margin-bottom: 20px;
  padding: clamp(19px, 3vw, 26px);
}

.panel-flush {
  padding: 0;
  overflow: hidden;
}

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

.panel-heading h2,
.panel-heading .eyebrow {
  margin-bottom: 0;
}

.panel-heading .eyebrow {
  margin-bottom: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.important-copy {
  margin-bottom: 20px;
  padding: 14px 15px;
  color: #f5dba7;
  background: rgba(247, 189, 88, 0.08);
  border: 1px solid rgba(247, 189, 88, 0.14);
  border-radius: 11px;
}

.important-copy strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.85rem;
}

.important-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.control-block {
  padding-top: 2px;
}

.account-summary-list,
.account-list {
  display: grid;
  gap: 10px;
}

.account-summary-row,
.account-card {
  display: flex;
  min-height: 58px;
  padding: 11px 13px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(5, 15, 27, 0.46);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.account-summary-row strong,
.account-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.86rem;
}

.account-summary-row small,
.account-card small {
  display: block;
  color: var(--text-soft);
  font-size: 0.71rem;
}

.account-card {
  min-height: 76px;
  padding: 15px;
}

.account-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state,
.empty-cell {
  padding: 24px;
  color: var(--text-soft);
  text-align: center;
  font-size: 0.84rem;
}

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

.detail-grid > div,
.detail-stack > div {
  min-width: 0;
  padding: 13px 14px;
  background: rgba(5, 15, 27, 0.43);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.detail-grid dt,
.detail-stack dt {
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.71rem;
}

.detail-grid dd,
.detail-stack dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: #dce7f5;
  font-size: 0.83rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
  row-gap: 3px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-actions p {
  margin: 0;
  font-size: 0.78rem;
}

.form-actions > div {
  display: flex;
  gap: 10px;
}

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

.stepup-box {
  margin: 0 0 20px;
  padding: 15px 16px 1px;
  background: rgba(247, 189, 88, 0.07);
  border: 1px solid rgba(247, 189, 88, 0.18);
  border-radius: 12px;
}

.activation-panel {
  border-color: rgba(247, 189, 88, 0.32);
}

.activation-panel .detail-grid {
  margin-bottom: 18px;
}

/* Audit */
.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.audit-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.79rem;
}

.audit-table th,
.audit-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: var(--text-soft);
  background: rgba(5, 15, 27, 0.46);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.audit-table td {
  max-width: 320px;
  color: #c8d5e5;
  overflow-wrap: anywhere;
}

.audit-table tr:last-child td {
  border-bottom: 0;
}

.audit-result {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
}

.audit-result-ok {
  color: var(--green);
  background: var(--green-soft);
}

.audit-result-failed {
  color: var(--red);
  background: var(--red-soft);
}

/* Security */
.security-columns {
  align-items: start;
}

.detail-stack {
  display: grid;
  margin: 0 0 20px;
  gap: 9px;
}

.detail-stack > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-stack dt {
  margin: 0;
}

.security-note {
  margin: 0;
  padding: 13px 14px;
  color: var(--text-muted);
  background: var(--green-soft);
  border: 1px solid rgba(66, 217, 161, 0.14);
  border-radius: 10px;
  font-size: 0.77rem;
  line-height: 1.55;
}

.page-footer {
  display: flex;
  padding: 20px 3px 4px;
  justify-content: space-between;
  gap: 18px;
  color: var(--text-soft);
  font-size: 0.7rem;
}

/* Dialog and toast */
.confirm-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 26px;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(1, 6, 12, 0.74);
  backdrop-filter: blur(5px);
}

.confirm-dialog h2 {
  margin: 13px 0 9px;
  font-size: 1.35rem;
}

.confirm-dialog > p {
  margin-bottom: 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

.dialog-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(247, 189, 88, 0.22);
  border-radius: 11px;
  font-weight: 900;
}

.dialog-details {
  max-height: 180px;
  margin: -4px 0 20px;
  padding: 12px 14px;
  overflow: auto;
  color: #c5d3e5;
  background: rgba(5, 15, 27, 0.58);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.76rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast-region {
  position: fixed;
  z-index: 1200;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(380px, calc(100% - 36px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  padding: 13px 15px;
  color: #dce8f6;
  background: rgba(15, 31, 52, 0.97);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--blue);
  border-radius: 11px;
  box-shadow: 0 13px 34px rgba(0, 0, 0, 0.3);
  font-size: 0.82rem;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
}

.toast-success {
  border-left-color: var(--green);
}

.toast-error {
  border-left-color: var(--red);
}

.toast-warning {
  border-left-color: var(--amber);
}

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

@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;
  }
}

@media (max-width: 1040px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .topbar-actions .user-chip {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --topbar-height: 68px;
  }

  .auth-shell {
    width: min(620px, calc(100% - 32px));
    padding: 38px 0;
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .auth-intro {
    max-width: none;
  }

  .auth-intro h1 {
    font-size: clamp(2.2rem, 10vw, 3.4rem);
  }

  .trust-list {
    display: none;
  }

  .auth-lead {
    margin-bottom: 0;
  }

  .auth-panel {
    min-height: 0;
  }

  .loading-state {
    min-height: 280px;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 180;
    top: auto;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    height: 64px;
    padding: 7px;
    flex-direction: row;
    justify-content: space-around;
    gap: 3px;
    background: rgba(8, 20, 35, 0.96);
    border: 1px solid var(--border-strong);
    border-radius: 17px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
    backdrop-filter: blur(18px);
  }

  .nav-item {
    min-width: 0;
    min-height: 48px;
    padding: 5px 8px;
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 0.62rem;
    text-align: center;
  }

  .nav-icon {
    width: auto;
    height: auto;
    background: transparent;
    font-size: 0.65rem;
  }

  .content {
    padding: 28px 20px 100px;
  }

  .monitor-frame-shell {
    height: max(640px, calc(100dvh - 205px));
    border-radius: 14px;
  }

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 10px 14px;
  }

  .topbar-subtitle,
  .topbar-actions .status-badge,
  .topbar-actions #refresh-state {
    display: none;
  }

  .topbar-actions {
    gap: 2px;
  }

  .topbar-brand {
    gap: 9px;
  }

  .topbar .brand-mark {
    width: 38px;
    height: 38px;
  }

  .content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .content-monitor-ready {
    padding-right: 10px;
    padding-left: 10px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .section-heading .inline-actions {
    width: 100%;
    justify-content: space-between;
  }

  .monitor-frame-shell {
    height: max(620px, calc(100dvh - 220px));
    border-radius: 12px;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric-card {
    min-height: 125px;
    padding: 16px;
  }

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

  .panel-flush {
    padding: 0;
  }

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

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-actions-right {
    align-items: flex-end;
  }

  .form-actions-right .button {
    width: 100%;
  }

  .account-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-card-meta {
    justify-content: flex-start;
  }

  .detail-stack > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .toast-region {
    right: 12px;
    bottom: 88px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 430px) {
  .auth-shell {
    width: min(100% - 24px, 620px);
  }

  .auth-panel {
    padding: 21px;
    border-radius: 18px;
  }

  .metric-card strong {
    font-size: 1.2rem;
  }

  .metric-card small {
    white-space: normal;
  }

  .nav-item {
    padding: 4px 2px;
  }

  .nav-item span:last-child {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
