/* Стили дашборда.

   Свой CSS, а не Tailwind или Bootstrap с CDN: приложение живёт на
   российской VDS, внешние CDN оттуда доступны нестабильно, а собирать
   фронтенд ради внутренней панели на несколько десятков пользователей
   несоразмерно задаче.

   Цвета взяты из скриптов РОПа, чтобы интерфейс читался как продолжение
   привычных ему материалов. */

:root {
    --brand: #4f9d91;
    --brand-dark: #3d7d73;
    --brand-light: #c9e5d0;
    --ink: #231f20;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f7f8f8;
    --card: #ffffff;
    --danger: #c0392b;
    --danger-bg: #fdecea;
    --warn: #b7791f;
    --warn-bg: #fef6e7;
    --ok: #2f855a;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- шапка --- */

.topbar {
    background: var(--ink);
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 52px;
}
.topbar .brand { font-weight: 600; letter-spacing: 0.02em; }
.topbar nav { display: flex; gap: 18px; flex: 1; }
.topbar nav a { color: #d9dcdc; padding: 4px 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar nav a.active { color: #fff; border-bottom-color: var(--brand); }
.topbar .who { color: #9ca3af; font-size: 13px; }
.topbar form { margin: 0; }
.topbar button {
    background: none; border: 1px solid #4b5563; color: #d9dcdc;
    padding: 4px 10px; border-radius: var(--radius); cursor: pointer; font-size: 13px;
}
.topbar button:hover { border-color: #9ca3af; color: #fff; }

/* --- каркас --- */

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase;
     letter-spacing: 0.04em; font-weight: 600; }
.subtitle { color: var(--muted); margin: 0 0 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* --- показатели --- */

.metric { background: var(--card); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 14px 16px; }
.metric .label { color: var(--muted); font-size: 12px; text-transform: uppercase;
                 letter-spacing: 0.04em; }
.metric .value { font-size: 26px; font-weight: 600; margin-top: 4px; }
.metric .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }

/* --- таблицы --- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase;
     letter-spacing: 0.03em; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfb; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

/* --- бейджи --- */

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px;
         font-size: 12px; white-space: nowrap; border: 1px solid transparent; }
.badge.ok { background: var(--brand-light); color: #1f5f52; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: #f1f2f3; color: var(--muted); }

.score { font-weight: 600; }
.score.good { color: var(--ok); }
.score.mid { color: var(--warn); }
.score.bad { color: var(--danger); }

/* --- фильтры и формы --- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 12px; color: var(--muted); }
input, select, textarea {
    font: inherit; padding: 6px 8px; border: 1px solid var(--line);
    border-radius: var(--radius); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand-light); border-color: var(--brand);
}
.checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.checkbox input { width: auto; }

button, .btn {
    font: inherit; padding: 6px 14px; border-radius: var(--radius);
    border: 1px solid var(--brand); background: var(--brand); color: #fff;
    cursor: pointer;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary, button.secondary {
    background: #fff; color: var(--brand-dark); border-color: var(--line);
}
.btn.secondary:hover, button.secondary:hover { background: #f3f5f5; }

/* --- карточка звонка --- */

.call-head { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.call-head .total { text-align: center; min-width: 130px; }
.call-head .total .num { font-size: 44px; font-weight: 700; line-height: 1; }
.call-head .total .of { color: var(--muted); font-size: 13px; }

dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }

.criterion { border-bottom: 1px solid var(--line); padding: 12px 0; }
.criterion:last-child { border-bottom: none; }
.criterion .head { display: flex; align-items: baseline; gap: 10px; }
.criterion .title { font-weight: 600; flex: 1; }
.criterion .comment { color: #374151; margin: 4px 0; }
.criterion .improved {
    background: var(--brand-light); border-left: 3px solid var(--brand);
    padding: 6px 10px; margin-top: 6px; border-radius: 0 var(--radius) var(--radius) 0;
}
.corrected { color: var(--warn); font-size: 12px; }

.quote {
    border-left: 3px solid var(--line); padding: 3px 10px; margin: 4px 0;
    color: #374151; font-style: italic;
}
.quote .tc { font-style: normal; color: var(--brand-dark); font-weight: 600;
             cursor: pointer; margin-right: 6px; }
.quote.unverified { border-left-color: var(--danger); background: var(--danger-bg); }

.steps li { margin-bottom: 4px; }
.steps .done { color: var(--ok); }
.steps .missed { color: var(--danger); }
.steps .optional { color: var(--muted); }

.transcript {
    max-height: 460px; overflow-y: auto; background: #fbfcfc;
    border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
    font-size: 13px;
}
.transcript .line { padding: 2px 4px; border-radius: 4px; }
.transcript .line.manager { color: #1f2937; }
.transcript .line.client { color: #4b5563; }
.transcript .line.highlight { background: #fff3cd; }
.transcript .tc { color: var(--brand-dark); font-weight: 600; margin-right: 6px; }
.transcript .who { font-weight: 600; margin-right: 4px; }

audio { width: 100%; margin-top: 8px; }

/* --- служебное --- */

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--brand-light); color: #1f5f52; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* --- вход --- */

.login-wrap { max-width: 380px; margin: 90px auto; }
.login-wrap h1 { text-align: center; margin-bottom: 20px; }
.login-wrap .field { margin-bottom: 12px; }
.login-wrap input { width: 100%; }
.login-wrap button { width: 100%; padding: 9px; }

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 10px; }
    main { padding: 12px; }
    .call-head { flex-direction: column; }
}
