/* ==========================================================================
   Todo
   Visual language borrowed from ziki.dev: Geist, hairline borders, 12px
   panels, near-black ink, one blue accent and a segmented control whose
   active pill is filled with ink.
   ========================================================================== */

@font-face {
    font-family: "Geist";
    src: url("../fonts/geist-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/geist-mono-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Light palette */
    --bg: #f5f5f5;
    --surface: #ffffff;
    --panel: #ffffff;
    --line: #e8e8e8;
    --divider: #f0f0f0;
    --chip: #f5f5f5;
    --seg: #f1f1f3;
    --sunken: #ededf0;
    --tint: #eef8ff;

    --text: #161616;
    --text-2: #384152;
    --muted: #686868;

    --accent: #086ccc;
    --accent-ink: #086ccc;
    --accent-soft: #eef8ff;
    --primary: #0972d5;
    --primary-hover: #0866c0;
    --on-primary: #ffffff;

    --ok-bg: #edf8f1;
    --ok-fg: #187a42;
    --warn-bg: #fff8db;
    --warn-fg: #7a5a00;
    --warn-bd: #f1dc8c;
    --bad-bg: #fff1ee;
    --bad-fg: #c4381f;
    --bad-bd: #f7c7bc;

    --dot: rgba(11, 23, 51, 0.1);
    --shadow-xs: 0 1px 2px rgba(11, 23, 51, 0.06);
    --shadow-sm: 0 3px 10px rgba(11, 23, 51, 0.07);
    --shadow: 0 24px 60px rgba(11, 23, 51, 0.14);

    --nav-active-bg: var(--text);
    --nav-active-fg: var(--surface);

    --radius: 12px;
    --radius-sm: 9px;
    --radius-pill: 999px;

    --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b0b0c;
    --surface: #161618;
    --panel: #161618;
    --line: #2c2c31;
    --divider: #232327;
    --chip: #222226;
    --seg: #111113;
    --sunken: #121214;
    --tint: #1c2333;

    --text: #ececee;
    --text-2: #bdbdc3;
    --muted: #8f8f97;

    --accent: #8fc9ff;
    --accent-ink: #8fc9ff;
    --accent-soft: #1c2333;

    --ok-bg: #0f3326;
    --ok-fg: #6ee7a8;
    --warn-bg: #3a2c0c;
    --warn-fg: #f6cf6b;
    --warn-bd: #6b5216;
    --bad-bg: #3a1517;
    --bad-fg: #fca5a0;
    --bad-bd: #6b2a27;

    --dot: rgba(255, 255, 255, 0.07);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow: 0 30px 70px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* A faint dotted field behind the top of the page */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(var(--dot) 1px, transparent 0);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 280px);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 280px);
    opacity: 0.75;
}

::selection {
    background: color-mix(in srgb, var(--accent) 24%, transparent);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

h1,
h2 {
    font-weight: 600;
    letter-spacing: -0.03em;
}

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

:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

/* Icons ---------------------------------------------------------------- */

.icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -2px;
}

.icon-sm {
    width: 14px;
    height: 14px;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* App bar -------------------------------------------------------------- */

.appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.appbar-inner {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 20px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    border-radius: 8px;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--text);
    color: var(--surface);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-xs);
}

.brand-mark .icon {
    width: 15px;
    height: 15px;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.appbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--chip);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.date-chip .icon {
    color: var(--muted);
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--chip);
    border-color: color-mix(in srgb, var(--muted) 35%, var(--line));
}

.theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* Page frame ----------------------------------------------------------- */

.main-container {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 0 20px 56px;
}

.content-wrapper {
    width: 100%;
    max-width: 840px;
    margin: 0 auto;
    padding-top: 28px;
}

.page-head {
    margin-bottom: 18px;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 7px;
}

