/* ==========================================================================
   Tasochka — дизайн-система поверх палитры MudBlazor (цвета — из AppTheme.cs).
   Здесь только то, чего нет в теме: оттенки для текста, тени, раскладка экранов.
   ========================================================================== */

:root {
    --tf-font: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    /* Бирюзовый и зелёный из палитры на белом не дотягивают до 4.5:1 — для текста темнее. */
    --tf-repeat: #0e7c8a;
    --tf-tag-mix: #000;
    --tf-tint: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    --tf-shadow-card: 0 1px 2px #1f24301a;
    --tf-shadow-panel: 0 8px 24px #1f24301f;
    --tf-panel-w: 448px;
}

:root[data-theme="dark"] {
    --tf-repeat: #22c5d4;
    --tf-tag-mix: #fff;
    --tf-tint: color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
    --tf-shadow-card: 0 1px 2px #00000066;
    --tf-shadow-panel: 0 8px 24px #00000080;
    color-scheme: dark;
}

html, body {
    font-family: var(--tf-font);
    -webkit-font-smoothing: antialiased;
}

h1:focus {
    outline: none;
}

.tf-grow { flex: 1 1 auto; min-width: 0; }
.tf-muted { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--mud-palette-text-secondary); }
.tf-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.tf-repeat { color: var(--tf-repeat); }
.tf-link { cursor: pointer; }
.tf-link:hover { text-decoration: underline; }

/* ----- Шапка ----- */

.tf-appbar {
    background: var(--mud-palette-surface) !important;
    color: var(--mud-palette-text-primary) !important;
    border-bottom: 1px solid var(--mud-palette-divider);
}

.tf-appbar .mud-toolbar { gap: 12px; }

.tf-logo {
    width: 196px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: inherit;
    text-decoration: none;
}

.tf-logo svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: var(--mud-palette-primary);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tf-search {
    flex: 1 1 auto;
    max-width: 560px;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--mud-palette-gray-light);
    color: var(--mud-palette-text-secondary);
    font-size: 14px;
    cursor: text;
}

.tf-search:focus-within { box-shadow: 0 0 0 2px var(--mud-palette-primary); }

.tf-search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.tf-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    color: var(--mud-palette-text-primary);
}

.tf-search kbd {
    font: 500 12px/1 var(--tf-font);
    padding: 3px 7px;
    border-radius: 4px;
    border: 1px solid var(--mud-palette-divider);
}

.tf-avatar {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    background: var(--tf-tint);
    color: var(--mud-palette-primary);
    font: 700 13px/1 var(--tf-font);
    cursor: pointer;
}

.tf-avatar:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }
.tf-menu-name { padding: 8px 16px 6px; font-size: 14px; font-weight: 600; }

/* ----- Сайдбар ----- */

.tf-drawer {
    background: var(--mud-palette-drawer-background) !important;
    border-right: 1px solid var(--mud-palette-divider);
}

.tf-drawer .mud-navmenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 100%;
    padding: 12px;
    box-sizing: border-box;
}

.tf-drawer .mud-nav-link {
    min-height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--mud-palette-drawer-text);
}

.tf-drawer .mud-nav-link .mud-nav-link-icon { color: var(--mud-palette-drawer-icon); font-size: 20px; }
.tf-drawer .mud-nav-link:hover:not(.active) { background: var(--mud-palette-action-default-hover); }

.tf-drawer .mud-nav-link.active:not(.mud-nav-link-disabled) {
    background: var(--tf-tint);
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.tf-drawer .mud-nav-link.active .mud-nav-link-icon { color: var(--mud-palette-primary); }

.nav-line { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }

.nav-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: var(--mud-palette-gray-light);
    color: var(--mud-palette-text-secondary);
}

.nav-count-overdue { background: var(--mud-palette-error); color: var(--mud-palette-error-text); }

.nav-section { display: flex; align-items: center; margin: 16px 0 2px; padding-left: 10px; }

.nav-section-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    padding: 4px 0;
    border: 0;
    background: none;
    font: 600 12px/16px var(--tf-font);
    color: var(--mud-palette-gray-darker);
    text-align: left;
    cursor: pointer;
}

.nav-section-toggle .mud-icon-root { opacity: 0; transition: opacity .15s; }
.nav-section:hover .nav-section-toggle .mud-icon-root,
.nav-section-toggle:focus-visible .mud-icon-root,
.nav-section-toggle[aria-expanded="false"] .mud-icon-root { opacity: 1; }
.nav-section .mud-icon-button { color: var(--mud-palette-drawer-icon); }

