:root {
    /* === SYNTRA Leather Organizer Design System === */

    /* Brand / accent */
    --primary: #C6A46A;          /* Brass metal */
    --primary-hover: #D6B77E;
    --primary-light: rgba(198,164,106,0.12);
    --cyan: #3B556D;             /* Steel accent */
    --cyan-light: #E3E1DC;

    /* Leather palette */
    --leather-dark: #3A2A1F;     /* Dark leather — sidebar */
    --leather-rich: #4A3324;     /* Rich leather — header */
    --leather-mid:  #5A3F2C;     /* Medium leather — secondary panels */
    --leather-soft: #7A5A44;     /* Soft leather — kanban bg */
    --leather-stitch: #8B5A3C;   /* Stitch color */

    /* Paper palette */
    --paper: #F3F1EB;            /* Paper — cards, modals */
    --paper-dark: #E3E1DC;       /* Darker paper — table lines, bg */
    --paper-line: #D2CEC6;       /* Table lines */

    /* Metal palette */
    --metal-brass: #C6A46A;
    --metal-bronze: #8A6A45;
    --metal-steel: #7C7C7C;

    /* Layout backgrounds */
    --bg: #6B4D38;               /* Kanban workspace (legacy) */
    --bg-content: #E8EDF4;       /* Единый светлый фон контента: Сводка, Расходы, проект (канбан/список/календарь) */
    --bg-card: #F3F1EB;          /* Cards, modals = paper */
    --bg-sidebar: #3A2A1F;
    --bg-sidebar-hover: rgba(255,255,255,0.07);
    --bg-sidebar-section: rgba(255,255,255,0.04);
    --bg-header: #4A3324;
    --bg-header-muted: #4A3324;
    --bg-header-muted-light: #F3F1EB;

    /* Text */
    --text: #3C2B1E;             /* Dark brown — on paper */
    --text-secondary: #7A5A44;
    --text-muted: #A08060;
    --text-sidebar: #D5B885;     /* Gold on dark leather */
    --text-sidebar-active: #E7D3A2;
    --text-sidebar-accent: #C6A46A;

    /* Borders & shadows */
    --border: #D2CEC6;
    --border-focus: #3B556D;
    --card-shadow: 0 4px 12px rgba(30,15,5,0.14), 0 1px 0 rgba(255,220,150,0.08);
    --card-shadow-hover: 0 8px 20px rgba(30,15,5,0.22), 0 1px 0 rgba(255,220,150,0.12);

    /* Status colors */
    --danger: #C0392B;
    --danger-hover: #A93226;
    --success: #2E7D32;
    --warning: #C6A46A;
    --review: #8A6A45;

    /* Radii */
    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 4px;

    /* Modal spacing */
    --modal-body-padding: 28px 28px 28px;
    --modal-header-padding: 20px 28px 18px;
    --modal-footer-padding: 24px 28px 28px;
    --modal-footer-gap: 16px;
    --form-group-spacing: 26px;

    /* Shadows */
    --shadow: 0 2px 8px rgba(30,15,5,0.12);
    --shadow-lg: 0 24px 48px rgba(30,15,5,0.35);
    --transition: 0.16s ease-out;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Touch-friendly tap highlight */
button, a, [role="button"] {
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--leather-soft);
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

#app { display: flex; height: 100vh; }

/* ===== Sidebar — Dark Leather ===== */

.sidebar {
    position: relative;
    width: 240px;
    min-width: 240px;
    background-color: #3A2A1F;
    background-image:
        repeating-linear-gradient(
            15deg, transparent 0, transparent 3px,
            rgba(255,255,255,0.012) 3px, rgba(255,255,255,0.012) 6px
        ),
        repeating-linear-gradient(
            105deg, transparent 0, transparent 5px,
            rgba(0,0,0,0.06) 5px, rgba(0,0,0,0.06) 10px
        ),
        linear-gradient(180deg, #4A3324 0%, #3A2A1F 25%, #2E1F14 100%);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
    overflow-y: auto;
    z-index: 20;
    /* Декоративный шов — правый край */
    box-shadow: inset -2px 0 0 rgba(139,90,60,0.35), 2px 0 16px rgba(0,0,0,0.35);
}

.sidebar.collapsed { margin-left: -240px; }

/* Декоративный шов ровно по правому краю панели (привязан к сайдбару) */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px, transparent 5px,
        rgba(139,90,60,0.5) 5px, rgba(139,90,60,0.5) 8px
    );
    pointer-events: none;
    z-index: 21;
}
/* На мобильных при свёрнутом сайдбаре линия не должна оставаться по центру экрана */
.sidebar.collapsed::after {
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 18px 52px 16px 6px;
    border-bottom: none;
    position: relative;
}

.sidebar-close-mobile {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-sidebar);
    min-width: 44px;
    min-height: 44px;
}
.sidebar-close-mobile:hover { color: var(--text-sidebar-active); opacity: 1; }

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}
.logo-icon {
    flex-shrink: 0;
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 500;
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    background: linear-gradient(160deg, #E7D3A2 0%, #C6A46A 50%, #A07840 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

.sidebar-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
}

/* Декоративная стёганая линия между шапкой (логотип) и первым заголовком */
.sidebar-body::before {
    content: '';
    display: block;
    height: 0;
    border-top: 2px dashed rgba(139,90,60,0.5);
    margin: 0 8px;
    box-shadow: 0 1px 0 rgba(200,170,120,0.2);
}

.sidebar-section {
    padding: 16px 10px 0;
    border-top: 1px solid rgba(139,90,60,0.3);
}
.sidebar-section:first-of-type { border-top: none; }

.sidebar-bottom {
    flex-shrink: 0;
    margin-top: auto;
    padding: 12px 8px 16px;
    border-top: 1px solid rgba(139,90,60,0.3);
    position: relative;
}

.btn-sidebar-menu {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
}
.btn-sidebar-menu .sidebar-menu-icon {
    flex-shrink: 0;
}

/* Выпадающее меню в сайдбаре (слева вниз) — отдельный фон области */
.sidebar-menu-dropdown {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    padding: 10px 6px;
    border-radius: var(--radius);
    border: 1px solid rgba(139,90,60,0.35);
    background: rgba(60,42,31,0.85);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    max-height: 70vh;
    overflow-y: auto;
}

.sidebar-menu-dropdown.open {
    display: flex;
}

.sidebar-menu-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-sidebar);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-menu-dropdown-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-menu-dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-menu-dropdown-item-logout {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: var(--text-sidebar);
    opacity: 0.9;
}

.sidebar-menu-dropdown-item-logout:hover {
    opacity: 1;
    color: var(--text-sidebar-active);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #B8A88A;
}
.sidebar-section-header span {
    color: #B8A88A;
}

.sidebar-section-header .btn-icon {
    color: var(--text-sidebar);
    opacity: 0.6;
}

.sidebar-section-header .btn-icon:hover { opacity: 1; }

/* Сворачиваемые блоки «Участники» и «Аккаунты» — тот же цвет заголовка */
.sidebar-section-collapsible .sidebar-section-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #B8A88A;
    cursor: pointer;
    text-align: left;
}
.sidebar-section-collapsible .sidebar-section-toggle:hover { color: #C9B99A; }
.sidebar-section-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.sidebar-section-collapsible.collapsed .sidebar-section-chevron { transform: rotate(-90deg); }
.sidebar-section-collapsible.collapsed .user-list,
.sidebar-section-collapsible.collapsed .account-list { display: none !important; }
.sidebar-section-collapsible .sidebar-section-header {
    padding-right: 4px;
}

.project-list, .user-list { list-style: none; }

.project-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.88rem;
}

.project-list li:hover { background: var(--bg-sidebar-hover); }
.project-list li.active {
    background: rgba(198,164,106,0.15);
    color: #E7D3A2;
    border-left: 2px solid #C6A46A;
    padding-left: 8px;
}

.project-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.project-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.project-item-count {
    font-size: 0.75rem;
    opacity: 0.5;
    background: rgba(255,255,255,0.1);
    padding: 1px 7px;
    border-radius: 10px;
}

.project-list li .btn-context {
    opacity: 0;
    transition: opacity var(--transition);
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 1.1rem;
    line-height: 1;
}

.project-list li:hover .btn-context { opacity: 0.7; }
.project-list li .btn-context:hover { opacity: 1; }

