﻿@font-face {
    font-family: 'Dana';
    src: url('/ews/static/fonts/Dana-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/ews/static/fonts/Dana-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Dana';
    src: url('/ews/static/fonts/Dana-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Dana', sans-serif;
}

body {
    background: #0b1120;
    color: #e2e8f0;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* پس‌زمینه انتزاعی */
.background-shapes {
    position: absolute;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    animation: float 10s infinite alternate;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: rgba(56, 189, 248, 0.15);
    top: -10%;
    left: -10%;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: rgba(139, 92, 246, 0.15);
    bottom: -20%;
    right: -10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: rgba(236, 72, 153, 0.15);
    top: 40%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
    }

    100% {
        transform: translateY(-30px) scale(1.05);
    }
}

/* صفحه لاگین */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2rem;
    text-align: center;
    z-index: 10;
}

.login-header h2 {
    margin-bottom: 0.5rem;
    color: #e2e8f0;
}

.login-header p {
    color: #94a3b8;
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.input-group input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: 0.3s;
    font-size: 1rem;
}

.input-group input:focus {
    border-color: #38bdf8;
    background: rgba(0, 0, 0, 0.4);
}

.glass-panel {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 16px;
}

.dashboard-container {
    display: flex;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
}

.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #38bdf8;
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    transition: 0.3s;
    margin-bottom: 0.5rem;
}

.menu a:hover,
.menu a.active {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

.logout-btn {
    color: #f43f5e !important;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1) !important;
    color: #f43f5e !important;
}

.agent-status {
    margin-top: auto;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 10px;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-radius: 16px;
}

.btn-primary {
    background: #38bdf8;
    color: #0f172a;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.btn-primary:hover {
    background: #0ea5e9;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: #e2e8f0;
    font-weight: bold;
}

.alert {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #fca5a5;
}

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
}

.card-icon.blue {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.card-icon.red {
    background: rgba(244, 63, 94, 0.2);
    color: #f43f5e;
}

.card-info h3 {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: normal;
    margin-bottom: 5px;
}

.card-info p {
    font-size: 1.8rem;
    font-weight: bold;
}

.filter-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    outline: none;
    flex: 1;
    min-width: 150px;
}

.filter-input::placeholder {
    color: #94a3b8;
}

.filter-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.data-table-container {
    padding: 1.5rem;
}

