/* ТСН «Рузские просторы» — хелпдеск. Токены и готовые фрагменты.
   Чистый CSS, без внешних шрифтов и CDN. Только светлая тема.
   Копия одна на dashboard и manager — Express раздаёт их как две
   независимые статические папки, общий импорт между ними не настроен. */

:root {
  /* поверхности и фон */
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --surface-3: #f8f7f2;
  --fill: #f2f1eb;
  --fill-muted: #f4f3ee;

  /* границы */
  --border: #e4e2d8;
  --border-inner: #eceae1;
  --border-row: #f1f0ea;
  --border-control: #dedcd2;

  /* текст */
  --ink: #1e2419;
  --ink-body: #2b3226;
  --ink-2: #5c6156;
  --ink-3: #767b6d;
  --ink-label: #7b8072;
  --ink-4: #8a8f81;

  /* бренд */
  --green: #5fa858;
  --green-hover: #4e9349;
  --green-active: #457f41;
  --green-ink: #33682e;
  --green-link: #3f7a3a;
  --green-soft: #eaf3e4;
  --green-soft-bd: #d3e6c8;
  --green-bright: #68c12d;
  --green-dark: #22331e;

  /* тревога / SLA */
  --alarm: #c2452f;
  --alarm-ink: #9c3324;
  --alarm-bg: #fdf1ee;
  --alarm-row: #fdf5f3;
  --alarm-badge: #fbe6e0;
  --alarm-bd: #f0cbc0;

  /* радиусы и тени */
  --r-sm: 7px;  --r-md: 10px; --r-lg: 12px; --r-xl: 14px; --r-2xl: 16px; --r-pill: 999px;
  --sh-panel: 0 1px 2px rgba(30, 36, 25, .04);
  --sh-raised: 0 1px 2px rgba(30, 36, 25, .12);
  --ring-focus: 0 0 0 3px rgba(95, 168, 88, .18);
  --ring-select: 0 0 0 3px rgba(95, 168, 88, .16);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-link); text-decoration: none; }
a:hover { color: #2e5c2a; text-decoration: underline; }
::selection { background: #cfe8c3; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 16px 56px; box-sizing: border-box; }

/* ——— индикатор автополлинга ——— */
@keyframes pulseDot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
.poll-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-bright);
  animation: pulseDot 2.4s ease-in-out infinite;
  flex: none;
}
@media (prefers-reduced-motion: reduce) { .poll-dot { animation: none; } }

/* ——— select со локальной стрелкой (без иконочных шрифтов) ——— */
.select {
  appearance: none; -webkit-appearance: none;
  background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6"><path d="M1 1l4 4 4-4" fill="none" stroke="%23767b6d" stroke-width="1.5"/></svg>') no-repeat right 10px center;
  border: 1px solid var(--border-control);
  border-radius: 9px;
  padding: 8px 30px 8px 10px;
  font: inherit; font-size: 13.5px; color: var(--ink);
  min-height: 38px; cursor: pointer;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-label); }

/* ——— чип-чекбокс «только просроченные» ——— */
.chip-check {
  display: flex; align-items: center; gap: 8px; box-sizing: border-box;
  padding: 9px 14px; min-height: 38px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; border: 1px solid var(--border); color: var(--ink-2);
}
.chip-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--alarm); cursor: pointer; }
.chip-check.is-on { background: var(--alarm-badge); border-color: var(--alarm-bd); color: var(--alarm-ink); }

/* ——— сегменты статуса (рабочее место) ——— */
.seg {
  padding: 8px 14px; min-height: 38px; border-radius: var(--r-pill);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: #fff; border: 1px solid var(--border); color: var(--ink-2);
}
.seg.is-on { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }

