:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #10151d;
  --surface-2: #151c26;
  --line: #263140;
  --text: #f3f7fb;
  --muted: #8e9aaa;
  --cyan: #38e8d5;
  --lime: #b9f34a;
  --purple: #a782ff;
  --amber: #ffca62;
  --red: #ff6b78;
  --radius: 18px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -20%, #183440 0, transparent 36%), var(--bg);
  color: var(--text);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
a {
  color: inherit;
  text-decoration: none;
}
.muted {
  color: var(--muted);
  line-height: 1.7;
}
.eyebrow {
  margin: 0 0 9px;
  color: var(--cyan);
  font:
    700 11px/1.2 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.18em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: rgba(8, 11, 16, 0.82);
  backdrop-filter: blur(18px);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wordmark-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}
.wordmark-copy b,
.wordmark-copy small {
  display: block;
}
.wordmark-copy b {
  font-size: 16px;
  letter-spacing: -0.02em;
}
.wordmark-copy b span {
  color: #10b981;
}
.wordmark-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font:
    12px ui-monospace,
    monospace;
}

.console-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 100px;
}
.workspace-bar {
  display: grid;
  grid-template-columns:
    minmax(240px, 1fr) minmax(160px, 220px) minmax(180px, 260px)
    auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 34px;
  padding: 18px;
  border: 1px solid #324356;
  border-radius: 16px;
  background:
    linear-gradient(120deg, rgba(56, 232, 213, 0.07), transparent 45%),
    var(--surface);
}
.workspace-copy strong,
.workspace-copy span {
  display: block;
}
.workspace-copy strong {
  font-size: 17px;
}
.workspace-copy span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}
.workspace-select {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.compact-panel {
  margin: -14px 0 28px;
}
.short-form {
  grid-template-columns: minmax(240px, 1fr) auto;
  max-width: 620px;
  margin: 0;
}
.tenant-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.tenant-form > button {
  align-self: end;
  min-height: 44px;
}
.role-badge {
  padding: 7px 10px;
  border: 1px solid var(--purple);
  border-radius: 999px;
  color: var(--purple);
  font-size: 10px;
}
.rule-summary {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(56, 232, 213, 0.24);
  border-radius: 12px;
  background: rgba(56, 232, 213, 0.045);
}
.rule-summary strong {
  color: var(--cyan);
  font-size: 13px;
}
.rule-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.hero-row,
.panel-heading,
.save-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.hero-row h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  letter-spacing: -0.055em;
}
.hero-row .muted {
  max-width: 680px;
}
.hero-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.table-button {
  border-radius: 11px;
  padding: 11px 16px;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}
.primary-button {
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #04110f;
  font-weight: 800;
  box-shadow: 0 10px 32px rgba(56, 232, 213, 0.12);
}
.secondary-button {
  border: 1px solid #4d6175;
  background: #182431;
  color: var(--text);
  font-weight: 700;
}
.ghost-button,
.table-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 42px 0 24px;
}
.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  padding: 20px;
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--accent);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent),
    var(--surface);
}
.status-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 13px;
  color: var(--accent);
  font:
    800 11px ui-monospace,
    monospace;
}
.status-card span,
.status-card strong {
  display: block;
}
.status-card span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}
.status-card strong {
  font-size: 16px;
}
.accent-cyan {
  --accent: var(--cyan);
}
.accent-lime {
  --accent: var(--lime);
}
.accent-purple {
  --accent: var(--purple);
}
.accent-amber {
  --accent: var(--amber);
}
.status-success {
  color: var(--lime);
}
.status-warning {
  color: var(--amber);
}
.status-error {
  color: var(--red);
}

.section-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 28px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(16, 21, 29, 0.78);
  overflow-x: auto;
}
.section-nav a {
  padding: 9px 14px;
  border-radius: 9px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}
