
:root {
  /* СВЕТЛАЯ ТЕМА - ПОЛНЫЙ ПЕРЕДЕЛ */
  --background: #f9fafb;
  --foreground: #111827;
  --card: #ffffff;
  --primary: #4f46e5;
  --primary-foreground: #ffffff;
  --secondary: #f3f4f6;
  --muted: #f3f4f6;
  --muted-foreground: #6b7280;
  --accent: #e0e7ff;
  --destructive: #dc2626;
  --border: #e5e7eb;
  --radius: 0.75rem;
}

/* ── Тёмная тема ─────────────────────────────────────────────────────────── */
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:not(.dark) .btn-icon-sm.favorite-active { color: #d97706; }
html:not(.dark) .btn-icon-sm.favorite-active svg { fill: #d97706; }
html:not(.dark) .btn-icon-sm.pin-active { color: var(--primary); }
html:not(.dark) .btn-icon-sm.pin-active svg { fill: var(--primary); }
html:not(.dark) .note-card.is-pinned { 
  box-shadow: 0 0 0 1px var(--primary);
  border-color: var(--primary);
  background: var(--card);
}
html:not(.dark) .note-card.is-favorite {
  border-color: #d97706;
}
html:not(.dark) .contact-btn:hover { 
  background: var(--secondary); 
}
html:not(.dark) .contact-pin-btn.pinned { 
  color: var(--primary);
}
html:not(.dark) .favorite-remove-btn { 
  color: #d97706;
}
html:not(.dark) .sidebar-tab.active {
  background: var(--card);
  color: var(--foreground);
}
html:not(.dark) .pagination-btn:hover:not(.disabled) {
  background: var(--secondary);
}
html:not(.dark) .note-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
html:not(.dark) .contact-btn:hover { 
  background: rgba(155, 142, 196, 0.08); 
}
html:not(.dark) .contact-pin-btn.pinned { 
  color: var(--primary); 
  background: rgba(155, 142, 196, 0.15);
  transform: rotate(-45deg);
}
html:not(.dark) .favorite-remove-btn { 
  color: #f59e0b; 
}
html:not(.dark) .sidebar-tab.active {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 2px 8px rgba(155, 142, 196, 0.25);
}
html:not(.dark) .pagination-btn:hover:not(.disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(155, 142, 196, 0.3);
}

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 .btn-icon-sm.favorite-active { color: #fbbf24; }
html.dark .btn-icon-sm.favorite-active svg { fill: #fbbf24; }
html.dark .btn-icon-sm.pin-active { color: var(--primary); }
html.dark .btn-icon-sm.pin-active svg { fill: 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; }

/* Skip to main content для доступности */
.skip-to-main {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: var(--primary-foreground);
  text-decoration: none;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 600;
}

.skip-to-main:focus {
  left: 50%;
  transform: translateX(-50%);
  top: 0;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: "Nunito Sans", sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: clamp(15px, 1.1vw, 19px);
  line-height: 1.6;
}

@media (min-width: 768px) {
  body { font-size: clamp(16px, 1.2vw, 20px); }
}

@media (min-width: 1400px) {
  body { font-size: clamp(17px, 1.3vw, 21px); }
}

@media (min-width: 1800px) {
  body { font-size: clamp(18px, 1.4vw, 22px); }
}

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: 1.375rem; }
@media (min-width: 1400px) { .gap-4 { gap: 1.5rem; } }
.grid { display: grid; }
.grid-auto-height { align-items: start; }
.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: 2.5rem; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.min-w-0 { min-width: 0; }
.w-full { width: 100%; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }

@media (min-width: 1400px) {
  .max-w-lg { max-width: 36rem; }
  .max-w-2xl { max-width: 48rem; }
  .max-w-4xl { max-width: 64rem; }
}

@media (min-width: 1800px) {
  .max-w-lg { max-width: 40rem; }
  .max-w-2xl { max-width: 54rem; }
  .max-w-4xl { max-width: 72rem; }
}
.mx-auto { margin-left: auto; margin-right: auto; }
@media (min-width: 1400px) { .xl\:block { display: block !important; } .xl\:hidden { display: none !important; } .xl\:line-clamp-none { -webkit-line-clamp: unset; } }
@media (max-width: 1399px) { .xl\:block { display: none !important; } }
@media (min-width: 1024px) { .lg\:block { display: block !important; } .lg\:hidden { display: none !important; } }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.375rem; }
.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; }
.break-words { word-break: break-word; overflow-wrap: break-word; }
.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.875rem 1rem;
  border-radius: 1rem;
  background: var(--muted);
  border: 1px solid rgba(155, 142, 196, 0.1);
  color: var(--foreground);
  outline: none;
  transition: all 0.2s;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.form-input::placeholder { color: var(--muted-foreground); opacity: 0.7; }
.form-input:focus {
  border-color: rgba(155, 142, 196, 0.4);
  box-shadow: 0 0 0 3px rgba(155, 142, 196, 0.08);
  background: var(--card);
}

.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.625rem;
  border-radius: 0.75rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  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(124, 58, 237, 0.05); }
