:root {
    color-scheme: light;
    --page: #f5f6f8;
    --surface: #ffffff;
    --surface-alt: #fafbfc;
    --sidebar: #17212b;
    --sidebar-muted: #9aa7b5;
    --text: #1f2933;
    --muted: #667085;
    --line: #d9dee5;
    --line-soft: #edf0f3;
    --primary: #1f7a8c;
    --primary-dark: #176270;
    --success: #18845b;
    --danger: #be3944;
    --warning: #a05a00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    letter-spacing: 0;
    background: var(--page);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: 0; }
h2 { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 650; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.login-shell {
    display: grid;
    place-items: center;
    padding: 32px;
    background: #eef1f5;
}

.login-window {
    width: min(980px, 100%);
    min-height: 560px;
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.window-chrome { display: none; }

.login-grid { display: contents; }

.brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 42px;
    background: #f8fafc;
    border-right: 1px solid var(--line);
}

.brand-mark {
    width: 54px;
    height: 54px;
    object-fit: contain;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.muted { max-width: 360px; color: var(--muted); }

.login-preview {
    display: grid;
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--line);
}

.login-preview div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--surface);
}

.login-preview span,
label span,
.metric-head span,
.details span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.login-preview strong { font-size: 13px; font-weight: 700; }

.login-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: 56px 70px;
    background: var(--surface);
}

.wordmark { width: 142px; height: auto; margin-bottom: 18px; }
label span { margin-bottom: 7px; }

input,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cfd6df;
    border-radius: 5px;
    padding: 8px 11px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #667085 50%),
        linear-gradient(135deg, #667085 50%, transparent 50%);
    background-position:
        calc(100% - 17px) 17px,
        calc(100% - 12px) 17px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.12);
}

button {
    min-height: 40px;
    border: 1px solid var(--primary-dark);
    border-radius: 5px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover { background: var(--primary-dark); }
button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.alert,
.notice {
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 650;
}

.alert {
    border: 1px solid rgba(190, 57, 68, 0.25);
    background: #fff4f5;
    color: var(--danger);
}

.notice {
    border: 1px solid rgba(24, 132, 91, 0.25);
    background: #f0fbf6;
    color: var(--success);
}

.page-field,
.dashboard-page {
    min-height: 100vh;
    background: var(--page);
}

.dashboard-shell,
.app-window {
    min-height: 100vh;
    display: grid;
    grid-template-columns: clamp(212px, 16vw, 244px) minmax(0, 1fr);
    background: var(--page);
    transition: grid-template-columns 160ms ease;
}

.app-window {
    width: 100%;
}

.profile-window {
    max-width: none;
}

.app-toolbar {
    grid-row: 1 / span 2;
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 18px 14px;
    border-right: 1px solid #101922;
    background: var(--sidebar);
    color: #fff;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 8px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
    width: 30px;
    min-height: 30px;
    margin-left: auto;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-muted);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.brand-lockup img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.brand-lockup strong { font-size: 15px; font-weight: 700; }

.pill-nav {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.pill-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 9px 12px;
    border-radius: 5px;
    color: var(--sidebar-muted);
    font-size: 14px;
    font-weight: 600;
}

.pill-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    text-decoration: none;
}

.pill-nav a.active {
    color: #fff;
    background: rgba(31, 122, 140, 0.88);
}

.user-chip {
    margin-top: auto;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 12px 8px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.user-chip b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip span,
.profile-mini span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #dfe7ee;
    color: #26323d;
    font-weight: 800;
}

body.sidebar-collapsed .dashboard-shell,
body.sidebar-collapsed .app-window {
    grid-template-columns: 72px minmax(0, 1fr);
}

body.sidebar-collapsed .app-toolbar {
    align-items: center;
    padding: 18px 10px;
}

body.sidebar-collapsed .brand-lockup {
    display: grid;
    justify-items: center;
    gap: 10px;
    justify-content: center;
    width: 100%;
    padding: 0 0 14px;
}

body.sidebar-collapsed .brand-lockup strong,
body.sidebar-collapsed .pill-nav a span,
body.sidebar-collapsed .user-chip b {
    display: none;
}

body.sidebar-collapsed .sidebar-toggle {
    position: static;
    margin-left: 0;
    transform: none;
}

body.sidebar-collapsed .pill-nav {
    width: 100%;
    padding-top: 0;
}

body.sidebar-collapsed .pill-nav a {
    justify-content: center;
    padding: 9px;
}

body.sidebar-collapsed .user-chip {
    grid-template-columns: 34px;
    justify-content: center;
    width: 100%;
    padding: 12px 0 2px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 18px;
    width: min(100%, 1480px);
    min-width: 0;
    margin: 0 auto;
    padding: 20px;
}

