:root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #18181b;
    --muted: #71717a;
    --link: #7c3aed;
    --link-hover: #6d28d9;
    --link-soft: #f5f3ff;
    --link-soft-border: #ddd6fe;
    --border: #e4e4e7;
    --sidebar-bg: #fafafa;
    --sidebar-width: 264px;
    --header-height: 3.75rem;
    --hover-bg: #f4f4f5;
    --input-bg: #f4f4f6;
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.875rem;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(16, 24, 40, 0.06);
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

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

/* Block: layout */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

.layout--no-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas:
        "header"
        "main";
}

.layout__main {
    grid-area: main;
    position: relative;
    padding: 1.75rem 2.25rem;
    max-width: 60rem;
    min-width: 0;
    overflow-wrap: break-word;
}

/* Task pages (list/done/calendar) aren't prose, so let them use more width
   than the site's 60rem reading-width default. */
.layout__main:has(.task-list) {
    max-width: 75rem;
}

/* Block: edit-link */
.edit-link {
    position: absolute;
    top: 1.75rem;
    right: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    text-decoration: none;
    font-size: 1rem;
    line-height: 1;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.edit-link:hover {
    background: var(--hover-bg);
    border-color: #d4d4d8;
}

.layout__main img,
.layout__main table,
.layout__main pre {
    max-width: 100%;
}

.layout__main pre {
    overflow-x: auto;
}

/* Block: task-list-item (GFM checkboxes) */
.layout__main .task-list-item {
    list-style: none;
}

.layout__main .task-list-item input[type="checkbox"] {
    margin-right: 0.5em;
    vertical-align: middle;
}

/* Block: site-header */
.site-header {
    grid-area: header;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.site-header__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: inherit;
    text-decoration: none;
}

.site-header__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 1.75rem;
    height: 1.75rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.site-header__toggle-bar {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.site-header__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: var(--link);
    font-size: 1.05rem;
    line-height: 1;
}

.site-header__title {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
}

.site-header__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    color: var(--muted);
    text-decoration: none;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.site-header__logout:hover {
    background: var(--hover-bg);
    color: var(--text);
    border-color: #d4d4d8;
}

.site-header__logout i {
    font-size: 0.9rem;
}

/* Block: site-search */
.site-search {
    margin-left: auto;
    position: relative;
}

.site-search::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 7 Free', FontAwesome, sans-serif;
    font-weight: 900;
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--muted);
    pointer-events: none;
}

.site-search__input {
    width: 16rem;
    max-width: 40vw;
    padding: 0.45rem 0.8rem 0.45rem 2rem;
    font: inherit;
    font-size: 0.88rem;
    color: inherit;
    background: var(--input-bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.site-search__input:hover {
    border-color: var(--border);
}

.site-search__input:focus {
    outline: none;
    background: var(--bg);
    border-color: var(--link);
    box-shadow: 0 0 0 3px var(--link-soft);
}

/* Block: layout backdrop (mobile sidebar overlay) */
.layout__backdrop {
    display: none;
}

/* Block: sidebar */
.sidebar {
    grid-area: sidebar;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--sidebar-bg);
}

.sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0.85rem;
}

/* Block: sidebar tree */
.sidebar__tree {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.88rem;
}

.sidebar__tree .sidebar__tree {
    padding-left: 1.25rem;
}

.sidebar__item {
    margin: 0 0 0.15rem;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    color: #3f3f46;
    text-decoration: none;
    font-weight: 500;
}

