:root {
    color-scheme: light;
    --background: #f8f1e8;
    --surface: #ffffff;
    --text: #172033;
    --muted: #5f6b7a;
    --primary: #2764e7;
    --primary-dark: #1748ad;
    --zeynep: #ff8a70;
    --peri: #7c4dff;
    --warm: #f6c453;
    --border: #ded6ca;
    --danger-bg: #fff1f1;
    --danger-text: #9f1c1c;
    --success-bg: #edf8ef;
    --success-text: #176b34;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--warm);
    outline-offset: 3px;
}

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

.card,
.hero-card {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: 0 1rem 3rem rgba(23, 32, 51, 0.08);
    padding: 1.25rem;
}

.hero-card {
    display: grid;
    gap: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #fff5de 100%);
}

.auth-card { max-width: 28rem; }

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1, h2, h3 { margin: 0 0 0.75rem; line-height: 1.15; }

.muted { color: var(--muted); }

.form-stack,
.form-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

label {
    display: grid;
    gap: 0.4rem;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font: inherit;
    padding: 0.85rem 1rem;
}

button,
.button-link {
    align-items: center;
    border: 0;
    border-radius: 0.75rem;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 850;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0.9rem 1rem;
    text-decoration: none;
}

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

button.secondary,
.button-link.secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.alert,
.notice {
    border-radius: 0.75rem;
    margin: 1rem;
    padding: 0.85rem 1rem;
}

.alert { background: var(--danger-bg); color: var(--danger-text); }
.notice { background: var(--success-bg); color: var(--success-text); }

.app-shell {
    display: grid;
    min-height: 100vh;
}

.sidebar {
    display: none;
}

.main-panel {
    min-width: 0;
    padding-bottom: calc(5.5rem + var(--safe-bottom));
}

.topbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.content-grid {
    display: grid;
    gap: 1rem;
    padding: 0 1rem 1rem;
}

.metric-grid,
.member-card-grid {
    display: grid;
    gap: 1rem;
}

.metric-card strong {
    color: var(--primary);
    display: block;
    font-size: 2rem;
    margin-top: 0.5rem;
}

.metric-card.warm strong { color: #9a6500; }

.progress {
    background: #eadfce;
    border-radius: 999px;
    height: 0.7rem;
    overflow: hidden;
}

.progress span {
    background: var(--member-color, var(--primary));
    display: block;
    height: 100%;
}

.task-list,
.week-list {
    display: grid;
    gap: 0.75rem;
}

.task-card,
.week-item,
.member-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
}

.task-card {
    display: grid;
    gap: 1rem;
}

.week-item {
    display: grid;
    gap: 0.3rem;
}

.member-card {
    border-top: 0.35rem solid var(--member-color, var(--primary));
}

.pill,
.done-label {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 850;
    padding: 0.35rem 0.65rem;
}

.pill { background: #edf2ff; color: var(--primary); }
.done-label { background: var(--success-bg); color: var(--success-text); }

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 1rem;
    color: var(--muted);
    margin: 0;
    padding: 1rem;
}

.bottom-nav {
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
    left: 0;
    padding: 0.4rem 0.4rem calc(0.4rem + var(--safe-bottom));
    position: fixed;
    right: 0;
    z-index: 10;
}

.bottom-nav a {
    align-items: center;
    border-radius: 0.85rem;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    padding: 0.4rem;
    text-align: center;
    text-decoration: none;
}

.bottom-nav a[aria-current="page"] {
    background: #eaf0ff;
    color: var(--primary);
}

.full { grid-column: 1 / -1; }

@media (min-width: 720px) {
    .app-shell {
        grid-template-columns: 17rem minmax(0, 1fr);
    }

    .sidebar {
        background: #172033;
        color: #fff;
        display: flex;
        flex-direction: column;
        gap: 2rem;
        min-height: 100vh;
        padding: 1.25rem;
        position: sticky;
        top: 0;
    }

    .brand-mark {
        align-items: center;
        background: var(--primary);
        border-radius: 1rem;
        display: inline-flex;
        font-weight: 900;
        height: 3.5rem;
        justify-content: center;
        width: 3.5rem;
    }

    .nav-list {
        display: grid;
        gap: 0.5rem;
    }

    .nav-list a {
        border-radius: 0.85rem;
        min-height: 44px;
        padding: 0.8rem 1rem;
        text-decoration: none;
    }

    .nav-list a:hover,
    .nav-list a[aria-current="page"] {
        background: rgba(255, 255, 255, 0.12);
    }

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

    .topbar {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        padding: 2rem;
    }

    .content-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding: 0 2rem 2rem;
    }

    .hero-card,
    .wide { grid-column: span 4; }

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

    .content-grid > .card:not(.wide) { grid-column: span 2; }

    .member-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .task-card,
    .week-item {
        align-items: center;
        grid-template-columns: 1fr auto;
    }

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

    .bottom-nav { display: none; }
}

@media (max-width: 360px) {
    .bottom-nav a { font-size: 0.68rem; }
    .card, .hero-card { padding: 1rem; }
}