.workspace.single {
    grid-template-columns: minmax(0, 1fr);
}

.main-column,
.side-column {
    display: grid;
    gap: 14px;
    align-content: start;
    min-width: 0;
}

.welcome-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: auto;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--line);
    background: transparent;
}

.welcome-band > div:first-child {
    min-width: 0;
}

.welcome-band p:last-child {
    margin: 0;
    max-width: 620px;
    font-size: 13px;
}

.welcome-band a,
.panel-title a,
.inline-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #cfd6df;
    border-radius: 5px;
    color: var(--text);
    background: var(--surface);
    font-size: 13px;
    font-weight: 650;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex: 0 0 auto;
    gap: 8px;
}

.welcome-band a:hover,
.panel-title a:hover,
.inline-link:hover {
    border-color: #b9c2cc;
    background: #f8fafc;
    text-decoration: none;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--line);
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.metric-card {
    min-height: 104px;
    padding: 16px;
    border: 0;
    border-radius: 0;
}

.metric-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.metric-head em,
.task-meta span,
.task-meta em,
.project-card span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid #ccd6dd;
    border-radius: 999px;
    background: #f7f9fb;
    color: #596673;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.metric-head em.green {
    color: var(--success);
    border-color: #b8dcca;
    background: #f3fbf7;
}

.metric-card strong {
    display: block;
    font-size: 26px;
    line-height: 1;
    font-weight: 700;
}

.metric-card p { margin: 8px 0 0; font-size: 13px; }

.panel { padding: 0; }

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
    margin: 0;
}

.panel-actions,
.task-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.panel-actions span,
.panel-title > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.timesheet-panel { display: grid; gap: 0; }

.timesheet-form {
    display: grid;
    grid-template-columns: 150px 110px repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    padding: 16px;
}

.timesheet-form .wide { grid-column: span 3; }
.timesheet-form button { min-height: 40px; }

.quick-entry {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--line-soft);
}

.quick-entry strong {
    font-size: 14px;
    font-weight: 670;
}

.quick-entry p {
    max-width: 620px;
    margin: 0;
    font-size: 13px;
}

.quick-entry button {
    justify-self: start;
    margin-top: 4px;
}

.entry-modal {
    width: 680px;
    max-width: calc(100vw - 48px);
    max-height: min(720px, calc(100vh - 48px));
    margin: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 60px rgba(18, 28, 38, 0.22);
    overflow: hidden;
}

.entry-modal::backdrop {
    background: rgba(15, 23, 32, 0.42);
}

.modal-card {
    display: grid;
    gap: 0;
    max-height: inherit;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.modal-head p {
    margin: 4px 0 0;
    font-size: 13px;
}

.modal-body.timesheet-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px 20px;
    overflow: auto;
}

.modal-body.timesheet-form .wide {
    grid-column: span 2;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line-soft);
    background: var(--surface-alt);
}

.icon-button {
    width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid #cfd6df;
    background: var(--surface);
    color: var(--muted);
}

.icon-button:hover,
.secondary-button:hover {
    border-color: #b9c2cc;
    background: #f8fafc;
    color: var(--text);
}

.secondary-button {
    border-color: #cfd6df;
    background: var(--surface);
    color: var(--text);
}

.assignments-panel { display: grid; gap: 0; }

.task-list,
.project-list {
    display: grid;
}

.task-row,
.activity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 12px 16px;
    border-top: 1px solid var(--line-soft);
}

.managed-task-row {
    grid-template-columns: 1fr;
    gap: 12px;
}

.task-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 16px;
}

.task-controls {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.task-update-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.task-update-form button,
.task-controls > form > button {
    min-height: 40px;
    white-space: nowrap;
}

.task-row:first-child,
.activity-row:first-child {
    border-top: 0;
}

.task-row strong,
.project-card strong,
.activity-row strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 670;
}

.task-row small,
.project-card small,
.activity-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.project-card {
    padding: 14px 16px;
    border-top: 1px solid var(--line-soft);
    background: var(--surface);
}

.project-card:first-child {
    border-top: 0;
}

.project-card div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.secondary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-panel { padding-bottom: 0; }

.activity-row {
    grid-template-columns: 10px minmax(0, 1fr) auto;
}

.activity-row b {
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.empty-state {
    padding: 16px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 13px;
}

.empty-state.compact { padding: 16px; }

.compact-card { min-height: auto; }
.side-column .compact-card { min-height: auto; }
.tint-card { background: var(--surface); }

.profile-mini {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 22px 16px;
    text-align: center;
}

.profile-mini strong { margin-top: 4px; font-size: 16px; }
.profile-mini small { color: var(--muted); }
.profile-mini.large span { width: 58px; height: 58px; font-size: 22px; }

.profile-card { padding: 0; }

.details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line-soft);
}

