/* Тёмно-фиолетовая тема */
:root {
  color-scheme: dark;
  --bg: #140c07;
  --card: rgba(40, 24, 14, 0.72);
  --text: #f6ede4;
  --muted: #b89f88;
  --line: rgba(251, 185, 49, 0.18);
  --accent: #fbb931;     /* «Закат»: FBB931 — ссылки, рамки, выделение (9,8:1 к фону) */
  --accent-strong: #ea6113; /* «Закат»: EA6113 — заливка главных кнопок */
  --danger: #f87171;
  --ok: #4ade80;
  --side: rgba(24, 14, 8, 0.78);
  --hover: rgba(251, 185, 49, 0.1);
  --border-input: #9a8470; /* рамка полей: 4,8:1 к фону — поле видно (WCAG 1.4.11 требует 3:1) */
  --on-accent: #2a1206; /* текст на оранжевом: 5,2–7,5:1 */
  --focus: #ffe3b3; /* кольцо фокуса для клавиатуры («Закат»: FFE3B3) */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --glass-fill: rgba(
    255,
    255,
    255,
    0.06
  ); /* заливка кнопок и плашек на стекле */
  --glass-fill-strong: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.12);
  /* Фон страницы и светящиеся пятна — их меняют темы (выбор темы — в левой панели) */
  --page-bg: linear-gradient(160deg, #24150b 0%, #140c07 55%, #0b0604 100%);
  --blob-1: rgba(234, 97, 19, 0.38);
  --blob-2: rgba(248, 143, 34, 0.24);
  --blob-3: rgba(251, 185, 49, 0.2);
  --blob-4: rgba(234, 97, 19, 0.22);
  /* Остальные цвета акцента — их тоже меняет тема (в «Тёмной» всё оранжевое становится голубым) */
  --accent-mid: #f88f22; /* середина градиента кнопок («Закат»: F88F22) */
  --folder-back: #c44f0e;
  --folder-hover: #fba245;
  --weekend: #f0a868; /* выходные в календаре — 7,9:1 к фону */
  --auth-end: rgba(42, 18, 6, 0.35);
}
/* Тема «Осень»: багряно-коричневый фон, пятна цвета клёна, охры и оливы; падают листья (theme.js).
   Кнопки и надписи — те же, что в «Закате»: их контраст уже проверен. */
html[data-theme="autumn"] {
  --page-bg: linear-gradient(160deg, #2b0f09 0%, #1a0a06 50%, #0d0604 100%);
  --blob-1: rgba(190, 45, 25, 0.36);
  --blob-2: rgba(214, 140, 40, 0.26);
  --blob-3: rgba(140, 130, 40, 0.18);
  --blob-4: rgba(165, 60, 20, 0.26);
}
/* Тема «Тёмная»: графит и голубой вместо оранжевого. На фоне — плавающие тёмные полосы (ниже).
   Контраст: голубой #6cb6ff к фону — 8,7:1; тёмный текст #06182c на голубой кнопке — 5,4:1;
   серые подписи #a3a3a3 — 7:1; рамки полей #8a8a8a — 5:1. */
html[data-theme="dark"] {
  --page-bg: linear-gradient(160deg, #222226 0%, #131315 55%, #09090a 100%);
  --text: #ececf1;
  --muted: #a3a3a3;
  --border-input: #8a8a8a;
  --card: rgba(30, 30, 33, 0.75);
  --side: rgba(20, 20, 22, 0.8);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #6cb6ff;
  --accent-strong: #3b8ef0;
  --accent-mid: #5aa9ff;
  --on-accent: #06182c;
  --focus: #bfe0ff;
  --hover: rgba(108, 182, 255, 0.1);
  --folder-back: #2a5f9e;
  --folder-hover: #7cc0ff;
  --weekend: #8cc4ff;
  --auth-end: rgba(10, 14, 22, 0.35);
}
html:is([data-theme="winter"], [data-theme="aurora"]) {
  --bg: #091827;
  --page-bg: linear-gradient(155deg, #183d59, #0d2439 52%, #080f20);
  --text: #eef8ff;
  --muted: #b2ccdf;
  --border-input: #82a5be;
  --card: rgba(17, 32, 57, 0.76);
  --side: rgba(10, 22, 42, 0.82);
  --line: rgba(174, 220, 255, 0.21);
  --accent: #a5ddff;
  --accent-strong: #71b9ed;
  --accent-mid: #8dccf5;
  --on-accent: #061c30;
  --focus: #e0f5ff;
  --hover: rgba(165, 221, 255, 0.12);
  --folder-back: #377bab;
  --folder-hover: #bbebff;
  --weekend: #a4d8ff;
  --auth-end: rgba(5, 22, 40, 0.45);
  --blob-1: rgba(117, 194, 255, 0.31);
  --blob-2: rgba(198, 227, 255, 0.17);
  --blob-3: rgba(70, 123, 241, 0.22);
  --blob-4: rgba(139, 207, 247, 0.14);
}
html[data-theme="aurora"] {
  --page-bg: linear-gradient(160deg, #18223d, #0a262d 55%, #0b1424);
  --accent: #8df0d2;
  --accent-strong: #50d2b6;
  --accent-mid: #73e1c3;
  --on-accent: #06241f;
  --focus: #c0ffe9;
  --hover: rgba(141, 240, 210, 0.13);
  --folder-back: #268e80;
  --folder-hover: #a3f5df;
  --weekend: #cab5ff;
  --blob-1: rgba(68, 236, 163, 0.38);
  --blob-2: rgba(157, 110, 244, 0.31);
  --blob-3: rgba(34, 209, 226, 0.22);
  --blob-4: rgba(119, 103, 242, 0.21);
}
html[data-theme="aurora"] body::before {
  background: radial-gradient(ellipse at 24% 43%, var(--blob-1), transparent 55%),
    radial-gradient(ellipse at 76% 62%, var(--blob-2), transparent 55%);
}
.winter-snow { display: none; }
html[data-theme="winter"] .winter-snow {
  display: block;
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.winter-snow::before,
.winter-snow::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 16px 28px, #e3f4ff 1px, transparent 2px),
    radial-gradient(circle at 91px 79px, #e3f4ff 1px, transparent 2px),
    radial-gradient(circle at 127px 148px, #fff 1.5px, transparent 2.5px);
  background-size: 160px 220px;
  opacity: 0.42;
}
.winter-snow::after {
  background-size: 240px 330px;
  opacity: 0.22;
}
@media (prefers-reduced-motion: no-preference) {
  .winter-snow::before { animation: winter-fall 13s linear infinite; }
  .winter-snow::after { animation: winter-fall-far 24s linear infinite; }
}
@keyframes winter-fall { to { background-position: 160px 220px; } }
@keyframes winter-fall-far { to { background-position: -240px 330px; } }
html:is([data-theme="winter"], [data-theme="aurora"]) input,
html:is([data-theme="winter"], [data-theme="aurora"]) .segmented {
  background: rgba(4, 8, 22, 0.35);
}
html:is([data-theme="winter"], [data-theme="aurora"]) input:focus {
  background: rgba(4, 8, 22, 0.5);
}
html:is([data-theme="winter"], [data-theme="aurora"]) .selbar {
  background: rgba(16, 24, 50, 0.94);
}
html:is([data-theme="winter"], [data-theme="aurora"]) .ctx-menu {
  background: linear-gradient(145deg, rgba(30, 42, 80, 0.96), rgba(14, 20, 44, 0.96));
}
html:is([data-theme="winter"], [data-theme="aurora"]) .move-dialog {
  background: #111a36;
}
html:is([data-theme="winter"], [data-theme="aurora"]) .tile-actions a,
html:is([data-theme="winter"], [data-theme="aurora"]) .tile-actions button {
  background: rgba(12, 18, 40, 0.92);
}
html:is([data-theme="winter"], [data-theme="aurora"]) .check {
  background: rgba(12, 18, 40, 0.8);
}
html:is([data-theme="winter"], [data-theme="aurora"]) .tile:has(:focus-visible) .tile-name span {
  background: #16203f;
  box-shadow: 0 0 0 4px #16203f;
}
html:is([data-theme="winter"], [data-theme="aurora"]) .drop-overlay {
  background: rgba(6, 10, 26, 0.7);
}
html:is([data-theme="winter"], [data-theme="aurora"]) .drop-overlay div,
html:is([data-theme="winter"], [data-theme="aurora"]) .part-grip::after {
  background: #16203f;
}
@media (hover: hover) {
  html:is([data-theme="winter"], [data-theme="aurora"]) .tile:hover .tile-name span {
    background: #16203f;
    box-shadow: 0 0 0 4px #16203f;
  }
}
/* Фон «Тёмной»: вместо светящихся пятен — широкие мягкие тёмные и чуть светлые полосы,
   которые медленно плывут навстречу друг другу. Движение очень медленное, поэтому включено всегда. */
html[data-theme="dark"] body::before {
  background: repeating-linear-gradient(115deg, rgba(0, 0, 0, 0) 0 110px, rgba(0, 0, 0, 0.38) 110px 220px);
  filter: blur(22px);
  animation: dark-stripes-a 46s ease-in-out infinite alternate;
}
html[data-theme="dark"] body::after {
  background: repeating-linear-gradient(-65deg, rgba(255, 255, 255, 0) 0 160px, rgba(255, 255, 255, 0.03) 160px 320px);
  filter: blur(28px);
  animation: dark-stripes-b 61s ease-in-out infinite alternate;
}
@keyframes dark-stripes-a {
  from {
    transform: translate(-6%, -1%);
  }
  to {
    transform: translate(6%, 3%);
  }
}
@keyframes dark-stripes-b {
  from {
    transform: translate(5%, -3%);
  }
  to {
    transform: translate(-5%, 2%);
  }
}
/* В «Тёмной» — нейтральные плашки там, где цвет был задан напрямую (полосы, меню, окна, подсказки) */
html[data-theme="dark"] input,
html[data-theme="dark"] .segmented {
  background: rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] input:focus {
  background: rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .selbar {
  background: rgba(30, 30, 33, 0.94);
}
html[data-theme="dark"] .ctx-menu {
  background: linear-gradient(145deg, rgba(44, 44, 48, 0.95), rgba(26, 26, 29, 0.95));
}
html[data-theme="dark"] .move-dialog {
  background: #1d1d20;
}
html[data-theme="dark"] .tile-actions a,
html[data-theme="dark"] .tile-actions button {
  background: rgba(22, 22, 25, 0.92);
}
html[data-theme="dark"] .check {
  background: rgba(22, 22, 25, 0.8);
}
html[data-theme="dark"] .tile:has(:focus-visible) .tile-name span {
  background: #232326;
  box-shadow: 0 0 0 4px #232326;
}
html[data-theme="dark"] .drop-overlay {
  background: rgba(10, 10, 12, 0.7);
}
html[data-theme="dark"] .drop-overlay div,
html[data-theme="dark"] .part-grip::after {
  background: #232326;
}
@media (hover: hover) {
  html[data-theme="dark"] .tile:hover .tile-name span {
    background: #232326;
    box-shadow: 0 0 0 4px #232326;
  }
}
* {
  box-sizing: border-box;
}
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 72px; /* липкая панель «Выбрано» не закрывает элемент в фокусе */
}
body {
  margin: 0;
  min-height: 100vh;
  font:
    0.9375rem/1.45 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--page-bg) fixed;
}

/* Светящиеся пятна фона. Плывут, только если в системе не просили уменьшить движение;
   иначе мягко «дышат» яркостью, ничего не сдвигая. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
}
body::before {
  background:
    radial-gradient(38% 34% at 22% 22%, var(--blob-1), transparent 70%),
    radial-gradient(34% 30% at 70% 78%, var(--blob-2), transparent 70%);
}
body::after {
  background:
    radial-gradient(32% 28% at 80% 22%, var(--blob-3), transparent 70%),
    radial-gradient(30% 26% at 28% 80%, var(--blob-4), transparent 70%);
}
/* Падающие листья темы «Осень» и ночь «Хэллоуина» — холст за всеми панелями, не мешает нажимать */
.leaves,
.spooky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body::before {
    will-change: transform;
    animation: bg-drift-1 32s ease-in-out infinite alternate;
  }
  body::after {
    will-change: transform;
    animation: bg-drift-2 41s ease-in-out infinite alternate;
  }
}
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: bg-breathe 9s ease-in-out infinite alternate;
  }
  body::after {
    animation: bg-breathe 13s ease-in-out infinite alternate-reverse;
  }
}
@keyframes bg-drift-1 {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate(7%, 5%) scale(1.08) rotate(10deg);
  }
  100% {
    transform: translate(-6%, 7%) scale(1.03) rotate(-8deg);
  }
}
@keyframes bg-drift-2 {
  0% {
    transform: translate(0, 0) scale(1.05) rotate(0deg);
  }
  50% {
    transform: translate(-8%, -4%) scale(1) rotate(-12deg);
  }
  100% {
    transform: translate(5%, -7%) scale(1.1) rotate(6deg);
  }
}
@keyframes bg-breathe {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Фокус с клавиатуры виден всегда; мышью — без лишних рамок */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* Скрыто с экрана, но доступно клавиатуре и экранному диктору */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
main:focus {
  outline: none;
} /* сюда переводит ссылка «Перейти к файлам»; это не элемент управления */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent-strong);
  color: var(--on-accent);
  font-weight: 600;
}
.skip-link:focus-visible {
  top: 12px;
}

