/* ============================================
   JVH ITSM - Dark Theme Dashboard
   Paleta: Navy oscuro con acentos naranja/púrpura
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Variables ── */
:root {
    --bg-primary: #0B1437;
    --bg-secondary: #111C44;
    --bg-tertiary: #1B254B;
    --bg-hover: #1E2D5B;
    --bg-input: #0B1437;
    --text-primary: #FFFFFF;
    --text-secondary: #A3AED0;
    --text-muted: #687CA8;
    --accent-brand: #7551FF;
    --accent-orange: #F97316;
    --accent-green: #01B574;
    --accent-red: #EE5D50;
    --accent-yellow: #FFB547;
    --accent-cyan: #22D3EE;
    --accent-blue: #3B82F6;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --sidebar-width: 72px;
    --sidebar-expanded: 250px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100%;
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo h1 span {
    color: var(--accent-orange);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent-brand);
    box-shadow: 0 0 0 3px rgba(117, 81, 255, 0.15);
}

.login-form input::placeholder {
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-brand), #9B6DFF);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(117, 81, 255, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-error {
    background: rgba(238, 93, 80, 0.1);
    border: 1px solid rgba(238, 93, 80, 0.3);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow: hidden;
    z-index: 100;
}

.sidebar:hover {
    width: var(--sidebar-expanded);
    min-width: var(--sidebar-expanded);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: linear-gradient(135deg, var(--accent-brand), var(--accent-orange));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand .brand-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.sidebar-brand .brand-text {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar:hover .brand-text {
    opacity: 1;
}

.sidebar-brand .brand-text h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-brand .brand-text span {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Nav Items ── */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar:hover .nav-section-title {
    opacity: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(117, 81, 255, 0.12);
    color: var(--accent-brand);
}

.nav-item.active .nav-icon {
    color: var(--accent-brand);
}

.nav-item.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.nav-item.disabled:hover {
    background: transparent;
    color: var(--text-secondary);
}

.nav-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.nav-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar:hover .nav-label {
    opacity: 1;
}

.nav-badge {
    position: absolute;
    top: 6px;
    left: 30px;
    min-width: 18px;
    height: 18px;
    background: var(--accent-orange);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.sidebar:hover .nav-badge {
    position: static;
    margin-left: auto;
}

.nav-tag {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s ease 0.1s;
}

.sidebar:hover .nav-tag {
    opacity: 1;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* ── Main Area ── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Header ── */
.top-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.header-breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

.header-icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-orange);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.header-user:hover {
    background: var(--bg-tertiary);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-brand), var(--accent-orange));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.header-user-info {
    text-align: right;
}

.header-user-info .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user-info .role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Content ── */
.content-area {
    flex: 1;
    overflow: hidden;
}

.content-area iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

/* ============================================
   MODULE COMMON STYLES (used inside iframes)
   ============================================ */

.module-body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

.module-container {
    padding: 24px;
    max-width: 100%;
}

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Cards ── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── KPI Cards ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.kpi-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.kpi-card .kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.kpi-card .kpi-icon svg {
    width: 22px;
    height: 22px;
}

.kpi-card .kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.kpi-card .kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

.kpi-card .kpi-change {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}

.kpi-change.up { color: var(--accent-green); }
.kpi-change.down { color: var(--accent-red); }

/* ── Charts Grid ── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-card .chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-card .chart-title {
    font-size: 15px;
    font-weight: 600;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 260px;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-brand), #9B6DFF);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(117, 81, 255, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #00D68F);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-red), #FF7B74);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-yellow), #FFC978);
    color: #1a1a1a;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* ── Tables ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table thead {
    background: var(--bg-tertiary);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    word-break: break-word;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.td-title {
    color: var(--text-primary) !important;
    font-weight: 500;
}

.td-link {
    color: var(--accent-cyan) !important;
    cursor: pointer;
    font-weight: 500;
}

.td-link:hover {
    text-decoration: underline;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-critical { background: rgba(238, 93, 80, 0.15); color: var(--accent-red); }
.badge-high { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.badge-medium { background: rgba(255, 181, 71, 0.15); color: var(--accent-yellow); }
.badge-low { background: rgba(1, 181, 116, 0.15); color: var(--accent-green); }

.badge-new { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.badge-assigned { background: rgba(117, 81, 255, 0.15); color: var(--accent-brand); }
.badge-in_progress { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.badge-pending { background: rgba(255, 181, 71, 0.15); color: var(--accent-yellow); }
.badge-resolved { background: rgba(1, 181, 116, 0.15); color: var(--accent-green); }
.badge-closed { background: rgba(104, 124, 168, 0.15); color: var(--text-muted); }

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-critical .badge-dot { background: var(--accent-red); }
.badge-high .badge-dot { background: var(--accent-orange); }
.badge-medium .badge-dot { background: var(--accent-yellow); }
.badge-low .badge-dot { background: var(--accent-green); }
.badge-new .badge-dot { background: var(--accent-blue); }
.badge-assigned .badge-dot { background: var(--accent-brand); }
.badge-in_progress .badge-dot { background: var(--accent-cyan); }
.badge-pending .badge-dot { background: var(--accent-yellow); }
.badge-resolved .badge-dot { background: var(--accent-green); }
.badge-closed .badge-dot { background: var(--text-muted); }

.badge-major {
    background: rgba(238, 93, 80, 0.2);
    color: var(--accent-red);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label .required {
    color: var(--accent-red);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-brand);
    box-shadow: 0 0 0 3px rgba(117, 81, 255, 0.12);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23687CA8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ── Filters Bar ── */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 240px;
    padding: 10px 14px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-brand);
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.search-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.filter-select {
    padding: 10px 36px 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23687CA8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-brand);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-btns {
    display: flex;
    gap: 6px;
}

.pagination-btns button {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btns button:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-btns button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btns button.active {
    background: var(--accent-brand);
    border-color: var(--accent-brand);
    color: white;
}

/* ── Timeline / History ── */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-brand);
    border: 2px solid var(--bg-secondary);
}

.timeline-dot.created { background: var(--accent-blue); }
.timeline-dot.status_changed { background: var(--accent-cyan); }
.timeline-dot.assigned { background: var(--accent-brand); }
.timeline-dot.resolved { background: var(--accent-green); }
.timeline-dot.closed { background: var(--text-muted); }
.timeline-dot.comment { background: var(--accent-yellow); }
.timeline-dot.escalated { background: var(--accent-red); }

.timeline-content {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.timeline-user {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.timeline-date {
    font-size: 11px;
    color: var(--text-muted);
}

.timeline-action {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    max-width: 400px;
    margin: 0 auto;
}

/* ── Loading Spinner ── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-brand);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: white;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    box-shadow: var(--shadow);
}

.toast-success { background: var(--accent-green); }
.toast-error { background: var(--accent-red); }
.toast-warning { background: var(--accent-yellow); color: #1a1a1a; }
.toast-info { background: var(--accent-blue); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--accent-brand);
    border-bottom-color: var(--accent-brand);
}

/* ── Detail Section ── */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.detail-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

/* ── Comment Box ── */
.comment-box {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.comment-box textarea {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
}

.comment-box textarea:focus {
    outline: none;
    border-color: var(--accent-brand);
}

/* ── Upcoming Module Placeholder ── */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
    text-align: center;
    color: var(--text-muted);
}

.coming-soon svg {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.2;
}

.coming-soon h2 {
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.coming-soon p {
    font-size: 14px;
    max-width: 400px;
}

/* ── User dropdown ── */
.user-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 4px);
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 200;
    display: none;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.user-dropdown-item svg {
    width: 16px;
    height: 16px;
}

.user-dropdown-divider {
    border-top: 1px solid var(--border-color);
}

.user-dropdown-item.danger {
    color: var(--accent-red);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        width: var(--sidebar-expanded) !important;
        min-width: var(--sidebar-expanded) !important;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.open ~ .sidebar-backdrop {
        display: block;
    }

    .sidebar .nav-label,
    .sidebar .brand-text,
    .sidebar .nav-section-title,
    .sidebar .nav-tag {
        opacity: 1 !important;
    }

    .sidebar .nav-badge {
        position: static;
        margin-left: auto;
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-wrapper {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .module-container {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Utility ── */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-yellow); }
.text-info { color: var(--accent-cyan); }
.fw-600 { font-weight: 600; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.hidden { display: none !important; }
.text-center { text-align: center; }

/* ── Form Actions ── */
.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* ── Status Actions Bar ── */
.status-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.current-status {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Full Width Grid Item ── */
.full-width {
    grid-column: 1 / -1;
}

/* ── Search Box (alias for search-wrapper) ── */
.search-box {
    position: relative;
    flex: 1;
    min-width: 240px;
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-brand);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ── Modal (dark theme) ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Status Banner ── */
.status-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.status-banner.success {
    background: rgba(1, 181, 116, 0.08);
    border-color: rgba(1, 181, 116, 0.25);
}

.status-banner.warning {
    background: rgba(255, 181, 71, 0.08);
    border-color: rgba(255, 181, 71, 0.25);
}

.status-banner .status-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-banner .status-icon svg {
    width: 24px;
    height: 24px;
}

.status-banner.success .status-icon {
    background: rgba(1, 181, 116, 0.15);
    color: var(--accent-green);
}

.status-banner.warning .status-icon {
    background: rgba(255, 181, 71, 0.15);
    color: var(--accent-yellow);
}

.status-banner h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.status-banner p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Confidence Bar ── */
.confidence-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-brand), var(--accent-cyan));
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ── Targets Matrix (SLM) ── */
.targets-matrix {
    margin-top: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--bg-primary);
}

.targets-matrix h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.target-row {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 160px;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.target-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.target-row input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
}

.target-row input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-brand);
}

.target-row input[type="number"]::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--accent-brand);
}

