:root,
html[data-theme="dark"] {
    --bg: #0d0f14;
    --panel: rgba(19, 22, 30, 0.78);
    --border: #1f2533;
    --accent: #d4af37;
    --danger: #d9534f;
    --success: #28c76f;
    --text: #dbe3f0;
    --muted: #7c879d;
    --warn: #f0ad4e;
}

html[data-theme="light"] {
    --bg: #eef2f7;
    --panel: rgba(255, 255, 255, 0.82);
    --border: #d5dde8;
    --accent: #a67c00;
    --danger: #c0392b;
    --success: #1f9d55;
    --text: #1f2937;
    --muted: #667085;
    --warn: #b7791f;
}

@media (prefers-color-scheme: light) {
    html[data-theme="system"] {
        --bg: #eef2f7;
        --panel: rgba(255, 255, 255, 0.82);
        --border: #d5dde8;
        --accent: #a67c00;
        --danger: #c0392b;
        --success: #1f9d55;
        --text: #1f2937;
        --muted: #667085;
        --warn: #b7791f;
    }
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        --bg: #0d0f14;
        --panel: rgba(19, 22, 30, 0.78);
        --border: #1f2533;
        --accent: #d4af37;
        --danger: #d9534f;
        --success: #28c76f;
        --text: #dbe3f0;
        --muted: #7c879d;
        --warn: #f0ad4e;
    }
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    color: var(--text);
    transition: background 0.25s ease, color 0.25s ease;
}

#canvas-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.app-container {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    background: rgba(13, 15, 20, 0.9);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
}

.brand {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-lockup img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.12);
}

.brand-lockup h1 {
    margin: 0;
}

.brand h1 {
    margin: 0;
    font-size: 24px;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    letter-spacing: 2px;
}

.brand p {
    margin: 5px 0;
    font-size: 12px;
    color: var(--muted);
}

