@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

:root {
  --p-950: #1c0022;
  --p-900: #2b0033;
  --p-800: #3a0043;
  --p-700: #470051;
  --orange: #ff8948;
  --orange-hi: #ffa06b;
  --cream: #fff7f1;
  --muted: rgba(255, 247, 241, 0.62);
  --faint: rgba(255, 247, 241, 0.38);
  --line: rgba(255, 247, 241, 0.12);
  --line-2: rgba(255, 247, 241, 0.22);
  --surface: rgba(255, 247, 241, 0.045);
  --surface-hi: rgba(255, 247, 241, 0.085);
  --ok: #56d9a3;
  --warn: #ffc24b;
  --late: #ff7a7a;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --pill: 999px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Onest, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1100px 620px at 10% -12%, rgba(255, 137, 72, 0.15), transparent 60%),
    radial-gradient(900px 520px at 100% -5%, rgba(104, 0, 122, 0.6), transparent 55%),
    var(--p-900);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(255, 137, 72, 0.14);
  color: var(--orange-hi);
  padding: 2px 6px;
  border-radius: 6px;
}
.small { font-size: 12.5px; }
.muted { color: var(--muted); }

/* ---------- tooltips ----------
   Positioned by /js/ui.js on <body>, so they are never clipped by a card,
   the page bottom or the mobile address bar. */
.tip-bubble {
  position: fixed;
  z-index: 200;
  background: var(--p-950);
  color: var(--cream);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 137, 72, 0.34);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.tip-bubble.below { transform: translateY(-4px); }
.tip-bubble.visible { opacity: 1; transform: translateY(0); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(43, 0, 51, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--orange);
  line-height: 1;
  white-space: nowrap;
}
.wordmark span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin-left: 10px;
}

.nav { display: flex; align-items: center; gap: 4px; }
.logout-form { display: flex; margin-left: 6px; }

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-hi); color: var(--cream); }
.nav-item.active {
  background: rgba(255, 137, 72, 0.14);
  color: var(--orange);
  border-color: rgba(255, 137, 72, 0.32);
}
.nav-item .badge {
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--orange);
  color: var(--p-950);
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  line-height: 19px;
  text-align: center;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.16s ease;
  padding: 0;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-hi); color: var(--cream); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- subnav ---------- */
.subnav-wrap {
  position: sticky;
  top: 62px;
  z-index: 30;
  background: rgba(43, 0, 51, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.subnav {
  max-width: 980px;
  margin: 0 auto;
  padding: 9px 20px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.subnav a {
  padding: 7px 15px;
  border-radius: var(--pill);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.16s ease;
}
.subnav a:hover { background: var(--surface-hi); color: var(--cream); }
.subnav a.active { background: var(--surface-hi); color: var(--orange); }

/* ---------- layout ---------- */
.container { max-width: 980px; margin: 0 auto; padding: 28px 20px 90px; }

.flash-wrap { max-width: 980px; margin: 16px auto -6px; padding: 0 20px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head form { display: flex; }
h1 { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; max-width: 560px; line-height: 1.5; }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: default;
}
.chip b { color: var(--cream); font-weight: 700; }
.chip.accent { background: rgba(255, 137, 72, 0.12); border-color: rgba(255, 137, 72, 0.3); color: var(--orange-hi); }
.chip.alert { background: rgba(255, 122, 122, 0.13); border-color: rgba(255, 122, 122, 0.32); color: var(--late); }
.chip.alert b { color: var(--late); }
.chip.warn-chip { background: rgba(255, 194, 75, 0.12); border-color: rgba(255, 194, 75, 0.3); color: var(--warn); }
.chip.warn-chip b { color: var(--warn); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 16px;
}

/* ---------- rows ---------- */
.rows { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all 0.16s ease;
}
.row:hover { background: var(--surface-hi); border-color: var(--line-2); transform: translateY(-1px); }
.row-alert { border-color: rgba(255, 122, 122, 0.34); background: rgba(255, 122, 122, 0.05); }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; cursor: default; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(86, 217, 163, 0.14); }
.dot.warning { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 194, 75, 0.14); }
.dot.overdue { background: var(--late); box-shadow: 0 0 0 4px rgba(255, 122, 122, 0.16); }
.dot.disabled { background: var(--faint); }

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 137, 72, 0.16);
  border: 1px solid rgba(255, 137, 72, 0.3);
  color: var(--orange);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.row-title {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  cursor: default;
  flex-shrink: 0;
}
.row-meta.overdue { color: var(--late); }

.row-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.row-actions form { display: flex; }

.wait-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--pill);
  background: rgba(255, 194, 75, 0.13);
  border: 1px solid rgba(255, 194, 75, 0.3);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  cursor: default;
}
.wait-pill svg { width: 13px; height: 13px; }
.wait-pill.over { background: rgba(255, 122, 122, 0.14); border-color: rgba(255, 122, 122, 0.34); color: var(--late); }