/* Общие элементы */
.logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo img {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 2px 8px rgba(248, 143, 34, 0.5));
}
.muted {
  color: var(--muted);
}
input {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--border-input);
  border-radius: 10px;
  background: rgba(12, 6, 2, 0.35);
  color: var(--text);
  min-width: 0;
  transition-property: border-color, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
input::placeholder {
  color: var(--muted);
}
input:focus {
  border-color: var(--accent);
  background: rgba(12, 6, 2, 0.5);
}
button,
.btn {
  font: inherit;
  cursor: pointer;
  padding: 7px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--glass-fill);
  color: var(--text);
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
  transition-property: border-color, background-color, color, filter, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-mid));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow:
    0 6px 18px color-mix(in srgb, var(--accent-strong) 35%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0 0 0 8px;
}
.flash {
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent);
}
.flash.error {
  border-left-color: var(--danger);
}
.flash.ok {
  border-left-color: var(--ok);
}

/* Гласморфизм: полупрозрачная «матовая» панель — фон за ней размыт, по верхнему краю блик */
.glass {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.09),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid var(--glass-border);
  border-radius: 28px; /* внутренний радиус 12px + отступ 16px */
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    0 12px 40px rgba(8, 4, 1, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
/* Нажатие — лёгкое сжатие кнопки (только если движение не отключено) */
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .side-nav a:hover {
    translate: 0 -1px; /* лёгкий подъём вкладки «Облако» / «Умный дом» при наведении */
  }
}
@media (prefers-reduced-motion: no-preference) {
  button:not(:disabled):active,
  .side-btn:active {
    scale: 0.96;
  }
}

/* Раскладка: всё в центре экрана, по бокам отступы 2rem.
   Слева стеклянная панель с кнопками, справа — стеклянная панель с файлами (или вход). */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  align-content: start;
  min-height: 100vh;
  margin: 0 3rem;
  padding: 2rem;
}
.side {
  position: sticky;
  top: 2rem;
  height: calc(100vh - 4rem);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.side .logo {
  padding: 4px 6px 8px;
}
.side-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--text);
  transition-property: background-color, filter, scale;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
