/* Тёмно-фиолетовая тема */
: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);
}
* {
  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: linear-gradient(160deg, #24150b 0%, #140c07 55%, #0b0604 100%)
    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%,
      rgba(234, 97, 19, 0.38),
      transparent 70%
    ),
    radial-gradient(34% 30% at 70% 78%, rgba(248, 143, 34, 0.24), transparent 70%);
}
body::after {
  background:
    radial-gradient(
      32% 28% at 80% 22%,
      rgba(251, 185, 49, 0.2),
      transparent 70%
    ),
    radial-gradient(
      30% 26% at 28% 80%,
      rgba(234, 97, 19, 0.22),
      transparent 70%
    );
}
@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), #f88f22);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow:
    0 6px 18px rgba(234, 97, 19, 0.35),
    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), #f88f22);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow:
    0 6px 18px rgba(234, 97, 19, 0.35),
    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;
}
.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), #f88f22, #fbb931);
}

/* Аккаунт: два прямоугольника рядом — кто вошёл и «Выйти» */
.account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0;
}
.account-chip,
.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  font-size: 0.875rem;
}
.account-chip {
  color: var(--text);
  min-width: 0;
}
.account-chip svg,
.account-btn svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-btn {
  color: var(--text);
  font-weight: 500;
}

.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, rgba(234, 97, 19, 0.35), rgba(42, 18, 6, 0.35));
  border-color: rgba(251, 185, 49, 0.25);
}
/* Вход и регистрация лежат рядом; при переключении одна форма уезжает, другая въезжает (auth.js).
   overflow: clip прячет уезжающую форму за краем карточки; поля по 4px — чтобы не обрезать рамку фокуса. */
.auth-slider {
  position: relative;
  overflow: clip;
  margin: -4px;
  padding: 4px;
}
.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: #c44f0e;
}
.folder-front {
  fill: #f88f22;
  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;
}

/* Имя файла: две строки, а при наведении или фокусе — полностью, поверх соседей */
.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;
}
.tile:focus-within .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:focus-within .tile-actions,
.tile:focus-within .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;
}

#progress {
  position: relative;
  min-height: 28px; /* длинное сообщение (например, «слишком большая загрузка») растягивает полосу */
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
#bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
  opacity: 0.3;
  transition-property: width;
  transition-duration: 200ms;
  transition-timing-function: ease-out;
}
/* «Отменить» — справа на полосе загрузки, пока файлы отправляются */
#pcancel {
  position: absolute;
  top: 2px;
  right: 3px;
  z-index: 1;
  height: 22px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 0.8125rem;
  line-height: 1;
}
#pcancel[hidden] {
  display: none;
}
#ptext {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 96px 4px 12px; /* справа место под «Отменить» */
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.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: rgba(248, 143, 34, 0.2);
  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;
}
/* Меню разделов в левой панели: «Облако», «Умный дом» */
.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: rgba(251, 185, 49, 0.12);
}
.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: rgba(251, 185, 49, 0.12);
  font-weight: 600;
}
.bar-end {
  margin-left: auto; /* направление сортировки — справа, как кнопки «Переместить/Удалить» */
}
.lasso {
  position: fixed;
  z-index: 40;
  border: 1px solid var(--accent);
  background: rgba(251, 185, 49, 0.15);
  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: rgba(234, 97, 19, 0.35) !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);
}

/* Умный дом: устройства */
.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: rgba(251, 185, 49, 0.12);
  border-color: rgba(251, 185, 49, 0.45);
}
.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), #f88f22);
  color: var(--on-accent);
}
.ha-name {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  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;
  top: 18px;
  right: 14px;
  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), #f88f22);
  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-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;
}

/* Дашборд «Сегодня» вверху «Умного дома»: приветствие и часы, погода, сводка дома */
.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, #fbb931, #f88f22 55%, #ea6113);
  -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 {
  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-card > .card-grip {
  right: 2px;
  bottom: 2px;
}
.ha-card.resizing {
  outline: 1px dashed rgba(251, 185, 49, 0.55);
  outline-offset: 2px;
}
.today-part.resizing {
  outline: 1px dashed rgba(251, 185, 49, 0.55);
  outline-offset: 4px;
  border-radius: 12px;
}
.today-card.today-part.resizing {
  outline-offset: -1px;
  border-radius: 16px;
}
@media (hover: none) {
  .part-grip {
    opacity: 0.6; /* на сенсорном экране наведения нет — уголок виден всегда */
  }
}
.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: #f0a868; /* выходные — тёплым цветом, 7,9:1 к фону */
}
/* Сегодняшний день — закатный кружок */
.cal-day.today {
  background: linear-gradient(135deg, var(--accent-strong), #f88f22);
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(234, 97, 19, 0.45);
}

/* Умный дом: «Скрыть» на карточке, спрятанные устройства, погода */
.ha-foot {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}
/* Широкая карточка занимает две колонки; на телефоне — всю ширину */
.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;
}

/* Эффекты наведения — только там, где есть мышь: на сенсорном экране они «залипают» после касания */
@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);
  }
  .side-btn:hover,
  .account-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: #fba245;
  }
  .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: rgba(251, 185, 49, 0.35);
    box-shadow:
      0 0 24px rgba(234, 97, 19, 0.18),
      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;
    padding: 1rem;
  }
  .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(100px, 1fr));
  }
  .tile-actions {
    opacity: 1;
  }
  input {
    font-size: 1rem;
  } /* меньше 16px — iPhone увеличивает страницу при вводе */
}