/* ---------- pending card ---------- */
.pending-card { border-color: rgba(255, 194, 75, 0.3); background: rgba(255, 194, 75, 0.06); }
.pending-card.over { border-color: rgba(255, 122, 122, 0.34); background: rgba(255, 122, 122, 0.06); }
.pending-card.calm { border-color: var(--line); background: var(--surface); }
.pending-head { display: flex; align-items: flex-start; gap: 12px; }
.pending-head svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; color: var(--warn); }
.pending-card.over .pending-head svg { color: var(--late); }
.pending-card.calm .pending-head svg { color: var(--ok); }
.pending-head b { display: block; font-size: 15px; margin-bottom: 3px; }
.pending-head .small { display: block; }
.pending-text {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hi); border-color: var(--cream); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--p-950); }
.btn.primary:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.btn.danger { border-color: rgba(255, 122, 122, 0.4); color: var(--late); }
.btn.danger:hover { background: rgba(255, 122, 122, 0.12); border-color: var(--late); }
.btn.block { width: 100%; justify-content: center; }
.btn.small-btn { padding: 7px 16px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

.link-sm {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.link-sm:hover { color: var(--orange); }
.danger-link:hover { color: var(--late); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.sticky-actions {
  position: sticky;
  /* keep clear of the mobile browser chrome / home indicator */
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: rgba(28, 0, 34, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px;
}
.field-grid .field.wide { grid-column: 1 / -1; }

.micro-label {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.req-star { color: var(--orange); }

.ph-hint {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 160, 107, 0.75);
  background: rgba(255, 137, 72, 0.1);
  padding: 1px 6px;
  border-radius: 5px;
  cursor: default;
}

.hint-dot {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  text-transform: none;
  letter-spacing: 0;
  flex-shrink: 0;
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='file'],
textarea,
select {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: rgba(28, 0, 34, 0.5);
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.16s ease, background 0.16s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(28, 0, 34, 0.75);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 14px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}
select option { background: var(--p-800); color: var(--cream); }

input[type='file'] { padding: 10px 14px; cursor: pointer; }
input[type='file']::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: var(--surface-hi);
  color: var(--cream);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.input-unit { position: relative; max-width: 200px; }
.input-unit input { padding-right: 50px; }
.input-unit::after {
  content: 'дн';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  pointer-events: none;
}
.input-unit.min::after { content: 'мин'; }

/* ---------- toggles & radio chips ---------- */
.toggles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 11px 17px 11px 13px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  transition: all 0.16s ease;
}
.switch:hover { border-color: var(--line-2); background: var(--surface-hi); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }

.track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: var(--pill);
  background: rgba(28, 0, 34, 0.7);
  border: 1px solid var(--line-2);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.thumb {
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--faint);
  transition: all 0.18s ease;
}
.switch input:checked + .track { background: rgba(255, 137, 72, 0.28); border-color: var(--orange); }
.switch input:checked + .track .thumb { left: 19px; background: var(--orange); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(255, 137, 72, 0.45); }
.switch-text { font-size: 14px; font-weight: 600; color: var(--muted); }
.switch input:checked ~ .switch-text { color: var(--cream); }

.chip-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-radio { cursor: pointer; }
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio span {
  display: inline-block;
  padding: 9px 17px;
  border-radius: var(--pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.16s ease;
}
.chip-radio:hover span { border-color: var(--line-2); color: var(--cream); }
.chip-radio input:checked + span {
  background: rgba(255, 137, 72, 0.16);
  border-color: var(--orange);
  color: var(--orange);
}
.chip-radio input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255, 137, 72, 0.4); }

/* ---------- placeholder table ---------- */
.ph-table { display: flex; flex-direction: column; }
.ph-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ph-row:last-child { border-bottom: none; padding-bottom: 0; }
.ph-row:first-child { padding-top: 0; }
.ph-label {
  flex: 1;
  min-width: 170px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.ph-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--orange-hi);
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.28);
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}
.ph-code:hover { background: rgba(255, 137, 72, 0.22); }
.ph-code.copied { background: rgba(86, 217, 163, 0.18); border-color: rgba(86, 217, 163, 0.4); color: var(--ok); }
.ph-actions { display: flex; align-items: center; gap: 12px; }
.ph-actions form { display: flex; }

.howto .steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.howto .steps li::marker { color: var(--orange); font-weight: 700; }
.howto p.small { margin: 12px 0 0; }

/* ---------- log & tags ---------- */
.log { display: flex; flex-direction: column; }
.log-item { padding: 13px 0; border-bottom: 1px solid var(--line); }
.log-item:first-child { padding-top: 0; }
.log-item:last-child { border-bottom: none; padding-bottom: 0; }
.log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
}
.tag {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--surface-hi);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag.err { background: rgba(255, 122, 122, 0.16); color: var(--late); }
.log-text { font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------- requests ---------- */
.req {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  transition: all 0.16s ease;
}
.req:hover { border-color: var(--line-2); }
.req.done { opacity: 0.5; }
.req-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 9px;
}
.req-head .who { color: var(--orange-hi); }
.req-text { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.req-foot { display: flex; align-items: center; gap: 12px; margin-top: 13px; flex-wrap: wrap; }
.req-foot form { display: flex; }
.tabs { display: flex; gap: 8px; }

/* ---------- states ---------- */
.empty { text-align: center; padding: 52px 24px; }
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.3);
  color: var(--orange);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty p { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; line-height: 1.6; }

