:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef4ff;
    --text: #172033;
    --muted: #667085;
    --border: #dfe6f1;
    --primary: #3157d5;
    --primary-dark: #2341a6;
    --primary-soft: #e8edff;
    --success: #18865b;
    --success-soft: #e5f7ef;
    --warning: #b76a00;
    --warning-soft: #fff2d9;
    --danger: #c93636;
    --danger-soft: #ffe8e8;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.09);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(49, 87, 213, 0.16), transparent 32rem),
        radial-gradient(circle at top right, rgba(24, 134, 91, 0.12), transparent 26rem),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black, transparent 70%);
}

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

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

h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 0.8rem;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

h3 {
    margin-bottom: 0.35rem;
    font-size: 1.05rem;
}

.app-shell {
    position: relative;
    z-index: 1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(223, 230, 241, 0.8);
    background: rgba(245, 247, 251, 0.82);
    backdrop-filter: blur(18px);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0;
}

.brand,
.nav-links {
    display: flex;
    align-items: center;
}

.brand {
    gap: 0.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.brand-mark {
    display: grid;
    width: 2.35rem;
    height: 2.35rem;
    place-items: center;
    color: white;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, var(--primary), #6b8cff);
    box-shadow: 0 12px 24px rgba(49, 87, 213, 0.25);
}

.nav-links {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.nav-links a {
    padding: 0.65rem 0.9rem;
    color: var(--muted);
    border-radius: 999px;
    font-weight: 700;
    transition: 0.18s ease;
}

.nav-links a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-links .nav-pill {
    color: white;
    background: var(--text);
}

.nav-links .nav-pill:hover {
    color: white;
    background: var(--primary);
}

.main-content {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
}

.flash-list {
    display: grid;
    gap: 0.75rem;
    padding: 0;
    margin: 0 0 1.25rem;
    list-style: none;
}

.flash {
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(23, 32, 51, 0.06);
    font-weight: 700;
}

.flash.success {
    color: var(--success);
    border-color: rgba(24, 134, 91, 0.2);
    background: var(--success-soft);
}

.flash.error,
.flash.danger {
    color: var(--danger);
    border-color: rgba(201, 54, 54, 0.2);
    background: var(--danger-soft);
}

.card {
    border: 1px solid rgba(223, 230, 241, 0.92);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
    align-items: center;
    gap: 2rem;
    min-height: 68vh;
}

.hero-copy,
.auth-copy,
.page-heading {
    max-width: 680px;
}

.eyebrow {
    margin-bottom: 0.7rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.lead {
    margin-bottom: 0.75rem;
    color: #344054;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    line-height: 1.55;
}

.muted {
    color: var(--muted);
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.85rem;
    padding: 0.75rem 1.15rem;
    color: white;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 12px 28px rgba(49, 87, 213, 0.22);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover {
    background: var(--primary-dark);
    box-shadow: 0 16px 35px rgba(49, 87, 213, 0.28);
    transform: translateY(-1px);
}

.button-secondary {
    color: var(--text);
    border: 1px solid var(--border);
    background: white;
    box-shadow: none;
}

.button-secondary:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.button-small {
    min-height: 2.35rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
}

.full-width {
    width: 100%;
}

.hero-panel {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
}

.mini-task {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--surface-soft);
}

.mini-task small {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted);
}

.check-dot,
.avatar {
    display: grid;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border-radius: 50%;
    font-weight: 900;
}

.mini-task.done .check-dot {
    color: var(--success);
    background: var(--success-soft);
}

.mini-task.progress .check-dot {
    color: var(--warning);
    background: var(--warning-soft);
}

.mini-task.todo .check-dot {
    color: var(--primary);
    background: var(--primary-soft);
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    align-items: center;
    gap: 2rem;
    padding: 4rem 0;
}

.form-card {
    display: grid;
    gap: 0.75rem;
    padding: 1.35rem;
}

.card-header {
    margin-bottom: 0.4rem;
}

label {
    color: #344054;
    font-size: 0.9rem;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.85rem 0.95rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    background: white;
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(49, 87, 213, 0.65);
    box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.12);
}

.form-footer {
    margin: 0.4rem 0 0;
    color: var(--muted);
    text-align: center;
}

.form-footer a {
    color: var(--primary);
    font-weight: 800;
}

.page-heading {
    margin-bottom: 1.5rem;
}

.grid {
    display: grid;
    gap: 1.25rem;
}

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

.dashboard-grid {
    grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
    align-items: start;
    margin-bottom: 2rem;
}

.section-block {
    margin-top: 1.75rem;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.section-title-row h2 {
    margin: 0;
}

.count-pill,
.role-pill,
.status-badge,
.overdue {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 1.75rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 900;
}

.count-pill,
.role-pill {
    color: var(--primary);
    background: var(--primary-soft);
}

.card-list,
.task-board {
    display: grid;
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.group-card,
.member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem;
}

.group-card h3,
.member-card h3,
.group-card p {
    margin-bottom: 0;
}

.member-list {
    gap: 0.75rem;
}

.member-card {
    justify-content: flex-start;
    box-shadow: 0 10px 25px rgba(23, 32, 51, 0.06);
}

.avatar {
    color: white;
    background: linear-gradient(135deg, var(--text), #46546c);
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
}

.dashboard-hero::after {
    content: "";
    position: absolute;
    right: -4rem;
    top: -5rem;
    width: 13rem;
    height: 13rem;
    border-radius: 50%;
    background: rgba(49, 87, 213, 0.11);
}

.dashboard-hero h1 {
    margin-bottom: 0.45rem;
    font-size: clamp(2rem, 5vw, 3.6rem);
}

.invite-code {
    display: inline-flex;
    margin: 0;
    padding: 0.55rem 0.85rem;
    border: 1px dashed rgba(49, 87, 213, 0.45);
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 900;
}

.dashboard-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.8rem;
}

.dashboard-stats div {
    min-width: 6rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.dashboard-stats strong {
    display: block;
    font-size: 1.55rem;
}

.dashboard-stats span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.create-task-card {
    margin-top: 0;
}

.task-card {
    padding: 1.15rem;
}

.task-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem;
    align-items: start;
}

.task-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.task-title-row h3 {
    margin-bottom: 0;
}

.task-description {
    margin-bottom: 0.8rem;
    color: #344054;
    line-height: 1.55;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.task-meta span {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: #f2f5fa;
}

.status-badge.status-to-do {
    color: var(--primary);
    background: var(--primary-soft);
}

.status-badge.status-in-progress {
    color: var(--warning);
    background: var(--warning-soft);
}

.status-badge.status-done {
    color: var(--success);
    background: var(--success-soft);
}

.overdue {
    margin-top: 0.8rem;
    color: var(--danger);
    background: var(--danger-soft);
}

.status-form {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.status-form select {
    min-width: 150px;
}

.empty-state {
    display: grid;
    place-items: center;
    padding: 2rem;
    text-align: center;
}

.empty-state p {
    margin-bottom: 0;
}

.empty-icon {
    display: grid;
    width: 4rem;
    height: 4rem;
    place-items: center;
    margin-bottom: 0.9rem;
    border-radius: 1.4rem;
    background: var(--primary-soft);
    font-size: 1.8rem;
}

@media (max-width: 820px) {
    .navbar,
    .hero,
    .auth-layout,
    .two-columns,
    .dashboard-grid,
    .dashboard-hero,
    .task-card-main {
        grid-template-columns: 1fr;
    }

    .navbar,
    .dashboard-hero {
        align-items: flex-start;
    }

    .navbar,
    .dashboard-hero {
        flex-direction: column;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    .auth-layout {
        padding: 2rem 0;
    }

    .status-form {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .main-content,
    .navbar {
        width: min(100% - 1rem, 1120px);
    }

    .group-card,
    .task-title-row,
    .section-title-row,
    .dashboard-stats {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-stats,
    .dashboard-stats div,
    .button {
        width: 100%;
    }
}
