/* Ironman Compliance Platform — Branded Styles */

:root {
    --gn-burgundy: #981e32;
    --gn-burgundy-dark: #7a1828;
    --gn-burgundy-light: #b22a40;
    --gn-gray: #949596;
    --gn-gray-light: #e8e8e9;
    --gn-gray-dark: #6b6c6d;
    --gn-white: #ffffff;
    --gn-bg: #f5f5f6;
    --sidebar-width: 280px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gn-bg);
    color: #333;
    min-height: 100vh;
}

/* ── Layout ────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--gn-burgundy);
    color: var(--gn-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar-header {
    padding: 12px 10px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}

.rocky-frame {
    width: 100%;
    padding: 6px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin-bottom: 8px;
}

.rocky-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.sidebar-brand-name {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-section {
    padding: 12px 20px 8px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: var(--gn-white);
    font-size: 13px;
    transition: border-color 0.2s;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.search-input:focus {
    border-color: rgba(255,255,255,0.5);
    outline: none;
    background: rgba(255,255,255,0.15);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--gn-white);
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--gn-white);
    border-left-color: var(--gn-white);
    font-weight: 600;
}

.sidebar-nav a .tab-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

/* ── Main Content ──────────────────────────── */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
}

.tab-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gn-gray-light);
}

.tab-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gn-burgundy);
}

/* ── Tab Content Panels ────────────────────── */

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ── Cards ─────────────────────────────────── */

.card {
    background: var(--gn-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gn-gray-light);
}

/* ── Stat Boxes ────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--gn-white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid var(--gn-burgundy);
}

.stat-box .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gn-burgundy);
}

.stat-box .stat-label {
    font-size: 13px;
    color: var(--gn-gray);
    margin-top: 4px;
}

.stat-box.stat-success { border-left-color: #2e7d32; }
.stat-box.stat-success .stat-value { color: #2e7d32; }
.stat-box.stat-warning { border-left-color: #e65100; }
.stat-box.stat-warning .stat-value { color: #e65100; }
.stat-box.stat-danger { border-left-color: #c62828; }
.stat-box.stat-danger .stat-value { color: #c62828; }

/* ── Tables ────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--gn-bg);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gn-gray-dark);
    border-bottom: 2px solid var(--gn-gray-light);
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    color: var(--gn-burgundy);
}

.data-table th.sort-asc::after {
    content: ' \25B2';
    font-size: 10px;
}

.data-table th.sort-desc::after {
    content: ' \25BC';
    font-size: 10px;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gn-gray-light);
    font-size: 14px;
}

.data-table tr:hover {
    background: rgba(152, 30, 50, 0.03);
}

/* ── Buttons ───────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gn-burgundy);
    color: var(--gn-white);
}

.btn-primary:hover {
    background: var(--gn-burgundy-dark);
}

.btn-secondary {
    background: var(--gn-gray-light);
    color: #333;
}

.btn-secondary:hover {
    background: #ddd;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-danger {
    background: #c62828;
    color: #fff;
}

.btn-danger:hover {
    background: #a01f1f;
}

/* ── Loading / htmx ───────────────────────── */

.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gn-gray-light);
    border-top-color: var(--gn-burgundy);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Placeholder State ─────────────────────── */

.placeholder-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gn-gray);
}

.placeholder-state .placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-state h2 {
    font-size: 20px;
    color: #666;
    margin-bottom: 8px;
}

.placeholder-state p {
    font-size: 14px;
}

/* ── Form Elements ─────────────────────────── */

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gn-gray-light);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--gn-burgundy);
    box-shadow: 0 0 0 2px rgba(152, 30, 50, 0.1);
}

/* ── CIS Controls ─────────────────────────── */

.cis-accordion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cis-control-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--gn-white);
    border: 1px solid var(--gn-gray-light);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.cis-control-header:hover {
    background: #f8f8f8;
}

.cis-control-header.expanded {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    background: #f5f5f5;
}

