/* ============ НАЄЗД CRM ============ */

:root {
  color-scheme: dark;

  --bg: #0a0a0a;
  --bg-panel: #131313;
  --bg-panel-2: #1c1c1c;
  --bg-input: #0f0f0f;
  --border: #272727;
  --border-hover: #484848;
  --text: #f4f4f4;
  --text-dim: #a1a1a1;
  --text-faint: #6a6a6a;
  --accent: #e11d2f;
  --accent-bright: #ff3b4e;
  --accent-deep: #8f0f1c;
  --accent-glow: rgba(225, 29, 47, 0.18);

  --c-green: #34d399;
  --c-yellow: #fbbf24;
  --c-orange: #fb923c;
  --c-red: #f43f5e;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --topbar-h: 64px;
}

[data-level="green"]  { --lvl: var(--c-green); }
[data-level="yellow"] { --lvl: var(--c-yellow); }
[data-level="orange"] { --lvl: var(--c-orange); }
[data-level="red"]    { --lvl: var(--c-red); }

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  scroll-behavior: smooth;
  /* Браузер не роздуває текст самовільно в альбомній орієнтації */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Без зуму на дотик: вимикає подвійний тап і меню по довгому натисканню */
  touch-action: manipulation;
  -webkit-touch-callout: none;
}


/* ============ Шапка ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px; top: 11px;
  height: 4px;
  border-radius: 2px;
  background: #fff;
}
.brand-text {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-accent { color: var(--accent-bright); margin-left: 4px; }

/* вкладки */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.tab {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--accent);
  color: #fff;
}
.tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.tab:not(.is-active) .tab-count { background: var(--accent); color: #fff; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* «Додати випадок» з'являється лише після входу — до того в шапці
   лишається сама кнопка «Увійти». */
body:not(.is-authed) #addBtn { display: none; }


/* ============ Кнопки ============ */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-bright); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-plus { font-size: 1.1rem; line-height: 1; margin-top: -2px; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }
.btn-ghost.is-authed { border-color: rgba(244, 63, 94, 0.45); color: var(--c-red); }
.btn-ghost.is-authed:hover { border-color: var(--c-red); color: var(--c-red); background: rgba(244, 63, 94, 0.1); }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}
.icon-btn:hover { color: var(--text); background: var(--bg-panel-2); }
.icon-btn-sm { font-size: 0.95rem; padding: 5px 8px; }

/* Дії в рядку — повноцінні кнопки, а не самотні значки */
.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  min-width: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-dim);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
/* Підпис показуємо тільки в картковому режимі — у таблиці на нього немає місця */
.act-text { display: none; font-size: 0.85rem; font-weight: 600; }

.act-btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg-panel-2); }
.act-delete:hover { color: #fff; border-color: var(--accent); background: var(--accent); }
.act-btn:active { transform: translateY(1px); }
.act-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============ Layout ============ */
.container {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}

.view { display: none; }
.view.is-active { display: flex; flex-direction: column; gap: 20px; animation: fadeUp 0.4s ease both; }


/* ============ Панелі ============ */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.panel-head .btn { margin-left: auto; }
/* активні фільтри */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.chip:hover { border-color: var(--c-red); color: var(--text); }
.chip-x { color: var(--text-faint); font-size: 0.95rem; line-height: 1; }
.filter-note { font-size: 0.78rem; color: var(--text-faint); }

/* ============ Поля ============ */
.field { display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-hint {
  position: absolute;
  right: 2px;
  top: 0;
  font-size: 0.74rem;
  color: var(--accent-bright);
}

input[type="text"], input[type="date"], input[type="search"],
input[type="email"], input[type="password"], select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 10px 13px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-faint); }
/* iOS дає полю дати власну «вроджену» ширину і не дає їй стиснутись —
   через це воно вилазило за край форми на вузьких екранах. */
input[type="date"] {
  color-scheme: dark;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
}
select { cursor: pointer; }

/* iOS сам наближає сторінку, коли фокусується поле зі шрифтом дрібнішим
   за 16px. На дотикових екранах піднімаємо рівно до 16px — і зуму немає. */
@media (max-width: 900px) {
  input[type="text"], input[type="date"], input[type="search"],
  input[type="email"], input[type="password"], select {
    font-size: 16px;
  }
}

/* ============ Рівні ============ */
.level-picker, .level-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.level-picker input[type="radio"] { display: none; }

.level-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.2s ease;
  user-select: none;
}
.level-btn:hover { border-color: var(--border-hover); color: var(--text); }

.level-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lvl, var(--text-faint));
  flex: none;
  transition: box-shadow 0.2s ease;
}

.level-picker input:checked + .level-btn,
.level-toggle.is-on {
  border-color: var(--lvl);
  color: var(--lvl);
  background: color-mix(in srgb, var(--lvl) 12%, transparent);
}
.level-picker input:checked + .level-btn .level-dot,
.level-toggle.is-on .level-dot { box-shadow: 0 0 10px var(--lvl); }

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--lvl);
  border: 1px solid color-mix(in srgb, var(--lvl) 45%, transparent);
  background: color-mix(in srgb, var(--lvl) 12%, transparent);
}

