/* Visual V7: scoped additions for portals and standalone pages.
   Existing cards, tables, icons and semantic tokens stay in main.css. */
.theme-shell {
    --theme-accent: #b53b00;
    --theme-action: #b53b00;
    --theme-error: #b91c1c;
    --theme-field-border: #737d8c;
    color-scheme: light;
}
.theme-agent { --theme-accent: #405d6b; --theme-action: #4f6d7a; }
.theme-student { --theme-accent: #326c85; --theme-action: #326c85; }
.theme-shell.dark-mode {
    --theme-accent: #ffab80;
    --theme-error: #ff8787;
    --theme-field-border: #8190a5;
    color-scheme: dark;
}
.theme-agent.dark-mode, .theme-student.dark-mode { --theme-accent: #91c7df; }
.theme-agent, .theme-student { --portal-accent: var(--theme-accent); }
.theme-agent #portal-content a:not(.btn):not(.nav-link),
.theme-agent :is(.btn-link, .btn-outline-primary, .btn-outline-secondary) {
    color: var(--theme-accent);
}
.theme-agent :is(.btn-outline-primary, .btn-outline-secondary) { border-color: var(--theme-accent); }
.theme-agent :is(.btn-outline-primary, .btn-outline-secondary):hover {
    background: var(--theme-action);
    color: #fff;
}
.theme-agent .hex-figure-secondary { background: var(--theme-accent); }
.theme-student .portal-supporting-summary { color: var(--ldt-text); }
.theme-student .portal-supporting-value { color: var(--theme-accent); }
.theme-applicant :is(.stat-label, .checklist-label, .next-action-label) { color: var(--theme-accent); }
.theme-applicant .next-action-text { color: var(--ldt-text); }
.theme-applicant .step-label { color: var(--ldt-text-muted); }
.theme-applicant .step-current .step-label { color: var(--theme-accent); }

.theme-shell .site-title { color: var(--ldt-text); }
.theme-public :is(.signing-in-title, .signing-in-contact a) { color: var(--theme-accent); }
.theme-shell :is(.login-title, .reference-title, .portal-section-title, .btn-resend, .login-footer a, .login-note) {
    color: var(--theme-accent);
}
.theme-shell :is(.btn-portal, .btn-reference, .btn-p, .btn-signin) {
    background: var(--theme-action);
    color: #fff;
}
.theme-shell :is(.btn-portal, .btn-reference, .btn-p, .btn-signin):hover {
    background: #273f4c;
    color: #fff;
}
.theme-shell :is(.alert-portal, .alert-reference) {
    color: var(--theme-error);
    border-color: var(--theme-error);
    background: var(--ldt-danger-bg);
}
.theme-shell .text-danger { color: var(--theme-error) !important; }
.theme-shell .reference-panel { background: var(--ldt-bg-secondary); }
.theme-shell :is(input:not([type=hidden]), textarea, select),
.theme-shell.dark-mode :is(input:not([type=hidden]), textarea, select) {
    border-color: var(--theme-field-border);
}
.theme-shell :is(a, button, input, textarea, select, summary):focus-visible {
    outline: 3px solid var(--theme-accent);
    outline-offset: 3px;
}
.theme-shell .form-control::placeholder { color: var(--ldt-text-muted); opacity: 1; }
.theme-shell .form-text { color: var(--ldt-text-muted); }
.theme-shell .message :is(strong, a) { color: inherit; }
.theme-shell .portal-sidenav-label { color: #b5ced9; opacity: 1; }
.theme-shell .login-divider, .theme-shell.dark-mode .login-divider { color: var(--ldt-text-muted); }
.theme-shell .login-header { background: #b53b00; }
.theme-auth { padding: 1rem; }
.theme-auth .theme-toolbar, .theme-referee .theme-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .75rem;
}
.theme-shell .theme-toolbar .dark-mode-toggle { display: inline-flex; }
.theme-shell .theme-toolbar { flex: 0 0 100%; }
.theme-error img[data-theme-logo] { max-width: 100%; height: auto; max-height: 150px; }
.theme-shell .mode-icon [hidden] { display: none; }
/* Prevent the wrong icon/logo flashing while the parser finishes the page. */
.theme-shell.dark-mode [data-theme-icon="moon"] { display: none; }
.theme-shell img[data-theme-logo] { content: url("../images/LDT-Logo-Colour.7c14173e73ae.png"); }
.theme-shell.dark-mode img[data-theme-logo] { content: url("../images/LDT-Logo-White.9c13e7b853d0.png"); }
.theme-shell img[data-theme-logo="spark"] { content: url("../images/SPARK-Logo-Colour.1de8e9aea605.png"); }
.theme-shell.dark-mode img[data-theme-logo="spark"] { content: url("../images/SPARK-Logo-White.5610be2f3438.png"); }
.theme-public .qr-code-div { background: #fff; }
.theme-public .qr-code-div :is(svg, img) { max-width: 100%; height: auto; }
.theme-agent.dark-mode .badge:not(.text-dark) { color: #fff; }
.theme-agent .badge.bg-light { color: #212529; }
.theme-agent.dark-mode .agent-draft-tabs .nav-link { border-color: var(--ldt-border); }

@media (max-width: 640px) {
    .theme-shell .main-header { gap: .5rem; }
    .theme-shell .header-right { gap: .5rem; }
    .theme-shell .header-right .dark-mode-toggle { display: inline-flex; }
    /* Student phones already have their toggle in the drawer. */
    .theme-student:not(.theme-auth) .header-right .dark-mode-toggle { display: none; }
    .theme-auth :is(.login-card, .reference-card) { padding: 1.5rem 1rem; }
    .theme-auth .login-card .login-body { padding: 1.5rem 1rem; }
    .theme-referee .reference-card { padding: 1.5rem 1rem; }
}

@media print {
    .theme-shell .dark-mode-toggle, .theme-shell .theme-toolbar { display: none !important; }
    .theme-shell img[data-theme-logo] { content: url("../images/LDT-Logo-Colour.7c14173e73ae.png") !important; }
    .theme-shell img[data-theme-logo="spark"] { content: url("../images/SPARK-Logo-Colour.1de8e9aea605.png") !important; }
    .theme-shell, .theme-shell.dark-mode {
        --ldt-text: #000;
        --ldt-text-muted: #333;
        --ldt-dark: #000;
        --ldt-white: #fff;
        --ldt-bg: #fff;
        --ldt-bg-secondary: #fff;
        --ldt-card-bg: #fff;
        --ldt-border: #777;
        --theme-accent: #333;
        color-scheme: light;
        background: #fff !important;
        color: #000 !important;
    }
    .theme-shell * {
        transition: none !important;
        animation: none !important;
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    .theme-staff-login .login-header img { content: url("../images/LDT-Logo-Colour.7c14173e73ae.png"); }
    .theme-shell :is(.btn-portal, .btn-reference, .btn-p, .btn-signin, .btn-resend) { display: none; }
}