.project-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 2px;
    user-select: none;
    flex-shrink: 0;
}
.project-list li:active .project-drag-handle { cursor: grabbing; }
.project-list li.project-dragging { opacity: 0.6; }
.project-list li.project-drag-over {
    background: var(--primary);
    color: var(--bg-card);
    border-radius: var(--radius-sm);
}

.user-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
}

.user-list li:hover {
    background: var(--bg-sidebar-hover);
}

.user-list li.user-dragging {
    opacity: 0.6;
}

.user-list li.user-drag-over {
    background: var(--primary);
    color: var(--bg-card);
    border-radius: var(--radius-sm);
}

.user-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0 2px;
    user-select: none;
    flex-shrink: 0;
}

.user-list li:active .user-drag-handle { cursor: grabbing; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar-sm { width: 30px; height: 30px; font-size: 0.72rem; }

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 500; color: var(--text-sidebar-active); }
.user-role { font-size: 0.75rem; opacity: 0.5; display: block; }

.user-list .btn-remove {
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    transition: opacity var(--transition);
}

.user-list li:hover .btn-remove { opacity: 0.7; }
.user-list .btn-remove:hover { opacity: 1; }

/* Data actions in sidebar */
.data-actions {
    display: flex;
    gap: 8px;
    padding: 0 8px;
}

.sidebar-bottom .data-actions-column {
    flex-direction: column;
    gap: 6px;
}

.sidebar-bottom .data-actions-column .btn-sidebar {
    flex: none;
    width: 100%;
    justify-content: flex-start;
}

