/* ==========================================================================
   wa-cas-upload.css — file-first CAS import (upload → processing → review → done)
   Styling follows the design handoff, mapped onto theme.css tokens.
   ========================================================================== */

#cas-import {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 40px 160px;
    color: var(--wa-text);
}

/* ── Step indicator ─────────────────────────────────────── */
.cas-steps {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 0 26px;
}
.cas-steps__label {
    font-size: 10px;
    letter-spacing: 0.26em;
    color: var(--wa-text-2);
    white-space: nowrap;
}
.cas-steps__track {
    flex: 1;
    height: 1px;
    background: var(--wa-border);
}
.cas-steps__fill {
    height: 1px;
    width: 6%;
    background: var(--wa-gold);
    transition: width 0.55s ease;
}
.cas-steps__count {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--wa-text-muted);
}

/* ── Generic step layout ────────────────────────────────── */
.cas-step { animation: casRise 0.4s ease; }
.cas-step--center { max-width: 520px; margin: 0 auto; text-align: center; padding-top: 60px; }
@keyframes casRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.cas-eyebrow {
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--wa-gold);
    margin: 16px 0 14px;
}
.cas-h1 {
    font-family: var(--wa-font-display);
    font-weight: 500;
    font-size: 48px;
    line-height: 1.06;
    letter-spacing: -0.01em;
    margin: 0 0 18px;
}
.cas-h1 em { font-style: italic; color: var(--wa-gold); }
.cas-h2 {
    font-family: var(--wa-font-display);
    font-weight: 500;
    font-size: 36px;
    margin: 0 0 12px;
}
.cas-sub {
    font-size: 16px;
    line-height: 1.6;
    color: var(--wa-text-2);
    max-width: 580px;
    margin: 0 0 28px;
}
.cas-sub--center { margin-left: auto; margin-right: auto; }
.cas-link { color: var(--wa-gold); text-decoration: underline; cursor: pointer; }
.cas-link--btn { background: none; border: 0; padding: 0; font-size: 12px; }

/* ── Dropzone ───────────────────────────────────────────── */
.cas-dropzone {
    border: 1.5px dashed var(--wa-gold-dim);
    border-radius: 6px;
    background: var(--wa-gold-pale);
    padding: 54px 40px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease;
}
.cas-dropzone:hover, .cas-dropzone.is-drag { background: var(--wa-gold-glow); }
.cas-dropzone__icon {
    width: 52px; height: 52px; line-height: 50px;
    margin: 0 auto 16px;
    border: 1px solid var(--wa-gold-dim);
    border-radius: 8px;
    color: var(--wa-gold);
    font-size: 22px;
}
.cas-dropzone__title { font-family: var(--wa-font-display); font-size: 24px; margin-bottom: 6px; }
.cas-dropzone__sub { font-size: 14px; color: var(--wa-text-muted); }

/* ── File-ready panel ───────────────────────────────────── */
.cas-file-panel {
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    background: var(--wa-bg-card);
    padding: 24px;
}
.cas-file-row { display: flex; align-items: center; gap: 14px; }
.cas-file-thumb {
    width: 42px; height: 52px; line-height: 52px; text-align: center;
    background: var(--wa-gold-pale);
    border: 1px solid var(--wa-gold-dim);
    border-radius: 4px;
    color: var(--wa-gold);
    font-size: 11px; font-weight: 600;
}
.cas-file-meta { flex: 1; }
.cas-file-name { font-size: 15px; }
.cas-file-info { font-size: 12px; color: var(--wa-text-muted); margin-top: 2px; }
.cas-file-clear {
    background: none; border: 0; color: var(--wa-text-muted);
    font-size: 22px; cursor: pointer; line-height: 1;
}
.cas-divider { height: 1px; background: var(--wa-border); margin: 20px 0; }

.cas-field-label {
    display: block;
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--wa-text-2);
    margin: 14px 0 8px;
}
.cas-input {
    width: 100%;
    background: var(--wa-input-bg);
    border: 1px solid var(--wa-input-border);
    border-radius: 4px;
    padding: 13px 14px;
    color: var(--wa-input-text);
    font-size: 14px;
    letter-spacing: 0.04em;
}
.cas-input:focus {
    outline: none;
    border-color: var(--wa-input-border-focus);
    box-shadow: var(--wa-input-shadow-focus);
}
.cas-input--pan { text-transform: uppercase; letter-spacing: 0.12em; }
.cas-hint { font-size: 11px; color: var(--wa-text-muted); margin: 7px 0 0; }

/* ── Buttons ────────────────────────────────────────────── */
.cas-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 4px;
    padding: 13px 22px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.cas-btn--primary { background: var(--wa-btn-bg); color: var(--wa-btn-text); }
