:root {
  color-scheme: dark;
  --ink: #08101f;
  --ink-soft: #101b31;
  --panel: rgba(15, 27, 49, 0.84);
  --panel-solid: #14213b;
  --line: rgba(168, 198, 230, 0.15);
  --line-strong: rgba(168, 198, 230, 0.3);
  --text: #edf5fb;
  --muted: #98acc1;
  --cyan: #67d8d4;
  --cyan-soft: rgba(103, 216, 212, 0.13);
  --gold: #e6bd72;
  --violet: #ac9bff;
  --green: #7bd4a4;
  --red: #ff938d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(54, 125, 151, 0.24), transparent 38rem),
    radial-gradient(circle at 92% 18%, rgba(86, 72, 159, 0.18), transparent 30rem),
    linear-gradient(145deg, #070e1b, #0b1427 52%, #080f1e);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    radial-gradient(circle, rgba(220, 239, 255, 0.5) 0 0.7px, transparent 0.9px),
    radial-gradient(circle, rgba(103, 216, 212, 0.3) 0 0.8px, transparent 1px);
  background-position: 0 0, 55px 40px;
  background-size: 110px 110px, 170px 170px;
  content: "";
  opacity: 0.3;
}

button,
input,
textarea {
  font: inherit;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.sky-glow {
  position: fixed;
  z-index: -2;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  pointer-events: none;
}

.sky-glow-one {
  top: 20%;
  left: -15rem;
  background: var(--cyan);
}

.sky-glow-two {
  right: -14rem;
  bottom: 0;
  background: var(--violet);
}

.topbar,
main,
footer {
  width: min(1440px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
}

.brand > span:last-child {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 1.25rem;
  letter-spacing: 0.14em;
}

.brand small {
  color: var(--muted);
  font-size: 0.56rem;
  letter-spacing: 0.2em;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.brand-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(230, 189, 114, 0.8);
}

.brand-orbit {
  position: absolute;
  width: 35px;
  height: 18px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  transform: rotate(-24deg);
}

.brand-orbit::after {
  position: absolute;
  top: 3px;
  right: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  content: "";
  box-shadow: 0 0 8px var(--cyan);
}

.plane-switch {
  display: flex;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(4, 12, 25, 0.55);
  padding: 5px;
}

.plane {
  border-radius: 999px;
  color: var(--muted);
  padding: 7px 13px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.plane.active {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.connection {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #66788b;
  box-shadow: 0 0 0 4px rgba(102, 120, 139, 0.12);
}

.connection.success .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(123, 212, 164, 0.12), 0 0 12px var(--green);
}

.connection.loading .connection-dot {
  background: var(--gold);
}

.connection.error .connection-dot {
  background: var(--red);
}

.welcome-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: clamp(50px, 8vw, 130px);
  min-height: calc(100vh - 180px);
  padding: 70px 4vw 90px;
}

.welcome-copy {
  max-width: 780px;
}

.kicker,
.section-tag {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.welcome-copy h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(3rem, 6vw, 6.7rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.welcome-copy h1 em {
  color: var(--gold);
  font-style: normal;
}

.lead {
  max-width: 680px;
  margin: 32px 0 0;
  color: #b3c4d5;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.9;
}

.principle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.78rem;
}

.principle-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.principle-row span::before {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.entry-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(155deg, rgba(22, 40, 69, 0.94), rgba(11, 22, 42, 0.92));
  box-shadow: var(--shadow);
  padding: clamp(26px, 4vw, 44px);
}

.entry-card::before {
  position: absolute;
  top: -100px;
  right: -80px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(103, 216, 212, 0.2);
  border-radius: 50%;
  content: "";
}

.entry-card h2,
.dashboard-hero h2,
.section-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 550;
}

.entry-card h2 {
  max-width: 360px;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.25;
}

.entry-card > p:not(.section-tag, .form-status) {
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.entry-card form {
  display: grid;
  gap: 9px;
}

.entry-card label {
  color: #cbd9e6;
  font-size: 0.78rem;
  font-weight: 650;
}

.entry-form {
  display: grid;
  gap: 9px;
}

.entry-form[hidden],
.text-button[hidden] {
  display: none;
}

.entry-form input {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(3, 11, 23, 0.78);
  color: var(--text);
  padding: 0 14px;
}

.entry-form input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(103, 216, 212, 0.12);
}

.entry-submit {
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid var(--cyan);
  border-radius: 12px;
  background: var(--cyan);
  color: #081721;
  font-weight: 760;
  cursor: pointer;
}

.entry-submit:disabled,
.quiet-button:disabled,
.approval-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.entry-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.oidc-entry {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.oidc-options {
  display: grid;
  gap: 0.5rem;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--cyan);
  padding: 4px 0;
  cursor: pointer;
}

.legacy-entry {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.legacy-entry summary {
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.legacy-entry form {
  margin-top: 12px;
}

.access-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-field input,
.access-field button,
.quiet-button {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.access-field input {
  min-width: 0;
  outline: none;
  background: rgba(3, 11, 23, 0.78);
  color: var(--text);
  padding: 0 14px;
}

.access-field input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(103, 216, 212, 0.12);
}

.access-field button {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #081721;
  padding: 0 18px;
  font-weight: 760;
  cursor: pointer;
}

.access-field button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.form-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.form-status.error {
  color: var(--red);
}

.form-status.success {
  color: var(--green);
}

.security-note {
  display: grid;
  gap: 3px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.security-note strong {
  color: var(--gold);
}

.welcome-shell[hidden] {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 34px;
  padding: 36px 0 90px;
}

.workspace[hidden] {
  display: none;
}

.workspace-sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  min-height: calc(100vh - 120px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 20, 38, 0.73);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.person-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.person-card > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.person-card strong,
.person-card span:not(.avatar) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-card span:not(.avatar) {
  color: var(--muted);
  font-size: 0.68rem;
}

.avatar {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(230, 189, 114, 0.42);
  border-radius: 50%;
  background: rgba(230, 189, 114, 0.09);
  color: var(--gold);
  font-family: "Songti SC", serif;
}

.workspace-sidebar nav {
  display: grid;
  align-content: start;
  gap: 5px;
  margin-top: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 10px;
  color: var(--muted);
  padding: 10px;
  font-size: 0.78rem;
}

.nav-item span {
  color: #586f84;
  font: 0.62rem ui-monospace, monospace;
}

.nav-item:hover,
.nav-item.active {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.sidebar-actions {
  display: grid;
  align-self: end;
  gap: 8px;
}

.quiet-button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.quiet-button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.quiet-button.danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.workspace-content {
  display: grid;
  gap: 22px;
}

.dashboard-hero,
.content-section {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(15px);
}

.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 190px;
  padding: clamp(26px, 4vw, 42px);
  background:
    radial-gradient(circle at 88% 20%, rgba(103, 216, 212, 0.12), transparent 15rem),
    var(--panel);
}

.dashboard-hero h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.dashboard-hero p:last-child {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.system-badge,
.data-chip,
.count-pill,
.trust-chip,
.readonly-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  white-space: nowrap;
}

.system-badge {
  gap: 8px;
  color: var(--green);
  padding: 8px 12px;
  font-size: 0.7rem;
}

.system-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  display: grid;
  min-height: 146px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(14, 27, 49, 0.72);
  padding: 20px;
}

.metric-card::after {
  position: absolute;
  right: -25px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  border: 1px solid currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.15;
}

.metric-card.accent-cyan { color: var(--cyan); }
.metric-card.accent-gold { color: var(--gold); }
.metric-card.accent-violet { color: var(--violet); }
.metric-card.accent-green { color: var(--green); }
.metric-card.accent-red { color: var(--red); }

.metric-label,
.metric-card small {
  color: var(--muted);
}

.metric-label {
  font-size: 0.72rem;
}

.metric-card strong {
  align-self: center;
  color: var(--text);
  font: 500 clamp(2rem, 4vw, 3.2rem) "Songti SC", serif;
}

.metric-card small {
  align-self: end;
  font-size: 0.66rem;
}

.content-section {
  padding: clamp(22px, 3vw, 32px);
}

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

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

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

.section-heading h2 {
  font-size: 1.65rem;
}

.section-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.section-intro {
  max-width: 760px;
  margin: -8px 0 20px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.65;
}

.count-pill,
.trust-chip,
.readonly-pill {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.66rem;
}

.trust-chip {
  border-color: rgba(230, 189, 114, 0.35);
  color: var(--gold);
  font-family: ui-monospace, monospace;
}

.readonly-pill {
  border-color: rgba(103, 216, 212, 0.35);
  color: var(--cyan);
}

.security-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.security-actions-grid article {
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5, 14, 28, 0.48);
  padding: 19px;
}

.security-actions-grid p {
  min-height: 3em;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.security-actions-grid .quiet-button {
  justify-self: start;
  min-height: 40px;
  padding-inline: 14px;
}

.agent-grid,
.organization-grid,
.connector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.agent-card,
.organization-card,
.message-card,
.governance-grid article,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(5, 14, 28, 0.48);
}

.primary-action {
  min-height: 40px;
  border: 1px solid var(--cyan);
  border-radius: 11px;
  background: var(--cyan);
  color: #081721;
  padding: 0 17px;
  font-weight: 760;
  cursor: pointer;
}

.connector-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0, rgba(103, 216, 212, 0.08), transparent 13rem),
    rgba(5, 14, 28, 0.48);
  padding: 19px;
}

.connector-heading,
.connector-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.connector-heading > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.connector-heading strong,
.connector-heading span:not(.data-chip) {
  overflow-wrap: anywhere;
}

.connector-heading span:not(.data-chip),
.connector-actions span {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.connector-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.connector-card dl div {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.connector-card dt {
  color: var(--muted);
  font-size: 0.58rem;
}

.connector-card dd {
  margin: 4px 0 0;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.connector-actions {
  align-items: center;
}

.connector-actions .quiet-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding-inline: 12px;
}

.organization-card {
  display: grid;
  gap: 16px;
  padding: 19px;
  background:
    radial-gradient(circle at 100% 0, rgba(172, 155, 255, 0.1), transparent 12rem),
    rgba(5, 14, 28, 0.48);
}

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

.organization-heading > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.organization-heading strong {
  overflow-wrap: anywhere;
}

.organization-card-actions {
  display: flex;
  justify-content: flex-end;
}

.organization-card-actions .quiet-button {
  min-height: 36px;
  padding-inline: 12px;
}

.organization-heading span:not(.data-chip) {
  color: var(--muted);
  font: 0.64rem ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.organization-card > p {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.organization-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.organization-card dl div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.organization-card dt {
  color: var(--muted);
  font-size: 0.6rem;
}

.organization-card dd {
  margin: 5px 0 0;
  font-size: 1rem;
}

.agent-card {
  display: grid;
  gap: 19px;
  padding: 19px;
}

.agent-organization {
  border-left: 2px solid var(--violet);
  color: #c1b8ff;
  padding-left: 9px;
  font-size: 0.66rem;
}

.agent-card-top,
.task-heading,
.message-heading,
.message-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-card-top > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.agent-card-top strong,
.agent-card-top span:not(.data-chip) {
  overflow-wrap: anywhere;
}

.agent-card-top span:not(.data-chip) {
  color: var(--muted);
  font-size: 0.68rem;
}

.data-chip {
  flex: 0 0 auto;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.62rem;
}

.data-chip.owner,
.data-chip.completed,
.data-chip.acked {
  border-color: rgba(123, 212, 164, 0.38);
  color: var(--green);
}

.data-chip.pending,
.data-chip.delivered,
.data-chip.partial {
  border-color: rgba(230, 189, 114, 0.4);
  color: var(--gold);
}

.data-chip.failed,
.data-chip.cancelled {
  border-color: rgba(255, 147, 141, 0.4);
  color: var(--red);
}

.data-chip.operator,
.data-chip.viewer,
.data-chip.auditor,
.data-chip.admin,
.data-chip.member,
.data-chip.read {
  border-color: rgba(103, 216, 212, 0.35);
  color: var(--cyan);
}

.capability-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.capability-row span {
  border-radius: 7px;
  background: rgba(103, 216, 212, 0.07);
  color: #9db8c9;
  padding: 5px 7px;
  font-size: 0.61rem;
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.agent-stats div {
  display: grid;
  gap: 4px;
}

.agent-stats dt {
  color: var(--muted);
  font-size: 0.59rem;
}

.agent-stats dd {
  margin: 0;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.timeline-list,
.message-list,
.approval-list {
  display: grid;
  gap: 12px;
}

.task-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0 18px;
}

.task-item:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.timeline-marker {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(230, 189, 114, 0.08);
}

.task-item.completed .timeline-marker { border-color: var(--green); }
.task-item.failed .timeline-marker { border-color: var(--red); }

.task-body {
  min-width: 0;
}

.task-heading strong,
.message-heading strong {
  overflow-wrap: anywhere;
}

.task-route,
.message-route,
.task-instruction {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.task-instruction {
  color: #c9d6e2;
  font-size: 0.78rem;
}

.dual-state {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: #718ba2;
  font-size: 0.62rem;
}

.trust-banner {
  margin: -6px 0 16px;
  border-left: 2px solid var(--gold);
  background: rgba(230, 189, 114, 0.05);
  color: #b8aa8f;
  padding: 10px 13px;
  font-size: 0.68rem;
  line-height: 1.5;
}

.message-card {
  padding: 18px;
}

.approval-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0, rgba(230, 189, 114, 0.08), transparent 14rem),
    rgba(5, 14, 28, 0.48);
  padding: 19px;
}

.approval-heading,
.approval-meta,
.approval-actions,
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.approval-heading > div {
  display: grid;
  gap: 5px;
}

.approval-heading strong,
.approval-summary,
.approval-justification,
.approval-payload {
  overflow-wrap: anywhere;
}

.approval-action-type {
  color: var(--cyan);
  font: 0.62rem ui-monospace, monospace;
  letter-spacing: 0.08em;
}

.approval-summary,
.approval-justification {
  margin: 0;
  line-height: 1.65;
}

.approval-summary {
  color: #d7e2eb;
  font-size: 0.84rem;
}

.approval-justification {
  color: var(--muted);
  font-size: 0.72rem;
}

.approval-payload {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 8, 18, 0.65);
  color: #a8bccd;
  padding: 11px;
  font: 0.66rem/1.55 ui-monospace, monospace;
  white-space: pre-wrap;
}

.approval-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: #718ba2;
  font-size: 0.62rem;
}

.approval-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.approval-action,
.approval-submit,
.dialog-close {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
}

.approval-action {
  min-height: 36px;
  background: transparent;
  color: var(--muted);
  padding: 0 13px;
  font-size: 0.7rem;
}

.approval-action.approve:hover {
  border-color: var(--green);
  color: var(--green);
}

.approval-action.reject:hover {
  border-color: var(--red);
  color: var(--red);
}

.approval-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #101c31;
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 0;
}

.approval-dialog::backdrop {
  background: rgba(2, 7, 15, 0.78);
  backdrop-filter: blur(6px);
}

.approval-dialog form {
  display: grid;
  gap: 11px;
  padding: 26px;
}

.dialog-heading {
  align-items: flex-start;
}

.dialog-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 550;
}

.dialog-close {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
}

.dialog-summary {
  margin: 5px 0;
  color: #d7e2eb;
  line-height: 1.65;
}

.approval-dialog label {
  margin-top: 5px;
  color: #cbd9e6;
  font-size: 0.72rem;
  font-weight: 650;
}

.approval-dialog textarea,
.approval-dialog input[type="email"],
.approval-dialog input[type="text"],
.approval-dialog input[type="password"],
.approval-dialog select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: rgba(3, 11, 23, 0.78);
  color: var(--text);
  padding: 12px;
}

.approval-dialog textarea {
  min-height: 96px;
  resize: vertical;
}

.approval-dialog textarea:focus,
.approval-dialog input[type="email"]:focus,
.approval-dialog input[type="text"]:focus,
.approval-dialog input[type="password"]:focus,
.approval-dialog select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(103, 216, 212, 0.12);
}

