/* ── Variables ────────────────────────────────────────────────────────── */
:root {
    --sidebar-width: 220px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #9ca3af;
    --sidebar-active-bg: #2d3748;
    --sidebar-hover-bg: #252a33;
    --accent: #3b82f6;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --text-muted: #6b7280;
    --healthy: #10b981;
    --warning: #f59e0b;
    --critical: #ef4444;
    --info: #3b82f6;
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { 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);
    font-size: 14px;
    line-height: 1.5;
}

a { color: inherit; }

/* ── Shell layout ─────────────────────────────────────────────────────── */
.shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
    width: 54px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
}
.sidebar:hover {
    width: var(--sidebar-width);
}

.sidebar-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid #2d3748;
}

.sidebar-header a {
    display: block;
}

.sidebar-logo-img {
    height: 38px;
    width: auto;
    max-width: 100%;
    display: block;
}

.sidebar-tagline {
    color: var(--sidebar-text);
    font-size: 10px;
    margin-top: 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4b5563;
    padding: 10px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 9px 17px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
}
.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: #ffffff;
}
.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    border-left-color: var(--accent);
}
.nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 14px;
}
.nav-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    margin-left: 0;
    transition: opacity 0.15s ease, max-width 0.2s ease, margin-left 0.15s ease;
}
.sidebar:hover .nav-text {
    opacity: 1;
    max-width: 160px;
    margin-left: 10px;
}
.nav-label {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: opacity 0.15s ease, max-height 0.2s ease, padding 0.2s ease;
}
.sidebar:hover .nav-label {
    opacity: 1;
    max-height: 30px;
    padding: 10px 16px 4px;
}
.sidebar-logo-img {
    opacity: 0;
    transition: opacity 0.15s ease;
    max-width: 140px;
}
.sidebar:hover .sidebar-logo-img {
    opacity: 1;
}
.sidebar-version {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.15s ease;
}
.sidebar:hover .sidebar-version {
    opacity: 1;
    max-height: 20px;
}

/* ── Sidebar footer (version + user avatar) ──────────────────────────── */
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sidebar-version {
    font-size: 10px;
    color: #4b5563;
    letter-spacing: 0.04em;
    font-family: monospace;
}
.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Main area ────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.top-bar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.top-bar-user a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: color 0.12s, border-color 0.12s;
}

.top-bar-user a:hover {
    color: var(--text);
    border-color: #9ca3af;
}

.signout-btn {
    background: none;
    color: var(--text-muted);
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}

.signout-btn:hover {
    color: var(--text);
    border-color: #9ca3af;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ── Section ──────────────────────────────────────────────────────────── */
.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-timestamp {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── KPI Strip ────────────────────────────────────────────────────────── */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-top: 3px solid var(--accent);
}

.kpi-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 44px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -1px;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ── Department cards ─────────────────────────────────────────────────── */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Per-department accent colors */
.dept-afi  { --dept-color: #3b82f6; }   /* Blue    — Factoring     */
.dept-aci  { --dept-color: #10b981; }   /* Emerald — Leasing       */
.dept-ats  { --dept-color: #f59e0b; }   /* Amber   — ATS           */
.dept-aef  { --dept-color: #9ca3af; }   /* Gray    — Coming soon   */
.dept-mkt  { --dept-color: #8b5cf6; }   /* Violet  — Marketing     */

.dept-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    border-top: 4px solid var(--dept-color);
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: box-shadow 0.15s, transform 0.15s;
}

.dept-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.dept-card--placeholder {
    opacity: 0.45;
}

.dept-card--placeholder:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: none;
}

.dept-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dept-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--dept-color);
}

.dept-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--dept-color);
    background: color-mix(in srgb, var(--dept-color) 10%, transparent);
    padding: 3px 8px;
    border-radius: 100px;
}

.dept-hero {
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.dept-hero-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.dept-hero-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--dept-color);
    line-height: 1;
    letter-spacing: -0.5px;
}

.dept-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    flex: 1;
}

.dept-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dept-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.dept-view-link {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dept-color);
    text-decoration: none;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    transition: opacity 0.12s;
}

.dept-view-link:hover {
    opacity: 0.75;
}

