/* AEA Databank — app theme on Bootstrap 5.3 */
:root {
  --aea-navy: #003c58;
  --aea-navy-deep: #002b40;
  --aea-gold: #dbb153;
  --bs-primary: #0b6a93;
  --bs-primary-rgb: 11, 106, 147;
  --bs-link-color: #0b6a93;
  --bs-link-hover-color: #08516f;
  --bs-body-font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-bg: #f4f6f8;
  --bs-border-radius: .6rem;
  --bs-border-radius-lg: .85rem;
  --sidebar-w: 248px;
}
[data-bs-theme="dark"] {
  --bs-body-bg: #0e151b;
  --bs-primary: #4cb3dc;
  --bs-primary-rgb: 76, 179, 220;
  --bs-link-color: #6cc4e8;
  --bs-link-hover-color: #9ad8f0;
}
.btn-primary { --bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: #08516f; --bs-btn-hover-border-color: #08516f; --bs-btn-active-bg: #08516f; --bs-btn-active-border-color: #08516f; --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #04202e; --bs-btn-hover-color: #04202e; --bs-btn-hover-bg: #7cc9e8; --bs-btn-hover-border-color: #7cc9e8; }
.skip-link { position: absolute; left: -999px; } .skip-link:focus { left: 1rem; top: 1rem; z-index: 2000; }

/* Shell */
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--aea-navy) 0%, var(--aea-navy-deep) 100%);
  color: #cfe1ea; display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .2s ease;
}
.app-sidebar .brand { padding: 1.1rem 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.app-sidebar .brand img { height: 34px; width: auto; max-width: 100%; }
.nav-group { padding: 1rem 1.25rem .35rem; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: #8fb2c3; font-weight: 600; }
.app-sidebar .nav-link {
  display: flex; align-items: center; gap: .7rem; color: #dbe9f0; padding: .5rem 1.25rem; margin: 1px .6rem;
  border-radius: .5rem; font-size: .92rem; border-left: 3px solid transparent;
}
.app-sidebar .nav-link i { font-size: 1.05rem; opacity: .9; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-sidebar .nav-link.active { background: rgba(219,177,83,.14); color: #fff; border-left-color: var(--aea-gold); }
.app-sidebar .nav-link.disabled { color: #7f9fb0; pointer-events: none; }
.app-sidebar .soon { margin-left: auto; font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; color: #8fb2c3; border: 1px solid rgba(255,255,255,.18); border-radius: 99px; padding: 0 .45rem; }
.app-sidebar .who { margin-top: auto; padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .7rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--aea-gold); color: var(--aea-navy-deep); font-weight: 700; font-size: .85rem; display: grid; place-items: center; flex: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 1020; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); padding: .7rem 1.5rem; display: flex; align-items: center; gap: 1rem; backdrop-filter: blur(6px); }
.topbar form.quick { flex: 1; max-width: 520px; }
.page { padding: 1.5rem; max-width: 1280px; margin: 0 auto; }
.page-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.page-sub { color: var(--bs-secondary-color); margin: .15rem 0 0; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .app-main { margin-left: 0; }
  .page { padding: 1rem; }
}

/* Cards, tiles */
.card { border-color: var(--bs-border-color); box-shadow: 0 1px 2px rgba(16,40,56,.04); }
.stat { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.1rem; color: inherit; text-decoration: none; height: 100%; }
.stat:hover { border-color: var(--bs-primary); }
.stat .ic { width: 42px; height: 42px; border-radius: .7rem; background: rgba(var(--bs-primary-rgb), .12); color: var(--bs-primary); display: grid; place-items: center; font-size: 1.2rem; flex: none; }
.stat .n { font-size: 1.55rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--bs-secondary-color); font-size: .82rem; }
.tile { display: block; padding: 1rem 1.1rem; color: inherit; text-decoration: none; height: 100%; }
a.tile:hover { border-color: var(--bs-primary); transform: translateY(-1px); }
.tile.is-soon { opacity: .62; }
.tile .ic { font-size: 1.25rem; color: var(--bs-primary); }
.section-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-secondary-color); font-weight: 600; margin: 1.75rem 0 .6rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-members th { font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--bs-secondary-color); font-weight: 600; white-space: nowrap; border-bottom-width: 1px; }
.table-members th a { color: inherit; text-decoration: none; }
.table-members th a:hover { color: var(--bs-primary); }
.table-members td { vertical-align: middle; }
.table-members tbody tr:hover { background: rgba(var(--bs-primary-rgb), .05); }
.badge-soft { font-weight: 600; font-size: .72rem; padding: .3em .6em; border-radius: 99px; }
.badge-soft.ok { background: rgba(25,135,84,.14); color: #146c43; }
.badge-soft.warn { background: rgba(255,193,7,.2); color: #8a6500; }
.badge-soft.bad { background: rgba(220,53,69,.14); color: #b02a37; }
.badge-soft.mute { background: rgba(108,117,125,.15); color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .badge-soft.ok { color: #6fd3a0; } [data-bs-theme="dark"] .badge-soft.warn { color: #f0cd6b; } [data-bs-theme="dark"] .badge-soft.bad { color: #f19ba3; }
.cert { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.dl dt { color: var(--bs-secondary-color); font-weight: 500; font-size: .8rem; }
.dl dd { margin-bottom: .75rem; }
.nav-tabs .nav-link { color: var(--bs-secondary-color); }
.nav-tabs .nav-link.active { color: var(--bs-body-color); font-weight: 600; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-hero { background: linear-gradient(160deg, var(--aea-navy) 0%, var(--aea-navy-deep) 100%); color: #e8f1f5; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px; border: 60px solid rgba(219,177,83,.12); }
.auth-hero img { height: 44px; width: auto !important; max-width: none; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
@media (max-width: 767.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }
@media print { .app-sidebar, .topbar, .no-print { display: none !important; } .app-main { margin: 0; } }
.table-members { min-width: 760px; } .badge-soft { white-space: nowrap; }

.pre-line{white-space:pre-line;min-width:9rem}

/* Charts */
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart-tip { position: absolute; z-index: 2000; pointer-events: none; background: #0e151b; color: #fff; font-size: .8rem; padding: .4rem .6rem; border-radius: .4rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 260px; transition: opacity .1s; }

/* Member area: PDF reader */
.reader { display: flex; flex-direction: column; align-items: center; gap: .75rem; background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .75rem; overflow-x: auto; }
.reader-page canvas { display: block; box-shadow: 0 1px 6px rgba(0,0,0,.25); background: #fff; max-width: none; }

/* ---- Content polish: section headings, resource cards, stat boxes, badge preview ---- */
.section-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; margin: 2rem 0 .25rem; display: flex; align-items: center; gap: .6rem; }
.section-title::before { content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--aea-gold); flex: none; }
.section-title:first-of-type { margin-top: 1.25rem; }
.section-lead { color: var(--bs-secondary-color); font-size: .9rem; margin: 0 0 1rem; max-width: 70ch; }
.card-eyebrow { font-size: .72rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); margin: 0 0 .85rem; }
.card { border-radius: .6rem; }
.card-lift { transition: box-shadow .15s, transform .15s, border-color .15s; }
a.card-lift:hover { box-shadow: 0 6px 16px rgba(16,40,56,.10); transform: translateY(-1px); border-color: var(--aea-gold); }

.res-card { display: flex; flex-direction: column; height: 100%; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem; overflow: hidden; box-shadow: 0 1px 2px rgba(16,40,56,.04); }
.res-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--bs-tertiary-bg); display: grid; place-items: center; border-bottom: 1px solid var(--bs-border-color); overflow: hidden; }
.res-thumb img { max-width: 86%; max-height: 86%; object-fit: contain; }
.res-thumb .ph { font-size: 2.2rem; color: var(--bs-secondary-color); opacity: .45; }
.res-thumb.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .6rem; place-items: stretch; }
.res-thumb.pair figure { margin: 0; display: grid; place-items: center; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .35rem; position: relative; min-height: 0; }
.res-thumb.pair figure img { max-width: 94%; max-height: 94%; }
.res-thumb.pair figcaption { position: absolute; left: .35rem; bottom: .2rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }
.res-body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.res-title { font-size: .98rem; font-weight: 650; margin: 0; }
.res-text { font-size: .85rem; color: var(--bs-secondary-color); margin: 0; }
.res-actions { margin-top: auto; padding-top: .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.res-unavail { font-size: .8rem; color: var(--bs-secondary-color); display: inline-flex; align-items: center; gap: .35rem; }
.res-meta { font-size: .72rem; color: var(--bs-secondary-color); }

.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .5rem 0 .75rem; }
.stat-box { background: var(--bs-tertiary-bg); border-radius: .5rem; padding: .55rem .7rem; }
.stat-box .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }
.stat-box .v { font-size: 1.1rem; font-weight: 650; line-height: 1.25; }
.stat-box .s { font-size: .75rem; color: var(--bs-secondary-color); }

.badge-preview { border: 1px solid var(--bs-border-color); border-radius: .6rem; overflow: hidden; background: var(--bs-body-bg); max-width: 340px; }
.badge-preview .bp-head { background: var(--aea-navy); color: #fff; padding: .7rem 1rem; display: flex; align-items: center; gap: .6rem; font-weight: 650; }
.badge-preview .bp-head i { color: var(--aea-gold); font-size: 1.3rem; }
.badge-preview .bp-body { padding: .8rem 1rem; font-size: .88rem; }
.badge-preview dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 600; margin-top: .45rem; }
.badge-preview dt:first-child { margin-top: 0; }
.badge-preview dd { margin: 0; font-weight: 550; }
.badge-preview .bp-note { padding: .55rem 1rem; font-size: .72rem; font-style: italic; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); border-top: 1px solid var(--bs-border-color); }
.code-box { position: relative; }
.code-box textarea { font-size: .75rem; padding-right: 3.2rem; }
.code-box .copy-btn { position: absolute; top: .35rem; right: .35rem; }

.photo-tile { position: relative; border-radius: .6rem; overflow: hidden; border: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); aspect-ratio: 1 / 1; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .dl { position: absolute; right: .4rem; bottom: .4rem; opacity: 0; transition: opacity .15s; }
.photo-tile:hover .dl, .photo-tile:focus-within .dl { opacity: 1; }
@media (hover: none) { .photo-tile .dl { opacity: 1; } }

.tile-link { display: block; height: 100%; text-decoration: none; color: inherit; padding: .85rem 1rem; }
.tile-link .t { font-weight: 650; display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
.tile-link .t i { color: var(--aea-navy); font-size: 1.05rem; }
[data-bs-theme="dark"] .tile-link .t i { color: var(--aea-gold); }
.tile-link .d { font-size: .8rem; color: var(--bs-secondary-color); margin-top: .2rem; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .88rem; margin: 0 0 1rem; }
.dl-grid dt { color: var(--bs-secondary-color); font-weight: 400; }
.dl-grid dd { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--bs-border-color); border-radius: .45rem; overflow: hidden; }
.seg > * { padding: .3rem .65rem; font-size: .8rem; text-decoration: none; border-right: 1px solid var(--bs-border-color); white-space: nowrap; }
.seg > *:last-child { border-right: 0; }
.seg a:hover { background: var(--bs-tertiary-bg); }
.seg .off { color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); }
.form-section { padding-bottom: .25rem; }
.form-section + .form-section { border-top: 1px solid var(--bs-border-color); margin-top: 1rem; padding-top: 1.1rem; }
.table-members th:first-child, .table-members td:first-child { padding-left: 1rem; }
.table-members th:last-child, .table-members td:last-child { padding-right: 1rem; }
.table-members thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 650; }
.code-box textarea { padding-right: 5.5rem; }
.res-thumb { aspect-ratio: 16 / 9; }
.res-thumb.pair { aspect-ratio: 16 / 10; }
