/* ==========================================================================
   ДОМ 43 — панель заявок
   ========================================================================== */

:root {
  --font-sans: "Golos Text", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-display: "Spectral", Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light;
}

[data-theme="light"] {
  --bg: #f7f4ef;
  --bg-alt: #f0ebe2;
  --surface: #fffdf9;
  --surface-2: #f3eee6;
  --ink: #16140f;
  --ink-soft: #37332b;
  --muted: #6e685d;
  --line: rgba(22, 20, 15, 0.11);
  --line-strong: rgba(22, 20, 15, 0.22);
  --accent: #a94b2b;
  --accent-hover: #8e3c20;
  --accent-ink: #fff8f4;
  --accent-soft: rgba(169, 75, 43, 0.1);
  --gold: #b9822b;
  --green: #3f7a4f;
  --blue: #39628f;
  --red: #ad3a2c;
  --shadow: 0 24px 60px -24px rgba(22, 20, 15, 0.3);
  --shadow-sm: 0 10px 26px -16px rgba(22, 20, 15, 0.32);
}

[data-theme="dark"] {
  --bg: #11100e;
  --bg-alt: #16140f;
  --surface: #1b1915;
  --surface-2: #24211c;
  --ink: #f2ede3;
  --ink-soft: #d9d2c5;
  --muted: #a49b8c;
  --line: rgba(242, 237, 227, 0.12);
  --line-strong: rgba(242, 237, 227, 0.24);
  --accent: #d9784f;
  --accent-hover: #e58a62;
  --accent-ink: #1a1009;
  --accent-soft: rgba(217, 120, 79, 0.15);
  --gold: #d8a24a;
  --green: #7fb98d;
  --blue: #8db3d9;
  --red: #e0806f;
  --shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 14px 32px -18px rgba(0, 0, 0, 0.7);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------------------------------------------------------------- atoms */
.logo { display: inline-flex; flex-direction: column; line-height: 1; }
.logo__mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.logo__mark b { color: var(--accent); font-weight: 600; }
.logo__sub {
  margin-top: 4px;
  font-size: 8.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
}

.btn {
  --h: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.btn:active { transform: scale(0.985); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 20px -12px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--ink); }
.btn--danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: transparent; }
.btn--danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }
.btn--sm { --h: 34px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.btn__spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn__label { opacity: 0.6; }
.btn.is-loading .btn__spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-2); }

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 13px; height: 13px; fill: currentColor; }

.dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
}
.dot--on { background: #4d9a5f; box-shadow: 0 0 0 3px rgba(77, 154, 95, 0.16); }
.dot--off { background: var(--muted); opacity: 0.5; }
.dot--err { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 16%, transparent); }

/* theme switch */
.theme-toggle { display: inline-flex; padding: 0; border: 0; background: none; border-radius: 999px; }
.theme-toggle__track {
  position: relative;
  width: 54px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}
.theme-toggle__icon { width: 12px; height: 12px; color: var(--muted); z-index: 1; }
.theme-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.3s var(--ease);
}
[data-theme="dark"] .theme-toggle__thumb { transform: translateX(26px); }
[data-theme="light"] .theme-toggle__icon--sun { color: var(--accent-ink); }
[data-theme="dark"] .theme-toggle__icon--moon { color: var(--bg); }

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login__theme {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
}

.login__form-side {
  display: grid;
  place-items: center;
  padding: 40px 32px;
}

.login__card { width: 100%; max-width: 360px; }

.login__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 54px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 44px 0 14px;
}
.login__title em { font-style: italic; color: var(--accent); }

.login__lead { color: var(--muted); font-size: 13px; line-height: 1.65; max-width: 34ch; }

.login__form { display: grid; gap: 14px; margin-top: 30px; }

.lfield { display: grid; gap: 6px; position: relative; }
.lfield > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}
.lfield input,
.lfield select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.lfield input:focus,
.lfield select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}
.lfield__eye {
  position: absolute;
  right: 10px;
  bottom: 10px;
  border: 0;
  background: none;
  font-size: 11px;
  color: var(--muted);
  padding: 4px;
}
.lfield__eye:hover { color: var(--ink); }

.login__error {
  min-height: 18px;
  font-size: 12px;
  color: var(--red);
}
.login__error:empty { min-height: 0; }

.login__foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.login__foot a:hover { color: var(--accent); }

