/* Системный шрифт: внешних шрифтов и CDN у сервиса нет (CLAUDE.md). */
:root {
  --bg: #ffffff;
  --fg: #1b1b1b;
  --muted: #6b6b6b;
  --line: #dcdcdc;
  --accent: #1f5fa9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; }
main { padding: 16px; }

.right { margin-left: auto; }
.who { color: var(--muted); }
.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.login { display: grid; gap: 12px; max-width: 320px; }
.login label { display: grid; gap: 4px; }
.login input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.login button { padding: 8px; cursor: pointer; }
.error { color: #b3261e; }
.muted { color: var(--muted); }

/* --- Список контактов ------------------------------------------------ */
h1 { font-size: 18px; margin: 0 0 12px; }

.counters { display: flex; gap: 18px; padding: 6px 0 10px; flex-wrap: wrap; }
.counter { color: var(--muted); }
.counter b { color: var(--fg); font-size: 15px; }

.filters {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.filters label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.filters .f-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg); }
.filters input[type=search], .filters select {
  font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px;
}
.f-search input { min-width: 260px; }

.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg); text-align: left; font-weight: 600;
  border-bottom: 1px solid var(--line); padding: 6px 8px; white-space: nowrap;
}
.grid td { border-bottom: 1px solid #f0f0f0; padding: 3px 8px; vertical-align: top; }
.grid tbody tr:hover { background: #fafafa; }

.c-name { width: 220px; }
.c-phone { width: 150px; white-space: nowrap; }
.c-region { width: 140px; }
.c-part { width: 120px; }
.c-community { width: 120px; }
.c-assignee { width: 160px; }
.c-status { width: 170px; }
.c-callback { width: 130px; white-space: nowrap; }
.c-comment { min-width: 200px; }

.tz { display: block; color: var(--muted); font-size: 11px; }
.chip {
  display: inline-block; padding: 0 6px; margin-right: 4px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 11px; line-height: 16px; cursor: default; white-space: nowrap;
}
.chip-project { border-color: #b9d0ea; }
.badge {
  display: inline-block; padding: 0 6px; border-radius: 9px;
  font-size: 11px; line-height: 16px;
}
.badge-ok { background: #e8f5e9; }
.badge-wait { background: #fff8e1; }
.badge-none { border: 1px solid var(--line); color: var(--muted); }
/* Статус подписан текстом всегда: цвет — вспомогательный, распечатка
   и монохромный экран не должны терять смысл (docs/04). */
.status { display: inline-block; padding: 0 6px; border-radius: 3px; }
.bad { color: #b3261e; }
.copy { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 0 2px; }
.pager { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: var(--muted); }
.pager button { font: inherit; padding: 3px 10px; cursor: pointer; }
.empty { color: var(--muted); padding: 20px 0; }

/* --- Правка прямо в строке (T-06) ---------------------------------- */
.status-select {
  font: inherit; width: 100%; border: 1px solid transparent; border-radius: 3px;
  padding: 1px 2px; cursor: pointer;
}
.status-select:hover, .status-select:focus { border-color: var(--line); }
.comment {
  font: inherit; width: 100%; resize: vertical; min-height: 22px; height: 22px;
  border: 1px solid transparent; border-radius: 3px; padding: 2px 4px; overflow: hidden;
}
.comment:hover { border-color: var(--line); }
.comment:focus { border-color: var(--accent); height: 5em; overflow: auto; }
.callback { font: inherit; width: 100%; border: 1px solid var(--line); border-radius: 3px; }
.save-mark { font-size: 11px; color: var(--muted); }
.save-mark.saved { color: #2e7d32; }

/* --- Карточка контакта (T-07) --------------------------------------- */
[x-cloak] { display: none !important; }

.card-panel:empty { display: none; }
.card-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw;
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -4px 0 16px rgba(0, 0, 0, .08);
  overflow-y: auto; z-index: 10;
}
.card-standalone .card { border: 1px solid var(--line); border-radius: 6px; max-width: 720px; }
.card { padding: 14px 16px 40px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-head h2 { font-size: 17px; margin: 0 0 2px; }
.card-head p { margin: 0; font-size: 12px; }
.card-close {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted);
}
.card-block { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.card-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
                 color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.pairs { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; margin: 0; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin-bottom: 3px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: 12px; padding: 3px 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: none;
}
.tabs button.active { background: #eef4fb; border-color: var(--accent); }
.template {
  white-space: pre-wrap; font: inherit; background: #fafafa;
  border: 1px solid var(--line); border-radius: 4px; padding: 8px; margin: 6px 0 0;
  max-height: 320px; overflow: auto;
}
.copy-text { font: inherit; font-size: 12px; padding: 3px 10px; cursor: pointer; }
.history { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.history li { display: grid; grid-template-columns: 108px 1fr; gap: 2px 8px;
              padding: 4px 0; border-bottom: 1px solid #f2f2f2; }
.history .when { color: var(--muted); }
.history .who { color: var(--muted); }
.history .what { grid-column: 2; }

/* --- Импорт (T-08) --------------------------------------------------- */
.preview { margin: 14px 0; }
.preview h3 { font-size: 15px; margin: 0 0 8px; }
.preview h4 { font-size: 13px; margin: 14px 0 6px; }
.warn-big {
  font-size: 18px; font-weight: 600; color: #b3261e;
  border: 2px solid #b3261e; border-radius: 6px; padding: 10px 12px;
}
.import-error { border-left: 3px solid #b3261e; padding: 6px 12px; }
.confirm { display: grid; gap: 6px; max-width: 560px; margin-top: 14px;
           border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.confirm button { justify-self: start; padding: 6px 16px; cursor: pointer; }
form.inline { display: flex; gap: 6px; align-items: center; }
code { font-size: 11px; }
.warn-columns {
  border-left: 3px solid #f5a623; background: #fffdf5;
  padding: 8px 12px; margin: 10px 0;
}
.export { font: inherit; padding: 5px 12px; cursor: pointer; align-self: flex-end; }

/* --- Дашборды (T-10) ------------------------------------------------- */
.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.tile {
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px;
  min-width: 150px; display: grid; gap: 2px;
}
.tile b { font-size: 22px; }
.tile span { color: var(--muted); font-size: 12px; }
.funnel { border-collapse: collapse; width: 100%; max-width: 640px; font-size: 13px; }
.funnel td { padding: 2px 6px; vertical-align: middle; }
.f-name { width: 170px; }
.f-bar { width: 100%; }
.f-bar span { display: block; height: 14px; border-radius: 3px; min-width: 2px; }
.f-num, .f-share { text-align: right; white-space: nowrap; width: 60px; }
.scroll-x { overflow-x: auto; }
.daily td.num, .daily th { text-align: right; white-space: nowrap; }
.daily .sticky-col { position: sticky; left: 0; background: var(--bg); text-align: left; }
.nowrap { white-space: nowrap; }
.topbar { flex-wrap: wrap; }
.c-pick { width: 28px; }
.bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
        padding: 8px 0; border-bottom: 1px solid var(--line); }
.bulk button, .bulk select { font: inherit; padding: 3px 8px; cursor: pointer; }
.bulk-done { color: #2e7d32; margin: 6px 0; }

/* --- Клавиатура (T-14) ----------------------------------------------- */
.grid tbody tr.row-current { background: #eef4fb; box-shadow: inset 2px 0 0 var(--accent); }
.shortcuts {
  position: fixed; right: 20px; bottom: 20px; z-index: 20;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 18px; box-shadow: 0 4px 20px rgba(0, 0, 0, .12); min-width: 280px;
}
.shortcuts h3 { margin: 0 0 8px; font-size: 13px; }
.shortcuts dl { display: grid; grid-template-columns: 80px 1fr; gap: 4px 10px; margin: 0 0 8px; font-size: 13px; }
.shortcuts dt { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.shortcuts dd { margin: 0; }
.shortcuts button { font: inherit; padding: 3px 10px; cursor: pointer; }