/* ============ Таблиця ============ */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }

.crm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}
.crm-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.crm-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}
.crm-table tbody tr {
  animation: rowIn 0.35s ease both;
  transition: background 0.2s ease;
}
.crm-table tbody tr:hover { background: var(--bg-panel-2); }
.crm-table tbody td:first-child { box-shadow: inset 3px 0 0 var(--lvl); border-radius: 3px 0 0 3px; }

.cell-date { white-space: nowrap; color: var(--text-dim); }
.cell-sub { display: block; font-size: 0.74rem; color: var(--text-faint); margin-top: 2px; }
.cell-what { max-width: 300px; }
.cell-name { font-weight: 600; }
.cell-loc { color: var(--text-dim); white-space: nowrap; }
.cell-social { min-width: 160px; }
.cell-actions { text-align: right; white-space: nowrap; width: 1%; }
.muted { color: var(--text-faint); }

/* дії видно лише після входу */
.cell-actions { opacity: 0; transition: opacity 0.2s ease; }
body.is-authed .cell-actions { opacity: 1; }
body:not(.is-authed) .cell-actions { pointer-events: none; }

/* пустий стан */
.empty-state { display: none; text-align: center; padding: 54px 20px; }
.empty-state.visible { display: block; animation: fadeUp 0.4s ease both; }
.empty-title { font-weight: 600; }
.empty-sub { color: var(--text-faint); font-size: 0.85rem; margin-top: 4px; }

/* ============ Фільтр ============ */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.field-levels { margin-bottom: 20px; }
.filter-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.86rem;
}

/* ============ Модалки ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal.is-open .modal-backdrop { opacity: 1; }

.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  /* Без цього блок можна тягати пальцем убік: коли overflow задано лише по
     одній осі, друга сама стає прокручуваною. */
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.2s ease;
}
.modal.is-open .modal-card { transform: none; opacity: 1; }
.modal-narrow { width: min(400px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.modal-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 1.05rem;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
#authForm .field { margin-bottom: 14px; }
.auth-error {
  color: var(--c-red);
  font-size: 0.84rem;
  margin-top: -4px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ============ Соцмережі ============ */

.social-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 42px;
  margin-top: 4px;
}
.social-preview { display: flex; align-items: center; animation: fadeUp 0.3s ease both; }
.social-preview:empty { display: none; }

.photo-btn {
  cursor: pointer;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}
.photo-btn:hover { border-color: var(--accent); color: var(--accent-bright); }

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: hsl(var(--av-hue, 265) 45% 38%);
  box-shadow: 0 0 0 1px var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.avatar-letter {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 0.82rem;
  color: #fff;
  user-select: none;
}
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.avatar-img.loaded { opacity: 1; }

.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--accent-bright);
  font-weight: 500;
  font-size: 0.86rem;
  transition: background 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
}
.social-chip:hover { background: var(--bg-input); border-color: var(--border-hover); }
.social-chip:hover .avatar { transform: scale(1.06); box-shadow: 0 0 0 1px var(--accent); }
.social-chip.static { cursor: default; }
.social-chip.static:hover { background: transparent; border-color: transparent; }
.social-chip.static:hover .avatar { transform: none; box-shadow: 0 0 0 1px var(--border); }
.social-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--bg-panel-2);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.25s ease;
  z-index: 200;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ============ Анімації ============ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes rowOut { to { opacity: 0; transform: translateX(24px); } }