.cis-control-arrow {
    font-size: 14px;
    color: var(--gn-gray);
    width: 16px;
    text-align: center;
    transition: transform 0.2s;
}

.cis-control-header.expanded .cis-control-arrow {
    transform: rotate(90deg);
}

.cis-control-number {
    font-weight: 700;
    color: var(--gn-burgundy);
    font-size: 14px;
    min-width: 24px;
}

.cis-control-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.cis-control-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--gn-burgundy);
    background: rgba(152, 30, 50, 0.08);
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid rgba(152, 30, 50, 0.25);
    min-width: 42px;
    text-align: center;
}

.cis-control-body {
    border: 1px solid var(--gn-gray-light);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 16px;
    background: var(--gn-white);
}

.cis-control-desc {
    font-size: 14px;
    color: #343a40;
    font-style: italic;
    margin: 0 0 14px 0;
    line-height: 1.5;
}

/* Progress bars */
.cis-progress-bar {
    height: 8px;
    background: var(--gn-gray-light);
    border-radius: 4px;
    overflow: hidden;
}

.cis-progress-fill {
    height: 100%;
    background: var(--gn-burgundy);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.cis-progress-fill.good { background: #2e7d32; }
.cis-progress-fill.ok { background: #e65100; }
.cis-progress-fill.low { background: #c62828; }

/* Safeguard table */
.cis-table th {
    font-size: 12px;
}

.cis-table td {
    font-size: 13px;
    padding: 6px 8px;
    vertical-align: middle;
}

.cis-id {
    font-weight: 600;
    color: var(--gn-burgundy);
}

.ig-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    color: #fff;
    letter-spacing: 0.2px;
}

.ig-pill-1 { background: #2e7d32; }
.ig-pill-2 { background: #0277bd; }
.ig-pill-3 { background: #ef6c00; }

.sg-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.sg-pill-asset {
    background: #e8eaf6;
    color: #283593;
}
.sg-pill-func {
    background: #f3e5f5;
    color: #4a148c;
}

.cis-status-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--gn-gray-light);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    background: var(--gn-white);
}

.cis-status-select.status-compliant {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

.cis-status-select.status-partial {
    background: #fff3e0;
    border-color: #ffcc80;
    color: #e65100;
}

.cis-status-select.status-noncompliant {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.cis-status-select.status-na {
    background: #f5f5f5;
    color: #999;
}

.cis-notes-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--gn-gray-light);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    background: transparent;
}

.cis-notes-input:focus {
    outline: none;
    border-color: var(--gn-burgundy);
    background: var(--gn-white);
}

/* Status row backgrounds */
.status-row-compliant { background: #f6faf6; }
.status-row-noncompliant { background: #fef6f6; }
.status-row-partial { background: #fefaf4; }

/* ── Safeguard Detail Panel ───────────────── */

.cis-row.has-detail {
    cursor: pointer;
}

.cis-row.has-detail:hover {
    background: #f5f0f1 !important;
}

.cis-row.detail-open {
    background: #f0eaec !important;
}

.cis-detail-row td {
    padding: 0 !important;
    border-top: none !important;
}

.cis-detail-panel {
    margin: 0 12px 12px 12px;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    border-left: 4px solid var(--gn-burgundy);
}

.cis-detail-header {
    margin-bottom: 10px;
}

.cis-detail-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.cis-detail-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.cis-detail-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-left: 4px;
}

.cis-detail-label:first-child {
    margin-left: 0;
}

.cis-detail-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.cis-badge-asset {
    background: #e8eaf6;
    color: #283593;
    border: 1px solid #c5cae9;
}

.cis-badge-function {
    color: #fff;
    border: none;
}

.cis-func-identify { background: #0277bd; }
.cis-func-protect  { background: #2e7d32; }
.cis-func-detect   { background: #ef6c00; }
.cis-func-respond  { background: #c62828; }
.cis-func-recover  { background: #6a1b9a; }
.cis-func-govern   { background: #37474f; }

.cis-badge-ig {
    color: #fff;
    border: none;
    min-width: 28px;
    text-align: center;
}

.cis-badge-ig1 { background: #2e7d32; }
.cis-badge-ig2 { background: #0277bd; }
.cis-badge-ig3 { background: #ef6c00; }

.cis-detail-description {
    font-size: 13px;
    line-height: 1.65;
    color: #343a40;
}

/* ── Safeguard Category Badges ─────────────── */

.sg-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    color: #fff;
    letter-spacing: 0.3px;
    vertical-align: middle;
    margin-left: 4px;
}

.sg-badge-asset {
    background: #546e7a;
}

/* Function colors (reuse existing) */
.sg-badge.cis-func-identify { background: #0277bd; }
.sg-badge.cis-func-protect  { background: #2e7d32; }
.sg-badge.cis-func-detect   { background: #ef6c00; }
.sg-badge.cis-func-respond  { background: #c62828; }
.sg-badge.cis-func-recover  { background: #6a1b9a; }
.sg-badge.cis-func-govern   { background: #37474f; }

/* ── Policy Link ──────────────────────────── */

.policy-link:hover {
    text-decoration: underline;
}

/* ── Control Detail ────────────────────────── */

.control-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.control-detail-header .btn {
    margin-left: auto;
}

.control-section {
    margin-bottom: 24px;
}

.control-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gn-burgundy);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gn-burgundy);
}

/* ── Document View ─────────────────────────── */

.document-banner {
    background: linear-gradient(135deg, var(--gn-burgundy) 0%, var(--gn-burgundy-dark) 100%);
    color: white;
    padding: 24px 28px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.document-banner-type {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.65);
    margin-bottom: 6px;
}

.document-banner-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.document-banner-meta {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-top: 6px;
}

.document-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.document-updated {
    margin-left: auto;
    font-size: 12px;
    color: var(--gn-gray);
}

.document-version-notice {
    background: #fff3e0;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #e65100;
    border-left: 4px solid #e65100;
}

.document-card {
    padding: 28px 32px;
}

.document-empty {
    color: var(--gn-gray);
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

.document-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.document-header h2 {
    flex: 1;
    font-size: 20px;
    color: var(--gn-burgundy);
}

.document-content {
    line-height: 1.75;
    color: #333;
    font-size: 14.5px;
    max-width: 900px;
}

.document-content h1 {
    font-size: 22px;
    margin: 28px 0 12px;
    color: var(--gn-burgundy);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gn-burgundy);
}

.document-content h2 {
    font-size: 19px;
    margin: 24px 0 10px;
    color: var(--gn-burgundy);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gn-gray-light);
}

.document-content h3 {
    font-size: 16px;
    margin: 20px 0 8px;
    color: #444;
}

.document-content h4 {
    font-size: 14px;
    margin: 16px 0 6px;
    color: #555;
    font-weight: 600;
}

.document-content p {
    margin: 8px 0;
}

.document-content p:empty,
.document-content br + br {
    display: none;
}

.document-content ul, .document-content ol {
    margin: 10px 0;
    padding-left: 28px;
}

.document-content li {
    margin: 5px 0;
    line-height: 1.6;
}

.document-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 13px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.document-content table th {
    background: var(--gn-bg);
    font-weight: 600;
    color: #444;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    text-align: left;
}

.document-content table td {
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

.document-content table tr:nth-child(even) {
    background: #fafafa;
}

.document-content table tr:hover {
    background: rgba(152, 30, 50, 0.03);
}

.document-content strong {
    color: #222;
}

.document-content em {
    color: #555;
}

/* ── Search Results ────────────────────────── */

.search-result {
    padding: 16px 0;
    border-bottom: 1px solid var(--gn-gray-light);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gn-burgundy);
    cursor: pointer;
}

.search-result-title:hover {
    text-decoration: underline;
}

.search-result-meta {
    font-size: 12px;
    color: var(--gn-gray);
    margin: 4px 0;
}

.search-result-excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.search-result-excerpt mark {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

/* ── Dashboard mini bars ───────────────────── */

.compliance-mini-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.mini-bar-label {
    flex: 0 0 200px;
    color: #444;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-bar-track {
    flex: 1;
    height: 16px;
    background: var(--gn-gray-light);
    border-radius: 4px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    background: var(--gn-burgundy);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s ease;
}

.mini-bar-fill.good { background: #2e7d32; }
.mini-bar-fill.ok { background: #e65100; }
.mini-bar-fill.low { background: #c62828; }

.mini-bar-pct {
    flex: 0 0 40px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gn-gray-dark);
}

/* ── Registers List ────────────────────────── */

.register-group {
    margin-bottom: 24px;
}

.register-group-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gn-burgundy);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gn-gray-light);
}

.register-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.register-item:hover {
    background: rgba(152, 30, 50, 0.03);
}

.register-item-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.register-item-date {
    font-size: 12px;
    color: var(--gn-gray);
}

/* ── Upcoming Reviews ──────────────────────── */

.review-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gn-gray-light);
}

.review-item:last-child {
    border-bottom: none;
}

.review-date {
    flex: 0 0 90px;
    font-size: 13px;
    font-weight: 600;
}

.review-date.overdue {
    color: #c62828;
}

.review-date.upcoming {
    color: #e65100;
}

.review-date.future {
    color: var(--gn-gray-dark);
}

.review-title {
    flex: 1;
    font-size: 14px;
}

.review-frequency {
    font-size: 12px;
    color: var(--gn-gray);
    background: var(--gn-gray-light);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ── Charts ────────────────────────────────── */

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    width: 100%;
    max-height: 300px;
}

/* ── Process Cards ────────────────────────── */

.process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.process-card {
    border-left: 4px solid var(--gn-burgundy);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

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

.process-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.process-card-desc {
    font-size: 13px;
    color: var(--gn-gray-dark);
    line-height: 1.5;
}

.process-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(152, 30, 50, 0.1);
    color: var(--gn-burgundy);
    margin-top: 8px;
}

/* ── Report Status ─────────────────────────── */

.report-status {
    font-size: 13px;
    font-weight: 600;
}

.report-status-ok { color: #2e7d32; }
.report-status-err { color: #c62828; }

/* ── Sidebar AI Chat Button ────────────────── */

.sidebar-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 16px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-chat-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.sidebar-chat-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* ── AI Chat Panel ─────────────────────────── */

.chat-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 480px;
    height: 600px;
    max-height: calc(100vh - 40px);
    background: var(--gn-white);
    border-radius: 12px 0 0 0;
    box-shadow: -4px -4px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow: hidden;
    animation: chatSlideIn 0.25s ease-out;
}

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

.chat-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--gn-burgundy) 0%, var(--gn-burgundy-dark) 100%);
    color: white;
}

.chat-header-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.chat-panel-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}

.chat-panel-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.2s;
}

.chat-panel-close:hover {
    background: rgba(255,255,255,0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafafa;
}

.chat-msg {
    display: flex;
    max-width: 88%;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg.assistant {
    align-self: flex-start;
}

.chat-msg-content {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
}

.chat-msg.user .chat-msg-content {
    background: var(--gn-burgundy);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant .chat-msg-content {
    background: white;
    color: #333;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chat-input-bar {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--gn-gray-light);
    background: white;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
    border-color: var(--gn-burgundy);
    box-shadow: 0 0 0 2px rgba(152, 30, 50, 0.1);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--gn-burgundy);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--gn-burgundy-dark);
    transform: scale(1.05);
}

.chat-new-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.2s;
}

.chat-new-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Chat message content formatting */
.chat-msg-content p { margin: 4px 0; }
.chat-msg-content ul { margin: 4px 0; padding-left: 18px; }
.chat-msg-content li { margin: 2px 0; }
.chat-msg-content code {
    background: rgba(0,0,0,0.06);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 12px;
}
.chat-msg-content strong { font-weight: 600; }

/* Citation badges */
.chat-citation {
    display: inline-block;
    background: rgba(152, 30, 50, 0.08);
    color: var(--gn-burgundy);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(152, 30, 50, 0.2);
    margin: 2px 0;
    cursor: pointer;
    transition: all 0.15s;
}

.chat-citation:hover {
    background: rgba(152, 30, 50, 0.15);
    border-color: var(--gn-burgundy);
}

/* Typing indicator */
.chat-typing {
    color: var(--gn-gray);
    font-style: italic;
    font-size: 13px;
}

.chat-typing::after {
    content: '';
    animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* ── Calendar ──────────────────────────────── */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-month-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gn-burgundy);
}

.calendar-grid {
    border: 1px solid var(--gn-gray-light);
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--gn-bg);
    border-bottom: 1px solid var(--gn-gray-light);
}

.calendar-day-header {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gn-gray-dark);
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell {
    min-height: 90px;
    padding: 6px 8px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.calendar-cell:nth-child(7n) {
    border-right: none;
}

.calendar-empty {
    background: #fafafa;
}

.calendar-today {
    background: rgba(152, 30, 50, 0.03);
}

.calendar-has-items {
    background: #fefefe;
}

.calendar-day-num {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.today-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gn-burgundy);
    color: white;
    font-weight: 700;
}

.calendar-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 1px 0;
    overflow: hidden;
    white-space: nowrap;
}

.calendar-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #444;
}

.calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendar-dot-monthly { background: #0277bd; }
.calendar-dot-quarterly { background: #ef6c00; }
.calendar-dot-semi-annual { background: #6a1b9a; }
.calendar-dot-annual { background: #2e7d32; }
.calendar-dot-one-time { background: var(--gn-gray); }

.calendar-more {
    font-size: 10px;
    color: var(--gn-gray);
    padding-top: 2px;
}

.overdue-alert {
    border-left: 4px solid #c62828;
    background: #fff8f8;
}

/* ── Evidence Panel ────────────────────────── */

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.evidence-item {
    background: var(--gn-bg);
    border: 1px solid var(--gn-gray-light);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.evidence-item-icon {
    font-size: 28px;
    text-align: center;
    opacity: 0.5;
}

.evidence-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.evidence-item-meta {
    font-size: 11px;
    color: var(--gn-gray);
}

.evidence-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.evidence-toggle-btn {
    padding: 4px 10px !important;
    font-size: 16px !important;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.evidence-toggle-btn:hover {
    opacity: 1;
    background: rgba(152, 30, 50, 0.08);
}

.inline-evidence {
    padding: 0 12px;
}

.evidence-inline-widget {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 4px 0;
}

.evidence-inline-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #e8e8e9;
}

.evidence-inline-item:last-child {
    border-bottom: none;
}

.evidence-inline-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.evidence-thumb-link {
    flex-shrink: 0;
}

.evidence-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.evidence-thumb:hover {
    border-color: var(--gn-burgundy);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.evidence-dropzone {
    border: 2px dashed var(--gn-gray-light);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    color: var(--gn-gray);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.evidence-dropzone:hover,
.evidence-dropzone.dragover {
    border-color: var(--gn-burgundy);
    background: rgba(152, 30, 50, 0.03);
    color: var(--gn-burgundy);
}

.evidence-dropzone-text {
    font-size: 14px;
    margin-top: 8px;
}

/* ── Responsive ────────────────────────────── */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }

    .main-content {
        padding: 16px 20px;
    }

    .chat-panel {
        width: 360px;
        height: 480px;
    }
}

/* ── IG Drilldown ──────────────────────── */
.ig-drilldown-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gn-burgundy);
    margin-bottom: 12px;
}

.stat-box[onclick] {
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-box[onclick]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