.bot-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 17px;
  border-radius: var(--pill);
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.32);
  color: var(--orange-hi);
  font-size: 14px;
  font-weight: 700;
}

.msg { padding: 12px 16px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; }
.msg.error { background: rgba(255, 122, 122, 0.14); border: 1px solid rgba(255, 122, 122, 0.32); color: var(--late); }
.msg.ok { background: rgba(86, 217, 163, 0.14); border: 1px solid rgba(86, 217, 163, 0.32); color: var(--ok); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  transition: color 0.16s ease;
}
.back:hover { color: var(--orange); }
.back svg { width: 14px; height: 14px; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 370px; text-align: center; }
.login-card .wordmark { font-size: 40px; display: block; margin-bottom: 8px; }
.login-card .wordmark span { display: none; }
.login-sub { color: var(--faint); font-size: 13.5px; font-weight: 500; margin: 0 0 30px; }
.login-card form { text-align: left; }
.login-card .msg { margin-bottom: 16px; }

/* ---------- users & credentials ---------- */
.cred-card { border-color: rgba(255, 137, 72, 0.4); background: rgba(255, 137, 72, 0.07); }
.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.cred-grid .micro-label { margin-bottom: 7px; }
.ph-code.big { font-size: 15px; padding: 11px 14px; width: 100%; text-align: left; }

.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.user-row { align-items: center; }
.user-row.is-off { opacity: 0.55; }
.user-main { display: flex; flex-direction: column; gap: 2px; }
.user-main b { font-weight: 700; font-size: 14.5px; }
.tag.warn-tag { background: rgba(255, 194, 75, 0.16); color: var(--warn); }
.msg.warn { background: rgba(255, 194, 75, 0.14); border: 1px solid rgba(255, 194, 75, 0.34); color: var(--warn); }
.logout-under { margin-top: 14px; display: flex; justify-content: center; }

/* ---------- permissions ---------- */
.perm-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.perm-pill {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--pill);
  cursor: default;
}
.perm-pill.view { background: rgba(255, 247, 241, 0.09); color: var(--muted); }
.perm-pill.edit { background: rgba(255, 137, 72, 0.16); color: var(--orange-hi); }

.perm-editor {
  flex-basis: 100%;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.perm-grid { display: flex; flex-direction: column; gap: 8px; }
.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.perm-name { font-size: 14px; font-weight: 600; cursor: help; }
.perm-levels { display: flex; gap: 5px; }
.chip-radio.sm span { padding: 6px 13px; font-size: 12.5px; }

/* ---------- payments ---------- */
.pay-row.overdue { border-color: rgba(255, 122, 122, 0.34); background: rgba(255, 122, 122, 0.05); }
.pay-row.soon { border-color: rgba(255, 194, 75, 0.3); }
.pay-row.closed { opacity: 0.55; }
.pay-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pay-main b { font-size: 15px; }
.pay-due {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  cursor: default;
}
.pay-due i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--faint); }
.pay-due.overdue { color: var(--late); }
.pay-due.overdue i { color: var(--late); }
.pay-due.soon { color: var(--warn); }
.pay-due.soon i { color: var(--warn); }
.input-unit.days::after { content: 'дн'; }

/* ---------- facsimile ---------- */
.facsimile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.facsimile { display: flex; flex-direction: column; gap: 10px; }
.facsimile-preview {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
  /* light chequerboard so a transparent PNG is readable on the dark theme */
  background:
    linear-gradient(45deg, rgba(255,247,241,.07) 25%, transparent 25%, transparent 75%, rgba(255,247,241,.07) 75%),
    linear-gradient(45deg, rgba(255,247,241,.07) 25%, transparent 25%, transparent 75%, rgba(255,247,241,.07) 75%),
    rgba(255, 247, 241, 0.92);
  background-size: 14px 14px;
  background-position: 0 0, 7px 7px;
}
.facsimile-preview img { max-width: 100%; max-height: 110px; display: block; }
.facsimile-preview.empty-preview { background: var(--surface); border-style: dashed; }
.facsimile-upload { display: flex; flex-direction: column; gap: 8px; }

/* ---------- week schedule ---------- */
.week-grid { display: flex; flex-direction: column; gap: 8px; }
.week-row { display: flex; align-items: center; gap: 12px; }
.week-day {
  width: 34px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
}
.week-row input { flex: 1; }