tr.removing { animation: rowOut 0.28s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============ Планшет ============ */
@media (max-width: 960px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; gap: 12px; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .topbar-actions { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 20px 16px 50px; }
}

/* ============ Телефон ============ */
@media (max-width: 640px) {
  .panel { padding: 16px; }
  .btn-text { display: none; }
  .btn-primary { padding: 10px 14px; }
  .btn-plus { font-size: 1.25rem; margin: 0; }
  .topbar-inner { gap: 10px; }
  .btn-ghost { padding: 10px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .active-filters { margin-left: 0; width: 100%; }
  .panel-head { gap: 10px; }
  .modal { padding: 10px; }
  .modal-card { padding: 18px; max-height: calc(100vh - 20px); }

}

@media (max-width: 330px) {
  .stats { gap: 8px; }
  .brand-text { display: none; }
}

/* ============ Таблиця -> картки (планшет і телефон) ============ */
@media (max-width: 820px) {
  .crm-table { min-width: 0; }
  /* У картковому режимі горизонтальній прокрутці нема чого прокручувати —
     прибираємо її, щоб картку не можна було тягати пальцем убік. */
  .table-wrap { overflow-x: hidden; }
  .crm-table td { overflow-wrap: anywhere; }
  .crm-table thead { display: none; }
  .crm-table, .crm-table tr, .crm-table td { display: block; }
  .crm-table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .crm-table tbody tr {
    position: relative;
    border: 1px solid var(--border);
    border-left: 3px solid var(--lvl);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: var(--bg-input);
  }
  /* Відступ зверху кожного поля — щоб підпис тримався свого значення,
     а не висів рівно між ним і полем вище. */
  .crm-table td { border: none; padding: 7px 0 0; }
  .crm-table tbody td:first-child { box-shadow: none; padding-top: 0; }
  .crm-table td.cell-what { max-width: none; }
  .crm-table td.cell-loc { white-space: normal; }
  .crm-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 1px;
  }
  /* Дата в картці поводиться як усі інші поля: підпис зверху, значення під ним.
     Пора року стає окремим полем зі своїм підписом, а не приліпленим збоку. */
  .cell-date { white-space: normal; }
  .cell-date .cell-sub {
    display: block;
    margin-top: 10px;
    font-size: inherit;
    color: inherit;
  }
  .cell-date .cell-sub::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 1px;
  }
  /* Дії в картці — окремий ряд знизу на всю ширину, а не значки в кутку.
     Так вони не налазять на дату і в них можна впевнено попасти пальцем. */
  .crm-table td.cell-actions {
    position: static;
    width: auto;
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .crm-table td.cell-actions::before { display: none; }
  .cell-actions .act-btn { flex: 1; height: 44px; }
  .act-text { display: inline; }
  /* Гостю ряд не показуємо зовсім, інакше лишається порожня смуга з рискою */
  body:not(.is-authed) .cell-actions { display: none; }
  .cell-social .social-chip { margin-left: -4px; }
}

@media (max-width: 640px) {
  .crm-table tbody { grid-template-columns: 1fr; }
}

/* ============ Hero ============ */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 34px;
  animation: fadeUp 0.45s ease both;
}

.hero-main {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.hero-count {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: clamp(3.4rem, 9vw, 5.6rem);
  line-height: 0.9;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.hero-text { min-width: 0; }

.hero-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: clamp(1.2rem, 3.4vw, 1.7rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.hero-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.hero-note {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.btn-lg { padding: 14px 26px; font-size: 0.92rem; }

@media (max-width: 640px) {
  .hero { padding: 26px 20px; gap: 20px; }
  .hero-main { gap: 18px; }
  .hero .btn-lg { width: 100%; justify-content: center; }
}

@media (max-width: 380px) {
  .hero-main { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ============ Випадаючий список ============ */

/* нативний select лишається запасним варіантом, якщо select.js не спрацював */
select {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23a1a1a1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 11px;
  padding-right: 34px;
}
select option { background: var(--bg-panel); color: var(--text); }

.select { position: relative; width: 100%; }

/* коли працює свій список — нативний ховаємо, але лишаємо в DOM */
.select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 10px 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.select-btn:hover { border-color: var(--border-hover); }
.select-btn:focus-visible,
.select.is-open .select-btn {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.select-chevron {
  width: 11px;
  height: 8px;
  flex: none;
  color: var(--text-dim);
  transition: transform 0.2s ease, color 0.2s ease;
}
.select.is-open .select-chevron { transform: rotate(180deg); color: var(--accent-bright); }

.select-menu {
  position: fixed;
  z-index: 120;
  background: var(--bg-panel-2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 5px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  animation: selectIn 0.16s ease both;
}
.select-menu.is-up { animation: selectInUp 0.16s ease both; }

.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.89rem;
  text-align: left;
  padding: 9px 11px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.select-option.is-active { background: var(--bg-input); color: var(--text); }

/* На дотикових екранах пункти списку розганяємо приблизно до 46px —
   інакше пальцем легко влучити в сусідній. */
@media (hover: none) {
  .select-option { padding: 12px; font-size: 0.95rem; }
}
.select-option[aria-selected="true"] { color: var(--accent-bright); font-weight: 600; }
.select-option[aria-selected="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  flex: none;
}

@keyframes selectIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}
@keyframes selectInUp {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}


/* ============ Локація у формі ============ */
.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--accent); color: #fff; }

.loc-parts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  animation: fadeUp 0.25s ease both;
}
#fPlace { animation: fadeUp 0.25s ease both; }

@media (max-width: 640px) {
  .loc-parts { grid-template-columns: 1fr; }
  .field-row { gap: 8px; }
}

/* пояснення під полем */
.field-note {
  font-size: 0.79rem;
  line-height: 1.45;
  color: var(--text-faint);
  margin-top: -2px;
}

/* ============ Скролбари ============ */
/* Сховані всюди — десктоп, планшет, телефон, будь-який внутрішній
   контейнер. Прокрутка при цьому працює як завжди. */

/* Firefox, старий Edge */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Chrome, Edge, Safari */
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* кнопка виходу: ім'я і піктограма виходу */
.logout-icon {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.btn-ghost.is-authed:hover .logout-icon {
  opacity: 1;
  transform: translateX(2px);
}
.auth-name { font-weight: 600; }
