/* ===== Main Dashboard ===== */

.dash-app {
    display: flex;
    min-height: calc(100vh - 72px);
    background: var(--color-bg-soft);
}

/* ===== App sidebar (module navigation) ===== */
.dash-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 16px 12px;
    overflow-y: auto;
}

.dash-nav-group { margin-bottom: 16px; }

.dash-nav-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0 12px 8px;
}

.dash-nav-list { list-style: none; }

.dash-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-body);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    border-left: 3px solid transparent;
    margin-left: -3px;
}
.dash-nav-item:hover { background: #F1F5F9; }
[data-theme="dark"] .dash-nav-item:hover { background: rgba(255,255,255,0.05); }

.dash-nav-item.active {
    background: #EFF6FF;
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    border-radius: 0 8px 8px 0;
}
[data-theme="dark"] .dash-nav-item.active { background: rgba(37,99,235,0.15); }

.dash-nav-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}
.dash-nav-item.active .dash-nav-icon,
.dash-nav-item:hover .dash-nav-icon { color: var(--color-primary); }

.dash-nav-item.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

/* ===== Main content ===== */
.dash-main {
    flex: 1;
    padding: 32px;
    max-width: 1440px;
    overflow-x: hidden;
}

/* Greeting header */
.dash-greeting {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.dash-greeting-text h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}
.dash-greeting-text p {
    font-size: 16px;
    color: var(--color-text-muted);
}

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

.dash-search { position: relative; }
.dash-search-input {
    width: 360px;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: var(--color-text-body);
    background: var(--color-bg);
}
.dash-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.dash-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.dash-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}
.dash-icon-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.dash-bell-dot {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #DC2626;
    border-radius: 50%;
    border: 2px solid var(--color-bg);
}

.dash-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ===== KPI tiles ===== */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.dash-kpi {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    transition: box-shadow 0.15s;
}
.dash-kpi:hover { box-shadow: 0 4px 12px var(--color-shadow); }

.dash-kpi-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dash-kpi-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}

.dash-kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #EFF6FF;
    color: #2563EB;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dash-kpi-icon.green  { background: #ECFDF5; color: #16A34A; }
