:root {
    --bg: #f3efe6;
    --panel: #fffaf0;
    --ink: #14212f;
    --muted: #5d6b78;
    --accent: #0f9d8a;
    --accent-strong: #0a7768;
    --warm: #f4a259;
    --danger: #d1495b;
    --border: #1f2f3d;
    --shadow: 0 12px 35px rgba(20, 33, 47, 0.18);
    --radius: 18px;
}

:root[data-theme="dark"] {
    --bg: #111a24;
    --panel: #1b2734;
    --ink: #ecf2f7;
    --muted: #a9b5c1;
    --warm: #f2b571;
    --border: #d8e0e7;
    --shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Outfit", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, #ffe7c7 0, transparent 35%),
        radial-gradient(circle at 90% 80%, #b7f0e9 0, transparent 35%),
        linear-gradient(165deg, #f3efe6 0%, #e8f4f2 100%);
    padding: 24px;
}

body.high-contrast {
    --ink: #000;
    --panel: #fff;
    --border: #000;
    --muted: #222;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 10px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--ink);
    padding: 8px 12px;
    z-index: 1000;
}

.skip-link:focus {
    left: 10px;
}

.app {
    width: min(980px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.hero {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    overflow: hidden;
    position: relative;
    animation: popIn 0.55s ease;
}

.hero-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    align-items: center;
}

.inline-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 10px;
    background: #fff;
    font-size: 0.82rem;
}

.hero::after {
    content: "";
    position: absolute;
    right: -45px;
    top: -35px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: rgba(15, 157, 138, 0.14);
}

h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    letter-spacing: 0.02em;
}

.subtitle {
    margin: 10px 0 0;
    color: var(--muted);
    max-width: 56ch;
    font-size: 1.02rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    animation: slideUp 0.5s ease;
}

.card h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-family: "Space Grotesk", sans-serif;
}

.task-form {
    display: grid;
    gap: 12px;
}

label {
    font-size: 0.9rem;
    color: var(--muted);
    display: block;
    margin-bottom: 6px;
}

input,
select,
button {
    font: inherit;
}

textarea {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 11px 12px;
    outline: none;
    font: inherit;
    resize: vertical;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="number"],
select,
input[type="search"] {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 11px 12px;
    outline: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgba(15, 157, 138, 0.2);
}

textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgba(15, 157, 138, 0.2);
}

.inline-row {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 170px;
}

.btn {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.18s ease, background 0.18s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: #0b5f53;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.toolbar {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto auto auto;
    margin-bottom: 14px;
}

.filters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn.active {
    background: var(--warm);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.view-switch {
    margin-bottom: 10px;
    display: inline-flex;
    gap: 8px;
}

.active-view {
    background: var(--warm);
}

#sortSelect,
#categoryFilter {
    min-width: 180px;
}

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.task {
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: start;
    animation: slideUp 0.35s ease;
}

.task .title-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.task.completed .title {
    text-decoration: line-through;
    color: var(--muted);
}

.task-main {
    min-width: 0;
}

.title {
    margin: 0;
    font-size: 1.02rem;
    word-break: break-word;
}

.meta {
    display: flex;
    gap: 8px;
    margin-top: 7px;
    flex-wrap: wrap;
}

.notes {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.attachment {
    margin-top: 6px;
    display: inline-block;
    color: var(--accent-strong);
    font-size: 0.88rem;
}

.tag {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.78rem;
    background: #f8f8f8;
}

.priority-high {
    background: #ffd8df;
}

.priority-medium {
    background: #ffe8cf;
}

.priority-low {
    background: #ddf6f2;
}

.category-tag {
    background: #e6edff;
}

.tag-chip {
    background: #ece7ff;
}

.recurring-tag {
    background: #dff5ff;
}

.overdue-tag {
    background: #ffe2e6;
    border-color: #b4354a;
    color: #7d1f2f;
}

.task-actions {
    display: inline-flex;
    gap: 8px;
}

.icon-btn {
    border: 2px solid var(--border);
    background: #fff;
    border-radius: 10px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 0.95rem;
}

.icon-btn.delete {
    color: var(--danger);
}

.empty {
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 24px;
    color: var(--muted);
}

.stats {
    display: grid;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.progress {
    width: 100%;
    height: 12px;
    border: 2px solid var(--border);
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), #3fc7b7);
    transition: width 0.25s ease;
}

.foot {
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.muted {
    color: var(--muted);
    margin: 0;
    font-size: 0.88rem;
}

.grid-secondary {
    align-items: start;
}

.calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.calendar-cell,
.calendar-label {
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 44px;
    padding: 6px;
    font-size: 0.82rem;
}

.calendar-label {
    min-height: 0;
    text-align: center;
    font-weight: 600;
    background: #fff;
}

.calendar-cell {
    background: #fff;
    cursor: pointer;
}

.calendar-cell.today {
    outline: 2px solid var(--accent);
}

.calendar-cell.selected {
    background: #fff2dc;
}

.calendar-count {
    display: inline-block;
    margin-top: 2px;
    border-radius: 999px;
    padding: 1px 6px;
    border: 1px solid var(--border);
    font-size: 0.74rem;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 860px) {
    body {
        padding: 14px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .inline-row {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 4px;
    }
}
