:root {
    --app-sidebar: #173f4d;
    --app-sidebar-muted: #aac0c7;
    --app-canvas: #f4f5f7;
    --app-border: #e3e5e8;
    --app-shadow: 0 8px 30px rgba(19, 64, 151, .06);
    --status-completed: #2b9c8d;
    --status-progress: #e4aa32;
    --status-not-started: #aeb4bc;
    --attention-support: #3266b3;
    --attention-escalation: #b95757;
}

body.authenticated-app {
    background: var(--app-canvas);
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    background: var(--app-sidebar);
    color: #fff;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 9px 22px;
    text-decoration: none;
}

.sidebar-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--dataq-green);
    color: #fff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -.04em;
}

.sidebar-brand-copy {
    display: grid;
    line-height: 1.15;
}

.sidebar-brand-copy strong {
    font-size: 17px;
    letter-spacing: -.02em;
}

.sidebar-brand-copy span {
    margin-top: 3px;
    color: var(--app-sidebar-muted);
    font-size: 11px;
}

.sidebar-label {
    margin: 14px 10px 7px;
    color: var(--app-sidebar-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    color: #edf5f7;
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, .09);
}

.sidebar-nav a.is-current {
    background: rgba(43, 156, 141, .24);
    color: #fff;
}

.sidebar-count {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--dataq-green);
    color: #fff;
    text-align: center;
    font-size: 11px;
}

.sidebar-account {
    margin-top: auto;
    padding: 17px 9px 0;
    border-top: 1px solid rgba(255, 255, 255, .13);
}

.sidebar-account strong,
.sidebar-account span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account strong {
    font-size: 13px;
}

.sidebar-account span {
    margin-top: 2px;
    color: var(--app-sidebar-muted);
    font-size: 11px;
}

.sidebar-account form {
    margin-top: 12px;
}

.sidebar-account .link-button {
    color: #d8e7eb;
    font-size: 12px;
}

.app-main {
    min-width: 0;
}

.workspace-topbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 30px;
    background: rgba(255, 255, 255, .93);
    border-bottom: 1px solid var(--app-border);
}

.workspace-title {
    display: grid;
    gap: 1px;
}

.workspace-title strong {
    font-size: 13px;
}

.workspace-title span {
    color: var(--text-muted);
    font-size: 11px;
}

.workspace-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #fff;
    color: #34434a;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.authenticated-app .page-shell {
    max-width: 1680px;
    padding: 28px 30px 42px;
}

.dashboard-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 20px;
}

.dashboard-heading h1 {
    margin: 5px 0 4px;
    font-size: 30px;
    letter-spacing: -.035em;
}

.dashboard-filter {
    min-width: 210px;
    display: grid;
    gap: 5px;
}

.dashboard-filter label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dashboard-filter select {
    min-height: 39px;
    padding: 7px 34px 7px 11px;
    border: 1px solid #d8dce1;
    border-radius: 8px;
    background: #fff;
    color: var(--dataq-night);
    font: inherit;
    font-size: 13px;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.kpi-card {
    min-height: 124px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border: 1px solid var(--app-border);
    border-top: 3px solid #6c7b82;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--app-shadow);
}

.kpi-card-success { border-top-color: var(--status-completed); }
.kpi-card-attention { border-top-color: var(--attention-escalation); }
.kpi-card-active { border-top-color: var(--dataq-blue); }

.kpi-label,
.kpi-meta {
    color: var(--text-muted);
    font-size: 11px;
}

.kpi-label {
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.kpi-card strong {
    margin: 4px 0;
    font-size: 31px;
    line-height: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-widget {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--app-border);
    border-radius: 11px;
    background: #fff;
    box-shadow: var(--app-shadow);
}

.widget-wide { grid-column: span 2; }
.widget-full { grid-column: 1 / -1; }

.widget-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
}

.widget-heading h2 {
    margin: 3px 0 0;
    font-size: 17px;
    letter-spacing: -.015em;
}

.widget-kicker {
    margin: 0;
    color: var(--dataq-green);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.widget-caption {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}

.client-progress-list {
    display: grid;
    gap: 16px;
}

.client-progress-row {
    display: grid;
    gap: 6px;
}

.client-progress-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf0f2;
}

.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--dataq-green), #46b3a5);
}

