/* ============================================================
   LACOR — Telegram Mini App Design System
   ============================================================ */

/* Barlow is a graceful fallback while Decima Nova Pro loads.
   Geist Mono is the project's monospace face. */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;600;700&display=swap');

/* Decima Nova Pro — company font (self-hosted). */
@font-face {
  font-family: "Decima Nova Pro";
  src: url("assets/decima-nova-pro.otf") format("opentype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand palette ------------------------------------------- */
  --ink:        #2A2244;   /* primary text, surfaces */
  --red:        #C8202C;   /* action, alerts */
  --bg:         #F1F2F6;   /* page background */
  --line:       #DEE1E5;   /* borders, dividers */
  --rose:       #F5E0DF;   /* soft red wash, tags */

  /* Derived ------------------------------------------------- */
  --ink-90:     rgba(42, 34, 68, 0.92);
  --ink-70:     rgba(42, 34, 68, 0.72);
  --ink-55:     rgba(42, 34, 68, 0.55);
  --ink-35:     rgba(42, 34, 68, 0.35);
  --ink-15:     rgba(42, 34, 68, 0.15);
  --ink-08:     rgba(42, 34, 68, 0.08);
  --ink-04:     rgba(42, 34, 68, 0.04);
  --red-tint:   rgba(200, 32, 44, 0.10);
  --white:      #FFFFFF;
  --green:      #1F8A5B;
  --amber:      #C28A1A;

  /* Type ---------------------------------------------------- */
  --font-display: "Decima Nova Pro", "Barlow", -apple-system, "Helvetica Neue", sans-serif;
  --font-body:    "Decima Nova Pro", "Barlow", -apple-system, "Helvetica Neue", sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Spacing & radii ---------------------------------------- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Telegram MiniApp control min font (prevents iOS zoom) */
  --fz-input: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

/* The net pattern lives behind everything at very low opacity */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("assets/net.png");
  background-size: 720px auto;
  background-repeat: repeat;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

main, .page { position: relative; z-index: 1; }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}

.doc-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 56px;
}
.doc-header .meta-eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-55);
  margin-bottom: 14px;
}
.doc-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 56px;
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
  color: var(--ink);
}
.doc-header h1 em {
  font-style: normal;
  color: var(--red);
}
.doc-header p {
  margin: 0;
  max-width: 56ch;
  color: var(--ink-70);
  font-size: 16px;
  line-height: 1.55;
}
.doc-header .meta-right {
  text-align: right;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-55);
  line-height: 1.7;
}
.doc-header .meta-right b {
  color: var(--ink);
  font-weight: 500;
}

section.ds-section {
  margin-bottom: 88px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-head .label {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-55);
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.section-head .right {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-35);
}

/* Card row layout for component groups */
.spec-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px dashed var(--line);
}
.spec-row:last-child { border-bottom: none; }
.spec-row .spec-meta h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.spec-row .spec-meta p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-55);
}
.spec-row .spec-meta code {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-70);
  background: var(--ink-04);
  padding: 2px 6px;
  border-radius: 4px;
}

.spec-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

/* ============================================================
   FOUNDATIONS — Colors
   ============================================================ */
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.swatch {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--white);
}
.swatch .chip {
  height: 140px;
  position: relative;
}
.swatch .chip::after {
  /* tiny dot indicator at corner */
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
}
.swatch[data-light] .chip::after {
  background: rgba(42, 34, 68, 0.25);
}
.swatch .meta {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.swatch .name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
}
.swatch .hex {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-55);
}
.swatch .role {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--ink-35);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* ============================================================
   FOUNDATIONS — Typography
   ============================================================ */
.type-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px dashed var(--line);
}
.type-grid:last-child { border-bottom: none; }
.type-grid .lbl {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-55);
}
.type-grid .lbl small {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-35);
  text-transform: none;
  letter-spacing: 0;
}
.t-display-xl { font-family: var(--font-display); font-weight: 800; font-size: 56px; line-height: 0.95; letter-spacing: -0.025em; color: var(--ink); }
.t-display-l  { font-family: var(--font-display); font-weight: 700; font-size: 36px; line-height: 1.05; letter-spacing: -0.02em; color: var(--ink); }
.t-h1         { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.15; letter-spacing: -0.015em; color: var(--ink); }
.t-h2         { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); }
.t-body       { font-family: var(--font-body);    font-weight: 400; font-size: 16px; line-height: 1.55; color: var(--ink); }
.t-caption    { font-family: var(--font-body);    font-weight: 500; font-size: 13px; line-height: 1.4;  color: var(--ink-70); }
.t-mono       { font-family: var(--font-body);    font-weight: 500; font-size: 12px; letter-spacing: 0.06em; color: var(--ink-55); text-transform: uppercase; }

