﻿@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --bg: #f4f6fb;
  --bg-deep: #e7ecf6;
  --panel: #ffffff;
  --panel-alt: #f6f8fc;
  --panel-muted: #edf1f8;
  --text: #1a1f2b;
  --muted: #5a6474;
  --accent: #1f6feb;
  --accent-strong: #114db8;
  --success: #1a9c5b;
  --warn: #d97706;
  --danger: #e11d48;
  --border: #d9e0ec;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --topbar-height: 72px;
}

[data-theme="dark"] {
  --bg: #0f1420;
  --bg-deep: #0b111b;
  --panel: #171f2d;
  --panel-alt: #1e2838;
  --panel-muted: #182233;
  --text: #f2f5fb;
  --muted: #9aa7bd;
  --accent: #7aa6ff;
  --accent-strong: #4d7df5;
  --success: #3bd08d;
  --warn: #f59e0b;
  --danger: #fb7185;
  --border: #2b3648;
  --shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg) 0%, var(--bg-deep) 60%, var(--bg) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

[data-theme="dark"] body::before {
  opacity: 0.08;
}

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

code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
}

.dashboard-body {
  padding-bottom: 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.topnav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.topnav-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  background: transparent;
  transition: all 0.2s ease;
}

.topnav-link.is-active,
.topnav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel-alt);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.version-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--muted);
  align-items: flex-end;
}

.version-chip code {
  font-size: 0.9em;
}