.secret-output {
  max-height: 210px;
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(230, 189, 114, 0.35);
  border-radius: 11px;
  background: rgba(2, 8, 18, 0.72);
  color: var(--gold);
  padding: 12px;
  font: 0.7rem/1.6 ui-monospace, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.secret-output[hidden] {
  display: none;
}

.organization-dialog {
  width: min(760px, calc(100% - 32px));
}

.organization-dialog h3 {
  margin: 12px 0 0;
  color: var(--gold);
  font-size: 0.82rem;
}

.organization-invite-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}

.organization-invite-fields > div {
  display: grid;
  gap: 7px;
}

.organization-domain-section {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  margin-top: 5px;
  padding-top: 4px;
}

.organization-domain-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.organization-oidc-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.organization-oidc-fields button {
  grid-column: 1 / -1;
}

.domain-proof {
  display: block;
  max-width: min(100%, 610px);
  border: 1px solid rgba(230, 189, 114, 0.28);
  border-radius: 8px;
  background: rgba(230, 189, 114, 0.06);
  color: var(--gold);
  font-size: 0.66rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.governance-list {
  display: grid;
  gap: 8px;
}

.governance-list[hidden] {
  display: none;
}

.governance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(3, 11, 23, 0.42);
  padding: 11px 12px;
}