.page-title {
    font-size: clamp(24px, 4.4vw, 31px);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.page-sub {
    margin-top: 7px;
    font-size: 13.5px;
    color: var(--text-2);
    max-width: 54ch;
}

/* Segmented tabs ------------------------------------------------------- */

.nav-tabs {
    list-style: none;
    display: flex;
    gap: 3px;
    padding: 4px;
    margin: 0 0 18px;
    background: var(--seg);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.nav-item {
    flex: 1 1 0;
    min-width: 0;
}

.nav-link {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.nav-link .icon {
    color: currentColor;
    opacity: 0.85;
}

.nav-link:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.nav-link.active {
    background: var(--nav-active-bg);
    color: var(--nav-active-fg);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.nav-link.active .icon {
    opacity: 1;
}

/* Tab content ---------------------------------------------------------- */

.tab-content {
    display: block;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Panels and forms ----------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    padding: 14px;
    margin-bottom: 12px;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 11px;
}

.panel-title {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.panel-note {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    flex: 1 1 150px;
}

.field-label {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field-row .field {
    flex: 0 1 260px;
    min-width: 170px;
}

.form-control,
.form-select {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
    color: var(--muted);
}

.form-control:hover,
.form-select:hover {
    border-color: color-mix(in srgb, var(--muted) 35%, var(--line));
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

input[type="date"].form-control {
    padding-right: 8px;
}

input[type="number"].form-control {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

/* Composer ------------------------------------------------------------- */

.composer {
    padding: 13px 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer:focus-within {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}

.composer-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.composer-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    letter-spacing: -0.01em;
    padding: 6px 2px;
}

.composer-input::placeholder {
    color: var(--muted);
}

.composer-input:focus {
    outline: none;
}

.composer-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
    padding-top: 11px;
    border-top: 1px solid var(--divider);
}

.composer-meta .field {
    flex: 1 1 150px;
    max-width: 260px;
}

/* Buttons -------------------------------------------------------------- */

.btn-add,
.btn-primary,
.btn-warning,
.btn-danger,
.btn-ghost,
.btn-nav,
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
        box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-add,
.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 1px 2px rgba(9, 114, 213, 0.22);
}

.btn-add:hover,
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-add:active,
.btn-primary:active {
    transform: translateY(1px);
}

.btn-warning {
    background: var(--warn-bg);
    border-color: var(--warn-bd);
    color: var(--warn-fg);
}

.btn-warning:hover {
    background: color-mix(in srgb, var(--warn-bg) 70%, var(--warn-bd));
}

.btn-danger {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
    color: var(--bad-fg);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--bad-bg) 68%, var(--bad-bd));
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text-2);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--chip);
}

.btn-nav {
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--surface);
    border-color: var(--line);
    color: var(--text-2);
    border-radius: 8px;
}

.btn-nav:hover {
    color: var(--text);
    background: var(--chip);
}

.btn-sm {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 500;
}

.btn-sm .icon {
    width: 12px;
    height: 12px;
}

/* Filter note ---------------------------------------------------------- */

.filter-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    margin-bottom: 12px;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 10px;
}

.filter-text {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--accent-ink);
}

.filter-info .btn-ghost {
    height: 28px;
    background: transparent;
    border-color: color-mix(in srgb, var(--accent) 25%, transparent);
    color: var(--accent-ink);
}

.filter-info .btn-ghost:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent-ink);
}

/* Progress ------------------------------------------------------------- */

.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 2px 14px;
}

.progress-track {
    flex: 1 1 auto;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--line);
    overflow: hidden;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--primary);
    transition: width 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.progress-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

/* Task list ------------------------------------------------------------ */

.todos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.todo-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px 14px;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.todo-item:hover {
    border-color: color-mix(in srgb, var(--muted) 30%, var(--line));
    box-shadow: var(--shadow-sm);
}

.todo-item.completed {
    background: color-mix(in srgb, var(--surface) 62%, var(--bg));
}

.todo-item.completed .todo-text {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.todo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.todo-text {
    flex: 1 1 140px;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.todo-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* Round checkboxes ----------------------------------------------------- */

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border: 1.6px solid color-mix(in srgb, var(--muted) 55%, var(--line));
    border-radius: 50%;
    background-color: var(--surface);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 68%;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="checkbox"]:hover {
    border-color: var(--primary);
}

input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
    outline-offset: 2px;
}

/* Badges --------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--chip);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9.5px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge .icon {
    width: 11px;
    height: 11px;
}

.priority-high {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
    color: var(--bad-fg);
}

.priority-medium {
    background: var(--warn-bg);
    border-color: var(--warn-bd);
    color: var(--warn-fg);
}

.priority-low {
    background: var(--ok-bg);
    color: var(--ok-fg);
}

.badge-date {
    background: var(--tint);
    color: var(--accent-ink);
}

.badge-overdue {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
    color: var(--bad-fg);
}

.badge-count {
    background: var(--chip);
    color: var(--text-2);
}

/* Subtasks ------------------------------------------------------------- */

