/* ================================================================
   НАШ ДОМ — полный файл стилей
   Темы переключаются атрибутом data-theme на <html>
   ================================================================ */

/* ===================== AI / Чипы / Дропдауны ===================== */
.chip-group {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px;
}
.chip {
  padding: 9px 16px; border: none; outline: none;
  border-radius: var(--r-pill); background: var(--accent-soft);
  color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: transform .15s, background .2s, color .2s, box-shadow .2s;
}
.chip:hover { transform: translateY(-1px); }
.chip:active { transform: scale(.95); }
.chip.active {
  background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px var(--accent-soft);
}
.ai-select {
  width: 100%; padding: 12px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke);
  background: var(--card-solid);
  color: var(--text); font-size: 14px;
  margin-bottom: 0;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a7568' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 42px;
  cursor: pointer;
}
.ai-panel {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--stroke);
}
.ai-label {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 12px 0 6px;
}
.ai-label:first-child { margin-top: 0; }
.ai-label span { font-weight: 400; color: var(--text-2); }

.ai-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 18px; color: var(--text-2);
}
.ai-loading svg { color: var(--accent); animation: ai-pulse 1.4s ease-in-out infinite; }
@keyframes ai-pulse {
  0%, 100% { opacity: .35; transform: scale(.92); }
  50%      { opacity: 1;   transform: scale(1.05); }
}
.ai-error { color: var(--danger); padding: 14px; text-align: center; }

.ai-result {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-movie-card {
  background: var(--accent-soft); border-radius: var(--r-md);
  padding: 14px 16px; font-size: 14px; line-height: 1.6;
}
.ai-movie-title {
  font-size: 15px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}
.ai-movie-year { color: var(--text-2); font-weight: 400; }
.ai-movie-meta, .ai-movie-why {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2); margin-bottom: 4px;
}
.ai-movie-meta svg, .ai-movie-why svg { color: var(--accent); flex-shrink: 0; }
.ai-movie-about { color: var(--text); margin: 6px 0; }
.ai-movie-actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.ai-movie-actions button {
  flex: 1; padding: 9px 12px;
  border: none; border-radius: var(--r-sm);
  background: var(--card-solid); color: var(--accent);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .12s, background .2s, color .2s;
}
.ai-movie-actions button:active { transform: scale(.96); }
.ai-movie-actions button.added {
  background: var(--accent); color: #fff;
}

/* ===================== Заголовок экрана (Хотелки/Заметки/Напомнить/Кино/Ещё) ===================== */
.fh-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.fh-head-text { flex: 1; min-width: 0; }
.fh-head-title {
  font-size: 30px; font-weight: 800; letter-spacing: -0.8px;
  color: var(--text); line-height: 1.15;
}
.fh-head-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.fh-head-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); border: none; cursor: pointer;
  transition: transform .15s;
}
.fh-head-btn:active { transform: scale(.92); }
.fh-head-btn.primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 20px var(--accent-soft);
}
.fh-head-btn.ghost {
  background: var(--card-solid); color: var(--text-2);
  border: 1px solid var(--stroke);
}
.fh-head-btn.ghost.active-tool { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===================== Универсальные утилиты ===================== */
.btn-with-icon {
  display: inline-flex !important; align-items: center; justify-content: center;
  gap: 8px;
}
.btn-with-icon svg { flex-shrink: 0; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%; padding: 11px 14px; margin-top: 6px;
  border: none; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
  transition: transform .12s, background .2s;
}
.btn-ghost:active { transform: scale(.97); }
.inline-ico {
  display: inline-flex; align-items: center; gap: 4px;
}
.inline-ico svg { color: var(--accent); }
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
}
.seg-ico { display: inline-flex; opacity: .75; }
.seg-btn.active .seg-ico { opacity: 1; }