.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.875rem;
  background: var(--card);
  border-radius: 1.5rem;
  padding: 1.375rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
  color: var(--foreground);
  min-width: 0;
}
.note-card > * {
  min-width: 0;
}
.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;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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;
  overflow-y: auto;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 27, 105, 0.1);
  backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  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;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.message {
  background: #fff;
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: 0.875rem 1rem;
  padding-bottom: 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(45, 27, 105, 0.08);
  max-width: 380px;
  animation: slideIn 0.3s ease-out;
  pointer-events: auto;
  overflow: hidden;
  position: relative;
}
.message::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), rgba(155, 142, 196, 0.3));
  animation: progress 3s linear forwards;
  width: 100%;
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes progress {
  from { width: 100%; }
  to   { width: 0%; }
}
@keyframes fadeOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(400px); }
}

.message.removing {
  animation: fadeOut 0.3s ease-in forwards;
}
html.dark .message {
  background: #1e1a2e;
  border-color: rgba(167, 139, 250, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 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 {
  margin-bottom: 10px;
  background: var(--card);
  border-radius: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.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 {
  margin-top:10px;
  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)); }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

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

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

@media (min-width: 1800px) {
  .xxl\:grid-cols-5 { grid-template-columns: repeat(5, 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;
}
@media (min-width: 1400px) { .xl\:max-h-\[260px\] { max-height: 260px; } }
@media (min-width: 1800px) { .xxl\:max-h-\[320px\] { max-height: 320px; } }

/* ── Drag handle ───────────────────────────────────────────── */
.drag-handle {
  background: none;
  border: none;
  cursor: grab;
  color: var(--muted-foreground);
  opacity: 0.3;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: opacity 0.2s;
}
.drag-handle:active { cursor: grabbing; }
.note-card:hover .drag-handle, .note-card.dragging .drag-handle { opacity: 0.7; }

/* ── Pin / Favorite ────────────────────────────────────────── */
.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: 0.75;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-icon-sm:hover { 
  opacity: 1 !important; 
  color: var(--foreground);
  transform: scale(1.15);
}
.btn-icon-sm:active { 
  transform: scale(0.9); 
}
.btn-icon-sm.favorite-active { 
  opacity: 1; 
  color: #f59e0b;
  transform: scale(1.1);
}
.btn-icon-sm.favorite-active svg { 
  fill: #f59e0b; 
}
.btn-icon-sm.pin-active { 
  opacity: 1; 
  color: var(--primary);
  transform: scale(1.1) rotate(-45deg);
}
.btn-icon-sm.pin-active svg { 
  fill: var(--primary); 
}

/* Закрепленные заметки - улучшенный стиль */
.note-card.is-pinned { 
  box-shadow: 0 0 0 2px var(--primary), 0 4px 16px rgba(155, 142, 196, 0.25);
  border-color: var(--primary);
  position: relative;
  background: linear-gradient(135deg, var(--card) 0%, rgba(155, 142, 196, 0.03) 100%);
}

html.dark .note-card.is-pinned {
  box-shadow: 0 0 0 2px var(--primary), 0 4px 16px rgba(167, 139, 250, 0.3);
  background: linear-gradient(135deg, var(--card) 0%, rgba(167, 139, 250, 0.05) 100%);
}

/* Индикатор закрепления */
.note-card.is-pinned::before {
  content: '📌';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.25rem;
  z-index: 10;
  animation: pinBounce 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes pinBounce {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(20deg);
  }
  100% {
    transform: scale(1) rotate(-45deg);
    opacity: 1;
  }
}

/* ── Drag & drop ───────────────────────────────────────────── */
.note-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  transition: opacity 0.15s, transform 0.15s;
}
.note-card.drag-over {
  border-color: var(--primary) !important;
  transform: scale(1.02);
  transition: border-color 0.15s, transform 0.15s;
}
.note-card {
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

/* ── Drop indicator ─────────────────────────────────────────── */
.drop-indicator {
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  margin: -1px 4px;
  position: relative;
  z-index: 5;
  pointer-events: none;
  animation: dropPulse 0.8s ease-in-out infinite alternate;
}
@keyframes dropPulse {
  from { opacity: 0.5; transform: scaleY(1); }
  to   { opacity: 1;   transform: scaleY(1.5); }
}

/* ── Sidebar tabs ──────────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
}
.sidebar-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted-foreground);
  cursor: pointer;
  border-radius: 0.5rem;
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.sidebar-tab:hover { background: var(--secondary); color: var(--foreground); }
.sidebar-tab.active { background: var(--primary); color: var(--primary-foreground); }
.sidebar-tab-content { display: none; }
.sidebar-tab-content.active { display: block; animation: fadeIn 0.2s ease; }

/* ── Favorites list ────────────────────────────────────────── */
.favorite-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.625rem;
  border-radius: 0.75rem;
  transition: background 0.15s;
  animation: fadeInUp 0.2s ease both;
}
.favorite-item:nth-child(2) { animation-delay: 0.02s; }
.favorite-item:nth-child(3) { animation-delay: 0.04s; }
.favorite-item:hover { background: var(--secondary); }
.favorite-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--foreground);
}
.favorite-emoji {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.favorite-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #f59e0b;
  padding: 2px;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.favorite-item:hover .favorite-remove-btn { opacity: 1; }
.favorite-remove-btn.favorite-active { opacity: 1; }
.favorite-remove-form { display: flex; }

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

.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 {
  position: relative;
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.avatar-upload-preview .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-upload-letter {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}

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

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

/* Десктоп/планшет — базовое поведение */
.sidebar-wrap {
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.3s ease;
}
.sidebar-wrap.open  { width: 18rem; }
.sidebar-wrap.closed { width: 0; }

/* Кнопка закрытия — скрыта на десктопе */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.75rem;
  color: var(--muted-foreground);
  transition: all 0.2s;
  flex-shrink: 0;
}
.sidebar-close-btn:hover { background: var(--muted); color: var(--foreground); }

/* Планшеты */
@media (min-width: 640px) and (max-width: 1023px) {
  .sidebar-wrap.open { width: 15rem; }
}

/* Десктоп — сбрасываем мобильные стили */
@media (min-width: 640px) {
  .sidebar-close-btn { display: none !important; }
  .sidebar-wrap {
    position: static !important;
    transform: none !important;
    height: auto !important;
    overflow: hidden !important;
  }
  .sidebar-wrap.open  { width: 18rem !important; }
  .sidebar-wrap.closed { width: 0 !important; }
}

/* ── Мобильные (< 640px) ─────────────────────────────────────────────────── */
@media (max-width: 639px) {
  /* Сайдбар — на весь экран поверх контента */
  .sidebar-wrap {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 40;
    overflow-y: auto;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(.4,0,.2,1) !important;
  }
  .sidebar-wrap > div { width: 100% !important; height: 100% !important; }
  .sidebar-wrap.mobile-open { transform: translateX(0) !important; }

  /* Кнопка закрытия — только на мобильных */
  .sidebar-close-btn { display: flex !important; }

  /* Основной контент — всегда на всю ширину */
  main { width: 100% !important; }

  /* Скрываем ненужное */
  .hide-mobile   { display: none !important; }
  .status-legend { display: none !important; }
  .sm\:hidden    { display: none !important; }
  .sm\:inline    { display: none !important; }
  .sm\:flex      { display: none !important; }

  /* Тулбар */
  .toolbar-btn { padding: 0.5rem 0.875rem; font-size: 0.85rem; }

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

  /* Карточки заметок — компактнее */
  .note-card { padding: 1rem; gap: 0.625rem; }
  .note-title { font-size: 14px; }
  .badge { font-size: 10px; padding: 0.2rem 0.5rem; }
  .btn-complete { padding: 0.3rem 0.6rem; font-size: 0.7rem; }
  .btn-delete   { padding: 0.3rem 0.4rem; }
  .btn-comment  { padding: 0.3rem 0.4rem; }

  /* Модалки — sheet снизу */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-panel {
    border-radius: 1.5rem 1.5rem 0 0 !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    padding: 1.25rem 1rem 2.5rem !important;
  }

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

  /* Уведомления */
  .messages { top: 0.5rem; right: 0.5rem; left: 0.5rem; max-width: calc(100% - 1rem); }
  .message  { max-width: 100%; }

}

/* ── Автоудаление ────────────────────────────────────────────────────────── */
.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);
}

