/* ============================================================
   v6 · Modern admin shell (sidebar layout)
   Layered on top of the heritage tokens above.
   ============================================================ */

.admin-body {
  --ui-bg: #f4f6fb;
  --ui-surface: #ffffff;
  --ui-border: #e4e9f2;
  --ui-border-strong: #cfd7e6;
  --ui-text: #0d1b33;
  --ui-muted: #64748b;
  --ui-brand: #071a3d;
  --ui-brand-soft: #eef2f9;
  --ui-accent: #0f7b5f;
  --ui-radius: 14px;
  --ui-shadow: 0 1px 2px rgba(15, 27, 51, .04), 0 8px 24px -12px rgba(15, 27, 51, .12);
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.admin-body h1, .admin-body h2, .admin-body h3, .admin-body h4 {
  font-family: inherit;
  letter-spacing: -.015em;
  color: var(--ui-text);
}
.admin-body h1 { font-size: 1.55rem; font-weight: 650; }
.admin-body h2 { font-size: 1.02rem; font-weight: 650; }
.admin-body a { color: #14508f; }

/* ---------- shell ---------- */

.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: linear-gradient(180deg, #081e47 0%, #071731 100%);
  color: #c9d4e8;
  z-index: 40;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 14px;
  color: #fff;
  text-decoration: none;
}
.app-brand img { border-radius: 50%; background: #fff; padding: 2px; }
.app-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.app-brand strong { font-size: 1rem; font-weight: 700; letter-spacing: .02em; }
.app-brand small { color: #8fa2c4; font-size: .72rem; }

.app-nav { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }
.app-nav-label {
  margin: 18px 0 6px;
  padding: 0 12px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #7b8db0;
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #c3cfe4;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.app-nav a svg {
  width: 18px; height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .85;
}
.app-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-nav a.active { background: #fff; color: #071a3d; font-weight: 650; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, .5); }
.app-nav a.active svg { opacity: 1; }

.app-sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, .09);
  padding: 13px 16px 15px;
}
.app-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #e6edf9;
  color: #071a3d;
  font-weight: 700;
  font-size: .82rem;
  flex: 0 0 auto;
}
.app-avatar.sm { width: 26px; height: 26px; font-size: .72rem; }
.app-user-text { display: flex; flex-direction: column; min-width: 0; }
.app-user-text strong { color: #fff; font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-text small { color: #8fa2c4; font-size: .7rem; text-transform: capitalize; }
.app-sidebar-actions { display: flex; gap: 14px; margin-top: 10px; font-size: .76rem; }
.app-sidebar-actions a, .app-sidebar-actions .link-btn { color: #9fb0cd; text-decoration: none; }
.app-sidebar-actions a:hover, .app-sidebar-actions .link-btn:hover { color: #fff; text-decoration: underline; }

.app-main { display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 26px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ui-border);
}
.app-menu-btn {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  color: var(--ui-text);
}
.app-menu-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.app-crumbs { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ui-muted); }
.app-crumbs strong { color: var(--ui-text); font-weight: 600; }
.app-crumbs .sep { color: #c2cad8; }
.app-topbar-right { margin-left: auto; }
.app-chip-link { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--ui-border); border-radius: 999px; background: #fff; color: var(--ui-text); text-decoration: none; font-size: .8rem; font-weight: 600; }
.app-chip-link:hover { border-color: var(--ui-border-strong); }

.app-content { padding: 26px 26px 40px; min-width: 0; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 26px 22px; color: var(--ui-muted); font-size: .74rem; }

/* Page-level constraints inside the new shell */
.app-content .wrap { width: auto; max-width: none; margin: 0; padding: 0; }

/* ---------- page head ---------- */

.admin-page-head { align-items: flex-start; margin-bottom: 22px; }
.admin-page-head h1 { font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; }
.admin-page-head .hint { margin: 3px 0 0; }
.admin-page-head .eyebrow { margin: 0 0 4px; }
.admin-body .eyebrow {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6b7a92;
}

/* ---------- cards ---------- */

.admin-body .card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}
.admin-body .card.padded { padding: 22px; }
.admin-body .card.padded > h2 { margin-bottom: 14px; }
.admin-body .card-head { background: transparent; border-bottom: 1px solid var(--ui-border); }
.admin-body .empty-state {
  background: #fff;
  border: 1px dashed var(--ui-border-strong);
  border-radius: var(--ui-radius);
  color: var(--ui-muted);
}

/* ---------- metrics ---------- */

.metric-row { gap: 14px; margin-bottom: 20px; }
.admin-body .metric {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  padding: 18px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.admin-body .metric:hover { transform: translateY(-1px); border-color: var(--ui-border-strong); box-shadow: 0 10px 30px -14px rgba(15, 27, 51, .25); border-top-color: var(--ui-border); }
.admin-body .metric-n { font-family: inherit; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; color: var(--ui-text); }
.admin-body .metric-n small { font-weight: 500; }
.admin-body .metric-label { font-size: .8rem; color: var(--ui-muted); }

/* overview strip used on the dashboard */
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
@media (max-width: 1100px) { .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .overview-grid { grid-template-columns: 1fr; } }
.overview-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, transform .15s ease;
}
.overview-card:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -18px rgba(15, 27, 51, .35); }
.overview-card .ov-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.overview-card .ov-label { font-size: .78rem; color: var(--ui-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.overview-card .ov-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; color: var(--ui-text); }
.overview-card .ov-sub { font-size: .8rem; color: var(--ui-muted); }
.ov-icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--ui-brand-soft); color: #14416f; }
.ov-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ov-icon.ok { background: #e7f5ef; color: #0f7b5f; }
.ov-icon.warn { background: #fdf2e3; color: #9a6412; }
.ov-icon.danger { background: #fdeceb; color: #b3271b; }

/* ---------- quick actions ---------- */

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.quick-action {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: #fff;
  color: var(--ui-text);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 27, 51, .04);
}
.quick-action:hover { border-color: var(--ui-border-strong); background: #f8fafd; }
.quick-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #14508f; }

/* ---------- tables ---------- */

.admin-body .table-wrap { border: 1px solid var(--ui-border); border-radius: var(--ui-radius); background: #fff; box-shadow: var(--ui-shadow); overflow: auto; }
.admin-body .table-wrap.flat { border: 0; border-radius: 0; box-shadow: none; }
.admin-body .data-table { font-size: .86rem; }
.admin-body .data-table th {
  background: #f8fafd;
  color: #55637a;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ui-border);
  position: sticky;
  top: 0;
}
.admin-body .data-table td { border-bottom: 1px solid #eef1f7; padding: 12px 16px; }
.admin-body .data-table tr:hover td { background: #f8fafd; }

/* ---------- chips ---------- */

.admin-body .status-chip {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .01em;
  border: 1px solid transparent;
}
.admin-body .stat-chip {
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 27, 51, .04);
}

/* ---------- forms ---------- */

.admin-body .field label { font-size: .78rem; font-weight: 650; color: #46536a; text-transform: none; letter-spacing: 0; }
.admin-body input[type=text], .admin-body input[type=email], .admin-body input[type=password],
.admin-body input[type=number], .admin-body input[type=date], .admin-body input[type=tel],
.admin-body input[type=search], .admin-body input[type=file], .admin-body select, .admin-body textarea {
  border-radius: 10px;
  border: 1px solid var(--ui-border-strong);
  background: #fff;
  padding: 10px 12px;
  font-size: .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-body input:focus, .admin-body select:focus, .admin-body textarea:focus {
  outline: none;
  border-color: #2f6fb5;
  box-shadow: 0 0 0 3px rgba(47, 111, 181, .16);
}
.admin-body .btn {
  border-radius: 10px;
  font-weight: 650;
  letter-spacing: .01em;
  text-transform: none;
  font-size: .82rem;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.admin-body .btn-primary { background: #0b2f6b; border-color: #0b2f6b; box-shadow: 0 4px 12px -6px rgba(11, 47, 107, .8); }
.admin-body .btn-primary:hover { background: #0e3d8a; border-color: #0e3d8a; }
.admin-body .btn-secondary { background: #fff; border-color: var(--ui-border-strong); color: #22344f; }
.admin-body .btn-secondary:hover { border-color: #9fb0ca; background: #f8fafd; }
.admin-body .btn-small { padding: 7px 11px; font-size: .76rem; min-height: 32px; }

.admin-body .alert { border-radius: 12px; border: 1px solid var(--ui-border); border-left-width: 4px; box-shadow: none; }
.admin-body .alert-ok { background: #eef8f3; border-color: #cbe7da; border-left-color: var(--ui-accent); color: #114c3b; }
.admin-body .alert-error { background: #fdf1f0; border-color: #f3cdc9; border-left-color: #b3271b; color: #7a1f16; }

/* ---------- dashboard ---------- */

.admin-body .dash-grid { gap: 18px; }
@media (min-width: 980px) { .admin-body .dash-grid { grid-template-columns: 1.15fr .85fr; } }
.admin-body .card-title-row { align-items: center; margin-bottom: 14px; }
.admin-body .card-title-row h2 { font-size: 1rem; }
.admin-body .module-list a { padding: 13px 0; }
.admin-body .module-list strong { font-size: .92rem; font-weight: 650; }
.admin-body .module-list span { font-size: .8rem; }
.admin-body .simple-list li { border-top-color: #eef1f7; }

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px;
  margin-bottom: 20px;
  border-radius: var(--ui-radius);
  background:
    radial-gradient(1000px 220px at 100% 0%, rgba(78, 128, 200, .35), transparent 60%),
    linear-gradient(135deg, #071a3d 0%, #0d2f63 100%);
  color: #fff;
  box-shadow: 0 18px 40px -24px rgba(7, 26, 61, .8);
}
.dash-hero h1 { color: #fff; font-size: 1.5rem; margin: 0 0 4px; }
.dash-hero p { margin: 0; color: #b9c8e2; font-size: .9rem; }
.dash-hero .hero-meta { display: flex; gap: 22px; flex-wrap: wrap; }
.dash-hero .hero-meta div { display: flex; flex-direction: column; }
.dash-hero .hero-meta strong { font-size: 1.2rem; }
.dash-hero .hero-meta span { font-size: .74rem; color: #a9bad8; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- accounts ---------- */

.row-details { position: relative; }
.row-details > summary { cursor: pointer; list-style: none; display: inline-flex; }
.row-details > summary::-webkit-details-marker { display: none; }
.row-details[open] { z-index: 5; }
.row-details-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(15, 27, 51, .4);
}
.stack-col { display: flex; flex-direction: column; gap: 18px; }

/* ---------- admin login ---------- */

.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); min-height: 100vh; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 7vw, 96px); max-width: 560px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand strong { display: block; font-size: 1.1rem; letter-spacing: .02em; }
.login-brand span { font-size: .78rem; color: var(--ui-muted); }
.login-panel h1 { font-size: 1.7rem; margin-bottom: 4px; }
.login-form { margin-top: 18px; }
.login-form .btn { margin-top: 6px; }
.login-foot { margin-top: 22px; font-size: .84rem; color: var(--ui-muted); }
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 48px;
  background:
    radial-gradient(900px 320px at 20% 0%, rgba(78, 128, 200, .38), transparent 60%),
    linear-gradient(150deg, #071a3d 0%, #0d2f63 100%);
  color: #e7eefb;
}
.login-aside h2 { color: #fff; font-size: 1.7rem; line-height: 1.2; margin: 6px 0 18px; }
.login-aside .eyebrow { color: #9fb6da; }
.login-aside ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.login-aside li { position: relative; padding-left: 22px; color: #c3d2ea; font-size: .92rem; }
.login-aside li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #6fa8ff; }
.login-aside-foot { color: #8ea6c9; font-size: .76rem; }
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { max-width: none; padding: 32px 22px; }
  .login-aside { display: none; }
}

.role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 650; background: #eef2f9; color: #1c3f6e; border: 1px solid #dbe4f2; text-transform: capitalize; }
.role-badge.superadmin { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.role-badge.president { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.role-badge.treasurer { background: #e7f5ef; color: #0f6b51; border-color: #c8e8da; }
.role-badge.secretary { background: #e8effd; color: #1d4ed8; border-color: #cfdcfb; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 18px; align-items: start; }
@media (max-width: 980px) { .acc-grid { grid-template-columns: 1fr; } }
.acc-row { display: flex; align-items: center; gap: 12px; }
.acc-row .app-avatar { background: #eef2f9; color: #14416f; }
.acc-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .acc-form-grid { grid-template-columns: 1fr; } }
.pw-meter { height: 6px; border-radius: 999px; background: #eef1f7; overflow: hidden; margin-top: 6px; }
.pw-meter span { display: block; height: 100%; width: 0; background: #b3271b; transition: width .2s ease, background .2s ease; }

/* ---------- member portal topbar (modernised) ---------- */

.admin-body .admin-topbar { background: #fff; border-bottom: 1px solid var(--ui-border); box-shadow: none; }
.admin-topbar-inner { max-width: 1200px; margin-inline: auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.admin-brand { color: var(--ui-text); font-family: inherit; font-weight: 700; }
.admin-brand b { color: #14508f; }
.admin-nav { gap: 6px; }
.admin-nav a { color: #56657d; text-decoration: none; padding: 7px 11px; border-radius: 8px; font-weight: 550; }
.admin-nav a:hover { background: #f1f5fb; color: var(--ui-text); text-decoration: none; }
.admin-nav a.active { background: #eef2f9; color: #0b2f6b; }
.admin-session { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.admin-user { color: #56657d; font-size: .82rem; }

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 24px 0 48px -24px rgba(0, 0, 0, .5);
  }
  .app-shell.nav-open .app-sidebar { transform: translateX(0); }
  .app-shell.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 40, .4);
    backdrop-filter: blur(2px);
    z-index: 35;
  }
  .app-menu-btn { display: inline-flex; }
  .app-content { padding: 20px 18px 32px; }
  .app-topbar { padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar, .metric, .overview-card, .quick-action { transition: none; }
  .admin-body .metric:hover, .overview-card:hover { transform: none; }
}
