:root {
  --panel: rgba(15, 23, 42, 0.78);
  --panel-2: rgba(30, 41, 59, 0.72);
  --border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 8px;
  --hero-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.88));
  --page-bg:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 24%),
    linear-gradient(180deg, #08101d 0%, #0b1220 42%, #111827 100%);
  --chip-bg: rgba(15, 23, 42, 0.72);
  --toggle-bg: rgba(15, 23, 42, 0.72);
  --input-bg: rgba(15, 23, 42, 0.6);
}
html.light-theme {
  --panel: rgba(255, 255, 255, 0.92);
  --panel-2: rgba(241, 245, 249, 0.96);
  --border: rgba(15, 23, 42, 0.10);
  --text: #0f172a;
  --muted: #475569;
  --accent: #0284c7;
  --accent-2: #16a34a;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.10);
  --hero-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.96));
  --page-bg:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.10), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, #edf4fb 45%, #e2e8f0 100%);
  --chip-bg: rgba(255, 255, 255, 0.9);
  --toggle-bg: rgba(255, 255, 255, 0.92);
  --input-bg: rgba(255, 255, 255, 0.9);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100%;
}
body { padding: 32px; }
.shell { max-width: 1280px; margin: 0 auto; }
.hero {
  position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 8px;
  background: var(--hero-bg); box-shadow: var(--shadow); padding: 42px; margin-bottom: 28px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.08), transparent 35%, rgba(34, 197, 94, 0.08));
  pointer-events: none;
}
.hero-top {
  position: relative; display: flex; justify-content: space-between; gap: 20px;
  align-items: flex-start; flex-wrap: wrap;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; font-size: 0.84rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 14px; font-weight: 700;
}
.dot {
  width: 10px; height: 10px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55);
}
h1 { margin: 0; font-size: clamp(2.3rem, 4vw, 4.1rem); line-height: 1.02; letter-spacing: -0.04em; max-width: 760px; }
h2 { margin: 0; }
.hero p { margin: 16px 0 0; max-width: 760px; color: var(--muted); font-size: 1.02rem; line-height: 1.65; }
.status-card {
  min-width: 260px; border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  border-radius: 8px; padding: 18px 18px 16px; backdrop-filter: blur(14px);
}
html.light-theme .status-card { background: rgba(255,255,255,0.72); }
.status-label { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.status-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 10px; }
.status-meta { color: var(--text); opacity: 0.9; font-size: 0.95rem; line-height: 1.5; }
.header-actions, .page-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.toolbar, .search-wrap { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.toolbar-chip, .secondary-button, .theme-toggle, .primary-button {
  border: 1px solid var(--border); background: var(--chip-bg); color: var(--text); padding: 12px 16px;
  border-radius: 8px; font-size: 0.92rem; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,0.18); text-decoration: none;
}
.primary-button {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(34, 197, 94, 0.20));
  border-color: rgba(56, 189, 248, 0.34);
  cursor: pointer;
}
.theme-toggle, .secondary-button, .primary-button, .icon-button { cursor: pointer; transition: transform 0.2s ease, border-color 0.2s ease; }
.theme-toggle:hover, .secondary-button:hover, .primary-button:hover, .icon-button:hover { transform: translateY(-2px); border-color: rgba(56, 189, 248, 0.34); }
.search-input {
  min-width: 280px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  padding: 12px 14px; border-radius: 8px; outline: none;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.tile, .panel-card, .loading-card, .error-card {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 22px;
}
.tile {
  min-height: 240px; display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease; text-decoration: none; color: inherit;
}
.tile-link { display: flex; flex: 1; flex-direction: column; justify-content: space-between; color: inherit; text-decoration: none; }
.tile::after {
  content: ""; position: absolute; inset: auto -20% -30% auto; width: 160px; height: 160px;
  border-radius: 8px; background: rgba(56, 189, 248, 0.10); pointer-events: none;
}
.tile:hover { transform: translateY(-6px); border-color: rgba(56, 189, 248, 0.34); box-shadow: 0 26px 60px rgba(0, 0, 0, 0.42); }
.tile-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.brand {
  display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(34, 197, 94, 0.14));
  border: 1px solid rgba(148, 163, 184, 0.16); color: var(--text); font-size: 1.1rem; font-weight: 800; letter-spacing: 0.05em;
}
.tag {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.24); padding: 8px 10px; border-radius: 8px; background: rgba(8, 145, 178, 0.12);
}
.tile h2 { margin: 18px 0 8px; font-size: 1.38rem; letter-spacing: -0.03em; }
.tile p, .loading-card, .error-card, .muted { color: var(--muted); line-height: 1.6; font-size: 0.97rem; margin: 0; }
.tile-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px;
}
.docs-count { color: var(--text); font-weight: 700; font-size: 0.92rem; opacity: 0.95; }
.open-link, .back-link, .doc-link { color: var(--accent); font-weight: 700; text-decoration: none; }
.back-link { display: inline-block; margin-bottom: 20px; }
.section-list { display: grid; gap: 16px; }
.doc-section { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: rgba(255,255,255,0.03); }
.doc-section summary {
  list-style: none; cursor: pointer; padding: 18px 20px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.doc-section summary::-webkit-details-marker { display: none; }
.doc-section summary span:last-child { color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.doc-list { display: grid; gap: 12px; padding: 0 18px 18px; }
.doc-item { border: 1px solid var(--border); border-radius: 8px; padding: 16px; background: rgba(255,255,255,0.03); }
.doc-item h3 { margin: 0; font-size: 1rem; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.meta-pill { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 0.8rem; color: var(--muted); }
.doc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.button-link, .danger-link {
  border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer;
}
.danger-link { color: #f87171; font-weight: 800; }
.admin-bar, .admin-tools, .admin-tile-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.admin-status { color: var(--muted); font-weight: 800; font-size: 0.9rem; }
.admin-tile-actions { position: relative; z-index: 1; margin-top: 16px; }
[hidden] { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(2, 6, 23, 0.70); backdrop-filter: blur(10px);
}
.modal-card {
  width: min(680px, 100%); max-height: min(86vh, 840px); overflow: auto;
  border: 1px solid var(--border); border-radius: 8px; background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow); padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.icon-button {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border); color: var(--text);
  background: var(--chip-bg); font-weight: 900;
}
.admin-form { display: grid; gap: 14px; }
.admin-form label { display: grid; gap: 8px; color: var(--muted); font-weight: 800; }
.admin-form input, .admin-form textarea {
  width: 100%; border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  padding: 12px 14px; border-radius: 8px; outline: none; font: inherit; font-weight: 500;
}
.admin-form textarea { resize: vertical; min-height: 88px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.form-error { margin: 0; color: #fecaca; font-weight: 800; }
.form-help, .info-body { margin: 0; color: var(--muted); line-height: 1.65; }
.hidden { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
@media (max-width: 700px) {
  body { padding: 18px; }
  .hero { padding: 26px; }
  .status-card, .theme-toggle { width: 100%; }
  .header-actions, .page-actions { align-items: stretch; }
  .admin-bar, .admin-tools { width: 100%; }
  .admin-bar > *, .admin-tools > * { flex: 1 1 100%; }
  .search-input { min-width: 100%; width: 100%; }
}
