:root {
    --bg: #e8eef8;
    --window: #ffffff;
    --panel: #f4f7fd;
    --soft: #edf3ff;
    --text: #121826;
    --muted: #6c7588;
    --line: #dfe7f4;
    --blue: #2574df;
    --cyan: #14b8c8;
    --purple: #7c4ce5;
    --pink: #e450b2;
    --amber: #f0a90f;
    --green: #21a67a;
    --red: #dc4b55;
    --shadow: 0 24px 80px rgba(31, 41, 55, 0.13);
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #e1e8f4, var(--bg));
    color: var(--text);
}

[hidden] {
    display: none !important;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.app-frame {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) 260px;
    overflow: hidden;
    border-radius: 0;
    background: var(--window);
    box-shadow: none;
}

.sidebar {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 24px;
    padding: 26px 20px;
    border-right: 1px solid var(--line);
    background: var(--window);
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
}

.icon-button:hover {
    background: var(--soft);
}

.side-nav {
    display: grid;
    gap: 18px;
    align-content: start;
    padding-top: 18px;
}

.side-link {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 34px;
    color: var(--text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.side-link svg {
    color: var(--muted);
}

.side-link.is-active svg {
    color: var(--blue);
}

.app-frame.is-nav-collapsed {
    grid-template-columns: 82px minmax(0, 1fr) 260px;
}

.app-frame.is-nav-collapsed .side-link {
    grid-template-columns: 1fr;
    justify-items: center;
}

.app-frame.is-nav-collapsed .side-link span {
    display: none;
}

.main-area {
    min-width: 0;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr;
    gap: 20px;
    padding: 28px;
    background: linear-gradient(180deg, var(--window), #f8faff);
}

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

.breadcrumb {
    margin-bottom: 28px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: 0;
}

.subtitle {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.top-actions {
    display: grid;
    justify-items: end;
    gap: 22px;
}

.top-tabs {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
}

.top-tab {
    position: relative;
    min-height: 34px;
    padding: 6px 0 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.top-tab.is-active {
    color: var(--blue);
}

.top-tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.primary-button,
.ghost-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    padding: 10px 14px;
    border: 0;
    font-weight: 700;
    font-size: 13px;
}

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

.primary-button:hover {
    background: #1f63c4;
}

.ghost-button {
    background: var(--soft);
    color: var(--text);
}

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(240, 169, 15, 0.35);
    border-radius: 8px;
    background: rgba(240, 169, 15, 0.11);
    color: #835d0a;
    font-size: 13px;
    font-weight: 600;
}

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

.summary-card {
    display: grid;
    gap: 8px;
    min-height: 106px;
    padding: 15px;
    border-radius: 8px;
    background: var(--panel);
}

.summary-label,
.summary-card small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.summary-card strong {
    font-size: 30px;
    line-height: 1;
}

.timeline-panel {
    display: grid;
    grid-template-columns: 214px minmax(0, 1fr);
    gap: 16px;
    padding: 24px 20px 22px;
    border-radius: 8px;
    background: var(--panel);
}

.timeline-list {
    display: grid;
    gap: 12px;
    align-content: end;
    padding-top: 58px;
}

.timeline-task {
    min-height: 48px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 999px;
    background: var(--window);
    box-shadow: 0 10px 28px rgba(37, 116, 223, 0.12);
}

.category-letter {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--category-color, var(--blue));
    color: #ffffff;
    font-weight: 800;
}

.timeline-copy {
    min-width: 0;
}

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

.timeline-copy strong {
    font-size: 10px;
    text-transform: uppercase;
}

.timeline-copy span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.timeline-chart {
    min-width: 0;
    display: grid;
    grid-template-rows: 36px 250px;
}

.timeline-dates {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.timeline-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    min-width: 0;
}

.timeline-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(12.5% - 1px),
        var(--line) calc(12.5% - 1px),
        var(--line) 12.5%
    );
    pointer-events: none;
}

.timeline-bar {
    position: absolute;
    left: var(--left);
    top: var(--top);
    width: var(--width);
    min-width: 168px;
    height: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--category-color), color-mix(in srgb, var(--category-color) 54%, #ffffff));
    color: #ffffff;
    box-shadow: 0 14px 26px color-mix(in srgb, var(--category-color) 24%, transparent);
    overflow: hidden;
}

