:root{
  --bg:#f6fbf8;
  --surface:#ffffff;
  --muted:#6b7280;
  --border:#e5efe9;

  --primary:#16a34a;   /* основной зелёный */
  --primary-2:#10b981; /* вторичный акцент */
  --primary-3:#34d399; /* мятный */
  --dark:#064e3b;

  --success:#16a34a;
  --warning:#f59e0b;
  --danger:#ef4444;
  --text:#0f172a;
}

*{ box-sizing:border-box; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ===== Topbar ===== */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand{ display:flex; align-items:center; gap:12px; }
.logo{
  width:40px; height:40px; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 24px rgba(22,163,74,.25);
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
}
.brand-text .title{ font-weight:800; letter-spacing:.2px; }
.brand-text .subtitle{ font-size:12px; color:var(--muted); margin-top:2px; }

.top-actions .btn{ border-radius:12px; }
.user-pill{
  background:#eef7f2; border:1px solid var(--border); color:#065f46;
  padding:8px 12px; border-radius:12px; font-weight:600;
}

/* ===== Контент ===== */
.main-wrap{ padding: 18px; }

/* ===== Статистика ===== */
.stat-card{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  text-align:center;
  box-shadow: 0 10px 20px rgba(22,163,74,.05);
}
.stat-card .val{ font-size:28px; font-weight:800; line-height:1; color:var(--dark); }
.stat-card .lbl{ font-size:12px; color: var(--muted); margin-top:4px; }

/* ===== Tabs ===== */
.tab-btn{
  background: #e8f8ef;
  border: 1px solid var(--border);
  color: var(--dark);
  padding: 8px 14px;
  border-radius:12px;
  font-weight:700;
  transition:.15s;
}
.tab-btn:hover{ transform: translateY(-1px); }
.tab-btn.active{
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color:#fff; border-color: transparent;
  box-shadow: 0 8px 20px rgba(16,185,129,.25);
}

/* ===== Search ===== */
.search-group .input-group-text{ background:#eef7f2; border:1px solid var(--border); }
.search-group .form-control{ border:1px solid var(--border); }
.search-group .btn{ border-color: var(--primary); color: var(--primary); }

/* ===== Table ===== */
.table thead th{
  background:#eff8f2; font-weight:800; border-bottom:1px solid var(--border);
}
.table tbody tr:hover{ background:#f7fcf9; }
.link-unstyled{ text-decoration:none; color:inherit; }
.link-unstyled:hover{ text-decoration:underline; }

.date-chip{
  background:#edf6ef; border:1px solid var(--border);
  padding:4px 8px; border-radius:10px; font-size:12px; color:#065f46;
}

/* ===== Mobile cards ===== */
.lead-card{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px; margin-bottom:12px;
  box-shadow: 0 10px 24px rgba(16,185,129,.06);
}
.lead-row{ display:flex; gap:8px; align-items:center; margin-top:6px; }
.lead-row.between{ justify-content:space-between; margin-top:0; }
.lead-name{ font-weight:900; font-size:18px; color:var(--dark); }
.lead-contact{ color: var(--text); text-decoration:none; }
.lead-contact:hover{ text-decoration:underline; }
.lead-actions{ display:flex; gap:10px; margin-top:10px; }
.btn-open{ border-radius:12px; }

/* ===== iOS modal ===== */
.modal-ios{
  background: #ffffff !important;
  color: var(--text);
  border-radius: 26px;
  border: none;
  padding-top: 6px;
  animation: fadeIn .25s ease;
}
.modal-ios .modal-header{
  border-bottom: none;
  padding: 20px 22px 8px;
}
.modal-ios .modal-header .modal-title{
  font-weight: 700;
  font-size: 20px;
}
.modal-ios .btn-close{ filter: invert(0.3); }
.modal-ios .modal-body{ padding: 4px 22px 20px; }
.modal-ios .modal-footer{ border-top: none; padding: 0 22px 22px; }

/* Inputs iOS */
.modal-ios .form-control,
.modal-ios .form-select,
.modal-ios textarea{
  background: #f8faf9;
  border: 1px solid #dce7df;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  transition: .2s;
}
.modal-ios .form-select:focus,
.modal-ios .form-control:focus,
.modal-ios textarea:focus{
  background: #ffffff;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .25);
}
.modal-ios textarea{ min-height: 85px; }
.modal-ios .form-label{ font-size: 13px; color: #495b4d; margin-bottom: 6px; margin-top: 14px; }

/* Switches */
.modal-ios .form-check-input{
  width: 44px; height: 24px; border-radius: 12px; background-size: 18px;
}
.modal-ios .form-check-input:checked{
  background-color: var(--primary-2); border-color: var(--primary-2);
}

/* Save button */
.modal-ios #saveLeadBtn{
  width: 100%;
  border-radius: 16px;
  padding: 12px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none;
  box-shadow: 0 8px 16px rgba(16, 185, 129, .25);
}
.modal-ios #saveLeadBtn:active{ transform: scale(.98); }

/* Ghost-card для админки */
.card-ghost{
  background: linear-gradient(180deg, #f6fbf8, #ffffff);
  border:1px solid var(--border);
  border-radius:16px;
}

/* Бейджи мессенджеров */
.badge-bubble{
  border-radius:999px; padding:6px 10px; font-weight:800; font-size:12px; color:#fff;
  display:inline-flex; align-items:center; gap:6px;
}
.badge-bubble.wa{ background:#25D366; }
.badge-bubble.tg{ background:#2AABEE; }
.badge-bubble.vb{ background:#7360F2; }
.badge-bubble.ph{ background:#0ea5e9; }

/* Адаптив */
@media (min-width: 992px){
  .desktop-only{ display:block !important; }
  .mobile-only{ display:none !important; }
}
@media (max-width: 991px){
  .desktop-only{ display:none !important; }
  .mobile-only{ display:block !important; }
  .search-group{ margin-top:8px; }
}

/* Animation */
@keyframes fadeIn {
  from{ transform: translateY(16px); opacity:0; }
  to{ transform: translateY(0); opacity:1; }
}
/* === БАЗОВЫЙ ФОН === */
body.auth-body {
    background: #f2f8f4;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* === ФОРМА АВТОРИЗАЦИИ === */
.auth-box {
    background: #ffffff;
    width: 420px;
    padding: 40px 45px;
    border-radius: 22px;
    animation: fadeIn .4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === ЛОГО (КРУЖОК) === */
.auth-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1dbf60, #148f48);
    border-radius: 50%;
    margin: 0 auto 18px auto;
    box-shadow: 0 6px 18px rgba(0, 128, 64, 0.25);
}

/* === INPUT === */
.form-control {
    border-radius: 14px;
    border: 1px solid #dce5df;
    background: #f9fdfb;
    height: 48px;
    transition: .3s;
}

.form-control:focus {
    border-color: #1dbf60;
    background: #fff;
    box-shadow: 0 0 0 0.15rem rgba(0, 176, 76, 0.25);
}

/* === LABEL === */
.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #1a1d1a;
}

/* === КНОПКА ВХОД === */
button.btn-success {
    background: linear-gradient(135deg, #1dbf60, #14964c);
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    height: 50px;
    transition: .2s;
}

button.btn-success:hover {
    filter: brightness(1.06);
    transform: translateY(-2px);
}

/* === АЛЕРТ === */
.alert-danger {
    border-radius: 14px;
    font-size: 14px;
    padding: 10px 12px;
}

/* === ШАПКА CRM (когда пользователь вошёл) === */
.topbar {
    background: #ffffff;
    padding: 14px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e4eee8;
}

.topbar .logo {
    display: flex;
    align-items: center;
    font-size: 22px;
    font-weight: 600;
    color: #148f48;
}

.topbar .logo:before {
    content: "";
    width: 14px;
    height: 14px;
    background: #1dbf60;
    border-radius: 50%;
    margin-right: 8px;
}

.topbar .top-actions a {
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid #d8e7dd;
    font-size: 14px;
    text-decoration: none;
    transition: .25s;
    color: #2b2b2b;
}

.topbar .top-actions a:hover {
    background: #e9f6ef;
}

/* Кнопка выхода */
.top-actions .btn-logout {
    border-color: #ffb3b3;
    color: #c72e2e;
}

.top-actions .btn-logout:hover {
    background: #ffe6e6;
}
.topbar .dropdown-toggle {
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 500;
}

.dropdown-menu {
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}

.dropdown-item {
  border-radius: 8px;
  padding: 8px 12px;
}

.dropdown-item:hover {
  background: #e6faef;
}