.table-header {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.glass-table th {
    padding: 1rem;
    color: #94a3b8;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    background: rgba(30, 41, 59, 0.95);
    z-index: 1;
}

.glass-table td {
    padding: 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.glass-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge-unread {
    background: #f43f5e;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.badge-read {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #cbd5e1;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin: 0 5px;
    font-size: 1.1rem;
    transition: 0.2s;
}

.view-btn {
    color: #38bdf8;
}

.view-btn:hover {
    color: #0ea5e9;
    transform: scale(1.2);
}

.delete-btn {
    color: #f43f5e;
}

.delete-btn:hover {
    color: #e11d48;
    transform: scale(1.2);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 70%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: #f43f5e;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: #e11d48;
    transform: rotate(90deg);
}

.modal-body {
    overflow-y: auto;
    padding-right: 10px;
    color: #e2e8f0;
    line-height: 1.7;
    font-size: 0.95rem;
}

.modal-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* انیمیشن لودینگ Shimmer */
.shimmer-box {
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.shimmer-box::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

.shimmer-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.shimmer-w-50 {
    width: 50%;
}

.shimmer-w-80 {
    width: 80%;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #38bdf8;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* استایل نشانگر همگام‌سازی زنده */
.sync-badge {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulseSync 2s infinite;
}

.sync-badge.hidden {
    display: none;
}

.sync-badge.success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
    animation: none;
}

@keyframes pulseSync {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(56, 189, 248, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

.live-counter {
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.pagination-container button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.05);
}

/* استایل‌های بخش گزارش هوش مصنوعی */
.ai-report-box h1,
.ai-report-box h2,
.ai-report-box h3 {
    color: #c084fc;
    margin-top: 1.2rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
}

.ai-report-box ul,
.ai-report-box ol {
    padding-right: 1.5rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.ai-report-box li {
    margin-bottom: 0.5rem;
}

.ai-report-box strong {
    color: #38bdf8;
}

/* کارت‌های کوچک تاریخچه */
.history-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.history-card:hover,
.history-card.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: #a855f7;
}

.history-time {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-top: 5px;
}

/* استایل‌های ساختار یافته برای گزارش JSON */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.report-header h2 {
    color: #38bdf8;
    font-size: 1.4rem;
}

.btn-print {
    background: #334155;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-print:hover {
    background: #475569;
}

.report-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    border-right: 4px solid #38bdf8;
}

.report-section h3 {
    margin-bottom: 0.8rem;
    color: #e2e8f0;
    font-size: 1.1rem;
}

.report-section.urgent {
    border-right-color: #f43f5e;
    background: rgba(244, 63, 94, 0.05);
}

.report-section.important {
    border-right-color: #f59e0b;
}

.report-section.custom {
    border-right-color: #a855f7;
    background: rgba(168, 85, 247, 0.05);
}

.report-list {
    list-style: none;
    padding: 0;
}

.report-list li {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.report-list li strong {
    color: #cbd5e1;
}

.badge-deadline {
    background: rgba(244, 63, 94, 0.2);
    color: #fca5a5;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-right: 10px;
    border: 1px solid #f43f5e;
}

/* ========================================= */
/* جادوی حالت پرینت (چاپ کاغذی یا PDF) */
/* ========================================= */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    /* مخفی کردن المان‌های مزاحم در پرینت */
    .sidebar,
    .background-shapes,
    .side-panel,
    .custom-prompt-zone,
    #btn-generate-default,
    .btn-print,
    .report-header i {
        display: none !important;
    }

    /* تغییر استایل‌های شیشه‌ای به حالت خطی و ساده */
    .dashboard-container {
        padding: 0;
        display: block;
    }

    .main-content {
        overflow: visible !important;
        height: auto !important;
        padding: 0 !important;
    }

    .data-section {
        display: block !important;
    }

    .glass-panel {
        background: transparent !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    .ai-report-box {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }

    .report-section {
        background: transparent !important;
        border: 1px solid #ccc !important;
        border-right: 4px solid #555 !important;
        margin-bottom: 0.55rem !important;
        padding: 0.55rem 0.65rem !important;
        page-break-inside: auto;
        break-inside: auto;
    }

    .report-list li {
        background: transparent !important;
        border: 1px solid #eee !important;
        color: #000 !important;
        page-break-inside: auto;
        break-inside: auto;
    }

    .report-section h3,
    .report-section h2 {
        break-after: avoid;
        page-break-after: avoid;
    }

    h2,
    h3,
    p,
    span,
    strong,
    div {
        color: #000 !important;
    }

    .badge-deadline {
        background: transparent !important;
        color: #000 !important;
        border-color: #000 !important;
    }
}

/* استایل‌های پارسر اختصاصی هوش مصنوعی */
.ai-markdown-container {
    font-size: 0.95rem;
    line-height: 2;
    color: #e2e8f0;
}

.ai-markdown-container strong {
    color: #38bdf8;
    font-weight: bold;
}

.ai-custom-list-item {
    display: flex;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.ai-list-number {
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: white;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
    margin-left: 15px;
    /* برای راست‌چین */
    flex-shrink: 0;
}

.ai-bullet-item {
    display: flex;
    align-items: flex-start;
    margin-right: 1.5rem;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
}

.ai-bullet-icon {
    color: #a855f7;
    margin-left: 8px;
    margin-top: 8px;
    font-size: 0.8rem;
}

.ai-paragraph {
    margin-bottom: 1rem;
}

/* گزارش‌های هوشمند: صفحه سازمانی و وضعیت زنده */
.reports-dashboard {
    min-width: 0;
}

.reports-main {
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(0, 2.6fr);
    gap: 1rem;
    overflow: hidden;
    padding-right: 0;
}

.reports-history-panel,
.reports-workspace {
    height: calc(100vh - 2rem);
    min-height: 0;
}

.reports-history-panel {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.panel-heading {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
}

.panel-heading span,
.analysis-eyebrow {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.panel-heading h3 {
    color: #e2e8f0;
    font-size: 1.05rem;
}

.reports-history-list {
    flex: 1;
    overflow-y: auto;
    padding-left: 4px;
}

.sidebar-meta {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 0.72rem;
}

.sidebar-version {
    color: #cbd5e1;
}

.sidebar-beta {
    align-self: flex-start;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.22);
    background: rgba(56, 189, 248, 0.08);
    color: #7dd3fc;
    font-weight: 700;
}

.history-title {
    font-size: 0.92rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-preview {
    margin-top: 0.35rem;
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-history {
    color: #94a3b8;
    font-size: 0.86rem;
    text-align: center;
    margin-top: 2rem;
}

.error-text {
    color: #fca5a5;
}

.reports-workspace {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    overflow-x: hidden;
}

.reports-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.reports-topbar h1 {
    font-size: 1.35rem;
    color: #f8fafc;
}

.reports-controls {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 360px;
}

.report-range-select {
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.report-action-btn {
    background: linear-gradient(to right, #0ea5e9, #8b5cf6);
    color: #fff;
    border: none;
    white-space: nowrap;
}

.reports-output {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    padding: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 1rem 0;
    line-height: 1.8;
    scrollbar-color: rgba(56, 189, 248, 0.35) rgba(15, 23, 42, 0.45);
    scrollbar-width: thin;
}

.reports-output::-webkit-scrollbar {
    width: 8px;
}

.reports-output::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.45);
    border-radius: 999px;
}

.reports-output::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.35);
    border-radius: 999px;
}

.reports-empty-state {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #94a3b8;
}

.reports-empty-state i {
    font-size: 2.6rem;
    color: #38bdf8;
    margin-bottom: 1rem;
}

.reports-empty-state h2 {
    color: #e2e8f0;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.reports-prompt-zone {
    display: flex;
    flex-shrink: 0;
    gap: 0.8rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.12);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 -10px 24px rgba(2, 6, 23, 0.18);
}

.reports-prompt-zone>i {
    color: #94a3b8;
}

.reports-prompt-zone input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    outline: none;
    min-width: 0;
}

.agent-job-progress-card {
    display: grid;
    justify-items: center;
    gap: 0.65rem;
}

.agent-job-progress-track {
    width: min(460px, 100%);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.agent-job-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(to left, #22c55e, #06b6d4, #8b5cf6);
    transition: width 0.3s ease;
}

.agent-job-progress-percent {
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 800;
}

.analysis-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    height: 100%;
    min-height: 0;
}

.analysis-percent {
    color: #38bdf8;
    font-size: 1.55rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.analysis-body-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 310px);
    gap: 1rem;
    min-height: 0;
    overflow: hidden;
}

.live-pill,
#live-report-badge {
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.request-summary {
    color: #cbd5e1;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    padding: 0.75rem;
    border-right: 3px solid #38bdf8;
    font-size: 0.82rem;
}

.live-report-zone {
    margin-top: 1rem;
    overflow: visible;
    min-height: 0;
    padding-left: 0.25rem;
}

.live-report-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.final-report-header {
    align-items: flex-start;
}

.final-report-header h2 {
    font-size: 1.2rem;
}

.report-section {
    border-radius: 8px;
}

.report-placeholder {
    color: #94a3b8;
    text-align: center;
    padding: 2rem 1rem;
}

.final-report-header p {
    color: #94a3b8;
    margin-top: 0.35rem;
}

.important-subject {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.4rem;
}

.important-subject span,
.important-reason {
    color: #94a3b8;
    font-size: 0.85rem;
}

.low-priority {
    border-right-color: #64748b;
    opacity: 0.88;
}

@media (max-width: 1100px) {
    .reports-main {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .reports-history-panel {
        height: auto;
        max-height: 240px;
    }

    .reports-workspace {
        height: auto;
        min-height: calc(100vh - 2rem);
    }

    .reports-topbar,
    .reports-controls {
        align-items: stretch;
        flex-direction: column;
        min-width: 0;
    }

    .analysis-shell {
        height: auto;
    }

    .live-report-panel {
        overflow: visible;
    }

    .reports-output,
    .live-report-zone {
        overflow-y: visible;
    }
}

/* Compact executive report workspace: tuned so 100% browser zoom feels closer to the old 67% view. */
.reports-dashboard {
    padding: 0.45rem;
    gap: 0.55rem;
    font-size: 12px;
}

.reports-dashboard .sidebar {
    width: 188px;
    padding: 0.95rem;
    border-radius: 10px;
}

.reports-dashboard .brand {
    gap: 8px;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.reports-dashboard .brand h2 {
    font-size: 1.15rem;
}

.reports-dashboard .menu a {
    gap: 10px;
    padding: 0.7rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
}

.reports-main {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 0.55rem;
}

.reports-history-panel,
.reports-workspace {
    height: calc(100vh - 0.9rem);
    border-radius: 10px;
}

.reports-history-panel {
    padding: 0.7rem;
}

.panel-heading {
    padding-bottom: 0.55rem;
    margin-bottom: 0.55rem;
}

.panel-heading h3 {
    font-size: 0.9rem;
}

.panel-heading span,
.analysis-eyebrow {
    font-size: 0.58rem;
}

.history-card {
    padding: 0.62rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.history-title {
    font-size: 0.78rem;
}

.history-time {
    font-size: 0.65rem;
}

.reports-workspace {
    padding: 0.75rem;
}

.reports-topbar {
    padding-bottom: 0.55rem;
}

.reports-topbar h1 {
    font-size: 1.02rem;
}

.reports-controls {
    min-width: 290px;
    gap: 0.45rem;
}

.report-range-select,
.report-action-btn,
.reports-prompt-zone .btn-secondary {
    min-height: 34px;
    padding: 0.38rem 0.65rem;
    font-size: 0.78rem;
    border-radius: 7px;
}

.reports-output {
    margin: 0.55rem 0;
    padding: 0.55rem;
    border-radius: 8px;
}

.reports-prompt-zone {
    padding: 0.48rem 0.6rem;
    border-radius: 8px;
}

.reports-prompt-zone input {
    font-size: 0.78rem;
}

.analysis-shell {
    gap: 0.55rem;
}

.analysis-percent {
    font-size: 1.25rem;
}

.analysis-body-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 82px;
    gap: 0.55rem;
}

.live-report-panel {
    order: 1;
}

.request-summary {
    display: none;
}

.live-report-title {
    padding-bottom: 0.38rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#live-report-badge {
    font-size: 0.64rem;
    padding: 0.14rem 0.45rem;
}

.live-report-zone {
    margin-top: 0.55rem;
}

.final-report-header {
    padding-bottom: 0.55rem;
    margin-bottom: 0.75rem;
}

.final-report-header h2,
.report-header h2 {
    font-size: 1rem;
}

.final-report-header p {
    font-size: 0.72rem;
}

.report-section {
    padding: 0.78rem;
    margin-bottom: 0.75rem;
    border-radius: 8px;
}

.report-section h3 {
    font-size: 0.86rem;
    margin-bottom: 0.45rem;
}

.ai-markdown-container {
    font-size: 0.82rem;
    line-height: 1.85;
}

.report-list li {
    padding: 0.55rem;
    margin-bottom: 0.4rem;
    border-radius: 7px;
}

.badge-deadline {
    font-size: 0.65rem;
}

@media (max-width: 1250px) {
    .reports-dashboard .sidebar {
        width: 168px;
    }

    .reports-main {
        grid-template-columns: 200px minmax(0, 1fr);
    }
}

/* Report-first pass: status stays visible, but the report owns the viewport. */
.analysis-shell {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.42rem;
}

.analysis-percent {
    font-size: 1rem;
    line-height: 1;
}

.analysis-body-grid {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    min-height: 0;
}

.live-report-panel {
    min-height: 0;
    padding: 0.55rem;
}

.live-report-title {
    padding-bottom: 0.28rem;
}

.live-report-title .analysis-eyebrow {
    display: none;
}

.live-report-title h3 {
    font-size: 0.78rem;
}

#live-report-badge {
    font-size: 0.58rem;
}

.live-report-zone {
    margin-top: 0.42rem;
    padding-bottom: 3.2rem;
}

.final-report-header {
    padding-bottom: 0.38rem;
    margin-bottom: 0.55rem;
}

.final-report-header h2,
.report-header h2 {
    font-size: 0.92rem;
}

.final-report-header p {
    font-size: 0.66rem;
}

.report-section {
    padding: 0.62rem 0.72rem;
    margin-bottom: 0.55rem;
}

.report-section h3 {
    font-size: 0.78rem;
}

.ai-markdown-container {
    font-size: 0.78rem;
    line-height: 1.75;
}

.report-list li {
    padding: 0.45rem 0.55rem;
}

/* Polish pass: refined archive, floating event ticker, and print affordance. */
.reports-history-panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.68));
}

.reports-history-list {
    padding: 0.2rem 0.1rem 0.2rem 0.35rem;
}

.history-card {
    position: relative;
    background: rgba(15, 23, 42, 0.54);
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0);
}