.dash-kpi-icon.orange { background: #FFF7ED; color: #F97316; }
.dash-kpi-icon.purple { background: #F5F3FF; color: #7C3AED; }

[data-theme="dark"] .dash-kpi-icon        { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .dash-kpi-icon.green  { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .dash-kpi-icon.orange { background: rgba(249,115,22,0.15); }
[data-theme="dark"] .dash-kpi-icon.purple { background: rgba(124,58,237,0.15); }

.dash-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-dark);
}
.dash-kpi-sub {
    font-size: 13px;
    color: var(--color-text-muted);
}
.dash-kpi-sub.up   { color: #16A34A; }
.dash-kpi-sub.down { color: #DC2626; }

/* ===== Card (reusable) ===== */
.dash-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.dash-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-dark);
}

.dash-card-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
}
.dash-card-link:hover { text-decoration: underline; }

/* ===== Timeline ===== */
.dash-timeline { list-style: none; }

.dash-timeline-item {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.dash-timeline-item:last-child { border-bottom: none; }

.dash-timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #EFF6FF;
    color: #2563EB;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-timeline-icon.green  { background: #ECFDF5; color: #16A34A; }
.dash-timeline-icon.orange { background: #FFF7ED; color: #F97316; }
.dash-timeline-icon.purple { background: #F5F3FF; color: #7C3AED; }
.dash-timeline-icon.red    { background: #FEE2E2; color: #DC2626; }

[data-theme="dark"] .dash-timeline-icon        { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .dash-timeline-icon.green  { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .dash-timeline-icon.orange { background: rgba(249,115,22,0.15); }
[data-theme="dark"] .dash-timeline-icon.purple { background: rgba(124,58,237,0.15); }
[data-theme="dark"] .dash-timeline-icon.red    { background: rgba(220,38,38,0.15); }

.dash-timeline-content { flex: 1; min-width: 0; }

.dash-timeline-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body);
    margin-bottom: 2px;
}

.dash-timeline-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.dash-timeline-module {
    display: inline-flex;
    padding: 2px 8px;
    background: var(--color-bg-soft);
    border-radius: 10px;
    font-weight: 500;
}

/* ===== Quick Actions ===== */
.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.dash-quick {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #EFF6FF;
    border: 1px solid transparent;
    border-radius: 12px;
    min-height: 100px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.dash-quick:hover { background: #DBEAFE; }
[data-theme="dark"] .dash-quick { background: rgba(37,99,235,0.1); }
[data-theme="dark"] .dash-quick:hover { background: rgba(37,99,235,0.2); }

.dash-quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--color-bg);
    color: #2563EB;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-quick-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-text-dark);
}

/* ===== Two-column grid for side-by-side cards ===== */
.dash-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 0;
}

/* Recent tickets table */
.dash-mini-table {
    width: 100%;
    border-collapse: collapse;
}
.dash-mini-table th {
    text-align: left;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.dash-mini-table td {
    padding: 12px 0;
    font-size: 14px;
    color: var(--color-text-body);
    border-bottom: 1px solid var(--color-border);
}
.dash-mini-table tr:last-child td { border-bottom: none; }

.dash-mini-id {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
}

.dash-mini-title {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges (shared with other modules) */
.dash-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.dash-badge.prio-high   { background: #FEE2E2; color: #DC2626; }
.dash-badge.prio-normal { background: #EFF6FF; color: #2563EB; }
.dash-badge.prio-low    { background: #F1F5F9; color: #64748B; }
.dash-badge.status-new      { background: #ECFEFF; color: #0EA5E9; }
.dash-badge.status-open     { background: #EFF6FF; color: #2563EB; }
.dash-badge.status-waiting  { background: #FFFBEB; color: #F59E0B; }
.dash-badge.status-closed   { background: #ECFDF5; color: #16A34A; }

[data-theme="dark"] .dash-badge.prio-high    { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .dash-badge.prio-normal  { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .dash-badge.prio-low     { background: rgba(100,116,139,0.15); }
[data-theme="dark"] .dash-badge.status-new     { background: rgba(14,165,233,0.15); }
[data-theme="dark"] .dash-badge.status-open    { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .dash-badge.status-waiting { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .dash-badge.status-closed  { background: rgba(22,163,74,0.15); }

.dash-mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #2563EB;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tasks list */
.dash-task-list { list-style: none; }

.dash-task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.dash-task:last-child { border-bottom: none; }

.dash-task-check {
    width: 18px;
    height: 18px;
    accent-color: #2563EB;
    flex-shrink: 0;
    cursor: pointer;
}

.dash-task-body { flex: 1; min-width: 0; }

.dash-task-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-body);
    margin-bottom: 2px;
}
.dash-task-name.done { text-decoration: line-through; color: var(--color-text-muted); }

.dash-task-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    gap: 10px;
}

.dash-task-due {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 2px 8px;
    background: var(--color-bg-soft);
    border-radius: 10px;
    white-space: nowrap;
}
.dash-task-due.urgent { background: #FEE2E2; color: #DC2626; }
.dash-task-due.soon { background: #FFFBEB; color: #F59E0B; }
[data-theme="dark"] .dash-task-due.urgent { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .dash-task-due.soon { background: rgba(245,158,11,0.15); }

/* HR attention list */
.dash-attention-list { list-style: none; }

.dash-attention-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}
.dash-attention-item:last-child { border-bottom: none; }

.dash-attention-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-attention-icon.red    { background: #FEE2E2; color: #DC2626; }
.dash-attention-icon.orange { background: #FFF7ED; color: #F97316; }
.dash-attention-icon.blue   { background: #EFF6FF; color: #2563EB; }
[data-theme="dark"] .dash-attention-icon.red    { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .dash-attention-icon.orange { background: rgba(249,115,22,0.15); }
[data-theme="dark"] .dash-attention-icon.blue   { background: rgba(37,99,235,0.15); }

.dash-attention-body { flex: 1; min-width: 0; }

.dash-attention-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-dark);
    margin-bottom: 2px;
}
.dash-attention-desc {
    font-size: 13px;
    color: var(--color-text-muted);
}

.dash-attention-action {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
    flex-shrink: 0;
}
.dash-attention-action:hover { text-decoration: underline; }

/* ===== Dashboard footer ===== */
.dash-footer {
    margin-top: 24px;
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-quick-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .dash-split-grid { grid-template-columns: 1fr; }
    .dash-search-input { width: 240px; }
}

@media (max-width: 768px) {
    .dash-app { flex-direction: column; }

    .dash-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: 240px;
    }

    .dash-main { padding: 20px; }

    .dash-greeting { flex-direction: column; gap: 16px; }
    .dash-search-input { width: 100%; }

    .dash-kpi-grid { grid-template-columns: 1fr; }
    .dash-quick-grid { grid-template-columns: 1fr; }
}
