/* BAPC Affiliate Engine: charcoal, turquoise glass, orange neon edges, red accents. WCAG 2.2 AA contrast throughout;
   solid fallbacks for reduced transparency, no motion for reduced motion, stronger edges for more contrast. */
:root {
  --bg: #0b0d10; --bg2: #11151a; --panel: rgba(18, 38, 44, .62); --panel-solid: #12262c; --edge: #ff8a1f; --edge2: #2ee6e0;
  --red: #ff4d4d; --text: #f3f6f8; --muted: #b9c4cc; --ok: #52e08a; --warn: #ffcc4d; --bad: #ff6b6b; --focus: #ffe066;
  --radius: 14px; --gap: 16px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 112.5%; }
body { margin: 0; background: radial-gradient(1200px 600px at 20% -10%, #1b2a31 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #2a1606 0%, transparent 55%), var(--bg); color: var(--text); font: 1rem/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--edge2); text-underline-offset: 3px; }
a:hover { color: #8ff7f3; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--focus); color: #000; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.2; margin: .2em 0 .5em; }
h1 { font-size: 2rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
small, .muted { color: var(--muted); }
code { background: #00000066; padding: 1px 6px; border-radius: 6px; font-size: .9em; }
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px; }
.prose { max-width: 820px; }
.prose li { margin: .4em 0; }

/* header and footer */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #ff8a1f55; background: linear-gradient(180deg, #14181dee, #0b0d10cc); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.15rem; }
.brand b { color: var(--edge2); letter-spacing: .04em; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.top nav a:not(.btn) { color: var(--text); text-decoration: none; }
.top nav a:not(.btn):hover { color: var(--edge2); }
.foot { border-top: 1px solid #2ee6e033; padding: 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-bottom: 6px; }
form.inline { display: inline; margin: 0; }
bapc-ad { display: block; max-width: 1280px; margin: 8px auto; }

/* glass panels */
.glass, .card, .tile, .kpi, .panel { background: var(--panel); border: 1px solid #2ee6e055; border-radius: var(--radius); box-shadow: 0 0 0 1px #ff8a1f33 inset, 0 0 18px #ff8a1f22, 0 10px 30px #0008; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 18px; }
.glass { margin: var(--gap) 0; }
.neon-o { color: var(--edge); text-shadow: 0 0 12px #ff8a1f88; }
.neon-t { color: var(--edge2); text-shadow: 0 0 12px #2ee6e088; }
.hero { text-align: center; padding: 34px 20px; border-color: var(--edge); }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0; font-weight: 800; }
.tag { font-size: 1.2rem; letter-spacing: .08em; color: var(--text); }
.lede { max-width: 760px; margin: 12px auto; font-size: 1.1rem; }
.note { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--gap); margin: var(--gap) 0; }
.tile h2 { font-size: 1.15rem; color: var(--edge2); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); }
.plan { margin: 0; }
.plan .big { font-size: 2rem; font-weight: 800; color: var(--edge); margin: 0; }
.plan ul { padding-left: 1.1em; }

/* buttons and forms */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--edge2); background: #0e2a2e; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover, button:hover { background: #134047; color: var(--text); }
.btn.primary, button.primary { background: linear-gradient(180deg, #ff9a3a, #e8700c); border-color: #ffb36b; color: #160900; font-weight: 700; }
.btn.primary:hover, button.primary:hover { background: linear-gradient(180deg, #ffad5c, #f07d1a); }
.btn.ghost, button.ghost { background: transparent; }
button.danger { border-color: var(--red); background: #3a0f0f; }
button.small, .btn.small { min-height: 36px; padding: 4px 10px; font-size: .9rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
.bapc-signin { border-color: var(--edge); }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid #5b7480; background: #0a1418; color: var(--text); font: inherit; }
textarea { min-height: 110px; }
input[type=checkbox] { width: auto; min-height: auto; transform: scale(1.3); margin-right: 8px; }
fieldset { border: 1px solid #2ee6e044; border-radius: 10px; padding: 10px 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.err { background: #3a0f0f; border: 1px solid var(--red); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.err ul { margin: 6px 0 0; padding-left: 1.2em; }
.okmsg { background: #0f3a22; border: 1px solid var(--ok); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.secret { font-family: ui-monospace, Consolas, monospace; word-break: break-all; background: #000; padding: 10px; border-radius: 8px; border: 1px dashed var(--warn); }

/* app shell */
.is-app main { max-width: 1440px; }
.shell { display: grid; grid-template-columns: 240px 1fr; gap: var(--gap); align-items: start; }
.side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.side a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.side a:hover { border-color: #2ee6e066; }
.side a[aria-current="page"] { background: #0e2a2e; border-color: var(--edge); box-shadow: 0 0 10px #ff8a1f44; }
.side .ws { margin-bottom: 10px; }
.view { min-width: 0; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bar h1 { margin: 0; }
.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: var(--gap); border: 1px solid var(--warn); background: #3a2d05; }
.banner.stop { border-color: var(--red); background: #3a0f0f; font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 14px; }
.tabs button[aria-selected="true"] { border-color: var(--edge); background: #2a1606; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.kpi { padding: 14px 16px; border-color: var(--edge); }
.kpi .label { color: var(--muted); font-size: .95rem; }
.kpi .value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; }
.kpi .change { font-weight: 700; }
.up { color: var(--ok); } .down { color: var(--bad); }
.actions-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--gap); margin: var(--gap) 0; }
.action-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 104px; font-size: 1.15rem; font-weight: 700; color: var(--text); text-decoration: none; border-color: var(--edge2); }
.action-tile:hover { box-shadow: 0 0 0 1px var(--edge) inset, 0 0 22px #ff8a1f66; color: var(--text); }
.action-tile svg { margin-bottom: 6px; }
.action-tile small { font-weight: 400; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #ffffff14; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.off { color: var(--muted); }
.checklist li { margin: 6px 0; }
.checklist .done { color: var(--ok); }

/* tables */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #ffffff1a; vertical-align: top; }
th { color: var(--edge2); font-weight: 700; background: #0c1b1f; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #ffffff08; }
.empty { padding: 18px; text-align: center; color: var(--muted); }
.reasons { margin: 4px 0 0; padding-left: 1.1em; color: var(--warn); font-size: .9rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
details summary { cursor: pointer; color: var(--edge2); margin: 8px 0; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; }
.sw.c0 { background: #2ee6e0; } .sw.c1 { background: #ff4d4d; } .sw.c2 { background: #ff8a1f; } .sw.c3 { background: #ffd23f; } .sw.c4 { background: #a8b3ba; } .sw.c5 { background: #7c5cff; }
.donut-wrap { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 16px; align-items: center; }

/* portal */
.portal .disclosure { background: #2a1606; border: 1px solid var(--edge); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.portal .disclosure.small { font-size: .85rem; font-weight: 500; padding: 6px 10px; }
.portal .cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.portal .offer { max-width: 760px; }
.portal .price { font-size: 1.2rem; font-weight: 700; }
.langs { display: flex; gap: 10px; justify-content: flex-end; }
.langs a[aria-current] { font-weight: 800; color: var(--edge); }
.cta { font-size: 1.15rem; padding: 12px 26px; }
.loading { color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; }
  .side a { padding: 8px 10px; }
  .donut-wrap { grid-template-columns: 1fr; }
  html { font-size: 106%; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .card, .tile, .kpi, .panel { background: var(--panel-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (prefers-contrast: more) {
  :root { --muted: #e3e9ed; --panel: #000; --panel-solid: #000; }
  .glass, .card, .tile, .kpi, .panel { border: 2px solid #fff; box-shadow: none; }
}
@media (forced-colors: active) { .glass, .card, .tile, .kpi, .panel { border: 2px solid CanvasText; } .sw { forced-color-adjust: none; } }
@media print { .top, .foot, bapc-ad, .side { display: none; } body { background: #fff; color: #000; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form-grid .full { grid-column: 1 / -1; }
fieldset label { font-weight: 400; display: flex; align-items: center; margin: 6px 0; }
