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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    height: 100dvh;
    overflow: hidden;
}

/* ─── Dashboard ──────────────────────────────────────────────────────────────── */

#dashboard-page {
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
}

.db-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 0 0 32px;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.db-scroll::-webkit-scrollbar { width: 5px; }
.db-scroll::-webkit-scrollbar-track { background: transparent; }
.db-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Top bar */
.db-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 14px;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    background: #f5f5f5;
    z-index: 10;
}

.db-topbar-left { display: flex; flex-direction: column; gap: 2px; }
.db-title { font-size: 20px; font-weight: 700; color: #1a1a1a; letter-spacing: -.3px; }
.db-subtitle { font-size: 12px; color: #888; }

.db-topbar-right { display: flex; align-items: center; gap: 12px; }
.db-updated { font-size: 11px; color: #999; }

.db-refresh-btn {
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
}
.db-refresh-btn:hover { background: #d93838; color: #fff; border-color: #d93838; }
.db-refresh-btn:disabled { opacity: .5; cursor: not-allowed; }

/* KPI row */
.db-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 20px 28px 0;
}

.db-kpi-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: box-shadow .2s, transform .2s;
}
.db-kpi-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }

.db-kpi-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.db-kpi-body { display: flex; flex-direction: column; gap: 2px; }
.db-kpi-val { font-size: 22px; font-weight: 700; color: #1a1a1a; line-height: 1; }
.db-kpi-label { font-size: 11px; color: #888; font-weight: 500; }

/* Grid rows */
.db-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 28px 0;
}

/* Cards */
.db-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
.db-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }

.db-card-wide { grid-column: span 1; }

.db-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.db-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.db-card-hint {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Charts */
.db-chart-area {
    flex: 1;
    min-height: 0;
}

.db-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
    color: #bbb;
    font-size: 13px;
}

/* List items */
.db-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    max-height: 280px;
    scrollbar-width: thin;
    scrollbar-color: #eee transparent;
}

.db-list-empty {
    color: #bbb;
    font-size: 13px;
    padding: 20px 0;
    text-align: center;
}