.timeline-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent var(--progress), rgba(255, 255, 255, 0.42) var(--progress));
    pointer-events: none;
}

.timeline-bar-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.timeline-bar-copy strong,
.timeline-bar-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-bar-copy strong {
    font-size: 10px;
}

.timeline-bar-copy span {
    color: rgba(255, 255, 255, 0.82);
    font-size: 9px;
}

.timeline-percent {
    position: relative;
    z-index: 1;
    font-size: 18px;
    font-weight: 800;
}

.board-section {
    display: grid;
    gap: 14px;
}

.board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.board-header h2,
.right-panel h2 {
    font-size: 16px;
    line-height: 1.25;
}

.search-field {
    width: min(320px, 100%);
    min-height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--window);
    color: var(--muted);
}

.search-field input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.kanban-lane {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}

.kanban-lane h3 {
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.task-stack {
    display: grid;
    gap: 12px;
    min-height: 138px;
}

.task-card {
    display: grid;
    grid-template-rows: auto auto auto auto auto;
    gap: 12px;
    min-width: 0;
    min-height: 0;
    padding: 14px;
    border: 1px solid rgba(223, 231, 244, 0.72);
    border-radius: 8px;
    background: var(--window);
    box-shadow: 0 14px 34px rgba(37, 116, 223, 0.1);
}

.task-card-header {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 8px;
}

.task-card-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.task-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
}

.task-card-title {
    min-width: 0;
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.task-card-description {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.task-card-meta span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-select {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--window);
    color: var(--text);
    font-size: 11px;
}

.mini-actions {
    display: flex;
    gap: 4px;
}

.mini-actions .icon-button {
    width: 30px;
    height: 30px;
}

.progress-line {
    display: grid;
    gap: 5px;
}

.progress-line span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--soft);
}

.progress-input {
    width: 100%;
    accent-color: var(--cyan);
}

.progress-fill {
    width: var(--progress);
    height: 100%;
    background: var(--cyan);
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.feature-panel {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 8px;
    background: var(--panel);
}

.feature-panel h2 {
    font-size: 18px;
}

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

.feature-card {
    display: grid;
    gap: 10px;
    min-height: 120px;
    padding: 16px;
    border-radius: 8px;
    background: var(--window);
}

.feature-card strong {
    font-size: 24px;
}

.feature-card span,
.feature-card p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.feature-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.priority-badge[data-priority="high"] {
    color: var(--red);
    background: rgba(220, 75, 85, 0.12);
}

.priority-badge[data-priority="medium"] {
    color: #9b6a00;
    background: rgba(240, 169, 15, 0.14);
}

.right-panel {
    display: grid;
    gap: 28px;
    align-content: start;
    padding: 30px 26px;
    border-left: 1px solid var(--line);
    background: var(--window);
}

.profile-block {
    display: grid;
    justify-items: center;
    gap: 9px;
    padding-top: 12px;
    text-align: center;
}

.profile-mark {
    position: relative;
    width: 58px;
    height: 58px;
}

.profile-mark span {
    position: absolute;
    width: 33px;
    height: 33px;
    border-radius: 18px;
    opacity: 0.92;
    transform: rotate(45deg);
}

.profile-mark span:nth-child(1) {
    left: 12px;
    top: 0;
    background: var(--cyan);
}

.profile-mark span:nth-child(2) {
    right: 0;
    top: 12px;
    background: var(--pink);
}

.profile-mark span:nth-child(3) {
    left: 12px;
    bottom: 0;
    background: var(--purple);
}

.profile-mark span:nth-child(4) {
    left: 0;
    top: 12px;
    background: var(--blue);
}

.profile-mark i {
    position: absolute;
    left: 22px;
    top: 22px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--amber);
}

.profile-block h2 {
    font-size: 20px;
    line-height: 1.15;
    font-weight: 800;
}

.profile-block p,
.side-section {
    color: var(--muted);
}

.profile-block p {
    font-size: 10px;
    font-weight: 600;
}

.side-section {
    display: grid;
    gap: 13px;
}