.nav-item-row { position: relative; display: flex; align-items: center; }
.nav-item-row > .mud-nav-item { flex: 1; min-width: 0; }
.nav-item-row .mud-nav-link { padding-right: 36px; }
.nav-item-menu { position: absolute; right: 2px; opacity: 0; transition: opacity .15s; }
.nav-item-row:hover .nav-item-menu, .nav-item-row:focus-within .nav-item-menu { opacity: 1; }
.nav-dot { width: 10px; height: 10px; margin: 0 5px 0 5px; }
.nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 4px; }
.nav-shared { opacity: .6; font-size: 16px !important; }
.nav-num { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--mud-palette-text-secondary); }
.nav-hash { width: 20px; flex-shrink: 0; text-align: center; font-weight: 700; }
.nav-empty { padding: 2px 10px 6px; font-size: 12px; line-height: 16px; color: var(--mud-palette-text-secondary); }
.nav-divider { height: 1px; margin: 8px 10px; background: var(--mud-palette-divider); }
/* Редкие разделы — прижаты к низу сайдбара. */
.tf-drawer .nav-bottom { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }

@media (hover: none) {
    .nav-item-menu { opacity: 1; }
}

/* ----- Страница ----- */

.tf-content { padding-top: 32px; padding-bottom: 48px; }

.tf-page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tf-title-line { display: flex; align-items: center; gap: 8px; }
.tf-page-title { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; }
.tf-page-sub { min-height: 20px; margin-top: 4px; font-size: 14px; line-height: 20px; color: var(--mud-palette-text-secondary); }

.tf-tabs {
    display: flex;
    padding: 3px;
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    overflow-x: auto;
    scrollbar-width: none;
}

.tf-tabs button {
    height: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: 600 13px/1 var(--tf-font);
    white-space: nowrap;
    cursor: pointer;
}

.tf-tabs button.is-on {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: var(--tf-shadow-card);
}

.tf-tabs button:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; }
.tf-tab-count { font-size: 12px; font-weight: 500; color: var(--mud-palette-text-secondary); }

.tf-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
/* MudSelect оборачивает поле в .mud-select, MudTooltip — в .mud-tooltip-root: ширину задаём обёрткам. */
.tf-toolbar > .mud-select, .tf-toolbar > .mud-tooltip-root { flex: 0 0 200px; }
.tf-toolbar .mud-input-control.tf-filter { width: 100%; margin: 0; }
.tf-toolbar .mud-chip { margin: 0; }

/* Блок-карточка для остальных страниц (Мой день, статистика, настройки). */
.tf-box {
    padding: 16px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    box-shadow: var(--tf-shadow-card);
}

.tf-box-title { margin: 0 0 8px; font-size: 15px; line-height: 22px; font-weight: 600; }
.tf-hint { margin: -8px 0 16px; max-width: 720px; }

/* ----- Список задач ----- */

.tf-groups { display: flex; flex-direction: column; gap: 24px; }
.tf-group { display: flex; flex-direction: column; gap: 8px; }
.tf-group-title { margin: 0 4px; font-size: 15px; line-height: 22px; font-weight: 600; }
.tf-group-title.is-alert { color: var(--mud-palette-error); }
.tf-group-count { margin-left: 4px; font-weight: 500; color: var(--mud-palette-text-secondary); }

.tf-card {
    background: var(--mud-palette-surface);
    border-radius: 8px;
    box-shadow: var(--tf-shadow-card);
    overflow: hidden;
}

.tf-swipe { position: relative; border-top: 1px solid var(--mud-palette-divider); }
.tf-swipe:first-child { border-top-color: transparent; }

.tf-swipe-bg {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    gap: 6px;
    padding-left: 24px;
    background: var(--mud-palette-success);
    color: var(--mud-palette-success-text);
    font-size: 13px;
    font-weight: 600;
    opacity: .7;
}

.tf-swipe-bg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tf-swipe.is-swiping .tf-swipe-bg { display: flex; }
.tf-swipe.is-armed .tf-swipe-bg { opacity: 1; }
.tf-swipe.is-swiping .tf-task { transition: none; }

.tf-task {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 10px 12px 10px 16px;
    box-sizing: border-box;
    background: var(--mud-palette-surface);
    transition: transform .2s ease, background-color .15s;
    touch-action: pan-y;
}