/* <label> с input внутри получает фокус через сам input — показываем кольцо на кнопке */
.side-btn:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.side-btn.main {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-mid));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow:
    0 6px 18px color-mix(in srgb, var(--accent-strong) 35%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.side-mkdir {
  display: flex;
  gap: 8px;
}
.side-mkdir input {
  flex: 1;
  height: 40px;
  border-radius: 12px;
}
.side-mkdir button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.side-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* Нижняя строка левой панели: слева аккаунт, справа тема. Над каждой кнопкой раскрывается своё меню. */
/* Аккаунт и тема — каждая кнопка на всю ширину панели, тема под аккаунтом (при любой теме одинаково) */
.side-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.theme-menu,
.acct-menu {
  position: relative;
  min-width: 0;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%; /* по ширине своей колонки — в узкой панели длинное имя темы сокращается «…» */
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition-property: border-color, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.theme-btn[aria-expanded="true"] {
  border-color: var(--accent);
}
.theme-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.theme-btn-text {
  flex: 1;
  min-width: 0;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-btn-name {
  color: var(--accent);
  font-weight: 600;
}
.theme-btn-chev {
  flex: none;
  color: var(--muted);
  transform: rotate(180deg); /* закрыто — стрелка вниз; открыто — вверх, к списку */
  transition: transform 200ms var(--ease-out);
}
.theme-btn[aria-expanded="true"] .theme-btn-chev {
  transform: none;
}
/* Меню над кнопками (темы, аккаунт) — всплывает и плавно появляется */
.side-pop {
  position: absolute;
  bottom: calc(100% + 6px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--glass-border);
  border-radius: 16px; /* внутренний радиус пункта 10px + отступ 6px */
  background: linear-gradient(145deg, rgba(48, 32, 20, 0.96), rgba(30, 18, 10, 0.96));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  transform-origin: bottom center;
  animation: theme-pop 180ms var(--ease-out);
}
html[data-theme="dark"] .side-pop {
  background: linear-gradient(145deg, rgba(44, 44, 48, 0.97), rgba(26, 26, 29, 0.97));
}
html:is([data-theme="winter"], [data-theme="aurora"]) .side-pop {
  background: linear-gradient(145deg, rgba(30, 42, 80, 0.97), rgba(14, 20, 44, 0.97));
}
.side-pop[hidden] {
  display: none;
}
.theme-pick {
  right: 0; /* кнопка темы справа — меню выравниваем по её правому краю */
  min-width: 170px;
}
.acct-pop {
  left: 0;
  min-width: 210px;
}
/* Пункты меню аккаунта */
.pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease-out;
}
.pop-item svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.pop-item.danger,
.pop-item.danger svg {
  color: var(--danger);
}
.pop-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
@keyframes theme-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}
.theme-pick label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 150ms ease-out;
}
.theme-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.theme-label {
  flex: 1;
}
/* Выбранная тема — цветом акцента и галочкой справа */
.theme-pick label:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.theme-pick label:has(input:checked)::after {
  content: "";
  width: 10px;
  height: 5px;
  margin: 0 4px 3px 0;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.theme-pick label:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.swatch-sunset {
  background: linear-gradient(135deg, #fbb931, #ea6113); /* образец темы — всегда свой цвет */
}
.swatch-autumn {
  background: linear-gradient(135deg, #e8a33d, #c2401f 55%, #8f2d17);
}
.swatch-dark {
  background: linear-gradient(135deg, #3a3a3e, #121214);
}
.swatch-winter { background: linear-gradient(135deg, #d8f2ff, #538fcf); }
.swatch-aurora { background: linear-gradient(135deg, #8df0d2, #6d43b4); }
@media (hover: hover) {
  .theme-pick label:hover,
  .pop-item:hover {
    background: var(--hover);
  }
  .theme-btn:hover,
  .acct-btn:hover {
    background: var(--glass-fill-strong);
  }
}
/* Плавная смена темы: браузер снимает «снимок» старой страницы и растворяет его в новой
   (View Transitions, theme.js). Только прозрачность, без сдвигов — поэтому и при «меньше движения». */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 600ms;
  animation-timing-function: ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .side-pop {
    animation: none;
  }
}
.quota-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  font-size: 0.8125rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.quota-card p {
  margin: 8px 0 0;
}
.quota-card p.muted {
  margin-top: 2px;
  font-size: 0.75rem;
}
.quota-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.quota-bar div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent-mid), var(--accent));
}

/* Кнопка аккаунта: кто вошёл; нажатие — меню «Сменить аккаунт / Выйти из аккаунта» */
.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition-property: border-color, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.account-chip[aria-expanded="true"] {
  border-color: var(--accent);
}
.account-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.account-chip svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  min-width: 0;
  min-height: calc(100vh - 4rem);
  padding: 24px 28px 32px;
}
.crumbs {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 4px 0 22px;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.crumbs a {
  color: var(--text);
}
/* Заголовок панели файлов с линией под ним: 3px, цвет #D3D3D3 с прозрачностью 35%.
   Линия начинается там же, где надпись «Файлы», и с таким же отступом заканчивается справа.
   Отрицательные поля «съедают» отступы панели (24px сверху, 28px по бокам), сами отступы не меняются. */
.content-bar {
  position: relative;
  margin: -24px -28px 22px;
  padding: 16px 28px 19px; /* снизу +3px — место под линию */
}
.content-bar::after {
  content: "";
  position: absolute;
  left: 28px;  /* = отступ надписи слева */
  right: 28px; /* такой же отступ справа */
  bottom: 0;
  height: 3px;
  background: rgba(211, 211, 211, 0.35); /* #D3D3D3, 35% */
}
.content-bar .crumbs {
  margin: 0;
}
.crumbs .sep {
  color: var(--muted);
  font-weight: 400;
  margin: 0 2px;
}

/* Главный экран для гостя: описание слева, карточка входа справа */
.intro {
  padding: 4px 6px;
}
.intro-title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-wrap: balance;
}
.intro .muted {
  margin: 0;
  text-wrap: pretty;
}
.features {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  font-size: 0.875rem;
  line-height: 1.4;
}
.features svg {
  color: var(--accent);
  margin-top: 1px;
}
.content.auth {
  display: grid;
  place-items: center;
}
/* Карточка входа — стеклянная, как панели */
.auth-card {
  width: 100%;
  max-width: 428px; /* 380px содержимого + отступы по 24px */
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}
/* Заливка карточки в гамме «Закат»: от оранжевого EA6113 к тёмно-коричневому, непрозрачность 35% */
.auth-card.glass {
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-strong) 35%, transparent), var(--auth-end));
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}
/* Вход и регистрация лежат рядом; при переключении одна форма уезжает, другая въезжает (auth.js).
   overflow: clip прячет уезжающую форму за краем карточки; поля по 4px — чтобы не обрезать рамку фокуса. */
/* Вход/регистрация уезжают вбок внутри этой рамки. Рамка шире содержимого на 24px (весь отступ карточки):
   иначе свечение под кнопкой «Войти» (тень 6px + размытие 18px) обрезалось прямым краем — «кривая обводка». */