.server-status {
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(40, 199, 111, 0.1);
    border: 1px solid rgba(40, 199, 111, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 0 10px rgba(40, 199, 111, 0.1) inset;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 1.5s infinite;
}

.status-text {
    color: var(--success);
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(40, 199, 111, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(40, 199, 111, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(40, 199, 111, 0);
    }
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    padding: 12px 15px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover:not(.active) {
    border: 1px solid var(--muted);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transform: translateX(4px);
}

.nav-btn.active {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1) inset;
}

.user-menu {
    position: relative;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.user-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 15px;
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.user-icon {
    font-size: 16px;
}

.user-name {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
    z-index: 100;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(14px);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 12px 15px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
}

.main-stage {
    padding: 40px;
    overflow-y: auto;
}

.main-stage::-webkit-scrollbar {
    width: 8px;
}

.main-stage::-webkit-scrollbar-track {
    background: transparent;
}

.main-stage::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.main-stage::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-section.active {
    display: block;
}

.view-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.glass-panel {
    background: var(--panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.tab-btn:hover:not(.active) {
    color: var(--text);
    border-color: var(--muted);
}

.input-section {
    display: none;
}

.input-section.active {
    display: block;
}

.single-line {
    height: 50px !important;
}

.input-box {
    background: rgba(13, 15, 20, 0.8);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 120px;
    padding: 15px;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 20px;
    resize: none;
    width: 100%;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.input-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.scan-container {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
    display: none;
}

.scan-bar {
    width: 30%;
    height: 100%;
    background: var(--accent);
    position: absolute;
    left: -30%;
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent);
    animation: scan 1.5s ease-in-out infinite alternate;
}

@keyframes scan {
    0% {
        left: -30%;
    }

    100% {
        left: 100%;
    }
}

.btn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    padding: 12px 24px;
    font-family: inherit;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s, border-color 0.2s;
}

.btn:hover {
    background: #e8c84a;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: var(--muted);
    cursor: not-allowed;
    transform: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.res-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.res-verdict {
    display: block;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 1px;
}

.verdict-REAL,
.verdict-SUPPORTED {
    color: var(--success);
}

.verdict-FAKE,
.verdict-REFUTED {
    color: var(--danger);
    text-shadow: 0 0 8px rgba(217, 83, 79, 0.4);
}

.verdict-UNCERTAIN,
.verdict-INSUFFICIENT-EVIDENCE {
    color: var(--muted);
}

.verdict-MISLEADING,
.verdict-LOW-CREDIBILITY {
    color: var(--warn);
    text-shadow: 0 0 8px rgba(240, 173, 78, 0.25);
}

.res-confidence {
    font-weight: bold;
    color: var(--muted);
}

.res-section {
    margin-bottom: 12px;
    line-height: 1.5;
}

.res-label {
    color: var(--accent);
    font-weight: bold;
}

.res-error {
    color: var(--danger);
    font-weight: bold;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 650px;
    width: 90%;
    padding: 0;
    animation: slideUp 0.3s ease-out;
    backdrop-filter: blur(14px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    color: var(--accent);
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 20px;
    color: var(--text);
    line-height: 1.6;
}

.modal-body p {
    margin: 0;
}

.modal-body .warning-text {
    color: var(--danger);
    font-weight: bold;
    margin-bottom: 10px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 24px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.modal-btn.cancel {
    background: transparent;
    color: var(--text);
}

.modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

.modal-btn.confirm {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.modal-btn.confirm:hover {
    background: #ff6b6b;
    border-color: #ff6b6b;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(400px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(400px);
    }
}

.notification {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-family: inherit;
    border-radius: 6px;
    z-index: 10000;
}

.notification-success {
    background: var(--success) !important;
}

.notification-error {
    background: var(--danger) !important;
}

.notification-warning {
    background: var(--warn) !important;
}

.notification-info {
    background: var(--accent) !important;
}

/* ===== BACKGROUND MODES ===== */

body.bg-solid {
    background: var(--bg);
}

body.bg-gradient {
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.08), transparent 30%),
        radial-gradient(circle at bottom right, rgba(40, 199, 111, 0.08), transparent 28%),
        linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg) 88%, white 12%));
}

body.bg-animated {
    background: var(--bg);
}

body.no-canvas #canvas-bg {
    display: none !important;
}

/* ===== LIGHT THEME FIXES ===== */

html[data-theme="light"] .sidebar {
    background: rgba(250, 252, 255, 0.92);
    border-right: 1px solid var(--border);
}

html[data-theme="light"] .glass-panel,
html[data-theme="light"] .settings-section,
html[data-theme="light"] .modal-box,
html[data-theme="light"] .user-dropdown {
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    box-shadow: 0 14px 38px rgba(17, 24, 39, 0.08);
}

html[data-theme="light"] .input-box,
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select {
    background: rgba(255, 255, 255, 0.92) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

html[data-theme="light"] .nav-btn:hover:not(.active) {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] #canvas-bg {
    opacity: 0.28;
}

html[data-theme="light"] .tab-btn.active,
html[data-theme="light"] .btn,
html[data-theme="light"] .settings-btn {
    color: #ffffff;
}

html[data-theme="light"] .server-status {
    background: rgba(31, 157, 85, 0.08);
    border-color: rgba(31, 157, 85, 0.22);
}

/* ===== DYNAMIC DASHBOARD UPGRADE ===== */

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 20px;
    margin-bottom: 20px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(212, 175, 55, 0.12), transparent 35%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.hero-copy h2 {
    margin: 0;
    color: var(--text);
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.08;
    letter-spacing: -1px;
}

.hero-copy p {
    max-width: 720px;
    color: var(--muted);
    line-height: 1.7;
    margin: 14px 0 20px 0;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-primary {
    border-radius: 10px;
}

.hero-secondary {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--border);
}

.hero-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(212, 175, 55, 0.08);
}

.hero-stats {
    display: grid;
    gap: 12px;
}

.hero-stat-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 16px;
}

.hero-stat-card .stat-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.hero-stat-card strong {
    color: var(--text);
    font-size: 28px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.quick-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    border-radius: 14px;
    padding: 18px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.quick-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.08);
}

.quick-icon {
    display: inline-flex;
    margin-bottom: 10px;
    font-size: 22px;
}

.quick-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
}

.quick-card small {
    color: var(--muted);
    line-height: 1.5;
}

.example-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 13px;
}

.example-strip button {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.example-strip button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(212, 175, 55, 0.08);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
    gap: 20px;
}

.scanner-stack {
    display: grid;
    gap: 20px;
}