.history-card::before {
    content: "";
    position: absolute;
    inset-block: 0.55rem;
    right: 0;
    width: 3px;
    border-radius: 999px 0 0 999px;
    background: transparent;
}

.history-card:hover {
    background: rgba(30, 41, 59, 0.78);
    border-color: rgba(56, 189, 248, 0.28);
    transform: translateX(-1px);
}

.history-card.active {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(56, 189, 248, 0.38);
}

.history-card.active::before {
    background: linear-gradient(180deg, #38bdf8, #8b5cf6);
}

.history-title {
    color: #e5eefb;
    line-height: 1.5;
}

.history-time {
    color: #93a4bc;
}

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(56, 189, 248, 0.11);
    border-color: rgba(56, 189, 248, 0.34);
    color: #7dd3fc;
    padding: 0.36rem 0.62rem;
    border-radius: 7px;
    font-size: 0.72rem;
    white-space: nowrap;
}

.btn-print:hover {
    background: rgba(56, 189, 248, 0.18);
    color: #e0f2fe;
}

/* Final archive layout: history first, live processing events beneath it. */
.reports-history-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 0.55rem;
    height: calc(100vh - 0.9rem);
    max-height: none;
}

.reports-history-panel .panel-heading {
    flex-shrink: 0;
}

.reports-history-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.12rem 0.08rem 0.12rem 0.45rem;
}