/* ---------- public booking page ---------- */
body.public { background-attachment: fixed; }
.book-wrap { min-height: 100vh; display: flex; justify-content: center; padding: 32px 16px 60px; }
.book-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
}
.book-card .wordmark { display: block; font-size: 26px; margin-bottom: 18px; }
.book-card h1 { font-size: 22px; margin-bottom: 18px; }
.tz-form { margin-bottom: 22px; }
.book-days { display: flex; flex-direction: column; gap: 18px; }
.book-day-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-hi);
  margin: 0 0 9px;
  text-transform: capitalize;
}
.book-times { display: flex; flex-wrap: wrap; gap: 8px; }
.time-btn {
  padding: 10px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: rgba(28, 0, 34, 0.4);
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.14s ease;
}
.time-btn:hover { border-color: var(--orange); color: var(--orange); }
.time-btn.picked { background: var(--orange); border-color: var(--orange); color: var(--p-950); }
.book-form {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.chosen { font-size: 14px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chosen b { color: var(--orange-hi); }
.book-done { text-align: center; padding: 20px 0; }
.book-done h1 { margin: 14px 0 8px; }
.book-when { font-size: 18px; font-weight: 700; color: var(--orange-hi); margin: 0 0 10px; }

/* ---------- pending list ---------- */
.pending-list { margin-top: 14px; border-top: 1px solid var(--line); }
.pending-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.pending-item:last-child { border-bottom: none; padding-bottom: 0; }
.tag.ok-tag { background: rgba(86, 217, 163, 0.16); color: var(--ok); }
.badge.sm {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: var(--pill);
  background: var(--orange);
  color: var(--p-950);
  font-size: 10.5px;
  font-weight: 800;
  font-style: normal;
  line-height: 17px;
  text-align: center;
}

/* ---------- responsive ---------- */

/* tablets: keep labels but tighten spacing */
@media (max-width: 900px) {
  .container { max-width: 100%; }
  .nav-item { padding: 9px 12px; font-size: 13.5px; gap: 7px; }
  .wordmark { font-size: 19px; }
}

/* narrow tablets / large phones: nav becomes a scrollable strip */
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px) * 0);
  }
  .wordmark { font-size: 20px; }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex-shrink: 0; }
  .logout-form { margin-left: auto; order: 2; }
  .subnav-wrap { top: auto; position: static; }
}

@media (max-width: 560px) {
  .container { padding: 18px 14px calc(90px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 20px; }
  .page-sub { font-size: 13.5px; }
  .page-head { gap: 12px; margin-bottom: 18px; }
  .card { padding: 16px 14px; border-radius: var(--r-md); }
  .field-grid { grid-template-columns: 1fr; }
  .row { padding: 13px 13px; gap: 10px; }
  .row-title { font-size: 14.5px; }
  .row-meta { font-size: 12px; }

  /* comfortable tap targets */
  .icon-btn { width: 42px; height: 42px; }
  .btn { padding: 12px 20px; }
  .btn.small-btn { padding: 9px 16px; }
  .switch { padding: 12px 18px 12px 14px; }
  .chip-radio span { padding: 11px 18px; }
  .subnav a { padding: 9px 15px; }
  input[type='text'], input[type='password'], input[type='number'], textarea, select {
    /* 16px keeps iOS from zooming in on focus */
    font-size: 16px;
    padding: 13px 15px;
  }
  select { background-position: calc(100% - 19px) 23px, calc(100% - 14px) 23px; }

  /* placeholder reference stacks instead of squeezing */
  .ph-row { flex-direction: column; align-items: flex-start; gap: 8px; padding: 13px 0; }
  .ph-label { min-width: 0; }
  .ph-code { width: 100%; text-align: left; padding: 9px 12px; }
  .ph-actions { width: 100%; justify-content: flex-start; }

  .sticky-actions { padding: 12px 14px; gap: 10px; }
  .sticky-actions .btn { flex: 1 1 auto; justify-content: center; }
  .sticky-actions .small { flex-basis: 100%; }

  .req-foot { gap: 10px; }
  .tabs { width: 100%; }
  .tabs .chip { flex: 1; justify-content: center; }
}

@media (max-width: 380px) {
  .nav-item { padding: 9px 12px; font-size: 13px; }
  .container { padding-left: 12px; padding-right: 12px; }
}

/* ==========================================================================
   Layout: fixed left rail + top section bar (Bitrix-style structure).
   Colours and components above are untouched — this only re-arranges them.
   ========================================================================== */

.sidenav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 232px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: rgba(28, 0, 34, 0.86);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
}
.sidenav-brand { display: block; padding: 6px 12px 18px; font-size: 22px; }
.sidenav-items { display: flex; flex-direction: column; gap: 2px; }
.sidenav-group { display:flex; flex-direction:column; gap:2px; margin-bottom:14px; }
.sidenav-group-label { padding:4px 12px 6px; color:var(--faint); font-size:10px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.sidenav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.sidenav-foot form { display: block; }

.side-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.16s ease;
}
.side-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.side-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item:hover { background: var(--surface-hi); color: var(--cream); }
.side-item.active {
  background: rgba(255, 137, 72, 0.14);
  border-color: rgba(255, 137, 72, 0.32);
  color: var(--orange);
}
.side-logout { color: var(--faint); }
.side-logout:hover { color: var(--late); }