.cas-btn--primary:hover { background: var(--wa-btn-bg-hover); }
.cas-btn--ghost { background: transparent; border-color: var(--wa-btn-ghost-border); color: var(--wa-btn-ghost-text); }
.cas-btn--block { width: 100%; margin-top: 22px; }
.cas-btn:disabled { opacity: 0.5; cursor: default; }
.cas-btn__spin, .cas-spinner {
    border: 2px solid var(--wa-gold-glow);
    border-top-color: var(--wa-gold);
    border-radius: 50%;
    animation: casSpin 0.9s linear infinite;
}
.cas-btn__spin { width: 14px; height: 14px; }
@keyframes casSpin { to { transform: rotate(360deg); } }

.cas-error {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 4px;
    background: rgba(224, 90, 90, 0.1);
    border: 1px solid rgba(224, 90, 90, 0.35);
    color: var(--wa-red);
    font-size: 13px;
}

.cas-trust { margin-top: 26px; font-size: 12px; color: var(--wa-text-muted); }

/* ── Where do I get a CAS? (collapsible help) ───────────── */
.cas-help { margin-top: 18px; }
.cas-help__summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wa-gold);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.cas-help__summary::-webkit-details-marker { display: none; }
.cas-help__summary::before { content: '?'; opacity: .7; }
.cas-help[open] .cas-help__summary { margin-bottom: 8px; }
.cas-help__body {
    font-size: 13px;
    line-height: 1.55;
    color: var(--wa-text-2);
    border-left: 2px solid var(--wa-gold-dim);
    padding-left: 12px;
}
.cas-help__body p { margin: 6px 0; }
.cas-help__body a { color: var(--wa-gold); }

/* ── Other ways to add (quiet secondary row) ────────────── */
.cas-alt { margin-top: 30px; }
.cas-alt__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--wa-text-muted);
}
.cas-alt__divider::before,
.cas-alt__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--wa-border);
}
.cas-alt__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    justify-content: center;
    margin-top: 16px;
}
.cas-alt__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    color: var(--wa-text);
    text-decoration: none;
}
.cas-alt__link:hover { color: var(--wa-gold); }
.cas-alt__icon { color: var(--wa-gold); }
.cas-alt__soon {
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--wa-text-muted);
}

/* ── Processing ─────────────────────────────────────────── */
.cas-spinner { width: 64px; height: 64px; margin: 0 auto 26px; border-width: 2px; }
.cas-checklist { list-style: none; padding: 0; max-width: 340px; margin: 28px auto 0; text-align: left; }
.cas-checklist li {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0;
    color: var(--wa-text-muted);
    font-size: 14px;
    transition: color 0.3s ease;
}
.cas-checklist li.is-on { color: var(--wa-text); }
.cas-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ── Parsed: checkpoint before matching ─────────────────── */
.cas-parsed-gate { margin-top: 8px; }
.cas-parsed-gate .cas-btn--block + .cas-btn--block { margin-top: 12px; }

/* Read-only preview of what was actually found in the statement — same
   .cas-group/.cas-row primitives as the Review step, collapsed by default
   (57 rows before login would otherwise push the CTA off-screen) so a
   click is what reveals the proof, not an unavoidable wall of rows. */
#cas-parsed-holdings { margin: 22px 0; }
#cas-parsed-holdings .cas-group__title { color: var(--wa-text); }
#cas-parsed-holdings .cas-group__help { color: var(--wa-text-muted); }

/* cas-upload.php only: the wizard runs at #cas-import's 1000px measure —
   match it here instead of the article's default 760px reading measure so
   the tool-to-guide transition doesn't visually "step in". Two classes
   (not one) to out-specificity wa-resource-article.css's .resource-article
   rule regardless of <link> load order. */
.resource-article.cas-resource-article { max-width: 1000px; }

/* ── Review: source line, tiles ─────────────────────────── */
.cas-source-line {
    font-size: 10px; letter-spacing: 0.24em; color: var(--wa-text-2); margin: 6px 0 14px;
}
.cas-h2 .cas-accent { color: var(--wa-gold); }
.cas-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 26px 0 18px; }
.cas-tile {
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    background: var(--wa-bg-card);
    padding: 16px 18px;
}
.cas-tile__label { font-size: 10px; letter-spacing: 0.2em; color: var(--wa-text-2); }
.cas-tile__count { font-family: var(--wa-font-display); font-size: 30px; margin: 6px 0 2px; }
.cas-tile__count--pos { color: var(--wa-green); }
.cas-tile__count--neg { color: var(--wa-red); }