.subtasks-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 11px;
    padding-top: 7px;
    border-top: 1px dashed var(--divider);
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 4px;
    border-radius: 7px;
    transition: background 0.12s ease;
}

.subtask-item:hover {
    background: var(--chip);
}

.subtask-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    color: var(--text-2);
    overflow-wrap: anywhere;
}

.subtask-item.completed .subtask-text {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.subtask-item .icon-btn {
    width: 26px;
    height: 26px;
    border: 0;
    background: transparent;
    color: var(--muted);
}

.subtask-item .icon-btn:hover {
    color: var(--bad-fg);
    background: var(--bad-bg);
}

.add-subtask-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
}

.add-subtask-form .form-control {
    flex: 1 1 auto;
    height: 30px;
    padding: 0 6px;
    font-size: 12.5px;
    color: var(--text-2);
    background: transparent;
    border-color: transparent;
}

.add-subtask-form .form-control::placeholder {
    color: var(--muted);
}

.add-subtask-form .form-control:hover {
    border-color: var(--line);
}

.add-subtask-form .form-control:focus {
    background: var(--surface);
    border-color: var(--accent);
}

.add-subtask-form .icon-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.add-subtask-form .icon-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}

.todo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.todo-actions .btn-danger {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.todo-actions .btn-danger:hover {
    background: var(--bad-bg);
    border-color: var(--bad-bd);
    color: var(--bad-fg);
}

.todo-item:hover .todo-actions,
.todo-item:focus-within .todo-actions {
    opacity: 1;
}

/* Empty state ---------------------------------------------------------- */

.empty-state {
    display: block;
    text-align: center;
    padding: 30px 18px;
    margin-bottom: 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
}

/* The tasks list manages its own visibility from JS */
#emptyMessage {
    display: none;
}

.empty-mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 10px;
    border-radius: 12px;
    background: var(--chip);
    color: var(--muted);
}

.empty-mark .icon {
    width: 20px;
    height: 20px;
}

.empty-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
}

.empty-sub {
    margin-top: 3px;
    font-size: 12px;
    color: var(--muted);
}

/* Stats ---------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

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

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 11px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: left;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-card:hover {
    border-color: color-mix(in srgb, var(--muted) 32%, var(--line));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.stat-card.is-active {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}

.stat-card-static {
    cursor: default;
}

.stat-card-static:hover {
    transform: none;
    border-color: var(--line);
    box-shadow: none;
}

.stat-value {
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Calendar ------------------------------------------------------------- */