/* ── Мобильный сайдбар на весь экран ────────────────────────────────────── */

/* ── Комментарии ─────────────────────────────────────────────────────────── */
.comment-card {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--card);
}
.comment-mine {
  background: rgba(155,142,196,0.08);
  border-color: rgba(155,142,196,0.2);
}
html.dark .comment-mine {
  background: rgba(167,139,250,0.08);
  border-color: rgba(167,139,250,0.2);
}
html.dark .comment-card { background: var(--card); }

.comment-form { display: flex; flex-direction: column; gap: 0; }

.btn-comment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.3rem 0.5rem;
  border-radius: 0.75rem;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  min-width: 2rem;
}
.btn-comment:hover { background: rgba(155,142,196,0.15); color: var(--primary); }
html.dark .btn-comment { background: #2a2440; }
html.dark .btn-comment:hover { background: rgba(167,139,250,0.15); color: var(--primary); }

.comment-count {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 9999px;
  padding: 0 0.3rem;
  font-size: 9px;
  font-weight: 800;
  min-width: 1rem;
  text-align: center;
}

/* ── Мобильный сайдбар на весь экран ────────────────────────────────────── */

/* ── Анимации кнопок ─────────────────────────────────────────────────────── */

/* Ripple-эффект при нажатии */
.btn-primary,
.btn-complete,
.btn-delete,
.btn-invite-accept,
.toolbar-btn,
.btn-secondary-sm {
  position: relative;
  overflow: hidden;
}

.btn-primary::after,
.btn-complete::after,
.toolbar-btn::after,
.btn-invite-accept::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.18);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: inherit;
}
.btn-primary:active::after,
.btn-complete:active::after,
.toolbar-btn:active::after,
.btn-invite-accept:active::after {
  opacity: 1;
}

