/* ============================================
   МЕЧТЫ — Архитектурный минимализм
   Светлая тема, швейцарская типографика
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;450;500;600&display=swap');

:root {
    --bg-body: #fafaf8;
    --bg-surface: #ffffff;
    --bg-hover: #f5f5f2;
    --bg-input: #f5f5f2;

    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-tertiary: #a3a3a0;

    --accent: #1a1a1a;
    --accent-hover: #4a4a4a;

    --red: #d94a4a;
    --red-bg: #fef5f5;
    --green: #3d8c5e;
    --green-bg: #f4faf6;
    --orange: #c47a2a;
    --orange-bg: #fdf8f3;
    --blue: #4a6fa5;
    --blue-bg: #f5f7fa;

    --border: 1px solid #e8e8e4;
    --border-hover: 1px solid #d4d4d0;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --navbar-height: 56px;
    --container-padding: 32px;

    --transition-fast: 120ms ease;
    --transition-normal: 200ms ease;
}

/* ============================================
   СБРОС
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    font-size: 16px;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.875rem;
    line-height: 1.6;
    min-height: 100vh;
    padding-top: var(--navbar-height);
    font-weight: 400;
    letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition-fast); }
a:hover { opacity: 0.7; }
img { max-width: 100%; height: auto; display: block; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d0; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #b0b0aa; }

/* ============================================
   НАВБАР
   ============================================ */

.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--navbar-height);
    background: rgba(250, 250, 248, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: var(--border);
    display: flex; align-items: center;
}

.navbar .container {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1400px; width: 100%; margin: 0 auto;
    padding: 0 var(--container-padding); gap: 16px;
}

.navbar-brand {
    font-size: 0.9375rem; font-weight: 500;
    color: var(--text-primary); letter-spacing: -0.02em;
    white-space: nowrap; flex-shrink: 0;
}

.nav-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }

/* ============================================
   КНОПКИ
   ============================================ */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 7px 14px;
    font-family: var(--font); font-size: 0.8125rem; font-weight: 450;
    border-radius: var(--radius-sm); border: var(--border);
    cursor: pointer; transition: all var(--transition-fast);
    white-space: nowrap; text-decoration: none;
    background: var(--bg-surface); color: var(--text-primary);
    letter-spacing: -0.01em;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-hover); opacity: 1; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-danger { background: transparent; border-color: transparent; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

/* ============================================
   КОНТЕЙНЕР
   ============================================ */

.container { max-width: 1400px; margin: 0 auto; padding: 0 var(--container-padding); }

/* ============================================
   ПРИВЕТСТВИЕ
   ============================================ */

.hero { padding: 40px 0 28px; }
.hero-greeting {
    font-size: 1.75rem; font-weight: 450; color: var(--text-primary);
    letter-spacing: -0.03em; margin-bottom: 4px; line-height: 1.2;
}
.hero-date { color: var(--text-tertiary); font-size: 0.8125rem; font-weight: 400; }

/* ============================================
   СТАТИСТИКА
   ============================================ */

.stats-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1px; background: var(--border);
    border: var(--border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 32px;
}

.stat-card { background: var(--bg-surface); padding: 20px 24px; text-align: left; }
.stat-value {
    font-size: 1.5rem; font-weight: 500; color: var(--text-primary);
    letter-spacing: -0.02em; margin-bottom: 2px;
}
.stat-label {
    font-size: 0.75rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 450;
}
.stat-card.critical .stat-value { color: var(--red); }
.stat-card.in-progress .stat-value { color: var(--orange); }
.stat-card.completed .stat-value { color: var(--green); }

.stats-collapsed { margin-bottom: 20px; }
.stats-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.8125rem; font-weight: 450; color: var(--text-secondary);
    cursor: pointer; background: none; border: var(--border);
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-family: var(--font); transition: all var(--transition-fast);
}
.stats-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.stats-toggle .arrow { transition: transform var(--transition-fast); display: inline-block; font-size: 0.625rem; }
.stats-toggle.open .arrow { transform: rotate(180deg); }
.stats-expanded { display: none; margin-top: 12px; }
.stats-expanded.show { display: block; }