.login__visual {
  position: relative;
  overflow: hidden;
  margin: 12px;
  border-radius: 20px;
  min-height: 560px;
}
.login__visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.02) brightness(0.86);
}
.login__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 14, 11, 0.1) 20%, rgba(16, 14, 11, 0.78) 100%);
}
.login__visual-inner {
  position: absolute;
  z-index: 1;
  inset: auto 36px 34px;
  color: #fff;
  display: grid;
  gap: 18px;
}
.login__quote p {
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.2;
  margin: 12px 0 10px;
  max-width: 22ch;
}
.login__quote span { font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.6; }
.login__quote .stars { color: #e0b059; }
.login__badge {
  position: absolute;
  top: 34px;
  right: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  font-size: 11px;
  opacity: 0.9;
}
.login__badge b { font-family: var(--font-display); font-size: 20px; }

/* ---------------------------------------------------------------- app shell */
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.sidebar__logo { padding-left: 8px; }

.snav { display: grid; gap: 3px; }
.snav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.2s, color 0.2s;
}
.snav__item:hover { background: var(--surface-2); color: var(--ink); }
.snav__item.is-active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.snav__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}
.snav__item.is-active .snav__dot { background: var(--accent); opacity: 1; }
.snav__item b {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar__tg {
  margin-top: auto;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
}
.sidebar__tg b { display: block; color: var(--ink); font-size: 11.5px; margin-bottom: 2px; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sidebar__user-info { display: grid; min-width: 0; }
.sidebar__user-info b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-info span { font-size: 10.5px; color: var(--muted); }
.sidebar__user .icon-btn { margin-left: auto; width: 30px; height: 30px; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { display: grid; gap: 1px; }
.topbar__title h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.topbar__title span { font-size: 11px; color: var(--muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar__menu { display: none; }

.content { padding: 26px 32px 56px; max-width: 1280px; width: 100%; }

.view { display: grid; gap: 22px; animation: viewIn 0.3s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- kpi */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  display: grid;
  gap: 2px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.kpi span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kpi b {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.kpi i { font-size: 10.5px; color: var(--muted); font-style: normal; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; }

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.tab span {
  font-size: 10px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.toolbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input {
  border: 0;
  background: none;
  outline: none;
  width: 178px;
  font-size: 12.5px;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch > span::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: background-color 0.2s, border-color 0.2s;
}
.switch input:checked + span::before { background: var(--accent); border-color: var(--accent); }
.switch input:focus-visible + span::before { box-shadow: 0 0 0 3px var(--accent-soft); }
.switch--box { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink-soft); }

/* ---------------------------------------------------------------- leads list */
.leads {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.lead-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1.5fr) minmax(0, 1.2fr) 132px 110px 92px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: background-color 0.18s;
}
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: var(--surface-2); }
.lead-row.is-new { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.lead-row.is-new:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.lead-row__num { display: grid; gap: 4px; }
.lead-row__num b { font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill--new { color: var(--accent); background: var(--accent-soft); }
.pill--accepted { color: var(--blue); background: color-mix(in srgb, var(--blue) 12%, transparent); }
.pill--in_progress { color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }
.pill--done { color: var(--muted); background: var(--surface-2); }
.pill--declined { color: var(--red); background: color-mix(in srgb, var(--red) 11%, transparent); }

.lead-row__who { min-width: 0; }
.lead-row__who b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.lead-row__who span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lead-row__type { min-width: 0; }
.lead-row__type b { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-row__type span { font-size: 10.5px; color: var(--muted); }

.lead-row__assignee { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); min-width: 0; }
.lead-row__assignee .is-empty { color: var(--muted); opacity: 0.85; }
.lead-row__assignee .avatar { width: 24px; height: 24px; font-size: 8.5px; }
.lead-row__assignee span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lead-row__time { font-size: 10.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.lead-row__tg { display: flex; justify-content: flex-end; color: var(--muted); }
.lead-row__tg svg { width: 14px; height: 14px; opacity: 0.5; }
.lead-row__tg.is-ok { color: var(--green); }

.empty { padding: 40px; text-align: center; color: var(--muted); display: grid; gap: 14px; justify-items: center; font-size: 13px; }

/* ---------------------------------------------------------------- drawer */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(12, 10, 8, 0.42);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 80;
  width: min(500px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: drawerIn 0.35s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } }

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}
.drawer__eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.drawer__head h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 30px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dfield { display: grid; gap: 3px; }
.dfield--full { grid-column: 1 / -1; }
.dfield dt, .dfield .dl {
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.dfield dd, .dfield .dv { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); word-break: break-word; }
.dfield a:hover { color: var(--accent); }
.dfield--full .dv { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; }

.dactions { display: flex; flex-wrap: wrap; gap: 8px; }

.dsection { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.dsection h3 { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.history { display: grid; gap: 0; }
.history li {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 14px;
  font-size: 11.5px;
  color: var(--muted);
}
.history li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  bottom: -3px;
  width: 1px;
  background: var(--line);
}
.history li:last-child::before { display: none; }
.history li::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}
.history b { display: block; color: var(--ink-soft); font-weight: 600; font-size: 12px; margin-bottom: 1px; }
.history time { font-size: 10px; opacity: 0.8; }

.dnote { display: grid; gap: 8px; }
.dnote textarea {
  width: 100%;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-size: 12.5px;
  resize: vertical;
}
.dnote textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.drawer__foot {
  display: grid;
  gap: 8px;
  padding: 16px 26px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.drawer__foot .btn { width: 100%; }
.drawer__hint { font-size: 10.5px; color: var(--muted); text-align: center; }

.select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}

/* ---------------------------------------------------------------- panels / team / settings */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: grid;
  gap: 18px;
}
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel__head h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.panel__head p { font-size: 12px; color: var(--muted); line-height: 1.55; max-width: 58ch; }

.table { display: grid; border-top: 1px solid var(--line); }
.trow {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.7fr 0.8fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.trow--head { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 9px 0; }
.trow:last-child { border-bottom: 0; }
.trow__name { display: flex; align-items: center; gap: 9px; font-weight: 500; min-width: 0; }
.trow__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow code { font-family: var(--font-sans); font-size: 11.5px; color: var(--muted); }
.trow .pill { padding: 2px 7px; }
.trow__actions { display: flex; justify-content: flex-end; gap: 4px; }
.trow__actions button { color: var(--muted); border-color: transparent; }

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.grid-form .btn {
  justify-self: start;
}
.grid-form .btn { height: 44px; }

.settings-form { display: grid; gap: 14px; max-width: 560px; }
.settings-form__actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; align-items: center; }
.settings-form .btn { height: 40px; }
.settings-form > .btn,
.settings-form .switch--box { justify-self: start; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}
.status-pill.is-ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.status-pill.is-err { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }

.note {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}
.note b { color: var(--ink); }
.note ol { padding-left: 18px; display: grid; gap: 4px; margin-top: 6px; list-style: decimal; }
.note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 10.5px;
}
.note--plain { border-style: solid; }
.note p:not(:empty) { margin-top: 8px; color: var(--red); }
.note p#tgError { color: var(--red); }

/* ---------------------------------------------------------------- toast */
.toast {
  opacity: 0;
  visibility: hidden;
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  transform: translate(-50%, 150%);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease);
  text-align: center;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .app { grid-template-columns: 210px minmax(0, 1fr); }
  .content { padding: 22px 22px 48px; }
  .topbar { padding: 16px 22px; }
  .lead-row { grid-template-columns: 86px minmax(0, 1.4fr) minmax(0, 1fr) 96px 80px; }
  .lead-row__tg { display: none; }
  .grid-form { grid-template-columns: 1fr 1fr; }
  .grid-form .btn { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login__visual { display: none; }
  .login__card { max-width: 420px; }

  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: 260px;
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  .topbar__menu { display: inline-grid; }
  .content { padding: 18px 16px 44px; }
  .topbar { padding: 14px 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 32px; }

  .toolbar { gap: 10px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { flex: none; }
  .toolbar__right { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }

  .lead-row {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 14px;
  }
  .lead-row__type { grid-column: 2 / -1; }
  .lead-row__assignee { display: none; }
  .lead-row__time { text-align: right; font-size: 10px; }

  .drawer { width: 100vw; }
  .drawer__head, .drawer__body, .drawer__foot { padding-left: 18px; padding-right: 18px; }
  .dgrid { grid-template-columns: 1fr; }

  .trow { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .trow > *:nth-child(2), .trow > *:nth-child(3) { display: none; }
  .trow--head { display: none; }
  .panel { padding: 18px; }
  .grid-form { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ---------------------------------------------------------------- редактор сайта */
.content-form { display: grid; gap: 18px; }

.cgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cgrid__full { grid-column: 1 / -1; }

.content-form .lfield textarea {
  width: 100%;
  min-height: 66px;
  padding: 10px 13px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.content-form .lfield textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.content-form .panel__head h2 { margin-bottom: 4px; }

.service-edit {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.service-edit__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.service-edit .cgrid { gap: 10px; }

.content-save {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.content-save span { font-size: 11px; color: var(--muted); }

.hint-line {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
}

.hint-line code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-2);
}

@media (max-width: 820px) {
  .cgrid { grid-template-columns: 1fr; }
  .content-save { flex-direction: column; align-items: stretch; text-align: center; }
}

.lfield > .hint-line {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.client-discount {
  width: 78px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--bg);
  font-size: 12px;
  text-align: center;
}
.client-discount:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.client-save { color: var(--muted); }

.club-tag {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

.presence {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  display: inline-block;
  flex: none;
}
.presence.is-online {
  background: #4d9a5f;
  box-shadow: 0 0 0 3px rgba(77, 154, 95, 0.15);
}
.trow__sub { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* фото и оплата в карточке */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.photo-item {
  position: relative;
  margin: 0;
  min-width: 0;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
  background: var(--surface-2);
}

.photo-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(12, 10, 8, 0.64);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
}

.photo-del:hover {
  background: var(--red);
}

.photo-item figcaption {
  margin-top: 3px;
  font-size: 8.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-empty {
  font-size: 11px;
  color: var(--muted);
}

.payment-current {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.payment-grid .select {
  height: 34px;
}

.payment-grid .btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.pay-tag {
  background: rgba(192, 138, 46, 0.18);
  color: #8a6218;
}

[data-theme="dark"] .pay-tag {
  color: #d8a24a;
}

.nudge-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.nudge-box input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 11.5px;
}

.nudge-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* редактирование сотрудника */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(12, 10, 8, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: fixed;
  z-index: 96;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.modal-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-card__head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 74px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 10.5px;
  padding: 4px;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ink);
}

body.is-locked .modal-card {
  overscroll-behavior: contain;
}
