/* Africa Digital Curriculum — admin (light default, dark optional) */
:root,
[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-input: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #5b4dff;
  --accent2: #2563eb;
  --kids: #d97706;
  --danger: #dc2626;
  --ok: #059669;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 268px;
  --header-h: 64px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121a2b;
  --surface-elevated: #161f33;
  --surface-input: #0e1628;
  --border: #223255;
  --text: #e7eefc;
  --muted: #9db0d3;
  --accent: #6d5efc;
  --accent2: #3aa0ff;
  --kids: #ffb703;
  --danger: #ff6b6b;
  --ok: #7df2a6;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body.adcp-admin {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent2);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.adcp-ico {
  flex-shrink: 0;
  opacity: 0.92;
}
.adcp-ico-lg {
  width: 22px;
  height: 22px;
}

.adcp-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.adcp-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  box-shadow: var(--shadow);
}

.adcp-sidebar-inner {
  flex: 1;
  padding: 22px 14px 16px;
  overflow-y: auto;
}

.adcp-brand {
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.25;
}

.adcp-brand--logo img {
  max-height: 40px;
  max-width: 100%;
  object-fit: contain;
}

.adcp-brand-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.35;
}

.adcp-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.adcp-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid transparent;
  text-decoration: none;
}
.adcp-nav a:hover {
  background: var(--surface-input);
  color: var(--text);
  text-decoration: none;
}
.adcp-nav a.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--text);
}

[data-theme="dark"] .adcp-nav a.active {
  background: rgba(109, 94, 252, 0.15);
  border-color: rgba(109, 94, 252, 0.35);
}

.adcp-nav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.adcp-sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-elevated);
}

.adcp-sidebar-user {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
  word-break: break-all;
}
.adcp-sidebar-role {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
  color: var(--accent2);
}

.adcp-sidebar-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  text-decoration: none;
}
.adcp-sidebar-signout:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  text-decoration: none;
}

/* Workspace + header */
.adcp-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.adcp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.adcp-header-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.adcp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adcp-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.adcp-icon-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-input));
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border));
}

.adcp-notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
}

.adcp-notif-wrap {
  position: relative;
}

.adcp-notif-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 92vw);
  max-height: 420px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.adcp-notif-panel.is-open {
  display: block;
}

.adcp-notif-head {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.adcp-notif-empty {
  padding: 24px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.adcp-notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.adcp-notif-list li {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adcp-notif-list li:last-child {
  border-bottom: none;
}
.adcp-notif-ev {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent2);
  font-weight: 700;
}
.adcp-notif-t {
  font-size: 0.88rem;
  color: var(--text);
}
.adcp-notif-d {
  font-size: 0.72rem;
  color: var(--muted);
}

[data-theme="dark"] .adcp-theme-light {
  display: none;
}
[data-theme="light"] .adcp-theme-dark {
  display: none;
}

.adcp-main {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

.adcp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.adcp-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.adcp-stat .k {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.adcp-stat .v {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

.adcp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.adcp-card h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.adcp-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 16px;
  font-weight: 700;
}

.adcp-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table.adcp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.adcp-table th,
.adcp-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.adcp-table th {
  background: var(--surface-input);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.adcp-table tr:last-child td {
  border-bottom: none;
}
.adcp-table tr:hover td {
  background: color-mix(in srgb, var(--accent2) 4%, transparent);
}

.adcp-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.adcp-badge-student {
  background: color-mix(in srgb, var(--accent2) 15%, transparent);
  color: var(--accent2);
}
.adcp-badge-teacher {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.adcp-badge-admin {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}

.adcp-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: end;
}

.adcp-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.adcp-field input,
.adcp-field select,
.adcp-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-input);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.adcp-field textarea {
  min-height: 100px;
  resize: vertical;
}
.adcp-field small {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.adcp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.adcp-btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  color: #fff;
}
.adcp-btn-primary:hover {
  filter: brightness(1.05);
}
.adcp-btn-ghost {
  background: var(--surface-input);
  color: var(--text);
  border: 1px solid var(--border);
}
.adcp-btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.adcp-flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.adcp-flash-ok {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  color: var(--ok);
}
.adcp-flash-err {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.adcp-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent),
    var(--bg);
}
.adcp-login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.adcp-login-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.adcp-login-card p.sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.adcp-content-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.adcp-tile-ico {
  display: flex;
  margin-bottom: 12px;
  color: var(--accent);
  opacity: 0.95;
}
.adcp-tile-ico .adcp-ico {
  width: 26px;
  height: 26px;
}

.adcp-tile {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
  box-shadow: var(--shadow);
}
.adcp-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-2px);
  text-decoration: none;
}
.adcp-tile h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.adcp-tile p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.adcp-settings-grid {
  display: grid;
  gap: 24px;
}

@media (max-width: 900px) {
  .adcp-shell {
    flex-direction: column;
  }
  .adcp-sidebar {
    width: 100%;
    min-height: 0;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .adcp-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .adcp-header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
}