/* top bar sits to the right of the rail */
.topbar { margin-left: 232px; gap: 20px; }
.topbar-area {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--cream);
}
.topbar .nav { flex: 1; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
.topbar .nav::-webkit-scrollbar { display: none; }

.subnav-wrap { margin-left: 232px; }
.flash-wrap { margin-left: 232px; }
.container { margin-left: 232px; }

/* Workspace polish: more breathing room for CRM lists and a clear visual
   hierarchy between area groups, content cards and actions. */
.container { max-width: 1180px; }
.flash-wrap { max-width: 1180px; }
.card-title { font-size:13px; letter-spacing:.08em; }
.page-head { margin-bottom:26px; }
.page-head h1 { letter-spacing:-.025em; }
.sidenav-group + .sidenav-group { border-top:1px solid rgba(255,247,241,.08); padding-top:12px; }
.side-item { min-height:42px; }
.topbar { min-height:62px; }
.topbar-area { color:var(--orange-hi); }
.row { min-height:60px; }
.row:focus-visible,.side-item:focus-visible,.nav-item:focus-visible,.btn:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }

/* dropdown in the top bar */
.nav-drop { position: relative; }
.nav-drop-toggle {
  font-family: inherit;
  cursor: pointer;
  background: transparent;
}
.nav-drop-toggle svg { width: 14px; height: 14px; }
.nav-drop.active .nav-item,
.nav-drop-toggle[aria-expanded='true'] {
  background: rgba(255, 137, 72, 0.14);
  color: var(--orange);
  border-color: rgba(255, 137, 72, 0.32);
}
.nav-drop-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  padding: 6px;
  border-radius: var(--r-md);
  background: var(--p-950);
  border: 1px solid var(--line-2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 60;
}
.nav-drop.open .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.nav-drop-menu a:hover { background: var(--surface-hi); color: var(--cream); }
.nav-drop-menu a.active { color: var(--orange); }

/* ---------- salary status strip ---------- */
.strip { display: flex; flex-direction: column; gap: 12px; }
.strip-row {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.strip-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.strip-name { font-size: 15px; font-weight: 700; }
.strip-period { font-size: 12.5px; font-weight: 600; color: var(--faint); }
.strip-sum { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--orange-hi); font-variant-numeric: tabular-nums; }

.steps-line { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; min-width: 0; }
.step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line-2);
  border: 3px solid var(--p-900);
  box-shadow: 0 0 0 1px var(--line-2);
  flex-shrink: 0;
  z-index: 1;
  cursor: default;
  transition: all 0.16s ease;
}
.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  text-align: center;
  line-height: 1.3;
}
.step-when { font-size: 10.5px; font-weight: 600; color: var(--faint); opacity: 0.75; font-variant-numeric: tabular-nums; }
/* connector between dots */
.step::before,
.step::after {
  content: '';
  position: absolute;
  top: 8px;
  height: 2px;
  background: var(--line-2);
}
.step::before { left: 0; right: 50%; }
.step::after { left: 50%; right: 0; }
.step:first-child::before,
.step:last-child::after { display: none; }

.step.done .step-dot { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.step.done .step-label { color: var(--cream); }
.step.done::before, .step.done::after { background: rgba(86, 217, 163, 0.45); }

.step.current .step-dot {
  background: var(--orange);
  box-shadow: 0 0 0 1px var(--orange), 0 0 0 6px rgba(255, 137, 72, 0.2);
}
.step.current .step-label { color: var(--orange); }
.step.current::before { background: rgba(86, 217, 163, 0.45); }

.step.failed .step-dot { background: var(--late); box-shadow: 0 0 0 1px var(--late); }
.step.failed .step-label { color: var(--late); }
.step.failed::before { background: rgba(255, 122, 122, 0.45); }

/* ---------- responsive: rail collapses to a strip of icons, then hides ---------- */
@media (max-width: 1100px) {
  .sidenav { width: 76px; padding: 14px 10px; }
  .sidenav-brand { font-size: 15px; padding: 6px 0 16px; text-align: center; letter-spacing: 0.1em; }
  .side-item { justify-content: center; padding: 11px 0; }
  .side-item span { display: none; }
  .side-item .badge { position: absolute; top: 4px; right: 12px; }
  .topbar, .subnav-wrap, .flash-wrap, .container { margin-left: 76px; }
}

@media (max-width: 760px) {
  .sidenav {
    flex-direction: row;
    align-items: center;
    top: auto;
    bottom: 0;
    right: 0;
    width: auto;
    height: 60px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .sidenav-brand { display: none; }
  .sidenav-items { flex-direction: row; flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .sidenav-items::-webkit-scrollbar { display: none; }
  .sidenav-foot { margin-top: 0; padding-top: 0; border-top: none; }
  .side-item { padding: 10px 12px; }
  .topbar, .subnav-wrap, .flash-wrap, .container { margin-left: 0; }
  .container { padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); }
  .topbar-area { display: none; }
  .strip-head { gap: 8px; }
  .step-label { font-size: 11px; }
  .step-when { display: none; }
}

/* ---------- collapsible card (details/summary) ---------- */
.fold { padding-bottom: 22px; }
.fold:not([open]) { padding-bottom: 18px; }
.fold-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.fold-head::-webkit-details-marker { display: none; }
.fold-head:hover .card-title { color: var(--muted); }
.fold-arrow {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--faint);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.fold[open] .fold-arrow { transform: rotate(180deg); }

/* ---------- KPI editor (panel) ---------- */
.kpi-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(28, 0, 34, 0.28);
  margin-bottom: 10px;
}
.kpi-item-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.kpi-item-head .k-title { flex: 1; min-width: 180px; font-weight: 600; }
.kpi-item .k-desc { min-height: 52px; margin-bottom: 10px; }
.kpi-crits { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.kpi-crit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kpi-crit .k-clabel { flex: 1; min-width: 160px; }
.input-unit.pct { max-width: 120px; }
.input-unit.pct::after { content: '%'; }
.input-unit.rub { max-width: 140px; }
.input-unit.rub::after { content: '₽'; }

/* ---------- KPI form (public) ---------- */
.kpi-card { max-width: 640px; }
.kpi-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: rgba(28, 0, 34, 0.28);
  margin-bottom: 14px;
}
.kpi-block-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.kpi-block-head b { flex: 1; font-size: 15px; }
.kpi-price { font-size: 13px; font-weight: 700; color: var(--orange-hi); white-space: nowrap; }
.kpi-desc { margin: 0 0 12px; line-height: 1.5; }
.kpi-crit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.kpi-crit-label { flex: 1; min-width: 150px; font-size: 13.5px; }
.kpi-crit-target { font-size: 12px; font-weight: 600; color: var(--faint); white-space: nowrap; }
.kpi-verdict {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
}
.kpi-verdict.met { background: rgba(86, 217, 163, 0.14); color: var(--ok); }
.kpi-verdict.missed { background: rgba(255, 122, 122, 0.14); color: var(--late); }
.kpi-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin: 18px 0;
  border-radius: var(--r-md);
  background: rgba(255, 137, 72, 0.1);
  border: 1px solid rgba(255, 137, 72, 0.3);
  font-size: 14px;
  font-weight: 600;
}
.kpi-total b { font-size: 19px; color: var(--orange); font-variant-numeric: tabular-nums; }
.kpi-result { text-align: left; margin: 14px 0; }
.kpi-result-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kpi-result-row:last-child { border-bottom: none; }
.kpi-result-name { flex: 1; font-size: 13.5px; }
.kpi-result-sum { font-weight: 700; font-size: 13.5px; color: var(--ok); font-variant-numeric: tabular-nums; }
.kpi-result-sum.zero { color: var(--faint); }