.sidebar__link i {
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.sidebar__link:hover {
    background: var(--hover-bg);
}

.sidebar__link--active {
    background: var(--link-soft);
    color: var(--link-hover);
    font-weight: 600;
}

.sidebar__link--active i {
    color: var(--link-hover);
}

.sidebar__row {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.sidebar__row .sidebar__link {
    flex: 1;
    min-width: 0;
}

.sidebar__toggle {
    cursor: pointer;
    width: 1.4rem;
    height: 1.4rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--muted);
}

.sidebar__toggle::before {
    content: '\f105';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 7 Free', FontAwesome, sans-serif;
    font-weight: 900;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.sidebar__toggle:hover {
    background: var(--hover-bg);
}

.sidebar__toggle-input:checked ~ .sidebar__row .sidebar__toggle::before {
    transform: rotate(90deg);
}

.sidebar__tree--nested {
    display: none;
}

.sidebar__toggle-input:checked ~ .sidebar__tree--nested {
    display: block;
}

/* Block: sidebar user footer (mirrors admin's bottom account panel) */
.sidebar__footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem;
    border-top: 1px solid var(--border);
}

.sidebar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 50%;
    background: var(--link);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.sidebar__account {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Block: project card */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
    list-style: none;
    padding: 0;
}

.project-card {
    display: flex;
    gap: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.project-card__image {
    width: 180px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
    background: var(--hover-bg);
}

.project-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.project-card__header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.project-card__title {
    font-weight: 700;
    font-size: 1.05rem;
}

.project-card__badge {
    font-size: 0.72rem;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
    font-weight: 600;
}

.project-card__badge--active {
    background: var(--link);
    color: #ffffff;
}

.project-card__badge--planned {
    background: var(--hover-bg);
    color: #6b7280;
}

.project-card__badge--inactive {
    background: var(--hover-bg);
    color: #9ca3af;
}

.project-card__badge--forming {
    background: #fdecd2;
    color: #a15c1e;
}

.project-card__description {
    color: #555555;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.project-card__progress {
    margin-top: auto;
}

.project-card__progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #777777;
    margin-bottom: 3px;
}

.project-card__progress-track {
    background: var(--hover-bg);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
}

.project-card__progress-bar {
    background: var(--link);
    height: 6px;
    border-radius: 4px;
}

.project-card__link {
    font-size: 0.85rem;
    align-self: flex-start;
    margin-top: 0.25rem;
}

/* Responsive: phones and small tablets */
@media (max-width: 860px) {
    :root {
        --header-height: 8rem;
    }

    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .site-header {
        flex-wrap: wrap;
        row-gap: 0.75rem;
        padding: 1.25rem 1.25rem;
        min-height: var(--header-height);
    }

    .site-header__toggle {
        display: inline-flex;
    }

    .site-search {
        margin-left: 0;
        order: 1;
        flex-basis: 100%;
    }

    .site-search__input {
        width: 100%;
        max-width: none;
    }

    .site-header__actions {
        margin-left: auto;
    }

    .layout__main {
        padding: 1rem;
    }

    .edit-link {
        top: 1rem;
        right: 1rem;
    }

    .layout__backdrop {
        display: block;
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 15;
    }

    .layout__toggle-input:checked ~ .layout__backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        bottom: 0;
        left: 0;
        width: min(80vw, var(--sidebar-width));
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 20;
    }

    .layout__toggle-input:checked ~ .sidebar {
        transform: translateX(0);
    }

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

    .project-card__image {
        width: 100%;
        height: auto;
        aspect-ratio: 3 / 2;
    }

    .stream-composer__submit {
        width: 100%;
    }
}

/* Block: auth-layout (login / forgot / reset / magic-link / unauthorized pages) */
.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem 1.5rem;
    background: var(--sidebar-bg);
}

.auth-layout__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    text-align: center;
}

.auth-layout__brand .site-header__logo {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.5rem;
}

.auth-layout__brand .site-header__title {
    font-size: 1.3rem;
}

.auth-layout__subtitle {
    margin: -0.5rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.auth-card {
    width: 100%;
    max-width: 24rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2.25rem 2rem;
}

.auth-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 1.75rem;
    text-align: center;
}

.auth-card__body {
    text-align: center;
}

.auth-card__body .button {
    width: 100%;
    margin-top: 1.25rem;
}

.auth-layout__footer {
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
    }
}

/* Block: form (shared by login / forgot / reset / magic forms) */
.form-field {
    margin-bottom: 1.1rem;
}

.form-label {
    margin-bottom: 0.4rem;
}

.form-label .inline {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #3f3f46;
}

.form-label .required {
    color: #dc2626;
    margin-left: 0.15rem;
}

.form-input-wrapper input:not([type="checkbox"]) {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    color: inherit;
    background: var(--input-bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-input-wrapper input:not([type="checkbox"]):hover {
    border-color: #d4d4d8;
}

.form-input-wrapper input:not([type="checkbox"]):focus {
    outline: none;
    background: var(--bg);
    border-color: var(--link);
    box-shadow: 0 0 0 3px var(--link-soft);
}

.form-input-wrapper input:-webkit-autofill,
.form-input-wrapper input:-webkit-autofill:hover,
.form-input-wrapper input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    box-shadow: 0 0 0 1000px var(--input-bg) inset;
    transition: background-color 9999s ease-in-out 0s;
}

.form-textarea-wrapper textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    color: inherit;
    background: var(--input-bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-textarea-wrapper textarea:hover {
    border-color: #d4d4d8;
}

.form-textarea-wrapper textarea:focus {
    outline: none;
    background: var(--bg);
    border-color: var(--link);
    box-shadow: 0 0 0 3px var(--link-soft);
}

/* file upload (dropzone) field */
.form-input-file.dropzone {
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--sidebar-bg);
    color: inherit;
    font-size: 0.85rem;
}

.form-field.has-errors .form-input-wrapper input {
    border-color: #dc2626;
    background: #fef2f2;
}

.form-field.has-errors .form-input-wrapper input:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-errors .form-message {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: #dc2626;
}

.form-errors .form-message i {
    display: none;
}

/* checkbox fields (remember-me, task done / show-in-calendar, etc.) */
.form-data.rememberme {
    order: 1;
    margin: 0;
}

.form-data[data-grav-field="checkbox"] .form-input-wrapper,
.form-data.rememberme .form-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.form-input-wrapper input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--link);
    cursor: pointer;
}