/* ============================================================
   FOUNDATIONS — Logo
   ============================================================ */
.logo-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 14px;
}
.logo-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--white);
  min-height: 220px;
  justify-content: space-between;
}
.logo-card.dark { background: var(--ink); color: var(--white); border-color: transparent; }
.logo-card.rose { background: var(--rose); border-color: transparent; }
.logo-card .holder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-card img { max-width: 100%; max-height: 90px; object-fit: contain; }
.logo-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-55);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.logo-card.dark .meta { color: rgba(255,255,255,0.55); }

/* ============================================================
   FOUNDATIONS — Background pattern
   ============================================================ */
.bg-card {
  border-radius: var(--r-md);
  overflow: hidden;
  height: 260px;
  position: relative;
  border: 1px solid var(--line);
}
.bg-card .surface {
  position: absolute;
  inset: 0;
  background-image: url("assets/net.png");
  background-size: 540px auto;
  background-repeat: repeat;
}
.bg-card .label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-55);
  background: var(--white);
  padding: 6px 10px;
  border-radius: 4px;
}
.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.bg-card.light { background: var(--bg); }
.bg-card.white { background: var(--white); }
.bg-card.ink   { background: var(--ink); }
.bg-card.ink .surface { opacity: 0.18; filter: invert(1); }
.bg-card.ink .label { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  height: 48px;
  padding: 0 20px;
  cursor: pointer;
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; display: inline-block; }

.btn--primary { background: var(--red); color: var(--white); }
.btn--primary:hover { background: #B41C26; }
.btn--primary:focus-visible { outline: 3px solid var(--red-tint); outline-offset: 2px; }

.btn--ink { background: var(--ink); color: var(--white); }
.btn--ink:hover { background: #221B38; }

.btn--secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
}
.btn--secondary:hover { border-color: var(--ink-35); }

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink-04); }

.btn--danger-ghost {
  background: var(--rose);
  color: var(--red);
}
.btn--danger-ghost:hover { background: #F0CFCD; }

.btn[disabled], .btn.is-disabled {
  background: var(--line);
  color: var(--ink-35);
  cursor: not-allowed;
  border-color: transparent;
}

.btn--lg { height: 56px; padding: 0 24px; font-size: 17px; border-radius: var(--r-lg); }
.btn--sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn--icon { width: 48px; padding: 0; }
.btn--block { width: 100%; }

/* ============================================================
   INPUTS  (font-size MUST be >= 16px to prevent iOS zoom-on-focus)
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
}
.field > label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.field > label .req { color: var(--red); }
.field .hint, .field .err {
  font-size: 12px;
  color: var(--ink-55);
  line-height: 1.4;
}
.field .err { color: var(--red); }

.input {
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  height: 52px;
  padding: 0 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  gap: 10px;
}
.input input,
.input textarea,
.input select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--fz-input);  /* 16px → no iOS zoom */
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 0;
  width: 100%;
  min-width: 0;
}
.input input::placeholder { color: var(--ink-35); font-weight: 400; }
.input .lead, .input .trail {
  display: flex;
  align-items: center;
  color: var(--ink-55);
  font-size: 14px;
  flex-shrink: 0;
}
.input .trail.clickable { cursor: pointer; color: var(--ink); }
.input:hover { border-color: var(--ink-35); }
.input:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--ink-08);
}
.input.is-error { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.input.is-disabled {
  background: var(--bg);
  border-color: var(--line);
  color: var(--ink-35);
  pointer-events: none;
}
.input.is-disabled input { color: var(--ink-35); }
.input.is-filled {}

.textarea-wrap { height: auto; padding: 14px; align-items: stretch; }
.textarea-wrap textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

/* Counter / OTP variant */
.otp-row {
  display: flex;
  gap: 10px;
}
.otp-cell {
  width: 52px;
  height: 60px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
}
.otp-cell.active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-08); }
.otp-cell.empty { color: var(--ink-15); }

/* ============================================================
   SELECT (custom dropdown)
   ============================================================ */
.select {
  position: relative;
  width: 320px;
}
.select .trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  height: 52px;
  padding: 0 14px;
  font-size: var(--fz-input);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  font-family: var(--font-body);
  letter-spacing: -0.005em;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.select .trigger:hover { border-color: var(--ink-35); }
