/* Стиль — за референсом design-reference/ (портал Дія), без логотипу, назви «Дія» і державної символіки. */
@font-face {
  font-family: 'Onest';
  src: url('/fonts/onest-cyrillic-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  src: url('/fonts/onest-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Кольори з референсу */
  --gradient-start: #d5f54f;
  --gradient-end: #027ffd;
  --lime-bg: #f7fddb;
  --blue-grey-bg: #e7eef3;
  --black: #000;
  --white: #fff;
  --grey-text: #6b6b6b;
  --placeholder: #6f6f6f;
  --line: #d9dde1;
  --error: #c4231a;
  --error-bg: #fdeceb;
  --ok: #1d7a3a;

  --radius-card: 24px;
  --radius-field: 16px;
  --shadow-card: 0 2px 6px rgb(0 0 0 / 0.04), 0 12px 32px rgb(0 0 0 / 0.06);
  --font: 'Onest', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--black);
  background: var(--lime-bg);
}
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- Шапка з градієнтом ---------- */
.hero {
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  padding: 0 24px 72px;
}
.hero__bar {
  max-width: 832px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}
.product { font-size: 16px; font-weight: 500; }
.hero__content { max-width: 832px; margin: 32px auto 0; }
h1 {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.lead { font-size: 20px; margin: 0; max-width: 34em; }

/* ---------- Сторінка й картки ---------- */
.page { max-width: 880px; margin: -40px auto 0; padding: 0 24px 96px; }
.page--narrow { max-width: 560px; }
.field--first { margin-top: 0; }
.btn--spaced { margin-top: 24px; }
.logout { margin: 0; }
.logout .btn--text { min-height: 36px; padding: 0; font-size: 16px; }
.card {
  background: var(--white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 32px;
  margin-bottom: 24px;
}
h2 { font-size: 28px; font-weight: 400; letter-spacing: -0.01em; margin: 0 0 8px; }
h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 32px 0 4px;
  padding-top: 24px;
  border-top: 1px solid var(--black);
}
.eyebrow { font-size: 14px; color: var(--grey-text); text-transform: uppercase; letter-spacing: 0.06em; }
.hint { font-size: 15px; color: var(--grey-text); margin: 4px 0 16px; }
.hint--center { text-align: center; margin: 12px 0 32px; }

/* ---------- Поля ---------- */
.field { margin-top: 20px; }
.field--narrow { max-width: 320px; margin-top: 12px; }
label { display: block; font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.optional { font-weight: 400; color: var(--grey-text); }
input[type='text'], input[type='password'] {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font: inherit;
  font-size: 17px;
  color: var(--black);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--placeholder); }
input:hover { border-color: #b6bcc2; }
input:focus { border-color: var(--black); box-shadow: 0 0 0 1px var(--black); }
input[aria-invalid='true'] { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); background: #fffafa; }
.field + .hint, .field .hint { margin-bottom: 0; }
.field .hint { margin-top: 8px; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 56px; }
.input-suffix span { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--grey-text); }
.field-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--error);
  font-size: 15px;
  margin: 8px 0 0;
}
.field-error::before {
  content: '!';
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--error);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  display: grid; place-items: center;
  margin-top: 1px;
}

/* ---------- Кнопки ---------- */
.btn {
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:focus-visible { outline: 3px solid var(--gradient-end); outline-offset: 3px; }
.btn--primary { background: var(--black); color: var(--white); }
.btn--primary:hover { background: #2b2b2b; }
.btn--primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn--large { min-height: 64px; padding: 0 40px; font-size: 19px; width: 100%; }
.btn--secondary { background: var(--white); color: var(--black); border-color: var(--black); }
.btn--secondary:hover { background: var(--black); color: var(--white); }
.btn--text { background: none; color: var(--black); min-height: 44px; padding: 0 12px; text-decoration: underline; text-underline-offset: 4px; }
.btn--text:hover { text-decoration-thickness: 2px; }
.btn--danger { color: var(--error); }
.btn--add-direction {
  width: 100%;
  min-height: 72px;
  background: transparent;
  border: 1.5px dashed var(--black);
  border-radius: var(--radius-card);
  font-size: 18px;
}
.btn--add-direction:hover { background: var(--white); border-style: solid; }

/* ---------- Напрямок ---------- */
.direction__head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.points { list-style: none; margin: 8px 0 0; padding: 0; }
.point { padding: 20px 0; border-bottom: 1px solid var(--line); }
.point:first-child { padding-top: 8px; }
.point__head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.point__label { font-size: 17px; font-weight: 500; display: flex; align-items: center; gap: 12px; }
.point__label::before {
  content: attr(data-marker);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 14px;
  display: grid; place-items: center;
}
.point--middle .point__label::before { background: var(--white); color: var(--black); border: 1px solid var(--black); }
.point__fields { display: grid; grid-template-columns: 2fr 3fr; gap: 0 16px; }
.point__fields .field { margin-top: 8px; }
.points__actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.route-summary { font-size: 17px; font-weight: 500; margin: 16px 0 0; }
.route-summary:empty { display: none; }

/* ---------- Перетин ДКУ ---------- */
.dku-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 12px; }
.dku-auto__text { margin: 0; font-size: 17px; }
.dku-auto__text.is-pending { color: var(--grey-text); }
.btn--compact { padding: 0; min-height: 36px; }

/* ---------- Позначка «координати розпізнано» ---------- */
.input-check { position: relative; }
.input-check input { padding-right: 52px; }
.input-check__mark {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ok);
}
.input-check__mark::after {
  content: ''; position: absolute; left: 8px; top: 4px;
  width: 6px; height: 11px;
  border: solid var(--white); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
input[data-valid='true'] { border-color: var(--ok); }
.field-ok { color: var(--ok); font-size: 15px; margin: 8px 0 0; }

/* ---------- Дати ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit;
  min-width: 96px;
  min-height: 64px;
  padding: 8px 16px;
  border-radius: var(--radius-field);
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip small { font-size: 13px; color: var(--grey-text); }
.chip strong { font-size: 18px; font-weight: 500; }
.chip:hover { border-color: var(--black); }
.chip[aria-pressed='true'] { background: var(--black); border-color: var(--black); color: var(--white); }
.chip[aria-pressed='true'] small { color: #c9c9c9; }
.chip:focus-visible { outline: 3px solid var(--gradient-end); outline-offset: 2px; }

/* ---------- Генерація ---------- */
.generate { margin-top: 8px; }
.alert {
  background: var(--error-bg);
  border-radius: var(--radius-field);
  padding: 20px 24px;
  margin-bottom: 16px;
  color: var(--black);
}
.alert strong { display: block; color: var(--error); font-weight: 500; margin-bottom: 4px; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert a { color: var(--black); }
.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 64px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow-card);
  font-size: 19px;
  font-weight: 500;
}
.spinner {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--black);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.card--done { text-align: center; margin-top: 0; }
.card--done .btn--primary { margin-top: 8px; }
.card--done .btn--text { display: flex; margin: 8px auto 0; }

/* ---------- Вузький екран ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 0 16px 64px; }
  .field--narrow { max-width: none; }
  .hero__content { margin-top: 16px; }
  .lead { font-size: 18px; }
  .page { padding: 0 16px 64px; }
  .card { padding: 24px 20px; border-radius: 20px; }
  h2 { font-size: 24px; }
  .point__fields { grid-template-columns: 1fr; }
  .points__actions { flex-direction: column; align-items: stretch; }
  .points__actions .btn--secondary { width: 100%; }
  .chip { min-width: calc(33.33% - 7px); }
}