.history-card {
    display: grid;
    gap: 0.22rem;
    min-height: 58px;
    padding: 0.58rem 0.72rem;
    border-radius: 7px;
    background:
        linear-gradient(135deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.72)),
        rgba(15, 23, 42, 0.6);
}

.history-title {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date-stack {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.16rem 0.5rem;
    min-width: 0;
}

.history-time {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    line-height: 1.3;
}

.history-time-fa {
    color: #b7c4d7;
    font-size: 0.62rem;
}

.history-time-en {
    direction: ltr;
    color: #64748b;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.58rem;
}

.analysis-body-grid {
    grid-template-columns: 1fr;
}

.live-report-zone {
    padding-bottom: 0.6rem;
}

.agent-status-grid {
    gap: 0.45rem;
}

.agent-source-line {
    color: #94a3b8;
    font-size: 0.68rem;
    line-height: 1.7;
    margin-top: 0.28rem;
}

.agent-direct {
    border-right-color: #10b981;
}

.agent-cc {
    border-right-color: #38bdf8;
}

.agent-sources,
.agent-meta-note {
    border-right-color: #8b5cf6;
}

.compact-source-list li {
    padding: 0.42rem 0.55rem;
}

.agent-sources summary {
    cursor: pointer;
    color: #dbeafe;
    font-weight: 800;
    list-style: none;
}

.agent-sources summary::-webkit-details-marker {
    display: none;
}

.agent-sources summary span,
.agent-source-refs {
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    margin-right: 0.35rem;
}

.agent-sources-helper {
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.8;
    margin: 0.45rem 0 0.65rem;
}

.agent-source-refs {
    color: #38bdf8;
    margin-left: 0.45rem;
}

.agent-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
}

.agent-meta-grid span {
    color: #a8b6ca;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 7px;
    padding: 0.42rem 0.5rem;
    font-size: 0.66rem;
}

.warning-text {
    color: #fbbf24;
}

.rtl-text {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
}

.ltr-text {
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
}

