:root {
    --bg: var(--cd-cold-grey-10);
    --bg-elevated: var(--cd-cold-grey-20);
    --bg-card: var(--cd-cold-grey-30);
    --text: var(--cd-grey-90);
    --text-secondary: var(--cd-grey-80);
    --text-muted: var(--cd-grey-60);
    --text-faint: var(--cd-grey-50);
    --accent: var(--cd-orange-70);
    --accent-active: var(--cd-orange-50);
    --accent-hover: var(--cd-orange-60);
    --border-subtle: var(--cd-cold-grey-50);
    --state-open: var(--cd-sea-green-60);
    --state-closed: var(--cd-rose-60);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Poppins, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

nav a {
    color: var(--accent);
}

a:hover {
    text-decoration: underline;
}

/* === Shared Components === */
.state-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.state-dot.open {
    background: var(--state-open);
}

.state-dot.closed {
    background: var(--state-closed);
}

.pill {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 9px;
    letter-spacing: 0.02em;
}

.pill-flag {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.25;
    }
}

.assignee {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.assignee img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.assignee-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
}

.assignee-header img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.child-item a {
    color: var(--text-secondary);
}

.desc-content {
    font-size: 0.85rem;
    line-height: 1.5;
}

.desc-content a {
    text-decoration: underline;
    text-decoration-color: var(--border-subtle);
}

.desc-content a:hover {
    text-decoration-color: currentcolor;
}

/* === Nav === */
nav {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

nav .brand {
    font-weight: 500;
}

nav .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

nav .user-info img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.toggle-btn {
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-elevated);
}

.toggle-btn:hover {
    background: var(--bg);
    text-decoration: none;
}

.toggle-btn.active {
    background: var(--accent-active);
    color: #ffffff;
}

.toggle-btn.active:hover {
    background: var(--accent-hover);
}

/* === Grid Layout === */
.container {
    padding: 1.5rem;
    padding-top: calc(var(--nav-height) + 1.5rem);
}

.desktop-only {
    display: inline-block;
    min-width: 100%;
}

.roadmap {
    background: var(--bg-card);
}

.roadmap-header-row {
    background: var(--bg);
    position: sticky;
    top: var(--nav-height);
    z-index: 1;
}

.roadmap-header {
    background: var(--bg);
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roadmap-header:first-child {
    text-align: left;
}

.month-label {
    background: var(--bg);
    padding: 0.6rem 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.cell {
    background: var(--bg);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* === Card === */
.card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: var(--bg-card);
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
    transition: box-shadow 0.15s;
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 2px 6px rgb(0 0 0 / 12%);
    background: var(--bg-elevated);
}

.card-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card .desc-content {
    font-size: 0.75rem;
    color: #ffffff;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card .desc-content a {
    color: #ffffff;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.35rem;
}

.card-pills {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 50%);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1rem;
}

.modal-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-elevated);
    padding: 0.75rem;
    border-radius: 4px;
}

.modal .desc-content {
    color: var(--text-secondary);
}

.modal .desc-content a {
    color: var(--text-secondary);
}

.modal-right .assignee {
    color: #ffffff;
}

.modal-meta {
    font-size: 0.8rem;
    color: #ffffff;
}

.modal-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* === Children === */
.children-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.children-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.child-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
}

.children-loading {
    font-size: 0.8rem;
    color: var(--text-faint);
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-faint);
}

/* === Responsive === */
.mobile-only {
    display: none;
}

.mobile-month {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.mobile-month-title {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--bg-card);
}

@media (width <= 768px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .container {
        padding: 0.75rem;
        padding-top: calc(var(--nav-height) + 0.75rem);
    }

    .user-name {
        display: none;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }
}