/* ---------- встреча: строка с раскрывающейся правкой ---------- */
.meet-list { display: flex; flex-direction: column; }
.meet { border-bottom: 1px solid var(--line); }
.meet:last-child { border-bottom: none; }
.meet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 0;
  cursor: pointer;
  list-style: none;
  flex-wrap: wrap;
}
.meet-head::-webkit-details-marker { display: none; }
.meet-head .user-main { flex: 1; min-width: 170px; }
.meet-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.meet-head:hover .meet-toggle { color: var(--cream); }
.meet[open] .meet-toggle .fold-arrow { transform: rotate(180deg); }
.meet-body { padding: 4px 0 18px; }
.meet-cancel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.meet-cancel input { flex: 1; min-width: 200px; }

@media (max-width: 640px) {
  .meet-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .meet-cancel input { min-width: 0; }
}

/* ---------- календарь команды ---------- */
.container.wide { max-width: 1320px; }

.cal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-title { font-size: 17px; font-weight: 700; min-width: 190px; }
.cal-filter { flex: 1; display: flex; justify-content: flex-end; }
.cal-person span { display: inline-flex; align-items: center; gap: 7px; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* по цвету на человека — так строка сразу читается, чья она */
.c1 { --cal: #ff8948; }
.c2 { --cal: #56d9a3; }
.c3 { --cal: #74b8ff; }
.c4 { --cal: #ffc24b; }
.c5 { --cal: #c89bff; }
.c6 { --cal: #ff7ab8; }
.cal-dot.c1, .cal-dot.c2, .cal-dot.c3, .cal-dot.c4, .cal-dot.c5, .cal-dot.c6 { background: var(--cal); }

/* --- месяц --- */
.cal-month {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.cal-head-row, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.cal-cell {
  min-height: 116px;
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-week:last-child .cal-cell { border-bottom: none; }
.cal-cell.weekend { background: rgba(255, 247, 241, 0.02); }
.cal-cell.past { opacity: 0.55; }
.cal-cell.today { background: rgba(255, 137, 72, 0.09); }
.cal-daynum { font-size: 13px; font-weight: 700; }
.cal-cell.today .cal-daynum { color: var(--orange); }

.cal-chip {
  display: block;
  font-size: 11.5px;
  line-height: 1.35;
  padding: 3px 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--cal) 16%, transparent);
  border-left: 3px solid var(--cal);
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.cal-chip b { color: var(--cal); font-weight: 700; }
.cal-chip.busy, .cal-chip.google { opacity: 0.8; font-style: italic; }

/* --- неделя --- */
.cal-week-view {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.cal-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-day.weekend { background: rgba(255, 247, 241, 0.02); }
.cal-day.today { border-color: rgba(255, 137, 72, 0.45); }
.cal-day-head { display: flex; align-items: baseline; gap: 6px; }
.cal-day-head b { font-size: 16px; }
.cal-day.today .cal-day-head b { color: var(--orange); }
.cal-empty { color: var(--muted); font-size: 13px; }

.cal-event {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--cal) 14%, transparent);
  border-left: 3px solid var(--cal);
}
.cal-event-time { font-size: 11.5px; font-weight: 700; color: var(--cal); }
.cal-event-title { font-size: 13px; font-weight: 600; }
.cal-event-who, .cal-event-note { font-size: 11.5px; color: var(--muted); }
.cal-event.busy .cal-event-title, .cal-event.google .cal-event-title { font-weight: 500; font-style: italic; }

@media (max-width: 1100px) {
  .cal-week-view { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cal-week-view { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .cal-month { overflow-x: auto; }
  .cal-head-row, .cal-week { min-width: 620px; }
  .cal-cell { min-height: 92px; }
  .cal-filter { justify-content: flex-start; }
  .cal-title { min-width: 0; }
}

/* ---------- страница записи: карточка · календарь · слоты ---------- */
.bk-page { max-width: 1060px; margin: 0 auto; padding: 34px 18px 60px; }
.bk-brand { display: block; margin-bottom: 20px; }

.bk-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 290px;
  gap: 16px;
  align-items: start;
}
/* колонкам разрешено сжиматься: без этого широкое содержимое распирает сетку */
.bk-grid > * { min-width: 0; }
.bk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
}

/* левая карточка */
.bk-host { display: flex; flex-direction: column; text-align: center; }
.bk-avatar {
  width: 72px;
  height: 72px;
  margin: 4px auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--p-950);
  background: linear-gradient(135deg, var(--orange), #ffb27a);
}
.bk-host-name { margin: 0; font-size: 15px; font-weight: 600; }
.bk-sep { height: 1px; background: var(--line); margin: 18px 0; }
.bk-title { font-size: 20px; margin: 0 0 8px; }
.bk-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; line-height: 1.6; }
.bk-host .msg { text-align: left; margin-bottom: 14px; }
.bk-form { text-align: left; margin-bottom: 16px; }
.bk-chosen {
  font-size: 13px;
  margin: 0 0 14px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 137, 72, 0.12);
  border: 1px solid rgba(255, 137, 72, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bk-chosen b { color: var(--orange-hi); }
.bk-host .btn.block { margin-top: auto; }
.bk-host .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* календарь месяца */
.bk-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.bk-month-label { font-size: 15px; font-weight: 700; }
.bk-cal-nav { display: flex; gap: 6px; }
.bk-cal-nav .icon-btn[disabled] { opacity: 0.3; pointer-events: none; }

/* minmax(0, 1fr), а не 1fr: иначе квадратные ячейки раздувают колонки шире
   карточки — сетка уезжает вправо и наползает на список слотов */
.bk-week-head, .bk-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.bk-week-head span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 6px;
}
.bk-day {
  aspect-ratio: 1 / 1;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bk-day.empty { visibility: hidden; }
/* свободные числа подсвечены — по ним и кликают */
.bk-day.free {
  color: var(--cream);
  background: rgba(255, 137, 72, 0.13);
  border-color: rgba(255, 137, 72, 0.26);
  cursor: pointer;
}
.bk-day.free:hover { background: rgba(255, 137, 72, 0.24); }
.bk-day.today { box-shadow: inset 0 0 0 1px var(--line-2); }
.bk-day.sel { background: var(--orange); border-color: var(--orange); color: #2a1206; }
.bk-day[disabled] { opacity: 0.35; }

.bk-tz {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bk-tz-now { font-size: 12.5px; color: var(--muted); }
.bk-tz-now b { color: var(--cream); }

/* правая колонка со временем */
.bk-times-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.bk-times-day { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.bk-times-list { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; }
.bk-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: none;
  color: var(--cream);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.bk-time svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.bk-time:hover { border-color: rgba(255, 137, 72, 0.45); background: rgba(255, 137, 72, 0.08); }
.bk-time.picked { background: rgba(255, 137, 72, 0.18); border-color: var(--orange); }
.bk-time.picked svg { color: var(--orange); }

/* подтверждение */
.bk-done { max-width: 420px; margin: 0 auto; text-align: center; }
.bk-done h1 { font-size: 22px; margin: 8px 0 14px; }
.bk-done-day { color: var(--muted); font-size: 14px; margin: 0 0 2px; }
.bk-done-time { font-size: 20px; font-weight: 700; color: var(--orange-hi); margin: 0 0 14px; }

@media (max-width: 980px) {
  .bk-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .bk-host { text-align: left; }
  .bk-avatar { margin-left: 0; }
  .bk-times-list { max-height: none; }
}

/* ---------- мини-приложение в боте ---------- */
body.tg { background: var(--p-950); }
.tg-wrap { max-width: 560px; margin: 0 auto; padding: 16px 14px 96px; }
.tg-wrap .card { padding: 18px; margin-bottom: 12px; }
.tg-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tg-note {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 12px;
}
.tg-note.good { color: var(--ok); border-color: rgba(86, 217, 163, 0.35); }
.tg-note.bad { color: var(--late); border-color: rgba(255, 122, 122, 0.35); }
.tg-wrap .ph-actions { margin-top: 10px; gap: 14px; flex-wrap: wrap; }

/* заявка, ждущая решения */
.meet-decide {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 194, 75, 0.1);
  border: 1px solid rgba(255, 194, 75, 0.3);
}
.meet-decide .muted { flex: 1; min-width: 200px; }
.cal-event.pendingBooking, .cal-chip.pendingBooking { border-left-style: dashed; }

/* Evangelists: partner renewals, documents and bot access. */
.evangelists-panel .split-title { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.evangelists-panel textarea { resize:vertical; }
.form-details { margin-top:14px; padding:12px 14px; border:1px solid var(--line); border-radius:14px; background:var(--surface); }
.form-details[open] { background:var(--surface-hi); border-color:var(--line-2); }
.form-details summary { cursor:pointer; color:var(--orange-hi); font-weight:750; }
.detail-grid { margin-top:14px; }
.ev-docs-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
.subcard { padding:15px; border:1px solid var(--line); border-radius:15px; background:var(--surface); color:var(--cream); }
.subcard input,.subcard select { width:100%; margin-bottom:10px; }
.file-chips { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.evangelist-row { grid-template-columns:auto minmax(220px,1fr) minmax(120px,auto) auto; }
.evangelist-row.overdue { border-left:3px solid #dc4b4b; }
.evangelist-row.soon { border-left:3px solid #ff8948; }
.admin-split { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:20px; }
.split-title .card-title,.subcard .card-title { margin-top:0; }
.mini-row { display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--line); }
.mini-row>span { flex:1; min-width:0; }.mini-row b,.mini-row small { display:block; }.mini-row small { margin-top:3px; color:var(--muted); }
.mini-row>a { text-decoration:none; }.mini-row form { margin:0; }
.admin-split .inline-form { display:grid; grid-template-columns:1fr 1fr auto; gap:8px; align-items:end; margin-top:14px; }
.admin-split .tariff-grid { grid-template-columns:2fr 1fr; }
.admin-split .tariff-grid .tariff-duration { display:grid; grid-template-columns:85px 1fr; gap:8px; }
.tariffs-card { margin-top:20px; overflow:hidden; }
.tariff-list { display:grid; gap:8px; margin:16px 0 18px; }
.tariff-item { display:grid; grid-template-columns:42px minmax(0,1fr) auto auto; align-items:center; gap:12px; padding:12px 14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); transition:all .16s ease; }
.tariff-item:hover { border-color:var(--line-2); background:var(--surface-hi); transform:translateY(-1px); }
.tariff-item.is-off { opacity:.58; }
.tariff-mark { display:grid; place-items:center; width:38px; height:38px; border-radius:12px; background:rgba(255,137,72,.16); color:var(--orange); font-size:18px; font-weight:800; }
.tariff-main { min-width:0; }.tariff-main b,.tariff-main small { display:block; }.tariff-main b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.tariff-main small { margin-top:3px; color:var(--muted); font-size:12px; }
.tariff-item>strong { color:var(--orange-hi); white-space:nowrap; }.tariff-edit { color:var(--muted); font-size:12px; }
.tariff-form { padding:16px; border:1px solid rgba(255,137,72,.3); border-radius:var(--r-md); background:rgba(255,137,72,.055); }
.tariff-fields { margin:0; }.tariff-duration { display:grid; grid-template-columns:90px 1fr; gap:8px; }
.tariff-actions { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:14px; }.tariff-actions .actions { margin:0; }
.community-role-note { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:13px; margin-top:16px; padding:14px; border:1px solid var(--line); border-radius:var(--r-md); background:var(--surface); }
.community-role-note b,.community-role-note p { display:block; margin:0; }.community-role-note p { margin-top:3px; color:var(--muted); font-size:12.5px; }.community-role-note p a { color:var(--orange-hi); text-decoration:underline; }.people-mark { color:var(--ok); background:rgba(86,217,163,.12); }
@media(max-width:800px) {
  .ev-docs-grid,.admin-split { grid-template-columns:1fr; }
  .evangelist-row { grid-template-columns:auto minmax(0,1fr) auto; }
  .evangelist-row .row-actions { grid-column:2 / -1; justify-content:flex-end; }
  .admin-split .inline-form { grid-template-columns:1fr; }
  .tariff-item { grid-template-columns:38px minmax(0,1fr) auto; }.tariff-edit { display:none; }.tariff-item>strong { grid-column:2; }
  .tariff-actions { align-items:flex-start; flex-direction:column; }.community-role-note { grid-template-columns:38px minmax(0,1fr); }.community-role-note>.btn { grid-column:2; justify-self:start; }
}

@media (max-width:1100px) {
  .sidenav-group-label { display:none; }
  .sidenav-group + .sidenav-group { border-top:0; padding-top:0; }
  .sidenav-group { margin-bottom:8px; }
}

@media (max-width:760px) {
  .container { max-width:100%; }
  .flash-wrap { max-width:100%; }
  .page-head h1 { font-size:23px; }
  .sidenav-group { margin-bottom:0; }
}
