@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Nunito+Sans:wght@400;600&display=swap');

:root {
  --background: #F5F0FF;
  --foreground: #2D1B69;
  --card: #FFFFFF;
  --primary: #9B8EC4;
  --primary-foreground: #FFFFFF;
  --secondary: #EDE9FF;
  --muted: #EDE9FF;
  --muted-foreground: #8B7AB5;
  --accent: #C4B5FD;
  --destructive: #d4183d;
  --border: rgba(155, 142, 196, 0.2);
  --radius: 1rem;
}

/* ── Тёмная тема ─────────────────────────────────────────────────────────── */
html.dark {
  --background: #13111a;
  --foreground: #e8e0ff;
  --card: #1e1a2e;
  --primary: #a78bfa;
  --primary-foreground: #ffffff;
  --secondary: #2a2440;
  --muted: #2a2440;
  --muted-foreground: #9d8ec4;
  --accent: #7c3aed;
  --destructive: #f87171;
  --border: rgba(167, 139, 250, 0.15);
}

html.dark .note-card { background: var(--card); color: var(--foreground); }
html.dark .note-card.is-completed { border-color: rgba(16,185,129,0.2); opacity: 0.5; }
html.dark .note-card.delete-pending { background: #2a1a1a; border-color: rgba(248,113,113,0.25); }
html.dark .modal-panel { background: var(--card); color: var(--foreground); }
html.dark .modal-backdrop { background: rgba(0,0,0,0.5); }
html.dark .bg-card\/60 { background: rgba(30,26,46,0.9); }
html.dark .bg-background\/40 { background: rgba(19,17,26,0.7); }
html.dark .bg-secondary\/50 { background: rgba(42,36,64,0.8); }
html.dark .tab-switch { background: #2a2440; }
html.dark .tab-switch a { color: var(--muted-foreground); }
html.dark .tab-switch a.active { background: #3a3060; color: var(--foreground); }
html.dark .tab-switch a:hover:not(.active) { color: var(--foreground); }
html.dark .contact-btn:hover { background: rgba(167,139,250,0.08); }
html.dark .contact-btn.selected { background: #2a2440; border-color: rgba(167,139,250,0.2); }
html.dark .form-input { background: #2a2440; color: var(--foreground); border-color: rgba(167,139,250,0.1); }
html.dark .form-input::placeholder { color: var(--muted-foreground); }
html.dark .form-input:focus { border-color: rgba(167,139,250,0.4); box-shadow: 0 0 0 2px rgba(167,139,250,0.1); }
html.dark .invite-card { background: #2a2440; border-color: rgba(167,139,250,0.2); }
html.dark .outgoing-invite-card { background: rgba(255,255,255,0.04); }
html.dark .error-box { background: rgba(248,113,113,0.12); color: #fca5a5; }
html.dark .message { background: #1e1a2e; border-color: rgba(167,139,250,0.2); color: var(--foreground); }
html.dark .note-hover:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.4); border-color: rgba(167,139,250,0.2); }

/* Статусы в тёмной теме */
html.dark .status-active { background: #1e293b; color: #94a3b8; }
html.dark .status-waiting_partner { background: #2d2000; color: #fbbf24; }
html.dark .status-waiting_you { background: #2e1a4a; color: #c084fc; }
html.dark .status-completed { background: #052e16; color: #34d399; }
html.dark .done-yes { background: #052e16; color: #34d399; }
html.dark .done-no { background: #2a2440; color: var(--muted-foreground); }
html.dark .status-delete-pending { background: #2d2000; color: #fbbf24; }
html.dark .status-delete-partner { background: rgba(248,113,113,0.15); color: #f87171; }

/* Кнопки в тёмной теме */
html.dark .btn-ghost { color: var(--muted-foreground); }
html.dark .btn-ghost:hover { background: rgba(167,139,250,0.1); color: var(--foreground); }
html.dark .btn-cancel { background: #2a2440; color: var(--muted-foreground); }
html.dark .btn-complete.muted { background: #2a2440; color: var(--muted-foreground); }
html.dark .btn-complete.muted:hover { background: rgba(167,139,250,0.15); color: var(--primary); }
html.dark .btn-delete { background: #2a2440; color: var(--muted-foreground); }
html.dark .btn-delete:hover { background: rgba(248,113,113,0.15); color: #f87171; }
html.dark .btn-delete-confirm { background: rgba(248,113,113,0.15); color: #f87171; }
html.dark .btn-delete-confirm:hover { background: #f87171; color: #fff; }
html.dark .btn-delete-cancel { background: rgba(251,191,36,0.1); color: #fbbf24; }
html.dark .btn-delete-cancel:hover { background: rgba(251,191,36,0.2); color: #fde68a; }
html.dark .btn-invite-decline:hover { background: rgba(248,113,113,0.15); color: #f87171; }
html.dark .add-contact-btn { border-color: rgba(167,139,250,0.2); color: var(--muted-foreground); }
html.dark .add-contact-btn:hover { border-color: rgba(167,139,250,0.4); color: var(--primary); }

/* Прочие элементы */
html.dark .stat-pill { background: #2a2440; color: var(--muted-foreground); }
html.dark .settings-card { background: var(--card); }
html.dark .settings-card-warn { background: #2d2000; border-color: rgba(251,191,36,0.2); }
html.dark .settings-card-ok { background: #052e16; border-color: rgba(52,211,153,0.2); }
html.dark .settings-header { background: rgba(30,26,46,0.8); }
html.dark .text-foreground\/40 { color: rgba(232,224,255,0.35); }

/* Фото и эмодзи */
html.dark .image-drop-zone { background: #2a2440; border-color: rgba(167,139,250,0.2); }
html.dark .image-drop-zone:hover { background: rgba(167,139,250,0.08); border-color: var(--primary); }
html.dark .image-drop-zone.drag-over { border-color: var(--primary); background: rgba(167,139,250,0.1); }
html.dark .emoji-picker-grid { background: #1e1a2e; border-color: rgba(167,139,250,0.2); }
html.dark .emoji-btn:hover { background: rgba(167,139,250,0.15); }
html.dark .emoji-btn.selected { background: rgba(167,139,250,0.25); outline-color: var(--primary); }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Nunito Sans", sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
}

h1, h2, h3, .font-nunito {
  font-family: "Nunito", sans-serif;
}

a { color: inherit; text-decoration: none; }

input, textarea, button {
  font-family: inherit;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(155, 142, 196, 0.3);
  border-radius: 2px;
}

/* Layout */
.min-h-screen { min-height: 100vh; }
.h-screen { height: 100vh; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-sm { max-width: 24rem; }
.max-w-4xl { max-width: 56rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-7 { padding: 1.75rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.pt-5 { padding-top: 1.25rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.pr-12 { padding-right: 3rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-5 { margin-top: 1.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-7 { margin-bottom: 1.75rem; }
.mb-8 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-xl { font-size: 1.25rem; }
.text-3xl { font-size: 1.875rem; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-\[15px\] { font-size: 15px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.font-normal { font-weight: 400; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.italic { font-style: italic; }
.opacity-25 { opacity: 0.25; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.relative { position: relative; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.pointer-events-none { pointer-events: none; }
.border { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-transparent { border-color: transparent; }
.border-dashed { border-style: dashed; }
.border-2 { border-width: 2px; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-\[1\.5rem\] { border-radius: 1.5rem; }
.rounded-\[2rem\] { border-radius: 2rem; }
.rounded-full { border-radius: 9999px; }
.bg-background { background: var(--background); }
.bg-card { background: var(--card); }
.bg-white { background: #fff; }
.bg-muted { background: var(--muted); }
.bg-primary { background: var(--primary); }
.bg-primary\/10 { background: rgba(155, 142, 196, 0.1); }
.bg-primary\/15 { background: rgba(155, 142, 196, 0.15); }
.bg-primary\/20 { background: rgba(155, 142, 196, 0.2); }
.bg-secondary\/50 { background: rgba(237, 233, 255, 0.5); }
.bg-accent\/25 { background: rgba(196, 181, 253, 0.25); }
.bg-red-50 { background: #fef2f2; }
.bg-card\/60 { background: rgba(255, 255, 255, 0.6); }
.bg-background\/40 { background: rgba(245, 240, 255, 0.4); }
.bg-foreground\/10 { background: rgba(45, 27, 105, 0.1); }
.text-foreground { color: var(--foreground); }
.text-foreground\/40 { color: rgba(45, 27, 105, 0.4); }
.text-muted-foreground { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-primary\/70 { color: rgba(155, 142, 196, 0.7); }
.text-primary-foreground { color: var(--primary-foreground); }
.text-destructive { color: var(--destructive); }
.text-white { color: #fff; }
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.card-shadow { box-shadow: 0 4px 32px rgba(155, 142, 196, 0.15); }
.btn-shadow { box-shadow: 0 2px 12px rgba(155, 142, 196, 0.3); }
.note-hover:hover {
  box-shadow: 0 4px 20px rgba(155, 142, 196, 0.18);
  border-color: rgba(155, 142, 196, 0.25);
}
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.blur-3xl { filter: blur(64px); }
.transition-all { transition: all 0.2s ease; }
.duration-200 { transition-duration: 0.2s; }
.duration-300 { transition-duration: 0.3s; }
.hidden { display: none; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.w-4 { width: 1rem; height: 1rem; }
.w-5 { width: 1.25rem; height: 1.25rem; }
.w-6 { width: 1.5rem; height: 1.5rem; }
.w-7 { width: 1.75rem; height: 1.75rem; }
.w-8 { width: 2rem; height: 2rem; }
.w-9 { width: 2.25rem; height: 2.25rem; }
.w-10 { width: 2.5rem; height: 2.5rem; }
.w-16 { width: 4rem; height: 4rem; }
.w-20 { width: 5rem; height: 5rem; }
.w-72 { width: 18rem; }
.w-\[500px\] { width: 500px; }
.h-4 { height: 1rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-\[500px\] { height: 500px; }
.min-h-\[60px\] { min-height: 60px; }
.-top-40 { top: -10rem; }
.-right-40 { right: -10rem; }
.-bottom-40 { bottom: -10rem; }
.-left-40 { left: -10rem; }
.top-1\/2 { top: 50%; }
.right-3\.5 { right: 0.875rem; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.resize-none { resize: none; }

/* Sidebar collapse */
.sidebar-wrap {
  flex-shrink: 0;
  transition: width 0.3s ease;
  overflow: hidden;
}
.sidebar-wrap.open { width: 18rem; }
.sidebar-wrap.closed { width: 0; }

/* Forms */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  background: var(--muted);
  border: 1px solid transparent;
  color: var(--foreground);
  outline: none;
  transition: all 0.2s;
}
.form-input::placeholder { color: var(--muted-foreground); }
.form-input:focus {
  border-color: rgba(155, 142, 196, 0.4);
  box-shadow: 0 0 0 2px rgba(155, 142, 196, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.25rem;
  border-radius: 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.75rem;
  color: var(--muted-foreground);
  transition: all 0.2s;
}
.btn-ghost:hover {
  background: var(--muted);
  color: var(--foreground);
}

.tab-switch {
  display: flex;
  border-radius: 1rem;
  background: var(--muted);
  padding: 0.25rem;
  margin-bottom: 1.75rem;
}
.tab-switch a {
  flex: 1;
  padding: 0.5rem;
  border-radius: 0.75rem;
  text-align: center;
  font-size: 0.875rem;
  transition: all 0.2s;
  color: var(--muted-foreground);
}
.tab-switch a.active {
  background: var(--card);
  color: var(--foreground);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.tab-switch a:hover:not(.active) { color: var(--foreground); }

.contact-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: 1rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.contact-btn:hover { background: rgba(255,255,255,0.6); }
.contact-btn.selected {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  border-color: rgba(155, 142, 196, 0.2);
}
.contact-btn.selected .contact-name { color: var(--primary); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  /* дефолтный размер md */
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.875rem;
}

/* Размеры */
.avatar-xs { width: 1.25rem; height: 1.25rem; font-size: 0.5rem; }
.avatar-sm { width: 2rem;    height: 2rem;    font-size: 0.75rem; }
.avatar-md { width: 2.5rem;  height: 2.5rem;  font-size: 0.875rem; }
.avatar-lg { width: 3rem;    height: 3rem;    font-size: 1rem; }
.avatar-xl { width: 4rem;    height: 4rem;    font-size: 1.25rem; }

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback когда img не загрузился */
.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 700;
  font-size: inherit;
}

/* Avatar palettes */
.pal-violet { background: #ede9fe; color: #7c3aed; }
.pal-pink { background: #fce7f3; color: #db2777; }
.pal-sky { background: #e0f2fe; color: #0284c7; }
.pal-emerald { background: #d1fae5; color: #059669; }
.pal-amber { background: #fef3c7; color: #d97706; }
.pal-rose { background: #ffe4e6; color: #e11d48; }

/* Status badges */
.status-active { background: #f1f5f9; color: #64748b; }
.status-waiting_partner { background: #fffbeb; color: #f59e0b; }
.status-waiting_you { background: #ede9fe; color: #7c3aed; }
.status-completed { background: #ecfdf5; color: #059669; }

.done-yes { background: #ecfdf5; color: #059669; }
.done-no { background: var(--muted); color: var(--muted-foreground); }

.note-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--card);
  border-radius: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
  color: var(--foreground);
}
.note-card.is-completed {
  border-color: #d1fae5;
  opacity: 0.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.75rem;
  font-size: 11px;
  font-weight: 700;
}

.btn-complete {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-complete.muted {
  background: var(--muted);
  color: var(--muted-foreground);
}
.btn-complete.muted:hover {
  background: rgba(155, 142, 196, 0.1);
  color: var(--primary);
}
.btn-complete.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 4px rgba(155, 142, 196, 0.2);
}
.btn-complete:active { transform: scale(0.95); }

.add-contact-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem;
  border-radius: 1rem;
  border: 2px dashed rgba(155, 142, 196, 0.3);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(155, 142, 196, 0.7);
  cursor: pointer;
  transition: all 0.2s;
}
.add-contact-btn:hover {
  border-color: rgba(155, 142, 196, 0.5);
  color: var(--primary);
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.toolbar-btn:hover { opacity: 0.9; }
.toolbar-btn:active { transform: scale(0.98); }

.stat-pill {
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  background: var(--muted);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.badge-count {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 27, 105, 0.1);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: 100%;
  background: var(--card);
  border-radius: 1.5rem;
  padding: 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  border: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.25rem;
}
.modal-actions button,
.modal-actions .btn-cancel {
  flex: 1;
  padding: 0.75rem;
  border-radius: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel {
  background: var(--muted);
  color: var(--muted-foreground);
  text-align: center;
  display: block;
}
.btn-cancel:hover { opacity: 0.8; }

.error-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--destructive);
  background: #fef2f2;
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
}

.messages {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}
.message {
  background: #fff;
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(45, 27, 105, 0.08);
  max-width: 320px;
}

/* Invite card */
.invite-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: 1rem;
  margin-bottom: 0.5rem;
  background: var(--card);
  border: 1px solid rgba(155, 142, 196, 0.25);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.invite-actions {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-shrink: 0;
}
.btn-invite-accept {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-invite-accept:hover { opacity: 0.9; }
.btn-invite-decline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  border-radius: 0.75rem;
  background: var(--muted);
  color: var(--muted-foreground);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-invite-decline:hover {
  background: #fef2f2;
  color: var(--destructive);
}
.outgoing-invite-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  margin-bottom: 0.25rem;
  background: rgba(0, 0, 0, 0.04);
}

/* Settings */
.settings-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}
.settings-card {
  background: var(--card);
  border-radius: 1.25rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.settings-card-warn {
  background: #fffbeb;
  border-color: rgba(217, 119, 6, 0.25);
}
.settings-card-ok {
  background: #ecfdf5;
  border-color: rgba(5, 150, 105, 0.2);
}
.settings-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.settings-check input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.btn-secondary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background: var(--muted);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary-sm:hover { opacity: 0.85; }
.border-t { border-top: 1px solid var(--border); }
.pt-5 { padding-top: 1.25rem; }
.opacity-70 { opacity: 0.7; }
.inline-block { display: inline-block; }

@media (min-width: 640px) {
  .sm\:flex { display: flex; }
  .sm\:inline { display: inline; }
  .sm\:hidden { display: none; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .sidebar-wrap.closed { width: 0; }
  .hide-mobile { display: none; }
}

/* Delete button */
.btn-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--muted);
  color: var(--muted-foreground);
}
.btn-delete:hover {
  background: #fef2f2;
  color: var(--destructive);
}
.btn-delete-confirm {
  background: #fef2f2;
  color: var(--destructive);
}
.btn-delete-confirm:hover {
  background: var(--destructive);
  color: #fff;
}
.btn-delete-cancel {
  background: #fffbeb;
  color: #d97706;
}
.btn-delete-cancel:hover {
  background: #fef3c7;
  color: #92400e;
}

/* Delete pending highlight */
.note-card.delete-pending {
  border-color: rgba(212, 24, 61, 0.2);
  background: #fff9f9;
}

/* Delete status badges */
.status-delete-pending {
  background: #fffbeb;
  color: #d97706;
}
.status-delete-partner {
  background: #fef2f2;
  color: var(--destructive);
}

/* flex-wrap utility */
.flex-wrap { flex-wrap: wrap; }

/* ── Эмодзи-пикер ────────────────────────────────────────────────────────── */
.emoji-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: 0 8px 24px rgba(45,27,105,0.12);
  max-height: 260px;
  overflow-y: auto;
}
.emoji-search-wrap {
  padding: 0 0 0.5rem 0;
}
.emoji-search {
  width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--muted);
  border: 1px solid transparent;
  color: var(--foreground);
  font-size: 0.8rem;
  outline: none;
}
.emoji-search:focus { border-color: var(--primary); }
html.dark .emoji-search { background: #2a2440; color: var(--foreground); }
.emoji-category-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.375rem 0.25rem 0.25rem;
}
.emoji-category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-bottom: 0.25rem;
}
.emoji-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2rem;
  border-radius: 0.4rem;
  line-height: 1;
  transition: background 0.1s;
  flex-shrink: 0;
}
.emoji-btn:hover { background: var(--muted); }
.emoji-btn.selected { background: rgba(155,142,196,0.2); outline: 2px solid var(--primary); }

/* ── Загрузка фото ───────────────────────────────────────────────────────── */
.image-drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.image-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(155,142,196,0.08);
}
.image-drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(155,142,196,0.12);
}
.note-image-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 0.75rem;
  display: block;
}
.image-remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 9999px;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.image-remove-btn:hover { background: rgba(0,0,0,0.75); }

/* ── Фото в карточке заметки ─────────────────────────────────────────────── */
.note-card-image-wrap {
  border-radius: 0.875rem;
  overflow: hidden;
  margin: -0.25rem 0;
}
.note-card-image {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}

/* ── Карточка заметки — нижняя строка ───────────────────────────────────── */
.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.note-title {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.375;
  color: var(--foreground);
  margin: 0;
  word-break: break-word;
}

.note-emoji {
  margin-right: 0.25rem;
}

.note-done-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #059669;
}

html.dark .note-done-label { color: #34d399; }

/* Убираем лишний отступ у w-3.5/h-3.5 иконок внутри badge */
.badge svg { width: 0.875rem; height: 0.875rem; flex-shrink: 0; }

/* ── Аватар в настройках ─────────────────────────────────────────────────── */
.avatar-upload-preview {
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border);
}
.avatar-upload-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
  font-weight: 800;
}
.avatar-upload-preview .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Адаптивность ────────────────────────────────────────────────────────── */

/* Мобильные (< 640px) */
@media (max-width: 639px) {
  /* Сайдбар — на мобильных поверх контента как drawer */
  .sidebar-wrap {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 40;
    transition: transform 0.3s ease, width 0.3s ease;
  }
  .sidebar-wrap.open {
    width: 80vw;
    max-width: 18rem;
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }
  .sidebar-wrap.closed {
    width: 80vw;
    max-width: 18rem;
    transform: translateX(-100%);
  }

  /* Основной контент занимает весь экран */
  main { width: 100%; }

  /* Шапка тулбара — компактнее */
  .toolbar-btn { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .toolbar-btn span { display: none; }
  .toolbar-btn::after { content: "+"; font-size: 1.1rem; font-weight: 800; }

  /* Карточки — одна колонка */
  .grid-cols-1 { grid-template-columns: 1fr; }

  /* Модалки — полный экран снизу */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-panel {
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 92vh;
    overflow-y: auto;
    padding: 1.25rem 1.25rem 2rem;
  }

  /* Паддинги */
  .p-5 { padding: 0.875rem; }
  .px-5 { padding-left: 0.875rem; padding-right: 0.875rem; }

  /* Легенда статусов — скрываем на мобильных */
  .status-legend { display: none; }

  /* Кнопки завершить/подтвердить — компактнее */
  .btn-complete { padding: 0.3rem 0.6rem; font-size: 0.7rem; }

  /* Заголовок в шапке */
  .toolbar-header-email { display: none; }
}

/* Планшеты (640–1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .sidebar-wrap.open { width: 15rem; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Оверлей для мобильного сайдбара */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 39;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Автоудаление ────────────────────────────────────────────────────────── */
.status-auto-delete {
  background: #fef3c7;
  color: #92400e;
}
html.dark .status-auto-delete {
  background: rgba(251,191,36,0.12);
  color: #fbbf24;
}
/* Срочное — меньше суток */
.status-auto-delete.urgent {
  background: #fef2f2;
  color: var(--destructive);
  animation: pulse-badge 2s ease-in-out infinite;
}
html.dark .status-auto-delete.urgent {
  background: rgba(248,113,113,0.15);
  color: #f87171;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* select в форме */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B7AB5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}
html.dark select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239d8ec4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ── Автоудаление — кастомный UI ─────────────────────────────────────────── */
.auto-delete-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.auto-delete-preset {
  padding: 0.3rem 0.75rem;
  border-radius: 0.75rem;
  border: 1.5px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.auto-delete-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(155,142,196,0.08);
}
.auto-delete-preset.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}
.auto-delete-custom-btn.active {
  border-color: var(--primary);
  background: rgba(155,142,196,0.12);
  color: var(--primary);
}

.auto-delete-custom-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.auto-delete-custom-row .form-input {
  padding: 0.5rem 0.75rem;
}

html.dark .auto-delete-preset {
  background: #2a2440;
  border-color: rgba(167,139,250,0.15);
  color: var(--muted-foreground);
}
html.dark .auto-delete-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(167,139,250,0.1);
}
html.dark .auto-delete-preset.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
html.dark .auto-delete-custom-btn.active {
  background: rgba(167,139,250,0.15);
  color: var(--primary);
}