/* Пружинящий scale при нажатии */
.btn-primary:active       { transform: scale(0.97); }
.toolbar-btn:active       { transform: scale(0.96); }
.btn-complete:active      { transform: scale(0.94); }
.btn-delete:active        { transform: scale(0.93); }
.btn-ghost:active         { transform: scale(0.92); }
.btn-secondary-sm:active  { transform: scale(0.95); }
.btn-invite-accept:active { transform: scale(0.95); }
.btn-cancel:active        { transform: scale(0.97); }
.contact-btn:active       { transform: scale(0.98); }
.auto-delete-preset:active { transform: scale(0.95); }

/* Плавный hover для карточек */
.note-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.note-hover:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(155,142,196,0.2);
}
.note-hover:active { transform: translateY(0); }

/* Анимация появления карточек */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.note-card {
  animation: fadeInUp 0.25s ease both;
}
.note-card:nth-child(2) { animation-delay: 0.03s; }
.note-card:nth-child(3) { animation-delay: 0.06s; }
.note-card:nth-child(4) { animation-delay: 0.09s; }
.note-card:nth-child(5) { animation-delay: 0.12s; }

/* Плавное появление модалки */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-panel {
  animation: slideUp 0.22s cubic-bezier(.4,0,.2,1) both;
}

/* Анимация бейджей */
.badge {
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Плавный переход иконок */
.btn-ghost svg,
.btn-ghost i { transition: transform 0.2s ease; }
.btn-ghost:hover svg,
.btn-ghost:hover i { transform: scale(1.1); }

/* ── Лайтбокс ───────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.lightbox-img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: lightboxIn 0.2s cubic-bezier(.4,0,.2,1) both;
  cursor: zoom-out;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 9999px;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.2s;
  backdrop-filter: blur(4px);
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-close:active { transform: scale(0.92); }

@keyframes lightboxIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Удаление собеседника ────────────────────────────────────────────────── */
.contact-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  animation: fadeInUp 0.2s ease both;
}
.contact-row:nth-child(2) { animation-delay: 0.02s; }
.contact-row:nth-child(3) { animation-delay: 0.04s; }
.contact-row:nth-child(4) { animation-delay: 0.06s; }
.contact-row:nth-child(5) { animation-delay: 0.08s; }
.contact-row .contact-btn {
  flex: 1;
  margin-bottom: 0;
}
.contact-delete-form {
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.contact-row:hover .contact-delete-form {
  opacity: 1;
}
.contact-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.75rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.contact-delete-btn:hover {
  color: var(--destructive);
  background: rgba(212,24,61,0.08);
}
html.dark .contact-delete-btn:hover {
  color: #f87171;
  background: rgba(248,113,113,0.1);
}
.contact-pin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.625rem;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}
.contact-row:hover .contact-pin-btn { opacity: 0.5; }
.contact-pin-btn:hover { opacity: 1 !important; color: var(--primary); }
.contact-pin-btn.pinned { opacity: 1; color: var(--primary); }
.contact-row.is-pinned .contact-btn .contact-name { color: var(--primary); }

