:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --panel-soft: #eef3f1;
    --ink: #17202a;
    --muted: #687381;
    --line: #d9e0e7;
    --primary: #256f68;
    --primary-dark: #174f4a;
    --blue: #315f9d;
    --amber: #b46a1f;
    --red: #b33a3a;
    --green: #2e7d4f;
    --shadow: 0 10px 30px rgba(23, 32, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #edf0f3;
    font-size: 0.92em;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(18px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(244, 246, 248, 0.94);
    backdrop-filter: blur(10px);
}

.topbar h1,
.section-heading h2,
.auth-panel h1 {
    margin: 0;
    line-height: 1.1;
}

.topbar h1 {
    font-size: clamp(24px, 3vw, 34px);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.top-actions,
.task-actions,
.row-actions,
.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.app-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 22px clamp(14px, 3vw, 34px) 86px;
}

.hero-grid,
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.7fr);
    gap: 18px;
    align-items: start;
}

.workspace-grid {
    grid-template-columns: minmax(310px, 380px) minmax(0, 1fr);
    margin-top: 18px;
}

.today-panel,
.quick-panel,
.tool-panel,
.matrix-panel,
.table-panel,
.board-panel,
.filter-bar,
.metric-card,
.auth-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.today-panel,
.quick-panel,
.tool-panel,
.matrix-panel,
.table-panel,
.board-panel,
.filter-bar {
    padding: 18px;
}

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

.section-heading.tight {
    margin-bottom: 12px;
}

.section-heading h2 {
    font-size: 21px;
}

.score-badge,
.user-pill,
.due-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.secondary {
    border-color: #bfd2cf;
    background: #e9f2f0;
    color: var(--primary-dark);
}