.agent-meta-note {
    display: none !important;
}

.executive-report-list {
    display: grid;
    gap: 0.48rem;
}

.executive-report-item,
.source-row {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 7px;
    padding: 0.62rem 0.72rem;
}

.report-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.3rem;
}

.report-item-title {
    min-width: 0;
    color: #e5eefb;
    font-size: 0.82rem;
    line-height: 1.75;
}

.report-item-title span {
    display: inline;
}

.report-item-body {
    color: #c8d3e3;
    font-size: 0.76rem;
    line-height: 1.9;
}

.report-item-detail {
    color: #aebbd0;
}

.report-item-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.34rem;
}

.report-item-meta {
    color: #8fa1b8;
    font-size: 0.66rem;
    line-height: 1.7;
}

.meta-dot {
    color: #475569;
    margin: 0 0.35rem;
}

.report-meta-chip {
    flex: 0 0 auto;
    border: 1px solid rgba(56, 189, 248, 0.24);
    background: rgba(56, 189, 248, 0.08);
    color: #bae6fd;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.45;
    white-space: nowrap;
}

.report-meta-chip.muted {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.06);
    color: #94a3b8;
}

.executive-sources .source-row {
    display: grid;
    gap: 0.25rem;
}

.ai-markdown-container code {
    direction: ltr;
    display: inline-block;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.92em;
    color: #bae6fd;
}

.important-reason .ai-markdown-container,
.report-list .ai-markdown-container {
    margin-top: 0.15rem;
}

.report-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-send-report {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(16, 185, 129, 0.11);
    border: 1px solid rgba(16, 185, 129, 0.34);
    color: #86efac;
    padding: 0.36rem 0.62rem;
    border-radius: 7px;
    font-size: 0.72rem;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn-send-report:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.18);
    color: #dcfce7;
}

.btn-send-report:disabled {
    opacity: 0.72;
    cursor: wait;
}

.ai-clean-heading {
    color: #e2e8f0;
    font-weight: 850;
    margin: 0.45rem 0 0.25rem;
}

.ai-clean-list {
    list-style: none;
    margin: 0.35rem 0;
    padding: 0;
}

.ai-clean-list li {
    position: relative;
    padding-right: 0.9rem;
    margin: 0.22rem 0;
    color: #cbd5e1;
}

.ai-clean-list li::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0.72em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #38bdf8;
}

.reports-controls .filter-input {
    appearance: none;
    min-width: 138px;
    min-height: 34px;
    padding: 0.42rem 2rem 0.42rem 0.75rem;
    border-radius: 8px;
    color: #e5f4ff;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.76)),
        linear-gradient(90deg, transparent calc(100% - 30px), rgba(56, 189, 248, 0.1) calc(100% - 30px));
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    font-size: 0.74rem;
    font-weight: 750;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    background-image:
        linear-gradient(45deg, transparent 50%, #7dd3fc 50%),
        linear-gradient(135deg, #7dd3fc 50%, transparent 50%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.76));
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 13px) 50%,
        0 0;
    background-size:
        5px 5px,
        5px 5px,
        100% 100%;
    background-repeat: no-repeat;
}

.reports-controls .filter-input:hover {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.reports-controls .filter-input:focus {
    border-color: rgba(14, 165, 233, 0.75);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.reports-controls .filter-input option {
    background: #111827;
    color: #e5e7eb;
}

.report-help {
    position: relative;
    flex: 0 0 auto;
}

.report-help-trigger {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.1);
    color: #7dd3fc;
    cursor: pointer;
    animation: helpPulse 2.8s ease-in-out infinite;
}

.report-help-trigger:hover,
.report-help-trigger:focus-visible {
    color: #e0f2fe;
    background: rgba(56, 189, 248, 0.18);
    outline: none;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.report-help-popover {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: 0;
    z-index: 20;
    width: min(420px, 82vw);
    max-height: 56vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    padding: 0.85rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
    color: #cbd5e1;
    line-height: 1.8;
    font-size: 0.75rem;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.report-help-popover strong {
    display: block;
    color: #e0f2fe;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
}

.report-help-popover p {
    margin: 0 0 0.52rem;
}

.report-help-popover p:last-child {
    margin-bottom: 0;
}

.report-help:hover .report-help-popover,
.report-help:focus-within .report-help-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.report-preferences-panel {
    margin: 0.55rem 0 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
    padding: 0.48rem 0.62rem;
}

.agent-main-loading {
    min-height: 260px;
}

.agent-main-loading h3 {
    margin: 0.75rem 0 0.35rem;
    color: #e5eefb;
    font-size: 1rem;
}

.report-preferences-panel summary {
    cursor: pointer;
    color: #dbeafe;
    font-size: 0.78rem;
    font-weight: 850;
    list-style: none;
}

.report-preferences-panel summary::-webkit-details-marker {
    display: none;
}

.report-preferences-panel summary i {
    color: #38bdf8;
    margin-left: 0.35rem;
}

.report-preferences-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.52rem;
    margin-top: 0.65rem;
}

.report-preferences-grid label {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
    color: #94a3b8;
    font-size: 0.66rem;
    font-weight: 750;
}

.report-preferences-grid input,
.report-preferences-grid select,
.report-preferences-grid textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.72);
    color: #e5eefb;
    padding: 0.45rem 0.55rem;
    font-size: 0.72rem;
    resize: vertical;
}

.report-preferences-grid label:nth-last-child(3),
.report-preferences-grid label:nth-last-child(2) {
    grid-column: span 2;
}

.pref-check {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.45rem !important;
}

.pref-check input {
    width: auto;
}

.report-preferences-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.62rem;
}