.select.is-open .trigger { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-08); }
.select .trigger .placeholder { color: var(--ink-35); font-weight: 400; }
.select .trigger .caret {
  width: 16px; height: 16px;
  transition: transform .18s ease;
  color: var(--ink-55);
  flex-shrink: 0;
}
.select.is-open .trigger .caret { transform: rotate(180deg); }

.select .menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(42, 34, 68, 0.12), 0 2px 6px rgba(42, 34, 68, 0.06);
  padding: 6px;
  display: none;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
}
.select.is-open .menu { display: block; }
/* Portaled state: the menu is detached from .select and appended to <body>
   to escape ancestors that create a containing block (e.g. ms-body-inner
   has a transform that traps position:fixed). All visual styles below are
   duplicated under `.menu.is-portaled` selectors. */
.menu.is-portaled {
  display: block;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(42, 34, 68, 0.12), 0 2px 6px rgba(42, 34, 68, 0.06);
  padding: 6px;
  overflow-y: auto;
}
.select .menu .opt,
.menu.is-portaled .opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: -0.005em;
}
.select .menu .opt:hover,
.menu.is-portaled .opt:hover { background: var(--ink-04); }
.select .menu .opt.is-selected,
.menu.is-portaled .opt.is-selected { background: var(--ink-04); }
.select .menu .opt.is-selected::after,
.menu.is-portaled .opt.is-selected::after {
  content: "✓";
  font-weight: 700;
  color: var(--red);
}
.select .menu .opt .sub,
.menu.is-portaled .opt .sub {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--ink-35);
  margin-left: 12px;
}

/* Autocomplete-specific */
.select .search,
.menu.is-portaled .search {
  display: flex;
  gap: 8px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin: -6px -6px 6px;
  align-items: center;
}
.select .search input,
.menu.is-portaled .search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--fz-input);
  color: var(--ink);
  font-weight: 500;
  background: transparent;
  padding: 4px 0;
}
.select .search input::placeholder,
.menu.is-portaled .search input::placeholder { color: var(--ink-35); font-weight: 400; }
.select .search .ic,
.menu.is-portaled .search .ic { color: var(--ink-55); font-size: 14px; }
.select .menu .opt mark,
.menu.is-portaled .opt mark {
  background: transparent;
  color: var(--red);
  font-weight: 700;
}
.select .empty,
.menu.is-portaled .empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-55);
}

/* ============================================================
   HEADERS
   ============================================================ */
.header-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: var(--white);
  padding: 14px 16px;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.app-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/net.png");
  background-size: 540px auto;
  opacity: 0.10;
  filter: invert(1);
  pointer-events: none;
}
.app-header > * { position: relative; z-index: 1; }
.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-header .brand img { height: 22px; filter: brightness(0) invert(1); }
.app-header .brand .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.005em;
}
.app-header .actions { display: flex; gap: 6px; }
.app-header .ic-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--white);
}
.app-header .ic-btn:hover { background: rgba(255,255,255,0.16); }

.page-header {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.page-header .crumb {
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-35);
}
.page-header .crumb b { color: var(--ink-70); font-weight: 500; }
.page-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.page-header .sub { color: var(--ink-55); font-size: 13px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 4px 6px;
}
.section-header .t {
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-55);
}
.section-header .a {
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  width: 100%;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--ink);
}
.table thead th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-55);
  font-weight: 500;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table thead th.num, .table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--ink-04); }
.table .code {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.table .muted { color: var(--ink-55); font-weight: 400; }

/* Mobile table - card list variant */
.table-mobile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.table-mobile .row {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 14px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: baseline;
}
.table-mobile .row .id {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-55);
  letter-spacing: 0.04em;
  grid-column: 1 / 2;
}
.table-mobile .row .badge { grid-column: 2 / 3; grid-row: 1 / 3; align-self: start; }
.table-mobile .row .route {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
  grid-column: 1 / 2;
}
.table-mobile .row .footer {
  grid-column: 1 / 3;
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-55);
}
.table-mobile .row .footer b { color: var(--ink); font-weight: 600; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink-08);
  color: var(--ink);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--red    { background: var(--rose); color: var(--red); }
.badge--ink    { background: var(--ink); color: var(--white); }
.badge--green  { background: rgba(31, 138, 91, 0.12); color: var(--green); }
.badge--amber  { background: rgba(194, 138, 26, 0.14); color: var(--amber); }
.badge--ghost  { background: transparent; color: var(--ink-55); border: 1px solid var(--line); }
.badge--ghost::before { display: none; }