.form-data[data-grav-field="checkbox"] label,
.form-data.rememberme label {
    font-size: 0.85rem;
    font-weight: 400;
    color: #52525b;
    cursor: pointer;
}

/* checkboxes (plural) fields - e.g. task "Настройки" (Выполнено / Показывать в календаре) */
.checkboxes input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0 0.45rem 0 0;
    vertical-align: middle;
    accent-color: var(--link);
    cursor: pointer;
}

.checkboxes label {
    margin-right: 1.25rem;
    padding-left: 1.8rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: #52525b;
    cursor: pointer;
}

/* form actions / buttons */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.75rem;
    margin-top: 0.25rem;
}

.form-actions.secondary-accent {
    justify-content: space-between;
}

/* Login form's actions row: remember-me + forgot link share a line,
   the submit button always takes its own full-width line below. */
.form-actions.secondary-accent .form-data.rememberme {
    flex: 0 1 auto;
}

.form-actions.secondary-accent .button.secondary {
    order: 2;
    margin-left: auto;
}

.form-actions.secondary-accent .button.primary {
    order: 3;
    flex: 1 1 100%;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

.button:hover {
    background: var(--hover-bg);
}

.button i {
    font-size: 0.85rem;
}

.button.primary {
    background: var(--link);
    border-color: var(--link);
    color: #ffffff;
}

.button.primary:hover {
    background: var(--link-hover);
    border-color: var(--link-hover);
}

.button.primary:active {
    filter: brightness(0.95);
}

.button.secondary {
    background: none;
    border-color: transparent;
    color: var(--link);
    padding: 0.4rem 0;
    font-size: 0.85rem;
    font-weight: 500;
}

.button.secondary:hover {
    background: none;
    text-decoration: underline;
}

/* messages / notices */
#messages {
    margin-bottom: 1.25rem;
}