#report-preferences-message {
    color: #94a3b8;
    font-size: 0.7rem;
}

#report-preferences-message.success {
    color: #86efac;
}

#report-preferences-message.error {
    color: #fca5a5;
}

@media (max-width: 1100px) {
    .report-preferences-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .report-preferences-grid {
        grid-template-columns: 1fr;
    }

    .report-preferences-grid label:nth-last-child(3),
    .report-preferences-grid label:nth-last-child(2) {
        grid-column: auto;
    }
}

@keyframes helpPulse {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    40% {
        transform: translateY(-1px) rotate(-5deg);
    }

    55% {
        transform: translateY(0) rotate(5deg);
    }
}

@media print {

    .btn-send-report {
        display: none !important;
    }

    .reports-dashboard,
    .reports-main,
    .reports-workspace,
    .reports-output,
    .live-report-zone {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        background: #fff !important;
        color: #111 !important;
        box-shadow: none !important;
    }

    .agent-sources {
        display: block !important;
    }

    .agent-sources[open],
    .agent-sources:not([open]) {
        page-break-inside: auto;
        break-inside: auto;
    }

    .agent-sources ul {
        display: block !important;
    }

    .agent-meta-note {
        display: none !important;
    }
}

/* Final beta overrides kept at the end so older compact rules cannot dilute them. */
.reports-history-list,
.main-content,
.modal-body {
    scrollbar-color: rgba(56, 189, 248, 0.3) rgba(15, 23, 42, 0.34);
    scrollbar-width: thin;
}

.reports-history-list::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.reports-history-list::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.34);
    border-radius: 999px;
}

.reports-history-list::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 999px;
}

.history-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    min-width: 0;
}

.history-title-row .history-title {
    flex: 1;
    min-width: 0;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.history-badge,
.experimental-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.28);
    background: rgba(250, 204, 21, 0.1);
    color: #fde68a;
    font-weight: 850;
    white-space: nowrap;
}

.history-badge {
    flex: 0 0 auto;
    padding: 0.05rem 0.35rem;
    font-size: 0.54rem;
}

.experimental-badge {
    padding: 0.08rem 0.42rem;
    font-size: 0.58rem;
    line-height: 1.6;
}

.experimental-badge.inline {
    vertical-align: middle;
    margin-right: 0.35rem;
}

.beta-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.55rem 0 0;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: rgba(56, 189, 248, 0.07);
    color: #b7c4d7;
    font-size: 0.72rem;
    line-height: 1.8;
}

#btn-submit-qa {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.42);
}

#btn-submit-qa.is-loading {
    opacity: 0.85;
    cursor: wait;
}

.qa-report-header .report-header-actions {
    gap: 0.5rem;
}

.qa-section {
    border-right-color: rgba(56, 189, 248, 0.7);
}

.qa-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.55rem;
}

.qa-metric-card {
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    padding: 0.58rem 0.68rem;
    min-width: 0;
}

.qa-metric-label {
    display: block;
    color: #94a3b8;
    font-size: 0.68rem;
    margin-bottom: 0.25rem;
}

.qa-metric-value {
    display: block;
    color: #e5eefb;
    font-size: 0.88rem;
    line-height: 1.7;
}

.qa-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.5;
}

.qa-badge.info {
    border-color: rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.08);
    color: #bae6fd;
}

.qa-badge.warning {
    border-color: rgba(250, 204, 21, 0.24);
    background: rgba(250, 204, 21, 0.08);
    color: #fde68a;
}

.qa-badge.success {
    border-color: rgba(16, 185, 129, 0.24);
    background: rgba(16, 185, 129, 0.08);
    color: #bbf7d0;
}

.qa-badge.muted {
    color: #94a3b8;
}

.qa-compact-list {
    display: grid;
    gap: 0.42rem;
    margin-top: 0.55rem;
}

.qa-compact-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
}

.qa-section.warning {
    background: rgba(250, 204, 21, 0.06);
    border-right-color: rgba(250, 204, 21, 0.72);
}

.qa-action-section {
    background: rgba(56, 189, 248, 0.05);
}

.qa-action-items-section,
.qa-hint-section {
    background: rgba(15, 23, 42, 0.3);
}

.qa-section-helper,
.qa-soft-note {
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.85;
}

.qa-section-helper {
    margin: -0.15rem 0 0.65rem;
}

.qa-soft-note {
    margin-top: 0.6rem;
}

.qa-compact-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.qa-compact-main strong {
    color: #e5eefb;
    font-size: 0.78rem;
    line-height: 1.8;
}