.client-progress-meta {
    color: var(--text-muted);
    font-size: 10px;
}

.status-stack {
    width: 100%;
    height: 22px;
    display: flex;
    overflow: hidden;
    border-radius: 6px;
    background: #edf0f2;
}

.status-segment { display: block; height: 100%; }
.status-segment-completed { background: var(--status-completed); }
.status-segment-progress { background: var(--status-progress); }
.status-segment-not-started { background: var(--status-not-started); }

.status-legend {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.status-legend > div {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f1f2;
    font-size: 12px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-completed { background: var(--status-completed); }
.legend-progress { background: var(--status-progress); }
.legend-not-started { background: var(--status-not-started); }

.dashboard-table-wrap {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #edf0f2;
    text-align: left;
    vertical-align: middle;
}

.dashboard-table th {
    color: #778187;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.dashboard-table td {
    font-size: 12px;
}

.dashboard-table tbody tr:hover {
    background: #fafbfb;
}

.table-secondary {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
}

.attention-badge {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.attention-support {
    background: #eaf1fb;
    color: #275d9f;
}

.attention-escalation {
    background: #faeaea;
    color: #994545;
}

.table-action {
    color: var(--dataq-blue);
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.positive-empty,
.widget-empty {
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #dce1e4;
    border-radius: 9px;
    background: #fafbfb;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}

.positive-empty {
    justify-content: flex-start;
    gap: 12px;
    padding: 18px;
    background: #f4fbf9;
    border-color: #cfe9e3;
    text-align: left;
}

.positive-empty-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--dataq-green);
    color: #fff;
    font-weight: 900;
}

.positive-empty strong,
.positive-empty span {
    display: block;
}

.positive-empty div span {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
}

.workload-list {
    display: grid;
}

.workload-head,
.workload-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(4, minmax(74px, .55fr));
    gap: 10px;
    align-items: center;
}

.workload-head {
    padding: 0 8px 8px;
    color: #7b858a;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.workload-row {
    min-height: 54px;
    padding: 8px;
    border-top: 1px solid #edf0f2;
    font-size: 12px;
}

.employee-cell {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.employee-cell > span:last-child {
    min-width: 0;
}

.employee-cell strong,
.employee-cell small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-cell small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 9px;
}

.avatar-chip {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #e8f4f2;
    color: #176d61;
    font-weight: 900;
}

.metric-completed { color: #197566; font-weight: 800; }
.metric-progress { color: #9b711c; font-weight: 800; }
.metric-not-started { color: #667177; font-weight: 800; }

.active-work-list {
    display: grid;
    gap: 7px;
}

.active-work-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px;
    border: 1px solid #e8ebed;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.active-work-row:hover {
    border-color: #bbd9d4;
    background: #fbfffe;
}

.active-work-row strong,
.active-work-row span {
    display: block;
}

.active-work-row strong {
    font-size: 12px;
}

.active-work-row div span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

.duration-chip {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 6px;
    background: #eaf1fb;
    color: var(--dataq-blue);
    font-size: 10px;
    font-weight: 850;
}

@media (max-width: 1180px) {
    .app-layout { grid-template-columns: 210px minmax(0, 1fr); }
    .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .widget-wide { grid-column: span 2; }
    .widget-full { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
    .app-layout { display: block; }
    .app-sidebar { position: static; height: auto; }
    .sidebar-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar-account { margin-top: 18px; }
    .workspace-topbar { padding: 0 18px; }
    .authenticated-app .page-shell { padding: 22px 16px 34px; }
    .dashboard-heading { align-items: stretch; flex-direction: column; }
    .dashboard-filter { min-width: 0; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .widget-wide, .widget-full { grid-column: auto; }
    .workload-head { display: none; }
    .workload-row { grid-template-columns: minmax(170px, 1fr) repeat(4, 44px); }
}