.auth-slider {
  position: relative;
  overflow: clip;
  margin: -24px;
  padding: 24px;
}
.auth-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-pane[hidden] {
  display: none;
}
.auth-card h1 {
  margin: 4px 0 0;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.auth-card .flash {
  margin: 0;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}
.auth-form input {
  height: 44px;
  color: var(--text);
}
.auth-form small {
  margin-top: -4px;
  font-size: 0.75rem;
}
.auth-form .primary {
  height: 44px;
  margin-top: 6px;
  font-weight: 600;
  border-radius: 12px;
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(12, 6, 2, 0.35);
  border: 1px solid var(--glass-border);
}
.segmented a {
  display: grid;
  place-items: center;
  height: 38px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  transition-property: background-color, color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.segmented a[aria-current="page"] {
  background: var(--glass-fill-strong);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}
.tile {
  position: relative;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
  transition-property: background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.tile-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 12px;
  color: var(--text);
  border-radius: 14px;
}
.thumb {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
}
.folder {
  width: 84px;
  height: 68px;
  stroke: none;
}
.folder-back {
  fill: var(--folder-back);
}
.folder-front {
  fill: var(--accent-mid);
  transition-property: fill;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.photo {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.05);
  outline: 1px solid rgba(255, 255, 255, 0.1);
  outline-offset: -1px;
}
.doc {
  position: relative;
  width: 64px;
  height: 82px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f4f0fb, #e2daf3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
}
.doc::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28%;
  height: 22%;
  background: rgba(0, 0, 0, 0.14);
  border-bottom-left-radius: 4px;
}
/* Цвета меток подобраны так, чтобы белый текст читался: контраст от 4,9:1 до 6,7:1 */
.doc span {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 10px;
  padding: 2px 0;
  border-radius: 4px;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 800;
  color: #fff;
  background: #9a3412;
  letter-spacing: 0.03em;
  overflow: hidden;
  white-space: nowrap;
}
.doc-pdf span {
  background: #be123c;
}
.doc-doc span {
  background: #1d4ed8;
}
.doc-sheet span {
  background: #15803d;
}
.doc-slides span {
  background: #c2410c;
}
.doc-archive span {
  background: #a16207;
}
.doc-video span {
  background: #a21caf;
}
.doc-audio span {
  background: #be185d;
}
/* Миниатюра видео: кадр с 1-й секунды и значок «▶» поверх. Не удалось взять кадр — значок формата */
.vthumb {
  position: relative;
  display: grid;
  place-items: center;
}
.vthumb video {
  display: block;
  pointer-events: none;
}
.vthumb.broken video {
  background: color-mix(in srgb, #a21caf 40%, transparent);  /* кадр не получить (.avi и т. п.) — цветная плашка */
}
.play-badge {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.play-badge svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  fill: #fff;
  stroke: none;
}
/* Папка показывается в Jellyfin — значок киноплёнки в правом нижнем углу папки */
.jf-badge {
  position: absolute;
  top: 74px;
  left: calc(50% + 22px);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--on-accent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  pointer-events: none;
}
.jf-badge[hidden] {
  display: none;
}
.jf-badge svg {
  width: 14px;
  height: 14px;
}

/* ---------- Просмотрщик фото, видео и музыки (viewer.js) ---------- */
.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(6, 6, 8, 0.97);
  color: #f2f2f5;
  overflow: hidden;
}
.viewer::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.viewer[open] {
  display: grid;
  grid-template-rows: auto 1fr;
  animation: viewer-in 180ms var(--ease-out);
}
@keyframes viewer-in {
  from {
    opacity: 0;
  }
}
.viewer-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}
.viewer-count {
  flex: none;
  min-width: 3ch;
  color: rgba(242, 242, 245, 0.7);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.viewer-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #f2f2f5;
}
.viewer-btn svg {
  width: 20px;
  height: 20px;
}
.viewer-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 64px 24px;
  touch-action: pan-y pinch-zoom;
}
.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: viewer-in 160ms var(--ease-out);
}
.viewer-stage img {
  cursor: zoom-in;
  object-fit: contain;
}
.viewer-stage video {
  width: 100%;
  background: #000;
}
/* Фото в настоящем размере: двигается прокруткой */
.viewer-stage.zoomed {
  display: block;
  overflow: auto;
  text-align: center;
}
.viewer-stage.zoomed img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}
.viewer-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(460px, 100%);
  padding: 28px 24px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
  overflow-wrap: anywhere;
}
.viewer-note {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 24px;
  background: linear-gradient(135deg, #be185d, #7c3aed);
  box-shadow: 0 10px 30px rgba(190, 24, 93, 0.35);
}
.viewer-note svg {
  width: 56px;
  height: 56px;
  stroke: #fff;
}
.viewer-audio audio {
  width: 100%;
  margin-top: 8px;
}
.viewer-fail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #f2f2f5;
}
.viewer-nav svg {
  width: 26px;
  height: 26px;
}
.viewer-nav.prev {
  left: 10px;
}
.viewer-nav.next {
  right: 10px;
}
.viewer.single .viewer-nav {
  display: none;
}
.viewer-btn:focus-visible,
.viewer-nav:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) {
  .viewer-btn:hover,
  .viewer-nav:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}
/* Телефон: стрелки не занимают место у картинки — листаем свайпом, кнопки поменьше по краям */
@media (max-width: 640px) {
  .viewer-stage {
    padding: 0 0 16px;
  }
  .viewer-nav {
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.35);
  }
}

/* Имя файла: две строки, а при наведении или фокусе — полностью, поверх соседей */
.tile-name {
  position: relative;
  width: 100%;
  height: 2.6em;
  font-size: 0.8125rem;
  line-height: 1.3;
  text-align: center;
}
.tile-name span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  border-radius: 6px;
}
/* Фокус «с клавиатуры» (:focus-visible), а не любой: щелчок мышью оставляет фокус на плитке,
   и с :focus-within кнопки и подложка имени «залипали» после того, как мышь ушла */
.tile:has(:focus-visible) .tile-name span {
  position: relative;
  z-index: 3;
  display: block;
  overflow: visible;
  background: #2c1d12;
  box-shadow: 0 0 0 4px #2c1d12;
}

/* Кружок выделения и кнопки (скачать, переименовать, удалить) — один ряд с одинаковыми промежутками:
   ряд тянется от края до края плитки, первое место пустое — там стоит кружок .check (left 8px, 24px),
   а space-between делит свободное место поровну. Все значки 24px, как кружок, и на одной высоте. */
.tile-actions {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none; /* пустые места ряда не мешают нажимать на плитку */
}
.tile-actions::before {
  content: "";
  flex: none;
  width: 24px; /* место кружка выделения */
}
.tile:has(:focus-visible) .tile-actions,
.tile:has(:focus-visible) .check {
  opacity: 1;
}
.tile-actions form {
  display: contents;
}
.tile-actions a,
.tile-actions button {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  pointer-events: auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(24, 14, 8, 0.9);
  color: var(--text);
}
.tile-actions svg {
  width: 14px;
  height: 14px;
}
.empty-state {
  margin-top: 60px;
  text-align: center;
  font-size: 1.0625rem;
}
.empty-state p {
  margin: 6px 0;
  text-wrap: pretty;
}

/* Очередь загрузки: заголовок с общей полосой и список файлов, у каждого — свой статус */
.upq {
  margin-bottom: 16px;
  padding: 10px 12px 8px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.upq[hidden],
.upq-btn[hidden],
.upq-list[hidden] {
  display: none;
}
.upq-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.upq-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
.upq-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.8125rem;
}
.upq-bar {
  height: 4px;
  margin: 8px 0 6px;
  border-radius: 2px;
  background: var(--glass-fill-strong);
  overflow: hidden;
}
.upq-bar > div {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 200ms ease-out;
}
.upq-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px; /* длинная очередь прокручивается, а не растягивает страницу */
  overflow-y: auto;
}
.upq-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 2px 4px;
  border-radius: 8px;
}
.upq-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upq-state {
  flex: none;
  color: var(--muted);
}
.upq-item.up .upq-state {
  color: var(--accent);
}
.upq-item.done .upq-state {
  color: var(--ok);
}
.upq-item.error .upq-state {
  color: var(--danger);
  white-space: normal;
  max-width: 55%;
  text-align: end;
}
.upq-item.cancel .upq-name,
.upq-item.done .upq-name {
  color: var(--muted);
}
.upq-x {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.upq-x[hidden] {
  visibility: hidden; /* место под крестиком остаётся — статусы в столбик не прыгают */
  display: block;
}
@media (hover: hover) {
  .upq-x:hover {
    color: var(--text);
    background: var(--glass-fill-strong);
  }
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  pointer-events: none;
  background: rgba(20, 12, 7, 0.7);
  backdrop-filter: blur(4px);
}
.drop-overlay div {
  padding: 28px 40px;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  font-size: 1.125rem;
  color: var(--accent);
  background: rgba(40, 24, 14, 0.8);
}
.drop-overlay.over {
  display: grid;
}

/* Выделение */
.check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgba(236, 230, 247, 0.55);
  background: rgba(24, 14, 8, 0.75);
  color: transparent;
  opacity: 0;
}
.check svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}
body.selecting .check {
  opacity: 1;
}
.tile.selected {
  background: color-mix(in srgb, var(--accent-mid) 20%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.tile.selected .check {
  opacity: 1;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.tile.moving {
  opacity: 0.45;
}
.selbar {
  position: sticky;
  top: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -6px 0 16px;
  padding: 8px 10px 8px 16px;
  border-radius: 14px;
  background: rgba(40, 24, 14, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.selbar[hidden] {
  display: none;
}
.selbar #selcount {
  font-weight: 600;
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}
.selbar button {
  border-radius: 10px;
}
.selbar .sel-tg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sel-tg svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--accent);
}
/* Короткое сообщение внизу экрана («Отправляю в Telegram…») — само исчезает через 4,5 с */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(145deg, rgba(48, 32, 20, 0.96), rgba(30, 18, 10, 0.96));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 0.875rem;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition:
    opacity 200ms var(--ease-out),
    transform 200ms var(--ease-out);
}
html[data-theme="dark"] .toast {
  background: linear-gradient(145deg, rgba(44, 44, 48, 0.97), rgba(26, 26, 29, 0.97));
}
html:is([data-theme="winter"], [data-theme="aurora"]) .toast {
  background: linear-gradient(145deg, rgba(30, 42, 80, 0.97), rgba(14, 20, 44, 0.97));
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.error {
  border-color: var(--danger);
}
/* Меню разделов в левой панели: «Облако», «Умный дом» */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 500;
  transition-property: background-color, border-color, color, box-shadow, translate;
  transition-duration: 200ms;
  transition-timing-function: var(--ease-out);
}
.side-nav a svg {
  color: var(--muted);
}
.side-nav a[aria-current="page"] {
  background: var(--glass-fill-strong);
  border-color: var(--glass-border);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.side-nav a[aria-current="page"] svg {
  color: var(--accent);
}

/* Подсказка в боковой панели: где теперь загрузка и создание */
.side-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.side-hint svg {
  color: var(--accent);
  margin-top: 2px;
}
.side-hint p {
  margin: 0;
  text-wrap: pretty;
}

/* Меню правой кнопки мыши — стеклянное, как панели */
.ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 230px;
  padding: 6px;
  border-radius: 16px; /* внутренний радиус пункта 10px + отступ 6px */
  background: linear-gradient(145deg, rgba(48, 32, 20, 0.92), rgba(30, 18, 10, 0.92));
}
.ctx-menu[hidden] {
  display: none;
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-align: start;
  font-size: 0.875rem;
  white-space: nowrap;
}
.ctx-item svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}
.ctx-item:focus-visible {
  outline: none;
  background: var(--glass-fill-strong);
}
.ctx-item:disabled {
  opacity: 0.45;
  cursor: default;
}
.ctx-item.danger,
.ctx-item.danger svg {
  color: var(--danger);
}
.ctx-item .chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.ctx-item[aria-expanded="true"] {
  background: var(--glass-fill-strong);
}

