/* CRM Callcentre — Apple-style light theme.
   SF Pro + vibrant pastel + frosted glass. */

:root {
  /* Базовая палитра — Big Sur light */
  --bg:        #F2F4F8;          /* off-white desktop bg */
  --bg2:       #FFFFFF;           /* nested */
  --surface:   #FFFFFF;          /* card */
  --surface2:  #F7F8FA;          /* nested */
  --line:      rgba(0,0,0,0.06);  /* hairline */
  --line-strong: rgba(0,0,0,0.10);
  --txt:       #0B0B0F;
  --muted:     #6E6E76;
  --dim:       #9A9AA2;

  /* Apple system акценты */
  --blue:      #007AFF;          /* iOS blue */
  --indigo:    #5856D6;
  --purple:    #AF52DE;
  --purple-l:  #BF5AF2;
  --purple-d:  #5E5CE6;
  --teal:      #34C759;          /* iOS green */
  --teal-d:    #248A3D;
  --teal-bg:   rgba(52,199,89,0.12);
  --cyan:      #5AC8FA;
  --gold:      #FFD60A;          /* iOS yellow */
  --gold-dark: #B25000;
  --orange:    #FF9500;
  --pink:      #FF2D55;
  --coral:     #FF6482;
  --coral-d:   #C73651;
  --coral-l:   #FFD7DE;

  --danger:    #FF3B30;
  --success:   var(--teal);

  /* Скругления */
  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  /* Apple-spring анимации */
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:  240ms;
  --dur:       420ms;
  --dur-slow:  700ms;

  --inset-hi:  inset 0 1px 0 rgba(255,255,255,0.7);
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 0 0 1px rgba(15,23,42,0.04);
  --shadow:    0 6px 24px -6px rgba(15,23,42,0.10), 0 2px 6px -2px rgba(15,23,42,0.06);
  --shadow-lg: 0 24px 60px -20px rgba(15,23,42,0.18);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Мягкая «vibrancy»: пастельные пятна по углам */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at -10% -10%, rgba(0,122,255,0.10), transparent 60%),
    radial-gradient(800px 600px at 110% -20%, rgba(175,82,222,0.10), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(52,199,89,0.08), transparent 60%);
}
a { color: var(--blue); text-decoration: none; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--indigo); text-decoration: none; }
button { font-family: inherit; transition: all var(--dur-fast) var(--ease); }

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 50% -180px, rgba(127, 119, 221, 0.18), transparent 60%);
}
.login-card {
  width: 100%; max-width: 420px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px; box-shadow: var(--shadow);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--txt); }
