:root {
    color-scheme: light;
    --bg: #eef4fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 32rem),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px clamp(20px, 4vw, 56px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 18px;
    margin: 0;
}

.topbar p {
    color: var(--muted);
    font-size: 12px;
    margin: 4px 0 0;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.topbar nav a {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #334155;
    font-weight: 700;
    font-size: 12px;
    padding: 7px 10px;
    text-decoration: none;
}

.topbar nav a.active {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

.page {
    margin: 0 auto;
    max-width: 1680px;
    padding: 24px clamp(20px, 4vw, 56px);
    width: 100%;
}

.panel {
    background: var(--card);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
    margin-bottom: 20px;
    padding: 20px;
}

.panel h2 {
    font-size: 18px;
    margin: 0 0 16px;
}

.grid {
    display: grid;
    gap: 20px;
}

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

.overview-layout {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(520px, 1.2fr) minmax(360px, 0.8fr);
}

.controls-panel,
.filters,
.period-summary,
.button-row,
.inline-form,
.task-meta,
.compact-row,
.timeline-title,
.section-heading,
.timeline-actions,
.select-all-row {
    align-items: center;
    display: flex;
    gap: 10px;
}

.controls-panel {
    align-items: center;
    justify-content: space-between;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(180deg, #fff, #f8fbff);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    font-size: 26px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    gap: 4px;
}

input,
select,
button,
textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    padding: 9px 10px;
}

textarea {
    resize: vertical;
}

button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.secondary-button {
    background: #f8fafc;
    border-color: var(--border);
    color: #334155;
}

.danger-button {
    background: var(--danger);
    border-color: var(--danger);
}

.notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 12px;
    color: #166534;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.error-notice {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

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

.task-row {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92)),
        radial-gradient(circle at top left, color-mix(in srgb, var(--task-color) 24%, transparent), transparent 14rem);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
    padding: 16px;
}

.task-meta {
    justify-content: space-between;
    margin-bottom: 10px;
}

.task-meta strong {
    flex: 1;
    font-size: 16px;
}

.dot {
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
    height: 11px;
    width: 11px;
}

.bar {
    background: rgba(226, 232, 240, 0.62);
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
    position: relative;
}

.bar span {
    background: linear-gradient(
        90deg,
        var(--task-color, var(--accent)),
        color-mix(in srgb, var(--task-color, var(--accent)) 60%, #06b6d4)
    );
    border-radius: inherit;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--task-color, var(--accent)) 25%, transparent);
    display: block;
    height: 100%;
}

.recommendation {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: #1e293b;
    line-height: 1.55;
    margin: 12px 0;
    max-height: none;
    overflow: auto;
    padding: 18px;
}

.recommendation h3 {
    border-top: 1px solid var(--border);
    color: #0f172a;
    font-size: 16px;
    margin: 18px 0 10px;
    padding-top: 16px;
}

.recommendation h3:first-child {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

.recommendation p {
    margin: 8px 0;
}

.recommendation ul {
    display: grid;
    gap: 8px;
    margin: 8px 0 14px;
    padding-left: 20px;
}

.recommendation li {
    padding-left: 4px;
}

.saving {
    color: #166534;
    font-weight: 700;
}

.compact-row {
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
    padding: 10px 0;
}

.section-heading {
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-heading h2,
.section-heading p {
    margin: 0;
}

.section-heading p {
    color: var(--muted);
    margin-top: 4px;
}

.timeline-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.select-all-row {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: #334155;
    font-weight: 700;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.guidance-form {
    align-items: end;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr 1fr 120px;
    margin-bottom: 18px;
    padding: 16px;
}

.guidance-text-field {
    grid-column: 1 / -1;
}

.guidance-form button {
    grid-column: 1 / -1;
    justify-self: start;
}

.guidance-list {
    display: grid;
    gap: 12px;
}

.guidance-card {
    align-items: start;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 14px;
}

.guidance-card p {
    color: #334155;
    line-height: 1.45;
    margin: 8px 0;
}

.guidance-card-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.guidance-card-title span:last-child {
    color: var(--muted);
    font-size: 12px;
}

.timeline {
    display: grid;
    gap: 14px;
}

.timeline-item {
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 16px;
    display: grid;
    gap: 14px;
    grid-template-columns: 28px 220px 1fr;
    padding: 12px;
    position: relative;
}

.timeline-item:has(input[type="checkbox"]:checked) {
    background: #fef2f2;
    border-color: #fecaca;
}

.sample-check {
    align-self: start;
    display: flex;
    justify-content: center;
    padding-top: 48px;
}

.timeline-shot img,
.no-shot {
    background: #e8eef6;
    border-radius: 12px;
    display: block;
    height: 124px;
    object-fit: cover;
    width: 220px;
}

.no-shot {
    align-items: center;
    color: var(--muted);
    display: flex;
    justify-content: center;
}

.timeline-details p {
    margin: 8px 0;
}

.ai-meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 8px;
    margin: 8px 0;
}

.ai-meta span {
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 8px;
}

.ai-meta .ai-used {
    background: #dcfce7;
    color: #166534;
}

.ai-reason {
    color: #334155;
    font-size: 13px;
}

.activity-summary {
    background: #f8fafc;
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    color: #1e293b;
    font-size: 13px;
    line-height: 1.45;
    padding: 10px 12px;
}

.ai-error {
    color: #b91c1c;
    font-size: 13px;
}

@media (max-width: 800px) {
    .grid.two,
    .timeline-item,
    .stats-grid,
    .guidance-form,
    .overview-layout {
        grid-template-columns: 1fr;
    }

    .topbar,
    .controls-panel,
    .filters,
    .section-heading,
    .timeline-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .sample-check {
        justify-content: flex-start;
        padding-top: 0;
    }

    .guidance-card {
        flex-direction: column;
    }
}