/* Окно «Название»: создать папку / файл, переименовать */
.name-dialog {
  width: min(460px, calc(100vw - 32px));
}
.name-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}
.field input {
  height: 44px;
  font-size: 1rem;
  color: var(--text);
}
.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.type-grid[hidden] {
  display: none;
}
.type-grid legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.type-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  font-size: 0.8125rem;
  cursor: pointer;
  transition-property: border-color, background-color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.type-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-choice:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.type-choice:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.type-badge {
  flex: none;
  min-width: 44px;
  padding: 3px 0;
  border-radius: 6px;
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 800;
  color: #fff;
  background: #9a3412;
}
.type-badge.doc-doc {
  background: #1d4ed8;
}
.type-badge.doc-sheet {
  background: #15803d;
}
.name-dialog .dialog-buttons {
  gap: 8px;
  padding-top: 18px;
}
.name-dialog .primary {
  font-weight: 600;
}

.ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--glass-border);
}
.tile {
  -webkit-touch-callout: none; /* на iPhone долгое нажатие открывает наше меню, а не системное */
}

/* Панель сортировки — на месте «Выбрано», те же размеры; кнопки — такие же прямоугольники */
.bar-label {
  font-weight: 600;
  margin-right: 4px;
}
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  color: var(--text);
  white-space: nowrap;
  transition-property: border-color, background-color, color;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.bar-btn svg {
  width: 16px;
  height: 16px;
}
.bar-btn[aria-current] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-weight: 600;
}
.bar-end {
  margin-left: auto; /* направление сортировки — справа, как кнопки «Переместить/Удалить» */
}
.lasso {
  position: fixed;
  z-index: 40;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-radius: 4px;
  pointer-events: none;
}

/* Перетаскивание в папки и из папок */
body.dragging .crumbs a {
  padding: 2px 8px;
  margin: 0 -4px;
  border-radius: 8px;
  outline: 1px dashed var(--line);
}
.drop-over {
  background: color-mix(in srgb, var(--accent-strong) 35%, transparent) !important;
  box-shadow: inset 0 0 0 2px var(--accent) !important;
}
.crumbs a.drop-over {
  outline-color: var(--accent);
}

.move-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: 70vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: #231710;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.move-dialog::backdrop {
  background: rgba(10, 5, 2, 0.6);
  backdrop-filter: blur(3px);
}
.move-dialog form {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.move-dialog h2 {
  margin: 0;
  padding: 16px 18px 10px;
  font-size: 1.0625rem;
}
.folder-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 10px;
}
.folder-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: start;
  border: 0;
  border-radius: 10px;
  background: none;
  padding: 9px 12px;
  color: var(--text);
}
.folder-choice svg {
  color: var(--accent);
}
.folder-choice:disabled {
  opacity: 0.4;
  cursor: default;
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  padding: 10px 18px 14px;
}

/* Умный дом: подключение Home Assistant */
.ha-connect {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ha-connect h2 {
  margin: 0;
  font-size: 1.125rem;
}
.ha-connect > p {
  margin: 0;
  text-wrap: pretty;
}
.ha-form-buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.ha-form-buttons .primary {
  margin-top: 0;
  flex: 1;
}
.ha-form-buttons .btn {
  display: grid;
  place-items: center;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  color: var(--text);
}
.ha-disconnect {
  margin-top: 10px;
}
.ha-disconnect .danger {
  color: var(--danger);
}
.ha-status.error {
  color: var(--danger);
}

/* Раздел «Telegram»: подключение бота к аккаунту */
.tg-card {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tg-card h2 {
  margin: 0;
  font-size: 1.125rem;
}
.tg-card p {
  margin: 0;
  line-height: 1.85; /* строкам с плашкой-кнопкой нужен воздух, иначе они слипаются */
  text-wrap: pretty;
}
.tg-features li {
  line-height: 1.85;
}
.tg-features {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-card .primary {
  margin-top: 0;
  width: 100%;
}
.tg-card .btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  color: var(--text);
}
.tg-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-links li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
}
.tg-links .danger {
  color: var(--danger);
}
.tg-card .tg-note {
  font-size: 0.8125rem;
  line-height: 1.5; /* в подсказках плашек нет — обычный интервал */
}
/* Кнопка бота, упомянутая в тексте: маленькая стеклянная плашка с иконкой */
.tg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px 1px 7px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill-strong);
  color: var(--text);
  margin: 0 3px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
}
.tg-chip svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Умный дом: устройства */
.ha-group h2 {
  margin: 8px 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ha-group + .ha-group {
  margin-top: 22px;
}
.ha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.ha-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  transition-property: background-color, border-color, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.ha-card.on {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.ha-card.alert {
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}
.ha-card.unavailable {
  opacity: 0.55;
}
.ha-card[aria-busy="true"] {
  opacity: 0.75;
}
.ha-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-right: 52px; /* место под переключатель справа */
}
.ha-card:not(:has(.ha-switch)) .ha-head {
  padding-right: 0;
}
.ha-icon {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.ha-card.on .ha-icon {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-mid));
  color: var(--on-accent);
}
/* «Шесть точек» внизу слева карточки — потянуть, чтобы поменять карточки местами */
.ha-move {
  flex: none;
  width: 24px;
  height: 24px;
  margin-right: auto; /* слева; «Это свет» и «Скрыть» остаются справа */
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  opacity: 0.55;
}
.ha-move svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}
.ha-card:hover .ha-move,
.ha-move:focus-visible {
  opacity: 1;
}
.ha-move:hover {
  color: var(--accent);
}
.ha-card.dragging {
  opacity: 0.75;
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  cursor: grabbing;
}
.ha-card.dragging .ha-move {
  cursor: grabbing;
}

/* Карандаш у названия устройства: виден при наведении или фокусе (на телефоне — всегда) */
.ha-rename {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  opacity: 0;
}
.ha-rename svg {
  width: 14px;
  height: 14px;
}
.ha-card:hover .ha-rename,
.ha-rename:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .ha-rename {
    opacity: 0.7;
  }
}
.ha-rename:hover {
  color: var(--accent);
}
.ha-name[hidden],
.ha-rename[hidden] {
  display: none;
}
.ha-name-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 4px 8px;
  font-weight: 600;
}
.ha-name {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: break-word; /* переносим по словам; длинное слово — по слогам (hyphens), а не «Умна / я» */
  hyphens: auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ha-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}
.ha-text.ha-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ha-card.alert .ha-text {
  color: var(--danger);
}

