:root { --primary:#0A5C36; --secondary:#F7931E; --accent:#E63946; --text:#222; --line:#E6E8EC; --soft:#F6F8FA; }
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--soft); }
a { color: inherit; text-decoration: none; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-sidebar { background: #0A5C36; color: #fff; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.admin-sidebar a { padding: 10px 12px; border-radius: 8px; font-weight: 700; }
.admin-sidebar a:hover { background: rgba(255,255,255,.12); }
.admin-brand { font-size: 20px; margin-bottom: 18px; }
.admin-main { padding: 24px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.admin-topbar h1 { margin: 0; }
.admin-menu-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--primary); font-size: 24px; cursor: pointer; }
.admin-shell { transition: grid-template-columns 200ms ease; }
.admin-sidebar { transition: transform 200ms ease, opacity 160ms ease; }
.admin-sidebar-collapsed.admin-shell { grid-template-columns: 0 minmax(0, 1fr); }
.admin-sidebar-collapsed .admin-sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.admin-card, .stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 10px 28px rgba(0,0,0,.04); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat span { display: block; color: #667085; margin-bottom: 8px; }
.stat strong { font-size: 30px; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.admin-search { display: flex; gap: 10px; align-items: center; }
.resource-search { max-width: 560px; margin-bottom: 14px; }
.bulk-actions { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; gap: 8px; margin-bottom: 14px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0; }
.pagination span { color: #667085; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.actions { display: flex; align-items: center; gap: 10px; }
.actions button { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 0; }
.btn { display: inline-flex; border: 0; background: var(--secondary); color: #fff; border-radius: 8px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--line); }
.notice { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.notice.success { background: #E9F8EF; color: #0A5C36; }
.notice.error { background: #FDECEC; color: #A11220; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid label { display: grid; gap: 6px; font-weight: 700; }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #0A5C36, #06341F); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 8px; padding: 26px; }
.stack { display: grid; gap: 14px; }
.muted { color: #667085; font-size: 14px; }
.bars { height: 180px; display: flex; align-items: end; gap: 6px; border-bottom: 1px solid var(--line); padding-top: 14px; }
.bar { width: 14px; background: var(--primary); border-radius: 5px 5px 0 0; }
.admin-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--soft); }
.admin-author-preview { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; border: 3px solid #d1fae5; box-shadow: 0 8px 20px rgba(10,92,54,.12); }
.author-image-tools { display: grid; justify-items: start; gap: 8px; }
.field-label { font-weight: 700; }
.admin-author-avatar-picker { position: relative; width: 140px; height: 140px; border-radius: 50%; overflow: hidden; cursor: pointer; }
.admin-author-avatar-picker span { position: absolute; inset: auto 0 0; min-height: 44px; display: grid; place-items: center; background: rgba(17,24,39,.76); color: #fff; font-size: 13px; opacity: 0; transition: opacity 250ms ease; }
.admin-author-avatar-picker:hover span, .admin-author-avatar-picker:focus-within span { opacity: 1; }
.image-action-row { display: flex; gap: 10px; margin-top: 14px; }
.dashboard-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.dashboard-hero h2 { margin: 4px 0 8px; font-size: 30px; }
.eyebrow { color: var(--primary); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.newsroom-stats .stat { min-height: 112px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.dashboard-panel { min-width: 0; }
.wide-panel { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head a { color: var(--primary); font-weight: 800; }
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; background: #f3f4f6; color: #374151; font-size: 12px; font-weight: 900; }
.status-pill.ok { background: #dcfce7; color: #166534; }
.status-pill.bad { background: #fee2e2; color: #991b1b; }
.health-list { display: grid; gap: 10px; margin: 0; }
.health-list div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.health-list dt { color: #667085; font-weight: 700; }
.health-list dd { margin: 0; font-weight: 900; text-align: right; }
.notification-list, .rank-list, .timeline-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.notification-list li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fffaf4; }
.rank-list li { display: grid; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.rank-list span { font-weight: 900; }
.rank-list small, .timeline-list small { color: #667085; }
.timeline-list li { position: relative; display: grid; gap: 4px; padding: 0 0 12px 20px; border-left: 2px solid #d1fae5; }
.timeline-list li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline-list strong { color: var(--primary); }
.media-library-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.media-library-head h2 { margin: 4px 0 8px; font-size: 28px; }
.media-upload-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.media-upload-zone label { display: grid; gap: 8px; width: 100%; }
.media-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 18px; }
.media-library-item { display: grid; gap: 12px; padding: 12px; }
.media-preview-button { display: block; width: 100%; aspect-ratio: 16/11; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; cursor: pointer; }
.media-preview-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-library-meta { display: grid; gap: 4px; min-width: 0; }
.media-library-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-library-meta span, .media-library-meta small { color: #667085; }
.media-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.danger-text { color: var(--accent) !important; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 86vw); overflow-y: auto; transform: translateX(-100%); transition: transform 250ms ease; box-shadow: 14px 0 30px rgba(0,0,0,.2); }
  .admin-menu-open .admin-sidebar { transform: translateX(0); }
  .admin-menu-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(17,24,39,.45); }
  .admin-main { padding: 16px; }
  .admin-menu-toggle { display: inline-grid; place-items: center; flex: 0 0 44px; }
  .admin-sidebar-collapsed.admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar-collapsed .admin-sidebar { opacity: 1; }
  .admin-topbar { position: sticky; top: 0; z-index: 30; padding: 8px 0; background: var(--soft); }
  .admin-topbar h1 { min-width: 0; font-size: 22px; overflow-wrap: anywhere; }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-actions, .quick-actions .btn { width: 100%; }
  .media-library-head, .media-upload-zone { align-items: stretch; flex-direction: column; }
  .admin-search, .resource-search { width: 100%; }
  .actions { min-width: 120px; }
  .bulk-actions { display: flex; overflow-x: auto; padding-bottom: 6px; }
  .bulk-actions > * { min-width: 160px; }
}

/* Phase F: admin consistency, accessibility, responsive controls, and dark mode. */
:root {
  --surface: #fff;
  --surface-muted: #f6f8fa;
  --muted: #667085;
  --focus: #f7931e;
  --shadow: 0 10px 28px rgba(16, 24, 40, .07);
  color-scheme: light;
}
html { scroll-behavior: smooth; }
body { min-width: 320px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { letter-spacing: 0; }
:where(a, button, input, textarea, select, [role="button"]):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 100; padding: 10px 14px; border-radius: 6px; background: #111827; color: #fff; font-weight: 800; transform: translateY(-160%); transition: transform 180ms ease; }
.skip-link:focus { transform: translateY(0); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.admin-sidebar a { min-height: 42px; display: flex; align-items: center; transition: background 180ms ease, color 180ms ease; }
.admin-sidebar a.active { background: #fff; color: var(--primary); }
.admin-brand { position: sticky; top: -20px; z-index: 2; min-height: 64px !important; background: var(--primary); }
.admin-main { min-width: 0; }
.admin-topbar { min-height: 52px; }
.admin-topbar h1 { flex: 1; min-width: 0; line-height: 1.2; }
.admin-topbar form { margin: 0; }
.admin-theme-toggle { flex: 0 0 44px; width: 44px; height: 44px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--primary); font-size: 20px; cursor: pointer; }
.admin-card, .stat, .auth-card, .media-library-item { background: var(--surface); box-shadow: var(--shadow); }
.admin-card { overflow: hidden; }
.btn { min-height: 42px; align-items: center; justify-content: center; transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(16, 24, 40, .12); }
.btn:disabled, button:disabled { opacity: .58; cursor: not-allowed; transform: none; box-shadow: none; }
input, textarea, select { min-height: 44px; background: var(--surface); color: var(--text); transition: border-color 180ms ease, box-shadow 180ms ease; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 92, 54, .14); outline: 0; }
label { overflow-wrap: anywhere; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overscroll-behavior-inline: contain; }
.table-wrap table { min-width: 720px; }
thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-muted); color: #344054; font-size: 13px; text-transform: uppercase; }
tbody tr { transition: background 160ms ease; }
tbody tr:hover { background: var(--surface-muted); }
.actions a, .actions button { min-height: 36px; display: inline-flex; align-items: center; padding: 5px 7px; border-radius: 6px; }
.actions a:hover, .actions button:hover { background: var(--surface-muted); }
.pagination { flex-wrap: wrap; }
.pagination .btn { min-width: 44px; }
.notice { border: 1px solid transparent; font-weight: 700; }
.form-actions { flex-wrap: wrap; }
.form-actions .btn { min-width: 120px; }
.auth-page { background: #07502f; }
.auth-card h1 { margin-top: 0; }
.media-preview-button { background: var(--surface-muted); }
.team-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.team-form label { display: grid; gap: 7px; font-weight: 800; }
.team-current-photo, .team-member-cell, .team-profile-summary { display: flex; align-items: center; gap: 14px; }
.team-current-photo img, .team-member-cell img, .team-profile-summary img { border-radius: 50%; object-fit: cover; background: var(--surface-muted); border: 2px solid var(--line); }
.team-current-photo img { width: 86px; height: 86px; }
.team-member-cell img { width: 46px; height: 46px; flex: 0 0 46px; }
.team-profile-summary img { width: 132px; height: 132px; flex: 0 0 132px; }
.team-permission-panel { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.team-panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.team-panel-head h3 { margin: 0; }
.team-panel-head p { margin: 6px 0 0; }
.team-permission-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.permission-grid fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface); }
.permission-grid legend { padding: 0 6px; font-weight: 900; }
.check-row { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 9px !important; min-height: 34px; font-weight: 700 !important; }
.check-row input { min-height: auto; width: 18px; height: 18px; }
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-weight: 800; font-size: 13px; }
.status-pill.active { color: var(--primary); background: #e8f7ef; border-color: #bfe6ce; }
.status-pill.inactive { color: #667085; background: #f2f4f7; }
.status-pill.suspended { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.team-profile-summary { align-items: flex-start; margin: 18px 0 24px; }
.team-profile-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; margin: 0; }
.team-profile-summary dt { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; }
.team-profile-summary dd { margin: 4px 0 0; font-weight: 800; }
.team-link-list, .permission-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.team-link-list a, .permission-chip-list span { display: inline-flex; min-height: 34px; align-items: center; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); font-weight: 800; }
.access-denied-card { max-width: 720px; }

html[data-theme="dark"] {
  --text: #edf4ef;
  --line: #2b3b32;
  --soft: #121c16;
  --surface: #18231c;
  --surface-muted: #202e25;
  --muted: #a9b7af;
  --shadow: 0 12px 30px rgba(0, 0, 0, .28);
  color-scheme: dark;
}
html[data-theme="dark"] body { background: #101713; color: var(--text); }
html[data-theme="dark"] .admin-main, html[data-theme="dark"] .admin-topbar { background: #101713; }
html[data-theme="dark"] .admin-card, html[data-theme="dark"] .stat, html[data-theme="dark"] .auth-card, html[data-theme="dark"] .media-library-item, html[data-theme="dark"] .media-preview-button, html[data-theme="dark"] .btn.ghost { background: var(--surface); color: var(--text); }
html[data-theme="dark"] thead th { color: #dce8e0; }
html[data-theme="dark"] .muted, html[data-theme="dark"] .stat span, html[data-theme="dark"] .rank-list small, html[data-theme="dark"] .timeline-list small { color: var(--muted); }
html[data-theme="dark"] .notification-list li { background: #2b2418; }

@media (max-width: 860px) {
  .admin-theme-toggle { margin-left: auto; }
  .admin-topbar { gap: 10px; }
  .admin-topbar h1 { font-size: 22px; }
  .admin-topbar .btn { padding-inline: 12px; }
  .admin-sidebar { position: fixed; height: 100vh; }
  body.admin-menu-open .admin-sidebar { transform: translateX(0); }
}
@media (max-width: 620px) {
  .admin-main { padding: 12px; }
  .admin-topbar { flex-wrap: nowrap; }
  .admin-topbar h1 { order: initial; flex-basis: auto; }
  .admin-topbar form { order: initial; }
  .admin-theme-toggle { order: initial; margin-left: 0; }
  .table-head, .form-actions, .image-action-row { align-items: stretch; flex-direction: column; }
  .table-head .btn, .form-actions .btn, .image-action-row .btn { width: 100%; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat strong { font-size: 26px; }
  .admin-card { padding: 14px; }
  .media-library-grid { grid-template-columns: 1fr; }
  .team-form-grid, .permission-grid, .team-profile-summary dl { grid-template-columns: 1fr; }
  .team-panel-head, .team-profile-summary { flex-direction: column; }
  .team-permission-tools { width: 100%; }
  .team-permission-tools > * { flex: 1 1 140px; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .admin-topbar { gap: 6px; }
  .admin-topbar h1 { font-size: 19px; }
  .admin-topbar .btn { padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Team Portal: shared admin components with a distinct newsroom identity. */
.team-shell { --primary: #153d5c; --secondary: #d97706; }
.team-shell .admin-sidebar { background: linear-gradient(180deg, #102f47, #091f30); }
.team-shell .admin-brand { background: #102f47; letter-spacing: .02em; }
.team-auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; color: #eaf3f8; background: radial-gradient(circle at 15% 15%, #22577a 0, transparent 34%), linear-gradient(145deg, #071b2a, #123b56); }
.team-auth-card { width: min(500px, 100%); padding: clamp(24px, 5vw, 42px); border: 1px solid rgba(255,255,255,.15); border-radius: 18px; color: #182534; background: rgba(255,255,255,.97); box-shadow: 0 28px 70px rgba(0,0,0,.35); }
.team-auth-card h1 { margin: 4px 0 10px; font-size: clamp(30px, 7vw, 42px); color: #102f47; }
.team-auth-brand { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: #d97706; font-size: 22px; font-weight: 900; box-shadow: 0 10px 24px rgba(217,119,6,.3); }
.team-auth-eyebrow { margin: 22px 0 0; color: #496477; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.team-auth-intro { margin: 0 0 22px; color: #5d6d79; line-height: 1.65; }
.team-login-form label { display: grid; gap: 7px; color: #243746; font-weight: 800; }
.team-login-form input { border-color: #c6d3dc; }
.team-sign-in { width: 100%; background: #d97706; }
.team-forgot-link { justify-self: center; color: #153d5c; font-weight: 800; }
.team-dashboard-hero { margin-bottom: 20px; background: linear-gradient(135deg, #fff, #edf6fb); }
.team-dashboard-hero h2 { margin: 5px 0; font-size: clamp(26px, 4vw, 38px); color: #153d5c; }
.team-workspace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.team-workspace-card { display: grid; gap: 8px; min-height: 128px; align-content: center; border-top: 4px solid #d97706; transition: transform 180ms ease, box-shadow 180ms ease; }
.team-workspace-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(16,47,71,.14); }
.team-workspace-card span { color: #153d5c; font-size: 19px; font-weight: 900; }
.team-workspace-card small { color: #667085; }
