/* ==========================================================================
   Базовые стили: шрифты, токены, типографика, формы, кнопки, уведомления.
   Общие для страниц участника и админки.
   ========================================================================== */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(/static/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(/static/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(/static/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }

:root {
  --font-sans: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Нейтральные тона — тёплый серый из логотипа VoxLink */
  --ink: #1f1d1b;
  --ink-2: #45413e;
  --muted: #716b67;
  --line: #e6e2dd;
  --line-strong: #cfc8c1;
  --bg: #f4f2ef;
  --surface: #ffffff;
  --surface-2: #faf9f7;

  /* Фирменный оранжевый логотипа; для текста на белом — затемнённый вариант */
  --accent: #f18a02;
  --accent-hover: #d97a00;
  --accent-text: #a55700;
  --accent-soft: #fff4e5;
  --focus-ring: 0 0 0 3px rgba(241, 138, 2, 0.28);

  --ok: #1d7443;      --ok-soft: #e6f3eb;
  --warn: #8f5400;    --warn-soft: #fff3df;
  --err: #b0261d;     --err-soft: #fcebe9;
  --info: #26588f;    --info-soft: #e8eff7;

  --radius: 6px;
  --radius-lg: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }

a { color: var(--accent-text); text-decoration: underline; text-decoration-color: rgba(165, 87, 0, 0.35); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

.mono { font-family: var(--font-mono); font-variant-ligatures: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Верхняя панель ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 10px 24px;
  margin: 0 auto;
}
.topbar__brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.topbar__brand img { height: 26px; width: auto; display: block; }
.topbar__label {
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}
.topbar__user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); min-width: 0; }
.topbar__user .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.topbar__user a { white-space: nowrap; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 500 15px/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: #e4dfda;
  border-color: #e4dfda;
  color: #8d8580;
  cursor: not-allowed;
}
.btn .spinner { width: 16px; height: 16px; }

.link-button {
  background: none; border: 0; padding: 0;
  color: var(--accent-text); font: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(165, 87, 0, 0.35); text-underline-offset: 2px;
}
.link-button:hover { text-decoration-color: currentColor; }
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Поля формы (только по классам — не задеваем разметку виджета СДЭК) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field__hint { font-size: 13px; color: var(--muted); }
.field__error { font-size: 13px; color: var(--err); display: none; }
.field.is-invalid .field__error { display: block; }
.field.is-invalid .input { border-color: var(--err); }

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: 400 15px/1.3 var(--font-sans);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #a39c96; }
.input:hover { border-color: #b3aba3; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.input.mono { font-family: var(--font-mono); font-size: 14px; }

/* ---------- Уведомления ---------- */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}
.alert[hidden] { display: none; }
.alert__title { font-weight: 600; margin-bottom: 2px; }
.alert--info { background: var(--info-soft); border-color: #cddcec; color: #1d3f66; }
.alert--ok { background: var(--ok-soft); border-color: #c7e3d1; color: #174f31; }
.alert--warn { background: var(--warn-soft); border-color: #f2d9ad; color: #6b3f00; }
.alert--err { background: var(--err-soft); border-color: #f1c9c4; color: #7d1a13; }
.alert--neutral { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }

/* ---------- Бейджи статусов ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--created { background: #f1efec; color: #5c5652; border-color: #e2ddd8; }
.badge--transit { background: var(--info-soft); color: var(--info); border-color: #cddcec; }
.badge--delivered { background: var(--ok-soft); color: var(--ok); border-color: #c7e3d1; }
.badge--problem { background: var(--err-soft); color: var(--err); border-color: #f1c9c4; }

/* ---------- Всплывающее сообщение ---------- */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast--err { background: var(--err); }
.toast--ok { background: var(--ok); }

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 22px; }
  .topbar__inner { padding: 10px 16px; }
  .topbar__label { display: none; }
  .topbar__user .email { display: none; }
  .card { padding: 20px 16px; border-radius: 8px; }
}

/* ---------- Утилиты ---------- */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.center { text-align: center; }