.calendar {
    padding: 14px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.calendar-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.calendar-nav {
    display: flex;
    gap: 6px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 4px;
}

.weekday {
    padding: 4px 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.calendar-day {
    position: relative;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.calendar-day:hover {
    background: var(--chip);
    color: var(--text);
}

.calendar-day.today {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent-ink);
    font-weight: 600;
}

.calendar-day.selected {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
    font-weight: 600;
}

.calendar-day.other-month {
    color: color-mix(in srgb, var(--muted) 55%, transparent);
    cursor: default;
}

.calendar-day.other-month:hover {
    background: transparent;
    color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.calendar-day .task-box {
    position: absolute;
    right: 4px;
    bottom: 3px;
    min-width: 14px;
    height: 14px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-family: var(--mono);
    font-size: 8.5px;
    font-weight: 600;
}

.calendar-day.selected .task-box {
    background: color-mix(in srgb, var(--surface) 22%, transparent);
    color: var(--surface);
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 2px 10px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.section-accent {
    color: var(--accent-ink);
}

/* Board ---------------------------------------------------------------- */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.kanban-column {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 180px;
    padding: 9px;
    background: var(--sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.kanban-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 3px 0;
}

.kanban-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-2);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
}

.dot-todo {
    background: var(--muted);
}

.dot-working {
    background: var(--warn-fg);
}

.dot-done {
    background: var(--ok-fg);
}

.kanban-count {
    padding: 1px 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
}

.kanban-tasks {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 110px;
    border-radius: 8px;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.kanban-tasks.drag-over {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.kanban-tasks:empty::after {
    content: "Drop a task here";
    display: grid;
    place-items: center;
    min-height: 72px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.kanban-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: var(--shadow-xs);
    cursor: grab;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card:hover {
    border-color: color-mix(in srgb, var(--muted) 32%, var(--line));
    box-shadow: var(--shadow-sm);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.working {
    border-left: 2px solid var(--warn-fg);
}

.kanban-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.kanban-card .todo-text {
    flex: 1 1 auto;
    font-size: 12.5px;
}

.kanban-card .badge {
    font-size: 8.5px;
    padding: 2px 6px;
}

.working-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warn-fg);
}

.working-pill .dot {
    background: var(--warn-fg);
    animation: pulse 2s ease-in-out infinite;
}

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

.kanban-meta {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* Timer ---------------------------------------------------------------- */

.timer-panel {
    padding: 24px 18px;
    background:
        radial-gradient(420px 180px at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
        linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 86%, var(--bg)));
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 13px;
}

.timer-circle {
    --p: 0;
    position: relative;
    width: 158px;
    height: 158px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--line) 0);
    box-shadow: 0 14px 34px color-mix(in srgb, var(--primary) 16%, transparent);
    cursor: pointer;
    transition: background 0.5s linear;
}

.timer-circle:hover {
    box-shadow: 0 16px 40px color-mix(in srgb, var(--primary) 24%, transparent);
}

.timer-circle::before {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--divider);
}

.timer-circle span {
    position: relative;
    z-index: 1;
    font-family: var(--mono);
    font-size: 33px;
    font-weight: 600;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
}

.timer-status {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
}

.timer-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

/* Footer --------------------------------------------------------------- */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.footer-mark {
    color: var(--text-2);
    font-weight: 600;
}

/* Modal ---------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: color-mix(in srgb, #0b1733 55%, transparent);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease;
}

.modal {
    width: 100%;
    max-width: 360px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.modal-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-bottom: 12px;
    border-radius: 11px;
    background: var(--ok-bg);
    color: var(--ok-fg);
}

.modal-title {
    font-size: 16px;
    letter-spacing: -0.02em;
}

.modal p {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-2);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* Scrollbar ------------------------------------------------------------ */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border: 3px solid var(--bg);
    border-radius: var(--radius-pill);
}

/* Responsive ----------------------------------------------------------- */

@media (max-width: 720px) {
    .main-container {
        padding: 0 14px 44px;
    }

    .appbar-inner {
        padding: 0 14px;
        height: 54px;
    }

    .content-wrapper {
        padding-top: 22px;
    }

    .composer-main {
        flex-wrap: wrap;
    }

    .composer-input {
        flex-basis: 100%;
        font-size: 16px; /* stops iOS from zooming on focus */
    }

    .composer-main .btn-add {
        width: 100%;
    }

    .kanban-board {
        grid-template-columns: 1fr;
    }

    .kanban-column {
        min-height: 120px;
    }

    .todo-actions {
        opacity: 1;
    }
}

@media (max-width: 560px) {
    .nav-link {
        gap: 0;
        padding: 8px 4px;
        font-size: 12.5px;
    }

    .nav-link .icon {
        display: none;
    }

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

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

    .date-chip {
        display: none;
    }

    .calendar-day {
        min-height: 40px;
        font-size: 12px;
    }

    .calendar-day .task-box {
        right: 2px;
        bottom: 2px;
        min-width: 12px;
        height: 12px;
        padding: 0 3px;
        font-size: 8px;
    }

    .field-row {
        flex-direction: column;
    }

    .field-row .field {
        flex-basis: auto;
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn-primary,
    .modal-actions .btn-ghost {
        width: 100%;
    }
}

@media (max-width: 380px) {
    .page-title {
        font-size: 24px;
    }

    .appbar-inner {
        gap: 8px;
    }

    .brand-name {
        font-size: 14px;
    }

    .progress-row {
        gap: 8px;
    }

    .progress-label {
        font-size: 9px;
    }

    .stat-card {
        padding: 9px 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .calendar {
        padding: 10px;
    }

    .calendar-days,
    .calendar-weekdays {
        gap: 3px;
    }

    .calendar-day {
        min-height: 36px;
    }

    .timer-circle {
        width: 142px;
        height: 142px;
    }

    .timer-circle span {
        font-size: 29px;
    }
}

@media (hover: none) {
    .todo-actions {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
