:root {
  color-scheme: dark;
  --bg: #0b0c10;
  --card: #111218;
  --border: #1f2231;
  --text: #e8ebf1;
  --accent: #47a6ff;
  --muted: #98a1b8;
  --danger: #ff6b6b;
  --success: #4adf86;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 28px;
  background: #090a0f;
  border-bottom: 1px solid var(--border);
  gap: 18px;
  flex-wrap: wrap;
}
.admin-header .brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-header .brand a {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.admin-header .brand .tagline {
  color: var(--muted);
  font-size: 0.85rem;
}
.admin-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-nav .nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  background: #161822;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}
.admin-nav .nav-link:hover {
  background: #1d2232;
  text-decoration: none;
}
.admin-nav .logout {
  background: rgba(255, 128, 128, 0.12);
  border: 1px solid rgba(255, 128, 128, 0.35);
  color: #ff9e9e;
}
.admin-nav .logout:hover {
  background: rgba(255, 128, 128, 0.2);
}
.admin-more {
  position: relative;
}
.admin-more summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  background: #161822;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.admin-more summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.admin-more summary::-webkit-details-marker {
  display: none;
}
.admin-more summary::after {
  content: 'v';
  font-size: 0.75rem;
  color: var(--muted);
}
.admin-more[open] summary {
  background: #1d2232;
}
.admin-more__links {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #0f111a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.admin-more__links a {
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
}
.admin-more__links a:hover {
  color: var(--accent);
}
.user-pill {
  background: #1a1d27;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}
@media (max-width: 720px) {
  .admin-header {
    padding: 18px;
  }
  .admin-nav {
    gap: 8px;
    justify-content: flex-start;
  }
  .admin-more__links {
    position: static;
    width: 100%;
    box-shadow: none;
  }
}
.admin-main {
  padding: 28px;
  max-width: 1100px;
  margin: 0 auto;
}
.admin-footer {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.card h2 {
  margin-top: 0;
}
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.table tr:hover {
  background: rgba(71, 166, 255, 0.08);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #001423;
  font-weight: 600;
  cursor: pointer;
}
.btn.secondary { background: #1d2232; color: var(--text); }
.btn.danger { background: var(--danger); color: #000; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
form .field {
  margin-bottom: 16px;
}
form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
form input[type="text"],
form input[type="password"],
form input[type="file"],
form select,
form textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f111a;
  color: var(--text);
  padding: 10px;
  font-size: 1rem;
}
form textarea {
  min-height: 280px;
  line-height: 1.5;
}
#structured-data-preview {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: #0b0f1a;
  color: #d6ddf5;
  white-space: pre;
}
.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.flash-success { background: rgba(74, 223, 134, 0.12); border-color: rgba(74, 223, 134, 0.3); }
.flash-error { background: rgba(255, 107, 107, 0.12); border-color: rgba(255, 107, 107, 0.3); }
.flash-info { background: rgba(71, 166, 255, 0.12); border-color: rgba(71, 166, 255, 0.3); }
.login-wrapper {
  max-width: 420px;
  margin: 80px auto;
}
.login-wrapper h1 {
  text-align: center;
}
.login-help {
  max-width: 720px;
  margin: 28px auto 0;
}
.login-help .grid.two {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.support-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: rgba(15, 17, 26, 0.65);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.support-form h3 {
  margin: 0;
  font-size: 1rem;
}
.support-form .field {
  margin-bottom: 0;
}
.support-form p.meta {
  margin: 0;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 24px;
}
.chart-panel {
  background: #0f111a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chart-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.chart-panel-header strong {
  font-size: 1rem;
}
.chart-canvas {
  position: relative;
  flex: 1;
  min-height: 220px;
}
.chart-canvas canvas {
  width: 100%;
  height: 100%;
}
.chart-subtitle {
  margin-top: 0;
  margin-bottom: 8px;
}
.chart-list {
  margin: 0;
  padding-left: 22px;
  list-style-position: outside;
}
.chart-list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.chart-list-row .meta {
  flex-shrink: 0;
}
.chart-stats {
  margin-top: 16px;
  align-items: flex-start;
}
.chart-stats .chart-list {
  padding-left: 22px;
}
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1a1d27;
  color: var(--muted);
  font-size: 0.8rem;
}
.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.session-timeout-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 17, 26, 0.75);
  backdrop-filter: blur(2px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.session-timeout-modal.is-visible {
  opacity: 1;
  visibility: visible;
}
.session-timeout-modal__dialog {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 12px;
  background: #0f111a;
  border: 1px solid #1f2231;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.session-timeout-modal__title {
  margin: 0 0 12px;
  font-size: 1.25rem;
}
.session-timeout-modal__body {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}
.session-timeout-modal__countdown {
  color: #4adf86;
  font-weight: 600;
}
.session-timeout-modal__actions {
  display: flex;
  justify-content: flex-end;
}
