:root {
  --bg: #0b0f14;
  --panel: #11161d;
  --panel-2: #0f1722;
  --border: #1b2531;
  --ink: #e6eef8;
  --muted: #a6b0bf;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.16);
  --ok: #1e8f5a;
  --err: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top right, #17263c, #0b0f14 45%);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.card {
  width: min(760px, 100%);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.15rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.org-admin-card {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.org-admin-page {
  display: block;
  padding: 1rem;
}

.org-admin-shell {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.org-admin-nav {
  display: grid;
  gap: 0.45rem;
  position: sticky;
  top: 1rem;
}

.org-nav-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #0e141b;
}

.org-nav-btn.is-active {
  background: linear-gradient(180deg, #1950a8, #11356f);
  border-color: #1c4d92;
}

.org-admin-content {
  min-width: 0;
}

.admin-section {
  display: none;
}

.admin-section.is-active {
  display: grid;
  gap: 0.75rem;
}

.tts-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 58vh;
}

.tts-save-row {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}

.audit-layout {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.panel.audit-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}

.audit-table-wrap {
  max-height: 58vh;
  min-height: 0;
  overflow: auto;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem 0;
}

p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.row.spread {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 0.6rem;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  background: #0e141b;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

button,
.btn {
  border: 1px solid var(--border);
  background: #0f1722;
  color: var(--ink);
  padding: 0.52rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  border-color: #2d445a;
}

button:focus-visible,
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.24);
}

button.primary,
.btn.primary {
  background: linear-gradient(180deg, #1950a8, #11356f);
  border-color: #1c4d92;
}

button.warn,
.btn.warn {
  background: linear-gradient(180deg, #a06d18, #694610);
  border-color: #8d5d14;
}

button.ghost,
.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.status {
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #112033;
  color: #b6c5da;
}

.status.ok {
  border-color: var(--ok);
  background: #0f1f16;
}

.status.err {
  border-color: #733;
  background: #2a0c0c;
}

.auth-provider-grid,
#providerButtons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.auth-provider-btn {
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(18, 27, 39, 0.96), rgba(10, 16, 25, 0.98)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), transparent 55%);
  border-color: rgba(102, 135, 166, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 24px rgba(0, 0, 0, 0.18);
  text-align: left;
}

.auth-provider-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(132, 174, 215, 0.42);
}

.auth-provider-btn.is-primary {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 28px rgba(0, 0, 0, 0.26);
}

.auth-provider-btn[data-provider-accent="sunrise"] .auth-provider-icon {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #22140a;
}

.auth-provider-btn[data-provider-accent="forest"] .auth-provider-icon {
  background: linear-gradient(135deg, #34d399, #22c55e);
  color: #081b12;
}

.auth-provider-btn[data-provider-accent="graphite"] .auth-provider-icon {
  background: linear-gradient(135deg, #f8fafc, #94a3b8);
  color: #0f172a;
}

.auth-provider-btn[data-provider-accent="ocean"] .auth-provider-icon {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #eff6ff;
}

.auth-provider-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.auth-provider-copy {
  min-width: 0;
  display: grid;
  gap: 0.22rem;
}

.auth-provider-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.auth-provider-title {
  font-weight: 650;
  color: var(--ink);
}

.auth-provider-caption {
  font-size: 12.5px;
  color: #9eb0c5;
}

.auth-provider-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(77, 163, 255, 0.28);
  color: #c9e3ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

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

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

.audit-session-row.is-flagged td {
  background: rgba(255, 186, 44, 0.12);
}

.audit-session-row.is-selected td {
  background: rgba(77, 163, 255, 0.16);
}

.audit-feed-row.is-flagged td {
  background: rgba(255, 186, 44, 0.12);
}

.audit-feed-flag-meta {
  margin-top: 0.35rem;
  font-size: 12px;
  color: #f4cf77;
}

.audit-feed-suggestions-heading {
  margin-top: 0.55rem;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.audit-feed-suggestions-list {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.35rem;
}

.audit-feed-suggestion-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  background: #0b121b;
  display: grid;
  gap: 0.2rem;
}

.audit-feed-suggestion-meta {
  color: var(--muted);
  font-size: 12px;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

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

.table-wide th,
.table-wide td {
  white-space: nowrap;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  background: #0f1722;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.admin-tools-grid {
  align-items: start;
}

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

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

  .org-admin-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tts-panel {
    min-height: auto;
  }

  .audit-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-provider-grid,
  #providerButtons {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-provider-btn {
    min-height: 78px;
  }
}