/* ── Review: groups & rows ──────────────────────────────── */
.cas-group {
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--wa-bg-card);
    margin-top: 16px;
}
.cas-group__head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.015);
    cursor: pointer;
}
.cas-group__title { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; }
.cas-group__title--gold { color: var(--wa-gold); }
.cas-group__title--red { color: var(--wa-red); }
.cas-group__title--muted { color: var(--wa-text-muted); }
.cas-group__help { font-size: 11px; color: var(--wa-text-muted); flex: 1; }
.cas-group__chev { color: var(--wa-text-muted); font-size: 12px; }

.cas-row {
    display: flex; align-items: center; gap: 16px;
    padding: 15px 18px;
    border-top: 1px solid var(--wa-border);
    cursor: pointer;
}
.cas-row__content { display: flex; flex: 1; justify-content: space-between; gap: 16px; transition: opacity 0.2s ease; }
.cas-row.is-off .cas-row__content { opacity: 0.34; }
.cas-row__name { font-size: 15px; }
.cas-row__badge {
    display: inline-block;
    border: 1px solid var(--wa-border-md);
    border-radius: 3px;
    padding: 2px 7px;
    font-size: 9px; letter-spacing: 0.12em;
    color: var(--wa-text-2);
    margin-left: 8px;
}
.cas-row__sub { font-size: 11px; color: var(--wa-text-muted); margin-top: 3px; }
.cas-row__right { text-align: right; }
.cas-row__val { font-family: var(--wa-font-display); font-size: 18px; }
.cas-row__val--pos { color: var(--wa-green); }
.cas-row__val--neg { color: var(--wa-red); }
.cas-row__detail { font-size: 11px; color: var(--wa-text-2); margin-top: 2px; }
.cas-row__detail--redeem { color: var(--wa-red); font-weight: 600; }
.cas-row__detail--review { color: var(--wa-text-2); font-style: italic; }

/* Review + in-sync rows are informational — not selectable */
.cas-row--flat { cursor: default; }
#cas-review-xls { color: var(--wa-gold); white-space: nowrap; }

/* checkbox */
.cas-check {
    width: 20px; height: 20px; flex: none;
    border: 1.5px solid var(--wa-border-strong);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: transparent;
}
.cas-row.is-on .cas-check, .cas-group__check.is-on {
    background: var(--wa-gold); border-color: var(--wa-gold); color: var(--wa-text-inverse);
}
.cas-group__check {
    width: 18px; height: 18px;
    border: 1.5px solid var(--wa-border-strong);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: transparent;
}

.cas-collapsible { display: none; }
.cas-collapsible.is-open { display: block; }

/* ── Fixed footer bar ───────────────────────────────────── */
.cas-footer-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--wa-border-md);
    padding: 14px 40px;
    z-index: 40;
}
.cas-footer-bar__inner {
    max-width: 1000px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}
.cas-footer-left { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.cas-footer-right { display: flex; align-items: center; gap: 12px; }

/* ── Done ───────────────────────────────────────────────── */
.cas-success {
    width: 66px; height: 66px; line-height: 64px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: rgba(46, 194, 126, 0.12);
    border: 1px solid rgba(46, 194, 126, 0.4);
    color: var(--wa-green);
    font-size: 28px;
}
.cas-done-report {
    border: 1px solid var(--wa-border);
    border-radius: 6px;
    background: var(--wa-bg-card);
    padding: 16px 20px;
    margin: 22px 0;
    font-size: 13px;
    text-align: left;
}
.cas-done-actions { display: flex; gap: 12px; justify-content: center; }

@media (max-width: 760px) {
    #cas-import { padding: 0 20px 160px; }
    .cas-h1 { font-size: 36px; }
    .cas-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ── Name-mismatch confirmation overlay ────────────────────── */
.cas-namecheck-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    z-index: 1000;
}
/* The explicit display:flex above wins over the browser's default
   [hidden]{display:none} (author CSS beats the UA stylesheet at equal
   specificity) — without this, the dialog renders on page load instead
   of staying hidden until a mismatch actually fires. */
.cas-namecheck-overlay[hidden] { display: none; }
.cas-namecheck-box {
    width: 100%; max-width: 440px;
    background: var(--wa-bg-card);
    border: 1px solid rgba(224, 90, 90, 0.35);
    border-radius: 8px;
    padding: 24px 26px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.cas-namecheck-title {
    margin: 0 0 10px;
    font-size: 17px;
    color: var(--wa-red);
}
.cas-namecheck-body {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--wa-text-2);
}
.cas-namecheck-body strong { color: var(--wa-text); }
.cas-namecheck-actions { display: flex; gap: 12px; justify-content: flex-end; }
