/* ============ Дизайн-система: «Современный SaaS» ============
   Шрифты: Geologica (заголовки/цифры), Onest (текст)
   Палитра: изумруд #0e6d4f, мягкие пастельные плитки, белые карточки */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f4;
  --card: #ffffff;
  --ink: #15211c;
  --ink-2: #3c4a43;
  --mut: #7c8a83;
  --line: #e6eae7;
  --accent: #0e6d4f;
  --accent-dark: #0a5028;
  --red: #b3382a;      --red-soft: #fdeeec;  --red-mid: #e2604d;
  --green: #176b3a;    --green-soft: #e7f4ea; --green-mid: #3f9e63;
  --amber: #8a6100;    --amber-soft: #fff3d6; --amber-mid: #eeb63c;
  --blue: #1c5a8a;     --blue-soft: #e6f0f8;
  --gray-ink: #3d3f4d; --gray-soft: #f0f0f4;
  --shadow: 0 1px 3px rgba(20, 40, 30, 0.06), 0 4px 16px rgba(20, 40, 30, 0.04);
  --r-card: 16px;
  --r-el: 12px;
}

body {
  font-family: Onest, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .title, .metric .val, .avatar, .score-tile .num, .avg-score, .modal .h {
  font-family: Geologica, Onest, sans-serif;
}

.page { max-width: 1000px; margin: 0 auto; padding: 28px 24px 56px; }
.title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }

/* ---------- Кнопки ---------- */
.btn {
  font-family: Onest, sans-serif;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 99px; padding: 9px 18px;
  background: var(--card); cursor: pointer; text-decoration: none; color: var(--ink);
  display: inline-block; transition: all .15s ease;
}
.btn:hover { border-color: #c9d2cc; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.full { width: 100%; text-align: center; }

/* ---------- Метрики главной ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.metric {
  background: var(--card); border-radius: var(--r-card); padding: 18px 20px;
  box-shadow: var(--shadow); animation: rise .4s ease both;
}
.metric:nth-child(2) { animation-delay: .06s; }
.metric:nth-child(3) { animation-delay: .12s; }
.metric .lbl { font-size: 12.5px; color: var(--mut); }
.metric .val { font-size: 30px; font-weight: 700; margin-top: 2px; letter-spacing: -0.02em; }

/* цветные плитки-метрики (отчёт) */
.metric.tint-red   { background: var(--red-soft); }
.metric.tint-red .val   { color: var(--red); }
.metric.tint-red .lbl   { color: #a0685f; }
.metric.tint-green { background: var(--green-soft); }
.metric.tint-green .val { color: var(--green); }
.metric.tint-green .lbl { color: #5c8a6d; }
.metric.tint-amber { background: var(--amber-soft); }
.metric.tint-amber .val { color: var(--amber); }
.metric.tint-amber .lbl { color: #a3833c; }
.metric.tint-gray  { background: var(--gray-soft); }
.metric.tint-gray .val  { color: var(--gray-ink); }
.metric.tint-gray .lbl  { color: #7f8292; }
.cards.four { grid-template-columns: repeat(4, 1fr); }

/* ---------- Карточки-секции ---------- */
.screen {
  background: var(--card); border: none; border-radius: var(--r-card);
  padding: 22px 24px; margin-bottom: 14px; box-shadow: var(--shadow);
  animation: rise .4s ease both;
}
.screen:nth-of-type(2) { animation-delay: .06s; }
.screen:nth-of-type(3) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { font-weight: 600; color: var(--mut); text-align: left; padding: 8px 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
td { padding: 11px 10px; border-top: 1px solid var(--line); }
tr:hover td { background: #fafbfa; }
td a { color: var(--accent); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* ---------- Плашки ---------- */
.pill {
  font-size: 12.5px; font-weight: 600; padding: 5px 13px; border-radius: 99px;
  white-space: nowrap; display: inline-block;
}
.pill.blue  { background: var(--blue-soft);  color: var(--blue); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.gray  { background: var(--gray-soft);  color: #63667a; }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red   { background: var(--red-soft);   color: var(--red); }

.muted { color: var(--mut); }

/* ---------- Логин ---------- */
.center-wrap { display: flex; justify-content: center; align-items: center; }
.login-wrap { min-height: 100vh; background: var(--bg); }

/* ---------- Модалки ---------- */
.modal {
  background: var(--card); border: none; border-radius: 20px; padding: 24px;
  width: 400px; box-shadow: 0 8px 40px rgba(20, 40, 30, 0.14);
}
.modal .h { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
label { font-size: 13px; color: var(--mut); display: block; margin-top: 10px; font-weight: 500; }
input[type=text], input[type=password], input[type=date], input[type=number], select {
  width: 100%; margin: 6px 0 8px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-el);
  padding: 0 12px; font-size: 14px; background: #fafbfa; font-family: inherit; transition: border .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); background: #fff; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 6px; }
.type { border: 1.5px solid var(--line); border-radius: var(--r-el); padding: 12px; display: block; cursor: pointer; transition: all .15s; }
.type:hover { border-color: #c9d2cc; }
.type.sel { border-color: var(--accent); background: #f2f8f5; }
.type .n { font-weight: 600; font-size: 13.5px; }
.type .d { font-size: 12px; color: var(--mut); margin-top: 2px; }

/* ---------- Аватар ---------- */
.avatar {
  width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
  flex-shrink: 0;
}

/* ---------- Оценки-бары ---------- */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 18px 0 4px; }
.bar-row { display: grid; grid-template-columns: 158px 1fr 38px; align-items: center; gap: 12px; margin-bottom: 11px; }
.bar-row span:first-child { font-size: 13px; color: var(--ink-2); font-weight: 500; width: auto; }
.bar-row span:last-child { width: auto; text-align: right; font-weight: 600; font-size: 14px; }
.track { flex: 1; height: 12px; background: #eef1ef; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; border-radius: 99px; transition: width .6s ease; }
.fill.g { background: var(--green-mid); }
.fill.a { background: var(--amber-mid); }
.fill.r { background: var(--red-mid); }

.sec-lbl { font-family: Geologica, sans-serif; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.outcome { line-height: 2; font-size: 13.5px; }
.divider { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 14px; }

/* ---------- Цитаты и выводы ---------- */
.quote { background: #f2f7f4; border-radius: var(--r-el); padding: 12px 16px; margin-top: 10px; color: var(--ink-2); font-style: italic; }
.summary-box {
  background: #f2f7f4; border-radius: var(--r-el); padding: 14px 18px;
  line-height: 1.65; margin-bottom: 16px; font-size: 13.5px; color: #2c3a33;
}
.quote-block { border-left: 3px solid var(--red-mid); border-radius: 0 var(--r-el) var(--r-el) 0; background: #fafbfa; padding: 10px 14px; margin-bottom: 10px; }
.quote-block .q { font-style: italic; font-size: 13.5px; color: var(--ink-2); }
.quote-block .c { font-size: 12.5px; color: var(--mut); margin-top: 5px; }

.sw-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.sw-cols > div { background: #fafbfa; border-radius: var(--r-el); padding: 14px 16px; }
.sw-cols .h-good { color: var(--green); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.sw-cols .h-bad { color: var(--red); font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.sw-cols ul { padding-left: 16px; margin: 0; font-size: 13px; line-height: 1.75; color: var(--ink-2); }

/* ---------- Плитки оценок (карточка звонка) ---------- */
.score-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 14px 0 18px; }
.score-tile { background: #fafbfa; border-radius: var(--r-el); padding: 12px 10px; text-align: center; }
.score-tile .num { font-size: 24px; font-weight: 700; }
.score-tile .lbl { font-size: 11.5px; color: var(--mut); margin-top: 4px; }
.score-tile .track { height: 5px; margin-top: 8px; }
.score-tile .fill { height: 5px; }
.txt-g { color: var(--green); }
.txt-a { color: var(--amber); }
.txt-r { color: var(--red); }
.avg-score { font-size: 24px; font-weight: 700; }

/* ---------- Расшифровка ---------- */
.line { margin-bottom: 9px; line-height: 1.65; font-size: 13.5px; }
.mgr { color: var(--accent); font-weight: 600; }
.drv { color: #63667a; font-weight: 600; }
.bad { background: var(--red-soft); border-radius: var(--r-el); padding: 9px 14px; color: var(--red); font-size: 13px; }
.transcript { white-space: pre-wrap; line-height: 1.65; font-size: 13.5px; margin-top: 10px; }
.transcript-lines { line-height: 1.65; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; color: var(--mut); }
details[open] summary::before { content: "▾ "; }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(21, 33, 28, 0.4);
  align-items: center; justify-content: center; z-index: 10; backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }

@media (max-width: 700px) {
  .cards, .cards.four { grid-template-columns: 1fr 1fr; }
  .cols, .sw-cols { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 34px; }
  .page { padding: 16px 12px 40px; }
}

/* ---------- Итоги звонков: распределение и причины ---------- */
.dist-bar { display: flex; height: 34px; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.dist-bar .seg {
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; min-width: 26px; transition: width .6s ease;
}
.seg-g { background: var(--green-mid); color: #fff; }
.seg-a { background: var(--amber-mid); color: #5c4a00; }
.seg-r { background: var(--red-mid); color: #fff; }
.seg-n { background: #c4c7d0; color: #3d3f4d; }
.dist-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 16px; }
.dist-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.dot-g { background: var(--green-mid); }
.dot-a { background: var(--amber-mid); }
.dot-r { background: var(--red-mid); }
.dot-n { background: #c4c7d0; }
.reasons-lbl { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 8px; }
.reason-chip {
  display: flex; align-items: flex-start; gap: 10px; background: var(--red-soft);
  border-radius: 10px; padding: 9px 13px; margin-bottom: 8px;
}
.reason-chip .cnt { font-family: Geologica, sans-serif; font-weight: 700; font-size: 15px; color: var(--red); min-width: 20px; text-align: center; }
.reason-chip span:last-child { font-size: 13px; color: #5c3833; line-height: 1.45; }

/* ---------- Заключение ИИ ---------- */
.verdict-box {
  background: #f2f7f4; border-left: 3px solid var(--accent); border-radius: 0 var(--r-el) var(--r-el) 0;
  padding: 12px 16px; font-size: 14px; line-height: 1.6; color: #22332b; margin-bottom: 16px;
}
.problem-card { display: flex; gap: 10px; background: #fafbfa; border-radius: var(--r-el); padding: 12px 14px; margin-bottom: 8px; }
.problem-card .num { font-family: Geologica, sans-serif; font-weight: 700; color: var(--red); font-size: 15px; }
.problem-card .body { flex: 1; }
.problem-card .t { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.problem-card .badge {
  background: var(--red-soft); color: var(--red); font-size: 11px; padding: 2px 8px;
  border-radius: 99px; font-weight: 600; margin-left: 6px; vertical-align: 1px;
}
.problem-card .d { font-size: 13px; color: #5a675f; line-height: 1.55; margin-top: 3px; }
.problem-card .ref { font-size: 12px; color: var(--mut); margin-top: 4px; }
.todo-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1ef; }
.todo-row:last-of-type { border-bottom: none; }
.todo-row .n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--amber-soft); color: var(--amber);
  font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-family: Geologica, sans-serif;
}
.todo-row span:last-child { font-size: 13.5px; color: #2c3a33; line-height: 1.55; }
.problem-card .ref a { color: var(--accent); text-decoration: none; font-weight: 500; }
.problem-card .ref a:hover { text-decoration: underline; }