.scanner-panel {
    position: relative;
    overflow: hidden;
}

.scanner-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(212, 175, 55, 0.12), transparent 30%),
        radial-gradient(circle at bottom left, rgba(40, 199, 111, 0.08), transparent 28%);
    pointer-events: none;
}

.scanner-panel > * {
    position: relative;
    z-index: 1;
}

.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-heading-row.compact {
    align-items: center;
    margin-bottom: 12px;
}

.dynamic-title {
    margin-bottom: 6px;
}

.mode-hint {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 13px;
}

.scanner-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(40, 199, 111, 0.28);
    background: rgba(40, 199, 111, 0.08);
    color: var(--success);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.upgraded-tabs {
    padding: 5px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    border-radius: 12px;
    width: fit-content;
}

.upgraded-tabs .tab-btn {
    border-radius: 9px;
    border-color: transparent;
}

.scanner-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.muted-btn {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
}

.muted-btn:hover {
    border-color: var(--accent);
    color: var(--accent) !important;
}

.result-empty {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: center;
}

.empty-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.25);
    font-size: 26px;
}

.result-empty h3 {
    margin: 0 0 6px 0;
    color: var(--text);
}

.result-empty p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.upgraded-result {
    animation: resultPop 0.28s ease-out;
}

@keyframes resultPop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-top {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 18px;
}

.result-kicker {
    display: block;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 1.4px;
    margin-bottom: 6px;
}

.confidence-card {
    min-width: 220px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    padding: 12px;
}

.confidence-track {
    width: 100%;
    height: 8px;
    margin-top: 10px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.confidence-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.result-cards {
    display: grid;
    gap: 12px;
}

.result-card,
.sources-card {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    padding: 14px;
}

.result-card p {
    margin: 8px 0 0 0;
    color: var(--text);
    line-height: 1.7;
}

.sources-card {
    margin-top: 12px;
}

.sources-card #res-sources {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.dashboard-side {
    display: grid;
    gap: 20px;
    align-content: start;
}

.mini-panel h3 {
    margin: 0 0 14px 0;
    color: var(--accent);
}

.brief-list {
    display: grid;
    gap: 10px;
}

.brief-list div {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.025);
    border-radius: 10px;
    padding: 12px;
}

.brief-list span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.brief-list strong {
    color: var(--text);
    font-size: 13px;
}

.mini-link {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-family: inherit;
}

.mini-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.recent-list {
    display: grid;
    gap: 10px;
}

.recent-item {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-item:hover {
    border-color: var(--accent);
    transform: translateX(3px);
}

.recent-item-title {
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 8px;
}

.recent-item-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 11px;
}

.recent-verdict {
    font-weight: bold;
}

.muted-text {
    color: var(--muted);
    line-height: 1.6;
}

.history-toolbar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.danger-action,
.accent-action {
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
}

.danger-action {
    background: var(--danger);
    color: white;
}

.accent-action {
    background: var(--accent);
    color: var(--bg);
}

/* Light mode dashboard polish */
html[data-theme="light"] .dashboard-hero,
html[data-theme="light"] .quick-card,
html[data-theme="light"] .example-strip button,
html[data-theme="light"] .result-card,
html[data-theme="light"] .sources-card,
html[data-theme="light"] .hero-stat-card,
html[data-theme="light"] .brief-list div,
html[data-theme="light"] .recent-item,
html[data-theme="light"] .confidence-card {
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

html[data-theme="light"] .dashboard-hero {
    background:
        linear-gradient(135deg, rgba(166, 124, 0, 0.08), transparent 36%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(246, 248, 252, 0.72));
}

html[data-theme="light"] .scanner-panel::before {
    background:
        radial-gradient(circle at top right, rgba(166, 124, 0, 0.08), transparent 30%),
        radial-gradient(circle at bottom left, rgba(31, 157, 85, 0.07), transparent 28%);
}

/* Responsive dashboard */
@media (max-width: 1100px) {
    .dashboard-hero,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .result-top {
        flex-direction: column;
    }

    .confidence-card {
        min-width: unset;
    }
}

@media (max-width: 760px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .main-stage {
        padding: 22px;
    }

    .dashboard-hero {
        padding: 20px;
    }

    .result-empty {
        grid-template-columns: 1fr;
    }
}
/* ===== FINAL RESPONSIVE FIXES ===== */

/* Small laptop / tablet landscape */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 240px 1fr;
    }

    .sidebar {
        padding: 24px 18px;
    }

    .main-stage {
        padding: 28px;
    }

    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-side {
        grid-template-columns: 1fr 1fr;
    }
}

