/* STAT Dashboard V2 — SPA styles
 * Uses a single CSS variable `--stat-primary` that Vue sets at mount time.
 * Everything else is neutral so themes can't bleed in.
 */

.stat-dashboard-v2-root {
    --stat-primary: #F97316;
    --stat-primary-soft: #FEF3ED;
    --stat-bg: #FAFAFA;
    --stat-card-bg: #FFFFFF;
    --stat-border: #E5E7EB;
    --stat-text: #111827;
    --stat-muted: #6B7280;
    --stat-danger: #DC2626;
    --stat-success: #10B981;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--stat-text);
    background: var(--stat-bg);
    min-height: 100vh;
    box-sizing: border-box;
}
.stat-dashboard-v2-root *, .stat-dashboard-v2-root *::before, .stat-dashboard-v2-root *::after { box-sizing: border-box; }

/* Layout */
.sd-shell { display: flex; min-height: 100vh; }
.sd-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #FFFFFF;
    border-right: 1px solid var(--stat-border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    gap: 16px;
}
.sd-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 4px; }
.sd-brand img { max-width: 100px; height: auto; }
.sd-brand .brand-tag { font-size: 10px; color: var(--stat-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.sd-section-label { font-size: 11px; color: var(--stat-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin: 12px 4px 6px; }
.sd-nav { display: flex; flex-direction: column; gap: 2px; }
.sd-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    color: var(--stat-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.sd-nav a .bi { font-size: 16px; }
.sd-nav a:hover { background: var(--stat-primary-soft); color: var(--stat-primary); }
.sd-nav a.router-link-active {
    background: var(--stat-primary);
    color: #FFFFFF;
}
.sd-nav a.router-link-active .bi { color: #FFFFFF; }
.sd-subnav { display: flex; flex-direction: column; gap: 2px; margin-left: 24px; }
.sd-subnav a {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    color: var(--stat-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
}
.sd-subnav a:hover { color: var(--stat-primary); }
.sd-subnav a.router-link-active { color: var(--stat-primary); font-weight: 600; }

.sd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sd-topbar {
    height: 60px;
    padding: 0 24px;
    display: flex; align-items: center; gap: 16px;
    border-bottom: 1px solid var(--stat-border);
    background: #FFFFFF;
}
.sd-search {
    flex: 1;
    max-width: 620px;
    display: flex; align-items: center; gap: 8px;
    background: #F3F4F6;
    border-radius: 10px;
    padding: 8px 12px;
}
.sd-search input {
    flex: 1; border: none; background: transparent; outline: none;
    font-size: 14px; color: var(--stat-text);
}
.sd-user { display: flex; align-items: center; gap: 10px; }
.sd-bell { color: var(--stat-primary); font-size: 20px; }
.sd-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--stat-primary-soft); color: var(--stat-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.sd-username { font-weight: 500; font-size: 14px; }

.sd-page { padding: 24px; }
.sd-page h1.page-title { font-size: 26px; margin: 0 0 4px; font-weight: 700; }
.sd-page .page-sub { color: var(--stat-muted); font-size: 14px; margin: 0 0 20px; }
.sd-section-header { font-size: 11px; color: var(--stat-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin: 24px 0 10px; }

/* Card grid */
.sd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1200px) { .sd-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .sd-grid { grid-template-columns: 1fr; } }

.sd-card {
    background: var(--stat-card-bg);
    border: 1px solid var(--stat-border);
    border-left: 4px solid var(--stat-primary);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sd-card .sd-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sd-card .sd-card-title { font-size: 16px; font-weight: 700; margin: 0; }
.sd-card .sd-card-badge { font-size: 11px; color: var(--stat-primary); background: var(--stat-primary-soft); padding: 3px 8px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.sd-card .sd-card-meta { color: var(--stat-muted); font-size: 12px; }
.sd-card .sd-big-number { font-size: 40px; font-weight: 700; line-height: 1; margin: 0; }
.sd-card .sd-list { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sd-card .sd-list .row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px dashed #EEE; }
.sd-card .sd-list .row:last-child { border-bottom: 0; }
.sd-card .sd-list .row .label { color: var(--stat-muted); }
.sd-card .sd-list .row .value { font-weight: 600; }

.sd-btn {
    background: var(--stat-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.12s;
    display: inline-flex; align-items: center; gap: 6px;
}
.sd-btn:hover { opacity: 0.9; }
.sd-btn.ghost { background: transparent; color: var(--stat-primary); border: 1px solid var(--stat-primary); }
.sd-btn.wide { width: 100%; justify-content: center; }

.sd-input, .sd-textarea, .sd-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--stat-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    background: #FFFFFF;
}
.sd-input:focus, .sd-textarea:focus, .sd-select:focus { border-color: var(--stat-primary); }
.sd-textarea { resize: vertical; min-height: 70px; }

/* Monthly bar chart */
.sd-bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; height: 110px; }
.sd-bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.sd-bar {
    width: 100%;
    background: var(--stat-primary);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: height 0.2s;
}
.sd-bar-label { font-size: 10px; color: var(--stat-muted); }

/* Employees table */
.sd-employee-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.sd-stat {
    border: 1px solid var(--stat-border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}
.sd-stat .num { font-size: 22px; font-weight: 700; color: var(--stat-primary); }
.sd-stat .lbl { font-size: 11px; color: var(--stat-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.sd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sd-table th { text-align: left; padding: 8px 10px; background: #F9FAFB; font-size: 11px; text-transform: uppercase; color: var(--stat-muted); font-weight: 600; letter-spacing: 0.04em; border-bottom: 1px solid var(--stat-border); }
.sd-table td { padding: 9px 10px; border-bottom: 1px solid #F3F4F6; }
.sd-status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--stat-muted); }
.sd-status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--stat-success); display: inline-block; }
.sd-status-pill.inactive .dot { background: #9CA3AF; }
.sd-toggle {
    display: inline-block; width: 34px; height: 18px; background: #D1D5DB; border-radius: 999px; position: relative; cursor: pointer;
}
.sd-toggle::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: #FFFFFF; border-radius: 50%; transition: left 0.15s;
}
.sd-toggle.on { background: var(--stat-success); }
.sd-toggle.on::after { left: 18px; }

.sd-empty { padding: 40px; text-align: center; color: var(--stat-muted); }
.sd-loading { padding: 40px; text-align: center; color: var(--stat-muted); font-style: italic; }

.sd-link { color: var(--stat-primary); font-size: 12px; font-weight: 600; text-decoration: none; }
.sd-link:hover { text-decoration: underline; }

.sd-two-col { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
@media (max-width: 1024px) { .sd-two-col { grid-template-columns: 1fr; } }

.sd-badge-count { font-size: 12px; font-weight: 500; color: var(--stat-muted); margin-left: 6px; }

/* Placeholder pages */
.sd-placeholder {
    background: #FFFFFF;
    border: 1px dashed var(--stat-border);
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    color: var(--stat-muted);
}
.sd-placeholder .bi { font-size: 40px; color: var(--stat-primary); margin-bottom: 12px; display: block; }