.qa-compact-sub {
    color: #94a3b8;
    font-size: 0.7rem;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.qa-compact-count {
    flex: 0 0 auto;
    color: #cbd5e1;
    font-size: 0.68rem;
    white-space: nowrap;
}

.qa-subsection,
.qa-citations {
    margin-top: 0.9rem;
}

.qa-subtitle {
    display: block;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.qa-inline-list {
    list-style: none;
    display: grid;
    gap: 0.3rem;
    padding: 0;
    margin: 0;
}

.qa-inline-list li {
    color: #cbd5e1;
    font-size: 0.75rem;
    line-height: 1.8;
}

.qa-note-line {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    color: #cbd5e1;
    font-size: 0.75rem;
    line-height: 1.8;
}

.qa-sync-guidance {
    margin-top: -0.7rem;
    margin-bottom: 1rem;
    padding: 0.68rem 0.82rem;
    border-radius: 8px;
    border: 1px solid rgba(250, 204, 21, 0.16);
    background: rgba(15, 23, 42, 0.34);
    color: #e2e8f0;
    font-size: 0.74rem;
    line-height: 1.9;
    display: grid;
    gap: 0.45rem;
}

.qa-sync-guidance strong {
    color: #f8fafc;
    font-size: 0.76rem;
}

.qa-sync-link {
    justify-self: start;
    font-size: 0.72rem;
    padding: 0.42rem 0.72rem;
}

.qa-evidence-panel summary {
    cursor: pointer;
    color: #e2e8f0;
    font-weight: 800;
    list-style: none;
}

.qa-evidence-panel summary::-webkit-details-marker {
    display: none;
}

.qa-evidence-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.7rem;
}

.qa-evidence-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 9px;
    padding: 0.72rem 0.82rem;
}

.qa-evidence-head {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: flex-start;
}

.qa-evidence-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 0.08rem 0.4rem;
    margin-left: 0.45rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
    font-size: 0.64rem;
    font-weight: 850;
}

.qa-evidence-subject {
    color: #e5eefb;
    font-size: 0.82rem;
    line-height: 1.8;
}

.qa-evidence-meta {
    display: grid;
    gap: 0.12rem;
    text-align: left;
    color: #94a3b8;
    font-size: 0.67rem;
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: nowrap;
}

.qa-evidence-snippet {
    margin: 0.5rem 0 0;
    color: #cbd5e1;
    font-size: 0.75rem;
    line-height: 1.85;
}

.qa-evidence-panel {
    margin-bottom: 1rem;
}

.qa-action-items {
    display: grid;
    gap: 0.55rem;
}

.qa-action-item {
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 9px;
    padding: 0.72rem 0.82rem;
}

.qa-action-head {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: flex-start;
}

.qa-action-reason {
    flex: 0 0 auto;
    color: #bae6fd;
    font-size: 0.68rem;
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.16);
    white-space: nowrap;
}

.qa-action-text {
    margin-top: 0.48rem;
    color: #cbd5e1;
    font-size: 0.74rem;
    line-height: 1.85;
}

.qa-advanced-panel summary {
    cursor: pointer;
    color: #dbeafe;
    font-weight: 800;
    list-style: none;
}

.qa-advanced-panel summary::-webkit-details-marker {
    display: none;
}

.qa-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.qa-advanced-row {
    background: rgba(15, 23, 42, 0.34);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 0.6rem 0.68rem;
    min-width: 0;
}

.qa-advanced-label {
    display: block;
    color: #94a3b8;
    font-size: 0.66rem;
    margin-bottom: 0.22rem;
}

.qa-advanced-value {
    display: block;
    color: #e5eefb;
    font-size: 0.76rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .qa-evidence-head,
    .qa-compact-row,
    .qa-action-head {
        flex-direction: column;
    }

    .qa-evidence-meta,
    .qa-compact-count {
        white-space: normal;
        text-align: right;
        direction: rtl;
    }
}

.email-body-view {
    direction: rtl;
    text-align: right;
    unicode-bidi: plaintext;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 1rem;
    overflow-wrap: anywhere;
}

.email-body-html {
    direction: initial;
    text-align: initial;
}

.email-body-view img,
.email-body-view table {
    max-width: 100%;
}

.email-body-view img {
    height: auto;
}

@media print {

    .beta-note,
    .experimental-badge {
        display: none !important;
    }
}

/* Login page redesign - compact */

body.login-page-body {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: #050814;
}

.login-page {
    position: relative;
    isolation: isolate;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    direction: rtl;
    color: #e5edf8;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 18%, rgba(56, 189, 248, 0.13), transparent 30%),
        radial-gradient(circle at 82% 82%, rgba(139, 92, 246, 0.12), transparent 34%),
        linear-gradient(135deg, #050814 0%, #0b1020 50%, #070b16 100%);
}

.login-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.login-orb {
    position: absolute;
    display: block;
    width: 22rem;
    height: 22rem;
    border-radius: 999px;
    filter: blur(72px);
    opacity: 0.5;
    animation: loginSoftDrift 18s ease-in-out infinite alternate;
}

.login-orb-1 {
    top: -8rem;
    right: -8rem;
    background: rgba(14, 165, 233, 0.24);
}

.login-orb-2 {
    left: -9rem;
    bottom: -9rem;
    background: rgba(124, 58, 237, 0.2);
    animation-delay: -7s;
}

.login-panel {
    width: min(100%, 380px);
    padding: 1.35rem;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.74)),
        rgba(15, 23, 42, 0.74);
    border: 1px solid rgba(226, 232, 240, 0.11);
    box-shadow:
        0 24px 72px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: loginFadeUp 520ms ease both;
}