/* На мобильных — всегда показываем */
@media (max-width: 639px) {
  .contact-delete-form { opacity: 1; }
  .contact-pin-btn { opacity: 0.5; }
}

/* ── Фиксы UI ────────────────────────────────────────────────────────────── */

/* Эмодзи-кнопка — не вылезает за поле */
.emoji-trigger-wrap {
  position: relative;
  display: block;
}
.emoji-trigger-wrap .form-input {
  padding-right: 3rem !important;
  width: 100%;
}
#emoji-trigger {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0.25rem 0.375rem;
  line-height: 1;
  font-size: 1.1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: background 0.15s;
}
#emoji-trigger:hover { background: var(--muted); }

/* Select — полностью убираем нативные стрелки и добавляем свою */
select,
select.form-input {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B7AB5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.875rem center !important;
  padding-right: 2.5rem !important;
  cursor: pointer;
}
html.dark select,
html.dark select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239d8ec4' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  color-scheme: dark;
}

/* Кнопка "Отклонить" в приглашениях */
.btn-invite-decline-text {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Нижняя строка пользователя в сайдбаре — убираем email */
.sidebar-user-email { display: none; }

/* Шапка собеседника — убираем email */
.partner-email { display: none; }

/* Отступы в сайдбаре */
.contact-row {
  margin-bottom: 0.125rem;
}
.contact-btn {
  margin-bottom: 0;
}

/* Автоудаление — кастомный ряд */
.auto-delete-custom-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.auto-delete-custom-row input[type="number"] {
  width: 5.5rem;
  flex-shrink: 0;
  /* убираем нативные стрелки number input */
  -moz-appearance: textfield;
}
.auto-delete-custom-row input[type="number"]::-webkit-outer-spin-button,
.auto-delete-custom-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.auto-delete-custom-row select {
  flex: 1;
  min-width: 0;
}

/* ── Фиксы отступов сайдбара ─────────────────────────────────────────────── */

/* Нижняя секция сайдбара — нормальные отступы */
.sidebar-wrap .px-4.py-4.border-t {
  padding: 1rem;
  gap: 0.75rem;
}

/* Кнопка пригласить — нормальный вид */
.add-contact-btn {
  border-radius: 1rem;
  padding: 0.625rem 1rem;
}

/* Убираем артефакты тонких линий */
.sidebar-wrap .border-r {
  border-right-width: 1px;
}
.border-b {
  border-bottom-width: 1px;
}

/* Нижняя строка пользователя */
.sidebar-wrap .flex.items-center.gap-2\.5 {
  padding: 0.5rem 0;
}

/* Отступ между собеседниками и кнопкой пригласить */
.sidebar-wrap .space-y-4 > * + * {
  margin-top: 0.5rem;
}

/* ── Обёртка для select — гарантированно убирает нативные стрелки ─────────── */
.select-wrap {
  position: relative;
  display: block;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted-foreground);
  pointer-events: none;
  z-index: 1;
}
.select-wrap select {
  width: 100%;
  padding-right: 2.5rem !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: none !important;
}