.btn-sidebar {
    flex: 1;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-sidebar:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ===== Main Content ===== */

.main-content {
    position: relative;
    z-index: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    background-color: #4A3324;
    background-image:
        repeating-linear-gradient(
            10deg, transparent 0, transparent 4px,
            rgba(255,255,255,0.014) 4px, rgba(255,255,255,0.014) 8px
        ),
        linear-gradient(180deg, #5A3F2C 0%, #4A3324 60%, #3E2918 100%);
    border-bottom: 1px solid rgba(139,90,60,0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 1px 0 rgba(255,200,120,0.08);
    flex-shrink: 0;
}

.topbar-title {
    flex: 1;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #E7D3A2;
}

.topbar-dashboard-link {
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
    font-size: 0.96rem;
    font-weight: 600;
    color: #E7D3A2;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.topbar-dashboard-link:hover {
    text-decoration: underline;
    color: #FFFFFF;
}

.topbar-actions { display: flex; gap: 12px; align-items: center; }

/* Task filters bar */
.task-filters-bar {
    padding: 12px 24px 14px;
    background-color: #3E2918;
    background-image: linear-gradient(180deg, #4A3324 0%, #3E2918 100%);
    border-bottom: 1px solid rgba(139,90,60,0.35);
    color: #D5B885;
}

.task-filters-bar .task-search-input::placeholder { color: var(--text-muted); }

.task-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.task-search-input {
    min-width: 200px;
    flex: 1;
    max-width: 280px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    background: var(--bg-card);
}

.task-search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.task-search-input::placeholder {
    color: var(--text-muted);
}

.task-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-card);
    color: var(--text);
    min-width: 140px;
}

.task-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.task-filters-actions {
    margin-top: 8px;
}

.task-filters-count {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    margin-top: 6px;
}

.sidebar-toggle { display: none; }

/* View Toggle */
.view-toggle {
    display: flex;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.btn-view {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    transition: all var(--transition);
}

.btn-view:hover { color: #fff; background: rgba(255,255,255,0.1); }
.btn-view.active { background: rgba(255,255,255,0.18); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* ===== Calendar View ===== */

.calendar-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    min-height: 0;
    overflow: hidden;
    background: var(--bg-content);
}
.calendar-scroll-wrap {
    flex: 1;
    min-height: 200px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.calendar-scroll-wrap::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.calendar-scroll-wrap::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 4px;
}
.calendar-scroll-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.calendar-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-toolbar .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.calendar-range-toggle {
    display: flex;
    gap: 4px;
}

.calendar-range-toggle .btn.active {
    background: var(--primary);
    color: #fff;
}

.calendar-grid {
    min-height: 480px;
    display: flex;
    flex-direction: column;
    background: #F4F6FB;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: visible;
}
.calendar-grid.calendar-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto repeat(6, 1fr);
    overflow: hidden;
}

.calendar-weekdays {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #E5EBF5;
    border-bottom: 1px solid var(--border);
}

.calendar-weekday {
    padding: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1f2933;
    text-align: center;
}

.calendar-day-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px;
    min-height: 80px;
    overflow-y: auto;
}

.calendar-day-cell:nth-child(7n) { border-right: none; }

.calendar-day-cell.other-month {
    background: #DCE3EE;
}

.calendar-day-cell.other-month .calendar-day-num {
    color: var(--text-muted);
}

.calendar-day-cell.today {
    background: rgba(99, 102, 241, 0.08);
}
.calendar-day-cell.droppable-calendar-date.drop-over,
.calendar-week-day.droppable-calendar-date.drop-over {
    background: rgba(99, 102, 241, 0.12);
    outline: 2px dashed var(--primary);
    outline-offset: -2px;
}
.calendar-task-item.draggable-calendar-task.dragging {
    opacity: 0.6;
}
.calendar-task-item.draggable-calendar-task {
    cursor: grab;
}
.calendar-task-item.draggable-calendar-task:active {
    cursor: grabbing;
}

.calendar-day-num {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.calendar-day-tasks {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-task-item {
    font-size: 0.8rem;
    padding: 4px 8px;
    background: var(--primary-light, rgba(99, 102, 241, 0.15));
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-task-item:hover {
    background: var(--primary);
    color: #fff;
}

.calendar-task-title { display: block; overflow: hidden; text-overflow: ellipsis; }
.calendar-task-done { opacity: 0.7; margin-left: 4px; }

.calendar-grid.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    min-height: 300px;
}

.calendar-week-day {
    border-right: 1px solid var(--border);
    padding: 10px;
    overflow-y: auto;
}

.calendar-week-day:last-child { border-right: none; }

.calendar-week-day.today {
    background: rgba(99, 102, 241, 0.08);
}

.calendar-day-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.calendar-grid.calendar-day {
    display: block;
    min-height: 400px;
    padding: 16px;
    background: #F4F6FB;
}
.calendar-day-single-header {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}
.calendar-day-single-tasks {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.calendar-day-single-tasks .calendar-task-item {
    white-space: normal;
}

.calendar-day-timeline .calendar-day-timeline-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.calendar-day-hour-row {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 12px;
    align-items: start;
    min-height: 48px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.calendar-day-hour-row:last-child { border-bottom: none; }
.calendar-day-hour-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-top: 4px;
}
.calendar-day-hour-slots {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: #F4F6FB;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.calendar-day-hour-slots.drop-over {
    background: rgba(99, 102, 241, 0.12);
    outline: 2px dashed var(--primary);
    outline-offset: 2px;
}
.calendar-day-timeline .calendar-task-item.dragging {
    opacity: 0.6;
}
.calendar-day-timeline .calendar-task-item {
    cursor: grab;
    white-space: normal;
}
.calendar-day-timeline .calendar-task-item:active {
    cursor: grabbing;
}

/* ===== Welcome Screen ===== */

.welcome-screen { flex: 1; display: flex; align-items: center; justify-content: center; background: #6B4D38; }

.welcome-content { text-align: center; padding: 40px; }
.welcome-content h2 { margin-top: 20px; font-size: 1.6rem; font-family: 'Playfair Display', serif; color: #E7D3A2; }
.welcome-content p { margin-top: 8px; color: #D5B885; margin-bottom: 24px; }

/* ===== Dashboard (summary) ===== */

.dashboard-screen {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-content);
}

.dashboard-header {
    margin: 0 -24px 20px -24px;
    padding: 16px 24px;
    background: var(--bg-header-muted-light);
    border-bottom: 1px solid var(--border);
}

.dashboard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.dashboard-projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.dashboard-card {
    background-color: #F3F1EB;
    background-image: none;
    border: 1px solid #D2CEC6;
    border-top: 3px solid #C6A46A;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
    box-shadow: 0 2px 8px rgba(30,15,5,0.12);
}

.dashboard-card:hover {
    box-shadow: 0 6px 18px rgba(30,15,5,0.2);
    transform: translateY(-2px);
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.dashboard-card-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dashboard-card-name {
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--paper-line);
    border-radius: 4px;
    overflow: hidden;
}

.dashboard-progress-fill {
    display: block;
    height: 100%;
    background: var(--card-color, var(--primary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.dashboard-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dashboard-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dashboard-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 10px;
    background: #E8E4DE;
    color: #3C2B1E;
    border: 1px solid #D2CEC6;
}

.dashboard-badge.overdue {
    background: #FEE2E2;
    color: #B91C1C;
    border-color: #FECACA;
}

.dashboard-badge.due-soon {
    background: #FEF3C7;
    color: #B45309;
    border-color: #FDE68A;
}

.dashboard-badge.ok {
    background: #D1FAE5;
    color: #047857;
    border-color: #A7F3D0;
}

.dashboard-hot {
    margin-top: 8px;
}

.dashboard-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.dashboard-hot-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-hot-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.dashboard-hot-item:hover {
    background: #E8E4DE;
}

.dashboard-hot-item.overdue {
    border-left: 3px solid var(--danger);
}

.dashboard-hot-title {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-hot-project {
    flex-shrink: 0;
    font-size: 0.85rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-hot-date {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.dashboard-hot-empty {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 12px 0;
}

/* ===== Sidebar nav (Сводка, Расходы) — в одном стиле с проектами ===== */

.sidebar-nav-section .sidebar-section-header {
    margin-bottom: 6px;
}

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav-list li {
    margin: 0 0 2px 0;
}

.btn-sidebar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-sidebar);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    text-align: left;
    border-left: 2px solid transparent;
}

.btn-sidebar-nav svg {
    flex-shrink: 0;
    opacity: 0.85;
    stroke: currentColor;
}

.btn-sidebar-nav:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.btn-sidebar-nav:hover svg {
    opacity: 1;
}

.btn-sidebar-nav.active {
    background: rgba(34, 211, 238, 0.12);
    color: var(--text-sidebar-accent);
    border-left-color: var(--text-sidebar-accent);
    padding-left: 8px;
}

.btn-sidebar-nav.active svg {
    opacity: 1;
    stroke: var(--text-sidebar-accent);
}

/* ===== Expenses screen ===== */

.expenses-screen {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--bg-content);
}

.expenses-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 -24px 20px -24px;
    padding: 16px 24px;
    background: var(--bg-header-muted-light);
    border-bottom: 1px solid var(--border);
}

.expenses-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.expenses-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.expenses-project-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.expenses-project-select {
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}

.expenses-period-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.expenses-period-select {
    min-width: 140px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}

.expenses-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expenses-date-input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.9rem;
}

.expenses-date-sep {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.expenses-view-toggle {
    display: flex;
    gap: 4px;
}

.btn-view-expense {
    padding: 8px 14px;
    font-size: 0.9rem;
    min-height: 38px;
}

.btn-view-expense.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn-view-expense.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.expenses-analytics {
    margin-bottom: 20px;
}

.expenses-analytics-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.expenses-analytics-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.expenses-analytics-panel.expenses-analytics-total {
    background: linear-gradient(135deg, #F5EAD5 0%, #EDDCC4 100%);
    border-color: #E2CFB0;
}

.expenses-analytics-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

.expenses-analytics-body {
    font-size: 0.9rem;
}

.expenses-analytics-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.expenses-analytics-row:last-child {
    border-bottom: none;
}

.expenses-analytics-label {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.expenses-analytics-value {
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.expenses-analytics-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.expenses-analytics-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #A36A1A;
}

.expenses-chart-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    box-shadow: var(--shadow);
}

.expenses-chart-inner {
    min-height: 240px;
}

.expenses-summary {
    margin-bottom: 16px;
}

.expenses-total {
    font-size: 1rem;
    color: var(--text-secondary);
}

.expenses-total strong {
    color: var(--text);
}

.expenses-list-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.expenses-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.expense-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.expense-item:last-child {
    border-bottom: none;
}

.expense-amount {
    font-weight: 600;
    color: var(--text);
    min-width: 80px;
}

.expense-category {
    color: var(--text-secondary);
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.expense-category-swatch-inline {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.expense-category-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.expense-category-select-wrap select {
    flex: 1;
    min-width: 0;
}
.expense-category-swatch-select {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.expense-project {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.expense-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expense-comment {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.btn-edit-expense,
.btn-delete-expense {
    padding: 4px 8px;
    min-width: 32px;
    min-height: 32px;
    font-size: 1rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.btn-edit-expense:hover,
.btn-delete-expense:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-delete-expense:hover {
    color: var(--danger);
}

.expenses-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.expenses-empty p {
    margin: 0;
}

/* ===== Kanban Board — Soft Leather Workspace ===== */

.kanban-board {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-content);
}

.kanban-column {
    flex: 1;
    min-width: 295px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    background-color: #D6CFC6;
    background-image: linear-gradient(180deg, #DDD6CC 0%, #CEC7BE 100%);
    border-radius: var(--radius);
    border: 1px solid rgba(139,90,60,0.25);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Металлическая табличка заголовка колонки */
.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4A3324;
    background: linear-gradient(180deg, #C8BFB4 0%, #BDB4A8 100%);
    border-bottom: 1px solid rgba(139,90,60,0.25);
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* Маркеры колонок — объёмные металлические заклёпки */
.column-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset -2px -2px 3px rgba(0,0,0,0.35), inset 1px 1px 2px rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.2);
}
.dot-todo {
    background: linear-gradient(135deg, #B87333 0%, #8B5A2B 40%, #6B4423 100%);
    border: 1px solid rgba(184,115,51,0.5);
}
.dot-progress {
    background: linear-gradient(135deg, #708090 0%, #4A5568 40%, #2D3748 100%);
    border: 1px solid rgba(112,128,144,0.5);
}
.dot-review {
    background: linear-gradient(135deg, #D4AF37 0%, #B8860B 40%, #8B6914 100%);
    border: 1px solid rgba(212,175,55,0.6);
}
.dot-done {
    background: linear-gradient(135deg, #E5E4E2 0%, #A8A9AD 40%, #7D7F83 100%);
    border: 1px solid rgba(229,228,226,0.6);
}

.column-count {
    margin-left: auto;
    background: rgba(74,51,36,0.15);
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #4A3324;
    border: 1px solid rgba(139,90,60,0.25);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.kanban-cards.drag-over {
    background: rgba(59,62,230,0.06);
    border-radius: var(--radius-sm);
}

/* ===== Task Card — Paper Note ===== */

.task-card {
    background-color: #F3F1EB;
    background-image: none;
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow:
        0 2px 6px rgba(30,15,5,0.16),
        0 1px 0 rgba(255,240,200,0.6) inset,
        0 -1px 0 rgba(0,0,0,0.06) inset;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid rgba(200,190,170,0.8);
    border-top: 3px solid #C6A46A; /* металлическая скоба сверху */
    position: relative;
}

.task-card:hover {
    box-shadow:
        0 6px 16px rgba(30,15,5,0.22),
        0 1px 0 rgba(255,240,200,0.6) inset;
    transform: translateY(-2px);
    background-color: #F8F6F0;
}

.task-card.dragging {
    opacity: 0.92;
    transform: rotate(1.5deg);
    box-shadow: 0 14px 32px rgba(30,15,5,0.3);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.task-card-id {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.task-card-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #3C2B1E;
    flex: 1;
    line-height: 1.4;
}

.priority-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.priority-low { background: rgba(90,138,69,0.15); color: #2E6B26; border: 1px solid rgba(90,138,69,0.3); }
.priority-medium { background: rgba(198,164,106,0.18); color: #7A4E10; border: 1px solid rgba(198,164,106,0.4); }
.priority-high { background: rgba(180,60,40,0.13); color: #9C2A1A; border: 1px solid rgba(180,60,40,0.3); }
.priority-urgent { background: #9C2A1A; color: #FFF0E8; border: 1px solid rgba(0,0,0,0.1); }

.task-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Task card overall progress bar */
.task-card-progress-wrap {
    margin-bottom: 10px;
}

.task-card-progress-bar-track {
    width: 100%;
    height: 5px;
    background: #E6EAF0;
    border-radius: 99px;
    overflow: hidden;
}

.task-card-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #C6A46A, #8A6A45);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.task-card-progress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

.task-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.task-card-assignees {
    display: flex;
    gap: 0;
}

.task-card-assignees .user-avatar-sm {
    margin-left: -8px;
    border: 2px solid #F3F1EB;
}

.task-card-assignees .user-avatar-sm:first-child { margin-left: 0; }

/* Avatar photo support */
.user-avatar img,
.user-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.task-card-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-card-date.overdue { color: var(--danger); font-weight: 600; }

.task-card-subtasks {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.subtask-progress {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.subtask-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width var(--transition);
}

/* ===== List View ===== */

.list-view {
    flex: 1;
    overflow: auto;
    padding: 0;
    background: var(--bg-content);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.task-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.task-table th {
    background: #E3E1DC;
    text-align: left;
    padding: 12px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7A5A44;
    border-bottom: 2px solid #C6A46A;
    white-space: nowrap;
}

.task-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #D2CEC6;
    vertical-align: middle;
    background: #F3F1EB;
}

.task-row { cursor: pointer; transition: background var(--transition); }
.task-row:hover { background: rgba(198,164,106,0.1); }

.col-title { min-width: 200px; }
.col-status { width: 130px; }
.col-priority { width: 100px; }
.col-assignees { width: 140px; }
.col-date { width: 100px; }
.col-subtasks { width: 90px; text-align: center; }

.list-task-title { font-weight: 600; display: block; }
.list-task-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Кнопка «плюс» в списке — раскрыть подзадачи под задачей */
.list-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0;
}
.list-expand-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}
.col-title {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.col-title .list-expand-btn { flex-shrink: 0; }
.col-title .list-title-block { flex: 1; min-width: 0; }

/* Строка под задачей: подзадачи */
.list-task-detail-row { background: var(--bg-card); }
.list-task-detail-clickable { cursor: pointer; }
.list-task-detail-clickable:hover .list-task-detail-cell { background: var(--bg-hover); }
.list-task-detail-row .list-task-detail-cell {
    padding: 0 12px 12px 44px;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}
.list-task-detail-inner { padding: 8px 0; }
.list-subtasks {
    list-style: none;
    margin: 0;
    padding: 0;
}
.list-subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.list-subtask-item.done { text-decoration: line-through; opacity: 0.8; }
.list-subtask-check {
    color: var(--primary);
    font-size: 0.85rem;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-todo { background: rgba(200,185,165,0.25); color: #7A5A44; border: 1px solid rgba(200,185,165,0.5); }
.status-progress { background: rgba(198,164,106,0.2); color: #7A4E10; border: 1px solid rgba(198,164,106,0.4); }
.status-review { background: rgba(138,106,69,0.18); color: #5A3A10; border: 1px solid rgba(138,106,69,0.35); }
.status-done { background: rgba(46,125,50,0.15); color: #2E6B26; border: 1px solid rgba(46,125,50,0.3); }

.assignee-avatars {
    display: flex;
    gap: 0;
}

.assignee-avatars .user-avatar-sm {
    margin-left: -6px;
    border: 2px solid var(--bg-card);
}

.assignee-avatars .user-avatar-sm:first-child { margin-left: 0; }

.text-muted { color: var(--text-secondary); opacity: 0.5; }

.empty-table {
    text-align: center;
    padding: 48px 16px !important;
    color: var(--text-secondary);
}

.overdue { color: var(--danger); font-weight: 600; }

/* ===== Buttons — Brass Metal & Leather ===== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

/* Primary — Brass Metal */
.btn-primary {
    background: linear-gradient(160deg, #D4AA70 0%, #C6A46A 40%, #A87830 100%);
    color: #3C2010;
    border: 1px solid rgba(200,155,60,0.5);
    box-shadow:
        0 1px 0 rgba(255,220,130,0.4) inset,
        0 -1px 0 rgba(0,0,0,0.3) inset,
        0 3px 10px rgba(0,0,0,0.25);
}
.btn-primary:hover {
    background: linear-gradient(160deg, #DDB878 0%, #D0AC72 40%, #B88438 100%);
    box-shadow:
        0 1px 0 rgba(255,220,130,0.4) inset,
        0 -1px 0 rgba(0,0,0,0.3) inset,
        0 5px 14px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

/* Secondary — Leather */
.btn-secondary {
    background: linear-gradient(160deg, #6B4D38 0%, #5A3F2C 100%);
    color: #D5B885;
    border: 1px solid rgba(139,90,60,0.5);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.btn-secondary:hover {
    background: linear-gradient(160deg, #7A5A42 0%, #6B4D38 100%);
    color: #E7D3A2;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.btn-danger { background: linear-gradient(160deg, #C0392B 0%, #A93226 100%); color: #FFF0EE; border: 1px solid rgba(180,50,40,0.5); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.btn-danger:hover { background: linear-gradient(160deg, #CC4136 0%, #B53228 100%); }

.btn-sm { padding: 5px 12px; font-size: 0.72rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.topbar .btn-icon {
    color: rgba(213,184,133,0.75);
}
.topbar .btn-icon:hover {
    color: #E7D3A2;
    background: rgba(255,200,100,0.1);
}

.topbar .btn-secondary {
    background: rgba(198,164,106,0.15);
    color: #D5B885;
    border-color: rgba(198,164,106,0.3);
}
.topbar .btn-secondary:hover {
    background: rgba(198,164,106,0.25);
    color: #E7D3A2;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background var(--transition);
    font-size: 1.3rem;
    line-height: 1;
}

.btn-icon:hover { background: rgba(0,0,0,0.05); }

/* ===== Modal ===== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20,10,5,0.6);
    backdrop-filter: blur(3px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

/* Окно задачи: лёгкий фон без размытия — видно что сзади */
.task-modal-overlay {
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: none;
    pointer-events: none;
}
.task-modal-overlay.open { align-items: flex-start; padding-top: 40px; }
.task-modal-overlay .task-modal-window {
    pointer-events: auto;
}

/* Окно задачи: перетаскивание за заголовок, изменение размера */
.task-modal-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    min-width: 260px;
    max-width: 95vw;
    height: auto;
    min-height: 220px;
    max-height: 90vh;
    resize: both;
    overflow: auto;
    margin: 0;
}
.task-modal-drag-handle {
    cursor: move;
    user-select: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.task-modal-drag-handle .btn-icon { cursor: pointer; }
.task-modal-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.task-modal-title-single { margin: 0; flex: 0 1 auto; }
.task-modal-title-hidden { display: none; }
.task-modal-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 100%;
    min-width: 0;
}
.task-tab {
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: var(--bg-input, #f1f5f9);
    color: var(--text-secondary, #475569);
    font-size: 13px;
    cursor: pointer;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-tab:hover { background: var(--bg-hover, #e2e8f0); color: var(--text, #0f172a); }
.task-tab.active { background: var(--primary); color: #fff; }
.task-tab-close {
    padding: 2px 6px;
    margin-left: -4px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.task-tab-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }
.task-modal-tabs .task-tab.active + .task-tab-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.modal {
    background-color: #F3F1EB;
    background-image: none;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 32px 64px rgba(30,15,5,0.5),
        0 0 0 1px rgba(200,190,170,0.6);
    animation: modalIn 0.2s ease-out;
    border-top: 4px solid #C6A46A;
}

.modal-lg { max-width: 600px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--modal-header-padding);
}

.modal-header h2 { font-size: 1.15rem; }

.modal form, .task-detail-body { padding: 28px 28px 0 28px; }
.modal form .modal-footer { margin-top: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--modal-footer-gap);
    padding: var(--modal-footer-padding);
    padding-top: 0;
}

.import-modal-body { padding: 0 24px 24px; }
.import-stats { font-weight: 600; margin-bottom: 12px; }
.import-hint { margin-bottom: 12px; color: var(--text-secondary); }
.import-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.import-warning { font-size: 0.85rem; color: var(--text-secondary); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ===== Support choice modal ===== */
.support-choice-hint { margin: 0 0 var(--form-group-spacing); font-size: 0.95rem; color: var(--text-secondary); }
.support-choice-buttons { display: flex; flex-direction: column; gap: var(--modal-footer-gap); }
.support-choice-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 12px 20px; }
.support-choice-btn-icon { font-size: 1.1rem; }

/* ===== Updates / Changelog Modal ===== */
.modal-updates { max-width: 560px; }
.modal-updates .modal-header { padding: var(--modal-header-padding); }
.modal-updates .modal-body { padding: var(--modal-body-padding); max-height: 70vh; overflow-y: auto; }
.modal-updates .updates-welcome-hint {
    margin: 0 28px var(--form-group-spacing) 28px;
    padding: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.updates-list { display: flex; flex-direction: column; gap: 24px; padding: 0; }
.updates-entry {
    padding: 16px 20px;
    border-radius: var(--radius);
    background: #F8F7F5;
    border: 1px solid #E0DDD8;
}
.updates-entry:last-child { margin-bottom: 0; }
.updates-entry-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.updates-version { font-weight: 700; color: #2c2c2c; font-size: 1rem; }
.updates-date { font-size: 0.85rem; color: #5c5c5c; }
.updates-changes { margin: 0; padding-left: 22px; font-size: 0.9rem; color: #1a1a1a; line-height: 1.55; }
.updates-changes li { margin-bottom: 6px; }
.updates-changes li:last-child { margin-bottom: 0; }
.modal-updates .updates-welcome-hint { color: #222; }
.modal-updates .updates-entry { color: #1a1a1a; }
.modal-updates .updates-entry .updates-version { color: #1a1a1a; }
.modal-updates .updates-entry .updates-date { color: #555; }
.modal-updates .updates-entry .updates-changes { color: #1a1a1a; }
.modal-updates .updates-entry .updates-changes li { color: #1a1a1a; }

/* ===== Report Modal ===== */

.modal-report { max-width: 480px; }
.modal-report .modal-header { border-bottom: 1px solid var(--border); padding: var(--modal-header-padding); }
.report-body { padding: var(--modal-body-padding); }

.report-summary {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.report-circle-wrap { flex-shrink: 0; }

.report-circle {
    --pct: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0% calc(var(--pct) * 1%), var(--border) calc(var(--pct) * 1%) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s ease;
}

.report-circle-value {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.report-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-stat {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.report-stat-num {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-right: 4px;
}

.report-section { margin-bottom: 22px; }
.report-section:last-child { margin-bottom: 0; }

.report-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.report-bars { display: flex; flex-direction: column; gap: 10px; }

.report-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 70px;
    align-items: center;
    gap: 12px;
}

.report-bar-label {
    font-size: 0.875rem;
    color: var(--text);
}

.report-bar-track {
    height: 20px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.report-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.report-bar-num {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

.report-bar-num small { font-weight: 500; opacity: 0.9; }

.report-stat-overdue.has-overdue .report-stat-num { color: var(--danger); }
.report-assignee-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    margin-right: 6px;
    vertical-align: middle;
}
.report-empty { font-size: 0.875rem; color: var(--text-secondary); margin: 0; }
.report-overdue-list { display: flex; flex-direction: column; gap: 6px; max-height: 140px; overflow-y: auto; }
.report-overdue-item {
    font-size: 0.875rem;
    padding: 8px 10px;
    background: rgba(239, 68, 68, 0.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.report-overdue-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-overdue-date { font-size: 0.75rem; color: var(--text-secondary); flex-shrink: 0; }

/* ===== Form ===== */

.form-group { margin-bottom: var(--form-group-spacing); }

.settings-tags-presets {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.settings-tag-preset {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.settings-tag-preset:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.settings-tags-list { margin-top: 0; }
.settings-tag-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.settings-tag-row:last-child { border-bottom: none; }
.settings-tag-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.settings-tag-name { flex: 1; font-size: 0.9rem; }
.settings-tag-row .btn { flex-shrink: 0; }

/* Form inputs — Paper style */
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7A5A44;
}

.form-group label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.form-group label.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D2CEC6;
    border-bottom: 2px solid #C4B8A8;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    background: #FFFFFF;
    color: #3C2B1E;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: 0 1px 4px rgba(30,15,5,0.06) inset;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #D2CEC6;
    border-bottom-color: #3B556D;
    box-shadow: 0 1px 4px rgba(30,15,5,0.06) inset, 0 2px 0 #3B556D;
}

.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

/* ===== Color Picker ===== */

/* Avatar photo upload */
.user-photo-upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-photo-preview {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.user-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-photo-upload-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition);
    border: 3px solid transparent;
}

.color-option:hover { transform: scale(1.1); }
.color-option.selected { border-color: var(--text); transform: scale(1.1); }

/* ===== Multi-Assignee Picker ===== */

.assignee-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.assignee-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 5px;
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.82rem;
    background: var(--bg-card);
    user-select: none;
}

.assignee-chip input[type="checkbox"] { display: none; }

.assignee-chip:hover { border-color: var(--primary); background: var(--primary-light); }

.assignee-chip.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.assignee-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    padding: 4px 0;
}

/* Task tags (метки) */
.task-tags-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
}

.task-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 500;
}

.task-tag-chip-remove {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.85;
    cursor: pointer;
    padding: 0 2px;
    font-size: 1rem;
    line-height: 1;
}

.task-tag-chip-remove:hover { opacity: 1; }

.task-tags-add {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.task-tag-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--bg-card);
    color: var(--text);
    min-width: 160px;
}

.task-new-tag-dialog {
    margin-top: 10px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.task-new-tag-dialog-inner label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    margin-top: 10px;
}
.task-new-tag-dialog-inner label:first-child { margin-top: 0; }
.task-new-tag-dialog-inner input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.task-new-tag-color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.task-new-tag-dialog-inner input[type="color"] {
    width: 36px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.task-new-tag-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.task-new-tag-dialog-btns {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Modal: Manage tags — отступы, чтобы не прижимало к краям */
.modal-manage-tags { max-width: 520px; }
.modal-manage-tags .modal-header { padding: var(--modal-header-padding); }
.modal-manage-tags-body {
    padding: var(--modal-body-padding);
    max-height: 70vh;
    overflow-y: auto;
}
.manage-tags-add {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.manage-tags-add input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.manage-tags-add input[type="color"] {
    width: 36px;
    height: 32px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.manage-tag-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
}
.manage-tag-presets .settings-tag-preset {
    width: 22px;
    height: 22px;
}
.manage-tags-list { margin-top: 0; }
.manage-tags-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.manage-tags-row:last-child { border-bottom: none; }
.manage-tags-row .settings-tag-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.manage-tags-row-name { flex: 1; font-size: 0.9rem; min-width: 0; }
.manage-tags-row .btn { flex-shrink: 0; }
.manage-tags-row-edit { flex-wrap: wrap; }
.manage-tags-row-edit .manage-tag-edit-name {
    flex: 1;
    min-width: 100px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.manage-tags-row-edit .manage-tag-edit-color {
    width: 32px;
    height: 28px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Modal: Manage expense categories */
.modal-manage-expense-categories { max-width: 480px; }
.modal-manage-expense-categories .modal-body {
    padding: var(--modal-body-padding);
    max-height: 70vh;
    overflow-y: auto;
}
.expense-categories-add {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.expense-categories-add input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}
.expense-categories-add input[type="color"] {
    width: 36px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.expense-category-presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}
.expense-category-presets .settings-tag-preset {
    width: 22px;
    height: 22px;
}
.expense-categories-row .settings-tag-swatch.expense-category-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}
.expense-categories-row-edit .expense-category-edit-color {
    width: 32px;
    height: 28px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.expense-category-edit-presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
}
.expense-category-edit-presets .settings-tag-preset {
    width: 18px;
    height: 18px;
}
.expense-categories-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.expense-categories-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.expense-categories-row:last-child { border-bottom: none; }
.expense-categories-row-name { flex: 1; min-width: 0; white-space: normal; overflow: visible; word-break: break-word; }
.expense-categories-row .btn { flex-shrink: 0; }
.expense-categories-row-edit { flex-wrap: wrap; gap: 8px; }
.expense-categories-row-edit .expense-category-edit-name {
    flex: 1;
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}

/* Modal: Записная книжка с вкладками */
.notebook-modal .notebook-body {
    padding: 0 24px 24px;
}
.notebook-tabs-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
    min-height: 40px;
}
.notebook-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.notebook-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 6px 8px 14px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--paper-dark);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    margin-bottom: -1px;
    max-width: 160px;
    min-width: 0;
}
.notebook-tab:hover {
    background: var(--paper-line);
    color: var(--text);
}
.notebook-tab.active {
    background: var(--bg-card);
    color: var(--text);
    font-weight: 500;
    border-color: var(--border);
    padding-bottom: 9px;
}
.notebook-tab-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.notebook-tab-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}
.notebook-tab-close:hover {
    color: var(--danger);
    background: rgba(192, 57, 43, 0.1);
}
.notebook-tab-add {
    flex-shrink: 0;
    margin-bottom: 8px;
}
.notebook-content-wrap {
    margin-top: 12px;
}
.notebook-footer {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.task-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.task-card-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
}

.list-task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.list-task-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
}

/* ===== Sub-task ===== */

.subtask-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.subtask-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid #D2CEC6;
    font-size: 0.85rem;
}

.subtask-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.subtask-item .subtask-text-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; }
.subtask-item .subtask-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-item .subtask-text.done { text-decoration: line-through; opacity: 0.5; }
.subtask-item .subtask-edit-input { flex: 1; min-width: 0; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-family: inherit; }
.subtask-item .subtask-edit-input:focus { outline: none; border-color: var(--primary); }
.subtask-item .btn-edit-subtask { flex-shrink: 0; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; font-size: 0.9rem; opacity: 0.6; transition: opacity var(--transition); }
.subtask-item .btn-edit-subtask:hover { opacity: 1; color: var(--primary); }

.subtask-assignee-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.subtask-assignee-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.subtask-assignee-picker .assignee-chip-sm {
    padding: 2px 6px;
    font-size: 0.75rem;
}

.subtask-assignee-picker .assignee-chip-sm .user-avatar-xs {
    width: 16px;
    height: 16px;
    font-size: 0.5rem;
}

.subtask-assignee-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-avatar-xs {
    width: 20px;
    height: 20px;
    font-size: 0.55rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.subtask-assignee-select {
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    max-width: 110px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 16px;
}

.subtask-assignee-select:focus {
    outline: none;
    border-color: var(--primary);
}

.subtask-item .btn-remove-subtask {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
    font-size: 1rem;
    flex-shrink: 0;
}

.subtask-item:hover .btn-remove-subtask { opacity: 0.7; }
.subtask-item .btn-remove-subtask:hover { opacity: 1; }

.subtask-desc-wrap {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 8px;
    margin-left: 0;
    padding-top: 8px;
    border-top: 1px solid #D2CEC6;
}
.subtask-desc-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.subtask-description {
    width: 100%;
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid #D2CEC6;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
    background: #FFFFFF;
    color: #1a1a1a;
}
.subtask-description:focus { outline: none; border-color: var(--primary); }

.subtask-add { display: flex; gap: 8px; }

.subtask-add input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
}

.subtask-add input:focus { outline: none; border-color: var(--primary); }

/* ===== Вложения к задаче ===== */

.task-attachments-block {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 4px;
}

.task-attachments-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.task-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.task-attachment-link {
    flex: 1;
    min-width: 0;
    color: var(--primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-attachment-link:hover {
    text-decoration: underline;
}

.task-attachment-meta {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.task-attachment-delete {
    flex-shrink: 0;
    padding: 2px 6px;
    font-size: 1rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

.task-attachment-delete:hover {
    color: var(--danger);
    background: var(--bg);
}

.task-attachments-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.task-attachments-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Комментарии к задаче ===== */

.task-comments-block {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 4px;
}

.task-comments-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-comments-empty {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 8px 0;
}

.task-comment-item {
    background: #FFFFFF;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid #D2CEC6;
}

.task-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.task-comment-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.task-comment-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.task-comment-body {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.45;
    white-space: pre-wrap;
}

/* ===== История изменений задачи ===== */

.task-history-block {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 4px;
}

.task-history-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-history-empty {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 8px 0;
}

.task-history-item {
    background: #FFFFFF;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    border: 1px solid #D2CEC6;
}

.task-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.task-history-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.task-history-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.task-history-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.task-comment-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-comment-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #D2CEC6;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 52px;
    background: #FFFFFF;
    color: #1a1a1a;
}

.task-comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.task-comment-form .btn {
    align-self: flex-end;
}

/* ===== Context Menu ===== */

.context-menu {
    display: none;
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 160px;
    padding: 4px;
    animation: modalIn 0.15s ease;
}

.context-menu.open { display: block; }

.context-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    border-radius: 4px;
    color: var(--text);
}

.context-menu button:hover { background: var(--bg); }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger:hover { background: #fef2f2; }

/* ===== Scrollbar ===== */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ===== Login Page ===== */

.login-body {
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    background: var(--bg-sidebar);
    background: linear-gradient(160deg, #0B1220 0%, #1e293b 45%, #0f172a 100%);
}

/* Анимация на тёмно-синем фоне, вне белой карточки */
.login-bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.login-bg-rays {
    position: absolute;
    inset: -50%;
    /* Премиальный тёмно-синий фон с эффектом тиснёной кожи / блокнота */
    background:
        radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
        radial-gradient(circle at 85% 100%, rgba(56, 189, 248, 0.14), transparent 55%),
        radial-gradient(circle at 50% 50%, #020617, #020617 40%, #020617 100%),
        repeating-linear-gradient(
            135deg,
            rgba(15, 23, 42, 0.9) 0,
            rgba(15, 23, 42, 0.9) 1px,
            rgba(15, 23, 42, 1) 3px,
            rgba(15, 23, 42, 1) 4px
        ),
        repeating-linear-gradient(
            45deg,
            rgba(15, 23, 42, 0.8) 0,
            rgba(15, 23, 42, 0.8) 1px,
            rgba(15, 23, 42, 0.95) 3px,
            rgba(15, 23, 42, 0.95) 4px
        );
    background-blend-mode: soft-light, soft-light, normal, overlay, multiply;
}

.login-bg-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 80vmin;
    height: 80vmin;
    margin-left: -40vmin;
    margin-top: -40vmin;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59, 62, 230, 0.15) 0%, rgba(6, 182, 212, 0.08) 35%, transparent 60%);
}

.syntra-core {
    animation: corePulse 2s ease-in-out infinite;
}

@keyframes corePulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.85;
    }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

.login-card {
    /* Кожаная обложка: тёплый тёмно-коричневый с текстурой */
    border-radius: 16px;
    padding: 36px 32px 32px;
    background-color: #2c1e0f;
    background-image:
        repeating-linear-gradient(
            17deg,
            transparent 0,
            transparent 3px,
            rgba(255,255,255,0.018) 3px,
            rgba(255,255,255,0.018) 6px
        ),
        repeating-linear-gradient(
            107deg,
            transparent 0,
            transparent 4px,
            rgba(0,0,0,0.08) 4px,
            rgba(0,0,0,0.08) 8px
        ),
        radial-gradient(ellipse at 30% 20%, rgba(90, 50, 10, 0.55), transparent 60%),
        radial-gradient(ellipse at 75% 80%, rgba(180, 100, 20, 0.18), transparent 55%),
        radial-gradient(ellipse at 60% 45%, rgba(120, 65, 10, 0.25), transparent 70%),
        linear-gradient(160deg, #3a2209 0%, #2c1a08 40%, #1e1005 100%);
    box-shadow:
        0 2px 0 rgba(255,200,120,0.10) inset,
        0 -2px 0 rgba(0,0,0,0.4) inset,
        4px 0 0 rgba(0,0,0,0.2) inset,
        -4px 0 0 rgba(255,180,80,0.06) inset,
        0 32px 64px rgba(0,0,0,0.55),
        0 4px 16px rgba(0,0,0,0.35);
    border: 1px solid rgba(200, 140, 60, 0.18);
    position: relative;
}

/* Складка — светлая полоса слева */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(255,190,90,0.12) 0%, rgba(255,190,90,0.22) 40%, rgba(255,190,90,0.06) 100%);
    border-radius: 2px;
    pointer-events: none;
}

.login-logo {
    text-align: center;
    margin-bottom: 22px;
    background: transparent;
}

/* Область логотипа: без круга, просто выравнивание */
.login-emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    position: relative;
    filter: none;
}

.login-emblem::after {
    content: none;
}

.login-logo-icon {
    display: block;
    margin: 0 auto;
    object-fit: contain;
    width: 180px;
    height: 180px;
    background: transparent;
    filter:
        grayscale(1)
        brightness(1.8)
        contrast(0.85)
        drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.login-title {
    font-family: 'Caveat', cursive;
    font-weight: 600;
    font-size: 2.85rem;
    margin: 12px 0 2px;
    letter-spacing: 0.06em;
    /* Серебряный металлик */
    background: linear-gradient(160deg, #e8e8f0 0%, #b0b0c8 30%, #d8d8e8 55%, #8a8aaa 80%, #c8c8dc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.login-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.18em;
    margin: 0;
    /* Серебристый, чуть тусклее заголовка */
    background: linear-gradient(135deg, #c0c0d8 0%, #8888a8 50%, #b8b8cc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
}

/* Описание как пластина/табличка с тиснением */
.login-description {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(90,50,10,0.4), transparent 60%),
        linear-gradient(160deg, #231608 0%, #1e1106 100%);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 24px;
    border: 1px solid rgba(200,140,60,0.20);
    box-shadow:
        0 1px 0 rgba(255,190,80,0.10) inset,
        0 -1px 0 rgba(0,0,0,0.4) inset,
        0 4px 12px rgba(0,0,0,0.3);
    position: relative;
}

.login-description::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 5px;
    border: 1px solid rgba(200,150,60,0.12);
    pointer-events: none;
}

.login-description-lead {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.95rem;
    font-style: italic;
    color: rgba(210, 175, 120, 0.9);
    margin: 0 0 10px;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.login-description-list {
    margin: 0;
    padding-left: 16px;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.9rem;
    color: rgba(180, 145, 90, 0.8);
    line-height: 1.7;
    letter-spacing: 0.02em;
}

.login-description-list li {
    margin-bottom: 1px;
}

.login-form .form-group:first-of-type {
    margin-top: 0;
}

/* Поля ввода под кожаный стиль */
.login-body .form-group label {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(190, 145, 80, 0.75);
}

.login-body .form-group input {
    background: rgba(255, 255, 255, 0.045) !important;
    border: 1px solid rgba(200, 145, 60, 0.25) !important;
    border-bottom: 1px solid rgba(200, 145, 60, 0.45) !important;
    color: rgba(230, 200, 150, 0.95) !important;
    box-shadow:
        0 2px 6px rgba(0,0,0,0.35) inset,
        0 1px 0 rgba(255,200,100,0.10) !important;
    border-radius: 6px !important;
}

.login-body .form-group input::placeholder {
    color: rgba(180, 140, 80, 0.4);
}

.login-body .form-group input:focus {
    border-color: rgba(220, 165, 80, 0.55) !important;
    box-shadow:
        0 2px 6px rgba(0,0,0,0.35) inset,
        0 0 0 2px rgba(200, 145, 60, 0.18) !important;
    background: rgba(255,255,255,0.07) !important;
    outline: none;
}

/* Кнопка «Войти» в золотом металлике */
.login-body .btn-primary {
    background: linear-gradient(160deg, #a87830 0%, #c8962e 35%, #b07828 65%, #8a5e1e 100%) !important;
    border: 1px solid rgba(200,155,60,0.5) !important;
    color: #f5e8c8 !important;
    font-family: 'Cormorant Garamond', Georgia, serif !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    box-shadow:
        0 1px 0 rgba(255,220,130,0.3) inset,
        0 -1px 0 rgba(0,0,0,0.4) inset,
        0 6px 18px rgba(0,0,0,0.4) !important;
    transition: filter 0.2s, box-shadow 0.2s !important;
}

.login-body .btn-primary:hover {
    filter: brightness(1.12) !important;
    box-shadow:
        0 1px 0 rgba(255,220,130,0.3) inset,
        0 -1px 0 rgba(0,0,0,0.4) inset,
        0 8px 24px rgba(0,0,0,0.5) !important;
}

.login-error {
    color: #e8a070;
    font-size: 0.85rem;
    min-height: 20px;
    margin-bottom: 8px;
    text-align: center;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.login-forgot {
    margin-top: 14px;
    text-align: center;
    font-size: 0.9rem;
}

.login-forgot a {
    color: rgba(190, 150, 80, 0.8);
    text-decoration: none;
    font-family: 'Cormorant Garamond', Georgia, serif;
    letter-spacing: 0.05em;
}

.login-forgot a:hover {
    color: rgba(220, 180, 100, 1);
    text-decoration: none;
}

.forgot-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-align: center;
}

/* ===== Logout button in sidebar ===== */

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 8px 8px 0;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
    color: var(--text-sidebar);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-logout:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* ===== Account list ===== */

.account-list {
    list-style: none;
    padding: 0 8px;
    margin: 0;
}

.account-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}

.account-list li:hover {
    background: rgba(255,255,255,0.08);
}

.account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

/* ===== Current user info ===== */

.sidebar-user-info {
    padding: 6px 12px;
    margin-bottom: 4px;
}

.current-user-name {
    display: block;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.current-user-role {
    display: block;
    color: var(--text-sidebar);
    font-size: 0.72rem;
    opacity: 0.7;
}

/* ===== Form hint ===== */

.form-hint {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.form-hint-inline { margin-bottom: 10px; }

.form-hint .btn-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}
.form-hint .btn-link:hover { opacity: 0.85; }

/* Блок описания задачи — светлый фон, текст хорошо читается */
.task-description-block {
    padding: 10px 12px;
    background: #F3F1EB;
    border-radius: var(--radius-sm);
    border: 1px solid #D2CEC6;
}
.task-description-block label {
    font-weight: 600;
    color: #3C2B1E;
}
.task-description-block .form-hint {
    color: #5A4A3A;
}
.task-description-block textarea {
    background: #fff;
    color: #1a1a1a;
    border-color: #D2CEC6;
}

/* ===== Sidebar overlay (mobile) ===== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    transition: opacity 0.2s ease;
    pointer-events: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .sidebar-overlay.visible {
        display: block;
        pointer-events: auto;
    }
    .sidebar-close-mobile { display: flex; align-items: center; justify-content: center; }
}

/* ===== Responsive (mobile) ===== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(280px, 85vw);
        min-width: min(280px, 85vw);
        max-width: min(280px, 85vw);
        height: 100vh;
        height: 100dvh;
        max-height: -webkit-fill-available;
        z-index: 50;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
        display: grid;
        grid-template-rows: auto 1fr auto;
        grid-template-areas: "header" "body" "bottom";
        overflow: hidden;
    }

    .sidebar .sidebar-header {
        grid-area: header;
        flex-shrink: 0;
    }

    .sidebar .sidebar-body {
        grid-area: body;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar .sidebar-bottom {
        grid-area: bottom;
        flex-shrink: 0;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        overflow: visible;
    }

    /* Блок с именем пользователя не должен отнимать весь экран — кнопка «Меню» должна оставаться видимой */
    .sidebar .sidebar-user-info {
        max-height: 20vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.collapsed { margin-left: min(-280px, -85vw); }
    .sidebar-toggle { display: flex !important; min-width: 44px; min-height: 44px; }

    .topbar {
        padding: 12px 16px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .topbar-title {
        font-size: 1.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    .topbar-actions {
        gap: 8px;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .topbar-actions .topbar-btn-label {
        display: none;
    }

    .topbar-actions .btn,
    .topbar-actions .btn-icon {
        min-height: 44px;
        min-width: 44px;
        padding: 8px;
    }

    .topbar-actions .btn svg:first-child { margin-right: 0; }

    .task-filters-bar {
        padding: 12px 16px 14px;
    }

    .task-filters-row {
        gap: 8px;
    }

    .task-search-input {
        min-width: 0;
        max-width: none;
    }

    .task-filter-select {
        min-width: 0;
    }

    .kanban-board {
        padding: 12px 16px;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .kanban-column {
        min-width: 260px;
        max-width: none;
    }

    .task-card {
        padding: 12px 14px;
    }

    .task-card-title { font-size: 0.85rem; }

    .dashboard-screen {
        padding: 16px;
    }

    .dashboard-header {
        margin-left: -16px;
        margin-right: -16px;
        padding: 14px 16px;
    }

    .dashboard-projects {
        grid-template-columns: 1fr;
    }

    .expenses-screen {
        padding: 16px;
    }

    .expenses-header {
        flex-direction: column;
        align-items: stretch;
        margin-left: -16px;
        margin-right: -16px;
        padding: 14px 16px;
    }

    .expenses-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .expenses-project-select,
    .expenses-period-select {
        width: 100%;
        min-width: 0;
    }

    .expenses-date-range {
        flex-wrap: wrap;
    }

    .expenses-date-input {
        flex: 1;
        min-width: 120px;
    }

    .expenses-view-toggle .btn-view-expense {
        min-height: 44px;
        flex: 1;
    }

    .expenses-analytics-panels {
        grid-template-columns: 1fr;
    }

    #expensesAddBtn {
        min-height: 44px;
    }

    .notebook-modal .notebook-body {
        padding: 0 16px 24px;
    }
    .notebook-tab,
    .notebook-tab-add {
        min-height: 44px;
    }

    .expense-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .expense-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .btn-edit-expense,
    .btn-delete-expense {
        min-height: 44px;
    }

    /* Горящие сроки: на мобильных — колонка, текст не обрезается по символам */
    .dashboard-hot-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 12px 14px;
    }

    .dashboard-hot-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: normal;
        line-height: 1.35;
    }

    .dashboard-hot-project {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: break-word;
        word-wrap: break-word;
        font-size: 0.8rem;
        opacity: 0.95;
    }

    .dashboard-hot-date {
        font-size: 0.8rem;
    }

    .dashboard-card-name {
        white-space: normal;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .calendar-view {
        padding: 12px 16px;
        min-height: 0;
    }

    .calendar-scroll-wrap {
        min-height: 200px;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-toolbar {
        gap: 10px;
        margin-bottom: 12px;
        flex-wrap: wrap;
    }

    .calendar-range-toggle .btn {
        min-height: 44px;
    }

    .calendar-grid.calendar-month {
        min-height: 420px;
    }

    .calendar-day-cell {
        min-height: 56px;
        padding: 4px;
    }

    .calendar-weekday {
        font-size: 0.65rem;
        padding: 4px;
    }

    .calendar-grid.calendar-week {
        min-width: min(700px, 95vw);
        min-height: 280px;
    }

    .calendar-grid.calendar-day {
        min-height: 160px;
        padding: 12px;
    }

    .calendar-day-single-header {
        font-size: 1rem;
    }

    .calendar-day-hour-row {
        grid-template-columns: 58px 1fr;
        min-height: 44px;
        padding: 6px 0;
    }

    .calendar-day-hour-label {
        font-size: 0.8rem;
    }

    .calendar-day-hour-slots {
        min-height: 44px;
        padding: 8px;
    }

    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal {
        max-height: 95vh;
        margin: auto 0;
    }

    .modal-lg {
        max-width: 100%;
    }

    .modal-header {
        padding: 18px 20px 14px;
    }

    .modal-header h2 {
        font-size: 1.05rem;
    }

    .modal form,
    .task-detail-body {
        padding: 24px 20px 0 20px;
    }
    .modal form .modal-footer {
        padding: 22px 20px 26px;
    }
    .form-group {
        margin-bottom: 26px;
    }
    .modal .modal-body {
        padding: 24px 20px 24px;
    }
    .modal-manage-tags-body,
    .modal-manage-expense-categories .modal-body,
    .modal-updates .modal-body {
        padding: 24px 20px 24px;
    }
    .modal-updates .updates-welcome-hint {
        margin: 0 20px var(--form-group-spacing) 20px;
    }
    .modal-updates .updates-entry {
        background: #FAF9F7;
        border-color: #E5E3DF;
    }

    .modal-manage-tags .modal-header {
        padding: 18px 20px 14px;
    }
    .manage-tags-add {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .manage-tags-add input[type="text"] {
        min-width: 0;
    }
    .manage-tag-presets {
        width: 100%;
    }
    .manage-tags-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    .manage-tags-row .btn {
        min-height: 44px;
    }

    .expense-categories-add {
        flex-direction: column;
        align-items: stretch;
    }
    .expense-categories-add input[type="text"] {
        min-width: 0;
    }
    .expense-categories-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    .expense-categories-row .btn {
        min-height: 44px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* prevents zoom on focus on iOS */
    }

    .list-view {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .task-table {
        font-size: 0.82rem;
    }

    .task-table th,
    .task-table td {
        padding: 10px 12px;
    }

    .col-title { min-width: 160px; }
    .col-status { width: 100px; }
    .col-priority { width: 80px; }
    .col-date { width: 90px; }

    .report-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .report-bar-row {
        grid-template-columns: 90px 1fr 50px;
        gap: 8px;
    }

    .data-actions .btn-sidebar {
        min-height: 44px;
    }

    .btn-sidebar-menu {
        min-height: 44px;
    }

    .btn-logout {
        min-height: 44px;
    }

    .sidebar-section-collapsible .sidebar-section-toggle {
        min-height: 44px;
        padding: 8px 0;
    }

    .project-list li,
    .user-list li {
        min-height: 44px;
        padding: 12px;
    }

    .welcome-content {
        padding: 24px 20px;
    }

    .welcome-content h2 {
        font-size: 1.3rem;
    }

    /* Safe area for notched devices */
    .topbar { padding-left: max(16px, env(safe-area-inset-left)); }
    .sidebar-bottom,
    .btn-logout { margin-bottom: env(safe-area-inset-bottom, 0); }
}

@media (max-width: 480px) {
    .sidebar {
        width: min(280px, 88vw);
        min-width: min(280px, 88vw);
        max-width: min(280px, 88vw);
    }

    .sidebar .sidebar-user-info {
        max-height: 16vh;
    }

    .sidebar .sidebar-header {
        padding-left: max(8px, env(safe-area-inset-left, 8px));
    }

    .sidebar .sidebar-header .logo-icon {
        width: 72px;
        height: 72px;
    }

    .sidebar .sidebar-header .logo-text {
        font-size: 1.1rem;
    }

    .btn-sidebar-nav {
        min-height: 44px;
    }

    .sidebar.collapsed {
        margin-left: min(-280px, -88vw);
    }

    .topbar {
        padding: 10px 12px;
        gap: 10px;
    }

    .topbar-title {
        font-size: 1rem;
    }

    .task-filters-bar {
        padding: 10px 12px 12px;
    }

    .kanban-board {
        padding: 10px 12px;
    }

    .kanban-column {
        min-width: 240px;
    }

    .task-card {
        padding: 10px 12px;
    }

    .task-card-assignees .user-avatar-sm {
        width: 28px;
        height: 28px;
        font-size: 0.68rem;
        margin-left: -6px;
    }

    .dashboard-screen {
        padding: 12px;
    }

    .dashboard-header {
        margin-left: -12px;
        margin-right: -12px;
        padding: 12px;
        margin-bottom: 16px;
    }

    .expenses-screen {
        padding: 12px;
    }

    .expenses-header {
        margin-left: -12px;
        margin-right: -12px;
        padding: 12px;
        margin-bottom: 16px;
    }

    .modal-header {
        padding: 16px 16px 12px;
    }

    .modal form,
    .task-detail-body {
        padding: 22px 16px 0 16px;
    }

    .modal form .modal-footer {
        padding: 20px 16px 24px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    .modal .modal-body,
    .modal-manage-tags-body,
    .modal-manage-expense-categories .modal-body,
    .modal-updates .modal-body {
        padding: 22px 16px 22px;
    }

    .notebook-modal .notebook-body {
        padding: 0 12px 20px;
    }
    .notebook-tab-close {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .modal-updates .updates-welcome-hint {
        margin: 0 16px var(--form-group-spacing) 16px;
    }
    .modal-updates .updates-entry {
        background: #FDFCFA;
        border-color: #EAE8E5;
    }

    .sidebar-menu-dropdown-item {
        padding: 12px 12px;
        min-height: 44px;
    }

    .assignee-avatars .user-avatar-sm {
        width: 28px;
        height: 28px;
        font-size: 0.68rem;
        margin-left: -6px;
    }

    .view-toggle .btn-view {
        width: 40px;
        height: 36px;
        min-height: 44px;
    }

    #addTaskBtn {
        min-height: 44px;
        padding: 10px 16px;
    }

    .audit-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .audit-filters input[type="date"],
    .audit-filters select {
        width: 100%;
    }
}

/* Archive folder list: drag and drop */
.archive-folder-drag-handle:active { cursor: grabbing; }
.archive-folder-li.archive-folder-drag-over {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    outline: 2px dashed var(--primary);
    outline-offset: 2px;
}
.archive-folder-li.archive-folder-dragging {
    opacity: 0.6;
}

/* Подсветка поисковой фразы в материале хранилища */
.archive-search-highlight {
    background: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

/* Панель свёрнутых задач (несколько редакторов) */
.minimized-tasks-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    padding: 8px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.minimized-tasks-bar.has-items {
    display: flex;
}
.minimized-task-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-sidebar);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    max-width: 320px;
}
.minimized-task-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.minimized-task-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