/* ===================== Empty state ===================== */
.empty-state {
  text-align: center; padding: 50px 20px;
  color: var(--text-2);
}
.empty-icon {
  width: 72px; height: 72px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); border-radius: var(--r-lg);
  color: var(--accent);
}
.empty-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
.empty-hint { font-size: 13px; max-width: 320px; margin: 0 auto; line-height: 1.5; }

/* ===================== Skeleton ===================== */
.skeleton {
  background: linear-gradient(90deg,
    var(--accent-soft) 25%,
    var(--card-solid) 50%,
    var(--accent-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 84px; margin-bottom: 12px; }

/* ===================== Кинопоиск-результаты ===================== */
.kp-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px; cursor: pointer;
  border-radius: var(--r-sm); margin-bottom: 4px;
  transition: background .15s;
}
.kp-row:hover { background: var(--accent-soft); }
.kp-row img { width: 40px; border-radius: 8px; flex-shrink: 0; }
.kp-no-poster {
  width: 40px; height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 8px;
}
.kp-info { font-size: 14px; min-width: 0; }
.kp-meta {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-2); font-size: 12px; margin-top: 2px;
}
.kp-meta svg { color: var(--accent); }

/* ===================== Чек-листы ===================== */
.check-items > div:last-child { border-bottom: none !important; }
.checklist-progress {
  height: 5px; border-radius: var(--r-pill);
  background: var(--stroke); margin: 12px 0 4px; overflow: hidden;
}
.checklist-progress-fill {
  height: 100%; border-radius: var(--r-pill); background: var(--accent);
  transition: width .25s ease;
}
.check-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 0;
  border-bottom: 1px solid var(--stroke);
}
.check-circle {
  width: 21px; height: 21px; border-radius: var(--r-pill); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.6px solid var(--stroke); box-sizing: border-box; cursor: pointer;
}
.check-circle.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.check-item-text { flex: 1; font-size: 14.5px; color: var(--text); }
.check-item.done .check-item-text { color: var(--text-3); text-decoration: line-through; opacity: .8; }
.checklist-more { font-size: 12.5px; font-weight: 600; color: var(--accent); margin-top: 8px; cursor: pointer; }

/* ===================== Кино — мета внутри карточки ===================== */
.movie-meta {
  font-size: 13px; color: var(--text-2); margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 0 4px; align-items: center;
}

/* ===== ТЕМА: Светлая (по умолчанию) ===== */
:root {
  --bg-solid: #F6F3EE;
  --bg: var(--bg-solid);         /* больше не градиент — сплошной цвет */
  --card-solid: #FFFFFF;
  --stroke: rgba(29, 25, 19, .06);
  --text: #1D1913;
  --text-2: #93897A;
  --text-3: #B0A796;             /* слабый текст: даты, авторы */
  --accent: #2E5C45;
  --accent-soft: rgba(46, 92, 69, .10);
  --accent-deep: rgba(46, 92, 69, .28);
  --danger: #C4553B;
  --tabbar-bg: rgba(255, 255, 255, .9);
  --r-sm: 12px;                  /* система скруглений */
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;
  --radius: var(--r-lg);         /* legacy alias */
  --shadow: 0 1px 2px rgba(29, 25, 19, .03), 0 10px 30px rgba(29, 25, 19, .05);
  --shadow-card-inset: none;
  --shadow-tabbar: 0 12px 40px rgba(29, 25, 19, .16);
  --seg-bg: rgba(29, 25, 19, .055);
}

/* ===== ТЕМА: Тёмная ===== */
html[data-theme="dark"] {
  --bg-solid: #171512;
  --bg: var(--bg-solid);
  --card-solid: #211F1B;
  --stroke: rgba(255, 255, 255, .07);
  --text: #EDE9E1;
  --text-2: #A39A8B;
  --text-3: #7A7265;
  --accent: #6FA98A;
  --accent-soft: rgba(111, 169, 138, .14);
  --accent-deep: rgba(111, 169, 138, .30);
  --danger: #E0705A;
  --tabbar-bg: rgba(33, 31, 27, .92);
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-tabbar: 0 12px 40px rgba(0, 0, 0, .5);
  --seg-bg: rgba(255, 255, 255, .07);
}