.governance-row > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.governance-row strong,
.governance-row span {
  overflow-wrap: anywhere;
}

.governance-row span {
  color: var(--muted);
  font-size: 0.66rem;
}

.governance-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.governance-row-actions .quiet-button {
  min-height: 34px;
  padding-inline: 10px;
}

.pairing-dialog {
  width: min(680px, calc(100% - 32px));
}

.pairing-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pairing-fields > div {
  display: grid;
  gap: 7px;
}

.pairing-preview {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(230, 189, 114, 0.3);
  border-radius: 12px;
  background: rgba(230, 189, 114, 0.05);
  padding: 14px;
}

.pairing-preview[hidden] {
  display: none;
}

.pairing-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

.pairing-preview span {
  color: var(--gold);
  font: 0.64rem ui-monospace, monospace;
}

.split-actions > div {
  display: flex;
  gap: 12px;
}

.danger-submit {
  border-color: var(--red);
  background: var(--red);
  color: #220907;
}

.data-chip.revoked,
.data-chip.denied {
  border-color: rgba(255, 147, 141, 0.4);
  color: var(--red);
}

.data-chip.replaced,
.data-chip.consumed {
  border-color: rgba(172, 155, 255, 0.4);
  color: var(--violet);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.dialog-actions .quiet-button,
.approval-submit {
  min-height: 42px;
  padding: 0 17px;
}

.approval-submit {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #081721;
  font-weight: 760;
}

.approval-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.message-heading > div {
  display: grid;
  gap: 5px;
}

.message-type {
  color: var(--cyan);
  font: 0.59rem ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message-card pre {
  max-height: 220px;
  margin: 14px 0;
  overflow: auto;
  border: 1px solid rgba(168, 198, 230, 0.1);
  border-radius: 9px;
  background: rgba(3, 10, 21, 0.66);
  color: #c8d7e4;
  padding: 12px;
  font: 0.72rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-footer {
  color: #60788f;
  font: 0.58rem ui-monospace, monospace;
}

.message-footer span {
  overflow-wrap: anywhere;
}

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

.governance-grid article {
  padding: 18px;
}

.governance-grid article > span {
  color: var(--cyan);
  font-size: 0.64rem;
}

.governance-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 0.88rem;
}

.governance-grid p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.65;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding: 24px 0 36px;
  color: #5f7488;
  font-size: 0.65rem;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .plane-switch {
    display: none;
  }

  .welcome-shell {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-inline: 2vw;
  }

  .entry-card {
    max-width: 650px;
  }

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

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .workspace-sidebar {
    position: static;
    min-height: auto;
  }

  .workspace-sidebar nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .sidebar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
  }

  .agent-grid,
  .organization-grid,
  .connector-grid,
  .security-actions-grid,
  .governance-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .topbar,
  main,
  footer {
    width: min(100% - 24px, 1440px);
  }

  .topbar {
    min-height: 74px;
  }

  .connection {
    font-size: 0;
  }

  .welcome-shell {
    gap: 44px;
    padding: 58px 0 70px;
  }

  .welcome-copy h1 {
    font-size: clamp(2.65rem, 14vw, 4.2rem);
  }

  .access-field {
    grid-template-columns: 1fr;
  }

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

  .dashboard-hero,
  .section-heading,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-hero {
    display: flex;
  }

  .system-badge {
    align-self: flex-start;
  }

  .agent-stats {
    grid-template-columns: 1fr;
  }

  .pairing-fields,
  .organization-invite-fields,
  .organization-domain-fields,
  .organization-oidc-fields,
  .connector-card dl {
    grid-template-columns: 1fr;
  }

  .split-actions,
  .connector-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