/* ============================================
   ФИЛЬТРЫ
   ============================================ */

.filters-row {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.category-filters { display: flex; gap: 2px; flex-wrap: wrap; }

.category-chip {
    padding: 5px 12px; border-radius: var(--radius-sm);
    font-size: 0.75rem; font-weight: 450;
    background: transparent; border: 1px solid transparent;
    color: var(--text-secondary); cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap; text-decoration: none;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.category-chip:hover { color: var(--text-primary); background: var(--bg-hover); }
.category-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.filter-selects { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.filter-select {
    background: var(--bg-surface); color: var(--text-primary);
    border: var(--border); padding: 5px 24px 5px 10px;
    border-radius: var(--radius-sm); font-size: 0.75rem;
    font-family: var(--font); appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%236b6b6b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    cursor: pointer; outline: none;
    text-transform: uppercase; letter-spacing: 0.03em; font-weight: 450;
}
.filter-select:focus { border-color: var(--accent); }

.view-toggle {
    display: flex; gap: 1px; background: var(--bg-hover);
    border-radius: var(--radius-sm); padding: 2px; border: var(--border);
}
.view-toggle-btn {
    padding: 5px 10px; border-radius: 3px; border: none;
    background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 0.75rem; font-family: var(--font);
    transition: all var(--transition-fast);
}
.view-toggle-btn.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.view-toggle-btn:hover:not(.active) { color: var(--text-primary); }

/* ============================================
   СЕТКА ЦЕЛЕЙ
   ============================================ */

.dreams-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border);
    border: var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 40px;
}

@media (max-width: 1200px) { .dreams-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .dreams-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .dreams-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .dreams-grid { grid-template-columns: 1fr; } }

/* ============================================
   КАРТОЧКА ЦЕЛИ (ПЛИТКА)
   ============================================ */

.dream-card {
    position: relative; background: var(--bg-surface);
    cursor: pointer; transition: background var(--transition-fast);
    text-decoration: none; color: inherit;
    display: flex; flex-direction: column;
}
.dream-card:hover { background: var(--bg-hover); }

.dream-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; z-index: 2;
}
.dream-card.priority-critical::before { background: var(--red); }
.dream-card.priority-high::before { background: var(--orange); }
.dream-card.priority-medium::before { background: var(--blue); }
.dream-card.priority-low::before { background: var(--text-tertiary); }

/* Изображение */
.dream-card-image {
    position: relative; width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden; background: var(--bg-hover);
}
.dream-card-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease;
}
.dream-card:hover .dream-card-image img { transform: scale(1.02); }

/* Эмодзи вместо картинки */
.card-emoji {
    display: flex; align-items: center; justify-content: center;
    height: 100%; font-size: 2rem; background: var(--bg-hover);
    user-select: none;
}

/* ============================================
   КНОПКИ В КАРТОЧКЕ (плитка)
   ============================================ */

.dream-card .card-top-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    display: flex;
    gap: 3px;
}

.card-icon-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #e8e8e4;
    background: #ffffff;
    color: #6b6b6b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 120ms ease;
    line-height: 1;
    font-family: var(--font);
}

.card-icon-btn:hover {
    background: #f5f5f2;
    color: #1a1a1a;
}

.card-icon-btn.complete-icon:hover {
    background: #f4faf6;
    color: #3d8c5e;
    border-color: #3d8c5e;
}

/* Меню три точки */
.dots-menu { position: relative; }

.dots-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 28px;
    background: #ffffff;
    border: 1px solid #e8e8e4;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    min-width: 170px;
    z-index: 20;
    padding: 4px;
}

.dots-dropdown.show { display: block; }

.dots-dropdown button,
.dots-dropdown .dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 13px;
    border: none;
    background: none;
    color: #1a1a1a;
    cursor: pointer;
    border-radius: 3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: background 120ms ease;
}