/* ===== ТЕМА: Океан ===== */
html[data-theme="ocean"] {
  --bg-solid: #EFF3F5;
  --bg: var(--bg-solid);
  --card-solid: #FFFFFF;
  --stroke: rgba(20, 50, 80, .07);
  --text: #1B2A33;
  --text-2: #6C8091;
  --text-3: #9AACB9;
  --accent: #33698C;
  --accent-soft: rgba(51, 105, 140, .10);
  --accent-deep: rgba(51, 105, 140, .28);
  --danger: #C4553B;
  --tabbar-bg: rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(20, 50, 80, .03), 0 10px 30px rgba(20, 50, 80, .06);
  --shadow-tabbar: 0 12px 40px rgba(20, 50, 80, .14);
  --seg-bg: rgba(20, 50, 80, .055);
}

/* ===== ТЕМА: Лес ===== */
html[data-theme="forest"] {
  --bg-solid: #F0F4EE;
  --bg: var(--bg-solid);
  --card-solid: #FFFFFF;
  --stroke: rgba(30, 60, 30, .07);
  --text: #22301F;
  --text-2: #75816C;
  --text-3: #A2AD98;
  --accent: #3E7A4C;
  --accent-soft: rgba(62, 122, 76, .10);
  --accent-deep: rgba(62, 122, 76, .28);
  --danger: #C4553B;
  --tabbar-bg: rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(30, 60, 30, .03), 0 10px 30px rgba(30, 60, 30, .06);
  --shadow-tabbar: 0 12px 40px rgba(30, 60, 30, .14);
  --seg-bg: rgba(30, 60, 30, .055);
}

/* ===== ТЕМА: Ночной графит ===== */
html[data-theme="graphite"] {
  --bg-solid: #14161A;
  --bg: var(--bg-solid);
  --card-solid: #1E2126;
  --stroke: rgba(255, 255, 255, .07);
  --text: #E8EAEE;
  --text-2: #9BA2AC;
  --text-3: #6E7580;
  --accent: #8AA7CE;
  --accent-soft: rgba(138, 167, 206, .14);
  --accent-deep: rgba(138, 167, 206, .30);
  --danger: #E0705A;
  --tabbar-bg: rgba(30, 33, 38, .92);
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-tabbar: 0 12px 40px rgba(0, 0, 0, .5);
  --seg-bg: rgba(255, 255, 255, .07);
}

/* ================================================================
   БАЗА
   ================================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
}

body {
  font-family: 'Golos Text', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; }
a { color: var(--accent); }

/* ===== Карточки ===== */
.glass-card {
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

/* ===== Поля ввода ===== */
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-2); }
textarea { resize: vertical; }

/* ===== Кнопки ===== */
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--accent-soft);
  transition: transform .12s, opacity .15s;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:active { transform: scale(.98); }

.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border: none; border-radius: 14px;
  cursor: pointer; font-size: 18px;
  color: var(--text);
  transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.small {
  width: 34px; height: 34px;
  font-size: 14px; background: transparent;
}
.icon-btn.active-tool { background: var(--accent); color: #fff; }

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.badge.muted { background: var(--stroke); color: var(--text-2); }

/* ================================================================
   КАРКАС И НАВИГАЦИЯ
   ================================================================ */
#fh-app { display: flex; min-height: 100vh; }

.fh-nav {
  width: 210px; flex-shrink: 0;
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--stroke);
  position: sticky; top: 0; height: 100vh;
}
.fh-nav-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: transparent; border: none; border-radius: 14px;
  cursor: pointer; color: var(--text-2);
  font-size: 15px; font-weight: 600; text-align: left;
  font-family: inherit;
  transition: all .15s;
}
.fh-nav-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.fh-nav-btn:hover { background: var(--accent-soft); color: var(--text); }
.fh-nav-btn.active { background: var(--accent-soft); color: var(--accent); }