/* ── Config Instructions ── */
.config-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 16px;
}

.config-card h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.config-card ol {
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.config-card li {
    margin-bottom: 8px;
}

.config-card code {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
}

.config-card pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
}

/* ── Manual / Documentation ── */
.manual-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.manual-content h2 {
    color: var(--accent-brand);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: 20px;
}

.manual-content h3 {
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 16px;
}

.manual-content p {
    margin-bottom: 12px;
}

.manual-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--accent-cyan);
}

.manual-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 16px 0;
}

.manual-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.manual-content ul,
.manual-content ol {
    margin: 12px 0;
    padding-left: 28px;
}

.manual-content li {
    margin: 6px 0;
}

.manual-content blockquote {
    border-left: 3px solid var(--accent-brand);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-muted);
    font-style: italic;
}

.manual-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.manual-content th,
.manual-content td {
    padding: 10px 14px;
    text-align: left;
    border: 1px solid var(--border-color);
    font-size: 13px;
}

.manual-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.manual-content td {
    color: var(--text-secondary);
}

/* Manual Nav Grid */
.manual-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.manual-nav-item {
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.manual-nav-item:hover {
    border-color: var(--accent-brand);
    background: var(--bg-hover);
}

.manual-nav-item h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-brand);
    margin-bottom: 4px;
}

.manual-nav-item p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    background: var(--accent-brand);
    color: white;
    border: none;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    font-size: 18px;
    z-index: 50;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(117, 81, 255, 0.35);
}

.back-to-top.visible {
    display: flex;
}