.tf-task:hover { background: var(--mud-palette-gray-lighter); }
.tf-task.is-selected { background: linear-gradient(var(--tf-tint), var(--tf-tint)), var(--mud-palette-surface); }

.tf-task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }

.tf-task-title {
    font-size: 15px;
    line-height: 22px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tf-task.is-done .tf-task-title { color: var(--mud-palette-text-disabled); text-decoration: line-through; }

.tf-task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 10px;
    row-gap: 2px;
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
}

.tf-task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.tf-task-meta svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tf-task-meta .is-alert { color: var(--mud-palette-error); }
.tf-tag { color: color-mix(in srgb, var(--c) 72%, var(--tf-tag-mix)); }

/* Круглый чекбокс: цвет кольца — приоритет. */
.tf-check {
    --ring: var(--mud-palette-lines-inputs);
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 999px;
    border: 2px solid var(--ring);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.tf-check::after { content: ""; position: absolute; inset: -10px; }
.tf-check.prio-3 { --ring: var(--mud-palette-error); }
.tf-check.prio-2 { --ring: var(--mud-palette-warning); }
.tf-check.prio-1 { --ring: var(--mud-palette-info); }
.tf-check.is-done { --ring: var(--mud-palette-success); background: var(--mud-palette-success); }

.tf-check svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: var(--ring);
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity .15s;
}

.tf-check:hover:not(.is-done) { background: color-mix(in srgb, var(--ring) 14%, transparent); }
.tf-check:hover svg { opacity: 1; }
.tf-check.is-done svg { opacity: 1; stroke: var(--mud-palette-surface); }
.tf-check:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }

.tf-hover-only { opacity: 0; transition: opacity .15s; }
.tf-task:hover .tf-hover-only, .tf-task:focus-within .tf-hover-only,
.tf-sub:hover .tf-hover-only, .tf-sub:focus-within .tf-hover-only { opacity: 1; }

@media (hover: none) {
    .tf-hover-only { opacity: 1; }
}

.tf-add-row {
    width: 100%;
    height: 40px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--mud-palette-text-secondary);
    font: 500 14px/20px var(--tf-font);
    cursor: pointer;
}

.tf-add-row:hover { color: var(--mud-palette-primary); background: var(--tf-tint); }
.tf-add-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.tf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 16px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-secondary);
    text-align: center;
}

.tf-empty > svg { width: 40px; height: 40px; fill: none; stroke: var(--mud-palette-success); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Ручная сортировка: ручка слева, линия-вставка под курсором. touch-action — чтобы на
   телефоне перетаскивание ручки не прокручивало страницу. */
.sort-handle { margin-left: -8px; display: inline-flex; cursor: grab; touch-action: none; opacity: .45; }
.sort-handle:hover { opacity: 1; }
.sort-dragging { opacity: .45; }
.sort-marker { position: absolute; height: 2px; background: var(--mud-palette-primary); z-index: 2000; pointer-events: none; }

/* ----- Боковая панель задачи ----- */

.tf-panel {
    position: fixed;
    z-index: 1150; /* над сайдбаром (1100), под выпадающими списками MudBlazor (1200) */
    top: calc(var(--mud-appbar-height) + 16px);
    right: 16px;
    bottom: 16px;
    width: var(--tf-panel-w);
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-surface);
    border-radius: 12px;
    box-shadow: var(--tf-shadow-panel);
    overflow: hidden;
    animation: tf-slide-in .18s ease-out;
}

@keyframes tf-slide-in {
    from { transform: translateX(24px); opacity: 0; }
}

.tf-panel-backdrop { display: none; }

@media (min-width: 1200px) {
    body:has(.tf-panel) .mud-main-content { padding-right: calc(var(--tf-panel-w) + 16px); }
}

@media (max-width: 1199.98px) {
    .tf-panel { top: var(--mud-appbar-height); right: 0; bottom: 0; width: min(520px, 100%); border-radius: 0; }
    .tf-panel-backdrop { display: block; position: fixed; inset: var(--mud-appbar-height) 0 0 0; z-index: 1149; background: rgba(0, 0, 0, .32); }
}

@media (prefers-reduced-motion: reduce) {
    .tf-panel { animation: none; }
    .tf-task { transition: none; }
}

/* ----- Карточка задачи (боковая панель) ----- */