.dept-placeholder-msg {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Trend badge (dept hero) ──────────────────────────────────────────── */
.dept-hero-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 100px;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.trend-badge.trend-up {
    background: #ecfdf5;
    color: #065f46;
}

.trend-badge.trend-down {
    background: #fef2f2;
    color: #991b1b;
}

.dept-prior-line {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Dept chart ───────────────────────────────────────────────────────── */
.dept-chart-wrap {
    margin: -4px 0 4px;
}

.dept-chart-wrap canvas {
    width: 100% !important;
}

/* ── KPI prior month ─────────────────────────────────────────────────── */
.kpi-prior {
    display: block;
    color: var(--text-muted);
}

/* ── Grid ─────────────────────────────────────────────────────────────── */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ── Trend text ───────────────────────────────────────────────────────── */
.trend-up   { color: var(--healthy); }
.trend-down { color: var(--critical); }
.trend-flat { color: var(--text-muted); }

/* ── Status badges ────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
}

.badge-healthy  { background: #ecfdf5; color: #065f46; }
.badge-warning  { background: #fffbeb; color: #92400e; }
.badge-critical { background: #fef2f2; color: #991b1b; }

/* ── Department health cards ──────────────────────────────────────────── */
.dept-card {
    border-left: 4px solid var(--border);
}

.dept-card.healthy  { border-left-color: var(--healthy); }
.dept-card.warning  { border-left-color: var(--warning); }
.dept-card.critical { border-left-color: var(--critical); }

.dept-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.dept-name {
    font-weight: 600;
    font-size: 14px;
}

.dept-metric {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.dept-trend {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dept-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.alert-dot.critical { background: var(--critical); }
.alert-dot.warning  { background: var(--warning); }
.alert-dot.info     { background: var(--info); }

.alert-text {
    font-size: 13px;
    line-height: 1.4;
}

/* ── Pipeline ─────────────────────────────────────────────────────────── */
.pipeline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pipeline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.pipeline-label {
    font-size: 13px;
    font-weight: 500;
}

.pipeline-right {
    text-align: right;
}

.pipeline-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.pipeline-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Blockers ─────────────────────────────────────────────────────────── */
.blockers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blocker-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.blocker-area {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    min-width: 80px;
    padding-top: 1px;
    flex-shrink: 0;
}

.blocker-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.blocker-impact {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    flex-shrink: 0;
    align-self: flex-start;
}

.impact-high   { background: #fef2f2; color: #991b1b; }
.impact-medium { background: #fffbeb; color: #92400e; }
.impact-low    { background: #f3f4f6; color: #6b7280; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
    font-size: 13px;
    color: var(--text-muted);
    padding: 12px;
}

/* ── Login page ───────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 52px 44px 44px;
    width: 360px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-logo-img {
    height: 64px;
    width: auto;
    max-width: 220px;
    display: block;
    margin: 0 auto 28px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 32px;
}

.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: #0078d4;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}

.btn-microsoft:hover {
    background: #006cbe;
    color: #ffffff;
}


/* ── Placeholder pages ────────────────────────────────────────────────── */
.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
}

.placeholder-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.placeholder-text {
    font-size: 14px;
}

/* ── Dept-colored KPI strip ───────────────────────────────────────────── */
.dept-kpi-afi .kpi-card { border-top-color: #3b82f6; }
.dept-kpi-aci .kpi-card { border-top-color: #10b981; }
.dept-kpi-ats .kpi-card { border-top-color: #f59e0b; }
.dept-kpi-mkt .kpi-card { border-top-color: #8b5cf6; }

/* ── Marketing pipeline breakdown ────────────────────────────────────── */
.pipeline-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pipeline-group {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    border-top: 4px solid var(--dept-color);
    padding: 20px 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pipeline-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.pipeline-group-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--dept-color);
}

.pipeline-group-total {
    font-size: 22px;
    font-weight: 800;
    color: var(--dept-color);
    letter-spacing: -0.5px;
}

.pipeline-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pipeline-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.pipeline-row-label {
    color: var(--text-muted);
}

.pipeline-row-count {
    font-weight: 700;
    color: var(--text);
}

/* ── Dept pills (marketing table) ────────────────────────────────────── */
.dept-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 100px;
}

.dept-pill-afi { background: #eff6ff; color: #1d4ed8; }
.dept-pill-aci { background: #ecfdf5; color: #065f46; }
.dept-pill-ats { background: #fffbeb; color: #92400e; }

/* ── Data table ───────────────────────────────────────────────────────── */
.table-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--text);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: #f8fafc;
}

.data-table .num {
    text-align: right;
}

.td-primary {
    font-weight: 600;
    color: var(--text);
}

.td-strong {
    font-weight: 700;
}

.td-muted {
    color: var(--text-muted);
}

.td-mono {
    font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: 12px;
}

.td-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
    font-style: italic;
}

.status-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}

/* ── Technology module ────────────────────────────────────────────────── */

/* KPI strip accent colors */
.dept-kpi-tech .kpi-card           { border-top-color: #0ea5e9; }
.dept-kpi-tech .kpi-card--critical { border-top-color: var(--critical); }
.dept-kpi-tech .kpi-card--warning  { border-top-color: var(--warning); }
.dept-kpi-tech .kpi-card--healthy  { border-top-color: var(--healthy); }

/* Sub-navigation */
.tech-subnav {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    margin: -24px -24px 20px;
    padding: 0 24px;
}
.tech-tab {
    display: block;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .12s, border-color .12s;
}
.tech-tab:hover { color: var(--text); }
.tech-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tech-subnav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tech-meta { font-size: 12px; color: var(--text-muted); }
.tech-live-badge {
    font-size: 11px; background: #dcfce7; color: #166534;
    padding: 2px 7px; border-radius: 3px; font-weight: 600;
}
.tech-mock-badge {
    font-size: 11px; background: #f1f5f9; color: #475569;
    padding: 2px 7px; border-radius: 3px; font-weight: 600;
}

/* Panels */
.tech-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.tech-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
}
.tech-panel-link {
    font-size: 12px; color: var(--accent); text-decoration: none;
    font-weight: 400; text-transform: none; letter-spacing: 0;
}
.tech-panel-link:hover { text-decoration: underline; }

/* Dashboard 3-column grid */
.tech-dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}
.tech-dash-middle { display: flex; flex-direction: column; gap: 16px; }

/* Department rows */
.tech-dept-row {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.tech-dept-row:last-child { border-bottom: 0; }
.tech-dept-row-name { flex: 1 1 auto; min-width: 0; }
.tech-dept-row-stats { display: flex; gap: 4px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.tech-dept-row-total { font-weight: 700; font-size: 14px; width: 28px; text-align: right; flex-shrink: 0; }
.tech-sys-count { font-size: 10px; padding: 2px 5px; border-radius: 3px; font-weight: 600; }
.sys-devops  { background: #f5f3ff; color: #5b21b6; }
.sys-zendesk { background: #fef3c7; color: #92400e; }
.sys-jira    { background: #eff6ff; color: #1e40af; }
.tech-dept-critical { font-size: 11px; color: var(--critical); font-weight: 600; }

/* Health bars */
.tech-health-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13px; }
.tech-health-label { width: 85px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); }
.tech-health-bar-wrap { flex: 1; background: #f3f4f6; border-radius: 4px; height: 8px; overflow: hidden; }
.tech-health-bar { height: 100%; border-radius: 4px; transition: width .5s ease; min-width: 4px; }
.tech-health-bar--healthy  { background: var(--healthy); }
.tech-health-bar--info     { background: var(--info); }
.tech-health-bar--warning  { background: var(--warning); }
.tech-health-bar--critical { background: var(--critical); }
.tech-health-count { width: 28px; text-align: right; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* Linked systems */
.tech-linked-systems { padding: 4px 0; }
.tech-linked-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.tech-linked-item:last-child { border-bottom: 0; }
.tech-linked-item:hover { background: #f9fafb; }
.tech-linked-info { flex: 1; }
.tech-linked-name { font-size: 13px; font-weight: 500; }
.tech-linked-count { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tech-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tech-status-dot--on  { background: var(--healthy); box-shadow: 0 0 4px var(--healthy); }
.tech-status-dot--off { background: #d1d5db; }

/* Needs attention compact items */
.tech-attention-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.tech-attention-item:last-child { border-bottom: 0; }
.tech-attention-left { display: flex; align-items: center; gap: 4px; flex-shrink: 0; padding-top: 2px; }
.tech-attention-body { flex: 1; min-width: 0; }
.tech-attention-title {
    font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.tech-attention-title a { color: var(--text); text-decoration: none; }
.tech-attention-title a:hover { color: var(--accent); }
.tech-attention-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Priority dot */
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.priority-dot--critical { background: var(--critical); }
.priority-dot--high     { background: var(--warning); }
.priority-dot--normal   { background: var(--info); }
.priority-dot--low      { background: #9ca3af; }

/* Page toolbar (detail pages) */
.tech-page-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 10px;
}
.tech-btn-bar { display: flex; gap: 5px; flex-shrink: 0; }
.tech-btn {
    padding: 6px 12px; font-size: 12px; font-weight: 500;
    border: 1px solid var(--border); border-radius: 5px;
    background: var(--card-bg); color: var(--text);
    cursor: pointer; white-space: nowrap;
    transition: all .12s;
}
.tech-btn:hover:not(:disabled) { background: #f3f4f6; border-color: #9ca3af; }
.tech-btn:disabled { opacity: .35; cursor: not-allowed; }
.tech-btn.active {
    background: var(--accent); border-color: var(--accent); color: #fff;
}
.tech-btn.active:hover { background: #2563eb; border-color: #2563eb; }
.tech-btn--sm { padding: 4px 10px; font-size: 11px; }

/* Filter panel */
.tech-filter-panel {
    display: none; gap: 24px; flex-wrap: wrap; align-items: flex-start;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 16px 20px; margin-bottom: 10px;
}
.tech-filter-panel.open { display: flex; }
.tech-filter-group { min-width: 140px; }
.tech-filter-group-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted); margin-bottom: 8px;
}
.tech-filter-check { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 2px 0; user-select: none; }
.tech-filter-actions { display: flex; align-items: flex-end; gap: 8px; margin-top: 18px; }

/* Mini KPI bar */
.tech-mini-kpi { display: flex; gap: 20px; font-size: 13px; margin-bottom: 10px; color: var(--text-muted); align-items: center; }
.tech-mini-kpi strong { color: var(--text); }
.tech-mini-kpi-critical { color: var(--critical); font-weight: 600; }
.tech-mini-kpi-blocked  { color: #b45309; font-weight: 600; }
.tech-mini-kpi-stale    { color: var(--warning); font-weight: 600; }

/* Sortable table headers */
.th-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sortable:hover { background: #f9fafb; }
.sort-icon { font-size: 10px; opacity: .4; margin-left: 3px; }
.th-sortable.sort-asc .sort-icon,
.th-sortable.sort-desc .sort-icon { opacity: 1; color: var(--accent); }

/* Type badge */
.type-badge { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 3px; font-weight: 500; background: #f3f4f6; color: var(--text-muted); }
.type-roadmap { background: #f5f3ff; color: #5b21b6; }
.type-bug     { background: #fef2f2; color: #991b1b; }
.type-task    { background: #eff6ff; color: #1d4ed8; }
.type-ticket  { background: #f0fdf4; color: #166534; }

/* Priority badges */
.priority-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 100px; white-space: nowrap; }
.priority-critical { background: #fef2f2; color: #991b1b; }
.priority-high     { background: #fff7ed; color: #9a3412; }
.priority-normal   { background: #fffbeb; color: #92400e; }
.priority-low      { background: #f1f5f9; color: #475569; }

/* Status pill */
.status-pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 100px; background: #f1f5f9; color: #475569; white-space: nowrap; }
.status-pill.status-open        { background: #eff6ff; color: #1d4ed8; }
.status-pill.status-in_progress { background: #fffbeb; color: #92400e; }
.status-pill.status-blocked     { background: #fef2f2; color: #991b1b; }

/* System source badges */
.system-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 2px 7px; border-radius: 100px; white-space: nowrap; }
.system-zendesk { background: #fef3c7; color: #92400e; }
.system-jira    { background: #eff6ff; color: #1e40af; }
.system-devops  { background: #f5f3ff; color: #5b21b6; }

/* Inline flags */
.tech-flag { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 100px; margin-left: 4px; vertical-align: middle; letter-spacing: .04em; }
.tech-flag-stale   { background: #fffbeb; color: #b45309; }
.tech-flag-blocked { background: #fef2f2; color: #b91c1c; }

/* Escalate button */
.tech-escalate-btn { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 3px 10px; font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: color .12s, border-color .12s; }
.tech-escalate-btn:hover { color: var(--critical); border-color: var(--critical); }

/* Error banner */
.tech-error-banner { background: #fef2f2; border: 1px solid #fecaca; border-left: 4px solid var(--critical); border-radius: 8px; padding: 12px 16px; font-size: 13px; color: #7f1d1d; margin-bottom: 16px; }

/* Ticket ID link */
.ticket-id-link { color: #0ea5e9; text-decoration: none; font-family: "SF Mono","Cascadia Code",Consolas,monospace; font-size: 12px; }
.ticket-id-link:hover { text-decoration: underline; }

/* Empty state */
.tech-empty-state { padding: 28px 20px; font-size: 13px; text-align: center; color: var(--text-muted); }

/* Dept pills for live-data departments */
.dept-pill-mkt  { background: #f5f3ff; color: #5b21b6; }
.dept-pill-tech { background: #e0f2fe; color: #0c4a6e; }

/* Audit event type badges */
.audit-event { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 100px; white-space: nowrap; }
.audit-event--login         { background: #dcfce7; color: #166534; }
.audit-event--logout        { background: #f1f5f9; color: #475569; }
.audit-event--access_denied { background: #fef2f2; color: #991b1b; }
.audit-event--page_view     { background: #eff6ff; color: #1d4ed8; }

/* Search input (detail pages) */
.tech-search-input {
    flex: 1; max-width: 360px; padding: 6px 12px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; color: var(--text); background: var(--card-bg);
    outline: none; transition: border-color .12s;
}
.tech-search-input:focus { border-color: var(--accent); }

/* Responsive tweaks */
@media (max-width: 1100px) {
    .tech-dash-grid { grid-template-columns: 1fr 1fr; }
    .tech-dash-grid > .tech-panel:last-child { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
    .tech-dash-grid { grid-template-columns: 1fr; }
    .tech-subnav { overflow-x: auto; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid-4  { grid-template-columns: repeat(2, 1fr); }
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .dept-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .kpi-strip { grid-template-columns: 1fr; }
    .dept-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .content { padding: 16px; }
}