/* Эмодзи-кнопка — фикс позиции */
.emoji-trigger-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.emoji-trigger-wrap .form-input {
  flex: 1;
  padding-right: 2.75rem !important;
}
#emoji-trigger {
  position: absolute;
  right: 0.375rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  padding: 0.25rem;
  font-size: 1.1rem;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0.5rem;
  flex-shrink: 0;
}
#emoji-trigger:hover { background: rgba(155,142,196,0.15); }
html.dark #emoji-trigger:hover { background: rgba(167,139,250,0.15); }

/* Character counter */
.char-counter {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  font-size: 0.625rem;
  color: var(--muted-foreground);
  pointer-events: none;
  opacity: 0.6;
}
.char-counter.near-limit { color: var(--destructive); opacity: 1; }
.relative { position: relative; }

/* ── Пагинация ────────────────────────────────────────────────────────── */
.pagination-wrap {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  background: var(--muted);
  color: var(--foreground);
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.pagination-btn:hover:not(.disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.pagination-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}

html.dark .pagination {
  background: var(--card);
  border-color: rgba(167,139,250,0.2);
}

html.dark .pagination-btn {
  background: #2a2440;
  color: var(--foreground);
}

html.dark .pagination-btn:hover:not(.disabled) {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ── Улучшенная адаптивность для мобильных устройств ──────────────────── */
@media (max-width: 639px) {
  .pagination {
    padding: 0.5rem 0.75rem;
    gap: 0.375rem;
  }
  
  .pagination-btn {
    width: 2rem;
    height: 2rem;
  }
  
  .pagination-info {
    font-size: 0.75rem;
    padding: 0 0.5rem;
  }
  
  /* Оптимизация карточек заметок на мобильных */
  .note-card {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  /* Уменьшаем отступы на мобильных */
  .px-5 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .py-3\.5 {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
  
  /* Адаптация модальных окон */
  .modal-panel {
    padding: 1.25rem;
    max-width: calc(100vw - 2rem);
  }
  
  /* Адаптация форм */
  .form-input {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
  }
  
  /* Адаптация кнопок */
  .btn-primary, .toolbar-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }
  
  /* Скрываем длинные тексты на мобильных */
  .status-legend {
    display: none;
  }
  
  /* Адаптация сайдбара */
  .sidebar-wrap {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar-wrap.mobile-open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
  }
  
  .sidebar-overlay.active {
    display: block;
  }
}

/* Планшеты */
@media (min-width: 640px) and (max-width: 1023px) {
  .note-card {
    padding: 1.125rem;
  }
  
  .px-5 {
    padding-left: 1.125rem !important;
    padding-right: 1.125rem !important;
  }
}

/* Большие экраны - увеличиваем размеры для комфорта */
@media (min-width: 1800px) {
  .note-card {
    padding: 1.5rem;
    gap: 1rem;
  }
  
  .form-input {
    padding: 1rem 1.125rem;
    font-size: 1rem;
  }
  
  .btn-primary, .toolbar-btn {
    padding: 0.875rem 1.125rem;
    font-size: 0.9375rem;
  }
}

/* Улучшение производительности анимаций */
.transition-all,
.note-card,
.btn-primary,
.btn-ghost,
.contact-btn,
.pagination-btn {
  will-change: transform, opacity;
}

/* Оптимизация скроллинга */
.overflow-y-auto {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Улучшение читаемости текста */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Дополнительные красивые анимации ────────────────────────────────────── */

/* Плавное появление элементов с задержкой */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Пульсация для важных элементов */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.02);
  }
}

/* Мягкое покачивание */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

/* Bounce эффект */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* Shimmer эффект для загрузки */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Gradient animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Применение анимаций */
.btn-primary:hover {
  animation: pulse 0.6s ease-in-out;
}

.badge-count {
  animation: fadeInScale 0.3s ease both;
}

.toolbar-btn:hover {
  animation: bounce 0.5s ease;
}

.btn-icon-sm.favorite-active {
  animation: wiggle 0.4s ease;
}

.btn-icon-sm.pin-active {
  animation: fadeInScale 0.3s ease;
}

/* Hover эффекты с трансформацией */
.note-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.note-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 32px rgba(155, 142, 196, 0.25);
}

