/* ============================================================
   Напоминалка — тёплая «бумажная» тема, один акцент — коралл.
   ============================================================ */

:root {
  color-scheme: light;
  --paper: #434a4e;
  --paper-deep: #373e42;
  --card: #8f9699;
  --surface: #9aa0a2;
  --surface-2: #828a8d;
  --ink: #1d2224;
  --ink-soft: #2a3033;
  --muted: #394144;
  --muted-2: #485255;
  --line: rgba(30, 35, 38, 0.11);
  --line-strong: rgba(30, 35, 38, 0.18);

  --coral: #c94f3d;
  --coral-2: #dc6a54;
  --coral-deep: #7d3025;
  --coral-soft: #d8b1a9;
  --mint: #1f5f50;
  --mint-soft: #b8d0c6;
  --gold: #6f5628;
  --gold-soft: #cfc1a3;
  --dot-gray: #5b6367;
  --send-a: #6d767a;
  --send-b: #4d565b;
  --avatar-a: #8b9295;
  --avatar-b: #5e676b;

  --radius-app: 28px;
  --shadow-app: 0 40px 90px -40px rgba(20, 25, 28, 0.65), 0 2px 0 rgba(255, 255, 255, 0.22) inset;
  --shadow-card: 0 18px 44px -30px rgba(25, 30, 34, 0.48);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --custom-window: #f3ede4;
  --custom-bubble: #ef5a42;
  --custom-bubble-ink: #fffdfa;
  --custom-on-window: #3c3645;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 8% -12%, rgba(186, 196, 202, 0.20) 0%, rgba(186, 196, 202, 0) 62%),
    radial-gradient(900px 700px at 104% 112%, rgba(15, 20, 24, 0.38) 0%, rgba(15, 20, 24, 0) 58%),
    linear-gradient(155deg, #5b6369 0%, #454c51 52%, #343a3f 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body::after { display: none; }

::selection { background: rgba(239, 90, 66, 0.22); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1em;
  height: 1em;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* ---------- Каркас ---------- */

.app {
  position: relative;
  width: min(1180px, 100%);
  height: min(880px, calc(100dvh - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  background: var(--card);
  border: 1px solid rgba(62, 46, 38, 0.08);
  border-radius: var(--radius-app);
  box-shadow: var(--shadow-app);
  overflow: hidden;
}

/* ---------- Анимация отправки в список ---------- */

.msg.is-departing {
  animation: none;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.flight-clone {
  position: fixed !important;
  z-index: 130;
  margin: 0 !important;
  pointer-events: none;
  transform-origin: center;
  box-shadow: 0 30px 60px -30px rgba(62, 42, 30, 0.55);
}
.flight-clone .rc-actions,
.flight-clone .rc-btn { display: none; }

.reminder-item.is-arriving-target {
  opacity: 0;
  pointer-events: none;
}
.reminder-item.is-arriving { animation: arrivalPulse 0.95s ease; }
.icon-btn.is-arriving { animation: arrivalIcon 0.75s ease; }

@keyframes arrivalPulse {
  0% { background: rgba(239, 90, 66, 0.2); transform: scale(0.985); }
  45% { background: rgba(239, 90, 66, 0.11); transform: scale(1.01); }
  100% { background: transparent; transform: none; }
}
@keyframes arrivalIcon {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.14); }
}

/* ---------- Чат ---------- */

.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(760px 340px at 108% -8%, rgba(255, 213, 195, 0.55) 0%, rgba(255, 213, 195, 0) 64%),
    radial-gradient(520px 340px at -12% 108%, rgba(224, 218, 245, 0.5) 0%, rgba(224, 218, 245, 0) 62%),
    linear-gradient(180deg, #fffdfa 0%, #fdf7ef 100%);
}

.topbar {
  flex: none;
  height: 78px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.72);
  backdrop-filter: blur(14px);
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: transparent;
  overflow: hidden;
  box-shadow: 0 10px 22px -12px rgba(190, 28, 112, 0.75);
}
.logo img { width: 100%; height: 100%; display: block; }
.logo .icon { width: 21px; height: 21px; stroke-width: 1.9; }
.logo-spark { display: none; }

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.brand-text p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Полоса активного диалога напоминания */
.thread-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 248, 0.58);
  backdrop-filter: blur(10px);
}
.thread-back {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border-color: transparent;
  background: transparent;
}
.thread-back:hover { background: rgba(34, 30, 41, 0.05); border-color: var(--line); }
.thread-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.thread-copy strong {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-copy span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-new {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: var(--coral-soft);
  color: var(--coral-deep);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.thread-new .icon { width: 12px; height: 12px; }
.thread-new:hover { background: var(--coral); color: #fff; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.notify-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.notify-chip:hover { background: #fff; border-color: rgba(239, 90, 66, 0.35); }
.notify-chip:active { transform: scale(0.98); }
.notify-chip .chip-bell { display: none; width: 15px; height: 15px; }

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(138, 130, 144, 0.12);
}
.notify-chip.is-on .status-dot,
.push-state.is-on .status-dot { background: var(--mint); box-shadow: 0 0 0 3px rgba(26, 131, 104, 0.14); }
.notify-chip.is-off .status-dot,
.push-state.is-off .status-dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.14); }
.notify-chip.is-blocked .status-dot,
.push-state.is-blocked .status-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(169, 116, 31, 0.16); }

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn:hover { background: #fff; border-color: rgba(239, 90, 66, 0.35); }
.panel-toggle, .panel-close { display: none; }

.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(239, 90, 66, 0.4);
}

/* ---------- Лента ---------- */

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 30, 41, 0.16) transparent;
}
.chat-scroll::-webkit-scrollbar { width: 8px; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(34, 30, 41, 0.14); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.messages {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 28px 12px;
}
.messages.no-anim .msg { animation: none; }

.msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 84%;
  animation: rise 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }
.msg.has-card { max-width: min(100%, 372px); }
.msg.has-card .avatar { display: none; }
.msg.has-card .stack { width: 100%; }
.msg.has-card .bubble { align-self: flex-start; max-width: 100%; }

@keyframes rise {
  from { opacity: 0; transform: translateY(9px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--avatar-a), var(--avatar-b));
  box-shadow: 0 6px 14px -8px rgba(30, 36, 40, 0.5);
}
.avatar .icon { width: 14px; height: 14px; }

