/* ── Admin area ───────────────────────────────────────────── */
:root {
  --admin-indigo: #4F46E5;
  --admin-indigo-dark: var(--indigo);
  --admin-sidebar-bg: #0F4C4C;
  --admin-sidebar-fg: #E2F2F2;
  --admin-sidebar-muted: #8FB8B8;
  --admin-sidebar-active: #1A6868;
  --admin-border: var(--border);
}

.admin-body {
  background: var(--white);
  color: var(--gray-dark);
}

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

/* Sidebar */
.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-fg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-sidebar-top,
.admin-sidebar-bottom {
  display: flex;
  flex-direction: column;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--admin-sidebar-fg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 1rem;
}

.admin-brand img {
  height: 32px;
  width: 32px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.admin-brand-text {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  line-height: 1;
}

.admin-brand-pill {
  background: var(--admin-indigo);
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.1em;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  color: var(--admin-sidebar-muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.admin-nav-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.04);
}

.admin-nav-link.is-active {
  background: var(--admin-sidebar-active);
  color: var(--white);
}

.admin-nav-link.is-active .admin-nav-dot {
  background: var(--admin-indigo);
}

.admin-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.admin-nav-link--muted {
  font-size: 0.85rem;
  margin: 0 0.75rem 0.5rem;
}

.admin-sidebar-bottom {
  padding: 0 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 1rem;
  gap: 0.5rem;
}

.admin-user {
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0.25rem 0;
}

.admin-user-email {
  color: var(--white);
  font-weight: 500;
  word-break: break-all;
}

.admin-user-role {
  color: var(--admin-sidebar-muted);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.admin-signout {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--admin-sidebar-muted);
  text-decoration: none;
  padding: 0.4rem 0;
}

.admin-signout:hover {
  color: var(--white);
}

/* Main content */
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 2.75rem;
}

.admin-page {
  max-width: 1100px;
  margin: 0 auto;
}

.admin-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--admin-indigo);
  margin-bottom: 0.35rem;
}

.admin-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-strong);
}

.admin-page-meta {
  font-size: 0.85rem;
  color: var(--gray-mid);
}

.admin-page-meta strong {
  color: var(--gray-dark);
  font-weight: 600;
}

/* Stats */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat {
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-top: 3px solid var(--admin-indigo);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

a.admin-stat:hover {
  border-color: var(--admin-indigo);
  box-shadow: 0 4px 12px -6px rgba(79,70,229,0.25);
  transform: translateY(-1px);
}

.admin-stat--static {
  border-top-color: var(--teal);
}

.admin-stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  margin-bottom: 0.5rem;
}

.admin-stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
}

/* Cards */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  background: var(--white);
  border: 1px solid var(--admin-border);
  border-top: 3px solid var(--admin-indigo);
  border-radius: 8px;
  padding: 1.5rem;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.admin-card-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-strong);
}

.admin-card-link {
  font-size: 0.85rem;
  color: var(--admin-indigo);
  text-decoration: none;
  font-weight: 500;
}

.admin-card-link:hover {
  color: var(--admin-indigo-dark);
  text-decoration: underline;
}

.admin-card-desc {
  font-size: 0.88rem;
  color: var(--gray-mid);
  margin-bottom: 1rem;
}

.admin-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--admin-border);
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-light);
  font-size: 0.9rem;
}

.admin-list-item:last-child {
  border-bottom: none;
}

.admin-list-primary {
  color: var(--gray-dark);
  font-weight: 500;
  word-break: break-all;
}

.admin-list-secondary {
  color: var(--gray-mid);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-list-empty {
  padding: 0.65rem 0;
  color: var(--gray-mid);
  font-size: 0.88rem;
  font-style: italic;
}

/* Re-skin existing components inside the admin area */
.admin-body .project-show,
.admin-body .project-show--wide {
  max-width: 1100px;
  padding: 0;
  margin: 0 auto;
}

.admin-body .project-show--wide {
  max-width: 1300px;
}

.admin-body .project-show .required-legend {
  margin: 0.6rem 0 1.5rem;
}

/* Line break inside a flex-wrapped details strip; the cell closing the row
   drops its right border like a genuine last cell. */
.admin-body .detail-row-break { flex-basis: 100%; height: 0; }
.admin-body .detail-cell--row-end { border-right: none; }

/* The admin shell has a sidebar instead of the app's top nav, so the shared
   sticky header's `top: var(--nav-height)` (tables.css) has nothing to clear —
   it leaves the header floating a nav-height below the viewport top while the
   page scrolls. Pin it to the top of the viewport here. */
.admin-body .data-table thead th {
  top: 0;
}

/* Admin form sections: an intro hint keeps the heading's gap to the fields,
   and stacked grids (the approval steps, then the signatories) read as
   separate groups. */
.admin-body .form-section h3 + .form-hint { margin: -0.5rem 0 1.25rem; }
.admin-body .form-section .form-grid + .form-grid { margin-top: 1.25rem; }

/* Approval type → form-field checklist. */
.approval-field-table .approval-field-check { width: 7rem; text-align: center; }
.approval-field-table .approval-field-check input[type="checkbox"] { accent-color: var(--teal); }
.approval-field-table .approval-field-group td {
  background: var(--surface-muted);
  color: var(--gray-mid);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.approval-field-table .approval-field-na { color: var(--text-faint); }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .admin-sidebar-top,
  .admin-sidebar-bottom {
    flex-direction: row;
    align-items: center;
    border: none;
    padding: 0;
    margin: 0;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  .admin-brand { border: none; padding: 0; margin: 0; }
  .admin-nav { flex-direction: row; padding: 0; }
  .admin-main { padding: 1.5rem; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
}


