/* Scordle Admin — layered on top of Bootstrap 5.
   Light, clean, dashboard-style. Brand palette taken from the Scordle wheel. */

:root {
  --brand: #5566c4;          /* indigo — primary action colour */
  --brand-dark: #44539f;
  --sidebar-bg: #161d2e;     /* deep navy, matches the product site --panel family */
  --sidebar-text: #c7d0e2;
  --sidebar-muted: #7e89a3;
  --sidebar-active: #232c44;
  --content-bg: #f3f5f9;
  --wheel: conic-gradient(from -90deg,
      #16a99a 0 12.5%, #e35d52 0 25%, #2f9bd4 0 37.5%, #5566c4 0 50%,
      #9d7fe0 0 62.5%, #f0922f 0 75%, #f4ba3f 0 87.5%, #7cc35a 0 100%);
}

/* Bootstrap primary override → brand indigo */
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
a { color: var(--brand); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(85, 102, 196, .2);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

body { background: var(--content-bg); }

/* The colourful wheel mark, rendered purely in CSS as a ring. */
.brand-mark {
  display: inline-block; width: 30px; height: 30px; border-radius: 50%;
  background: var(--wheel);
  -webkit-mask: radial-gradient(circle, transparent 9px, #000 10px);
          mask: radial-gradient(circle, transparent 9px, #000 10px);
  flex: 0 0 auto;
}

/* ============================== Login overlay ============================== */
.login-overlay {
  position: fixed; inset: 0; z-index: 1080;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #243154, #0f1420);
}
.login-card { width: 100%; max-width: 420px; border: none; border-radius: 16px; }

/* ================================= Shell ================================== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px; font-weight: 700; font-size: 1.1rem; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .nav { padding: 12px 10px; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar .nav-link {
  color: var(--sidebar-text); border-radius: 9px; padding: 9px 12px;
  display: flex; align-items: center; gap: 11px; font-size: .94rem;
}
.sidebar .nav-link .bi { font-size: 1.05rem; width: 1.1em; text-align: center; color: var(--sidebar-muted); }
.sidebar .nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-link.active .bi { color: #fff; }
.sidebar-foot { padding: 12px 14px 18px; border-top: 1px solid rgba(255,255,255,.07); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid #e4e8f0; padding: 12px 22px;
}
.page-title { letter-spacing: -.01em; }
.content { padding: 22px; max-width: 1180px; width: 100%; }

/* ============================== Page helpers ============================== */
.page-head { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.page-head .lead-text { color: #5a657c; font-size: .92rem; margin: 4px 0 0; max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card { border-color: #e4e8f0; border-radius: 13px; }
.card-header { background: #fff; border-bottom-color: #eef1f6; font-weight: 600; }

.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: #6b7588; font-weight: 600; border-bottom-width: 1px; white-space: nowrap;
}
.table td { vertical-align: middle; }
.cell-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem; color: #334; max-width: 360px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.text-dim { color: #8a93a6; }
.muted-id { color: #97a0b2; font-variant-numeric: tabular-nums; }

/* Stat cards (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border: 1px solid #e4e8f0; border-radius: 13px; padding: 16px 18px; }
.stat-card .stat-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  font-size: 1.15rem; color: #fff; margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-card .stat-label { color: #6b7588; font-size: .88rem; margin-top: 4px; }

/* Misc */
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
.empty-state { text-align: center; color: #8a93a6; padding: 52px 20px; }
.empty-state .bi { font-size: 2.4rem; opacity: .55; }
.badge-soft { background: #eef1f6; color: #4a5468; font-weight: 600; }
.tally-bar { height: 8px; border-radius: 6px; background: var(--brand); }
.tally-track { height: 8px; border-radius: 6px; background: #e8ebf2; overflow: hidden; }

.sidebar-backdrop { display: none; }

/* Bootstrap 5.3 ships no min-width utility; needed so flex children truncate. */
.min-w-0 { min-width: 0; }

/* ============================== Responsive =============================== */
@media (max-width: 991.98px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 248px; z-index: 1060;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1055;
  }
}