.login-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.login-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background:
        radial-gradient(circle at 34% 28%, #dbeafe 0 8%, transparent 9%),
        linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(139, 92, 246, 0.16));
    border: 1px solid rgba(125, 211, 252, 0.24);
    box-shadow: 0 0 24px rgba(14, 165, 233, 0.14);
}

.login-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.24);
    background: rgba(250, 204, 21, 0.08);
    color: #fde68a;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    padding: 0.38rem 0.62rem;
    white-space: nowrap;
}

.login-version {
    margin: 0;
    color: #7dd3fc;
    font-size: 0.8rem;
}

.login-header {
    margin-bottom: 1.1rem;
}

.login-title {
    margin: 0 0 0.45rem;
    color: #f8fafc;
    font-size: 1.28rem;
    font-weight: 850;
    line-height: 1.55;
    letter-spacing: -0.02em;
}

.login-subtitle {
    margin: 0;
    color: #93a4bc;
    font-size: 0.82rem;
    line-height: 1.95;
}

.login-error {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    color: #fecaca;
    background: rgba(239, 68, 68, 0.09);
    border: 1px solid rgba(248, 113, 113, 0.24);
    font-size: 0.8rem;
    line-height: 1.8;
}

.login-form {
    display: grid;
    gap: 0.82rem;
}

.login-field {
    display: grid;
    gap: 0.38rem;
}

.login-label {
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 750;
}

.login-password-wrap {
    position: relative;
}

.login-input {
    width: 100%;
    min-height: 44px;
    padding: 0.68rem 0.82rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 13px;
    outline: none;
    background: rgba(2, 6, 23, 0.4);
    color: #e2e8f0;
    direction: ltr;
    text-align: left;
    font: inherit;
    font-size: 0.88rem;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease;
}

.login-password-input {
    padding-left: 4.2rem;
}

.login-input::placeholder {
    color: #64748b;
}

.login-input:hover {
    border-color: rgba(148, 163, 184, 0.32);
    background: rgba(2, 6, 23, 0.5);
}

.login-input:focus,
.login-input:focus-visible {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(2, 6, 23, 0.58);
    box-shadow:
        0 0 0 3px rgba(14, 165, 233, 0.13),
        0 0 22px rgba(14, 165, 233, 0.08);
}

.login-password-toggle {
    position: absolute;
    left: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    min-width: 50px;
    padding: 0 0.55rem;
    border: 0;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    color: #9aa8bc;
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    transition:
        color 150ms ease,
        background 150ms ease,
        box-shadow 150ms ease;
}

.login-password-toggle:hover {
    color: #dbeafe;
    background: rgba(148, 163, 184, 0.13);
}

.login-password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

.login-submit {
    position: relative;
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 0.15rem;
    border: 0;
    border-radius: 13px;
    color: #04111f;
    background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 56%, #a78bfa 100%);
    box-shadow:
        0 14px 30px rgba(14, 165, 233, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 850;
    cursor: pointer;
    transition:
        transform 150ms ease,
        box-shadow 150ms ease,
        filter 150ms ease,
        opacity 150ms ease;
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow:
        0 17px 36px rgba(14, 165, 233, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.login-submit:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 4px rgba(14, 165, 233, 0.22),
        0 17px 36px rgba(14, 165, 233, 0.24);
}

.login-submit:disabled {
    cursor: wait;
    opacity: 0.78;
}

.login-submit-spinner {
    width: 16px;
    height: 16px;
    display: none;
    border-radius: 999px;
    border: 2px solid rgba(4, 17, 31, 0.25);
    border-top-color: rgba(4, 17, 31, 0.88);
    animation: loginSpin 700ms linear infinite;
}

.login-submit.is-loading .login-submit-spinner {
    display: inline-block;
}

.login-trust-note {
    margin: 0.85rem 0 0;
    color: #8fa1b8;
    font-size: 0.74rem;
    line-height: 1.85;
}

.login-hints {
    display: grid;
    gap: 0.42rem;
    margin: 0.9rem 0 0;
    padding: 0;
    list-style: none;
}

.login-hints li {
    position: relative;
    padding-right: 0.75rem;
    color: #aab8cc;
    font-size: 0.73rem;
    line-height: 1.7;
}

.login-hints li::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0.72em;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #38bdf8;
    opacity: 0.8;
}

@keyframes loginFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes loginSoftDrift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }

    to {
        transform: translate3d(1.2rem, -0.9rem, 0) scale(1.04);
    }
}

@keyframes loginSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 440px) {
    .login-page {
        padding: 0.75rem;
        align-items: center;
    }

    .login-panel {
        padding: 1.05rem;
        border-radius: 18px;
    }

    .login-title {
        font-size: 1.16rem;
    }

    .login-subtitle {
        font-size: 0.78rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    .login-orb,
    .login-panel,
    .login-submit-spinner {
        animation: none !important;
    }

    .login-input,
    .login-submit,
    .login-password-toggle {
        transition: none !important;
    }
}