.notices {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.notices p {
    margin: 0;
}

.notices.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.notices.info {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.notices.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* Block: generic content-page form wrapper (e.g. flex-edit / new task page) */
.container.form {
    max-width: 34rem;
}

/* Block: task-list (tasks directory page) */
.task-list__header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-list__title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.task-list__header-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.task-list__done-link {
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
}

.task-list__done-link:hover {
    color: var(--link);
}

.task-list__sort {
    display: inline-flex;
    gap: 0.15rem;
    padding: 0.2rem;
    margin-bottom: 0.9rem;
    background: var(--hover-bg);
    border-radius: 10px;
}

.task-list__sort-link {
    padding: 0.35rem 0.8rem;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.task-list__sort-link:hover {
    color: var(--text);
}

.task-list__sort-link--active {
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.task-list__quick-add {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.25rem;
    padding: 0.65rem 0.75rem;
    font: inherit;
    font-size: 0.9rem;
    color: var(--muted);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
}

.task-list__quick-add:hover {
    background: var(--hover-bg);
    color: var(--text);
}

.task-list__quick-add-icon {
    font-size: 1rem;
    line-height: 1;
    color: var(--link);
}

.task-list__empty {
    color: var(--muted);
    padding: 0.5rem 0.75rem;
}

.task-list__divider {
    padding: 0.6rem 0.75rem 0.3rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.task-list__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

.task-list__pagination a {
    text-decoration: none;
}

.task-list__pagination a:hover {
    text-decoration: underline;
}

.task-list__pagination-disabled {
    color: #9ca3af;
}

.task-list__pagination-info {
    color: var(--muted);
}

.task-list__items {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--border);
}

/* Block: cal-nav (prev/today/next bar, shared by all calendar views) */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.cal-nav__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 1rem;
}

.cal-nav__arrow:hover {
    background: var(--hover-bg);
    color: var(--text);
}

.cal-nav__label {
    min-width: 10rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.cal-nav__today {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.cal-nav__today:hover {
    color: var(--text);
    border-color: var(--muted);
}

/* Block: cal-month (month grid view) */
.cal-month {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-month__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--hover-bg);
}

.cal-month__weekdays span {
    padding: 0.4rem 0.2rem;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
}

.cal-month__row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-height: 3.4rem;
    padding: 0.35rem 0.15rem;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
    color: var(--text);
}

.cal-month__row .cal-day:first-child {
    border-left: none;
}

.cal-day:hover {
    background: var(--hover-bg);
}

.cal-day--muted {
    color: var(--muted);
    opacity: 0.55;
}

.cal-day__num {
    font-size: 0.82rem;
    font-weight: 500;
}

.cal-day--today .cal-day__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    background: var(--link);
    color: #fff;
    border-radius: 999px;
}

.cal-day__dots {
    display: flex;
    gap: 0.2rem;
}

.cal-day__dot {
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 999px;
    background: var(--muted);
}

.cal-day__dot--priority-low {
    background: #3b82f6;
}

.cal-day__dot--priority-medium {
    background: #f59e0b;
}

.cal-day__dot--priority-high {
    background: #ef4444;
}

.cal-day__more {
    font-size: 0.65rem;
    color: var(--muted);
}

/* Block: cal-week (week view - stacked day sections, becomes columns on wide screens) */
.cal-week {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.cal-week__day {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-week__day-label {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--hover-bg);
}

.cal-week__day--today .cal-week__day-label {
    color: var(--link);
}

.cal-week__empty {
    margin: 0;
    padding: 0.6rem 0.75rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.cal-week__items {
    border-top: none;
}


/* Block: task-row (flat list row, TickTick-style) */
.task-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
}

.task-row--priority-low {
    border-left-color: #3b82f6;
}

.task-row--priority-medium {
    border-left-color: #f59e0b;
}

.task-row--priority-high {
    border-left-color: #ef4444;
}

.task-row:hover {
    background: var(--hover-bg);
}

.task-row__toggle-form {
    display: contents;
}

.task-row__checkbox {
    margin-top: 0.15rem;
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    accent-color: var(--link);
    cursor: pointer;
}

.task-row__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.task-row__title {
    font-size: 0.92rem;
}

.task-row--done .task-row__title {
    color: var(--muted);
    text-decoration: line-through;
}

.task-row__description {
    font-size: 0.8rem;
    color: var(--muted);
}

.task-row__attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.task-row__attachment {
    font-size: 0.78rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    background: var(--sidebar-bg);
}

.task-row__attachment:hover {
    background: var(--hover-bg);
}

.task-row__edit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    margin-top: -0.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.task-row__edit:hover {
    opacity: 1;
    background: var(--hover-bg);
}

/* Block: modal (native <dialog>-based, used for the "new task" form) */
dialog.modal {
    padding: 0;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 30rem;
}

dialog.modal::backdrop {
    background: rgba(24, 24, 27, 0.45);
}

.modal__panel {
    padding: 1.5rem;
    max-height: 85vh;
    overflow-y: auto;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.modal__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
}

.modal__close:hover {
    background: var(--hover-bg);
    color: var(--text);
}

/* Block: stream-composer (quick-capture input at the top of /stream) */
.stream-composer {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--hover-bg);
}

.stream-composer .form-textarea-wrapper textarea {
    background: var(--bg);
}

.stream-composer form > .form-field:last-child {
    margin-top: 0.5rem;
}

/* Block: stream-list / stream-item (feed of captured thoughts) */
.stream-list__items {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stream-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stream-item__body {
    flex: 1;
    min-width: 0;
}

.stream-item__content {
    margin: 0;
    font-size: 0.92rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.stream-item__time {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.stream-item__delete-form {
    flex-shrink: 0;
}

.stream-item__delete {
    background: none;
    border: none;
    padding: 0.2rem 0.35rem;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
    opacity: 0.6;
}

.stream-item__delete:hover {
    opacity: 1;
    background: var(--hover-bg);
}

/* Block: action-items (aggregated checkboxes from every page) */
.action-items {
    margin-top: 0;
}

.action-items__group {
    margin-top: 1.5rem;
}

.action-items__group:first-of-type {
    margin-top: 1rem;
}

.action-items__breadcrumb {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.action-items__breadcrumb:hover {
    color: var(--link);
}

.action-items__list {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--border);
}

.action-items__item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.55rem 0.1rem;
    border-bottom: 1px solid var(--border);
}

.action-items__form {
    display: contents;
}

.action-items__checkbox {
    margin-top: 0.2rem;
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    accent-color: var(--link);
    cursor: pointer;
}

.action-items__text {
    font-size: 0.92rem;
}

.action-items__item--done .action-items__text {
    color: var(--muted);
    text-decoration: line-through;
}