/* Tablet portrait and mobile: convert sidebar into top panel */
@media (max-width: 900px) {
    body,
    html {
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #canvas-bg {
        position: fixed;
    }

    .app-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 100vh;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 18px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: rgba(13, 15, 20, 0.94);
    }

    .brand {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .brand-lockup {
        justify-content: flex-start;
    }

    .brand-lockup img {
        width: 42px;
        height: 42px;
    }

    .brand h1 {
        font-size: 21px;
    }

    .brand p {
        font-size: 11px;
    }

    .server-status {
        margin-top: 12px;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        flex: unset;
    }

    .nav-btn {
        justify-content: center;
        text-align: center;
        padding: 11px 8px;
        font-size: 12px;
        transform: none !important;
    }

    .nav-btn .icon {
        display: block;
    }

    .user-menu {
        margin-top: 14px;
        padding-top: 14px;
    }

    .user-dropdown {
        position: static;
        margin-top: 10px;
        margin-bottom: 0;
    }

    #not-logged-in-message {
        margin-top: 14px !important;
        padding-top: 14px !important;
    }

    .main-stage {
        width: 100%;
        height: auto;
        overflow: visible;
        padding: 22px;
    }

    .dashboard-hero {
        padding: 22px;
        margin-bottom: 16px;
        border-radius: 16px;
    }

    .hero-copy h2 {
        font-size: 34px;
    }

    .hero-copy p {
        font-size: 14px;
    }

    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-side {
        grid-template-columns: 1fr;
    }

    .glass-panel {
        padding: 22px;
    }

    .result-top {
        flex-direction: column;
    }

    .confidence-card {
        min-width: unset;
    }

    .history-toolbar {
        flex-direction: column;
    }

    .history-toolbar button {
        width: 100%;
    }

    #history-content {
        overflow-x: auto;
    }

    #history-content table {
        min-width: 650px;
    }
}

/* Phone */
@media (max-width: 520px) {
    .sidebar {
        padding: 16px 14px;
    }

    .brand-lockup {
        gap: 10px;
    }

    .brand-lockup img {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .brand h1 {
        font-size: 19px;
        letter-spacing: 1.5px;
    }

    .brand p {
        font-size: 10px;
    }

    .server-status {
        width: fit-content;
        padding: 6px 10px;
    }

    .status-text {
        font-size: 10px;
    }

    .nav-menu {
        grid-template-columns: 1fr;
    }

    .nav-btn {
        justify-content: flex-start;
        padding: 12px 14px;
        font-size: 13px;
    }

    .user-btn {
        padding: 12px 14px;
    }

    .main-stage {
        padding: 16px;
    }

    .dashboard-hero {
        padding: 18px;
        border-radius: 14px;
    }

    .eyebrow {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .hero-copy h2 {
        font-size: 28px;
        line-height: 1.15;
    }

    .hero-copy p {
        font-size: 13px;
        line-height: 1.65;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .hero-stat-card {
        padding: 14px;
    }

    .hero-stat-card strong {
        font-size: 24px;
    }

    .quick-card {
        padding: 15px;
    }

    .example-strip {
        align-items: flex-start;
        flex-direction: column;
    }

    .example-strip button {
        width: 100%;
        text-align: left;
    }

    .panel-heading-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .scanner-status-pill {
        font-size: 10px;
    }

    .upgraded-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .upgraded-tabs .tab-btn {
        width: 100%;
        padding: 9px 6px;
        font-size: 11px;
    }

    .input-box {
        font-size: 13px;
        padding: 13px;
    }

    .scanner-actions {
        flex-direction: column;
    }

    .scanner-actions .btn {
        width: 100%;
    }

    .result-empty {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .empty-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .res-verdict {
        font-size: 16px;
        line-height: 1.4;
    }

    .result-card,
    .sources-card {
        padding: 12px;
    }

    .modal-box {
        width: calc(100% - 24px);
        max-width: none;
        max-height: 88vh;
        overflow: hidden;
    }

    .modal-body {
        max-height: 62vh;
        overflow-y: auto;
        padding: 16px;
    }

    .modal-footer {
        padding: 14px;
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }
}

/* Very small phones */
@media (max-width: 390px) {
    .main-stage {
        padding: 12px;
    }

    .dashboard-hero {
        padding: 16px;
    }

    .hero-copy h2 {
        font-size: 25px;
    }

    .glass-panel {
        padding: 16px;
    }

    .brand h1 {
        font-size: 17px;
    }
}

.result-actions-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin: -4px 0 16px 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.copy-report-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.055);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.copy-report-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(212, 175, 55, 0.08);
    transform: translateY(-1px);
}

@media (max-width: 520px) {
    .result-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-report-btn {
        width: 100%;
    }
}

/* ===== HISTORY SEARCH + FILTER ===== */

.history-filter-panel {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}

.history-filter-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 12px;
}

.history-filter-item label {
    display: block;
    color: var(--accent);
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 7px;
}

.history-filter-item input,
.history-filter-item select {
    width: 100%;
    background: rgba(13, 15, 20, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 11px 12px;
    font-family: inherit;
    outline: none;
}

.history-filter-item input:focus,
.history-filter-item select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.12);
}

