/* ══════════════════════════════════════════
   Public Core — Reset, Variables, Body, Shared Components
   ══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root, [data-theme="light"] {
    --bg: #F2F4F7;
    --card: #ffffff;
    --border: rgba(0,0,0,0.05);
    --text: #1a1a1a;
    --muted: #64748b;
    --accent: #178ae8;
    --accent-hover: #006cca;
    --accent-light: rgba(23,138,232,0.08);
    --accent-badge: rgba(23,138,232,0.15);
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --shadow: 0 4px 12px rgba(0,0,0,0.03);
    --shadow-lg: 0 16px 32px rgba(0,0,0,0.06);
    --hover-bg: rgba(0,0,0,0.02);
    --input-bg: rgba(248, 249, 251, 0.7);
}

/* Dark theme — vivid electric-blue palette: a rich blue base (#022268),
   an electric-royal accent (#1062fe), and translucent blue-white surfaces
   (hsla hue 220) so cards/text tint over the background rather than
   sitting flat on it. */
[data-theme="dark"] {
    --bg: #022268;
    --card: rgba(75, 120, 210, 0.14);
    --border: rgba(179, 204, 255, 0.12);
    --text: #eef3ff;
    /* Fine print was 64%-opacity blue-white — too faint on the glass. Raised
       for legibility (WCAG contrast) across the portal. */
    --muted: hsla(220, 100%, 92%, 0.85);
    --accent: #1062fe;
    --accent-hover: #009aff;
    --accent-light: rgba(16, 98, 254, 0.16);
    --accent-badge: rgba(16, 98, 254, 0.24);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #eab308;
    --shadow: 0 4px 12px rgba(0, 10, 40, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 10, 40, 0.5);
    --hover-bg: rgba(179, 204, 255, 0.06);
    --input-bg: rgba(75, 120, 210, 0.12);
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding: 0;
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark-mode body tone: a soft light-streak texture painted over the deep navy
   base, giving diagonal highlights and darker corners (depth over the flat
   blue). Fixed so it stays anchored while content scrolls. */
[data-theme="dark"] body {
    background-image: url('/assets/img/acdark-bg.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: 50% 50%;
    background-attachment: fixed;
    background-color: var(--bg);
}

/* ── Page Wrapper ── */
.page-wrap {
    width: 100%;
    max-width: 1200px;
    min-width: 0;
    margin: 0 auto;
}

/* ── Cards ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.card__accent {
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent));
}

.card__body { padding: 1.25rem; }

.card__title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

/* ── Logo (light/dark) ── */
.logo--dark { display: none; }
[data-theme="dark"] .logo--light { display: none; }
[data-theme="dark"] .logo--dark { display: inline; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, background-color 0.3s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212,162,78,0.12);
}
.form-group textarea { resize: vertical; }
.form-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M2 3l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap input { padding-left: 2.4rem; }
.input-icon { position: absolute; left: 0.75rem; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

/* Dark mode: keep typed/filled input text crisply light (not grey) across the
   portal, and give placeholders a legible-but-subtle tone. Covers all input
   variants (.form-group, .fg, and bare inputs). */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: var(--text);
    -webkit-text-fill-color: var(--text);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: hsla(220, 100%, 90%, 0.5);
    -webkit-text-fill-color: hsla(220, 100%, 90%, 0.5);
    opacity: 1;
}
/* Autofilled fields (Chrome paints them dark by default) */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    transition: background-color 9999s ease-out 0s;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 0.3rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(23,138,232,0.15);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(23,138,232,0.3); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; filter: none; transform: none; box-shadow: none; }

.btn--sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.btn--full { width: 100%; }
.btn--outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn--danger { background: var(--danger); }
.btn--success { background: var(--success); }
.btn--ghost {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0.4rem 0.6rem;
    font-weight: 600;
}
.btn--ghost:hover { filter: none; background: var(--accent-light); }

.btn svg { width: 14px; height: 14px; }

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert--success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.15); color: var(--success); }
.alert--error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.15); color: var(--danger); }
.alert--warning { background: rgba(234,179,8,0.1); border: 1px solid rgba(234,179,8,0.15); color: var(--warning); }
.alert--info { background: rgba(212,162,78,0.08); border: 1px solid rgba(212,162,78,0.15); color: var(--accent); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge--success { background: rgba(34,197,94,0.1); color: var(--success); }
.badge--danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge--warning { background: rgba(234,179,8,0.1); color: var(--warning); }
.badge--muted { background: var(--hover-bg); color: var(--muted); }
.badge--primary { background: var(--accent-light); color: var(--accent); }
.badge--accent { background: var(--accent-light); color: var(--accent); }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0.85rem 0; }

/* ── Section Label ── */
.section-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

/* ── Page Footer ── */
.page__footer {
    text-align: center;
    margin-top: 2.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.page__footer a { color: var(--muted); text-decoration: none; }
.page__footer a:hover { color: var(--accent); }

/* ── Spin Animation ── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
    body { padding: 1rem 0.75rem; }
}

/* ══ Site-wide public footer bar ══ */
.pfoot {
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border);
}
.pfoot__link { color: var(--muted); text-decoration: none; }
.pfoot__link:hover { color: var(--accent); }

/* Inline SVG with no dimensions renders at its intrinsic size, or the 300x150
   SVG default. That produced a 340px envelope inside a login field and header
   illustrations that filled their column. Every SVG in the site tree is bounded
   by its container unless a rule says otherwise. */
/* An inline svg with no size renders at its intrinsic size, or the 300x150
   default. That has now caused a giant envelope in a login field, a 150px
   sprite pushing every page down, and full-width arrows inside buttons.
   The default here is an icon sitting with text; anything that needs to be
   bigger says so with a more specific rule, which wins. */
/* Only max-width. An earlier version also set width and height here as a
   "safe default", but core.css is loaded by the account portal too, so it
   resized every icon in the dashboard. The components that genuinely needed a
   size now declare one, which is where that belongs. */
svg { max-width: 100%; }

/* Illustrations carry width and height attributes from their viewBox, so this
   keeps their ratio when a container narrows them.
   Scoped by class, not by attribute: svg[width][height] also matched the
   sprite, whose width="0" height="0" then became height:auto, and an svg with
   no viewBox resolves auto to the 150px default. That pushed every page down
   by 150px from the first element in the body. */
.illus { width: 100%; height: auto; flex: initial; }

/* The sprite holds only <defs> and must never occupy space, whatever else in
   the cascade has an opinion about svg sizing. */
/* One shared container. Sections span the full width and set their own
   inner measure, which is the model every page design assumes. A section that
   needs a full-bleed background simply has no .wrap on its outer element. */
.wrap {
    width: 100%;
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 22px;
}

/* ── Overflow safety ─────────────────────────────────────────────────────────
   The two usual causes of a page wider than the screen: long unbroken
   strings, and flex/grid children that refuse to shrink below their content
   because min-width defaults to auto.
   -------------------------------------------------------------------------- */
.pd__wrap { min-width: 0; }
.pd__rich { overflow-wrap: break-word; }