html.dark .note-card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Анимация для кнопок */
.btn-primary,
.toolbar-btn,
.btn-complete,
.btn-invite-accept {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary::before,
.toolbar-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.toolbar-btn:hover::before {
  width: 300px;
  height: 300px;
}

/* Плавное появление модальных окон */
.modal-overlay {
  animation: fadeIn 0.3s ease;
}

.modal-panel {
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Анимация для сообщений */
.message {
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Анимация для избранного */
.favorite-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.favorite-item:hover {
  transform: translateX(4px);
  background: var(--secondary);
}

/* Анимация для контактов */
.contact-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.contact-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  transform: scaleY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-btn.selected::before,
.contact-btn:hover::before {
  transform: scaleY(1);
}

/* Анимация для закрепленных заметок */
.note-card.is-pinned {
  animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.note-card.is-pinned::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  opacity: 0.15;
  z-index: -1;
  animation: gradientShift 3s ease infinite;
  background-size: 200% 200%;
}

html.dark .note-card.is-pinned::before {
  opacity: 0.1;
}

/* Анимация для избранных заметок */
.note-card.is-favorite {
  position: relative;
}

.note-card.is-favorite::after {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 0 1.5rem 0 1rem;
  opacity: 0.2;
  pointer-events: none;
}

/* Плавная анимация для переключателя темы */
#theme-toggle {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#theme-toggle:hover {
  transform: rotate(20deg) scale(1.1);
}

#theme-toggle:active {
  transform: rotate(20deg) scale(0.95);
}

/* Анимация для эмодзи */
.emoji-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.emoji-btn:hover {
  transform: scale(1.2);
}

.emoji-btn:active {
  transform: scale(0.9);
}

/* Анимация для аватаров */
.avatar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(155, 142, 196, 0.3);
}