#tab-root {
  flex: 1; max-width: 760px;
  margin: 0 auto; padding: 18px; width: 100%;
}

/* ================================================================
   ТУЛБАРЫ, СЕГМЕНТЫ (Кино, Заметки, Напоминания)
   ================================================================ */
.movies-toolbar { display: flex; align-items: center; gap: 10px; }

.seg {
  flex: 1; display: flex;
  background: var(--seg-bg);
  border-radius: var(--r-pill); padding: 3px;
}
.seg-btn {
  flex: 1; padding: 8px 0;
  background: transparent; border: none;
  border-radius: var(--r-pill); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  font-family: inherit;
  transition: all .2s;
}
.seg-btn.active {
  background: var(--card-solid); color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(29, 25, 19, .08);
}

/* ================================================================
   КИНО
   ================================================================ */
.ai-banner {
  background: var(--accent); border-radius: var(--r-lg);
  padding: 18px; box-shadow: 0 14px 34px var(--accent-deep);
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; margin-bottom: 14px; border: none; width: 100%;
  font-family: inherit; text-align: left;
}
.ai-banner-text { flex: 1; }
.ai-banner-title { font-size: 16px; font-weight: 700; color: #fff; }
.ai-banner-sub { font-size: 12.5px; color: rgba(255,255,255,.75); margin-top: 3px; }
.ai-banner-cta {
  padding: 10px 16px; border-radius: var(--r-pill);
  background: #fff; color: var(--accent);
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.movie-form { margin-top: 14px; }
.movie-row { display: flex; gap: 14px; }
.movie-poster {
  width: 56px; height: 78px; object-fit: cover;
  border-radius: 12px;
  align-self: flex-start; flex-shrink: 0;
}
.movie-poster-ph {
  width: 56px; height: 78px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(150deg, #C8B99A, #8F7B5C);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.8);
}
.movie-info { flex: 1; min-width: 0; }
.movie-info p { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.movie-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.movie-chip {
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  background: var(--stroke); color: var(--text-2);
}
.movie-chip.accent { background: var(--accent-soft); color: var(--accent); }
.card-icons { display: flex; flex-direction: row; gap: 4px; flex-shrink: 0; align-self: flex-start; }
.card-icons .icon-btn.small { background: var(--accent-soft); }
.movie-footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.movie-footer a { color: var(--accent); text-decoration: none; font-size: 14px; }
.movie-footer .btn-primary { margin-left: auto; width: auto; padding: 10px 20px; }

/* ================================================================
   ФАЙЛЫ: ПАПКИ И ПЛИТКИ
   ================================================================ */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.folder-tile {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 18px 10px;
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer; text-align: center;
  transition: transform .15s;
}
.folder-tile:hover { transform: translateY(-3px); }
.folder-tile strong {
  font-size: 13px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-tile small { color: var(--text-2); font-size: 11px; }
.folder-tile .f-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 16px;
  color: var(--accent); font-size: 26px;
}
.folder-tile .f-icon svg { width: 28px; height: 28px; }
.folder-tile .f-del {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  opacity: .35; font-size: 13px; color: var(--text);
}
.folder-tile.add-tile { border-style: dashed; box-shadow: none; background: transparent; }

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.file-tile {
  position: relative;
  display: flex; flex-direction: column;
  aspect-ratio: 1;
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer;
  transition: transform .15s;
}
.file-tile:hover { transform: translateY(-3px); }
.file-tile .thumb {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px;
  background: var(--accent-soft);
  overflow: hidden;
}
.file-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-tile .meta { padding: 8px 10px; }
.file-tile .meta strong {
  display: block; font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-tile .meta small { color: var(--text-2); font-size: 11px; }
.file-tile .actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 4px; z-index: 2;
}
.tile-act {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .85);
  border: none; border-radius: 10px;
  cursor: pointer; font-size: 14px;
  text-decoration: none; color: #2b2a27;
  backdrop-filter: blur(4px);
}

.dropzone {
  border: 2px dashed var(--stroke);
  border-radius: 14px;
  padding: 22px; text-align: center;
  color: var(--text-2); cursor: pointer;
  transition: all .15s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }

/* ===== Просмотрщик ===== */
.viewer-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.viewer-overlay .viewer-content { max-width: 95vw; max-height: 90vh; }
.viewer-overlay img, .viewer-overlay video {
  max-width: 95vw; max-height: 85vh; border-radius: 14px;
}
.viewer-close {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px;
  background: rgba(255, 255, 255, .15);
  border: none; border-radius: 50%;
  color: #fff; font-size: 18px; cursor: pointer;
}

/* ================================================================
   НАПОМИНАНИЯ — горизонтальные строки-карточки, группировка по дате
   ================================================================ */
.rem-list { display: flex; flex-direction: column; gap: 10px; }
.rem-date-label {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-2); padding: 2px 4px 0; margin-top: 6px;
}
.rem-date-label:first-child { margin-top: 0; }
.rem-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  cursor: pointer;
  transition: transform .15s;
}
.rem-row:hover { transform: translateY(-2px); }
.rem-row.past { opacity: .55; }
.rem-row-time-col { width: 62px; flex-shrink: 0; }
.rem-row-time {
  font-size: 21px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; letter-spacing: -0.5px;
}
.rem-row.soon .rem-row-time { color: var(--accent); }
.rem-row-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.rem-row-soon-badge {
  display: inline-block; margin-top: 4px; padding: 2px 8px;
  border-radius: var(--r-pill); background: var(--accent-soft);
  color: var(--accent); font-size: 10.5px; font-weight: 700;
}
.rem-row-body { flex: 1; min-width: 0; }
.rem-row-title { font-size: 15px; font-weight: 600; color: var(--text); }
.rem-row-meta {
  font-size: 12.5px; color: var(--text-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rem-row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.rem-row-actions button {
  background: none; border: none; cursor: pointer;
  opacity: .4; color: var(--text); padding: 4px;
}
.rem-row-actions button:hover { opacity: 1; }
.rem-row-chevron { color: var(--text-3); flex-shrink: 0; }

/* ================================================================
   ЕЩЁ: профиль, список настроек, тоггл
   ================================================================ */
.more-profile { display: flex; align-items: center; gap: 14px; }
.more-avatar {
  width: 52px; height: 52px; border-radius: var(--r-pill);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; flex-shrink: 0;
}
.more-profile-text { flex: 1; min-width: 0; }
.more-profile-name { font-size: 17px; font-weight: 700; color: var(--text); }
.more-profile-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.btn-logout {
  padding: 9px 14px; border-radius: var(--r-pill); flex-shrink: 0;
  background: rgba(196, 85, 59, .09); color: var(--danger);
  font-size: 13px; font-weight: 600; border: none; cursor: pointer;
  font-family: inherit;
}

.more-list {
  background: var(--card-solid); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
}
.more-row {
  display: flex; align-items: center; gap: 13px; padding: 15px 18px;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer; background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font-family: inherit; color: inherit;
  text-decoration: none;
}
.more-row:last-child { border-bottom: none; }
.more-row-icon {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.more-row-text { flex: 1; min-width: 0; }
.more-row-title { font-size: 14.5px; font-weight: 600; color: var(--text); }
.more-row-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.more-row-chevron { color: var(--text-3); flex-shrink: 0; }
.more-toggle {
  width: 46px; height: 28px; border-radius: var(--r-pill);
  background: var(--stroke); position: relative; flex-shrink: 0;
  border: none; cursor: pointer; padding: 0;
}
.more-toggle.on { background: var(--accent); }
.more-toggle .knob {
  position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px; border-radius: var(--r-pill);
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .2s;
}
.more-toggle.on .knob { left: 20px; }

/* ================================================================
   ТЕМЫ: ПЛИТКИ ВЫБОРА (раздел «Ещё»)
   ================================================================ */
.theme-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.theme-swatch {
  width: auto; padding: 0; border: none; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; text-align: center;
  font-size: 10.5px; font-weight: 500; color: var(--text-2);
  font-family: inherit;
}
.theme-swatch .sw {
  width: 40px; height: 40px; border-radius: var(--r-pill); margin-bottom: 0;
  border: 1px solid var(--stroke);
}
.theme-swatch.active { color: var(--accent); font-weight: 600; }
.theme-swatch.active .sw {
  border: none;
  box-shadow: 0 0 0 2px var(--card-solid), 0 0 0 4px var(--accent);
}

/* ================================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   ================================================================ */
@media (max-width: 700px) {
  #fh-app { flex-direction: column; }
  .fh-nav {
    position: fixed; left: 14px; right: 14px;
    bottom: max(26px, env(safe-area-inset-bottom) + 10px);
    top: auto; height: auto; width: auto;
    flex-direction: row; justify-content: space-around;
    padding: 8px 6px 9px;
    background: var(--tabbar-bg);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--stroke); border-right: none;
    border-radius: 30px;
    box-shadow: var(--shadow-tabbar);
    z-index: 50;
  }
  .fh-nav-btn { flex-direction: column; gap: 3px; font-size: 11px; padding: 6px 8px; }
  .fh-nav-btn span { display: block; }
  #tab-root { padding-bottom: 120px; }
  .folder-grid, .file-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
/* ================================================================
   ФОН — сплошной цвет темы, без картинок и градиентов
   ================================================================ */
body {
  background: var(--bg-solid);
}

/* ===================== PWA / safe-area ===================== */
/* В standalone-режиме контент не должен заезжать под челку iPhone */
@supports (padding: env(safe-area-inset-top)) {
  #tab-root {
    padding-top: max(18px, env(safe-area-inset-top));
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
}

/* В PWA-режиме запрещаем выделение текста (как в нативе),
   но оставляем для инпутов/полей */
@media (display-mode: standalone) {
  html, body {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;       /* выключаем pull-to-refresh браузера */
  }
  input, textarea, [contenteditable], .note-body {
    user-select: text;
    -webkit-user-select: text;
  }
}
/* hidden должен побеждать любые display */
[hidden] { display: none !important; }
/* ===== Фикс модалки: всегда по центру ===== */
.fh-modal-overlay {
  position: fixed !important; inset: 0 !important; z-index: 2000;
  display: flex !important; align-items: center !important; justify-content: center !important;
  background: rgba(0, 0, 0, .45); padding: 20px;
}
.fh-modal {
  background: var(--card-solid); border: 1px solid var(--stroke);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; max-width: 360px; width: 100%; text-align: center;
}
.fh-modal p { font-size: 15px; margin-bottom: 20px; }
.fh-modal-btns { display: flex; gap: 10px; }
.fh-modal-btns button {
  flex: 1; padding: 12px; border: none; border-radius: 12px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.fh-m-cancel { background: var(--accent-soft); color: var(--text); }
.fh-m-ok { background: var(--accent); color: #fff; }
.fh-m-ok.danger { background: var(--danger); }

/* ===== Напоминания: полный просмотр по тапу ===== */
.rem-detail { max-width: 420px; text-align: left; }
.rem-detail-time { font-size: 28px; font-weight: 700; color: var(--accent); }
.rem-detail-date { font-size: 14px; color: var(--text-2); margin-bottom: 12px; }
.rem-detail-title { font-size: 18px; margin: 0 0 10px; word-break: break-word; }
.rem-detail-desc { font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--text); }

/* ===== Раздел «Хотелки» ===== */
.wish-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.wish-card {
  position: relative; cursor: pointer;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  background: var(--card-solid);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.wish-card:hover { transform: translateY(-3px); }
.wish-card.done { opacity: .55; box-shadow: var(--shadow-sm); }
.wish-card.done .wish-title { text-decoration: line-through; }
.wish-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.wish-title { font-weight: 600; font-size: 15px; line-height: 1.3; word-break: break-word; }
.wish-done-mark {
  width: 20px; height: 20px; border-radius: var(--r-pill); flex-shrink: 0;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
}
.wish-link-chip {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 600; text-decoration: none;
}
.wish-author { color: var(--text-3); font-size: 11.5px; margin-top: auto; }
.wish-card .f-del {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; cursor: pointer;
  opacity: .4; color: var(--text); padding: 2px;
}
.wish-card .f-del:hover { opacity: 1; }

/* ===== Полноценный редактор заметок ===== */
.note-editor { max-width: 640px; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.ne-head { display: flex; align-items: center; }
.ne-head strong { flex: 1; font-size: 17px; }
.ne-close { background: none; border: none; cursor: pointer; color: var(--text-2); padding: 4px; }
.ne-title { font-size: 16px; font-weight: 600; }
.ne-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--accent-soft); border-radius: 10px; }
.ne-toolbar button {
  border: none; background: var(--card-solid); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer;
  font-family: inherit; min-width: 32px;
}
.ne-toolbar button:hover { background: var(--accent); color: #fff; }
.ne-sep { width: 1px; background: var(--stroke); margin: 2px 3px; }
.ne-body {
  width: 100%; resize: vertical; min-height: 220px; line-height: 1.5;
  font-size: 15px; font-family: inherit; padding: 12px;
}
.ne-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ne-count { color: var(--text-2); font-size: 12px; }
@media (max-width: 700px) {
  .note-editor { max-width: 100%; }
  .ne-body { min-height: 50vh; }
}

/* ===== Markdown-рендер заметок ===== */
.note-body { margin: 8px 0; line-height: 1.55; font-size: 15px; word-break: break-word; }
.note-body h4 { margin: 10px 0 4px; font-size: 16px; }
.note-body ul, .note-body ol { margin: 6px 0; padding-left: 22px; }
.note-body li { margin: 2px 0; }
.note-body blockquote {
  margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.note-body hr { border: none; border-top: 1px solid var(--stroke); margin: 10px 0; }
.note-body .md-check { padding: 2px 0; }
.note-body .md-check.done span { text-decoration: line-through; opacity: .55; }
.note-body strong { font-weight: 700; }
.note-body br { line-height: 0.6; }

/* ============================================================
   ОСВЕЖЕНИЕ: единая система теней, карточки, кнопки, диалог еды
   ============================================================ */
:root {
  --shadow-sm: 0 1px 2px rgba(29,25,19,.03);
  --shadow-md: 0 1px 2px rgba(29,25,19,.03), 0 10px 30px rgba(29,25,19,.05);
  --shadow-lg: 0 1px 2px rgba(29,25,19,.04), 0 16px 40px rgba(29,25,19,.09);
}
html[data-theme="dark"], html[data-theme="graphite"] {
  --shadow-sm: 0 2px 8px rgba(0,0,0,.30);
  --shadow-md: 0 10px 30px rgba(0,0,0,.5);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.55);
}

/* карточки — единые тени и плавный подъём */
.glass-card, .folder-tile, .file-tile, .wish-card, .rem-tile { box-shadow: var(--shadow-md); }
.folder-tile, .file-tile, .wish-card {
  transition: transform .15s ease, box-shadow .15s ease;
}
.folder-tile:hover, .file-tile:hover, .wish-card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-lg);
}

/* кнопки — мягче тень, аккуратное нажатие */
.btn-primary { box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: scale(.97); }
.icon-btn { transition: transform .15s ease, background .15s ease; }

/* диалог «Что поесть» — полировка (перебивает inline-стили meal.js) */
.fh-modal .meal-chip { padding: 8px 15px; font-weight: 600; }
.fh-modal .meal-chip.active { box-shadow: 0 4px 12px var(--accent-soft); }
.fh-modal .meal-dish { border-radius: 14px; box-shadow: var(--shadow-sm); }
.fh-modal #m-go { box-shadow: var(--shadow-sm); }

/* ============================================================
   НИЖНЕЕ МЕНЮ (телефон): 4 раздела + «Ещё», активная пилюля
   ============================================================ */
@media (max-width: 700px) {
  /* «На сайт» убираем из нижней панели — она переезжает в «Ещё» */
  .fh-nav a.fh-nav-btn { display: none; }

  .fh-nav-btn { gap: 2px; padding: 0; flex: 1; }

  /* контейнер иконки — пилюля 46×28 */
  .fh-nav-btn svg {
    width: 20px; height: 20px;
    padding: 4px 13px; box-sizing: content-box;
    border-radius: 999px;
    color: #A39A8B;
    transition: background .15s ease, color .15s ease;
  }
  html[data-theme="dark"] .fh-nav-btn svg,
  html[data-theme="graphite"] .fh-nav-btn svg { color: var(--text-2); }
  .fh-nav-btn span { font-size: 10px; font-weight: 600; color: #A39A8B; }
  html[data-theme="dark"] .fh-nav-btn span,
  html[data-theme="graphite"] .fh-nav-btn span { color: var(--text-2); }

  /* активный пункт: акцентная пилюля под иконкой, текст акцентный */
  .fh-nav-btn.active { background: transparent; color: var(--accent); }
  .fh-nav-btn.active svg { background: var(--accent-soft); color: var(--accent); }
  .fh-nav-btn.active span { color: var(--accent); font-weight: 700; }
}

/* ===== Анимация переключения вкладок ===== */
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}
#tab-root.tab-entering {
  animation: tabFadeIn 0.22s ease both;
}

/* ===== Офлайн-баннер ===== */
#fh-offline-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--card-solid);
  padding: 9px 18px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  white-space: nowrap; z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
#fh-offline-banner.visible { opacity: 1; }

/* ===== Баннер «Доступна новая версия» над нижней навигацией ===== */
#fh-update-bar {
  position: fixed;
  left: 12px; right: 12px; margin: 0 auto;
  bottom: calc(72px + env(safe-area-inset-bottom));
  max-width: 420px;
  display: flex; align-items: center; gap: 12px;
  background: var(--accent); color: #fff;
  padding: 10px 12px 10px 16px; border-radius: var(--r-pill);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 9999;
  transform: translateY(20px); opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#fh-update-bar.visible { transform: translateY(0); opacity: 1; }
#fh-update-bar span {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600;
}
#fh-update-bar span svg { flex-shrink: 0; }
#fh-update-bar button {
  flex-shrink: 0;
  background: #fff; color: var(--accent);
  border: none; border-radius: var(--r-pill);
  padding: 8px 16px; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}

/* ===== Undo-тост после удаления ===== */
.fh-undo-toast {
  position: fixed;
  left: 12px; right: 12px; margin: 0 auto;
  bottom: calc(130px + env(safe-area-inset-bottom));
  max-width: 420px;
  display: flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--card-solid);
  padding: 10px 12px 10px 16px; border-radius: var(--r-pill);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 9999;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.fh-undo-toast.visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.fh-undo-toast span { flex: 1; font-size: 14px; font-weight: 500; }
.fh-undo-toast button {
  flex-shrink: 0; background: none; color: inherit;
  border: 1px solid currentColor; border-radius: var(--r-pill);
  padding: 6px 14px; font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer;
}

/* ===== Приоритет хотелок (звезда) и превью ссылки ===== */
.wish-card .f-star {
  flex-shrink: 0; margin-left: 6px;
  background: none; border: none; cursor: pointer;
  opacity: .3; color: var(--text); padding: 0;
}
.wish-card .f-star:hover { opacity: 1; }
.wish-card .f-star.active { opacity: 1; color: var(--accent); }
.wish-card .f-star svg { fill: currentColor; stroke: none; }
.wish-img {
  width: 100%; height: 120px; object-fit: cover;
  border-radius: 10px; background: var(--accent-soft);
}