.tf-detail { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.tf-detail-head {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 20px;
    border-bottom: 1px solid var(--mud-palette-divider);
    font-size: 13px;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
}

.tf-detail-project { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-detail-state { flex: 1; text-align: right; white-space: nowrap; }

.tf-detail-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tf-detail-titlerow { display: flex; gap: 12px; align-items: flex-start; }
.tf-detail-titlerow .tf-check { width: 22px; height: 22px; margin-top: 3px; }

.tf-detail-title {
    flex: 1;
    min-height: 28px;
    padding: 0 0 2px;
    border: 0;
    border-bottom: 2px solid transparent;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--mud-palette-text-primary);
    font: 600 20px/28px var(--tf-font);
    letter-spacing: -0.01em;
    field-sizing: content;
}

.tf-detail-title:focus { border-bottom-color: var(--mud-palette-primary); }
.tf-detail-title.is-done { color: var(--mud-palette-text-disabled); text-decoration: line-through; }

.tf-detail-desc {
    width: 100%;
    min-height: 64px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    outline: 0;
    resize: vertical;
    background: transparent;
    color: var(--mud-palette-text-primary);
    font: 400 14px/20px var(--tf-font);
    field-sizing: content;
}

.tf-detail-desc:focus { border-color: var(--mud-palette-primary); }

.tf-props {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
}

.tf-prop-label { font-size: 13px; font-weight: 500; color: var(--mud-palette-text-secondary); }
.tf-prop-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.tf-prop-value > .mud-input-control { flex: 1 1 140px; min-width: 0; margin: 0; }
.tf-prop-value > .mud-input-control.tf-prop-time { flex: 0 1 110px; }
.tf-prop-value .mud-checkbox { margin: 0; }
.tf-prop-labels { gap: 6px; }

.tf-seg { flex: 1 1 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 2px; border-radius: 8px; background: var(--mud-palette-background-gray); }

.tf-seg button {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: 600 12px/1 var(--tf-font);
    cursor: pointer;
}

.tf-seg button.is-on { background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); box-shadow: var(--tf-shadow-card); }
.tf-seg button:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; }

.tf-flag { width: 8px; height: 8px; border-radius: 2px; background: var(--mud-palette-lines-inputs); }
.tf-flag.prio-3 { background: var(--mud-palette-error); }
.tf-flag.prio-2 { background: var(--mud-palette-warning); }
.tf-flag.prio-1 { background: var(--mud-palette-info); }

.tf-label-chip {
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    background: transparent;
    color: var(--mud-palette-text-secondary);
    font: 500 12px/1 var(--tf-font);
    cursor: pointer;
}

.tf-label-chip:hover { border-color: var(--mud-palette-lines-inputs); }
.tf-label-chip:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }

.tf-detail-section { display: flex; flex-direction: column; gap: 8px; }
.tf-section-head { display: flex; align-items: center; gap: 8px; }
.tf-section-head h3 { flex: 1; margin: 0; font-size: 15px; line-height: 22px; font-weight: 600; }

.tf-progress { height: 4px; border-radius: 999px; background: var(--mud-palette-gray-light); overflow: hidden; }
.tf-progress > div { height: 100%; border-radius: 999px; background: var(--mud-palette-success); transition: width .2s; }

.tf-sub { display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 14px; }

.tf-sub-box {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    padding: 0;
    border: 2px solid var(--mud-palette-lines-inputs);
    border-radius: 4px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tf-sub-box svg { width: 10px; height: 10px; fill: none; stroke: var(--mud-palette-surface); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.tf-sub.is-done .tf-sub-box { background: var(--mud-palette-success); border-color: var(--mud-palette-success); }
.tf-sub.is-done .tf-sub-box svg { opacity: 1; }
.tf-sub-box:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; }
.tf-sub-title { flex: 1; min-width: 0; }
.tf-sub.is-done .tf-sub-title { color: var(--mud-palette-text-disabled); text-decoration: line-through; }

.tf-sub-add { display: flex; align-items: center; gap: 10px; height: 32px; color: var(--mud-palette-text-secondary); }

.tf-sub-add input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mud-palette-text-primary);
    font: 400 14px/20px var(--tf-font);
}

.tf-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 4px 4px 4px 14px;
    border-radius: 8px;
    background: var(--mud-palette-gray-lighter);
    font-size: 14px;
}

.tf-row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-row-wrap > .mud-input-control { flex: 1 1 150px; margin: 0; }

.tf-fold {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--mud-palette-text-primary);
    font: 600 14px/20px var(--tf-font);
    text-align: left;
    cursor: pointer;
}

.tf-fold:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 2px; border-radius: 4px; }
.tf-fold-hint { margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--mud-palette-text-secondary); }
.tf-fold-hint.tf-repeat { color: var(--tf-repeat); }
.tf-fold-body { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 4px; }