/* Анимация для бейджей */
.badge {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Анимация для форм */
.form-input {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
  transform: translateY(-1px);
}

/* Анимация для пагинации */
.pagination-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-btn:hover:not(.disabled) {
  transform: translateY(-2px);
}

.pagination-btn:active:not(.disabled) {
  transform: translateY(0);
}

/* Анимация для сайдбара */
.sidebar-wrap {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Анимация для комментариев */
.comment-card {
  animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.comment-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(155, 142, 196, 0.15);
}

/* Анимация для настроек */
.settings-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(155, 142, 196, 0.15);
}

/* Анимация для приглашений */
.invite-card {
  animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.invite-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(155, 142, 196, 0.2);
}

/* Анимация загрузки */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Плавное появление элементов списка */
.contact-row,
.favorite-item,
.note-card {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.contact-row:nth-child(1) { animation-delay: 0.05s; }
.contact-row:nth-child(2) { animation-delay: 0.1s; }
.contact-row:nth-child(3) { animation-delay: 0.15s; }
.contact-row:nth-child(4) { animation-delay: 0.2s; }
.contact-row:nth-child(5) { animation-delay: 0.25s; }

.note-card:nth-child(1) { animation-delay: 0.05s; }
.note-card:nth-child(2) { animation-delay: 0.1s; }
.note-card:nth-child(3) { animation-delay: 0.15s; }
.note-card:nth-child(4) { animation-delay: 0.2s; }
.note-card:nth-child(5) { animation-delay: 0.25s; }
.note-card:nth-child(6) { animation-delay: 0.3s; }

/* Эффект ripple для кнопок */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.btn-primary,
.toolbar-btn,
.btn-complete {
  position: relative;
  overflow: hidden;
}

.btn-primary:active::after,
.toolbar-btn:active::after,
.btn-complete:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 0.6s ease-out;
}

/* Улучшенная анимация для drag & drop */
.note-card.dragging {
  opacity: 0.5;
  transform: scale(0.98) rotate(2deg);
  box-shadow: 0 12px 48px rgba(155, 142, 196, 0.4);
  cursor: grabbing;
}

.note-card.drag-over {
  border-color: var(--primary);
  border-width: 2px;
  transform: scale(1.02);
  background: rgba(155, 142, 196, 0.05);
}

html.dark .note-card.drag-over {
  background: rgba(167, 139, 250, 0.08);
}

/* Анимация для удаления элементов */
@keyframes fadeOutScale {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.removing {
  animation: fadeOutScale 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Плавная анимация для переключения вкладок */
.sidebar-tab-content {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Анимация для лайтбокса */
.lightbox {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-img {
  animation: lightboxIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes lightboxIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Улучшенная анимация для статус-бейджей */
.status-auto-delete.urgent {
  animation: pulse-badge 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes pulse-badge {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* Smooth transitions для всех интерактивных элементов */
a, button, input, textarea, select {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Отключение анимаций для пользователей с prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}ntialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Фикс для iOS Safari */
@supports (-webkit-touch-callout: none) {
  .h-screen {
    height: -webkit-fill-available;
  }
  
  .min-h-screen {
    min-height: -webkit-fill-available;
  }
}

/* Улучшение контрастности для доступности */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(155, 142, 196, 0.4);
  }
  
  html.dark {
    --border: rgba(167, 139, 250, 0.3);
  }
  
  .note-card {
    border-width: 2px;
  }
}

/* Уменьшение движения для пользователей с вестибулярными нарушениями */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Темная тема для системных предпочтений */
@media (prefers-color-scheme: dark) {
  html:not(.light) {
    --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);
  }
}

/* Оптимизация для печати */
@media print {
  .sidebar-wrap,
  .toolbar-btn,
  .btn-ghost,
  .modal-overlay,
  .pagination-wrap,
  .messages {
    display: none !important;
  }
  
  .note-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  
  body {
    background: white;
    color: black;
  }
}