.login-card p  { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.field         { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label   { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select {
  background: var(--surface2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; color: var(--txt); font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 4px rgba(0,122,255,0.15);
}
.btn {
  width: 100%;
  background: linear-gradient(180deg, #1F8DFF, var(--blue));
  color: #fff; border: 0;
  padding: 13px 18px; border-radius: 14px; font-weight: 600; cursor: pointer; font-size: 15px;
  box-shadow: 0 4px 14px -2px rgba(0,122,255,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.btn:hover    { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 22px -4px rgba(0,122,255,0.5), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn:active   { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface2); color: var(--txt); border: 1px solid var(--line); box-shadow: none; }
.btn.secondary:hover { background: #fff; border-color: var(--line-strong); }
.error {
  background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger); padding: 10px 12px; border-radius: 9px; font-size: 14px; margin-bottom: 14px;
}

/* ---------- Топ-бар (общий) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 14px;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  box-shadow: 0 6px 16px -4px rgba(0,122,255,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.topbar .h-title { font-size: 22px; font-weight: 700; color: var(--txt); line-height: 1.1; letter-spacing: -0.02em; }
.topbar .h-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }
.topbar .live    { color: var(--teal); font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar select, .topbar input[type="date"] {
  background: rgba(255,255,255,0.7); color: var(--txt); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 14px; font-size: 13px; font-family: inherit; font-weight: 500;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.topbar select:hover, .topbar input[type="date"]:hover { border-color: var(--line-strong); background: #fff; }
.topbar .pill   {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.7); border: 1px solid var(--line);
  color: var(--txt); font-size: 12px; font-weight: 600;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transition: all var(--dur-fast) var(--ease);
}
.topbar a.pill { color: var(--blue); }
.topbar a.pill:hover { background: rgba(0,122,255,0.10); border-color: rgba(0,122,255,0.30); text-decoration: none; }
.topbar .avatar {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 12px -2px rgba(0,122,255,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.topbar button {
  background: rgba(255,255,255,0.7); color: var(--txt); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 500;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.topbar button:hover { color: var(--blue); border-color: rgba(0,122,255,0.25); background: rgba(0,122,255,0.05); }

.content { max-width: 1280px; margin: 0 auto; padding: 0 32px 48px; }
.sec-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin: 36px 0 14px; letter-spacing: -0.01em;
}
.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpis.kpis-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1100px) {
  .kpis.kpis-6 { grid-template-columns: repeat(3, 1fr); }
}
.kpi  {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.kpi:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.kpi .lbl {
  font-size: 12px; color: var(--muted); margin-bottom: 12px;
  font-weight: 600; letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.kpi .lbl i {
  font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #fff; box-shadow: 0 4px 10px -2px rgba(0,122,255,0.4);
}
.kpi .val {
  font-size: 36px; font-weight: 700; color: var(--txt); line-height: 1;
  letter-spacing: -0.03em;
  font-feature-settings: 'tnum';
}
.kpi.accent .val { background: linear-gradient(135deg, var(--teal), var(--blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 8px; font-weight: 500; }

/* ---------- График ---------- */
.chart-block { padding: 22px 26px; }
.chart-block canvas {
  width: 100% !important;
  height: 420px !important;
}
@media (max-width: 760px) {
  .chart-block canvas { height: 280px !important; }
}

/* ---------- Герои дня ---------- */
.heroes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px;
}
.hero {
  position: relative; overflow: hidden;
  background: var(--hero-grad, var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 32px; box-shadow: var(--shadow);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.hero:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.hero .hero-glow {
  position: absolute; top: -50px; right: -50px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,0.5), transparent 70%);
  border-radius: 50%; pointer-events: none;
}
.hero .hero-icon {
  font-size: 22px; margin-bottom: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.6));
  color: var(--orange);
  box-shadow: 0 6px 18px -4px rgba(255,149,0,0.45), inset 0 1px 0 rgba(255,255,255,0.6);
}
.hero .hero-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: -0.005em; margin-bottom: 6px;
}
.hero .hero-name { font-size: 22px; font-weight: 700; color: var(--txt); margin-bottom: 16px; letter-spacing: -0.02em; }
.hero .hero-value {
  font-size: 52px; font-weight: 700; color: var(--txt); line-height: 1;
  font-feature-settings: 'tnum'; letter-spacing: -0.04em;
}
.hero .hero-sub { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 500; }
.hero.hero-empty .hero-empty-text { color: var(--dim); font-size: 14px; margin-top: 8px; }
@media (max-width: 760px) { .heroes { grid-template-columns: 1fr; } }

/* ---------- Пьедестал ---------- */
.podium {
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  margin: 8px auto 0; max-width: 540px;
}
.pod { flex: 1; text-align: center; }
.pod .ava {
  margin: 0 auto 6px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.pod .name { font-size: 12px; font-weight: 600; color: #fff; }
.pod .pts  { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.pod .pts.gold { color: var(--gold); font-weight: 600; }
.pod .bar  { border-radius: 12px 12px 0 0; padding-top: 8px; }
.pod .medal { font-size: 18px; }
.pod .place { font-size: 16px; font-weight: 700; color: #C4C9D4; }
.pod .crown { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); font-size: 18px; }
.pod.center .ava-wrap { position: relative; width: 50px; height: 50px; margin: 0 auto 6px; }
.pod.center .ava { width: 50px; height: 50px; background: var(--purple); color: #fff; font-size: 15px; }
.pod.left  .ava { width: 44px; height: 44px; background: linear-gradient(135deg, var(--teal), var(--cyan)); color: #fff; font-size: 14px; }
.pod.right .ava { width: 44px; height: 44px; background: linear-gradient(135deg, var(--pink), var(--coral)); color: #fff; font-size: 14px; }
.pod.center .ava { background: linear-gradient(135deg, var(--blue), var(--purple)); }
.pod.left  .bar { background: var(--surface); border: 1px solid var(--line); height: 58px; box-shadow: var(--shadow-sm); }
.pod.center .bar { background: linear-gradient(180deg, #FFE066, var(--gold)); height: 84px; padding-top: 10px; box-shadow: 0 8px 24px -8px rgba(255,214,10,0.6); border: 1px solid rgba(255,214,10,0.4); }
.pod.right .bar { background: var(--surface); border: 1px solid var(--line); height: 44px; padding-top: 6px; box-shadow: var(--shadow-sm); }
.pod.center .place { color: var(--gold-dark); font-size: 20px; font-weight: 800; }
.pod .place { color: var(--txt); }
.pod .name { color: var(--txt); }
.pod .pts.gold { color: var(--orange); }
.pod.center .medal { font-size: 22px; }

/* ---------- Таблица лидеров (десктоп) ---------- */
.tbl-head, .row {
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr 1.1fr 1fr 0.9fr;
}
.tbl-head {
  padding: 0 16px 10px; font-size: 11px; color: var(--dim);
  text-transform: uppercase; letter-spacing: .3px;
}
.tbl-head > div:not(:first-child) { text-align: center; }
.tbl-head > div:last-child         { text-align: right; }

.row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.row:hover { border-color: var(--line-strong); transform: translateX(2px); }
.row.me {
  border-color: rgba(0,122,255,0.35);
  background: linear-gradient(135deg, rgba(0,122,255,0.06), rgba(175,82,222,0.04));
}
.row .nm { display: flex; align-items: center; gap: 10px; }
.row .ava {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.row .name { font-size: 14px; font-weight: 600; color: var(--txt); }
.row .row-tag { font-size: 11px; color: var(--blue); font-weight: 600; margin-left: 6px; }
.row .c    { text-align: center; font-size: 14px; font-weight: 600; }
.row .c.blue  { color: var(--blue); }
.row .c.teal  { color: var(--teal-d); }
.row .c.gold  { color: var(--orange); }
.row .pts  { text-align: right; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; font-feature-settings: 'tnum'; }
.row .pts.gold  { color: var(--orange); }
.row .pts.teal  { color: var(--teal-d); }
.row .pts.coral { color: var(--pink); }
.muted-cell { color: var(--muted) !important; font-weight: 400 !important; font-size: 12px !important; }
.hint-cell { font-size: 11px; color: var(--dim); padding: 4px 16px; }

/* ---------- Блок «Звонки сегодня» ---------- */
.calls-head, .calls-row {
  display: grid; gap: 10px; align-items: center;
  grid-template-columns: 1.6fr repeat(6, 1fr);
}
.calls-head {
  background: transparent; font-size: 11px; color: var(--dim);
  text-transform: uppercase; padding: 0 14px 6px;
}
.calls-head .v { text-align: center; }
.calls-row {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px;
}
.calls-row:hover { border-color: var(--line-strong); background: #fff; }
.calls-row .v { text-align: center; font-size: 14px; }
.calls-row .nm { font-size: 13px; font-weight: 600; }
.calls-row.me { border-left: 3px solid var(--gold); }

/* ---------- Лента лидов ---------- */
.lead-item {
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  color: var(--txt); padding: 14px 0; border-bottom: 1px solid var(--line);
  transition: padding var(--dur-fast) var(--ease);
}
.lead-item:last-child { border-bottom: none; }
.lead-item:hover { padding-left: 4px; }
.lead-item .ico       { color: var(--teal); font-size: 16px; flex-shrink: 0; }
.lead-item .lead-title { color: var(--txt); flex-shrink: 1; max-width: 56%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.lead-item .lead-title:hover { color: var(--blue); }
.lead-item .who       { color: var(--dim); font-size: 12px; margin-left: auto; white-space: nowrap; font-weight: 500; }
.tag {
  font-size: 11px; padding: 4px 10px; border-radius: 999px; flex-shrink: 0;
  font-weight: 600;
  border: 1px solid transparent;
}
.tag-office { background: rgba(175,82,222,0.10); color: var(--purple); border-color: rgba(175,82,222,0.20); }
.tag-online { background: var(--teal-bg); color: var(--teal-d); border-color: rgba(52,199,89,0.25); }

/* ---------- Тост (новая встреча) ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; max-width: 380px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.92);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line-strong);
  font-size: 14px; color: var(--txt); font-weight: 500;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  animation: toast-in 600ms var(--ease-bounce);
  z-index: 50;
}
@keyframes toast-in { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* ---------- Полноэкранный пуш ---------- */
.push-overlay {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(0,122,255,0.65), transparent 60%),
    radial-gradient(ellipse at 70% 70%, rgba(175,82,222,0.55), transparent 60%),
    rgba(15,23,42,0.4);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; z-index: 999;
}
.push-overlay.show { display: flex; animation: push-in 700ms var(--ease); }
@keyframes push-in { from { opacity: 0; } to { opacity: 1; } }
.push-overlay h2 { font-size: 56px; margin: 0 0 12px; color: #fff; font-weight: 700; letter-spacing: -0.03em; }
.push-overlay .sub { font-size: 22px; color: rgba(255,255,255,0.85); margin-bottom: 36px; }
.push-overlay .btn-close {
  background: #fff; color: var(--blue); border: none; padding: 16px 40px;
  font-size: 17px; font-weight: 600; border-radius: 999px; cursor: pointer;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transition: transform var(--dur-fast) var(--ease);
}
.push-overlay .btn-close:hover { transform: scale(1.04); }

/* ---------- Модалка (для админ-форм, в отличие от .push-overlay для пуша) ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.modal-overlay.hidden { display: none !important; }

/* ---------- Admin / Settings ---------- */
.settings-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px;
}
.link-btn {
  background: transparent; color: var(--blue); border: 0; cursor: pointer;
  padding: 2px 4px; font-size: 13px; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- Адаптив ---------- */
@media (max-width: 760px) {
  .content { padding: 0 16px 32px; }
  .topbar { padding: 14px 16px; }
  .kpis, .kpis.kpis-6 { grid-template-columns: repeat(2, 1fr); }
  .kpi .val { font-size: 26px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: unset; }

  .tbl-head { display: none; }
  .row {
    grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px 14px;
  }
  .row .nm { grid-column: 1 / -1; }
  .row .c::before, .row .pts::before {
    content: attr(data-l) " "; color: var(--muted); font-size: 10px; font-weight: 400;
  }
  .row .pts { text-align: left; }

  .calls-head { display: none; }
  .calls-row {
    grid-template-columns: 1fr 1fr; gap: 8px 10px;
  }
  .calls-row .nm { grid-column: 1 / -1; }
  .calls-row .v::before {
    content: attr(data-l) " "; color: var(--muted); font-size: 10px;
  }
  .calls-row .v { text-align: left; }

  .settings-grid { grid-template-columns: 1fr; }
  .lead-item .lead-title { max-width: 100%; }
}
