/* Базовые стили CRM. Подключается в index.html и login.html. */

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; letter-spacing: -0.01em; }
h1, h2, h3, h4, .heading-font {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

/* Боковое меню (тёмный сайдбар, светлый контент) */
.sidebar-item { transition: all 0.2s ease; color: #94a3b8; }
.sidebar-item:hover, .sidebar-item.active { background-color: rgba(255,255,255,0.06); color: #fff; }
.sidebar-item.active i { color: #8b5cf6; }

/* Переключение вкладок (надёжно перекрывает Tailwind .flex) */
.view-content:not(.active) { display: none !important; }
.view-content.active { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Підвкладки статистики */
.stats-tab { color: #94a3b8; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stats-tab:hover { color: #475569; }
.stats-tab.active { color: #8b5cf6; border-bottom-color: #8b5cf6; }

/* Перемикач типу транзакції */
.fin-kind-btn { color: #64748b; background: transparent; transition: all .15s ease; }
.fin-kind-btn:hover { background: rgba(255,255,255,0.5); }
.fin-kind-btn.active { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.fin-kind-btn[data-kind="income"].active { color: #059669; }
.fin-kind-btn[data-kind="expense"].active { color: #e11d48; }
.fin-kind-btn[data-kind="transfer"].active { color: #7c3aed; }

/* Модальные окна */
.modal-active { display: flex !important; }
.modal-active > div { animation: fadeIn 0.2s ease-out; }

/* Скроллбары */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Автоподсказка Нова Пошта */
.np-ac { position: relative; }
.np-ac-box {
    position: absolute; left: 0; right: 0; top: 2px; z-index: 50;
    background: #fff; border: 1px solid #e2e8f0; border-radius: .6rem;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.25); max-height: 240px; overflow-y: auto;
}
.np-ac-box div {
    padding: 8px 14px; font-size: 13px; cursor: pointer; color: #334155;
}
.np-ac-box div:hover { background: #f1f5f9; }
body.dark .np-ac-box { background: #14141f; border-color: #2a2a3c; }
body.dark .np-ac-box div { color: #e6e6f0; }
body.dark .np-ac-box div:hover { background: #1f1f2e; }

/* Карточки выбора темы */
.theme-card { border-color: #e2e8f0; background: #fff; }
.theme-card:hover { border-color: #c4b5fd; }
.theme-card .theme-check { color: transparent; }
.theme-card.selected { border-color: #7c3aed; box-shadow: 0 0 0 4px rgba(124,58,237,.12); }
.theme-card.selected .theme-check { color: #7c3aed; }

/* Телефон клиента и кнопки ТТН/ЧЕК (обе темы) */
.order-phone { color: #64748b; }
a.phone-call { color: inherit; text-decoration: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px;
    border-radius: 6px; padding: 1px 6px; transition: background-color .15s ease, color .15s ease; }
a.phone-call:hover { background-color: rgba(139,92,246,.08); color: #7c3aed; }
a.phone-call .fa-phone { font-size: 9px; opacity: 0; transition: opacity .15s ease; }
a.phone-call:hover .fa-phone { opacity: 1; }

/* Toast-сповіщення */
#appToast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
    background: #0f172a; color: #fff; font-weight: 700; font-size: 13px;
    padding: 10px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(15,23,42,.3);
    z-index: 200; pointer-events: none; opacity: 0;
    transition: opacity .2s ease, transform .2s ease; }
#appToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ttn-btn { font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff;
    padding: 3px 10px; border-radius: 7px; transition: filter .15s ease, transform .1s ease; }
.ttn-btn:hover { filter: brightness(1.1); }
.ttn-btn:active { transform: scale(.96); }
.ttn-btn-pink { background: #ec4899; }
.ttn-btn-blue { background: #3b82f6; }

/* Индикатор чека Checkbox рядом с кнопкой ЧЕК */
.receipt-ok, .receipt-err {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 9999px;
    font-size: 12px; font-weight: 800; text-decoration: none;
    margin-left: 2px; transition: filter .15s ease, transform .1s ease;
}
.receipt-ok { background: #16a34a; color: #fff; }
.receipt-err { background: #dc2626; color: #fff; border: none; cursor: pointer; }
.receipt-ok:hover, .receipt-err:hover { filter: brightness(1.1); }
.receipt-ok:active, .receipt-err:active { transform: scale(.95); }

/* Повторный клиент: подсветка номера заказа */
.repeat-id {
    display: inline-block; padding: 2px 8px; border-radius: 8px;
    background: #fef3c7; color: #b45309; cursor: help;
    box-shadow: inset 0 0 0 1.5px #f59e0b;
}
body.dark .repeat-id { background: rgba(245,158,11,.18); color: #fcd34d; box-shadow: inset 0 0 0 1.5px rgba(245,158,11,.55); }

/* ============== ТЁМНАЯ ТЕМА (под референс-скриншот) ============== */
body.dark { background: #0a0a0f !important; color: #e6e6f0; }
body.dark .bg-\[\#f8fafc\] { background: #0a0a0f !important; }
body.dark main { background: transparent !important; }

/* Сайдбар — почти чёрный */
body.dark .bg-\[\#020617\] { background: #050507 !important; }

/* Панели / карточки / шапка */
body.dark .bg-white,
body.dark .bg-white\/80 { background: #131320 !important; }
body.dark .bg-slate-50,
body.dark .bg-slate-100,
body.dark .bg-slate-50\/50,
body.dark .bg-slate-50\/60,
body.dark .bg-indigo-50\/50,
body.dark .bg-amber-50\/50 { background: #1a1a28 !important; }

/* Границы */
body.dark .border-slate-50,
body.dark .border-slate-100,
body.dark .border-slate-200,
body.dark .border-slate-800 { border-color: #262636 !important; }
body.dark .divide-slate-50 > :not([hidden]) ~ :not([hidden]),
body.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #21212f !important; }

/* Текст */
body.dark .text-slate-800,
body.dark .text-slate-700,
body.dark .text-slate-600 { color: #ededf5 !important; }
body.dark .text-slate-500,
body.dark .text-slate-400 { color: #8b8b9c !important; }
body.dark .text-slate-300,
body.dark .text-slate-200 { color: #5b5b6b !important; }

/* Акцентные заголовки страниц — фиолетовые, как на скриншоте */
body.dark h2 { color: #a78bfa !important; }

/* Поля ввода / выпадайки */
body.dark input,
body.dark select,
body.dark textarea { background: #14141f !important; color: #ededf5 !important; border-color: #2a2a3c !important; }
body.dark input::placeholder,
body.dark textarea::placeholder { color: #5a5a6e !important; }
body.dark select option { background: #14141f; color: #ededf5; }

/* Кнопка «Нове замовлення» — фиолетово-фуксиевый градиент */
body.dark button.bg-violet-600,
body.dark button.bg-indigo-600 {
    background: linear-gradient(135deg, #7c3aed, #d946ef) !important;
    box-shadow: 0 8px 24px -10px rgba(168, 85, 247, .6) !important;
}

/* Телефон клиента — голубой акцент */
body.dark .order-phone { color: #38bdf8 !important; }

/* Наведение на строки */
body.dark .hover\:bg-slate-50:hover { background: #1a1a28 !important; }

/* Модалки / скроллбар */
body.dark .bg-slate-900\/60 { background: rgba(0,0,0,.72) !important; }
body.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #2f2f42; }

/* Карточки выбора темы в тёмном режиме */
body.dark .theme-card { background: #1a1a28; border-color: #262636; }
body.dark .theme-card.selected { border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(167,139,250,.18); }
body.dark .theme-card.selected .theme-check { color: #a78bfa; }

/* ============== СВОРАЧИВАЕМЫЙ САЙДБАР ============== */
#appSidebar { transition: width .25s ease; }

#appSidebar.nav-collapsed { width: 5rem; }
#appSidebar.nav-collapsed .nav-logo { padding-left: 0; padding-right: 0; }
#appSidebar.nav-collapsed .nav-logo > div { justify-content: center; }
#appSidebar.nav-collapsed h1,
#appSidebar.nav-collapsed .nav-section,
#appSidebar.nav-collapsed .nav-user-text { display: none; }
#appSidebar.nav-collapsed .nav-user { justify-content: center; padding-left: 0; padding-right: 0; }
#appSidebar.nav-collapsed > div { padding-left: .5rem; padding-right: .5rem; }
#appSidebar.nav-collapsed .sidebar-item {
    justify-content: center; gap: 0; padding-left: 0; padding-right: 0; font-size: 0;
}
#appSidebar.nav-collapsed .sidebar-item i { font-size: 16px; }

/* Світла тема використовує стандартні Tailwind кольори (фіолетовий акцент, slate фон) */