.tf-comment { display: flex; gap: 10px; }
.tf-comment-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tf-tint);
    color: var(--mud-palette-primary);
    font-size: 12px;
    font-weight: 700;
}
.tf-comment-meta { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.tf-comment-author { font-size: 13px; font-weight: 600; }
.tf-comment-text { font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tf-comment:hover .tf-hover-only, .tf-comment:focus-within .tf-hover-only { opacity: 1; }
.tf-comment-new { display: flex; flex-direction: column; gap: 6px; }
.tf-comment-input {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    outline: 0;
    resize: none;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: 400 14px/20px var(--tf-font);
    field-sizing: content;
}
.tf-comment-input:focus { border-color: var(--mud-palette-primary); }

.tf-audit { padding: 8px 0; border-bottom: 1px solid var(--mud-palette-divider); font-size: 14px; }
.tf-audit-line { margin-left: 12px; }

.tf-detail-foot {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--mud-palette-divider);
}

/* ----- Вход, регистрация, сброс пароля ----- */

.auth {
    min-height: calc(100vh - var(--mud-appbar-height) - 96px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    gap: 48px;
    align-items: center;
}

.auth-brand { display: flex; flex-direction: column; gap: 16px; }
.auth-rings { display: grid; grid-template-columns: repeat(5, 36px); gap: 18px; margin-bottom: 16px; }
.auth-rings .tf-check { width: 36px; height: 36px; border-width: 3px; cursor: default; }
.auth-rings .tf-check svg { width: 20px; height: 20px; }
.auth-rings .tf-check::after { display: none; }
.auth-tagline { margin: 0; max-width: 420px; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { margin: 0; max-width: 420px; font-size: 15px; line-height: 22px; color: var(--mud-palette-text-secondary); }

.auth-card {
    padding: 28px;
    border-radius: 12px;
    background: var(--mud-palette-surface);
    box-shadow: var(--tf-shadow-panel);
}

.auth-title { margin: 0 0 20px; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }

@media (max-width: 899.98px) {
    .auth { grid-template-columns: minmax(0, 1fr); justify-items: center; min-height: 0; padding-top: 4vh; }
    .auth-brand { display: none; }
    .auth-card { width: 100%; max-width: 420px; box-sizing: border-box; }
}

/* ----- Телефон: нижняя навигация и круглая кнопка ----- */

.tf-bottom-nav, .tf-fab { display: none; }

@media (max-width: 599.98px) {
    .tf-logo { width: auto; }
    .tf-logo span, .tf-search kbd, .tf-add-btn, .tf-theme-btn { display: none; }
    .tf-content { padding-top: 20px; padding-bottom: 104px; }
    .tf-page-title { font-size: 24px; line-height: 30px; }
    .tf-tabs { width: 100%; }
    .tf-toolbar .mud-spacer { display: none; }
    .tf-toolbar > .mud-select, .tf-toolbar > .mud-tooltip-root { flex: 1 1 140px; }
    .tf-task { min-height: 64px; }
    .tf-props { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
    .tf-prop-label { margin-top: 8px; }

    /* Уведомления — над нижней навигацией. */
    .mud-snackbar-location-bottom-left { bottom: calc(72px + env(safe-area-inset-bottom)) !important; }

    .tf-bottom-nav {
        position: fixed;
        z-index: 1100;
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        background: var(--mud-palette-surface);
        border-top: 1px solid var(--mud-palette-divider);
    }

    .tf-bottom-nav a, .tf-bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 0;
        background: none;
        color: var(--mud-palette-text-secondary);
        font: 500 12px/16px var(--tf-font);
        text-decoration: none;
        cursor: pointer;
    }

    .tf-bottom-nav .active { color: var(--mud-palette-primary); font-weight: 600; }

    .tf-fab {
        position: fixed;
        z-index: 1100;
        right: 16px;
        bottom: calc(80px + env(safe-area-inset-bottom));
        width: 56px;
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 999px;
        background: var(--mud-palette-primary);
        color: var(--mud-palette-primary-text);
        box-shadow: var(--tf-shadow-panel);
        cursor: pointer;
    }

    .tf-fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
}

/* ----- Служебное Blazor: ошибка и загрузка ----- */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #4f46e5;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* Обёртка полей карточки: блокирует ввод наблюдателю, сама не видна. */
.tf-plain-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tf-plain-fieldset:disabled { opacity: .75; }