/* Переключатель вкл/выкл — справа вверху карточки */
.ha-switch {
  position: absolute; /* относительно .ha-inner (внутри отступов карточки по 14px) */
  top: 4px;
  right: 0;
  width: 46px;
  height: 28px;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--border-input);
}
.ha-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition-property: translate, background-color;
  transition-duration: 180ms;
  transition-timing-function: var(--ease-out);
}
.ha-switch[aria-checked="true"] {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-mid));
  border-color: transparent;
}
.ha-switch[aria-checked="true"] span {
  translate: 18px 0;
  background: #fff7ea;
}
.ha-switch:disabled {
  cursor: default;
}
.ha-range input {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--accent-strong);
}
/* Оттенок белого: полоса от тёплого (слева) к холодному (справа), белый кружок-ползунок */
.ha-ct input {
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  margin: 6px 0 2px;
  border-radius: 5px;
  background: linear-gradient(90deg, #ff9f43, #ffd9a8 35%, #fff6ea 60%, #d6e6ff);
  cursor: pointer;
}
.ha-ct input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #2a1206;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.ha-ct input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #2a1206;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.ha-ct input:disabled {
  opacity: 0.4;
  cursor: default;
}
.ha-ct-labels {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
  font-size: 0.6875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ha-btns {
  display: flex;
  gap: 6px;
}
.ha-btns button {
  flex: 1;
  padding: 7px 6px;
  font-size: 0.8125rem;
}
.ha-temp {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.ha-temp button {
  height: 40px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}
.ha-temp b {
  display: block;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.ha-temp small {
  font-size: 0.75rem;
}

/* «Умный дом» — это пульт, а не текст: случайные двойные клики, Ctrl+A и перетаскивание ползунков
   не должны выделять надписи синим. Поля ввода (название, адрес, токен) выделяются как обычно.
   Так же и «Telegram» (.content.tg): там только кнопки и пара строк пояснений. */
.content.smart,
.content.tg,
.side {
  -webkit-user-select: none; /* левая панель — навигация, выделять в ней нечего (на любой странице) */
  user-select: none;
}
.content.smart input,
.content.smart textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* Дашборд «Сегодня» вверху «Умного дома»: приветствие и часы, погода, сводка дома */
section.today {
  margin-bottom: 22px;
}
.today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}
/* Средний экран: часы с календарём и погода рядом, «Дом» — строкой ниже на всю ширину.
   Широкий экран: все три в ряд; левый блок шире — в нём часы и календарь бок о бок. */
@media (min-width: 1000px) {
  .today-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .today-home {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1500px) {
  .today-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 0.9fr);
  }
  .today-home {
    grid-column: auto;
  }
}
.today-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
}
.today-card p {
  margin: 0;
}
.today-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.today-greet {
  font-weight: 600;
}
/* Часы — крупно, в закатном градиенте */
.today-time {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid) 55%, var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wx-now {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wx-icon svg {
  width: 40px;
  height: 40px;
  color: var(--accent);
}
.wx-temp {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wx-desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
}
.wx-desc small {
  font-size: 0.75rem;
}
.wx-hours {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0 0 2px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none; /* часы листаются пальцем или колесом, полоса прокрутки не нужна */
}
.wx-hours::-webkit-scrollbar {
  display: none;
}
.wx-hours li {
  flex: 1 0 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--muted);
}
.wx-hours b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wx-hours svg,
.wx-days svg {
  width: 18px;
  height: 18px;
}
.wx-days {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
  border-top: 1px solid var(--glass-border);
}
.wx-days li {
  display: grid;
  grid-template-columns: 1fr 22px 42px 36px;
  align-items: center;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.wx-days b,
.wx-days .muted {
  text-align: right;
}
.home-lights {
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-lights svg {
  color: var(--accent);
}
.home-on {
  font-size: 0.8125rem;
}
.home-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}
.home-status .ok {
  color: var(--ok);
}
.home-status .warn {
  color: var(--accent);
}
.home-status .bad {
  color: var(--danger);
  font-weight: 600;
}
.today-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.today-hello .today-part {
  flex: 0 1 auto;
}
.today-light {
  flex: 1 1 140px; /* рядом, если помещаются; на узком экране — друг под другом на всю ширину */
  white-space: nowrap;
}

/* Размеры частей «Сегодня»: уголок справа внизу — тянем мышью (как ширину карточек устройств) */
.today-part {
  position: relative;
  min-width: 0;
}
.part-grip {
  position: absolute;
  right: -6px;
  bottom: -6px;
  z-index: 3;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 150ms;
}
.today-card.today-part > .part-grip {
  right: 4px; /* у целой карточки уголок — внутри её скругления */
  bottom: 4px;
}
/* Сам уголок — две линии, как у растягиваемого окна */
.part-grip::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  border-bottom-right-radius: 3px;
}
/* Пока тянем — рядом подсказка с текущим размером */
.part-grip::after {
  content: attr(data-pct);
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: #2c1d12;
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.today-part:hover > .part-grip,
.ha-card:hover > .part-grip,
.part-grip:focus-visible,
.today-part.resizing > .part-grip,
.ha-card.resizing > .part-grip {
  opacity: 1;
}
.part-grip:hover::before,
.today-part.resizing > .part-grip::before,
.ha-card.resizing > .part-grip::before {
  border-color: var(--accent);
}
.today-part.resizing > .part-grip::after,
.ha-card.resizing > .part-grip::after,
.part-grip:focus-visible::after {
  display: block;
}
/* Содержимое карточки устройства: уголок размера увеличивает его, сама карточка остаётся в колонке */
.ha-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
/* У карточки устройства уголок — внутри её скругления; правая полоска ширины кончается выше него */
.ha-card > .card-grip {
  right: 2px;
  bottom: 2px;
}
.ha-card.resizing {
  outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}
.today-part.resizing {
  outline: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 4px;
  border-radius: 12px;
}
.today-card.today-part.resizing {
  outline-offset: -1px;
  border-radius: 16px;
}
@media (hover: none) {
  .part-grip {
    opacity: 0.35; /* на сенсорном экране наведения нет — уголок виден всегда, но неярко */
  }
}
.today-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

/* Левый блок «Сегодня»: часы слева, календарь на месяц справа (на узком экране — под часами) */
.today-hello {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.today-clock {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 120px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.cal-title {
  padding: 2px 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
}
.cal-back {
  color: var(--accent);
}
.cal-nav {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.125rem;
  line-height: 1;
}
.cal-grid {
  border-collapse: collapse;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.cal-grid th {
  width: 25px;
  padding: 0 0 4px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.cal-grid td {
  padding: 1px;
  text-align: center;
}
.cal-day {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
}
.cal-grid .we {
  color: var(--weekend); /* выходные — тёплым цветом, 7,9:1 к фону */
}
/* Сегодняшний день — закатный кружок */
.cal-day.is-today {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-mid));
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent-strong) 45%, transparent);
}

/* Умный дом: «Скрыть» на карточке, спрятанные устройства, погода */
.ha-foot {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
/* Широкая карточка занимает две колонки; на телефоне — всю ширину */
.ha-card.wide {
  grid-column: span 2;
}
/* Узкий экран: в одну колонку не умещается две, поэтому широкая карточка — на всю ширину */
@media (max-width: 1000px) {
  .ha-card.wide {
    grid-column: 1 / -1;
  }
  .ha-grip {
    display: none;
  }
}
/* Полоска справа: за неё тянут мышью, чтобы сделать карточку шире или уже */
.ha-grip {
  position: absolute;
  top: 12px;
  bottom: 26px; /* ниже — уголок размера карточки */
  right: -7px;
  width: 14px;
  cursor: ew-resize;
  touch-action: none;
  border-radius: 8px;
}
.ha-grip::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  left: 6px;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.ha-grip:hover::after {
  background: var(--accent);
}
.ha-hide {
  padding: 2px 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.8125rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ha-hide:hover {
  color: var(--text);
}
.hidden-dev {
  opacity: 0.6;
  border-style: dashed;
}
.bar-btn[hidden] {
  display: none;
}
.ha-temp-big {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ha-meta {
  font-size: 0.75rem;
}

/* ---------- Сценарии умного дома (scenes.js) ---------- */
.scenes {
  margin: 4px 0 14px;
}
.scenes-title {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scenes-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.scene-chip {
  display: flex;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-fill);
  overflow: hidden;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.scene-chip.done {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}
.scene-chip.fail {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent);
}
.scene-run {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px 0 12px;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: 600;
}
.scene-icon {
  font-size: 1.25rem;
  line-height: 1;
}
.scene-run.busy .scene-icon {
  animation: scene-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes scene-pulse {
  to {
    opacity: 0.3;
    transform: scale(0.85);
  }
}
.scene-edit {
  display: grid;
  place-items: center;
  width: 38px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--glass-border);
  border-radius: 0;
  background: none;
  color: var(--muted);
}
.scene-edit svg {
  width: 15px;
  height: 15px;
}
.scene-add {
  min-height: 46px;
  padding: 0 16px;
  border: 1px dashed var(--glass-border);
  border-radius: 14px;
  background: none;
  color: var(--accent);
  font-weight: 600;
}
.scene-empty {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 0.8125rem;
}
@media (hover: hover) {
  .scene-run:hover,
  .scene-edit:hover,
  .scene-add:hover {
    background: var(--hover);
  }
}
/* Окно настройки сценария */
.scene-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: 88vh;
}
.scene-dialog form {
  max-height: 88vh;
}
.scene-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 0 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.scene-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.scene-icons legend {
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}
.scene-ico {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 10px;
}
.scene-ico[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--hover);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.scene-hint {
  margin: 0;
  font-size: 0.8125rem;
}
.scene-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
}
.scene-quick span {
  color: var(--muted);
}
.scene-quick button {
  padding: 5px 10px;
  font-size: 0.8125rem;
}
.scene-group h3 {
  margin: 6px 0 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}
.scene-dev {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.scene-dev.active {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--hover);
}
.scene-dev-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.scene-dev select,
.scene-extra select {
  font: inherit;
  font-size: 0.875rem;
  padding: 6px 8px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}
.scene-extras {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.scene-extra {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.scene-extra[hidden] {
  display: none;
}
.scene-extra input[type="range"] {
  width: 140px;
  accent-color: var(--accent-strong);
}
.scene-extra input[type="number"] {
  width: 72px;
}
.scene-extra output {
  min-width: 5ch;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.scene-error {
  margin: 8px 18px 0;
  color: var(--danger);
  font-size: 0.875rem;
}
.scene-error:empty {
  display: none;
}
.scene-dialog .dialog-buttons {
  gap: 8px;
}
.scene-delete {
  margin-right: auto;
}
.scene-delete[hidden] {
  display: none;
}

/* ---------- Расходы (электричество) ---------- */
.ex-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.ex-tile,
.ex-panel,
.ex-empty {
  padding: 16px 18px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-fill);
}
.ex-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ex-label {
  color: var(--muted);
  font-size: 0.8125rem;
}
.ex-big {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ex-small {
  font-size: 0.8125rem;
}
.ex-panel,
.ex-empty {
  margin-top: 14px;
}
.ex-panel h2,
.ex-empty h2 {
  margin: 0 0 12px;
  font-size: 1.0625rem;
}
.ex-empty p {
  margin: 0;
}
/* Столбики по дням месяца */
.ex-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  height: 150px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ex-chart li {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.ex-bar {
  width: 100%;
  max-width: 22px;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  opacity: 0.75;
}
.ex-chart li.today .ex-bar {
  opacity: 1;
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
}
.ex-chart small {
  font-size: 0.625rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ex-chart li.today small {
  color: var(--accent);
  font-weight: 700;
}
.ex-chart li.future small {
  opacity: 0.45;
}
/* Таблица устройств */
.ex-table-wrap {
  overflow-x: auto;
}
.ex-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.ex-table th,
.ex-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  white-space: nowrap;
}
.ex-table thead th {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}
.ex-table th[scope="row"],
.ex-table thead th:first-child {
  text-align: left;
  white-space: normal;
}
.ex-table tbody tr:last-child > * {
  border-bottom: 0;
}
.ex-table td small {
  display: block;
  font-size: 0.75rem;
}
.ex-name {
  font-weight: 600;
}
.ex-kind {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  vertical-align: 1px;
}
.ex-kind.measured {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
}
.ex-kind.estimate {
  background: var(--glass-fill-strong);
  color: var(--muted);
}
.ex-watts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}
.ex-watts input,
.ex-settings input {
  width: 72px;
  padding: 4px 8px;
  text-align: right;
}
.ex-share {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--glass-fill-strong);
}
.ex-share span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}
.ex-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.ex-settings label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ex-msg.ok {
  color: var(--ok);
}
.ex-msg.error {
  color: var(--danger);
}
.ex-note {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  text-wrap: pretty;
}

/* Эффекты наведения — только там, где есть мышь: на сенсорном экране они «залипают» после касания */
@media (hover: hover) {
  a:hover {
    text-decoration: underline;
  }
  .logo:hover,
  .tile-link:hover,
  .crumbs a:hover {
    text-decoration: none;
  }
  .btn:hover,
  button:hover {
    border-color: var(--accent);
    text-decoration: none;
  }
  .primary:hover,
  .side-btn.main:hover {
    filter: brightness(1.1);
    border-color: transparent; /* общая рамка при наведении легла бы ободком поверх градиента */
  }
  .side-btn:hover {
    background: var(--glass-fill-strong);
  }
  .segmented a:not([aria-current]):hover {
    color: var(--text);
    text-decoration: none;
    background: var(--glass-fill);
  }
  .tile:hover {
    background: var(--hover);
  }
  .tile:hover .folder-front {
    fill: var(--folder-hover);
  }
  .tile:hover .tile-actions,
  .tile:hover .check {
    opacity: 1;
  }
  .tile:hover .tile-name span {
    position: relative;
    z-index: 3;
    display: block;
    overflow: visible;
    background: #2c1d12;
    box-shadow: 0 0 0 4px #2c1d12;
  }
  .tile-actions a:hover,
  .tile-actions button:hover {
    border-color: var(--accent);
  }
  .tile-actions .danger:hover,
  .selbar .danger:hover {
    border-color: var(--danger);
    color: var(--danger);
  }
  /* Вкладки «Облако» / «Умный дом»: при наведении рамка теплеет и появляется мягкое свечение */
  .side-nav a:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow:
      0 0 24px color-mix(in srgb, var(--accent-strong) 18%, transparent),
      inset 0 1px 0 rgba(255, 255, 255, 0.14);
    text-decoration: none;
  }
  .side-nav a:not([aria-current]):hover {
    background: var(--glass-fill);
  }
  .ctx-item:hover:not(:disabled) {
    background: var(--glass-fill-strong);
  }
  .type-choice:hover {
    border-color: var(--accent);
  }
  .bar-btn:hover {
    border-color: var(--accent);
    background: var(--glass-fill-strong);
    text-decoration: none;
  }
  .folder-choice:hover:not(:disabled) {
    background: var(--hover);
  }
  .ha-disconnect .danger:hover {
    border-color: var(--danger);
  }
  .ha-switch:disabled:hover {
    border-color: var(--border-input);
  }
}
/* На сенсорных экранах наведения нет — кнопки плиток видны всегда */
@media (hover: none) {
  .tile-actions,
  .check {
    opacity: 1;
  }
}

/* Узкий экран (телефон): панели друг под другом, отступы меньше */
@media (max-width: 760px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin: 0; /* боковые поля 3rem — для компьютера; на телефоне они съедали четверть ширины */
    padding: 12px;
  }
  .side {
    position: static;
    height: auto;
    min-height: 0;
  }
  .side-bottom {
    margin-top: 0;
  }
  .content {
    min-height: 0;
    padding: 18px 16px 28px;
  }
  .content.auth {
    padding: 24px 16px;
  }
  .content-bar {
    margin: -18px -16px 18px; /* отступы панели на телефоне: 18px сверху, 16px по бокам */
    padding: 14px 16px 17px;
  }
  .content-bar::after {
    left: 16px;
    right: 16px;
  }
  .grid {
    /* по две плитки в ряд: в узкую плитку не помещались кружок выделения и три кнопки */
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .tile-actions {
    opacity: 1;
  }
  input {
    font-size: 1rem;
  } /* меньше 16px — iPhone увеличивает страницу при вводе */

  /* Сортировка в «Облаке»: подпись своей строкой, четыре кнопки в ряд, кнопки компактнее */
  .sortbar {
    gap: 6px;
    padding: 8px 10px;
  }
  .sortbar .bar-label {
    flex-basis: 100%;
  }
  .sortbar .bar-btn {
    padding: 6px 10px;
  }

  /* «Умный дом» на телефоне */
  .content.smart .selbar {
    position: static; /* липкая полоса на узком экране закрывала часы и карточки */
    gap: 8px;
    padding: 10px 12px;
  }
  .content.smart .selbar .ha-status {
    flex-basis: 100%; /* «Подключено · устройств» — своей строкой под «Home Assistant» */
    margin-top: -4px;
  }
  .content.smart .selbar .bar-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .content.smart .bar-end {
    margin-left: 0;
  }
  /* Часы сверху, календарь под ними — на всю ширину, числа по центру клеток */
  .today-hello {
    flex-direction: column;
    align-items: stretch;
  }
  .today-hello .today-part {
    width: 100%;
  }
  .cal-grid {
    width: 100%;
  }
  .cal-grid th {
    width: auto;
  }
  .cal-day {
    margin: 0 auto;
    width: 30px;
    height: 30px;
  }
  .cal-grid {
    font-size: 0.8125rem;
  }
  /* Показания и датчики — маленькие карточки, на телефоне по две в ряд */
  .ha-group[data-key="sensor"] .ha-grid,
  .ha-group[data-key="binary_sensor"] .ha-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* В этих узких карточках значок отнимал место у названия — убираем, название мельче */
  .ha-group[data-key="sensor"] .ha-icon,
  .ha-group[data-key="binary_sensor"] .ha-icon {
    display: none;
  }
  .ha-group[data-key="sensor"] .ha-name,
  .ha-group[data-key="binary_sensor"] .ha-name {
    font-size: 0.8125rem;
  }
  .ha-group[data-key="sensor"] .ha-card,
  .ha-group[data-key="binary_sensor"] .ha-card {
    padding: 12px;
  }
}

/* ---------- Редактор текстовых файлов (edit.html, editor.js) ---------- */
.editor-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.editor-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-back,
.editor-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
}
.editor-back svg,
.editor-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editor-status {
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}
.editor-status[data-state="error"] {
  color: var(--danger);
}
.editor-form {
  margin: 0;
}
#ed-text {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: calc(100vh - 4rem - 140px);
  min-height: 320px;
  resize: vertical;
  padding: 14px 16px;
  font: 15px/1.55 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  tab-size: 4;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-input);
  border-radius: 12px;
  caret-color: var(--accent);
}
#ed-text:focus {
  outline: none;
  border-color: var(--accent);
}
#ed-text:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (max-width: 640px) {
  .editor-status {
    display: none;  /* на телефоне места мало: состояние видно по кнопке */
  }
  #ed-text {
    height: calc(100vh - 220px);
    font-size: 16px;  /* меньше 16px — iPhone приближает страницу при вводе */
  }
}