.button.ghost,
.icon-button {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.button.danger {
    border-color: #efc2c2;
    background: #fff2f2;
    color: var(--red);
}

.icon-button {
    min-width: 54px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.icon-button.success {
    border-color: #b9d9c6;
    background: #edf7f0;
    color: var(--green);
}

.small-link,
.link-button {
    border: 0;
    background: transparent;
    color: var(--blue);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.danger-text {
    color: var(--red);
}

.recommendation-list,
.form-stack,
.side-panel,
.main-panel,
.mini-list {
    display: grid;
    gap: 12px;
}

.task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.task-row.hot {
    border-left: 5px solid var(--primary);
}

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

.task-title-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.task-title-line strong,
td strong,
.board-task strong {
    overflow-wrap: anywhere;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.score-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1f2b37;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chips span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef1f5;
    color: #42505f;
    font-size: 12px;
    font-weight: 700;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.metric-card {
    padding: 16px;
}

.metric-card span,
.metric-card small {
    display: block;
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin: 7px 0;
    font-size: 30px;
    line-height: 1;
}

.form-stack label {
    display: grid;
    gap: 6px;
    color: #334252;
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cfd8e1;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    padding: 9px 10px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(37, 111, 104, 0.16);
    border-color: var(--primary);
}

.two-col,
.score-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.score-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel-note,
.muted,
.empty-state {
    color: var(--muted);
    line-height: 1.5;
}

.filter-bar {
    margin-bottom: 18px;
}

.filter-form {
    align-items: stretch;
}

.filter-form input {
    flex: 1 1 240px;
}

.filter-form select {
    flex: 0 1 180px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.matrix-cell {
    min-height: 170px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.matrix-cell.do-now {
    border-top: 4px solid var(--red);
}

.matrix-cell.schedule {
    border-top: 4px solid var(--blue);
}

.matrix-cell.delegate {
    border-top: 4px solid var(--amber);
}

.matrix-cell.later {
    border-top: 4px solid var(--muted);
}

.matrix-title,
.board-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.matrix-title span,
.board-heading span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #edf0f3;
    font-weight: 900;
}

.mini-list {
    margin-top: 12px;
}

.mini-list a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #263545;
    font-weight: 750;
}

.table-panel {
    margin-top: 18px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

td small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.row-actions {
    justify-content: flex-end;
    min-width: 150px;
}

.row-actions form,
.task-actions form {
    display: inline-flex;
}

.stale-row {
    background: #fff8ef;
}

tr.priority-critical td:first-child {
    box-shadow: inset 5px 0 0 var(--red);
    background: #fff6f6;
}

tr.priority-high td:first-child {
    box-shadow: inset 5px 0 0 var(--amber);
    background: #fff8ef;
}

tr.priority-medium td:first-child {
    box-shadow: inset 5px 0 0 #d1a318;
    background: #fffbea;
}

tr.priority-low td:first-child {
    box-shadow: inset 5px 0 0 var(--green);
    background: #f2f8f4;
}

.empty-cell {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

.board-panel {
    margin-top: 18px;
}

.mobile-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 50;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

.mobile-tabbar a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 7px;
    color: #2c3a49;
    font-size: 12px;
    font-weight: 900;
}

.mobile-tabbar a:active {
    background: var(--panel-soft);
    color: var(--primary-dark);
}

.section-band {
    scroll-margin-top: 92px;
    margin-top: 24px;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.plan-group,
.calendar-bucket,
.tree-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.plan-group {
    min-height: 190px;
    padding: 12px;
}

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

.plan-heading strong {
    display: block;
}

.plan-heading small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.35;
}

.plan-heading span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #edf0f3;
    font-weight: 900;
}

.compact-task {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-left-color: #9aa6b2;
    border-radius: 7px;
    background: #fbfcfd;
}

.compact-task + .compact-task {
    margin-top: 8px;
}

.compact-task strong,
.compact-task span {
    display: block;
    overflow-wrap: anywhere;
}

.compact-task span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.compact-task b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 12px;
}

.compact-task.routine-chip {
    background: #f7f3ea;
}

.compact-task.priority-critical,
.tree-task-list a.priority-critical {
    border-left-color: var(--red);
    background: #fff4f4;
}

.compact-task.priority-high,
.tree-task-list a.priority-high {
    border-left-color: var(--amber);
    background: #fff8ef;
}

.compact-task.priority-medium,
.tree-task-list a.priority-medium {
    border-left-color: #d1a318;
    background: #fffbea;
}

.compact-task.priority-low,
.tree-task-list a.priority-low {
    border-left-color: var(--green);
    background: #f2f8f4;
}

.score-dot.priority-critical,
.compact-task.priority-critical b {
    background: var(--red);
}

.score-dot.priority-high,
.compact-task.priority-high b {
    background: var(--amber);
}

.score-dot.priority-medium,
.compact-task.priority-medium b {
    background: #b38a10;
}

.score-dot.priority-low,
.compact-task.priority-low b {
    background: var(--green);
}

.capacity-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.capacity-panel .panel-note {
    margin-bottom: 0;
}

.capacity-form label {
    display: grid;
    gap: 6px;
    color: #334252;
    font-size: 13px;
    font-weight: 800;
}

.tree-panel {
    padding: 14px;
}

.tree-project,
.tree-phase {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.tree-project + .tree-project,
.tree-phase + .tree-phase {
    margin-top: 10px;
}

.tree-project > summary,
.tree-phase > summary {
    cursor: pointer;
    padding: 12px;
    font-weight: 900;
}

.tree-project > summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.tree-project > summary span {
    color: var(--muted);
    font-size: 12px;
}

.tree-phase {
    margin: 8px 12px 12px;
    background: #fafbfc;
}

.tree-task-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0 12px 12px 28px;
}

.tree-task-list li {
    list-style: none;
}

.tree-task-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-left-width: 5px;
    border-left-color: #9aa6b2;
    border-radius: 7px;
    background: #fff;
}

.tree-task-list span {
    overflow-wrap: anywhere;
}

.tree-task-list b {
    color: var(--primary-dark);
    font-size: 12px;
}

.tree-task-list.level-1 {
    padding-left: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.calendar-bucket {
    min-height: 230px;
    padding: 14px;
}

.calendar-item {
    display: grid;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.calendar-item:last-child {
    border-bottom: 0;
}

.calendar-item span {
    color: var(--muted);
    font-size: 12px;
}

.no-margin {
    margin-top: 0;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.check-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.check-grid input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    min-height: 18px;
}

.score-grid.slim {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(180px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.board-column {
    min-height: 260px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fafb;
}

.board-task {
    display: grid;
    gap: 5px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.board-task span {
    color: var(--muted);
    font-size: 12px;
}

.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 750;
}

.alert.success {
    border-color: #b9d9c6;
    background: #eef8f1;
    color: var(--green);
}

.alert.error {
    border-color: #e7b8b8;
    background: #fff0f0;
    color: var(--red);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 22px;
}

.auth-panel {
    width: min(460px, 100%);
    padding: 26px;
}

.auth-panel.wide {
    width: min(560px, 100%);
}

.auth-panel p {
    color: var(--muted);
    line-height: 1.5;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 900;
}

@media (max-width: 1120px) {
    .hero-grid,
    .workspace-grid {
        grid-template-columns: 1fr;
    }

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

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

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

@media (max-width: 720px) {
    .mobile-tabbar {
        display: grid;
    }

    .topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions,
    .task-row,
    .filter-form {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .button,
    .icon-button,
    .top-actions a,
    .top-actions span {
        width: 100%;
    }

    .metric-grid,
    .matrix-grid,
    .plan-grid,
    .calendar-grid,
    .two-col,
    .score-grid,
    .score-grid.slim,
    .check-grid,
    .capacity-form {
        grid-template-columns: 1fr;
    }

    .today-panel,
    .quick-panel,
    .tool-panel,
    .matrix-panel,
    .table-panel,
    .board-panel,
    .filter-bar {
        padding: 14px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .task-actions {
        width: 100%;
    }

    .task-actions form {
        flex: 1;
    }

    .section-band {
        scroll-margin-top: 14px;
        margin-top: 20px;
    }

    .plan-group,
    .calendar-bucket {
        min-height: auto;
    }

    .tree-project > summary {
        flex-direction: column;
    }
}

/* Dashboard simplification and overflow fixes */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body * {
    min-width: 0;
}

code,
.panel-note,
.data-card,
.calendar-item,
.tree-task-list a,
.compact-task {
    overflow-wrap: anywhere;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

.dashboard-shell {
    max-width: 1360px;
}

.action-shell {
    width: min(760px, 100%);
    padding-top: 24px;
}

.action-shell .tool-panel {
    width: 100%;
}

.action-topbar .top-actions {
    justify-content: flex-end;
}

.section-heading-actions {
    align-items: center;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#routines .mobile-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

#routines .data-card + .data-card {
    margin-top: 0;
}

#routines .table-wrap {
    display: none;
}

.routine-card {
    background: #fffdf8;
}

.filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(140px, 1fr)) auto auto;
    gap: 8px;
}

.filter-form input,
.filter-form select,
.filter-form .button {
    width: 100%;
}

@media (max-width: 900px) {
    .section-nav {
        display: none;
    }

    .app-shell {
        padding-left: 12px;
        padding-right: 12px;
    }

    .topbar {
        padding: 14px 12px;
    }

    .top-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .top-actions .button,
    .top-actions .user-pill {
        width: 100%;
    }

    .table-wrap {
        display: none;
    }

    .mobile-card-list {
        display: block;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .section-heading-actions {
        align-items: stretch;
    }

    .section-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .section-actions .button,
    .section-heading-actions > .button {
        width: 100%;
    }

    .hero-grid,
    .workspace-grid,
    .metric-grid,
    .plan-grid,
    .calendar-grid,
    .two-col,
    .three-col,
    .score-grid,
    .score-grid.slim,
    .check-grid,
    .capacity-form {
        grid-template-columns: 1fr;
    }

    .data-meta-grid {
        grid-template-columns: 1fr;
    }

    .topbar h1 {
        font-size: 28px;
    }

    .section-band {
        margin-top: 18px;
    }
}

/* Work OS redesign */
.workos-frame {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    background: #f3f6f8;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    border-right: 1px solid var(--line);
    background: #ffffff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.brand-mark.small {
    width: 40px;
    height: 40px;
    margin: 0;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

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

.sidebar-nav a {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 8px;
    color: #3f4c5a;
    font-weight: 900;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: #e9f2f0;
    color: var(--primary-dark);
}

.sidebar-nav b {
    min-width: 24px;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.sidebar-add,
.sidebar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 8px;
    font-weight: 900;
}

.sidebar-add {
    margin-top: auto;
    background: var(--primary);
    color: #fff;
}

.sidebar-logout {
    border: 1px solid #efc2c2;
    color: var(--red);
}

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

.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 84px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.app-header h1 {
    margin: 0;
    font-size: clamp(24px, 2.4vw, 34px);
    line-height: 1.1;
}

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

.icon-only {
    width: 42px;
    padding: 0;
}

.dashboard-surface {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px 24px 52px;
}

.page-stack {
    display: grid;
    gap: 16px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.page-heading h2 {
    margin: 0;
    font-size: 28px;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.today-layout {
    display: grid;
    gap: 16px;
}

.today-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 16px;
    align-items: stretch;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(23, 32, 42, 0.06);
}

.today-hero-copy h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
}

.today-hero-copy p {
    margin: 10px 0 0;
    color: var(--muted);
}

.load-card {
    display: grid;
    gap: 7px;
    align-content: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7faf9;
}

.load-card.is-overload {
    border-color: #efc2c2;
    background: #fff4f4;
}

.load-card span,
.load-card small {
    color: var(--muted);
    font-weight: 800;
}

.load-card strong {
    font-size: 34px;
    line-height: 1;
}

.load-bar {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #e0e6ec;
}

.load-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.is-overload .load-bar i {
    background: var(--red);
}

.overload-banner {
    grid-column: 1 / -1;
    padding: 12px 14px;
    border: 1px solid #efc2c2;
    border-radius: 8px;
    background: #fff0f0;
    color: var(--red);
    font-weight: 900;
}

.compact-metrics {
    margin-top: 0;
}

.today-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
    gap: 16px;
}

.today-primary {
    display: grid;
    gap: 14px;
}

.today-aside {
    display: grid;
    gap: 14px;
    align-content: start;
}

.plan-group {
    min-height: 0;
    padding: 14px;
}

.plan-group.tone-critical {
    border-top: 4px solid var(--red);
}

.plan-group.tone-high {
    border-top: 4px solid var(--amber);
}

.plan-group.tone-soft {
    border-top: 4px solid var(--green);
}

.plan-card-list {
    display: grid;
    gap: 10px;
}

.panel-block {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(23, 32, 42, 0.05);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.panel-heading strong {
    font-size: 17px;
}

.panel-heading span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.timeline-list {
    display: grid;
    gap: 10px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 5px solid #9aa6b2;
    border-radius: 8px;
    background: #fbfcfd;
}

.timeline-item.priority-critical {
    border-left-color: var(--red);
}

.timeline-item.priority-high {
    border-left-color: var(--amber);
}

.timeline-item.priority-medium {
    border-left-color: #d1a318;
}

.timeline-item.priority-low {
    border-left-color: var(--green);
}

.timeline-item time {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.timeline-item strong,
.timeline-item span {
    display: block;
    overflow-wrap: anywhere;
}

.timeline-item span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.work-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-left: 6px solid #9aa6b2;
    border-radius: 8px;
    background: #ffffff;
}

.work-card.priority-critical {
    border-left-color: var(--red);
    background: #fff7f7;
}

.work-card.priority-high {
    border-left-color: var(--amber);
    background: #fff9f1;
}

.work-card.priority-medium {
    border-left-color: #d1a318;
    background: #fffdf0;
}

.work-card.priority-low {
    border-left-color: var(--green);
    background: #f4faf6;
}

.work-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.work-card-main strong,
.work-card-main span {
    display: block;
    overflow-wrap: anywhere;
}

.work-card-main span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.work-card-main b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
}

.task-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.task-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef1f5;
    color: #3f4c5a;
    font-size: 12px;
    font-weight: 900;
}

.task-chip.priority-critical {
    background: #ffe3e3;
    color: var(--red);
}

.task-chip.priority-high,
.task-chip.money {
    background: #fff0dc;
    color: var(--amber);
}

.task-chip.priority-medium {
    background: #fff6c9;
    color: #8d6c00;
}

.task-chip.priority-low {
    background: #e6f4ea;
    color: var(--green);
}

.task-chip.waiting {
    background: #e9eef9;
    color: var(--blue);
}

.task-chip.status {
    background: #edf0f3;
    color: #42505f;
}

.work-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.work-card-actions a,
.work-card-actions button {
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.smart-empty {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px dashed #c9d4df;
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--muted);
}

.smart-empty strong {
    color: var(--ink);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.action-tile {
    display: grid;
    gap: 8px;
    min-height: 130px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(23, 32, 42, 0.05);
}

.action-tile.primary {
    border-left: 5px solid var(--primary);
}

.action-tile span {
    color: var(--muted);
    line-height: 1.45;
}

.routine-panel .mobile-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.routine-panel .table-wrap {
    display: none;
}

.filter-drawer {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.filter-drawer summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
}

.filter-drawer summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.filter-drawer .filter-form {
    padding: 0 14px 14px;
}

@media (max-width: 1024px) {
    .workos-frame {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        display: none;
    }

    .app-header {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 12px;
    }

    .header-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .header-actions .button,
    .header-actions .user-pill {
        width: 100%;
    }

    .compact-action,
    .header-actions .user-pill {
        display: none;
    }

    .dashboard-surface {
        padding: 14px 12px 92px;
    }

    .today-hero,
    .today-grid,
    .metric-grid,
    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-drawer[open] {
        position: fixed;
        inset: auto 10px 82px;
        z-index: 80;
        max-height: min(78vh, 680px);
        overflow: auto;
        box-shadow: 0 20px 50px rgba(23, 32, 42, 0.2);
    }

    .filter-drawer .filter-form {
        grid-template-columns: 1fr;
    }

    .mobile-tabbar {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .mobile-tabbar a {
        display: grid;
        gap: 3px;
        place-items: center;
        min-height: 44px;
        font-size: 11px;
    }

    .mobile-tabbar a.active {
        background: var(--panel-soft);
        color: var(--primary-dark);
    }

    .mobile-tabbar span {
        font-size: 13px;
    }
}

@media (max-width: 560px) {
    .header-actions {
        grid-template-columns: 1fr 1fr;
    }

    .app-header h1 {
        font-size: 25px;
    }

    .today-hero {
        padding: 14px;
    }

    .today-hero-copy h2 {
        font-size: 27px;
    }

    .data-card,
    .work-card,
    .panel-block,
    .plan-group,
    .calendar-bucket,
    .tree-panel {
        border-radius: 8px;
    }
}

/* Visual refresh */
.topbar {
    background: rgba(255, 255, 255, 0.96);
}

.topbar h1 {
    font-size: clamp(28px, 2.4vw, 38px);
}

.section-nav {
    position: sticky;
    top: 86px;
    z-index: 18;
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 18px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 22px rgba(23, 32, 42, 0.06);
}

.section-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 7px;
    color: #42505f;
    font-weight: 900;
}

.section-nav a:hover,
.section-nav a:focus {
    background: var(--panel-soft);
    color: var(--primary-dark);
}

.section-band {
    padding-top: 8px;
}

.section-band > .section-heading {
    padding: 0 2px;
}

.today-panel,
.quick-panel,
.tool-panel,
.table-panel,
.tree-panel,
.calendar-bucket,
.plan-group,
.metric-card,
.filter-bar {
    box-shadow: 0 8px 22px rgba(23, 32, 42, 0.06);
}

.metric-card {
    border-left: 5px solid #9aa6b2;
}

.metric-card:nth-child(1) {
    border-left-color: var(--blue);
}

.metric-card:nth-child(2) {
    border-left-color: var(--primary);
}

.metric-card:nth-child(3) {
    border-left-color: var(--amber);
}

.metric-card:nth-child(4) {
    border-left-color: var(--red);
}

.plan-group:nth-child(1) {
    border-top: 4px solid var(--red);
}

.plan-group:nth-child(2) {
    border-top: 4px solid var(--amber);
}

.plan-group:nth-child(3) {
    border-top: 4px solid var(--blue);
}

.plan-group:nth-child(4) {
    border-top: 4px solid #7c5c25;
}

.plan-group:nth-child(5) {
    border-top: 4px solid var(--green);
}

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

.compact-form {
    gap: 14px;
}

.form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.form-section summary {
    cursor: pointer;
    padding: 12px 14px;
    color: #263545;
    font-weight: 900;
}

.form-section-body {
    display: grid;
    gap: 12px;
    padding: 0 14px 14px;
}

.mobile-card-list {
    display: none;
}

.data-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 6px solid #9aa6b2;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(23, 32, 42, 0.05);
}

.table-panel {
    overflow: hidden;
}

.action-shell .tool-panel {
    padding: 22px;
}

.action-shell .section-heading h2 {
    font-size: 24px;
}

.dashboard-shell > .section-band {
    border-top: 1px solid rgba(217, 224, 231, 0.7);
    padding-top: 20px;
}

.tree-panel {
    max-height: none;
}

.data-card + .data-card {
    margin-top: 12px;
}

.data-card.priority-critical {
    border-left-color: var(--red);
}

.data-card.priority-high {
    border-left-color: var(--amber);
}

.data-card.priority-medium {
    border-left-color: #d1a318;
}

.data-card.priority-low {
    border-left-color: var(--green);
}

.data-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.data-card-head strong,
.data-card-head span {
    display: block;
    overflow-wrap: anywhere;
}

.data-card-head span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.data-card-head b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
}

.data-card.priority-critical .data-card-head b {
    background: var(--red);
}

.data-card.priority-high .data-card-head b {
    background: var(--amber);
}

.data-card.priority-medium .data-card-head b {
    background: #b38a10;
}

.data-card.priority-low .data-card-head b {
    background: var(--green);
}

.data-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 0;
}

.data-meta-grid div {
    padding: 9px;
    border-radius: 7px;
    background: #f5f7f9;
}

.data-meta-grid dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.data-meta-grid dd {
    margin: 4px 0 0;
    color: #263545;
    font-weight: 800;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.card-actions form {
    display: contents;
}

.card-actions .button {
    min-height: 36px;
}

@media (min-width: 1121px) {
    .hero-grid {
        grid-template-columns: minmax(0, 1fr) 300px;
    }

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

@media (max-width: 720px) {
    body {
        background: #f6f8fa;
        font-size: 14px;
    }

    .section-nav {
        display: none;
    }

    .app-shell {
        padding: 14px 12px 92px;
    }

    .topbar h1 {
        font-size: 30px;
    }

    .top-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-actions .button,
    .top-actions .user-pill {
        width: 100%;
    }

    .table-wrap {
        display: none;
    }

    .mobile-card-list {
        display: block;
    }

    .three-col {
        grid-template-columns: 1fr;
    }

    .data-meta-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .plan-grid,
    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .metric-card strong {
        font-size: 26px;
    }

    .section-heading h2 {
        font-size: 20px;
    }

    .card-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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