/* ============================================================
   BLOCKS / CARDS
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
}
.card--ink   { background: var(--ink); color: var(--white); border-color: transparent; }
.card--red   { background: var(--red); color: var(--white); border-color: transparent; }
.card--rose  { background: var(--rose); border-color: transparent; }

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 180px;
}
.stat-card .lbl {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-55);
}
.card--ink .stat-card .lbl { color: rgba(255,255,255,0.6); }
.stat-card .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 36px;
  letter-spacing: -0.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card .delta {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--green);
}
.stat-card .delta.down { color: var(--red); }

.list-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s ease, transform .08s ease;
}
.list-item:hover { border-color: var(--ink-35); }
.list-item:active { transform: translateY(1px); }
.list-item .lead-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ink-04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink);
  flex-shrink: 0;
}
.list-item .lead-ic.red { background: var(--rose); color: var(--red); }
.list-item .lead-ic.ink { background: var(--ink); color: var(--white); }
.list-item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list-item .body .ttl {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .body .sub {
  font-size: 13px;
  color: var(--ink-55);
}
.list-item .chev {
  color: var(--ink-35);
  font-size: 18px;
}

.info-block {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.info-block.red {
  background: var(--rose);
  border-color: rgba(200,32,44,0.18);
  color: var(--ink);
}
.info-block .ic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.info-block.red .ic { background: var(--red); }
.info-block .body .t {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
  color: var(--ink);
}
.info-block .body .d {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-70);
}

/* ============================================================
   MULTISTEP FORM
   ============================================================ */
.ms-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.ms-step {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .25s ease, box-shadow .25s ease, background-color .25s ease;
}
.ms-step.is-active {
  border-color: var(--ink);
  box-shadow: 0 1px 0 var(--ink-08), 0 8px 24px -12px rgba(42, 34, 68, 0.18);
}
.ms-step.is-pending {
  background: var(--bg);
  border-color: var(--line);
}

.ms-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.ms-step.is-pending .ms-head { cursor: not-allowed; }

.ms-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 30px;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  white-space: nowrap;
}
.ms-step.is-pending .ms-num {
  border-color: var(--line);
  color: var(--ink-35);
}
.ms-step.is-done .ms-num {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.ms-head .meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-head .ms-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-step.is-pending .ms-head .ms-title { color: var(--ink-55); }
.ms-head .ms-summary {
  font-size: 13px;
  color: var(--ink-55);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-step.is-done .ms-head .ms-summary {
  color: var(--ink-70);
}
.ms-head .ms-edge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-35);
  font-size: 12px;
}
.ms-step.is-done .ms-head .ms-edge { color: var(--red); font-weight: 600; font-family: var(--font-display); }
.ms-step.is-active .ms-head .ms-edge { display: none; }
.ms-step.is-pending .ms-head .ms-edge { color: var(--ink-15); }
.ms-head .ms-edge .ic { font-size: 14px; }

/* Body collapse via grid-template-rows 0fr → 1fr (smooth) */
.ms-body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s cubic-bezier(.4, 0, .2, 1);
}
.ms-step.is-active .ms-body-wrap { grid-template-rows: 1fr; }
.ms-body {
  min-height: 0;
  overflow: hidden;
}
.ms-body-inner {
  padding: 4px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s ease, transform .25s ease;
}
.ms-step.is-active .ms-body-inner {
  opacity: 1;
  transform: translateY(0);
  transition-delay: .12s;
}
.ms-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-70);
  padding: 0 0 4px;
}

.ms-cta-wrap {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  background: linear-gradient(to top, var(--bg) 60%, rgba(241,242,246,0));
  padding-top: 12px;
}
.ms-cta {
  position: relative;
  overflow: hidden;
}
.ms-cta .ms-cta-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity .2s ease, transform .2s ease;
}
.ms-cta.is-swapping .ms-cta-label {
  opacity: 0;
  transform: translateY(6px);
}

/* Inline progress rail (optional) */
.ms-rail {
  display: flex;
  gap: 6px;
  padding: 4px 0 10px;
}
.ms-rail .tick {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  transition: background-color .25s ease;
}
.ms-rail .tick.is-done { background: var(--ink); }
.ms-rail .tick.is-active { background: var(--red); }

.picker-block {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.picker-block .picker-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.picker-block .picker-label .t {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.picker-block .picker-label .req {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-35);
}
.picker {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 2px;
}
.picker button {
  appearance: none;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-55);
  padding: 10px 6px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.picker button:hover { color: var(--ink); }
.picker button.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(42, 34, 68, 0.10), inset 0 0 0 1px var(--ink-08);
}
.picker-panels { display: contents; }
.picker-panels [data-panel] { display: none; flex-direction: column; gap: 8px; }
.picker-panels [data-panel].is-active { display: flex; }

