:root {
  color-scheme: light;
  --bg: #eef2ff;
  --bg-alt: linear-gradient(135deg, #eef2ff 0%, #fef3c7 100%);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: rgba(148, 163, 184, 0.35);
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b91c1c;
  --success: #0f766e;
  --warning: #b45309;
  --shadow: 0 24px 64px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-alt);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.8rem 0.95rem;
  background: rgba(255, 255, 255, 0.92);
}

.page-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar h1,
.panel h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

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

.topbar-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.content-shell {
  display: grid;
  gap: 1.25rem;
}

.panel {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.highlight-panel {
  border-color: rgba(15, 118, 110, 0.35);
}

.auth-panel {
  width: min(520px, 100%);
  margin: 4rem auto 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stats-grid,
.two-column-grid {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.stat-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 2rem;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

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

.empty-cell {
  text-align: center;
  color: var(--muted);
}

.form-grid,
.filters-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-grid label,
.filters-grid label {
  display: grid;
  gap: 0.4rem;
}

.form-grid > button {
  width: auto;
  min-width: 10rem;
  justify-self: start;
  align-self: end;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.compact-form {
  flex-wrap: wrap;
}

.compact-form select {
  min-width: 9.5rem;
}

.compact-button {
  padding: 0.5rem 0.9rem;
  border-radius: 14px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.button-secondary {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
  border: 1px solid rgba(15, 118, 110, 0.18);
}

.button-secondary:hover {
  background: rgba(15, 118, 110, 0.18);
  color: var(--accent-strong);
}

.button-danger {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
  border: 1px solid rgba(185, 28, 28, 0.18);
}

.button-danger:hover {
  background: rgba(185, 28, 28, 0.16);
  color: #8f1414;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.flash-success {
  border-color: rgba(15, 118, 110, 0.35);
}

.flash-error {
  border-color: rgba(185, 28, 28, 0.25);
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-success {
  background: rgba(15, 118, 110, 0.14);
  color: var(--success);
}

.status-error {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.status-warning {
  background: rgba(180, 83, 9, 0.12);
  color: var(--warning);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

.secret-block {
  display: block;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 18px;
  background: #0f172a;
  color: #e5e7eb;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}

.definition-list {
  display: grid;
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}

.definition-list div {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.definition-list dt {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-weight: 600;
}

.definition-list dd {
  margin: 0;
}

.muted-copy {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 768px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 0.5rem;
  }

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

  .topbar-nav {
    width: 100%;
  }

  .form-grid > button {
    width: 100%;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