.side-section h2 {
    color: var(--text);
}

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

.plan-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 4px;
    gap: 10px;
    align-items: center;
    min-height: 34px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.avatar-stack {
    display: flex;
}

.avatar-stack span {
    width: 15px;
    height: 15px;
    display: grid;
    place-items: center;
    margin-left: -4px;
    border-radius: 50%;
    background: var(--blue);
    color: #ffffff;
    font-size: 8px;
    font-weight: 800;
}

.avatar-stack span:first-child {
    margin-left: 0;
}

.plan-time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-mark {
    height: 34px;
    border-radius: 999px;
    background: var(--cyan);
}

.efficiency-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    text-align: center;
}

.efficiency-item {
    display: grid;
    justify-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 10px;
    font-weight: 800;
}

.ring {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--window) 56%, transparent 58%),
        conic-gradient(var(--ring-color) calc(var(--value) * 1%), var(--soft) 0);
    font-size: 10px;
}

.completed-bars {
    height: 82px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 7px;
    align-items: end;
}

.completed-bar {
    min-height: 16px;
    height: var(--height);
    border-radius: 8px;
    background: var(--bar-color);
}

.completed-legend {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    color: var(--muted);
    font-size: 9px;
    text-align: center;
}

.completed-legend strong {
    display: block;
    color: var(--text);
    font-size: 12px;
}

.empty-state {
    min-height: 124px;
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.task-dialog {
    width: min(720px, calc(100% - 32px));
    border: 0;
    border-radius: 12px;
    padding: 0;
    background: transparent;
}

.task-dialog::backdrop {
    background: rgba(17, 24, 39, 0.45);
}

.task-form {
    display: grid;
    gap: 16px;
    padding: 22px;
    border-radius: 12px;
    background: var(--window);
    box-shadow: var(--shadow);
}

.dialog-head,
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.dialog-head h2 {
    font-size: 20px;
}

.dialog-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.task-form label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.task-form input,
.task-form select,
.task-form textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    background: var(--window);
    color: var(--text);
}

.task-form textarea {
    resize: vertical;
}

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

.checkbox-line {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 9px !important;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    max-width: min(380px, calc(100% - 44px));
    transform: translateY(14px);
    opacity: 0;
    pointer-events: none;
    padding: 12px 14px;
    border-radius: 8px;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 1180px) {
    .page-shell {
        padding: 0;
    }

    .app-frame {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .side-link {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .side-link span {
        display: none;
    }

    .right-panel {
        grid-column: 1 / -1;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .profile-block {
        padding-top: 0;
    }

    .timeline-panel {
        grid-template-columns: 170px minmax(0, 1fr);
    }
}

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

    .sidebar {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto;
        align-items: center;
        padding: 14px 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .side-nav {
        display: flex;
        gap: 12px;
        overflow: hidden;
        padding-top: 0;
    }

    .topbar {
        grid-template-columns: 1fr;
    }

    .top-actions {
        justify-items: stretch;
    }

    .top-tabs {
        gap: 18px;
    }

    .summary-grid,
    .kanban-board,
    .right-panel,
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .timeline-panel {
        grid-template-columns: 1fr;
    }

    .timeline-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-top: 0;
    }
}

@media (max-width: 620px) {
    .page-shell {
        padding: 0;
    }

    .app-frame {
        border-radius: 0;
    }

    .main-area,
    .right-panel {
        padding: 20px;
    }

    .summary-grid,
    .kanban-board,
    .right-panel,
    .timeline-list,
    .form-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .board-header {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field {
        width: 100%;
    }

    .timeline-chart {
        grid-template-rows: 32px 236px;
    }

    .timeline-dates {
        grid-template-columns: repeat(4, 1fr);
    }

    .timeline-dates span:nth-child(n+5) {
        display: none;
    }

    .timeline-grid::before {
        background: repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent calc(25% - 1px),
            var(--line) calc(25% - 1px),
            var(--line) 25%
        );
    }

    .timeline-bar {
        left: min(var(--left), 40%);
        width: min(var(--width), 58%);
        min-width: 0;
        padding: 10px 12px;
    }

    .timeline-percent {
        font-size: 14px;
    }

    .dialog-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

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