.mp-result {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-55);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mp-result.ok::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.mp-result.ok.ozon { color: #005BFF; }
.mp-result.ok.wb   { color: #CB11AB; }
.mp-result.err     { color: var(--red); }

/* Stacked option (used by HS-code autocomplete) */
.select .menu .opt.opt--stacked,
.menu.is-portaled .opt.opt--stacked {
  display: block;
  padding: 10px 12px;
}
.select .menu .opt.opt--stacked .line1,
.menu.is-portaled .opt.opt--stacked .line1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.select .menu .opt.opt--stacked .code,
.menu.is-portaled .opt.opt--stacked .code {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.select .menu .opt.opt--stacked .line2,
.menu.is-portaled .opt.opt--stacked .line2 {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-55);
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: -0.005em;
}
.select .menu .opt.opt--stacked.is-selected::after,
.menu.is-portaled .opt.opt--stacked.is-selected::after {
  position: absolute;
  right: 12px;
  top: 10px;
}
.select .menu .opt.opt--stacked.is-selected,
.menu.is-portaled .opt.opt--stacked.is-selected { position: relative; }

/* Segmented control / tabs */
.seg {
  display: inline-flex;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
}
.seg .opt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--ink-70);
  cursor: pointer;
  user-select: none;
  letter-spacing: -0.005em;
}
.seg .opt.is-active {
  background: var(--ink);
  color: var(--white);
}

/* Toggle switch */
.tog {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  cursor: pointer;
  transition: background-color .18s ease;
  flex-shrink: 0;
}
.tog::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: var(--white);
  border-radius: 50%;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tog.on { background: var(--red); }
.tog.on::after { transform: translateX(18px); }

/* Checkbox */
.chk {
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink-35);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--white);
  flex-shrink: 0;
}
.chk.on {
  background: var(--ink);
  border-color: var(--ink);
}
.chk.on::after { content: "✓"; color: var(--white); font-weight: 700; font-size: 14px; }

/* Radio */
.rd {
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink-35);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--white);
  flex-shrink: 0;
}
.rd.on { border-color: var(--red); }
.rd.on::after {
  content: "";
  width: 11px; height: 11px;
  background: var(--red);
  border-radius: 50%;
}

/* Bottom Tab Bar */
.tabbar {
  display: flex;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
  gap: 4px;
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-55);
}
.tabbar .tab.is-active { color: var(--ink); }
.tabbar .tab.is-active .dot { background: var(--red); }
.tabbar .tab .ic { font-size: 18px; }
.tabbar .tab .lbl {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.tabbar .tab .dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: transparent;
}

/* ============================================================
   PHONE FRAMES (mini-app preview)
   ============================================================ */
.preview-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}
.phone {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 36px;
  padding: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -20px rgba(42, 34, 68, 0.25), 0 8px 20px -8px rgba(42, 34, 68, 0.12);
}
.phone .screen {
  background: var(--bg);
  border-radius: 26px;
  height: 640px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone .screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("assets/net.png");
  background-size: 480px auto;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
.phone .screen > * { position: relative; z-index: 1; }
.phone .tg-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: var(--white);
  padding: 10px 18px 12px;
  font-size: 12px;
  font-weight: 500;
}
.phone .tg-status .close {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  font-size: 12px;
}
.phone .content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.phone .content .field,
.phone .content .select,
.phone .content .input,
.phone .content .page-header,
.phone .content .info-block,
.phone .content .card,
.phone .content .list-item,
.phone .content .table-mobile,
.phone .content .app-header,
.phone .content .tabbar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.phone .content .input { box-sizing: border-box; }
.phone .caption {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-55);
  text-align: center;
}

/* small util */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }

/* Responsive */
@media (max-width: 920px) {
  .page { padding: 32px 18px 64px; }
  .doc-header { grid-template-columns: 1fr; }
  .doc-header .meta-right { text-align: left; }
  .doc-header h1 { font-size: 40px; }
  .color-grid { grid-template-columns: repeat(2, 1fr); }
  .logo-grid { grid-template-columns: 1fr; }
  .bg-grid { grid-template-columns: 1fr; }
  .spec-row { grid-template-columns: 1fr; gap: 16px; padding: 22px 0; }
  .type-grid { grid-template-columns: 1fr; }
  .preview-row { grid-template-columns: 1fr; }
  .field, .select { width: 100%; }
}