/* Winter canvas scene, behind the glass panels. */
html[data-theme="winter"] .winter-snow { z-index: -1; overflow: hidden; }
.winter-snow::before, .winter-snow::after { content: none; }
.winter-snow canvas { display: block; }

/* Decorative folder faces follow the selected site theme. */
.folder .folder-art { display: none; pointer-events: none; }
html:not([data-theme]) .folder-art-sunset,
html[data-theme="sunset"] .folder-art-sunset,
html[data-theme="autumn"] .folder-art-autumn,
html[data-theme="winter"] .folder-art-winter,
html[data-theme="dark"] .folder-art-dark,

.folder .folder-art { transform-origin: 40px 39px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .folder .folder-art { transition: transform .35s ease; }
  .tile:hover .folder-art { transform: translateY(-1px) rotate(-4deg); }
}


/* Seasonal detail sits inside rounded panel corners. */
html[data-theme="winter"] { --season-corner: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20120%20100%22%3E%3Cg%20stroke%3D%22%23dcf5ff%22%20fill%3D%22none%22%20stroke-linecap%3D%22round%22%3E%3Cg%20opacity%3D%22.77%22%20stroke-width%3D%221.5%22%3E%3Cpath%20d%3D%22M88%2030v27M76%2043h24M79.5%2034.5l17%2017M96.5%2034.5l-17%2017M84%2034l4%204%204-4M84%2053l4-4%204%204M78%2039l4%204-4%204M98%2039l-4%204%204%204%22/%3E%3C/g%3E%3Cg%20opacity%3D%22.42%22%20stroke-width%3D%221.2%22%3E%3Cpath%20d%3D%22M50%2017v17M42%2025h16M44%2019l12%2012M56%2019L44%2031M108%2065v15M100%2072h16M103%2067l10%2010M113%2067l-10%2010%22/%3E%3C/g%3E%3Ccircle%20cx%3D%2268%22%20cy%3D%2262%22%20r%3D%222%22%20fill%3D%22%23fff%22%20opacity%3D%22.55%22/%3E%3Ccircle%20cx%3D%2227%22%20cy%3D%2216%22%20r%3D%221.5%22%20fill%3D%22%23fff%22%20opacity%3D%22.55%22/%3E%3C/g%3E%3C/svg%3E"); }
html[data-theme="autumn"] { --season-corner: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20120%20100%22%3E%3Cpath%20d%3D%22M113%2010Q80%209%2066%2030T35%2061%22%20fill%3D%22none%22%20stroke%3D%22%23a76746%22%20stroke-width%3D%221.8%22/%3E%3Cg%20fill%3D%22%23d49246%22%3E%3Cpath%20d%3D%22M72%2023Q61%208%2048%2018Q54%2034%2072%2023Z%22/%3E%3Cpath%20d%3D%22M54%2041Q38%2028%2028%2041Q39%2055%2054%2041Z%22/%3E%3C/g%3E%3Cg%20fill%3D%22%23b55c38%22%3E%3Cpath%20d%3D%22M92%2014Q80%2029%2096%2037Q107%2022%2092%2014Z%22/%3E%3Cpath%20d%3D%22M37%2060Q22%2050%2014%2064Q27%2075%2037%2060Z%22/%3E%3C/g%3E%3C/svg%3E"); }
html:is([data-theme="winter"],[data-theme="autumn"]) :is(.content.glass,.side.glass) {
  background-image: var(--season-corner), linear-gradient(145deg,rgba(255,255,255,.09),rgba(255,255,255,.03));
  background-repeat: no-repeat;
  background-position: right 8px top 7px, center;
  background-size: 95px 80px, 100% 100%;
}
html[data-theme="winter"] .glass {
  border-color: rgba(192,231,255,.35);
  box-shadow: 0 12px 40px rgba(4,16,35,.45), inset 0 1px 12px rgba(224,246,255,.22);
}
html[data-theme="winter"] .editor #ed-text {
  background-image: var(--season-corner),
    radial-gradient(ellipse at top right,rgba(190,229,255,.24),transparent 48%),
    linear-gradient(135deg,rgba(215,239,255,.09),transparent 35%);
  background-repeat: no-repeat;
  background-position: right 10px top 9px, center, center;
  background-size: 105px 88px, 100% 100%, 100% 100%;
  border: 1px solid rgba(196,232,255,.62);
  box-shadow: inset 0 0 20px rgba(188,229,255,.19), 0 0 0 1px rgba(200,238,255,.12);
}
html[data-theme="autumn"] .editor #ed-text {
  background-image: var(--season-corner),linear-gradient(135deg,rgba(194,109,37,.12),transparent 35%);
  background-repeat: no-repeat;
  background-position: right 10px top 9px, center;
  background-size: 105px 88px,100% 100%;
  border-color: rgba(221,157,75,.5);
}
html[data-theme="aurora"] .glass {
  border-color: rgba(139,232,212,.3);
  box-shadow: 0 12px 40px rgba(5,15,25,.45), inset 0 2px 10px rgba(156,124,241,.17), inset 0 -2px 10px rgba(83,225,182,.12);
}

.auth-form .password-field {
  position: relative;
  display: block;
}
.auth-form .password-field input {
  width: 100%;
  padding-right: 52px;
}
.auth-form .password-eye {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.auth-form .password-eye svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-form .password-eye:hover,
.auth-form .password-eye[aria-pressed="true"] {
  color: var(--accent);
  background: var(--hover);
}
.auth-form .password-eye:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