.history-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.history-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.history-table thead tr {
    border-bottom: 1px solid var(--border);
}

.history-table th {
    padding: 12px 10px;
    color: var(--text);
    font-size: 13px;
}

.history-table tbody tr {
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.history-table td {
    padding: 12px 10px;
    line-height: 1.45;
}

html[data-theme="light"] .history-filter-panel,
html[data-theme="light"] .history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .history-filter-item input,
html[data-theme="light"] .history-filter-item select {
    background: rgba(255, 255, 255, 0.92);
}

@media (max-width: 900px) {
    .history-filter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 520px) {
    .history-filter-grid {
        grid-template-columns: 1fr;
    }

    .history-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .history-filter-actions .mini-link {
        width: 100%;
    }
}
.download-report-btn {
    border: 1px solid var(--border);
    background: rgba(212, 175, 55, 0.12);
    color: var(--accent);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.download-report-btn:hover {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.18);
    transform: translateY(-1px);
}

@media (max-width: 520px) {
    .download-report-btn {
        width: 100%;
    }
}
@media (max-width: 768px) {
    html,
    html[data-theme="dark"],
    html[data-theme="light"],
    html[data-theme="system"] {
        --bg: #070a10 !important;
        --panel: rgba(10, 14, 22, 0.98) !important;
        --border: rgba(226, 232, 240, 0.34) !important;
        --accent: #d4af37 !important;
        --danger: #ef4444 !important;
        --success: #22c55e !important;
        --text: #f8fafc !important;
        --muted: #cbd5e1 !important;
        --warn: #f59e0b !important;
    }

    html,
    body {
        background: #070a10 !important;
        color: #f8fafc !important;
        min-height: 100vh !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    #canvas-bg,
    canvas {
        opacity: 0.08 !important;
        filter: brightness(0.75) contrast(0.85) !important;
    }

    .app-container,
    .main-stage {
        background: transparent !important;
        color: #f8fafc !important;
    }

    .sidebar {
        background: rgba(7, 10, 16, 0.98) !important;
        color: #f8fafc !important;
        border-bottom: 1px solid rgba(226, 232, 240, 0.34) !important;
        border-right: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .dashboard-hero,
    .glass-panel,
    .quick-card,
    .hero-stat-card,
    .scanner-panel,
    .mini-panel,
    .result-card,
    .sources-card,
    .confidence-card,
    .brief-list div,
    .recent-item,
    .history-filter-panel,
    .history-table-wrapper,
    .modal-box,
    .user-dropdown {
        background: rgba(10, 14, 22, 0.98) !important;
        color: #f8fafc !important;
        border-color: rgba(226, 232, 240, 0.34) !important;
        box-shadow: 0 14px 38px rgba(0, 0, 0, 0.65) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    html[data-theme="light"] .dashboard-hero,
    html[data-theme="system"] .dashboard-hero,
    .dashboard-hero {
        background:
            linear-gradient(135deg, rgba(212, 175, 55, 0.12), transparent 32%),
            rgba(10, 14, 22, 0.98) !important;
    }

    .scanner-panel::before {
        opacity: 0.35 !important;
    }

    h1,
    h2,
    h3,
    .view-title,
    .hero-copy h2,
    .dynamic-title,
    .result-empty h3,
    .quick-card strong,
    .hero-stat-card strong,
    .brief-list strong,
    .recent-item-title,
    .res-verdict {
        color: #ffffff !important;
        opacity: 1 !important;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.08) !important;
    }

    p,
    label,
    small,
    .hero-copy p,
    .mode-hint,
    .muted-text,
    .quick-card small,
    .brief-list span,
    .recent-item-meta,
    .stat-label,
    .result-empty p,
    .res-section,
    .result-card p,
    .sources-card,
    .modal-body {
        color: #dbe3f0 !important;
        opacity: 1 !important;
    }

    .eyebrow,
    .res-label,
    .mini-panel h3,
    .brand h1 {
        color: #e8c84a !important;
        opacity: 1 !important;
    }

    .brand p,
    .stat-label,
    .result-kicker,
    .recent-item-meta,
    .mode-hint {
        color: #cbd5e1 !important;
        opacity: 1 !important;
    }

    .nav-btn {
        color: #dbe3f0 !important;
        opacity: 1 !important;
        background: rgba(10, 14, 22, 0.94) !important;
        border-color: rgba(226, 232, 240, 0.18) !important;
    }

    .nav-btn.active {
        color: #e8c84a !important;
        background: rgba(212, 175, 55, 0.13) !important;
        border-color: #d4af37 !important;
    }

    .nav-btn:hover {
        color: #ffffff !important;
        border-color: #d4af37 !important;
    }

    .input-box,
    input,
    textarea,
    select {
        background: rgba(4, 8, 14, 0.96) !important;
        color: #f8fafc !important;
        border-color: rgba(226, 232, 240, 0.36) !important;
        opacity: 1 !important;
    }

    .input-box::placeholder,
    input::placeholder,
    textarea::placeholder {
        color: #94a3b8 !important;
        opacity: 1 !important;
    }


    .btn,
    .tab-btn.active,
    .hero-primary,
    .accent-action {
        background: #d4af37 !important;
        color: #070a10 !important;
        border-color: #d4af37 !important;
        opacity: 1 !important;
        font-weight: 800 !important;
    }

    .hero-secondary,
    .muted-btn,
    .mini-link,
    .example-strip button,
    .copy-report-btn,
    .download-report-btn,
    .tab-btn {
        background: rgba(10, 14, 22, 0.96) !important;
        color: #f8fafc !important;
        border-color: rgba(226, 232, 240, 0.36) !important;
        opacity: 1 !important;
    }

    .tab-btn {
        color: #dbe3f0 !important;
    }

    .tab-btn.active {
        color: #070a10 !important;
    }

    .server-status,
    .scanner-status-pill {
        background: rgba(34, 197, 94, 0.12) !important;
        border-color: rgba(34, 197, 94, 0.36) !important;
        color: #22c55e !important;
    }

    .status-text {
        color: #22c55e !important;
        opacity: 1 !important;
    }

    .verdict-SUPPORTED,
    .verdict-REAL {
        color: #22c55e !important;
    }

    .verdict-REFUTED,
    .verdict-FAKE {
        color: #ef4444 !important;
    }

    .verdict-MISLEADING,
    .verdict-LOW-CREDIBILITY {
        color: #f59e0b !important;
    }

    .verdict-INSUFFICIENT-EVIDENCE,
    .verdict-UNCERTAIN {
        color: #cbd5e1 !important;
    }

    /* Tables/history */
    .history-table th,
    .history-table td {
        color: #f8fafc !important;
        border-color: rgba(226, 232, 240, 0.22) !important;
    }

    .history-table tbody tr {
        background: rgba(10, 14, 22, 0.96) !important;
    }

    .history-table tbody tr:hover {
        background: rgba(212, 175, 55, 0.08) !important;
    }

    * {
        -webkit-tap-highlight-color: transparent;
    }
}