.stack { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.user .stack { align-items: flex-end; }

.bubble {
  padding: 9px 15px 10px;
  border-radius: 17px 17px 17px 6px;
  background: #fbf4ea;
  border: 1px solid rgba(34, 30, 41, 0.07);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}
.user .bubble {
  border-radius: 17px 17px 6px 17px;
  background: linear-gradient(150deg, #332c3f 0%, #221e2a 100%);
  border-color: transparent;
  color: #fffdfa;
  box-shadow: 0 12px 26px -16px rgba(30, 24, 40, 0.75);
}

.msg-meta {
  font-size: 10px;
  letter-spacing: 0.01em;
  color: var(--muted-2);
  padding: 0 3px;
  font-variant-numeric: tabular-nums;
}
.user .msg-meta { text-align: right; }

/* Печатает… */
.typing .bubble { padding: 14px 16px; }
.typing-dots { display: flex; gap: 4px; align-items: center; height: 6px; }
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  animation: blink 1.15s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.14s; }
.typing-dots span:nth-child(3) { animation-delay: 0.28s; }
@keyframes blink {
  0%, 70%, 100% { opacity: 0.35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

/* Быстрые ответы */
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.quick-reply {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid rgba(34, 30, 41, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.quick-reply .icon { width: 12px; height: 12px; color: var(--coral); }
.quick-reply:hover { border-color: rgba(239, 90, 66, 0.4); color: var(--coral-deep); background: #fff; }

/* Свой вариант ответа */
.quick-custom {
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(300px, 100%);
  margin-top: 7px;
  padding: 3px 3px 3px 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(34, 30, 41, 0.18);
  border-radius: 12px;
  transition: border-color 0.16s, background 0.16s;
}
.quick-custom:focus-within {
  background: #fff;
  border-style: solid;
  border-color: rgba(239, 90, 66, 0.45);
}
.quick-custom-input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}
.quick-custom-input::placeholder { color: var(--muted-2); }
.quick-custom-send {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 12px -7px rgba(239, 90, 66, 0.8);
}
.quick-custom-send .icon { width: 13px; height: 13px; }
.quick-custom-send:hover { background: var(--coral-deep); }

/* ---------- Карточка напоминания ---------- */

.reminder-card {
  position: relative;
  width: 100%;
  padding: 15px 16px 13px;
  background: #fff;
  border: 1px solid rgba(34, 30, 41, 0.09);
  border-radius: 19px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.reminder-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #ff9a7e, #ef5a42);
}
.reminder-card[data-variant="due"] {
  background: #fffaf7;
  border-color: rgba(239, 90, 66, 0.28);
  animation: cardGlow 2.4s ease-out 1;
}
.reminder-card[data-variant="due"]::before { background: linear-gradient(180deg, #ef5a42, #b93422); }
@keyframes cardGlow {
  0% { box-shadow: 0 0 0 0 rgba(239, 90, 66, 0.25), var(--shadow-card); }
  100% { box-shadow: 0 0 0 14px rgba(239, 90, 66, 0), var(--shadow-card); }
}

.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-icon {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--coral-soft);
  color: var(--coral-deep);
}
.rc-icon .icon { width: 13px; height: 13px; }
.rc-kicker {
  flex: 1;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-status {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.reminder-card[data-variant="due"] .rc-status { background: var(--coral-soft); color: var(--coral-deep); }
.reminder-card.is-done .rc-status { background: rgba(34, 30, 41, 0.06); color: var(--muted); }
.reminder-card.is-cancelled .rc-status { background: rgba(34, 30, 41, 0.06); color: var(--muted); }

.rc-when { display: flex; align-items: flex-end; gap: 11px; margin-top: 11px; }
.rc-time {
  font-size: 31px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.rc-date { display: flex; flex-direction: column; gap: 2px; padding-bottom: 2px; min-width: 0; }
.rc-day { font-size: 12.5px; font-weight: 550; color: var(--ink-soft); }
.rc-rel { font-size: 10.5px; color: var(--muted); }

.rc-text {
  margin: 11px 0 0;
  font-size: 14.5px;
  line-height: 1.42;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.rc-repeat {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 550;
  color: var(--coral-deep);
}
.rc-repeat .icon { width: 12px; height: 12px; flex: none; }

.rc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.rc-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rc-btn .icon { width: 13px; height: 13px; }
.rc-btn.done { color: var(--mint); }
.rc-btn.done:hover { background: var(--mint-soft); }
.rc-btn.ghost { color: var(--ink-soft); margin-left: auto; }
.rc-btn.ghost:hover { background: rgba(34, 30, 41, 0.05); }
.rc-btn.danger { color: var(--muted-2); margin-left: auto; }
.rc-btn.ghost + .rc-btn.danger { margin-left: 0; }
.rc-btn.danger:hover { background: var(--coral-soft); color: var(--coral-deep); }

.reminder-card.is-done { opacity: 0.72; }
.reminder-card.is-done .rc-time { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.reminder-card.is-done .rc-text { color: var(--muted); }
.reminder-card.is-cancelled { opacity: 0.6; }
.reminder-card.is-cancelled .rc-actions { display: none; }
.reminder-card.is-busy { opacity: 0.65; pointer-events: none; }
.reminder-card.flash {
  border-color: rgba(239, 90, 66, 0.55);
  box-shadow: 0 0 0 4px rgba(239, 90, 66, 0.13), var(--shadow-card);
}

/* ---------- Зона ввода ---------- */

.composer-zone {
  flex: none;
  padding: 10px 26px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(253, 248, 241, 0) 0%, var(--surface) 22%);
  position: relative;
  z-index: 4;
}

.permission-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 10px 9px 11px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(239, 90, 66, 0.22);
  border-radius: 15px;
  box-shadow: 0 12px 30px -24px rgba(62, 42, 30, 0.5);
  animation: rise 0.4s ease both;
}
.pb-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--coral-soft);
  color: var(--coral-deep);
}
.pb-icon .icon { width: 15px; height: 15px; }
.pb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pb-text strong { font-size: 12px; font-weight: 650; }
.pb-text span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.pb-action {
  flex: none;
  padding: 7px 11px;
  border: 0;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(239, 90, 66, 0.8);
}
.pb-action:hover { background: var(--coral-deep); }
.pb-close {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
}
.pb-close .icon { width: 13px; height: 13px; }
.pb-close:hover { background: rgba(34, 30, 41, 0.05); color: var(--ink); }

.suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 1px 10px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 92%, transparent 100%);
}
.suggestions::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 11px;
  border: 1px solid rgba(34, 30, 41, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}
.chip:hover { color: var(--coral-deep); border-color: rgba(239, 90, 66, 0.35); background: #fff; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 16px;
  background: #fff;
  border: 1px solid rgba(34, 30, 41, 0.13);
  border-radius: 20px;
  box-shadow: 0 14px 34px -26px rgba(62, 42, 30, 0.55);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.10), 0 14px 34px -26px rgba(30, 36, 40, 0.4);
}
.composer.is-locked {
  background: rgba(255, 252, 248, 0.55);
  border-style: dashed;
  box-shadow: none;
}
.composer.is-locked:focus-within {
  border-color: rgba(34, 30, 41, 0.13);
  box-shadow: none;
}
.composer.is-locked textarea { color: var(--muted-2); cursor: not-allowed; }
.composer.is-locked .send { opacity: 0.35; box-shadow: none; }
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 118px;
  padding: 10px 0 9px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.4;
}
.composer textarea::placeholder { color: var(--muted-2); }

.mic {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.mic .icon { width: 18px; height: 18px; }
.mic:hover { color: var(--coral-deep); background: var(--coral-soft); }
.mic.is-listening {
  color: var(--coral-deep);
  background: var(--coral-soft);
  border-color: rgba(239, 90, 66, 0.25);
  animation: micPulse 1.3s ease-in-out infinite;
}
.mic:disabled { opacity: 0.35; cursor: default; animation: none; }
.composer.is-locked .mic { opacity: 0.35; }
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 90, 66, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(239, 90, 66, 0); }
}

.send {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--send-a), var(--send-b));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 20px -10px rgba(30, 36, 40, 0.45);
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}
.send .icon { width: 19px; height: 19px; stroke-width: 1.9; }
.send:hover { filter: brightness(1.04); }
.send:active { transform: scale(0.94); }
.send:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.composer-hint {
  margin: 8px 3px 0;
  font-size: 11.5px;
  color: var(--muted-2);
}
.composer-hint kbd {
  font-family: inherit;
  font-size: 10.5px;
  padding: 1px 4px;
  border: 1px solid rgba(34, 30, 41, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
}

/* ---------- Панель ---------- */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-2);
  border-left: 0;
  position: relative;
}