.section-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.panel {
  margin-top: 20px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 40%),
    var(--surface);
  scroll-margin-top: 90px;
}
.panel-heading {
  margin-bottom: 26px;
}
.panel h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.switch-group {
  display: flex;
  gap: 18px;
}
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}
.switch-label > input {
  position: absolute;
  opacity: 0;
}
.switch-label > span {
  position: relative;
  width: 40px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #080b10;
  transition: 0.2s;
}
.switch-label > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #667384;
  transition: 0.2s;
}
.switch-label > input:checked + span {
  border-color: var(--cyan);
  background: rgba(56, 232, 213, 0.13);
}
.switch-label > input:checked + span::after {
  left: 21px;
  background: var(--cyan);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.span-2 {
  grid-column: span 2;
}
.field {
  display: grid;
  gap: 8px;
  color: #c6d0dc;
  font-size: 13px;
}
.field > span {
  font-weight: 700;
}
.field small {
  color: var(--muted);
  font-size: 11px;
}
.field small.secret-ready {
  color: var(--lime);
}
input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  padding: 10px 12px;
  background: #0b1017;
  color: var(--text);
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 232, 213, 0.09);
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
.compact-pair > span:last-child {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}
.mini-check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1017;
}
.mini-check input {
  width: auto;
  min-height: auto;
}
.callback-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px dashed #405164;
  border-radius: 12px;
  background: #0b1017;
}
.callback-box span {
  color: var(--muted);
  font-size: 12px;
}
.callback-box code {
  overflow: hidden;
  color: var(--cyan);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.callback-box button {
  border: 0;
  background: none;
  color: var(--text);
}
.panel-actions {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.panel-actions span {
  color: var(--muted);
  font-size: 12px;
}

.save-dock {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #3a4b5e;
  border-radius: 15px;
  background: rgba(14, 20, 28, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}
.save-dock strong,
.save-dock span {
  display: block;
}
.save-dock span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.global-message {
  position: fixed;
  z-index: 40;
  right: 22px;
  top: 82px;
  max-width: 420px;
  margin: 0;
  padding: 0;
  border-radius: 11px;
  background: #14202b;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.4);
}
.global-message:not(:empty) {
  padding: 13px 16px;
  border: 1px solid var(--cyan);
}
.global-message[data-type="error"] {
  border-color: var(--red);
}
.global-message[data-type="warning"] {
  border-color: var(--amber);
}

.inline-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 150px auto;
  gap: 10px;
  margin-bottom: 22px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}
th {
  color: var(--muted);
  font:
    700 10px ui-monospace,
    monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.audit-list {
  display: grid;
  gap: 2px;
}
.audit-list article {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) 1fr;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.audit-list strong,
.audit-list span {
  display: block;
}
.audit-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}
.audit-list code {
  align-self: center;
  overflow: hidden;
  color: #9fb0c2;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  width: min(1000px, 100%);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.42);
}
.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(38px, 7vw, 76px);
  background:
    radial-gradient(
      circle at 50% 20%,
      rgba(56, 232, 213, 0.22),
      transparent 36%
    ),
    linear-gradient(145deg, #0d1720, #080b10);
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.09;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
}
.login-brand > * {
  position: relative;
  z-index: 1;
}
.login-brand h1 {
  margin: 6px 0 22px;
  font-size: clamp(58px, 9vw, 96px);
  line-height: 0.84;
  letter-spacing: -0.08em;
}
.login-brand h1 span {
  color: var(--cyan);
}
.login-brand > p:not(.eyebrow) {
  max-width: 480px;
  color: var(--muted);
  line-height: 1.7;
}
.signal-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 28px;
  color: var(--muted);
  font:
    11px ui-monospace,
    monospace;
}
.signal-line i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 16px var(--lime);
}
.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  padding: clamp(34px, 6vw, 64px);
}
.login-card h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.04em;
}
.login-card form {
  display: grid;
  gap: 18px;
}
.login-card label,
.login-field {
  display: grid;
  gap: 8px;
  color: #c6d0dc;
  font-size: 13px;
}
.password-input {
  position: relative;
  display: block;
}
.password-input input {
  padding-right: 50px;
}
.password-visibility {
  position: absolute;
  top: 6px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.password-visibility svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.password-visibility:hover,
.password-visibility:focus-visible,
.password-visibility[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--cyan) 45%, transparent);
  background: rgba(56, 232, 213, 0.08);
  color: var(--cyan);
  outline: 0;
}
.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

@media (max-width: 860px) {
  .workspace-bar {
    grid-template-columns: 1fr 1fr;
  }
  .workspace-copy {
    grid-column: span 2;
  }
  .tenant-form {
    grid-template-columns: 1fr 1fr;
  }
  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-brand {
    min-height: 320px;
  }
  .inline-form {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .workspace-bar,
  .tenant-form,
  .short-form {
    grid-template-columns: 1fr;
  }
  .workspace-copy {
    grid-column: span 1;
  }
  .console-shell {
    width: min(100% - 22px, 1200px);
    padding-top: 34px;
  }
  .hero-row,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-actions,
  .switch-group {
    width: 100%;
    flex-wrap: wrap;
  }
  .status-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
  .status-card {
    min-height: 92px;
  }
  .callback-box {
    grid-template-columns: 1fr auto;
  }
  .callback-box span {
    grid-column: span 2;
  }
  .save-dock {
    bottom: 8px;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
  .audit-list article {
    grid-template-columns: 1fr;
  }
  .user-chip {
    display: none;
  }
  .login-body {
    padding: 10px;
  }
  .login-shell {
    border-radius: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