.db-list-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    transition: border-color .15s, background .15s;
}
.db-list-item:hover { border-color: #ddd; background: #fff; }

.db-li-icon {
    width: 32px; height: 32px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.db-li-icon-dc      { background: #fff0f0; }
.db-li-icon-news    { background: #f0f4ff; }
.db-li-icon-filing  { background: #fff8f0; }
.db-li-icon-event   { background: #f0fff4; }

.db-li-body { flex: 1; min-width: 0; }
.db-li-title {
    font-size: 12px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-li-sub {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-li-summary {
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.db-li-form {
    color: #aaa;
    font-weight: 400;
    font-size: 11px;
}

/* Tags/badges */
.db-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    cursor: default;
}
a.db-tag { cursor: pointer; }
.db-tag-green  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.db-tag-blue   { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.db-tag-red    { background: #fff1f2; color: #dc2626; border: 1px solid #fecaca; }
.db-tag-yellow { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

@media (max-width: 1100px) {
    .db-kpi-row { grid-template-columns: repeat(3, 1fr); }
    .db-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .db-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .db-topbar { padding: 14px 16px 10px; }
    .db-row, .db-kpi-row { padding-left: 16px; padding-right: 16px; }
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: #1B1B1B;
    padding: 20px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #d93838;
    margin-bottom: 40px;
    text-align: center;
}

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

.nav-item {
    padding: 12px 16px;
    color: #ccc;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #16213e;
    color: white;
}

.nav-item.active {
    background: #d93838;
    color: white;
}

.main-content {
    margin-left: 250px;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.page {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.page.active {
    display: flex;
}

h1 {
    margin: 0;
    padding: 30px 30px 20px 30px;
    color: #1a1a2e;
    flex-shrink: 0;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px 20px 30px;
    flex-wrap: wrap;
    gap: 15px;
    flex-shrink: 0;
}

.view-controls {
    display: flex;
    gap: 10px;
}

.view-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.view-btn:hover {
    background: #e0e0e0;
}

.view-btn.active {
    background: #d93838;
    color: white;
    border-color: #d93838;
}

.action-controls {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    background: #d93838;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn:hover {
    background: #c02828;
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #d93838;
}

.projects-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 30px;
    min-height: 0;
}

.projects-container {
    display: grid;
    gap: 20px;
    padding-bottom: 20px;
}

.project-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.project-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.project-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.project-id {
    font-size: 12px;
    color: #666;
}

.project-value {
    font-size: 20px;
    font-weight: bold;
    color: #d93838;
}

.project-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.detail-item {
    font-size: 14px;
}

.detail-label {
    color: #666;
    font-weight: 500;
}

.detail-value {
    color: #333;
}

.project-card.data-center {
    border-left: 4px solid #d93838;
    background: linear-gradient(135deg, #ffffff 0%, #fff0f0 100%);
}

.dc-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #d93838;
    color: white;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 10px;
    vertical-align: middle;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.project-fetched {
    font-size: 11px;
    color: #999;
}

.pagination-footer {
    flex-shrink: 0;
    background: white;
    border-top: 2px solid #e0e0e0;
    padding: 15px 30px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.page-btn {
    padding: 8px 12px;
    background: white;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.page-btn:hover {
    background: #f0f0f0;
    border-color: #d93838;
}

.page-btn.active {
    background: #d93838;
    color: white;
    border-color: #d93838;
}

.page-info {
    margin-left: 15px;
    color: #666;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal.show {
    display: block;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.info-section {
    margin-bottom: 30px;
}

.info-section h3 {
    color: #1a1a2e;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #d93838;
}

.info-section h4 {
    color: #1a1a2e;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 16px;
}

.info-section h5 {
    color: #666;
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.note-item, .event-item, .participant-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #d93838;
}

.note-type, .event-name, .participant-role {
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 5px;
}

.note-description, .event-details, .participant-details {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.timestamp {
    font-size: 12px;
    color: #999;
    margin-top: 10px;
}

.project-info-count {
    display: inline-block;
    padding: 5px 12px;
    background: #ffe8e8;
    color: #d93838;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.filter-info {
    background: #fff0f0;
    padding: 12px 20px;
    margin: 0 30px 15px 30px;
    border-radius: 8px;
    border-left: 4px solid #d93838;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

.filter-info strong {
    color: #d93838;
    font-weight: 600;
}

.fetch-filters {
    background: #f9f9f9;
    padding: 15px 20px;
    margin: 0 30px 15px 30px;
    border-radius: 8px;
    border-left: 4px solid #d93838;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

.fetch-filters h4 {
    color: #d93838;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.fetch-filters .filter-row {
    margin: 5px 0;
}

.fetch-filters .filter-label {
    font-weight: 600;
    color: #333;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-overlay.show {
    display: flex;
}

.loader-content {
    background: white;
    padding: 30px 50px;
    border-radius: 10px;
    text-align: center;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #d93838;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Page Styles */
.modal.login-modal {
    background: linear-gradient(135deg, #1B1B1B 0%, #d93838 100%);
}

.modal.login-modal .modal-content {
    background: transparent;
    box-shadow: none;
    max-width: none;
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    max-height: none;
}

.login-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 60px;
    width: 100%;
    max-width: 480px;
    animation: slideUp 0.5s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 180px;
    height: auto;
    margin-bottom: 30px;
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
    font-weight: 400;
}

.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-label svg {
    color: #d93838;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.form-input:focus {
    outline: none;
    border-color: #d93838;
    background: white;
    box-shadow: 0 0 0 4px rgba(217, 56, 56, 0.1);
}

.form-input::placeholder {
    color: #aaa;
}

.login-error {
    display: none;
    background: #fee;
    color: #c33;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
}

.login-button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1B1B1B 0%, #d93838 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(217, 56, 56, 0.4);
}

.login-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 56, 56, 0.5);
}

.login-button:active:not(:disabled) {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-button-icon {
    transition: transform 0.3s;
}

.login-button:hover:not(:disabled) .login-button-icon {
    transform: translateX(4px);
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    margin: 0;
}

.login-footer-text svg {
    color: #d93838;
    flex-shrink: 0;
}

/* Logout Button in Sidebar */
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(217, 56, 56, 0.1);
    color: #ff6b6b;
    border: 2px solid rgba(217, 56, 56, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s;
    margin-top: auto;
    width: 100%;
}

.logout-btn:hover {
    background: #d93838;
    color: white;
    border-color: #d93838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 56, 56, 0.3);
}

.logout-btn svg {
    transition: transform 0.3s;
}

.logout-btn:hover svg {
    transform: translateX(4px);
}

/* Intelligence Enrichment Styles */

.intelligence-tabs .tab-header .view-btn {
    border-radius: 6px 6px 0 0;
    margin-right: 5px;
}

.intelligence-tabs .tab-header .view-btn.active {
    background: #1a1a2e;
    border-color: #1a1a2e;
}

.tab-content {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    border: 1px solid #ddd;
    border-top: none;
}

.report-section {
    margin-bottom: 20px;
}

.report-section h4 {
    margin-bottom: 10px;
    font-size: 15px;
    border-left: 3px solid #d93838;
    padding-left: 10px;
}

/* ─── Reports Page ──────────────────────────────────────────────────────────── */

#reports-page {
    overflow: hidden;
    flex-direction: column;
}

/* Cards view */
#reports-cards-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.reports-page-header {
    padding: 24px 30px 8px;
    flex-shrink: 0;
}

.reports-page-header h1 {
    padding: 0;
    margin: 0 0 4px;
}

.reports-subtitle {
    color: #666;
    font-size: 14px;
    margin: 0 0 16px;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 8px 30px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Individual card */
.report-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px 20px;
    border: 1px solid #e0e4ef;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}

.report-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
}

.report-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.report-badge {
    background: #003366;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.report-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
}

.report-card-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    flex: 1;
}

.report-card-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.report-option-label {
    font-size: 12px;
    color: #444;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.report-select {
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #333;
}

.report-generate-btn {
    font-size: 12px;
    padding: 7px 14px;
    background: #d93838;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background .2s;
    white-space: nowrap;
}

.report-generate-btn:hover { background: #b82e2e; }
.report-generate-btn:disabled { background: #aaa; cursor: not-allowed; }

/* History list inside card */
.report-history-wrap {
    border-top: 1px solid #eef0f6;
    padding-top: 10px;
}

.report-history-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #888;
    margin-bottom: 6px;
}

.report-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.report-history-loading,
.report-history-empty {
    font-size: 12px;
    color: #aaa;
    padding: 4px 0;
}

.report-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    background: #f7f9fc;
    border-radius: 6px;
    font-size: 12px;
}

.rhi-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rhi-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.rhi-status.completed  { background: #d4edda; color: #155724; }
.rhi-status.processing { background: #fff3cd; color: #856404; }
.rhi-status.failed     { background: #f8d7da; color: #721c24; }

.rhi-date   { color: #555; font-size: 11px; }
.rhi-meta   { color: #888; font-size: 11px; }

.rhi-processing { font-size: 11px; color: #856404; }

.rhi-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.rhi-btn {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .15s;
}

.rhi-btn:hover { opacity: .8; }

.rhi-view {
    background: #003366;
    color: #fff;
}

.rhi-dl {
    background: #e8eef7;
    color: #003366;
}

/* ─── Viewer ─────────────────────────────────────────────────────────────────── */

.reports-viewer {
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e4ef;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.viewer-back-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
    white-space: nowrap;
    transition: background .15s;
}

.viewer-back-btn:hover { background: #f0f4fa; }

.viewer-title {
    font-weight: 600;
    font-size: 14px;
    color: #003366;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.viewer-dl-btn {
    background: #003366;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
}

.viewer-dl-btn:hover { background: #002244; }

.reports-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #f5f5f5;
}

/* ─── Toast ──────────────────────────────────────────────────────────────────── */

.reports-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    z-index: 9999;
    transition: opacity .4s;
    pointer-events: none;
    max-width: 340px;
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

.reports-toast-info    { background: #003366; }
.reports-toast-success { background: #155724; }
.reports-toast-error   { background: #721c24; }

/* Responsive: collapse to 2 cols on narrower windows */
@media (max-width: 1200px) {
    .reports-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    .reports-grid { grid-template-columns: 1fr; }
}