.dots-dropdown button:hover,
.dots-dropdown .dropdown-item:hover { background: #f5f5f2; }

.dots-dropdown .dropdown-item.danger { color: #d94a4a; }
.dots-dropdown .dropdown-item.danger:hover { background: #fef5f5; }

/* Тело карточки (плитка) */
.dream-card-body {
    padding: 10px 12px; flex: 1;
    display: flex; flex-direction: column;
}

/* Обёртка для информации */
.dream-card-info {
    flex: 1;
    min-width: 0;
}

/* Дата создания */
.dream-card-date {
    font-size: 0.625rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 4px;
}

/* Название */
.dream-card-title {
    font-size: 0.8125rem; font-weight: 500;
    color: var(--text-primary); letter-spacing: -0.02em;
    line-height: 1.3; margin-bottom: 3px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

/* Статус под названием */
.dream-card-status-text {
    font-size: 0.6875rem; color: var(--text-secondary);
    margin-bottom: 6px; font-weight: 450;
}

/* Правая часть — цена и кнопки */
.dream-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dream-card-cost {
    font-size: 0.75rem; font-weight: 500;
    color: var(--text-primary); letter-spacing: -0.01em;
}

/* Линия срока */
.deadline-bar-wrap { padding: 6px 12px 8px; border-top: var(--border); }
.deadline-bar-info {
    display: flex; justify-content: space-between;
    font-size: 0.625rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
.deadline-bar { height: 3px; background: #e8e8e4; border-radius: 1.5px; overflow: hidden; }
.deadline-fill { height: 100%; background: var(--green); border-radius: 1.5px; transition: width 0.4s ease; }
.deadline-fill.urgent { background: var(--orange); }
.deadline-fill.overdue { background: var(--red); }

/* Drag handle */
.drag-handle {
    position: absolute; top: 6px; left: 6px; z-index: 5;
    cursor: grab; opacity: 0; font-size: 0.75rem;
    color: var(--text-tertiary); transition: opacity var(--transition-fast);
    user-select: none; background: var(--bg-surface);
    width: 20px; height: 20px; display: flex;
    align-items: center; justify-content: center;
    border-radius: 3px; border: var(--border);
}
.dream-card:hover .drag-handle { opacity: 1; }

/* ============================================
   РЕЖИМ СПИСКА
   ============================================ */

.dreams-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1px;
    background: var(--border);
    border: var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dreams-grid.list-view .dream-card {
    flex-direction: row;
    align-items: stretch;
    background: var(--bg-surface);
    border-bottom: var(--border);
    gap: 0;
}
.dreams-grid.list-view .dream-card:last-child { border-bottom: none; }

/* Фото в списке */
.dreams-grid.list-view .dream-card-image {
    display: flex;
    width: 60px;
    min-width: 60px;
    height: 60px;
    aspect-ratio: auto;
    border-radius: 4px;
    margin: 10px 12px;
    overflow: hidden;
    background: var(--bg-hover);
}
.dreams-grid.list-view .dream-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dreams-grid.list-view .card-emoji {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Тело карточки в списке */
.dreams-grid.list-view .dream-card-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 12px 10px 0;
    min-width: 0;
}

.dreams-grid.list-view .dream-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dreams-grid.list-view .dream-card-date {
    display: block;
    font-size: 0.625rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.dreams-grid.list-view .dream-card-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    -webkit-line-clamp: 1;
    line-height: 1.3;
}

.dreams-grid.list-view .dream-card-status-text {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

/* Цена в списке */
.dreams-grid.list-view .dream-card-cost {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Кнопки в списке */
.dreams-grid.list-view .card-top-actions {
    position: static;
    transform: none;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.dreams-grid.list-view .card-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 14px;
}

.dreams-grid.list-view .dots-dropdown {
    top: auto;
    bottom: 38px;
    right: 0;
    min-width: 160px;
}

/* Линия срока под всей карточкой */
.dreams-grid.list-view .deadline-bar-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 12px 4px;
    border-top: none;
}

.dreams-grid.list-view .deadline-bar {
    height: 2px;
    background: #e8e8e4;
    border-radius: 1px;
}

.dreams-grid.list-view .deadline-bar-info {
    display: none;
}

/* Drag handle в списке */
.dreams-grid.list-view .drag-handle { display: none; }

/* ============================================
   ПУСТОЕ СОСТОЯНИЕ
   ============================================ */

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty-state-title {
    font-size: 1.125rem; font-weight: 500;
    color: var(--text-primary); margin-bottom: 8px;
    letter-spacing: -0.02em;
}
.empty-state-desc { font-size: 0.8125rem; margin-bottom: 20px; }

/* ============================================
   ДЕТАЛЬНАЯ СТРАНИЦА
   ============================================ */

.detail-header { padding: 32px 0 20px; }
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-secondary); font-size: 0.8125rem;
    margin-bottom: 24px; text-transform: uppercase;
    letter-spacing: 0.04em; font-weight: 450;
}
.back-link:hover { color: var(--text-primary); opacity: 1; }

.detail-layout {
    display: grid; grid-template-columns: 1fr 320px;
    gap: 40px; padding-bottom: 60px;
}
@media (max-width: 800px) { .detail-layout { grid-template-columns: 1fr; gap: 24px; } }

.detail-main { min-width: 0; }
.detail-title {
    font-size: 1.75rem; font-weight: 500;
    color: var(--text-primary); letter-spacing: -0.03em;
    margin-bottom: 12px; line-height: 1.25;
}

.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.badge {
    padding: 4px 10px; border-radius: 3px;
    font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.04em;
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid transparent;
}
.badge-critical { background: var(--red-bg); color: var(--red); border-color: #f0d0d0; }
.badge-high { background: var(--orange-bg); color: var(--orange); border-color: #e8d8c0; }
.badge-medium { background: var(--blue-bg); color: var(--blue); border-color: #d4dce8; }
.badge-low { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border); }

.detail-section { margin-bottom: 24px; }
.detail-section-title {
    font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-tertiary); margin-bottom: 8px;
}
.detail-section-content {
    color: var(--text-primary); font-size: 0.875rem;
    line-height: 1.7; font-weight: 400;
}

.detail-sidebar { position: sticky; top: calc(var(--navbar-height) + 28px); align-self: start; }
@media (max-width: 800px) { .detail-sidebar { position: static; order: -1; } }

.detail-image-card {
    background: var(--bg-hover); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 16px;
}
.detail-image-card img { width: 100%; height: 240px; object-fit: cover; }
.detail-image-card .no-image-large {
    display: flex; align-items: center; justify-content: center;
    height: 240px; color: var(--text-tertiary);
    font-size: 3rem; font-weight: 300;
}

.detail-info-card {
    background: var(--bg-surface); border: var(--border);
    border-radius: var(--radius-md); padding: 18px 20px;
}
.detail-info-row {
    display: flex; justify-content: space-between;
    align-items: center; padding: 10px 0;
    border-bottom: var(--border); gap: 8px;
}
.detail-info-row:last-child { border-bottom: none; }
.detail-info-label {
    font-size: 0.6875rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
}
.detail-info-value {
    font-size: 0.875rem; color: var(--text-primary);
    font-weight: 500; text-align: right;
    word-break: break-word; letter-spacing: -0.01em;
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px; margin-top: 12px;
}
.detail-gallery img {
    width: 100%; aspect-ratio: 1; object-fit: cover;
    border-radius: var(--radius-sm); cursor: pointer;
    transition: opacity var(--transition-fast);
}
.detail-gallery img:hover { opacity: 0.8; }

/* ============================================
   ФОРМЫ
   ============================================ */

.form-container { max-width: 640px; margin: 0 auto; padding: 40px 0 60px; }
.form-title {
    font-size: 1.5rem; font-weight: 500;
    letter-spacing: -0.03em; margin-bottom: 28px;
    color: var(--text-primary);
}
.form-group { margin-bottom: 18px; }
.form-label {
    display: block; font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-tertiary); margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 10px 12px;
    background: var(--bg-surface); border: var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: var(--font); font-size: 0.875rem;
    transition: border-color var(--transition-fast); outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-tertiary); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b6b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 32px; cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 0.6875rem; color: var(--text-tertiary); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 500px) { .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; } }

.form-actions { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }

/* ============================================
   АНАЛИТИКА
   ============================================ */

.analytics-page { padding: 32px 0 60px; }
.analytics-page h1 {
    font-size: 1.5rem; font-weight: 500;
    letter-spacing: -0.03em; margin-bottom: 32px;
}
.analytics-section { margin-bottom: 40px; }
.analytics-section h2 {
    font-size: 0.6875rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-tertiary); margin-bottom: 16px;
}

.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 1px; background: var(--border);
    border: var(--border); border-radius: var(--radius-md);
    overflow: hidden;
}
@media (max-width: 768px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-item { background: var(--bg-surface); padding: 20px 24px; }
.stat-item .value {
    font-size: 1.75rem; font-weight: 500;
    letter-spacing: -0.02em; margin-bottom: 2px;
}
.stat-item .label {
    font-size: 0.6875rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em;
}

.progress-large { margin-bottom: 8px; }
.progress-large .progress-info {
    display: flex; justify-content: space-between; margin-bottom: 8px;
    font-size: 0.75rem; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.progress-large .progress-bar { height: 4px; background: #e8e8e4; border-radius: 2px; overflow: hidden; }
.progress-large .progress-fill { height: 100%; background: var(--accent); border-radius: 2px; }

.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label {
    width: 160px; text-align: right; font-size: 0.75rem;
    color: var(--text-secondary); flex-shrink: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { flex: 1; height: 8px; background: #e8e8e4; border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.bar-value { width: 100px; font-size: 0.75rem; color: var(--text-primary); flex-shrink: 0; }
@media (max-width: 600px) { .bar-label { width: 100px; font-size: 0.6875rem; } .bar-value { width: 70px; font-size: 0.6875rem; } }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th {
    padding: 8px 12px; text-align: left;
    border-bottom: 2px solid var(--accent);
    font-size: 0.6875rem; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-tertiary);
    font-weight: 500; white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: var(--border); }
.table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--container-padding));
    padding: 0 var(--container-padding);
}
.action-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* ============================================
   АРХИВ
   ============================================ */

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px; background: var(--border);
    border: var(--border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 40px;
}

.archive-card {
    background: var(--bg-surface); text-decoration: none;
    color: inherit; transition: background var(--transition-fast);
    position: relative;
}
.archive-card:hover { background: var(--bg-hover); }
.archive-card-image { aspect-ratio: 4/3; overflow: hidden; }
.archive-card-image img { width: 100%; height: 100%; object-fit: cover; }
.archive-card-body { padding: 14px 16px; }
.archive-card-title {
    font-size: 0.875rem; font-weight: 500;
    letter-spacing: -0.02em; margin-bottom: 4px;
}
.archive-card-date {
    font-size: 0.6875rem; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}
.archive-card-cost { font-size: 0.8125rem; font-weight: 500; color: var(--green); }

.archive-delete-btn {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 28px; height: 28px; border-radius: 50%;
    border: var(--border); background: var(--bg-surface);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; transition: all var(--transition-fast);
}
.archive-delete-btn:hover { background: var(--red-bg); color: var(--red); border-color: #f0d0d0; }

/* ============================================
   СТРАНИЦА ДОМА
   ============================================ */

.house-hero {
    aspect-ratio: 16/7; max-height: 400px;
    border-radius: var(--radius-md); overflow: hidden;
    margin-bottom: 32px; background: var(--bg-hover);
    position: relative;
}
.house-hero img { width: 100%; height: 100%; object-fit: cover; }
.house-hero-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 32px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
}
.house-hero-title {
    font-size: 1.75rem; font-weight: 500;
    color: #fff; letter-spacing: -0.03em;
}

.house-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1px; background: var(--border);
    border: var(--border); border-radius: var(--radius-md);
    overflow: hidden; margin-bottom: 40px;
}
.house-card { background: var(--bg-surface); padding: 20px; }
.house-card h4 {
    font-size: 0.8125rem; font-weight: 500;
    letter-spacing: -0.01em; margin-bottom: 6px;
}
.house-card p { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.6; }

/* ============================================
   ЛОГИН
   ============================================ */

.login-container {
    max-width: 360px; margin: 80px auto; padding: 32px;
    background: var(--bg-surface); border: var(--border);
    border-radius: var(--radius-md);
}
.login-container h1 {
    font-size: 1.25rem; font-weight: 500;
    text-align: center; margin-bottom: 24px;
    letter-spacing: -0.02em;
}
.login-error {
    background: var(--red-bg); color: var(--red);
    padding: 10px 12px; border-radius: var(--radius-sm);
    margin-bottom: 16px; font-size: 0.75rem;
    border: 1px solid #f0d0d0;
}
.login-btn { width: 100%; margin-top: 4px; }

/* ============================================
   МОДАЛКИ
   ============================================ */

.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); z-index: 2000;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--bg-surface); border: var(--border);
    border-radius: var(--radius-md); padding: 24px;
    width: 90%; max-width: 380px; box-shadow: var(--shadow-md);
}
.modal-box h3 { font-size: 1rem; font-weight: 500; margin-bottom: 16px; letter-spacing: -0.02em; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ============================================
   АНИМАЦИИ
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.dream-card { animation: fadeIn 0.3s ease backwards; }
.dream-card:nth-child(1) { animation-delay: 0.02s; }
.dream-card:nth-child(2) { animation-delay: 0.04s; }
.dream-card:nth-child(3) { animation-delay: 0.06s; }
.dream-card:nth-child(4) { animation-delay: 0.08s; }
.dream-card:nth-child(5) { animation-delay: 0.10s; }
.dream-card:nth-child(6) { animation-delay: 0.12s; }

/* ============================================
   МОБИЛЬНЫЕ
   ============================================ */

@media (max-width: 768px) {
    :root { --container-padding: 20px; }
    .navbar .container { max-width: 100%; }
    .container { max-width: 100%; }
    .hero { padding: 24px 0 16px; }
    .hero-greeting { font-size: 1.375rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 1.25rem; }
    .filters-row { flex-direction: column; }
    .category-filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
    .dream-card-title { font-size: 0.75rem; }
    .detail-title { font-size: 1.375rem; }
    .form-container { padding: 24px 0 32px; }
    .form-title { font-size: 1.25rem; }
    .house-hero { aspect-ratio: 3/2; max-height: 240px; }
    .house-hero-overlay { padding: 20px; }
    .house-hero-title { font-size: 1.25rem; }
    .house-grid { grid-template-columns: 1fr; }
    .archive-grid { grid-template-columns: 1fr; }
    .login-container { margin: 32px 16px; }

    .dreams-grid.list-view .dream-card-image { width: 50px; min-width: 50px; height: 50px; margin: 8px; }
    .dreams-grid.list-view .card-icon-btn { width: 28px; height: 28px; font-size: 12px; }
    .dreams-grid.list-view .card-top-actions { gap: 4px; }
    .dreams-grid.list-view .dream-card-body { padding: 8px 8px 8px 0; gap: 10px; }
    .dreams-grid.list-view .dream-card-cost { font-size: 0.75rem; }
}

@media (max-width: 400px) {
    :root { --container-padding: 14px; }
    .navbar-brand { font-size: 0.8125rem; }
    .hero-greeting { font-size: 1.25rem; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 1.125rem; }
}