.user-chip {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-name {
  font-weight: 600;
}

.user-meta {
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.subnav {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

#recovery-banner,
#emergency-banner {
  margin: 12px 24px 0;
}

.subnav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subnav-link {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.2s ease;
}

.subnav-link.is-active,
.subnav-link:hover {
  color: var(--text);
  background: var(--panel-alt);
  border-color: var(--border);
}

.subnav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tool-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tool-panel.is-active {
  display: flex;
  animation: panel-reveal 0.35s ease;
}

.tool-panel.is-loading {
  opacity: 0.85;
}

.tool-panel.is-active .card {
  animation: card-rise 0.4s ease both;
}

.tool-panel.is-active .card:nth-child(2) {
  animation-delay: 0.05s;
}

.tool-panel.is-active .card:nth-child(3) {
  animation-delay: 0.1s;
}

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

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tool-header h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.tool-header p {
  margin: 0;
}

.tool-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  align-items: flex-end;
}

.card-grid {
  display: grid;
  gap: 16px;
}

.card-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card-grid.three-col {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.metric-card h3 {
  margin-bottom: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 0;
}

.data-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.data-grid dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.data-grid dd {
  margin: 0;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.rank-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  display: grid;
  gap: 6px;
}

.rank-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.subheading {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.text-input,
.select-input,
.small-input,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.small-input {
  max-width: 140px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.range-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.severity-chips {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.chip.is-active {
  background: var(--panel);
  color: var(--text);
}

.inline-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 16px rgba(31, 111, 235, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-danger {
  background: var(--danger);
  box-shadow: 0 8px 16px rgba(225, 29, 72, 0.2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.badge-success {
  background: rgba(26, 156, 91, 0.15);
  color: var(--success);
  border-color: rgba(26, 156, 91, 0.3);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.3);
}

.badge-danger {
  background: rgba(225, 29, 72, 0.15);
  color: var(--danger);
  border-color: rgba(225, 29, 72, 0.3);
}

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

.status-line {
  font-weight: 600;
}

.status-line.status-ok {
  color: var(--success);
}

.status-line.status-warn {
  color: var(--warn);
}

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

.feedback-error {
  color: var(--danger);
}

.feedback-success {
  color: var(--success);
}

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

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: var(--panel-alt);
}

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

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.user-cell {
  display: flex;
  gap: 10px;
  align-items: center;
}

.user-title {
  font-weight: 600;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-alt);
  color: var(--muted);
  font-weight: 700;
}

.avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.selection-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--panel-alt);
  display: grid;
  gap: 6px;
}

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

.inset-card {
  background: var(--panel-muted);
  border: 1px solid var(--border);
  padding: 16px;
}

.selection-header strong {
  font-size: 0.95rem;
}

.result-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.result-item {
  width: 100%;
  text-align: left;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.result-item:hover,
.result-item:focus {
  background: var(--panel);
  border-color: rgba(148, 163, 184, 0.45);
  transform: translateY(-1px);
}

.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.health-summary {
  display: grid;
  gap: 16px;
}

.health-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.health-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.health-badge {
  font-size: 0.9rem;
  padding: 6px 14px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.health-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.problem-list {
  display: grid;
  gap: 12px;
}

.problem-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-alt);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.problem-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.problem-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.problem-title {
  font-weight: 600;
  font-size: 1rem;
}

.problem-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.problem-suggest {
  font-size: 0.9rem;
  color: var(--muted);
}

.flag-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

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

.segmented {
  display: inline-flex;
  gap: 4px;
  background: var(--panel-alt);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--border);
}

.segmented-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.segmented-btn.is-active {
  background: var(--panel);
  color: var(--text);
}

.logs-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0b1220;
  color: #e2e8f0;
  padding: 12px;
  max-height: 340px;
  overflow: auto;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
}

.alert-error {
  background: rgba(225, 29, 72, 0.08);
  color: var(--danger);
  border-color: rgba(225, 29, 72, 0.2);
}

.alert-warn {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
  border-color: rgba(217, 119, 6, 0.2);
}

.callout {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px dashed var(--border);
  color: var(--muted);
}

.access-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title h3 {
  margin: 0;
}

.effective-card {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

.effective-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.effective-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.effective-row .label {
  font-size: 0.85rem;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.toast-root {
  position: fixed;
  top: 92px;
  right: 24px;
  display: grid;
  gap: 10px;
  z-index: 100;
}

.toast {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  transition: all 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(26, 156, 91, 0.4);
}

.toast-error {
  border-color: rgba(225, 29, 72, 0.4);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  place-items: center;
  z-index: 120;
}

.modal.is-open {
  display: grid;
}

.modal[hidden] {
  display: none !important;
}

.modal-panel {
  background: var(--panel);
  padding: 24px;
  border-radius: var(--radius);
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.skeleton {
  position: relative;
  color: transparent;
  background: linear-gradient(90deg, var(--panel-alt), var(--panel), var(--panel-alt));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.hidden {
  display: none !important;
}

.home-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.home-wrap {
  max-width: 520px;
  width: 100%;
}

.home-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.home-actions {
  display: grid;
  gap: 10px;
}

.home-meta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.maintenance-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.15);
  color: var(--warn);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.capability-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.capability-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

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

  .topbar-actions {
    justify-content: space-between;
  }

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

  .range-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .range-controls {
    width: 100%;
    justify-content: space-between;
  }
}

.viewas-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewas-control span {
  font-size: 0.8rem;
  color: var(--muted);
}

#viewas-banner {
  margin: 12px 24px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--warn);
  font-weight: 600;
}

.viewas-active .topbar,
.viewas-active .subnav {
  box-shadow: inset 0 -2px 0 rgba(217, 119, 6, 0.35);
}

.viewas-active #viewas-banner {
  background: rgba(217, 119, 6, 0.12);
}

#viewas-exit {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.attendance-list {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.attendance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.attendance-item input {
  accent-color: var(--accent);
}

.feedback-block {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.embed-preview-body {
  margin-top: 12px;
}

.embed-preview {
  border-left: 4px solid #1f003d;
  background: var(--panel-alt);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.embed-preview-title {
  font-weight: 600;
  font-size: 1rem;
}

.embed-preview-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.embed-preview-name {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.embed-preview-value {
  font-size: 0.9rem;
  line-height: 1.4;
}

.embed-preview-footer {
  font-size: 0.75rem;
  color: var(--muted);
}
