* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 14% 0%, rgba(249, 105, 21, 0.12), transparent 25rem),
    linear-gradient(180deg, var(--surface) 0%, var(--canvas) 28rem);
  color: var(--ink);
  font-family:
    "Manrope", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

a {
  color: inherit;
}

code,
.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 40;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--canvas);
}

.page {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-500);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.kicker {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 0;
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.05;
  font-weight: 800;
}

.lede {
  margin-top: 16px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.5;
}

.legal-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
}

.textarea-legal {
  min-height: 280px;
}

.panel {
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-500);
  color: #fff;
  box-shadow: 0 10px 24px rgba(249, 105, 21, 0.24);
}

.btn-outline {
  border-color: var(--rule);
  background: var(--surface);
  color: var(--ink-2);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.btn-dark {
  background: var(--ink);
  color: var(--canvas);
}

button.btn {
  cursor: pointer;
}

.btn:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-500) 55%, var(--rule));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-500) 18%, transparent);
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field,
fieldset.panel {
  display: grid;
  gap: 6px;
}

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

.field label,
legend {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.textarea {
  min-height: 86px;
  padding-top: 10px;
  resize: vertical;
}

.choice {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  font-size: 14px;
}

.button-row,
.toolbar,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.filters .input,
.filters .select {
  min-width: 160px;
  width: auto;
}

.fineprint {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.alert.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.alert.warning {
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.secret {
  font-size: clamp(15px, 4.2vw, 18px);
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.credential .kicker {
  margin-top: 16px;
}

.tenant-logo,
.side-logo-img {
  width: auto;
  max-width: 100%;
  height: 48px;
  object-fit: contain;
}

.side-logo-img {
  height: 36px;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
}

.identified-fields[hidden] {
  display: none;
}

.btn-block {
  width: 100%;
}

.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

html[data-theme="light"] .theme-toggle .icon-moon,
html[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

.sidebar .theme-toggle {
  width: 100%;
  background: var(--side-surface);
  color: var(--side-text-2);
  border-color: var(--side-border);
  box-shadow: none;
}

.sidebar .theme-toggle:hover {
  color: var(--side-text);
}

.sidebar .btn-ghost {
  width: 100%;
  color: var(--side-text-2);
}

.sidebar .btn-ghost:hover {
  color: var(--side-text);
  background: var(--side-surface);
}

.side-actions {
  display: grid;
  gap: 8px;
  padding: 8px 8px 16px;
}

.side-logout {
  padding: 0;
}

.mobile-bar {
  display: none;
  width: 100%;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.nav-scrim {
  display: none;
}

.app-body {
  background: var(--canvas);
}

.app-shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: var(--side-text);
}

.side-head {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--side-border);
}

.side-logo {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  color: var(--accent-500);
  font-weight: 900;
}

.side-title {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 800;
}

.side-subtitle,
.side-user span {
  color: var(--side-text-3);
  font-size: 11px;
}

.nav-group {
  flex: 1;
  padding: 12px 8px;
}

.nav-label {
  margin: 11px 8px 7px;
  color: var(--side-text-3);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 33px;
  margin-bottom: 3px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--side-text-2);
  font-size: 12px;
  text-decoration: none;
}

.nav-item.active {
  background: var(--side-surface);
  box-shadow: inset 2px 0 0 var(--accent-500);
  color: var(--side-text);
}

.side-user {
  display: flex;
  gap: 9px;
  margin: 8px;
  padding: 9px;
  border-top: 1px solid var(--side-border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background: var(--side-surface);
  font-size: 10px;
  font-weight: 900;
}

.content {
  padding: 24px;
}

.content-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.content-title {
  margin-top: 5px;
  font-size: 26px;
  font-weight: 780;
}

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

.stat,
.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  min-height: 100px;
}

.stat-value {
  margin-top: 10px;
  font-size: 31px;
  font-weight: 780;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--rule);
}

.panel-title {
  font-size: 13px;
  font-weight: 820;
}

.panel-body {
  padding: 16px;
}

.rows,
.message {
  display: grid;
  gap: 8px;
}

.row,
.mobile-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 780;
}

.badge.success {
  background: var(--success-bg);
  color: var(--success-fg);
}
.badge.warning {
  background: var(--warning-bg);
  color: var(--warning-fg);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}
.badge.info {
  background: var(--info-bg);
  color: var(--info-fg);
}
.badge.neutral {
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge.accent {
  background: var(--accent-500);
  color: #fff;
}

.table {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.8fr 0.8fr;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.table-head {
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
}

.message {
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.message.internal {
  background: var(--surface-2);
}

.row-line {
  font-size: 13px;
  color: var(--ink-2);
}

.mobile-only {
  display: none;
}

@media (max-width: 820px) {
  .page {
    width: min(720px, calc(100% - 24px));
    padding: 24px 0 48px;
  }

  .field-grid,
  .stats-grid,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(280px, 86vw);
  }

  body.menu-open .sidebar {
    display: flex;
  }

  body.menu-open .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    border: 0;
    background: rgba(8, 9, 10, 0.45);
  }

  .desktop-only {
    display: none;
  }

  .mobile-only,
  .mobile-bar {
    display: grid;
    gap: 8px;
  }

  .table-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .btn-primary,
  .btn-outline {
    min-height: 44px;
  }
}

