/* Dashboard CSS for Counter Reports Hub */

:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
}

body.dashboard-body {
    background-color: #0b1120;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.dash-navbar {
    background-color: #0f172a;
    border-bottom: 1px solid #1e293b;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.dash-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.logo-text span { color: var(--accent-blue); }

.system-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dash-plant-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}
.plant-label { color: var(--text-muted); }
.plant-name { font-weight: 600; color: #fff; }
.status-indicator {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-indicator.online {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.dash-user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}
.btn-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.btn-back:hover { color: #fff; }

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #334155;
    font-size: 0.85rem;
}
.avatar {
    width: 24px;
    height: 24px;
    background: var(--accent-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.dash-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.dash-hero {
    margin-bottom: 24px;
}
.dash-hero-title h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 4px 0;
    color: #fff;
}
.dash-hero-title p {
    color: var(--text-muted);
    margin: 0 0 16px 0;
    font-size: 0.95rem;
}

.dash-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.dash-kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}
.kpi-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.kpi-value { font-size: 1.6rem; font-weight: 800; margin: 4px 0; }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }

.dash-filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.role-tabs {
    display: flex;
    gap: 6px;
    background: #1e293b;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #334155;
    flex-wrap: wrap;
}
.role-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.role-tab:hover { color: #fff; }
.role-tab.active {
    background: var(--accent-blue);
    color: #fff;
}

.search-box input {
    background: #1e293b;
    border: 1px solid #334155;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 260px;
    outline: none;
}
.search-box input:focus { border-color: var(--accent-blue); }

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.report-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, border-color 0.2s;
}
.report-card:hover {
    transform: translateY(-2px);
    border-color: #475569;
}
.report-card.featured {
    border-left: 4px solid var(--accent-blue);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.report-code {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}
.format-badges { display: flex; gap: 4px; }
.badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
}
.badge.pdf { background: #fee2e2; color: #991b1b; }
.badge.xlsx { background: #dcfce7; color: #166534; }
.badge.web { background: #e0e7ff; color: #3730a3; }
.badge.xml { background: #fef3c7; color: #92400e; }
.badge.json { background: #f3e8ff; color: #6b21a8; }
.badge.tg { background: #e0f2fe; color: #0369a1; }
.legal-badge { font-size: 0.7rem; background: #3b82f6; color: #fff; padding: 2px 6px; border-radius: 3px; font-weight: 700; }
.exec-badge { font-size: 0.7rem; background: #10b981; color: #fff; padding: 2px 6px; border-radius: 3px; font-weight: 700; }

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #fff;
    line-height: 1.3;
}
.card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    flex-grow: 1;
    line-height: 1.4;
}
.card-role-tag {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 14px;
    border-top: 1px dashed #334155;
    padding-top: 8px;
}

.card-actions {
    display: flex;
    gap: 8px;
}
.btn-action {
    flex: 1;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-align: center;
}
.btn-action.preview {
    background: #334155;
    color: #fff;
}
.btn-action.preview:hover { background: #475569; }
.btn-action.excel {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.btn-action.excel:hover { background: rgba(16, 185, 129, 0.25); }
.btn-action.primary {
    background: var(--accent-blue);
    color: #fff;
}
.btn-action.primary:hover { background: #2563eb; }

/* Scheduler Strip */
.dash-scheduler-strip {
    background: linear-gradient(90deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.sched-info h3 { margin: 0 0 4px 0; font-size: 1.1rem; color: #fff; }
.sched-info p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.btn-sched {
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: #93c5fd;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-sched:hover { background: rgba(59, 130, 246, 0.15); }

/* Verify Section */
.dash-verify-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px 24px;
}
.verify-box {
    display: flex;
    align-items: center;
    gap: 16px;
}
.verify-icon { font-size: 2rem; }
.verify-text { flex: 1; }
.verify-text h4 { margin: 0 0 4px 0; font-size: 1rem; color: #fff; }
.verify-text p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.verify-input-group {
    display: flex;
    gap: 8px;
}
.verify-input-group input {
    background: #0f172a;
    border: 1px solid #334155;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 320px;
}
.btn-verify {
    background: #334155;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-verify:hover { background: #475569; }

.verify-result-box {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 6px;
    background: #0f172a;
    border: 1px solid #334155;
    font-size: 0.85rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    overflow: hidden;
}
.modal-card.wide { max-width: 800px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #334155;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; color: #fff; }
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}
.modal-body { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.form-group select, .form-group input[type="text"] {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.radio-row { display: flex; gap: 16px; font-size: 0.85rem; }
.checkbox-label { font-size: 0.85rem; display: flex; align-items: center; gap: 8px; color: #cbd5e1; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #334155;
    background: #162032;
}
.btn-secondary {
    background: #334155;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.preview-kpi-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    background: #0f172a;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Floating Async Toast */
.async-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 320px;
    max-width: 420px;
}
.toast-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast-content { flex: 1; }
.toast-title { font-size: 0.9rem; font-weight: 700; color: #fff; }
.toast-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.toast-progress-bar {
    width: 100%;
    height: 4px;
    background: #334155;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.bar-fill {
    width: 15%;
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.3s ease;
}
.btn-download-toast {
    background: var(--accent-green);
    color: #fff;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}
.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
}

/* Rich Independent Preview Modal Styles */
.modal-card.wide {
    max-width: 960px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}
.modal-card.wide .modal-body {
    overflow-y: auto;
    padding: 20px 24px;
}
.preview-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
    gap: 10px;
}
.preview-title-area h4 {
    margin: 0 0 6px 0;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
}
.preview-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.badge-code {
    background: #3b82f6;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}
.badge-std {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}
.badge-role {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #475569;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
}
.preview-meta-right {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: right;
}
.preview-meta-right strong {
    color: #f8fafc;
}
.preview-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 768px) {
    .preview-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.preview-kpi-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.preview-kpi-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.preview-kpi-val {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 4px;
}
.preview-kpi-desc {
    font-size: 0.72rem;
    color: #64748b;
}

.preview-chart-box {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
    min-height: 250px;
}
.preview-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-table-box {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 18px;
}
.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}
.preview-table th {
    background: #1e293b;
    color: #cbd5e1;
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}
.preview-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #1e293b;
    color: #f1f5f9;
    white-space: nowrap;
}
.preview-table tr:last-child td {
    border-bottom: none;
}
.preview-table tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.preview-insight-box {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.insight-icon {
    font-size: 1.25rem;
    line-height: 1;
}
.insight-text {
    font-size: 0.84rem;
    line-height: 1.45;
    color: #e2e8f0;
}
.insight-text strong {
    color: #fff;
}

/* Custom visual components for specialized reports */
.toir-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toir-item {
    background: #162032;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 10px 14px;
}
.toir-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.toir-bar-wrap {
    height: 8px;
    background: #0f172a;
    border-radius: 4px;
    overflow: hidden;
}
.toir-bar-inner {
    height: 100%;
    border-radius: 4px;
}

.preview-code-box {
    background: #020617;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: #38bdf8;
    overflow-x: auto;
    max-height: 220px;
    line-height: 1.5;
}

/* Responsive Split Layouts for Specialized Previews (EN-07, EN-08) & Firefox / Mobile Fix */
.grid-preview-split {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
    width: 100%;
    min-width: 0;
}
.grid-chart-col {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}
.energy-preview-split {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 14px;
    width: 100%;
    min-width: 0;
}
.energy-chart-col {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

@media (max-width: 900px) {
    .grid-preview-split,
    .energy-preview-split {
        grid-template-columns: 1fr;
    }
}