.details div {
    padding: 16px;
    border-right: 1px solid var(--line-soft);
}

.details div:last-child { border-right: 0; }
.details strong { display: block; margin-top: 6px; font-size: 14px; font-weight: 680; }

.analytics-body,
.legend,
.callout,
.dot-chart,
.search-dot,
.source-bars,
.split-stats {
    display: none;
}

@media (max-width: 1120px) {
    body.sidebar-collapsed .dashboard-shell,
    body.sidebar-collapsed .app-window,
    .dashboard-shell,
    .app-window {
        grid-template-columns: 1fr;
    }

    .app-toolbar {
        grid-row: auto;
        position: sticky;
        top: 0;
        z-index: 20;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        min-height: 58px;
        padding: 10px 14px;
        border-right: 0;
        border-bottom: 1px solid #101922;
    }

    .brand-lockup {
        flex: 0 0 auto;
        min-height: 0;
        padding: 0;
        border-bottom: 0;
    }

    .sidebar-toggle {
        display: none;
    }

    body.sidebar-collapsed .brand-lockup strong,
    body.sidebar-collapsed .pill-nav a span,
    body.sidebar-collapsed .user-chip b {
        display: inline;
    }

    body.sidebar-collapsed .app-toolbar {
        align-items: center;
        padding: 10px 14px;
    }

    body.sidebar-collapsed .pill-nav {
        width: auto;
        padding-top: 2px;
    }

    body.sidebar-collapsed .pill-nav a {
        justify-content: flex-start;
        padding: 7px 10px;
    }

    .brand-lockup img {
        width: 30px;
        height: 30px;
    }

    .brand-lockup strong {
        font-size: 14px;
        white-space: nowrap;
    }

    .pill-nav {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
        gap: 4px;
        padding: 2px 0;
        scrollbar-width: thin;
    }

    .pill-nav a {
        flex: 0 0 auto;
        min-height: 34px;
        padding: 7px 10px;
        white-space: nowrap;
    }

    .user-chip {
        flex: 0 0 auto;
        margin-top: 0;
        margin-left: auto;
        padding: 0;
        border-top: 0;
        grid-template-columns: 30px minmax(0, 120px);
    }

    .user-chip span {
        width: 30px;
        height: 30px;
    }

    .workspace {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .side-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .login-shell { padding: 16px; }
    .login-window { grid-template-columns: 1fr; min-height: auto; }
    .brand-panel { padding: 28px; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-form { padding: 28px; }
    .login-preview { display: none; }
    .app-toolbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
    }
    .brand-lockup {
        min-width: 0;
    }
    .brand-lockup strong {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pill-nav {
        grid-column: 1 / -1;
        order: 3;
        margin: 0 -4px;
        padding: 2px 4px;
    }
    .pill-nav a {
        min-height: 32px;
        padding: 6px 10px;
        font-size: 13px;
        gap: 7px;
    }
    .user-chip {
        grid-template-columns: 30px;
        width: auto;
        margin-left: 0;
    }
    .user-chip b {
        display: none;
    }
    .welcome-band {
        align-items: stretch;
        flex-direction: column;
    }
    .page-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .page-actions button,
    .page-actions a {
        flex: 1 1 180px;
        justify-content: center;
    }
    .side-column {
        grid-template-columns: 1fr;
    }
    .metric-grid,
    .secondary-metrics,
    .details,
    .timesheet-form,
    .timesheet-form .wide,
    .modal-body.timesheet-form {
        grid-template-columns: 1fr;
        grid-column: auto;
    }
    .task-row,
    .activity-row {
        grid-template-columns: 1fr;
        align-items: start;
    }
    .task-summary,
    .task-controls,
    .task-update-form {
        grid-template-columns: 1fr;
    }
    .task-meta { justify-content: flex-start; }
    h1 { font-size: 20px; }
}

@media (max-width: 480px) {
    .workspace {
        padding: 12px;
    }

    .panel-title {
        min-height: 44px;
        padding: 10px 12px;
    }

    .timesheet-form,
    .task-row,
    .activity-row,
    .project-card,
    .empty-state {
        padding: 12px;
    }

    .metric-card {
        padding: 14px 12px;
    }

    .entry-modal {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        border-radius: 7px;
    }

    .modal-head,
    .modal-body.timesheet-form,
    .modal-actions {
        padding: 12px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }

    .quick-entry button {
        width: 100%;
    }
}