/* ——— бейджи ——— */
.pill { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.pill--new    { background: #eaf3e4; color: #33682e; border: 1px solid #cfe4c4; }
.pill--work   { background: #eef2fa; color: #3a5480; border: 1px solid #d5def0; }
.pill--solved { background: #fdf4e3; color: #8a6215; border: 1px solid #f0e0bd; }
.pill--closed { background: #f1f0ea; color: #6b7064; border: 1px solid #e2e0d6; }

.pill--overdue { background: var(--alarm-badge); color: var(--alarm-ink); border: 1px solid var(--alarm-bd); font-weight: 700; }

.chan { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-sm); color: #4b5046; white-space: nowrap; }
.chan--max { background: #f0eef9; }
.chan--tg  { background: #e8f2f8; }
.chan--web { background: #f1f0ea; }

/* ——— кнопки ——— */
.btn-primary {
  width: 100%; min-height: 52px; border: none; border-radius: 13px;
  background: var(--green); color: #fff; font: inherit; font-size: 16px; font-weight: 650;
  cursor: pointer; box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.btn-primary:hover { background: var(--green-hover); }
.btn-primary:active { background: var(--green-active); }

.btn-secondary {
  width: 100%; min-height: 48px; border-radius: var(--r-lg);
  background: #fff; border: 1.5px solid var(--green); color: var(--green-ink);
  font: inherit; font-size: 15px; font-weight: 620; cursor: pointer;
}
.btn-secondary:disabled { background: var(--fill-muted); border-color: var(--border); color: var(--ink-4); cursor: default; }

.btn-open {
  min-height: 44px; padding: 10px 16px; border-radius: var(--r-md);
  background: var(--green-dark); border: 1px solid var(--green-dark); color: #fff;
  font: inherit; font-size: 14px; font-weight: 620; cursor: pointer;
}
.btn-open.is-open { background: var(--green-soft); border-color: #cfe4c4; color: var(--green-ink); }

/* ——— метрики ——— */
.metrics-shell { background: #fff; border: 1px solid var(--border); border-radius: var(--r-2xl); padding: 4px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 1px; background: var(--border-inner); border-radius: var(--r-lg); overflow: hidden; }
.metric { background: #fff; padding: 13px 14px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.metric__label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-label); }
.metric__value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.metric__sub { font-size: 12px; color: var(--ink-3); min-height: 16px; }
.metric--warm { background: #fdfaf2; }
.metric--alarm { background: var(--alarm-bg); box-shadow: inset 3px 0 0 var(--alarm); }
.metric--alarm .metric__value { color: var(--alarm-ink); font-size: 30px; }

/* ——— таблица ——— */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-2xl); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.tickets { width: 100%; border-collapse: collapse; min-width: 880px; font-size: 13.5px; }
table.tickets th {
  text-align: left; padding: 10px 14px; background: var(--surface-2);
  font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-label); border-bottom: 1px solid var(--border-inner);
}
table.tickets td { padding: 11px 14px; border-bottom: 1px solid var(--border-row); vertical-align: top; }
table.tickets tr.is-overdue { background: var(--alarm-row); box-shadow: inset 3px 0 0 var(--alarm); }
.num { font-weight: 680; white-space: nowrap; }
.sub { font-size: 12px; color: var(--ink-3); }

/* ——— панель обращения ——— */
.detail { background: #fff; border: 1px solid var(--border); border-radius: var(--r-2xl); box-shadow: var(--sh-panel); position: sticky; top: 76px; }
.detail__body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.detail__text { background: var(--surface-3); border: 1px solid var(--border-inner); border-radius: var(--r-lg); padding: 13px 14px; font-size: 14px; line-height: 1.55; color: var(--ink-body); white-space: pre-wrap; }
textarea.reply {
  width: 100%; box-sizing: border-box; border: 1px solid var(--border-control); border-radius: var(--r-lg);
  padding: 11px 12px; font: inherit; font-size: 14px; line-height: 1.5; color: var(--ink); background: #fff; resize: vertical;
}
textarea.reply:focus { border-color: var(--green); outline: none; box-shadow: var(--ring-focus); }

.manager-grid { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
@media (max-width: 900px) {
  .manager-grid { grid-template-columns: 1fr; }
  .detail { position: static; }
}

/* ——— общий каркас: хедер + переключатель экранов ——— */
.app-header {
  background: #ffffff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.app-header__inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--green-soft); border: 1px solid var(--green-soft-bd);
  display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none;
}
.brand__title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.brand__subtitle { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.tabs {
  background: var(--fill); border: 1px solid var(--border); border-radius: 10px;
  padding: 3px; display: flex; gap: 4px; margin-left: auto;
}
.tab {
  padding: 9px 14px; min-height: 38px; display: flex; align-items: center;
  border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.tab.is-active { background: var(--green); color: #fff; box-shadow: var(--sh-raised); }

/* ——— заголовок раздела + метка обновления ——— */
.h1-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.h1-row h1 { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; margin: 0; }
.updated { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.updated.is-error { color: var(--alarm-ink); }

/* ——— баннер SLA ——— */
.alert-banner {
  background: var(--alarm-bg); border: 1px solid var(--alarm-bd); border-left: 4px solid var(--alarm);
  border-radius: var(--r-lg); padding: 12px 14px; margin: 14px 0; font-size: 13.5px; line-height: 1.45;
  display: flex; gap: 8px; align-items: flex-start;
}
.alert-banner a { color: var(--alarm-ink); font-weight: 620; text-decoration: underline; cursor: pointer; }

/* ——— панель фильтров над таблицей/списком ——— */
.filters-bar {
  padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border-inner);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
}
.filters-bar__found { margin-left: auto; font-size: 12.5px; color: var(--ink-3); align-self: center; }
.filters-bar__found b { color: var(--ink); }

.empty-state { padding: 34px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }
.empty-state--dashed { background: #fff; border: 1px dashed var(--border-control); border-radius: var(--r-xl); padding: 30px; }

.stars { color: var(--green-bright); letter-spacing: 1px; }
