* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #172036;
  --navy-2: #202b46;
  --gold: #b8944a;
  --gold-light: #d6b86f;
  --cream: #f8f3e8;
  --paper: #fffdf8;
  --text: #1d2433;
  --muted: #667085;
  --border: rgba(30, 40, 60, 0.16);
  --danger: #a33a3a;
  --ok: #2f7d52;
  --shadow: 0 16px 40px rgba(20, 26, 40, 0.12);
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f9f4ea 0%, #eef1f6 100%);
  color: var(--text);
  min-height: 100vh;
}

.admin-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-header.hidden,
.admin-footer.hidden {
  display: none;
}

.admin-header-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.admin-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.admin-brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.admin-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  max-width: 760px;
  margin-left: auto;
}

.admin-menu-group {
  position: relative;
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.admin-menu-button,
.admin-menu-link {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  padding: 9px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.admin-menu-button:hover,
.admin-menu-link:hover,
.admin-menu-link.active {
  background: rgba(184, 148, 74, 0.28);
  border-color: rgba(214, 184, 111, 0.95);
}

.admin-menu-button::after {
  content: " ▸";
  color: var(--gold-light);
}

/* Sub-items are intentionally always visible for direct access. */
.admin-submenu {
  display: flex !important;
  position: static !important;
  z-index: auto;
  min-width: 0;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(214, 184, 111, 0.38);
  border-radius: 14px;
  box-shadow: none;
  padding: 6px;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-submenu a {
  color: #fff7dc !important;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.20);
  text-decoration: none;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}

.admin-submenu a:hover,
.admin-submenu a.active {
  background: var(--gold-light) !important;
  border-color: #ffffff;
  color: var(--navy) !important;
}

@media (max-width: 860px) {
  .admin-header-inner {
    align-items: flex-start;
  }

  .admin-menu {
    max-width: none;
    margin-left: 0;
  }

  .admin-menu-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .admin-submenu {
    margin-left: 12px;
  }
}

.admin-app {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 22px 48px;
}

.admin-footer {
  max-width: 1220px;
  margin: 0 auto;
  padding: 18px 22px 36px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(460px, 100%);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-title {
  color: var(--navy);
  font-size: 1.7rem;
  margin-bottom: 8px;
}

.login-note {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

label {
  font-weight: 700;
  color: var(--navy);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  padding: 12px 13px;
  font-size: 1rem;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 148, 74, 0.16);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--navy);
  color: white;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: #253150;
}

.btn-gold {
  background: var(--gold);
  color: var(--navy);
}

.btn-light {
  background: #f1f4f8;
  color: var(--navy);
}

.message {
  padding: 12px 14px;
  border-radius: 12px;
  margin: 16px 0;
  border: 1px solid var(--border);
  background: #fff;
}

.message.error {
  color: var(--danger);
  background: #fff3f3;
  border-color: rgba(163, 58, 58, 0.25);
}

.message.ok {
  color: var(--ok);
  background: #f0fff6;
  border-color: rgba(47, 125, 82, 0.25);
}

.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-title h1 {
  color: var(--navy);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.page-title p {
  color: var(--muted);
  margin-top: 6px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 26px rgba(20, 26, 40, 0.08);
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.stat-card strong {
  display: block;
  color: var(--navy);
  font-size: 2rem;
  margin-top: 6px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  min-width: min(320px, 100%);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid rgba(30, 40, 60, 0.09);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f3ec;
  color: var(--navy);
  font-size: 0.83rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #fffaf0;
}

.small {
  color: var(--muted);
  font-size: 0.86rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #eef1f6;
  color: var(--navy);
}

.badge.ok {
  background: #e8f6ee;
  color: var(--ok);
}

.badge.no {
  background: #fff0e6;
  color: #9a5b00;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.summary-list {
  list-style: none;
  display: grid;
  gap: 9px;
}

.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 8px;
}

.loading-box {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 760px) {
  .admin-header-inner,
  .page-title,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-brand-title {
    font-size: 1rem;
  }

  .admin-menu {
    justify-content: flex-start;
  }

  
/* Keep dropdown reachable while moving the mouse from parent to submenu */
.admin-menu-group::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.admin-submenu {
    left: 0;
    right: auto;
  }

  .stats-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Event information block */
.event-info-card {
  margin-bottom: 1.25rem;
}

.event-info-card h2 {
  margin-bottom: 0.8rem;
}

.event-info-item + .event-info-item {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.event-info-item h3 {
  margin-bottom: 0.25rem;
}

.event-info-item p {
  margin: 0.35rem 0 0;
  line-height: 1.55;
}

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

/* ── Metrics page ─────────────────────────────────────────────────────────── */

.metrics-source-section {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 26px rgba(20, 26, 40, 0.08);
  padding: 22px 24px;
  margin-bottom: 22px;
}

.metrics-source-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}

.metrics-source-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

.metrics-source-header--azure { border-bottom-color: #0078d433; }
.metrics-source-header--azure h2 { color: #0078d4; }

.metrics-source-header--github { border-bottom-color: #1f6feb33; }
.metrics-source-header--github h2 { color: #1d4ed8; }

.metrics-source-header--cloudinary { border-bottom-color: #f5a62333; }
.metrics-source-header--cloudinary h2 { color: #92400e; }

.metrics-source-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.metrics-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  background: #f6f8fc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.metric-card strong {
  display: block;
  color: var(--navy);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.metric-card--supabase { border-left: 3px solid #3ecf8e; }
.metric-card--github   { border-left: 3px solid #1f6feb; }
.metric-card--cloudinary { border-left: 3px solid #f5a623; }

/* Progress bars */

.metrics-progress-wrap {
  display: grid;
  gap: 14px;
}

.metrics-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: var(--text);
}

.metrics-progress-label strong {
  font-size: 0.95rem;
  color: var(--navy);
}

.metrics-progress-track {
  height: 10px;
  background: #e8eaf0;
  border-radius: 999px;
  overflow: hidden;
}

.metrics-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.metrics-progress-fill--ok     { background: var(--ok); }
.metrics-progress-fill--warn   { background: #d97706; }
.metrics-progress-fill--danger { background: var(--danger); }

.metrics-progress-sub {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}

@media (max-width: 760px) {
  .metrics-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Thinktank pages ─────────────────────────────────────────────────────── */

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.neutral {
  background: #f1f5f9;
  color: #475569;
}

.post-body-cell {
  max-width: 280px;
  white-space: pre-line;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-green {
  background: #16a34a;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.btn-green:hover {
  background: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.btn-danger:hover {
  background: #b91c1c;
}

.link-gold {
  color: #b8943a;
  text-decoration: underline;
  font-weight: 600;
}

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


/* ── Collapsible comments cell ──────────────────────────────────────────── */

.comment-cell {
  display: block;
  max-width: 320px;
  min-width: 200px;
  word-break: break-word;
  white-space: pre-line;
  line-height: 1.5;
  font-size: 0.88rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: var(--gold, #b8943a);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
  vertical-align: baseline;
}

.btn-link:hover {
  color: var(--navy, #1a2540);
}