.panel-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 26px 22px 14px;
}
.panel-head > div:first-child { flex: 1; min-width: 0; }
.eyebrow {
  margin: 0 0 3px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.panel-head h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.new-thread {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 9px 10px;
  border: 1px solid rgba(239, 90, 66, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  text-align: left;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.new-thread:hover { background: #fff; border-color: rgba(239, 90, 66, 0.42); }
.new-thread-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #ff7d5f, #e74c35);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(221, 66, 43, 0.8);
}
.new-thread-icon .icon { width: 15px; height: 15px; }
.new-thread-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.new-thread-copy strong { font-size: 13px; font-weight: 650; color: var(--ink); }
.new-thread-copy small { font-size: 11px; color: var(--muted); }
.count {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.panel-tabs {
  flex: none;
  display: flex;
  gap: 3px;
  margin: 0 16px 10px;
  padding: 3px;
  background: rgba(34, 30, 41, 0.045);
  border-radius: 11px;
}
.panel-tabs button {
  flex: 1;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.panel-tabs button:hover { color: var(--ink-soft); }
.panel-tabs button.active {
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(34, 30, 41, 0.08);
}

.panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 12px calc(20px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 30, 41, 0.14) transparent;
}
.panel-list::-webkit-scrollbar { width: 7px; }
.panel-list::-webkit-scrollbar-thumb { background: rgba(34, 30, 41, 0.13); border-radius: 99px; }

.group-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 10px 7px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: linear-gradient(180deg, var(--surface-2) 72%, rgba(248, 241, 231, 0) 100%);
}
.group-title span { letter-spacing: 0; font-size: 11px; color: var(--muted-2); }

.reminder-item {
  position: relative;
  display: flex;
  gap: 11px;
  padding: 11px 10px;
  border-radius: 13px;
  transition: background 0.16s, box-shadow 0.16s;
}
.reminder-item + .reminder-item { margin-top: 1px; }
.reminder-item:hover {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 24px -22px rgba(62, 42, 30, 0.55);
}
.reminder-item.is-active {
  background: rgba(239, 90, 66, 0.07);
  box-shadow: none;
}
.reminder-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--coral);
}
.reminder-item.is-active .r-text { color: var(--ink); }
.reminder-item.is-active .r-time { color: var(--coral-deep); }

.r-time {
  width: 46px;
  flex: none;
  padding-top: 1px;
  text-align: right;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.r-time strong { display: block; font-weight: 650; }
.r-time small {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.r-main { flex: 1; min-width: 0; padding-right: 34px; }
.r-text {
  font-size: 15px;
  line-height: 1.38;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
.r-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted-2);
}
.r-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.r-repeat {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(239, 90, 66, 0.09);
  color: var(--coral-deep);
  font-size: 10.5px;
  font-weight: 600;
}

.r-actions {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
  padding-left: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 28%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.reminder-item:hover .r-actions,
.reminder-item:focus-within .r-actions { opacity: 1; pointer-events: auto; }
.r-btn {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.r-btn .icon { width: 13px; height: 13px; }
.r-btn:hover { background: var(--mint-soft); color: var(--mint); }
.r-btn.del:hover { background: var(--coral-soft); color: var(--coral-deep); }

.reminder-item.is-done .r-text { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--muted); }
.reminder-item.is-done .r-time { color: var(--muted); }

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 44px 24px 30px;
  text-align: center;
}
.empty-art {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px dashed rgba(34, 30, 41, 0.18);
  color: var(--coral);
  background: radial-gradient(circle at 35% 30%, #fff, #fdf3eb);
  box-shadow: 0 12px 30px -20px rgba(62, 42, 30, 0.45);
}
.empty-art .icon { width: 27px; height: 27px; }
.empty-art::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd9a6;
  border: 2px solid var(--surface-2);
}
.panel-empty strong { font-size: 15px; font-weight: 650; }
.panel-empty p { margin: 0; max-width: 220px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }

.panel-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(248, 241, 231, 0.92);
  backdrop-filter: blur(8px);
}
.push-state {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.push-state-text { display: flex; flex-direction: column; min-width: 0; }
.push-state-text strong { font-size: 11.5px; font-weight: 650; }
.push-state-text span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.test-push {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.test-push:hover { background: #fff; border-color: rgba(239, 90, 66, 0.35); }
.test-push:disabled { opacity: 0.45; cursor: default; }

/* ---------- Тост ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 440px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 12px;
  background: rgba(34, 30, 41, 0.95);
  color: #fffdfa;
  font-size: 12.5px;
  line-height: 1.35;
  box-shadow: 0 16px 40px -16px rgba(20, 15, 25, 0.7);
  animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  pointer-events: auto;
}
.toast .icon { width: 14px; height: 14px; flex: none; color: #ffd0c2; }
.toast.leaving { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Настройки ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 25, 35, 0.45);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.22s ease both;
}
.settings-sheet {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 40px 90px -30px rgba(30, 20, 25, 0.55);
  animation: sheetIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(32px); }
  to { opacity: 1; transform: none; }
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.settings-head h2 {
  margin: 2px 0 0;
  font-size: 23px;
  font-weight: 680;
  letter-spacing: -0.025em;
}
.settings-head .icon-btn { width: 34px; height: 34px; border-radius: 10px; }

.settings-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.theme-card {
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}
.theme-card:hover { border-color: rgba(239, 90, 66, 0.38); }
.theme-card:active { transform: scale(0.99); }
.theme-card.active {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.12);
}

.theme-preview {
  height: 82px;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  border: 1px solid;
  border-radius: 11px;
}
.theme-preview.light {
  background: linear-gradient(180deg, #fffdfa, #fdf3e9);
  border-color: rgba(34, 30, 41, 0.1);
}
.theme-preview.dark {
  background: linear-gradient(180deg, #241e2a, #121016);
  border-color: rgba(255, 255, 255, 0.14);
}
.theme-preview.custom {
  background: var(--custom-window);
  border-color: color-mix(in srgb, var(--custom-on-window) 18%, transparent);
}
.theme-preview.custom .pv-line { background: color-mix(in srgb, var(--custom-on-window) 24%, transparent); }
.theme-preview.custom .pv-bubble {
  background: color-mix(in srgb, var(--custom-bubble) 16%, #fffdfa);
}
.theme-preview.custom .pv-bubble.right { background: var(--custom-bubble); }
.theme-preview.custom .pv-input {
  background: color-mix(in srgb, var(--custom-window) 45%, #fff);
  border-color: color-mix(in srgb, var(--custom-on-window) 18%, transparent);
}
.pv-row { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.pv-dot { width: 7px; height: 7px; flex: none; border-radius: 3px; background: #ef5a42; }
.pv-line { height: 4px; border-radius: 2px; background: rgba(34, 30, 41, 0.16); }
.pv-row .pv-line { width: 45%; }
.pv-short { width: 32%; }
.pv-bubble {
  width: 66%;
  height: 13px;
  border-radius: 6px 6px 6px 2px;
  background: #f0e6d9;
}
.pv-bubble.right {
  align-self: flex-end;
  width: 48%;
  border-radius: 6px 6px 2px 6px;
  background: #2d2735;
}
.pv-input {
  margin-top: auto;
  height: 10px;
  border: 1px solid rgba(34, 30, 41, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8);
}
.theme-preview.dark .pv-line { background: rgba(255, 246, 238, 0.2); }
.theme-preview.dark .pv-bubble { background: #332b3b; }
.theme-preview.dark .pv-bubble.right { background: linear-gradient(145deg, #ff7d5f, #dd422b); }
.theme-preview.dark .pv-input {
  border-color: rgba(255, 246, 238, 0.12);
  background: rgba(255, 246, 238, 0.08);
}

.theme-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 3px 3px;
  font-size: 12.5px;
  font-weight: 600;
}
.theme-check {
  width: 18px;
  height: 18px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.16s, transform 0.16s;
}
.theme-check .icon { width: 11px; height: 11px; stroke-width: 2.4; }
.theme-card.active .theme-check { opacity: 1; transform: none; }

.custom-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
}
.custom-color { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 600; }
.custom-color-control {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
}
.custom-color input[type="color"] {
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.custom-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(34, 30, 41, 0.14); border-radius: 6px; }
.custom-color code { color: var(--ink-soft); font-family: var(--font); font-size: 10.5px; }
.custom-colors-hint { grid-column: 1 / -1; margin: 0; }

.settings-hint {
  margin: 14px 2px 0;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--muted);
}

.settings-divider {
  height: 1px;
  margin: 18px 0 16px;
  background: var(--line);
}

.notify-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}
.notify-setting-icon {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--coral-soft);
  color: var(--coral-deep);
}
.notify-setting-icon .icon { width: 17px; height: 17px; }
.notify-setting-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--muted-2);
}
.notify-setting.is-on .notify-setting-dot { background: var(--mint); }
.notify-setting.is-off .notify-setting-dot { background: var(--coral); }
.notify-setting.is-blocked .notify-setting-dot { background: var(--gold); }
.notify-setting-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notify-setting-copy strong { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.notify-setting-copy span { font-size: 10.5px; line-height: 1.4; color: var(--muted); }
.notify-setting-action {
  flex: none;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: filter 0.16s, opacity 0.16s;
}
.notify-setting-action:hover { filter: brightness(0.94); }
.notify-setting-action:disabled { opacity: 0.45; cursor: default; }

.settings-btn.has-notify-dot::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot-gray);
  box-shadow: none;
}

/* ---------- Календарь ---------- */

.calendar-sheet {
  position: relative;
  width: min(860px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 40px 90px -30px rgba(30, 20, 25, 0.55);
  animation: sheetIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.calendar-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.025em;
}
.calendar-head .icon-btn { width: 34px; height: 34px; border-radius: 10px; }

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}
.calendar-toolbar strong {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.cal-nav {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.cal-nav:hover { background: rgba(34, 30, 41, 0.05); border-color: var(--line-strong); }
.cal-today {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.cal-today:hover { background: rgba(239, 90, 66, 0.07); border-color: rgba(239, 90, 66, 0.3); }

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 20px;
  align-items: start;
}
.calendar-grid-wrap { min-width: 0; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 2px 4px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cal-day:hover { background: rgba(34, 30, 41, 0.05); }
.cal-day.is-other { color: var(--muted-2); opacity: 0.45; }
.cal-day.is-today { border-color: rgba(239, 90, 66, 0.45); }
.cal-day.is-selected {
  background: var(--coral);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(239, 90, 66, 0.8);
}
.cal-day-num { font-size: 12.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 6px;
  margin-top: 5px;
}
.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--coral);
}
.cal-dot.is-done { background: var(--muted-2); }
.cal-day.is-selected .cal-dot { background: #fff; }
.cal-day.is-selected .cal-dot.is-done { background: rgba(255, 255, 255, 0.65); }
.cal-more { font-size: 7px; line-height: 1; color: var(--muted); }
.cal-day.is-selected .cal-more { color: rgba(255, 255, 255, 0.8); }

.calendar-agenda { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cal-selected {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.cal-day-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 30, 41, 0.14) transparent;
}
.cal-reminder {
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
}
.cal-reminder:hover { background: rgba(34, 30, 41, 0.05); }
.cal-reminder.is-done { opacity: 0.55; }
.cal-reminder-time {
  width: 38px;
  flex: none;
  padding-top: 1px;
  color: var(--coral-deep);
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.cal-reminder-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-reminder-text {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.cal-reminder-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted-2);
  font-size: 9.5px;
}
.cal-repeat {
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(239, 90, 66, 0.09);
  color: var(--coral-deep);
}
.cal-empty {
  padding: 12px 8px 14px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.calendar-add {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.calendar-add .settings-label { margin-bottom: 6px; }
.calendar-add-row { display: flex; align-items: center; gap: 5px; }
.calendar-add-row input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.calendar-add-row input[type="text"]:focus {
  border-color: rgba(239, 90, 66, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.09);
}
.calendar-add-row input[type="time"] {
  width: 82px;
  height: 36px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
}
.calendar-add-row button {
  height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: var(--coral);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}
.calendar-add-row button:disabled { opacity: 0.4; cursor: default; }
.calendar-add-hint {
  margin: 7px 1px 0;
  color: var(--muted-2);
  font-size: 9.5px;
  line-height: 1.4;
}

/* ---------- Мобильная панель ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 25, 35, 0.36);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.25s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Адаптив ---------- */

@media (max-width: 980px) {
  body { padding: 0; }
  .app {
    grid-template-columns: 1fr;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .chat { height: 100dvh; }
  .panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(88vw, 360px);
    border-left: 0;
    box-shadow: -24px 0 60px -30px rgba(30, 25, 35, 0.5);
    transform: translateX(103%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    padding-top: env(safe-area-inset-top);
  }
  .app.panel-open .panel { transform: none; }
  .panel-toggle, .panel-close { display: grid; }
  .panel-head { padding-top: 22px; }
  .panel-close { margin-left: 2px; }
  .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  .topbar { height: 68px; padding: 0 15px; gap: 8px; }
  .brand { gap: 10px; }
  .logo { width: 40px; height: 40px; border-radius: 13px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { display: none; }
  .thread-bar { padding: 7px 14px; gap: 8px; }
  .thread-back { width: 30px; height: 30px; }
  .thread-copy strong { font-size: 12.5px; }
  .thread-copy span { font-size: 10px; }
  .thread-new { padding: 6px 9px; font-size: 10.5px; }
  .new-thread { margin: 0 12px 10px; padding: 8px 9px; }
  .notify-chip { padding: 0 11px; height: 34px; }
  .notify-label { display: none; }
  .notify-chip .chip-bell { display: block; }
  .icon-btn { width: 36px; height: 36px; }

  .messages { padding: 20px 15px 10px; gap: 14px; }
  .msg { max-width: 90%; }
  .msg.has-card { max-width: 100%; }
  .bubble { font-size: 14px; }

  .composer-zone { padding: 8px 14px calc(12px + env(safe-area-inset-bottom)); }
  .composer { padding: 6px 6px 6px 14px; }
  .send { width: 42px; height: 42px; }
  .composer-hint { display: none; }
  .suggestions { -webkit-mask-image: none; mask-image: none; padding-bottom: 8px; }

  .permission-banner { gap: 8px; padding: 8px; }
  .pb-icon { width: 27px; height: 27px; }
  .pb-text strong { font-size: 11.5px; }
  .pb-text span { font-size: 10.5px; }
  .pb-action { padding: 6px 9px; font-size: 11px; }
  .pb-close { display: none; }

  .rc-time { font-size: 29px; }
  .rc-text { font-size: 14px; }
  .reminder-card { padding: 14px 14px 12px; }

  .modal { padding: 0; place-items: end center; }
  .settings-sheet {
    width: 100%;
    max-height: calc(100dvh - 36px);
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    animation-name: sheetUp;
  }
  .calendar-sheet {
    width: 100%;
    max-height: calc(100dvh - 18px);
    padding: 18px 14px calc(14px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    animation-name: sheetUp;
  }
  .edit-sheet {
    width: 100%;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    animation-name: sheetUp;
  }
  .calendar-layout { grid-template-columns: 1fr; gap: 14px; }
  .calendar-grid-wrap { width: 100%; max-width: 430px; margin: 0 auto; }
  .cal-day { aspect-ratio: auto; min-height: 38px; }
  .cal-day-list { max-height: none; }
  .calendar-add-row { flex-wrap: wrap; }
  .calendar-add-row input[type="text"] { flex-basis: 100%; }
}

@media (max-width: 380px) {
  .messages { padding-left: 12px; padding-right: 12px; }
  .composer-zone { padding-left: 12px; padding-right: 12px; }
  .notify-chip { padding: 0 9px; }
  .rc-when { gap: 8px; }
}

@media (hover: none) {
  .r-actions { opacity: 1; pointer-events: auto; background: none; padding-left: 0; }
  .reminder-item .r-main { padding-right: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Поиск, редактирование, повторный сигнал ---------- */

.panel-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 12px 8px;
}
.panel-search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  pointer-events: none;
}
.panel-search input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 31px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.panel-search input::-webkit-search-cancel-button { display: none; }
.panel-search input:focus {
  border-color: rgba(239, 90, 66, 0.42);
  box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.08);
}
.panel-search-clear {
  position: absolute;
  right: 5px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.panel-search-clear .icon { width: 13px; height: 13px; }
.panel-search-clear:hover { background: rgba(34, 30, 41, 0.06); }
.search-summary {
  padding: 4px 4px 6px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thread-edit {
  width: 30px;
  height: 30px;
  flex: none;
  border-color: transparent;
  background: transparent;
  border-radius: 9px;
  color: var(--muted);
}
.thread-edit:hover { color: var(--ink); background: rgba(34, 30, 41, 0.06); }
.thread-edit .icon { width: 15px; height: 15px; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-row-copy { display: flex; flex-direction: column; gap: 2px; }
.settings-row-copy strong { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.settings-row-copy span { font-size: 10.5px; color: var(--muted); }
.settings-select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  outline: none;
}

.edit-sheet {
  position: relative;
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: 0 40px 90px -30px rgba(30, 20, 25, 0.55);
  animation: sheetIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.edit-field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 10.5px; }
.edit-field > span { font-weight: 600; letter-spacing: 0.01em; }
.edit-field textarea,
.edit-field input,
.edit-field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.edit-field textarea { min-height: 58px; resize: vertical; line-height: 1.4; }
.edit-field textarea:focus,
.edit-field input:focus,
.edit-field select:focus {
  border-color: rgba(239, 90, 66, 0.5);
  box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.09);
}
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-hint { margin: -2px 1px 0; color: var(--muted-2); font-size: 10px; line-height: 1.4; }
.edit-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.edit-cancel,
.edit-save {
  height: 36px;
  padding: 0 13px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}
.edit-cancel { border: 1px solid var(--line-strong); background: transparent; color: var(--muted); }
.edit-cancel:hover { background: rgba(34, 30, 41, 0.05); }
.edit-save { border: 0; background: var(--coral); color: #fff; }
.edit-save:hover { filter: brightness(0.94); }

.toast-action {
  flex: none;
  margin-left: 3px;
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffe0d6;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.22); }

/* ---------- Вход, синхронизация, backup ---------- */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(255, 160, 120, 0.28), transparent 60%),
    var(--paper);
}
.auth-card {
  width: min(380px, 100%);
  padding: 28px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 40px 100px -40px rgba(30, 20, 25, 0.5);
  text-align: center;
}
.auth-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  overflow: hidden;
  color: #fff;
  box-shadow: 0 16px 30px -16px rgba(190, 28, 112, 0.8);
}
.auth-logo img { width: 100%; height: 100%; display: block; }
.auth-logo .icon { width: 24px; height: 24px; }
.auth-card h1 { margin: 3px 0 8px; font-size: 26px; letter-spacing: -0.03em; }
.auth-text { margin: 0 auto 18px; max-width: 280px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form input {
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.auth-form input:focus { border-color: rgba(239, 90, 66, 0.5); box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.09); }
.auth-form button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.auth-form button:hover { filter: brightness(0.95); }
.auth-form button:disabled { opacity: 0.5; cursor: default; }
.auth-error { min-height: 16px; margin: 10px 0 0; color: #c8402b; font-size: 11px; }
.auth-note { margin: 12px 0 0; color: var(--muted-2); font-size: 10px; line-height: 1.45; }

.settings-action {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
}
.settings-action:hover { background: rgba(34, 30, 41, 0.05); }
.sync-setup { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.sync-setup input {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.sync-setup input:focus { border-color: rgba(239, 90, 66, 0.5); box-shadow: 0 0 0 3px rgba(239, 90, 66, 0.09); }
.sync-setup button {
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}
.sync-setup button:disabled { opacity: 0.4; cursor: default; }
.sync-setup .settings-hint { margin-top: 2px; }

.backup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.backup-btn {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
}
.backup-btn:hover { background: rgba(34, 30, 41, 0.05); }
.backup-btn.primary { border-color: transparent; background: var(--coral); color: #fff; }
.backup-btn.primary:hover { filter: brightness(0.95); background: var(--coral); }

/* ---------- Своя тема ---------- */

[data-theme="custom"] body { background: var(--custom-window); }
[data-theme="custom"] .auth-screen { background: var(--custom-window); }
[data-theme="custom"] .chat {
  background:
    radial-gradient(760px 340px at 108% -8%, color-mix(in srgb, var(--custom-window) 88%, #fff) 0%, transparent 64%),
    radial-gradient(520px 340px at -12% 108%, color-mix(in srgb, var(--custom-window) 94%, #000) 0%, transparent 62%),
    var(--custom-window);
}
[data-theme="custom"] .composer-zone {
  background: linear-gradient(180deg, transparent 0%, color-mix(in srgb, var(--custom-window) 18%, var(--surface)) 26%);
}
[data-theme="custom"] .panel {
  background: color-mix(in srgb, var(--custom-window) 20%, var(--surface-2));
}
[data-theme="custom"] .topbar {
  background: color-mix(in srgb, var(--custom-window) 12%, rgba(255, 252, 248, 0.78));
}
[data-theme="custom"] .thread-bar {
  background: color-mix(in srgb, var(--custom-window) 12%, rgba(255, 252, 248, 0.62));
}
[data-theme="custom"] .msg-meta { color: color-mix(in srgb, var(--custom-on-window) 70%, transparent); }
[data-theme="custom"] .chat-scroll { scrollbar-color: color-mix(in srgb, var(--custom-on-window) 30%, transparent) transparent; }
[data-theme="custom"] .chat-scroll::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--custom-on-window) 22%, transparent); }
[data-theme="custom"] .bubble {
  background: color-mix(in srgb, var(--custom-bubble) 14%, #fffdfa);
  border-color: color-mix(in srgb, var(--custom-bubble) 18%, transparent);
  color: var(--ink);
}
[data-theme="custom"] .user .bubble {
  background: var(--custom-bubble);
  border-color: transparent;
  color: var(--custom-bubble-ink);
  box-shadow: 0 12px 26px -16px rgba(20, 14, 25, 0.6);
}

/* ============================================================
   Тёмная тема
   ============================================================ */

:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #100d14;
  --paper-deep: #0b0910;
  --card: #1b1720;
  --surface: #211c26;
  --surface-2: #17131c;
  --ink: #f7f1e9;
  --ink-soft: #ddd3c9;
  --muted: #a398a8;
  --muted-2: #8a7e92;
  --line: rgba(247, 241, 233, 0.09);
  --line-strong: rgba(247, 241, 233, 0.16);

  --coral: #ff7459;
  --coral-2: #ff947c;
  --coral-deep: #ffa08a;
  --coral-soft: rgba(255, 116, 89, 0.15);
  --mint: #63d6b3;
  --mint-soft: rgba(99, 214, 179, 0.13);
  --gold: #e5b76a;
  --gold-soft: rgba(229, 183, 106, 0.15);
  --dot-gray: #b3acb2;
  --send-a: #8b9295;
  --send-b: #626a6f;
  --avatar-a: #9aa1a4;
  --avatar-b: #666e72;

  --shadow-app: 0 40px 100px -40px rgba(0, 0, 0, 0.92), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-card: 0 18px 44px -30px rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] body {
  background:
    radial-gradient(1100px 640px at 6% -12%, rgba(255, 116, 89, 0.16) 0%, rgba(255, 116, 89, 0) 62%),
    radial-gradient(900px 700px at 104% 112%, rgba(109, 80, 180, 0.24) 0%, rgba(109, 80, 180, 0) 58%),
    var(--paper);
}
[data-theme="dark"] ::selection { background: rgba(255, 116, 89, 0.3); }

[data-theme="dark"] .app {
  border-color: rgba(255, 246, 238, 0.06);
  box-shadow: var(--shadow-app);
}

[data-theme="dark"] .chat {
  background:
    radial-gradient(760px 340px at 108% -8%, rgba(255, 116, 89, 0.14) 0%, rgba(255, 116, 89, 0) 64%),
    radial-gradient(520px 340px at -12% 108%, rgba(109, 80, 180, 0.18) 0%, rgba(109, 80, 180, 0) 62%),
    linear-gradient(180deg, #1d1822 0%, #17131c 100%);
}

[data-theme="dark"] .topbar {
  background: rgba(27, 23, 32, 0.78);
  border-bottom-color: var(--line);
}

[data-theme="dark"] .notify-chip,
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .count,
[data-theme="dark"] .test-push {
  background: rgba(255, 246, 238, 0.05);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}
[data-theme="dark"] .notify-chip:hover,
[data-theme="dark"] .icon-btn:hover,
[data-theme="dark"] .test-push:hover {
  background: rgba(255, 246, 238, 0.09);
  border-color: rgba(255, 116, 89, 0.42);
}

[data-theme="dark"] .chat-scroll { scrollbar-color: rgba(255, 246, 238, 0.18) transparent; }
[data-theme="dark"] .chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 246, 238, 0.16);
  background-clip: content-box;
}
[data-theme="dark"] .panel-list { scrollbar-color: rgba(255, 246, 238, 0.16) transparent; }
[data-theme="dark"] .panel-list::-webkit-scrollbar-thumb { background: rgba(255, 246, 238, 0.14); }

[data-theme="dark"] .bubble {
  background: #241e2a;
  border-color: rgba(255, 246, 238, 0.07);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
[data-theme="dark"] .user .bubble {
  background: linear-gradient(150deg, #ff8165 0%, #e64f37 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .quick-reply {
  background: rgba(255, 246, 238, 0.05);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}
[data-theme="dark"] .quick-reply:hover {
  background: rgba(255, 116, 89, 0.12);
  border-color: rgba(255, 116, 89, 0.45);
  color: #ffb7a5;
}

[data-theme="dark"] .quick-custom {
  background: rgba(255, 246, 238, 0.04);
  border-color: rgba(255, 246, 238, 0.18);
}
[data-theme="dark"] .quick-custom:focus-within {
  background: rgba(255, 246, 238, 0.07);
  border-color: rgba(255, 116, 89, 0.5);
}
[data-theme="dark"] .quick-custom-input { color: var(--ink); }

[data-theme="dark"] .reminder-card {
  background: #221c28;
  border-color: rgba(255, 246, 238, 0.09);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .reminder-card[data-variant="due"] {
  background: #2b1e23;
  border-color: rgba(255, 116, 89, 0.32);
}
[data-theme="dark"] .rc-icon {
  background: rgba(255, 116, 89, 0.15);
  color: var(--coral-deep);
}
[data-theme="dark"] .rc-btn.ghost { color: var(--ink-soft); }
[data-theme="dark"] .rc-btn.ghost:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .rc-btn.danger:hover { background: var(--coral-soft); }
[data-theme="dark"] .reminder-card.is-done .rc-status,
[data-theme="dark"] .reminder-card.is-cancelled .rc-status {
  background: rgba(255, 246, 238, 0.08);
}
[data-theme="dark"] .reminder-card.is-done { opacity: 0.78; }

[data-theme="dark"] .composer-zone {
  background: linear-gradient(180deg, rgba(23, 19, 28, 0) 0%, #17131c 22%);
}
[data-theme="dark"] .permission-banner {
  background: rgba(34, 28, 40, 0.96);
  border-color: rgba(255, 116, 89, 0.26);
  box-shadow: 0 12px 30px -24px rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .pb-close:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .chip {
  background: rgba(255, 246, 238, 0.05);
  border-color: var(--line);
  color: var(--muted);
}
[data-theme="dark"] .chip:hover {
  background: rgba(255, 116, 89, 0.1);
  border-color: rgba(255, 116, 89, 0.35);
  color: #ffb7a5;
}

[data-theme="dark"] .composer {
  background: #241e2a;
  border-color: rgba(255, 246, 238, 0.15);
  box-shadow: 0 14px 34px -26px rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .composer:focus-within {
  border-color: rgba(255, 116, 89, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 116, 89, 0.12), 0 14px 34px -26px rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .composer-hint kbd {
  background: rgba(255, 246, 238, 0.05);
  border-color: var(--line);
}

[data-theme="dark"] .panel-tabs { background: rgba(255, 246, 238, 0.05); }
[data-theme="dark"] .panel-tabs button.active {
  background: #2a2430;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .group-title {
  background: linear-gradient(180deg, #17131c 72%, rgba(23, 19, 28, 0) 100%);
}
[data-theme="dark"] .reminder-item:hover {
  background: rgba(255, 246, 238, 0.055);
  box-shadow: 0 10px 24px -22px rgba(0, 0, 0, 0.9);
}
[data-theme="dark"] .r-actions {
  background: linear-gradient(90deg, rgba(37, 31, 43, 0), rgba(37, 31, 43, 0.97) 28%);
}
[data-theme="dark"] .r-repeat {
  background: rgba(255, 116, 89, 0.14);
  color: #ffb7a5;
}
[data-theme="dark"] .empty-art {
  border-color: rgba(247, 241, 233, 0.16);
  background: radial-gradient(circle at 35% 30%, #2a2430, #201a25);
  box-shadow: 0 12px 30px -20px rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .empty-art::after { border-color: var(--surface-2); }
[data-theme="dark"] .panel-foot { background: rgba(23, 19, 28, 0.94); }
[data-theme="dark"] .test-push { color: var(--ink-soft); }

[data-theme="dark"] .toast {
  background: #f4eee6;
  color: #221e29;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
}
[data-theme="dark"] .toast .icon { color: #d84b33; }

[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .settings-sheet {
  background: #1f1a24;
  border-color: var(--line-strong);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .theme-name { color: var(--ink); }
[data-theme="dark"] .theme-card:hover { border-color: rgba(255, 116, 89, 0.5); }
[data-theme="dark"] .notify-setting {
  background: rgba(255, 246, 238, 0.04);
  border-color: var(--line);
}
[data-theme="dark"] .quick-custom-send:hover,
[data-theme="dark"] .pb-action:hover { background: #e2533b; }

[data-theme="dark"] .thread-bar {
  background: rgba(27, 23, 32, 0.78);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .thread-back {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}
[data-theme="dark"] .thread-back:hover {
  background: rgba(255, 246, 238, 0.06);
  border-color: var(--line);
}
[data-theme="dark"] .thread-new { background: rgba(255, 116, 89, 0.14); color: #ffb7a5; }
[data-theme="dark"] .thread-new:hover { background: var(--coral); color: #221e29; }
[data-theme="dark"] .new-thread {
  background: rgba(255, 246, 238, 0.05);
  border-color: rgba(255, 116, 89, 0.22);
}
[data-theme="dark"] .new-thread:hover { background: rgba(255, 246, 238, 0.08); border-color: rgba(255, 116, 89, 0.45); }
[data-theme="dark"] .reminder-item.is-active { background: rgba(255, 116, 89, 0.13); }
[data-theme="dark"] .reminder-item.is-active .r-text { color: var(--ink); }
[data-theme="dark"] .composer.is-locked { background: rgba(255, 246, 238, 0.03); }
[data-theme="dark"] .composer.is-locked:focus-within { border-color: var(--line-strong); }

[data-theme="dark"] .calendar-sheet {
  background: #1f1a24;
  border-color: var(--line-strong);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .cal-nav,
[data-theme="dark"] .cal-today {
  border-color: var(--line);
  color: var(--ink-soft);
}
[data-theme="dark"] .cal-nav:hover,
[data-theme="dark"] .cal-today:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .cal-day:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .cal-day.is-selected { color: #221e29; }
[data-theme="dark"] .cal-day.is-selected .cal-dot { background: #221e29; }
[data-theme="dark"] .cal-day.is-selected .cal-dot.is-done { background: rgba(34, 30, 41, 0.5); }
[data-theme="dark"] .cal-day.is-selected .cal-more { color: rgba(34, 30, 41, 0.65); }
[data-theme="dark"] .cal-reminder:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .cal-repeat { background: rgba(255, 116, 89, 0.14); color: #ffb7a5; }
[data-theme="dark"] .calendar-add-row input[type="text"],
[data-theme="dark"] .calendar-add-row input[type="time"] {
  background: #241e2a;
  border-color: var(--line-strong);
}
[data-theme="dark"] .calendar-add-row input[type="text"]:focus {
  border-color: rgba(255, 116, 89, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 116, 89, 0.12);
}

[data-theme="dark"] .panel-search input {
  background: rgba(255, 246, 238, 0.04);
  border-color: var(--line);
}
[data-theme="dark"] .panel-search input:focus {
  border-color: rgba(255, 116, 89, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 116, 89, 0.1);
}
[data-theme="dark"] .panel-search-clear:hover,
[data-theme="dark"] .thread-edit:hover,
[data-theme="dark"] .edit-cancel:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .settings-select,
[data-theme="dark"] .edit-field textarea,
[data-theme="dark"] .edit-field input,
[data-theme="dark"] .edit-field select {
  background: #241e2a;
  border-color: var(--line-strong);
}
[data-theme="dark"] .edit-sheet {
  background: #1f1a24;
  border-color: var(--line-strong);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .edit-field textarea:focus,
[data-theme="dark"] .edit-field input:focus,
[data-theme="dark"] .edit-field select:focus {
  border-color: rgba(255, 116, 89, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 116, 89, 0.12);
}

[data-theme="dark"] .auth-card {
  background: #1f1a24;
  border-color: var(--line-strong);
  box-shadow: 0 40px 100px -40px rgba(0, 0, 0, 0.85);
}
[data-theme="dark"] .auth-form input,
[data-theme="dark"] .sync-setup input {
  background: #241e2a;
  border-color: var(--line-strong);
}
[data-theme="dark"] .auth-form input:focus,
[data-theme="dark"] .sync-setup input:focus {
  border-color: rgba(255, 116, 89, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 116, 89, 0.12);
}
[data-theme="dark"] .settings-action:hover,
[data-theme="dark"] .backup-btn:hover { background: rgba(255, 246, 238, 0.06); }
[data-theme="dark"] .auth-error { color: #ff9b83; }


/* ---------- Светлая тема: мокрый асфальт ---------- */
[data-theme="light"] .app {
  border-color: rgba(255, 255, 255, 0.16);
}
[data-theme="light"] .thread-bar {
  background: rgba(255, 255, 255, 0.09);
}
[data-theme="light"] .notify-chip,
[data-theme="light"] .icon-btn {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--line-strong);
}
[data-theme="light"] .notify-chip:hover,
[data-theme="light"] .icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}
[data-theme="light"] .bubble {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}
[data-theme="light"] .msg.user .bubble {
  background: linear-gradient(150deg, #3b4145 0%, #2d3236 100%);
  color: #f1eee8;
}
[data-theme="light"] .reminder-card {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="light"] .reminder-card[data-variant="due"] {
  background: color-mix(in srgb, var(--surface) 87%, var(--coral-soft));
  border-color: color-mix(in srgb, var(--coral) 35%, transparent);
}
[data-theme="light"] .composer {
  background: var(--surface);
  border-color: var(--line-strong);
}
[data-theme="light"] .composer.is-locked {
  background: color-mix(in srgb, var(--surface) 82%, var(--card));
}
[data-theme="light"] .composer-zone {
  background: linear-gradient(180deg, rgba(143, 150, 153, 0) 0%, var(--surface) 22%);
}
[data-theme="light"] .quick-reply,
[data-theme="light"] .chip,
[data-theme="light"] .new-thread,
[data-theme="light"] .quick-custom,
[data-theme="light"] .permission-banner,
[data-theme="light"] .panel-search,
[data-theme="light"] .test-push,
[data-theme="light"] .settings-action,
[data-theme="light"] .backup-btn,
[data-theme="light"] .settings-select {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--line-strong);
}
[data-theme="light"] .quick-reply:hover,
[data-theme="light"] .chip:hover,
[data-theme="light"] .new-thread:hover,
[data-theme="light"] .test-push:hover,
[data-theme="light"] .settings-action:hover,
[data-theme="light"] .backup-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}
[data-theme="light"] .panel-search input {
  background: transparent;
}
[data-theme="light"] .reminder-item:hover {
  background: rgba(255, 255, 255, 0.17);
}
[data-theme="light"] .panel-empty {
  background: radial-gradient(circle at 35% 30%, #a8aeae, #8c9496);
}
[data-theme="light"] .auth-form input,
[data-theme="light"] .sync-setup input,
[data-theme="light"] .edit-field input,
[data-theme="light"] .edit-field textarea,
[data-theme="light"] .edit-field select {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--line-strong);
}
[data-theme="light"] .theme-preview.light {
  background: linear-gradient(180deg, #9aa0a2, #828a8d);
  border-color: rgba(30, 35, 38, 0.16);
}
[data-theme="light"] .theme-preview.light .pv-line {
  background: rgba(30, 35, 38, 0.24);
}
[data-theme="light"] .theme-preview.light .pv-bubble {
  background: #b9bebc;
}
[data-theme="light"] .theme-preview.light .pv-bubble.right {
  background: linear-gradient(145deg, #d36650, #a94735);
}
[data-theme="light"] .theme-preview.light .pv-input {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(30, 35, 38, 0.16);
}
