/* Ekonomiportal — Shared styles */

:root {
    --primary: #5B4B8A;
    --primary-light: #7B6BA8;
    --primary-dark: #4A3B7A;
    --accent: #6B46C1;
    --danger: #CC0000;
    --warning: #856404;
    --bg: #f8f7fc;
    --card-bg: #ffffff;
    --text: #333;
    --text-muted: #808080;
    --border: #ddd;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ======================== */
/* PORTAL NAV               */
/* ======================== */
.portal-nav {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-brand a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.nav-apps {
    display: flex;
    gap: 0.25rem;
    margin-left: 1rem;
}
.nav-app-link {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-app-link:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-app-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
    font-weight: 600;
}
.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.nav-user-info {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    font-size: 0.8rem;
}
.nav-user-name { color: rgba(255,255,255,0.95); font-weight: 500; }
.nav-user-role {
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-logout {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
}
.nav-logout:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-admin-link { color: #ffc107 !important; font-weight: 600; }

/* ======================== */
/* APP SUB-NAVIGATION       */
/* ======================== */
.app-subnav {
    background: #f0f1f5;
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    gap: 0.25rem;
    height: 38px;
    align-items: center;
}
.subnav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
}
.subnav-link:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.subnav-link.active {
    color: var(--primary);
    background: white;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ======================== */
/* PORTAL HOME              */
/* ======================== */
.portal-home { padding: 1rem 0; }
.portal-home h1 { margin-bottom: 1.5rem; color: var(--primary); }

.app-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.app-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    border-top: 4px solid var(--primary);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
}
.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.app-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}
.app-card h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.app-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.app-card-status {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
}

/* ======================== */
/* CONTAINER & TYPOGRAPHY   */
/* ======================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

h1 { margin-bottom: 0.5rem; color: var(--primary); }
h2 { margin: 1.5rem 0 0.75rem; color: var(--primary); }
.subtitle { color: var(--text-muted); margin-bottom: 1rem; }
.page-description { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; line-height: 1.5; }

/* ======================== */
/* BUTTONS                  */
/* ======================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.btn:hover { background: #f0f0f0; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #ffeaec; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 2rem; font-size: 1rem; }
.actions { margin: 1rem 0; display: flex; gap: 0.5rem; }

/* ======================== */
/* TABLES                   */
/* ======================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
th {
    background: var(--primary);
    color: white;
    text-align: left;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 500;
}
td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
tr:hover td { background: #f8f7fc; }
tr { transition: background 0.15s; }
td:last-child { white-space: nowrap; }

/* ======================== */
/* STATUS BADGES            */
/* ======================== */
.status-ok { color: var(--accent); font-weight: 600; }
.status-error { color: var(--danger); font-weight: 600; }
.status-pending { color: var(--warning); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-critical { background: #ffeaec; color: var(--danger); }
.badge-warning { background: #fff3cd; color: var(--warning); }
.badge-ok { background: #e8f5e9; color: var(--accent); }
.badge-info { background: #d1ecf1; color: #5B4B8A; }

/* ======================== */
/* FORMS                    */
/* ======================== */
.form-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    max-width: 600px;
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 500; font-size: 0.9rem; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

select, input[type="password"], input[type="text"], input[type="number"], input[type="date"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white;
}
select:focus, input:focus { outline: none; border-color: var(--primary); }

textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal !important;
    cursor: pointer;
}
.checkbox-label input { width: auto; }

/* ======================== */
/* LOGIN                    */
/* ======================== */
.login-container {
    max-width: 360px;
    margin: 15vh auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    text-align: center;
}
.login-container h1 { font-size: 1.5rem; }
.login-container .subtitle { margin-bottom: 1.5rem; }
.login-container form { text-align: left; }
.login-container label { display: block; margin-bottom: 0.3rem; font-weight: 500; }
.login-container input { margin-bottom: 1rem; }
.login-container button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}
.login-container button:hover { filter: brightness(1.15); }

/* ======================== */
/* ALERTS                   */
/* ======================== */
.alert { padding: 0.6rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: #ffeaec; color: var(--danger); border: 1px solid #ffccd0; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* ======================== */
/* KPI GRID                 */
/* ======================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.kpi-card {
    background: var(--card-bg);
    padding: 1.2rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}
.kpi-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.kpi-value { font-size: 1.3rem; font-weight: 700; color: var(--primary); margin-top: 0.3rem; }

/* ======================== */
/* PROGRESS                 */
/* ======================== */
.progress-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    max-width: 600px;
    text-align: center;
}
.progress-bar-container {
    width: 100%;
    height: 24px;
    background: #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    border-radius: 12px;
    transition: width 0.4s ease;
    animation: progressShine 2s ease-in-out infinite;
}
@keyframes progressShine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.progress-step { color: var(--text-muted); margin-bottom: 0.3rem; }
.progress-pct { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.progress-text { font-weight: 500; margin-bottom: 0.25rem; }
.progress-detail { font-size: 0.85rem; color: var(--text-muted); }

/* ======================== */
/* EMPTY STATE              */
/* ======================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 1.5rem; }

/* ======================== */
/* UTILITY                  */
/* ======================== */
.loading { color: var(--text-muted); font-style: italic; }
.empty { color: var(--text-muted); padding: 2rem; text-align: center; }
.error { color: var(--danger); }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }

/* Delta colors */
.delta-pos { color: var(--accent); font-weight: 600; }
.delta-neg { color: var(--danger); font-weight: 600; }
.delta-flat { color: var(--text-muted); }

/* Trend arrows */
.trend-up { color: #2e7d32; font-weight: 700; }
.trend-down { color: #cc0000; font-weight: 700; }
.trend-flat { color: #999; }

/* Action buttons group */
.action-btns { display: flex; gap: 0.3rem; flex-wrap: wrap; }

/* ======================== */
/* HEATMAP                  */
/* ======================== */
.hm-controls { margin-bottom: 1.5rem; }
.hm-area { margin-bottom: 2rem; }
.hm-area h2 { margin-top: 0; font-size: 1.1rem; }
.hm-badge-rehab {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e0f2fe;
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 0.5rem;
}
.hm-table-wrap { overflow-x: auto; }
.hm-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    font-size: 0.85rem;
}
.hm-table th {
    background: var(--primary);
    color: white;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}
.hm-table td {
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: background 0.15s;
    white-space: nowrap;
}
.hm-unit-name { text-align: left !important; font-weight: 500; white-space: nowrap; }
.hm-table tr:hover td { background: #f0ecff; }
.hm-green { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.hm-yellow { background: #fff3cd; color: #856404; font-weight: 600; }
.hm-red { background: #ffeaec; color: #cc0000; font-weight: 600; }
.hm-gray { background: #f5f5f5; color: #999; }

.hm-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.hm-legend-item { display: flex; align-items: center; gap: 0.3rem; }
.hm-legend-sep { color: #ccc; }
.hm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.hm-dot.hm-green { background: #4caf50; }
.hm-dot.hm-yellow { background: #ffc107; }
.hm-dot.hm-red { background: #f44336; }

.hm-budget { font-size: 0.7rem; color: #666; font-weight: 400; }

/* ======================== */
/* DASHBOARD                */
/* ======================== */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.dash-header h1 { margin-bottom: 0; }
.dash-period { display: flex; align-items: center; gap: 0.5rem; }
.dash-period select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dash-kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.2rem;
    text-align: center;
}
.dash-kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dash-kpi-value { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin: 0.3rem 0; }
.dash-kpi-delta { font-size: 0.8rem; margin-bottom: 0.3rem; }
.dash-kpi-spark { display: flex; justify-content: center; }
.sparkline { display: block; }

/* Area barometer */
.dash-area-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.dash-area-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s;
    display: block;
}
.dash-area-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.dash-area-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.dash-tl { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tl-green { background: #2faa51; }
.tl-yellow { background: #f0ad4e; }
.tl-red { background: #cc0000; }
.dash-area-name { font-weight: 600; font-size: 0.95rem; }
.dash-area-metric { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.3rem; }
.dash-area-label { color: var(--text-muted); }
.dash-area-val { font-weight: 600; }
.dash-area-val.tl-green { color: #2e7d32; background: none; }
.dash-area-val.tl-yellow { color: #856404; background: none; }
.dash-area-val.tl-red { color: #cc0000; background: none; }
.dash-area-footer { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #eee; }

/* Bottom row */
.dash-bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dash-bottom-left, .dash-bottom-right {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.2rem;
}
.dash-bottom-left h2, .dash-bottom-right h2 { margin-top: 0; font-size: 1rem; margin-bottom: 0.75rem; }

/* Alert list */
.dash-alert-list { display: flex; flex-direction: column; gap: 0.4rem; }
.dash-alert-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
    font-size: 0.85rem;
}
.dash-alert-item:hover { background: #f0ecff; }
.dash-alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sev-critical .dash-alert-dot { background: var(--danger); }
.sev-warning .dash-alert-dot { background: #f0ad4e; }
.dash-alert-unit { font-weight: 600; min-width: 120px; }
.dash-alert-kpi { color: var(--text-muted); min-width: 100px; }
.dash-alert-msg { color: var(--text-muted); font-size: 0.8rem; }

/* Budget variance */
.dash-budget-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dash-budget-table th { background: var(--primary); color: white; padding: 0.4rem 0.6rem; font-size: 0.8rem; font-weight: 500; text-align: left; }
.dash-budget-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #eee; }
.bv-green td:last-child { color: #2e7d32; font-weight: 600; }
.bv-yellow td:last-child { color: #856404; font-weight: 600; }
.bv-red td:last-child { color: var(--danger); font-weight: 600; }

/* ======================== */
/* CHAT                     */
/* ======================== */
.chat-layout { display: flex; height: calc(100vh - 56px - 4rem); margin: -2rem; margin-top: -1rem; }
.chat-sidebar { width: 260px; min-width: 260px; background: var(--card-bg); border-right: 1px solid var(--border); padding: 1rem; overflow-y: auto; }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }
.chat-empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.chat-input-bar { display: flex; gap: 0.5rem; padding: 0.75rem 1.5rem; border-top: 1px solid var(--border); background: var(--card-bg); }
.chat-input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; resize: none; font-family: inherit; }
.chat-input:focus { outline: none; border-color: var(--primary); }

.chat-session-item { padding: 0.6rem 0.8rem; border-radius: var(--radius); cursor: pointer; margin-bottom: 0.25rem; transition: background 0.15s; }
.chat-session-item:hover { background: #f0ecff; }
.chat-session-item.active { background: #f0ecff; border-left: 3px solid var(--primary); }
.session-title { display: block; font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { font-size: 0.75rem; color: var(--text-muted); }

.chat-msg { margin-bottom: 1rem; display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant { justify-content: flex-start; }
.msg-bubble { max-width: 75%; padding: 0.75rem 1rem; border-radius: 12px; line-height: 1.5; font-size: 0.9rem; word-wrap: break-word; overflow-x: auto; }
.msg-user { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg-assistant { background: var(--card-bg); border: 1px solid #e0e0e0; border-bottom-left-radius: 4px; }
.msg-assistant table { margin: 0.5rem 0; font-size: 0.8rem; white-space: nowrap; }
.msg-assistant table td, .msg-assistant table th { padding: 0.25rem 0.5rem; }
.msg-artifact { margin-top: 0.5rem; }
.chat-chart { max-width: 100%; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.chat-tool-indicator { padding: 0.4rem 0.8rem; color: var(--text-muted); font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; }
.tool-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chat-thinking-indicator { padding: 0.5rem 0.8rem; color: var(--primary); font-size: 0.85rem; display: flex; align-items: center; gap: 0.5rem; background: rgba(91, 75, 138, 0.04); border-left: 2px solid var(--primary-light); margin: 0.3rem 0; border-radius: 0 var(--radius) var(--radius) 0; }
.thinking-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(91, 75, 138, 0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 1.2s linear infinite; }
.thinking-step { font-size: 0.75rem; color: var(--text-muted); }

/* ======================== */
/* COMMENTS / Q&A           */
/* ======================== */
#comments-section { margin-top: 2rem; }
.comment-thread { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1rem 1.5rem; margin-bottom: 1rem; }
.comment-thread.comment-resolved { opacity: 0.7; }
.comment-thread-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.comment-timeline { border-left: 2px solid #e0e0e0; padding-left: 1rem; margin-bottom: 0.75rem; }
.comment-item { margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; background: #f8f9ff; border-radius: var(--radius); }
.comment-item.comment-ai { border-left: 3px solid var(--primary); }
.comment-meta { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; display: flex; gap: 0.5rem; align-items: center; }
.comment-role { font-weight: 600; color: var(--primary); }
.comment-time { color: #aaa; }
.comment-content { font-size: 0.9rem; line-height: 1.5; }
.comment-reply { margin-top: 0.5rem; }
.comment-reply .form-row { display: flex; gap: 0.5rem; align-items: flex-start; }
.comment-reply-input { flex: 1; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; resize: vertical; font-family: inherit; }
.comment-new-thread { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; margin-top: 1rem; }
.comment-new-thread h3 { margin-bottom: 1rem; color: var(--primary); }

/* ======================== */
/* VEC Q&A                  */
/* ======================== */
.vec-section { margin-top: 2rem; }
.vec-question-card { background: var(--card-bg); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 1rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.vec-question-highlight { border-left-color: var(--accent); }
.vec-question-text { font-weight: 600; margin-bottom: 0.75rem; }
.vec-ai-text { font-size: 0.9rem; color: var(--text); margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; background: #f8f9ff; border-radius: var(--radius); line-height: 1.5; }
.vec-response { padding: 0.5rem 0.75rem; background: #f0ecff; border-radius: var(--radius); margin-bottom: 0.5rem; }
.vec-response-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.vec-response-content { font-size: 0.9rem; line-height: 1.5; }
.vec-response-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.vec-response-form .form-row { display: flex; gap: 0.5rem; align-items: end; }
.vec-enrich-btn { margin-top: 1rem; }
.enriched-banner { background: #e8f5e9; border-left: 4px solid var(--accent); padding: 1rem 1.5rem; border-radius: var(--radius); margin: 1rem 0; }
.enriched-banner h3 { margin-bottom: 0.5rem; font-size: 1rem; color: #2e7d32; }
.enriched-banner ul { padding-left: 1.5rem; margin: 0.3rem 0; }
.enriched-banner li { margin-bottom: 0.3rem; }
.vec-role-label { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 600; background: #f0ecff; color: var(--primary); }
.vec-author-name { font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

/* ======================== */
/* SYNC INDICATOR           */
/* ======================== */
.sync-indicator { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; background: rgba(255,255,255,0.1); cursor: pointer; transition: background 0.2s; }
.sync-indicator:hover { background: rgba(255,255,255,0.2); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sync-dot-ok { background: #2faa51; }
.sync-dot-empty { background: #f0ad4e; }
.sync-dot-running { background: #5bc0de; animation: pulse 1.5s ease infinite; }
.sync-dot-unknown { background: #999; }
.sync-label { color: rgba(255,255,255,0.85); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Sync page */
.sync-page { max-width: 800px; margin: 0 auto; }
.sync-page h1 { margin-bottom: 0.25rem; }
.sync-page .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.sync-status-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.sync-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; text-align: center; }
.sync-stat-label { display: block; font-size: 0.8rem; color: var(--text-muted); }
.sync-stat-value { display: block; font-size: 1.3rem; font-weight: 600; color: var(--primary); margin-top: 0.25rem; }
.sync-controls { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.sync-period { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.sync-period label { font-weight: 500; }
.sync-period select { padding: 0.4rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; }
.sync-buttons { display: flex; gap: 0.75rem; }
.sync-buttons .btn { flex: 1; }
.sync-progress { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.sync-info { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; }
.sync-info h3 { margin-bottom: 0.75rem; }
.sync-info ul { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.sync-info li { margin-bottom: 0.5rem; }

/* ======================== */
/* ALERTS PAGE              */
/* ======================== */
.al-summary-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.al-badge { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 16px; font-size: 0.85rem; font-weight: 600; }
.al-badge-critical { background: #ffeaec; color: var(--danger); }
.al-badge-warning { background: #fff3cd; color: var(--warning); }
.al-badge-info { background: #d1ecf1; color: #5B4B8A; }
.al-badge-total { color: var(--text-muted); font-size: 0.85rem; }
.al-filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.al-filters select { padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; }
.al-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,0.06); margin-bottom: 0.5rem; text-decoration: none; color: var(--text); transition: box-shadow 0.15s; border-left: 3px solid transparent; }
.al-item:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.al-critical { border-left-color: var(--danger); }
.al-warning { border-left-color: #f0ad4e; }
.al-info { border-left-color: #17a2b8; }
.al-item .al-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.al-critical .al-dot { background: var(--danger); }
.al-warning .al-dot { background: #f0ad4e; }
.al-info .al-dot { background: #17a2b8; }
.al-item-main { flex: 1; min-width: 0; }
.al-item-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.al-unit { font-weight: 600; font-size: 0.9rem; }
.al-item-detail { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }
.al-kpi { font-weight: 500; }
.al-item-ref { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* ======================== */
/* TRENDS PAGE              */
/* ======================== */
.tr-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.tr-chart-box { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1rem; height: 300px; position: relative; }
.tr-movers-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.tr-movers-col { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.2rem; }
.tr-movers-title { font-size: 1rem; margin-bottom: 0.75rem; margin-top: 0; }
.tr-movers-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tr-movers-table th { background: var(--primary); color: white; padding: 0.4rem 0.6rem; font-size: 0.8rem; font-weight: 500; text-align: left; }
.tr-movers-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #eee; }

/* ======================== */
/* BATCH                    */
/* ======================== */
.batch-section { margin-top: 2.5rem; padding-top: 2rem; border-top: 2px solid #e8e8e8; }
.batch-section h2 { margin-top: 0; }
.batch-preview { background: #f0ecff; border: 1px solid #d0d8f0; border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; color: var(--primary); }
.batch-overall { margin-bottom: 1.5rem; }
.batch-current { padding-top: 1rem; border-top: 1px solid #eee; }
.batch-current-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.progress-bar-sm { height: 12px; }
.progress-bar-sm .progress-bar { border-radius: 6px; }
.batch-units-card { background: var(--card-bg); padding: 1.5rem; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-top: 1.5rem; }
.batch-units-card h2 { margin-top: 0; }

/* ======================== */
/* RESULT CARD              */
/* ======================== */
.result-card { background: var(--card-bg); padding: 2rem; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: 600px; margin-top: 1.5rem; }
.result-card .actions { margin-top: 1rem; }

/* ======================== */
/* ADMIN PANEL              */
/* ======================== */
.adm-page { max-width: 1100px; margin: 0 auto; }
.adm-page h1 { margin-bottom: 0.25rem; }
.adm-bootstrap-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 2rem; text-align: center; margin-bottom: 1.5rem; }
.adm-bootstrap-card h2 { margin-top: 0; }
.adm-bootstrap-card p { color: var(--text-muted); margin-bottom: 1.5rem; }
.adm-create-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 1.5rem; margin-bottom: 1.5rem; }
.adm-create-card h2 { margin-top: 0; margin-bottom: 1rem; }
.adm-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.08); font-size: 0.85rem; }
.adm-table th { background: var(--primary); color: white; padding: 0.6rem 0.8rem; font-size: 0.8rem; font-weight: 500; text-align: left; }
.adm-table td { padding: 0.5rem 0.8rem; border-bottom: 1px solid #eee; vertical-align: middle; }
.adm-table tr:hover td { background: #f8f7fc; }
.adm-role-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.adm-role-admin { background: #e3f2fd; color: #1565c0; }
.adm-role-cfo { background: #fce4ec; color: #c62828; }
.adm-role-ao_chef { background: #fff3e0; color: #e65100; }
.adm-role-controller { background: #f3e5f5; color: #6a1b9a; }
.adm-role-vec { background: #e8f5e9; color: #2e7d32; }
.adm-chip { display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.7rem; background: #f0ecff; color: var(--primary); margin: 0.1rem; white-space: nowrap; }
.adm-chip-more { background: #e0e0e0; color: #666; }
.adm-units-cell { max-width: 250px; }
.adm-active { color: var(--accent); font-weight: 600; }
.adm-inactive { color: var(--danger); font-weight: 600; }
.adm-actions { white-space: nowrap; }
.adm-actions .btn { margin-right: 0.25rem; }
.adm-unit-grid { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; }
.adm-unit-area { margin-bottom: 0.5rem; }
.adm-area-label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.5px; }
.adm-unit-cb { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8rem; margin-right: 0.75rem; margin-bottom: 0.25rem; cursor: pointer; }
.adm-unit-cb input { width: auto; margin: 0; }
.adm-pin-display { font-size: 2rem; font-weight: 700; letter-spacing: 0.3em; color: var(--primary); background: #f0ecff; padding: 0.75rem 1.5rem; border-radius: var(--radius); font-family: 'SF Mono', 'Consolas', monospace; }

/* ======================== */
/* PROCESS WIDGET           */
/* ======================== */
.proc-widget { background: white; border-radius: 12px; padding: 1.2rem 1.5rem; margin: 1.5rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border: 1px solid #e9ecef; }
.proc-widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.proc-widget-header h2 { margin: 0; font-size: 1.1rem; }
.proc-widget-period { font-weight: 400; color: #666; font-size: 0.95rem; }
.proc-widget-link { font-size: 0.85rem; color: var(--primary); text-decoration: none; }
.proc-widget-link:hover { text-decoration: underline; }
.proc-widget-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.proc-widget-ring-row { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1rem; }
.proc-widget-ring { width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--pct) * 1%), #e9ecef 0); display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.proc-widget-ring::before { content: ''; width: 52px; height: 52px; background: white; border-radius: 50%; position: absolute; }
.proc-ring-value { position: relative; z-index: 1; font-size: 1rem; font-weight: 700; color: var(--primary); }
.proc-widget-counts { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: #555; }
.proc-count-row { display: flex; align-items: center; gap: 0.4rem; }
.proc-count-row strong { color: #222; }
.proc-count-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.proc-c-gen { background: #adb5bd; }
.proc-c-vec { background: #74b9ff; }
.proc-c-ctrl { background: #fdcb6e; }
.proc-c-done { background: var(--accent); }
.proc-widget-areas { display: flex; flex-direction: column; gap: 0.35rem; }
.proc-area-mini { display: grid; grid-template-columns: 120px 1fr 50px; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.proc-area-mini-name { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proc-area-mini-bar { height: 8px; background: #e9ecef; border-radius: 4px; position: relative; overflow: hidden; }
.proc-area-mini-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.proc-fill-gen { background: #dfe6e9; z-index: 1; }
.proc-fill-done { background: var(--accent); z-index: 2; }
.proc-area-mini-label { text-align: right; font-weight: 600; color: #333; font-size: 0.78rem; }
.proc-widget-right h3 { font-size: 0.95rem; margin: 0 0 0.6rem; color: var(--primary); }
.proc-no-actions { color: var(--accent); font-weight: 600; font-size: 0.9rem; padding: 1rem 0; }
.proc-action-list { display: flex; flex-direction: column; gap: 0.3rem; max-height: 260px; overflow-y: auto; }
.proc-action-item { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0.7rem; border-radius: 6px; text-decoration: none; font-size: 0.82rem; transition: background 0.15s; border-left: 3px solid transparent; }
.proc-action-item:hover { background: #f8f9fa; }
.proc-action-unit { color: #333; font-weight: 500; }
.proc-action-label { font-size: 0.78rem; padding: 0.15rem 0.5rem; border-radius: 10px; white-space: nowrap; }
.proc-act-vec { border-left-color: #74b9ff; }
.proc-act-vec .proc-action-label { background: #dfe6e9; color: #2d3436; }
.proc-act-controller { border-left-color: #fdcb6e; }
.proc-act-controller .proc-action-label { background: #ffeaa7; color: #6c5b2a; }
.proc-act-generate { border-left-color: #fab1a0; }
.proc-act-generate .proc-action-label { background: #ffedf2; color: #d63031; }
.proc-more-link { display: block; text-align: center; margin-top: 0.5rem; font-size: 0.82rem; color: var(--primary); text-decoration: none; }
.proc-more-link:hover { text-decoration: underline; }

/* ======================== */
/* RESPONSIVE               */
/* ======================== */
@media (max-width: 900px) {
    .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .dash-bottom-row { grid-template-columns: 1fr; }
    .tr-chart-grid { grid-template-columns: 1fr; }
    .tr-movers-row { grid-template-columns: 1fr; }
    .proc-widget-body { grid-template-columns: 1fr; }
    .proc-area-mini { grid-template-columns: 100px 1fr 40px; }
    .portal-nav { padding: 0 1rem; }
    .nav-apps { gap: 0.1rem; }
    .nav-app-link { padding: 0.3rem 0.5rem; font-size: 0.8rem; }
}
@media (max-width: 600px) {
    .dash-kpi-row { grid-template-columns: 1fr; }
    .dash-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .app-cards { grid-template-columns: 1fr; }
    .portal-nav { flex-wrap: wrap; height: auto; padding: 0.5rem 1rem; }
}
