/* IQBS Портал — единая утверждённая тема «графит».
   ДНК: static/mockups/1.html + страницы p-*.html (не редактировать макеты).
   Сначала базовый каркас, затем компоненты страниц. */

  :root {
    /* поверхности */
    --bg:          #12161c;
    --surface:     #171d26;
    --surface-2:   #1b2330;
    --surface-3:   #212b3a;
    /* линии */
    --line:        #232c38;
    --line-strong: #2f3b4c;
    /* текст */
    --text:        #e7edf4;
    --text-dim:    #9aa9bc;
    --text-mute:   #6d7d91;
    /* акцент — стальной голубой */
    --accent:      #4f9dd4;
    --accent-deep: #2f6d99;
    --accent-soft: rgba(79, 157, 212, 0.14);
    /* семантика (отдельно от акцента) */
    --amber:       #d8a33f;
    --amber-soft:  rgba(216, 163, 63, 0.14);
    --green:       #59a97f;
    --green-soft:  rgba(89, 169, 127, 0.14);
    --slate:       #7b8ca1;
    --slate-soft:  rgba(123, 140, 161, 0.13);

    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
    --ui: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --rail-w: 96px;
    --hdr-h: 52px;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--ui);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
  }

  .num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: -0.01em;
  }

  .label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--text-mute);
    font-weight: 600;
  }

  a { color: var(--accent); }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* ---------- каркас ---------- */

  .app {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    grid-template-rows: var(--hdr-h) minmax(0, 1fr);
    grid-template-areas:
      "hdr hdr"
      "rail main";
    min-height: 100vh;
  }

  /* ---------- шапка ---------- */

  .topbar {
    grid-area: hdr;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .brand .mark {
    width: 26px;
    height: 26px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-deep);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .brand h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .shift {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-left: 16px;
    border-left: 1px solid var(--line);
    color: var(--text-dim);
    font-size: 12px;
    white-space: nowrap;
  }

  .live-dot {
    width: 7px;
    height: 7px;
    flex: none;
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-soft);
  }

  .topbar .spacer { flex: 1 1 auto; }

  .variant-badge {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    padding: 3px 8px;
    white-space: nowrap;
  }

  .user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
    white-space: nowrap;
  }

  .avatar {
    width: 26px;
    height: 26px;
    flex: none;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    font-size: 11px;
    font-weight: 650;
    color: var(--text-dim);
  }

  .user-name { font-size: 13px; }
  .user-role { font-size: 10px; color: var(--text-mute); }

  .btn {
    font-family: inherit;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    padding: 6px 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color .12s linear, border-color .12s linear, background-color .12s linear;
  }

  .btn:hover {
    color: var(--text);
    border-color: var(--accent-deep);
  }

  .btn-primary {
    color: #0d1219;
    background: var(--accent);
    border-color: var(--accent);
    font-weight: 650;
  }

  .btn-primary:hover {
    background: #62aade;
    border-color: #62aade;
    color: #0d1219;
  }

  /* ---------- навигационный рельс ---------- */

  .rail {
    grid-area: rail;
    position: sticky;
    top: var(--hdr-h);
    align-self: start;
    height: calc(100vh - var(--hdr-h));
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow-y: auto;
  }

  .rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 4px 9px;
    color: var(--text-mute);
    text-decoration: none;
    border-left: 2px solid transparent;
    font-size: 10.5px;
    text-align: center;
    line-height: 1.2;
    transition: color .12s linear, background-color .12s linear;
  }

  .rail-item svg { display: block; }
  .rail-item:hover { color: var(--text); background: var(--surface-2); }

  .rail-item[aria-current="page"] {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
    font-weight: 600;
  }

  .rail-sep {
    height: 1px;
    background: var(--line);
    margin: 7px 14px;
  }

  /* ---------- контент ---------- */

  .main {
    grid-area: main;
    min-width: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .page-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .page-head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 650;
    letter-spacing: 0.01em;
    text-wrap: balance;
  }

  .page-head .sub {
    font-size: 12px;
    color: var(--text-mute);
  }

  /* ---------- плитки-показатели ---------- */

  .kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
  }

  .kpi {
    background: var(--surface);
    padding: 12px 14px 11px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    position: relative;
  }

  .kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--kpi-bar, var(--line-strong));
  }

  .kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .kpi-top svg { color: var(--text-mute); flex: none; }

  .kpi-value {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 24px;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .kpi-value .unit {
    font-size: 12px;
    color: var(--text-mute);
    font-weight: 500;
    margin-left: 3px;
  }

  .kpi-foot {
    font-size: 11.5px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .kpi-foot .dim { color: var(--text-mute); }
  .kpi-foot .warn { color: var(--amber); }

  .meter {
    height: 3px;
    background: var(--surface-3);
    display: flex;
    gap: 1px;
  }

  .meter i { display: block; height: 100%; }

  /* ---------- панели ---------- */

  .grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    min-width: 0;
  }

  .panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
  }

  .panel-head h3 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text);
    text-wrap: balance;
  }

  .panel-head .count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-mute);
    border: 1px solid var(--line-strong);
    padding: 1px 6px;
  }

  .panel-head .spacer { flex: 1 1 auto; }

  .panel-head .link {
    font-size: 11.5px;
    color: var(--text-dim);
    text-decoration: none;
    border-bottom: 1px dotted var(--line-strong);
  }

  .panel-head .link:hover { color: var(--accent); border-bottom-color: var(--accent-deep); }

  .panel-body { padding: 14px; }

  .panel-foot {
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--text-mute);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* ---------- таблицы ---------- */

  .tablewrap {
    overflow-x: auto;
    max-width: 100%;
  }

  table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
  }

  thead th {
    position: sticky;
    top: 0;
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-weight: 600;
    color: var(--text-mute);
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
  }

  tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
  }

  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover td { background: var(--surface-2); }

  /* состояние кодируется формой: полоса слева у строки */
  tbody td:first-child {
    border-left: 3px solid var(--row-state, transparent);
    padding-left: 11px;
  }

  tr.st-work    { --row-state: var(--accent); }
  tr.st-hold    { --row-state: var(--amber); }
  tr.st-service { --row-state: var(--green); }

  .cell-num {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 12.5px;
    white-space: nowrap;
  }

  .cell-num .date { color: var(--text-mute); }

  .money {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
  }

  th.money { text-align: right; }

  .client { font-size: 13px; }
  .muted { color: var(--text-mute); }
  .empty { color: var(--text-mute); font-family: var(--mono); }

  /* ---------- чипы состояния ---------- */

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1;
    padding: 4px 8px 4px 6px;
    border: 1px solid var(--chip-line, var(--line-strong));
    background: var(--chip-bg, var(--slate-soft));
    color: var(--chip-fg, var(--text-dim));
    white-space: nowrap;
    font-weight: 550;
  }

  .chip::before {
    content: "";
    width: 6px;
    height: 6px;
    flex: none;
    background: currentColor;
  }

  .chip-work    { --chip-fg: var(--accent); --chip-bg: var(--accent-soft); --chip-line: var(--accent-deep); }
  .chip-hold    { --chip-fg: var(--amber);  --chip-bg: var(--amber-soft);  --chip-line: #8a6a26; }
  .chip-done    { --chip-fg: var(--green);  --chip-bg: var(--green-soft);  --chip-line: #35674f; }
  .chip-neutral { --chip-fg: var(--slate);  --chip-bg: var(--slate-soft);  --chip-line: var(--line-strong); }

  .chip-hold::before { transform: rotate(45deg); }
  .chip-done::before { border-radius: 50%; }

  /* ---------- форма приёма документов ---------- */

  .intake {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px 18px;
  }

  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .field.wide { grid-column: 1 / -1; }

  .seg {
    position: relative;
    display: inline-flex;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    width: fit-content;
    max-width: 100%;
  }

  .seg input {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
  }

  .seg label {
    padding: 7px 14px;
    font-size: 12px;
    color: var(--text-dim);
    cursor: pointer;
    border-right: 1px solid var(--line-strong);
    white-space: nowrap;
    transition: color .12s linear, background-color .12s linear;
  }

  .seg label:last-of-type { border-right: 0; }
  .seg label:hover { color: var(--text); }

  .seg input:checked + label {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: inset 0 -2px 0 0 var(--accent);
    font-weight: 600;
  }

  .seg input:focus-visible + label {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }

  select,
  .filebox {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    padding: 7px 9px;
    width: 100%;
    min-width: 0;
  }

  select { appearance: none; cursor: pointer; }

  .select-wrap { position: relative; }

  .select-wrap svg {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-mute);
    pointer-events: none;
  }

  .select-wrap select { padding-right: 26px; }

  select:disabled {
    color: var(--text-mute);
    background: #151b23;
    cursor: not-allowed;
  }

  .filebox {
    display: flex;
    align-items: center;
    gap: 10px;
    border-style: dashed;
    cursor: pointer;
    color: var(--text-dim);
  }

  .filebox:hover { border-color: var(--accent-deep); color: var(--text); }
  .filebox svg { color: var(--text-mute); flex: none; }
  .filebox input[type="file"] { display: none; }
  .filebox .hint { font-size: 11px; color: var(--text-mute); margin-left: auto; white-space: nowrap; }

  .intake-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 14px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
  }

  .intake-actions .note {
    font-size: 11.5px;
    color: var(--text-mute);
    max-width: 340px;
  }

  /* ---------- список сессий ---------- */

  .sessions { display: flex; flex-direction: column; }

  .session {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: center;
    padding: 10px 14px 10px 11px;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid var(--row-state, var(--line-strong));
  }

  .session:last-child { border-bottom: 0; }
  .session:hover { background: var(--surface-2); }
  .session.s-work { --row-state: var(--accent); }
  .session.s-check { --row-state: var(--amber); }
  .session.s-done { --row-state: var(--green); }

  .session .sid {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
    letter-spacing: 0.02em;
  }

  .session .meta {
    grid-column: 1 / 2;
    font-size: 11.5px;
    color: var(--text-mute);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .session .meta b {
    font-weight: 500;
    color: var(--text-dim);
  }

  .session .chip { grid-row: 1 / span 2; }

  /* ---------- кассы ---------- */

  .tills { display: flex; flex-direction: column; }

  .till {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
  }

  .till svg { color: var(--text-mute); }
  .till:hover { background: var(--surface-2); }
  .till .name { font-size: 13px; }
  .till .name small { display: block; font-size: 10.5px; color: var(--text-mute); letter-spacing: 0.04em; text-transform: uppercase; }

  .till .amt {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-size: 13.5px;
    white-space: nowrap;
  }

  .till-total {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 12px;
    padding: 11px 14px;
    border-top: 1px solid var(--line-strong);
    background: var(--surface-2);
  }

  .till-total .amt {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 17px;
    font-weight: 650;
    text-align: right;
    color: var(--text);
    white-space: nowrap;
  }

  /* ---------- подвал ---------- */

  .foot {
    display: flex;
    align-items: center;
    gap: 10px 16px;
    flex-wrap: wrap;
    padding: 12px 2px 24px;
    border-top: 1px solid var(--line);
    color: var(--text-mute);
    font-size: 11.5px;
  }

  .foot .num { color: var(--text-dim); }
  .foot .spacer { flex: 1 1 auto; }

  /* ---------- адаптив ---------- */

  @media (max-width: 1080px) {
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (max-width: 760px) {
    .app {
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: auto auto minmax(0, 1fr);
      grid-template-areas:
        "hdr"
        "rail"
        "main";
    }

    .rail {
      position: sticky;
      top: var(--hdr-h);
      height: auto;
      flex-direction: row;
      gap: 0;
      padding: 0;
      border-right: 0;
      border-bottom: 1px solid var(--line);
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
    }

    .rail-item {
      flex: none;
      flex-direction: row;
      gap: 7px;
      padding: 10px 12px;
      border-left: 0;
      border-bottom: 2px solid transparent;
      white-space: nowrap;
      font-size: 12px;
    }

    .rail-item[aria-current="page"] {
      border-left: 0;
      border-bottom-color: var(--accent);
    }

    .rail-sep { display: none; }

    .main { padding: 12px; gap: 12px; }
    .shift { display: none; }
    .user-role { display: none; }
    .intake { grid-template-columns: minmax(0, 1fr); }
    .kpi-value { font-size: 21px; }
  }

  @media (max-width: 460px) {
    .kpis { grid-template-columns: minmax(0, 1fr); }
    .user-name { display: none; }
    .variant-badge { display: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* ==================================================================
     Компоненты страниц (из утверждённых макетов p-*.html)
     ================================================================== */

  a.btn { text-decoration: none; }

  /* недоступный пункт рельса («скоро») */
  .rail-item.is-disabled {
    color: var(--text-mute);
    opacity: 0.55;
    cursor: not-allowed;
  }

  .rail-item.is-disabled:hover {
    color: var(--text-mute);
    background: transparent;
  }

  .rail-item .soon {
    font-size: 8.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    padding: 1px 4px;
    color: var(--text-mute);
    font-weight: 600;
  }

  /* ---------- поля ввода ---------- */

  input[type="text"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  textarea {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    padding: 7px 9px;
    width: 100%;
    min-width: 0;
  }

  input.num { font-size: 12.5px; }

  input:disabled,
  textarea:disabled {
    color: var(--text-mute);
    background: #151b23;
    cursor: not-allowed;
  }

  textarea {
    resize: vertical;
    min-height: 76px;
    line-height: 1.5;
  }

  ::placeholder { color: var(--text-mute); opacity: 1; }

  input.amount {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    text-align: right;
    letter-spacing: -0.01em;
  }

  input.mono,
  input.manual {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
  }

  .form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 14px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
  }

  .form-actions .note {
    font-size: 11.5px;
    color: var(--text-mute);
    max-width: 300px;
  }

  /* сообщение об ошибке — язык форм: ромб = ошибка, квадрат = блокировка */
  .alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    line-height: 1.4;
    padding: 9px 11px;
    border: 1px solid #8a6a26;
    background: var(--amber-soft);
    color: var(--amber);
  }

  .alert::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    margin-top: 4px;
    background: currentColor;
    transform: rotate(45deg);
  }

  .alert-lock {
    border-color: var(--line-strong);
    background: var(--slate-soft);
    color: var(--slate);
  }

  .alert-lock::before { transform: none; }

  .alert .num { color: inherit; }

  /* карточка успеха */
  .success {
    display: flex;
    align-items: center;
    gap: 12px 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border: 1px solid #35674f;
    border-left: 3px solid var(--green);
    background: var(--green-soft);
  }

  .success .msg {
    font-size: 13px;
    color: var(--text);
    min-width: 0;
  }

  .success .msg .num { color: var(--green); }

  .success .spacer { flex: 1 1 auto; }

  /* чип «внимание» — янтарный треугольник */
  .chip-warn {
    --chip-fg: var(--amber);
    --chip-bg: var(--amber-soft);
    --chip-line: #8a6a26;
  }

  .chip-warn::before {
    width: 8px;
    height: 7px;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
  }

  /* ---------- дашборд: карточки разделов ---------- */

  .cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
  }

  .section-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    min-width: 0;
    background: var(--surface);
    color: var(--text-dim);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color .12s linear, background-color .12s linear,
                border-color .12s linear;
    position: relative;
  }

  a.section-card:hover {
    background: var(--surface-2);
    color: var(--text);
    border-left-color: var(--accent);
  }

  .section-card .section-icon { font-size: 18px; line-height: 1.2; }

  .section-card .section-name {
    font-size: 13px;
    font-weight: 650;
    color: var(--text);
  }

  .section-card .section-note {
    font-size: 11.5px;
    color: var(--text-mute);
  }

  .section-card.is-disabled { opacity: 0.55; cursor: not-allowed; }

  .section-card .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 8.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    padding: 2px 4px;
    color: var(--text-mute);
    font-weight: 600;
  }

  /* ---------- дашборд: панель событий ---------- */

  .dash-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    align-items: stretch;
  }

  .dash-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
  }

  .events-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .events {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .event {
    display: grid;
    grid-template-columns: auto 9px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .event:last-child { border-bottom: 0; }
  .event:hover { background: var(--surface-2); }

  .event .t {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--text-dim);
    line-height: 1.5;
    white-space: nowrap;
  }

  .event .shape {
    width: 7px;
    height: 7px;
    flex: none;
    margin-top: 5px;
    background: var(--slate);
  }

  .event .shape.sh-work { background: var(--accent); }
  .event .shape.sh-hold { background: var(--amber); transform: rotate(45deg); }
  .event .shape.sh-done { background: var(--green); border-radius: 50%; }
  .event .shape.sh-neutral { background: var(--slate); }

  .event .txt {
    font-size: 12px;
    color: var(--text-dim);
    min-width: 0;
    overflow-wrap: break-word;
  }

  .event .txt .id {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--text);
    letter-spacing: 0.02em;
  }

  .event .txt .obj { color: var(--text); font-weight: 550; }

  /* ---------- «Новый лид»: раскладка форма + справка ---------- */

  .lead-layout {
    display: grid;
    grid-template-columns: minmax(0, 560px) minmax(0, 300px);
    gap: 16px;
    align-items: start;
  }

  .lead-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .help-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .help-list li {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
  }

  .help-list .n {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-deep);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 10px;
    margin-top: 1px;
  }

  .help-list b { font-weight: 600; color: var(--text); }

  /* ---------- «Новый заказ»: мастер ---------- */

  .wizard {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 640px;
  }

  .stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .step-ind {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-mute);
    white-space: nowrap;
  }

  .step-ind .n {
    width: 22px;
    height: 22px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text-mute);
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
  }

  .step-ind.is-done { color: var(--green); }

  .step-ind.is-done .n {
    border-color: #35674f;
    background: var(--green-soft);
    color: var(--green);
  }

  .step-ind.is-active { color: var(--text); font-weight: 600; }

  .step-ind.is-active .n {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .stepper .arrow { color: var(--text-mute); flex: none; }

  .step-tag {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--accent);
    border: 1px solid var(--accent-deep);
    background: var(--accent-soft);
    padding: 2px 7px;
    white-space: nowrap;
  }

  .stage-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .inline-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
  }

  .inline-row .field { flex: 1 1 240px; }
  .inline-row .btn { flex: none; margin-bottom: 1px; }

  .found-note { font-size: 12px; color: var(--text-dim); }
  .found-note .num { color: var(--text); }

  /* радио-строки выбора клиента */
  .choice {
    display: flex;
    flex-direction: column;
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
  }

  .choice-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    cursor: pointer;
    border-left: 3px solid transparent;
    font-size: 13px;
    color: var(--text-dim);
    transition: color .12s linear, background-color .12s linear;
  }

  .choice-row:hover { color: var(--text); background: var(--surface-3); }

  .choice-row input[type="radio"] {
    width: 14px;
    height: 14px;
    flex: none;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
  }

  .choice-row.is-selected {
    border-left-color: var(--accent);
    background: var(--accent-soft);
    color: var(--text);
  }

  .choice-row .who { min-width: 0; }
  .choice-row .who .tel { color: var(--text-mute); }
  .choice-row.is-selected .who .tel { color: var(--text-dim); }
  .choice-row .who small { display: block; font-size: 11px; color: var(--text-mute); }

  .choice-row .plus {
    width: 16px;
    height: 16px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    color: var(--text-mute);
  }

  .choice-row.is-selected .plus,
  .choice-row:hover .plus { border-color: var(--accent-deep); color: var(--accent); }

  .choice-new-name {
    padding: 10px 12px 12px 39px;
    background: var(--surface-2);
  }

  /* доп. поле, запрошенное CRM */
  .crm-extra {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid #8a6a26;
    border-left: 3px solid var(--amber);
    background: var(--amber-soft);
  }

  .crm-extra .label { color: var(--amber); }

  .crm-extra .why { font-size: 11.5px; color: var(--text-dim); }

  /* ---------- «Приём документов» ---------- */

  .dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 168px;
    padding: 28px 18px;
    text-align: center;
    border: 1.5px dashed var(--line-strong);
    background: var(--surface-2);
    color: var(--text-dim);
    cursor: pointer;
    transition: border-color .12s linear, color .12s linear,
                background-color .12s linear;
  }

  .dropzone:hover,
  .dropzone.is-drag {
    border-color: var(--accent-deep);
    background: var(--accent-soft);
    color: var(--text);
  }

  .dropzone svg { color: var(--text-mute); }
  .dropzone:hover svg { color: var(--accent); }

  .dz-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
  .dz-hint { font-size: 11.5px; color: var(--text-mute); }
  .dropzone input[type="file"] { display: none; }

  /* список выбранных файлов */
  .filelist {
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
  }

  .file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    min-width: 0;
  }

  .file-row:last-child { border-bottom: 0; }
  .file-row:hover { background: var(--surface-2); }
  .file-row > svg { color: var(--text-mute); flex: none; }

  .file-name {
    font-size: 12.5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .file-size {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-mute);
    white-space: nowrap;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
  }

  /* конвейер «как это работает» */
  .flow { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

  .flow-step {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 3px 12px;
    padding: 13px 14px 12px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }

  .flow-step:last-child { border-bottom: 0; }

  .flow-mark {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    margin-top: 1px;
    grid-row: 1 / span 2;
  }

  .flow-mark i {
    display: block;
    width: 9px;
    height: 9px;
    background: currentColor;
  }

  .fm-dot    { color: var(--slate); }
  .fm-square { color: var(--accent); }
  .fm-tri    { color: var(--amber); }
  .fm-tri i  { width: 11px; height: 9px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
  .fm-round  { color: var(--green); }
  .fm-round i { border-radius: 50%; }

  .flow-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 600;
  }

  .flow-title .num { font-size: 11px; color: var(--text-mute); }
  .flow-title .time { font-size: 11px; color: var(--text-mute); font-weight: 500; }

  .flow-desc {
    grid-column: 2;
    font-size: 11.5px;
    color: var(--text-mute);
  }

  /* ---------- «Мои сессии» ---------- */

  .sess-table table { min-width: 760px; }

  .cell-target { font-size: 13px; white-space: nowrap; }
  .cell-target .stock { color: var(--text-dim); }

  td.center, th.center { text-align: center; }

  .btn-sm {
    padding: 4px 10px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  .btn.is-stub {
    cursor: help;
    opacity: 0.75;
  }

  .refresh-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .refresh-note svg { color: var(--text-mute); flex: none; }

  /* ---------- «Финансы» ---------- */

  .actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .actions-row .btn { font-size: 12.5px; padding: 8px 13px; }

  table.table-slim { min-width: 420px; }

  .mbar {
    width: 110px;
    max-width: 100%;
    height: 4px;
    background: var(--surface-3);
    overflow: hidden;
  }
  .mbar i { display: block; height: 100%; background: var(--accent); }

  .share {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--text-mute);
    white-space: nowrap;
  }

  .cell-share {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  /* карточка превью — обязательное подтверждение */
  .confirm {
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--accent);
    background: var(--surface-2);
    padding: 12px 14px 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .confirm .label { color: var(--accent); }

  .confirm-rows {
    margin: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 5px 14px;
    font-size: 12.5px;
  }
  .confirm-rows dt {
    color: var(--text-mute);
    white-space: nowrap;
  }
  .confirm-rows dd {
    margin: 0;
    color: var(--text);
    min-width: 0;
  }
  .confirm-rows dd .num { font-size: 13px; }

  .confirm-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .seg.seg-wrap { flex-wrap: wrap; }
  .seg.seg-wrap label { border-top: 1px solid transparent; }

  .compact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px 16px;
  }
  .compact-grid .wide { grid-column: 1 / -1; }

  /* ---------- «Накладные»: мастер ---------- */

  .wizard-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 940px;
    min-width: 0;
  }

  .wiz {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
  }
  .wiz-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-mute);
    white-space: nowrap;
  }
  .wiz-step .n {
    width: 22px;
    height: 22px;
    flex: none;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 11px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    color: var(--text-dim);
  }
  .wiz-step.is-done { color: var(--text-dim); }
  .wiz-step.is-done .n {
    color: var(--green);
    border-color: #35674f;
    background: var(--green-soft);
  }
  .wiz-step.is-active { color: var(--accent); font-weight: 600; }
  .wiz-step.is-active .n {
    color: var(--accent);
    border-color: var(--accent-deep);
    background: var(--accent-soft);
  }
  .wiz-arrow { color: var(--text-mute); flex: none; }

  .step-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 12px 16px;
    align-items: end;
  }

  /* карточки приходов на выбор */
  .picks {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .pick {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    cursor: pointer;
    min-width: 0;
    transition: border-color .12s linear, background-color .12s linear;
  }
  .pick:hover { border-color: var(--accent-deep); }
  .pick .pick-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .pick .pick-id {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
  }
  .pick .pick-top .spacer { flex: 1 1 auto; }
  .pick .pick-meta {
    font-size: 12px;
    color: var(--text-dim);
  }
  .pick .pick-count {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--text-mute);
  }
  .pick .pick-act { margin-top: 4px; }

  /* таблица состава */
  table.compose { min-width: 520px; }
  .compose input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
  }
  .compose .qty { color: var(--text-mute); }
  .th-check { width: 34px; }

  .price-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
  }
  .price-row .field { flex: 1 1 260px; max-width: 340px; }
  .price-row .btn { flex: none; }

  /* карточка результата */
  .result {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 14px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid #35674f;
    border-left: 3px solid var(--green);
  }
  .result .ric {
    width: 34px;
    height: 34px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid #35674f;
    background: var(--green-soft);
    color: var(--green);
    grid-row: 1 / span 2;
  }
  .result .r-title {
    font-size: 13.5px;
    font-weight: 650;
    color: var(--text);
    min-width: 0;
  }
  .result .r-title .num { font-size: 13px; }
  .result .r-meta {
    grid-column: 2 / 3;
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .result .r-meta .num { color: var(--text); }
  .result .btn { grid-row: 1 / span 2; align-self: center; }

  /* ---------- «Товары» ---------- */

  .goods-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .searchbox {
    position: relative;
    flex: 1 1 320px;
    min-width: 0;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .searchbox svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-mute);
    pointer-events: none;
  }

  .searchbox input[type="search"] {
    padding: 8px 10px 8px 32px;
  }

  .goods-count {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--text-dim);
    border: 1px solid var(--line-strong);
    background: var(--surface-2);
    padding: 6px 10px;
    white-space: nowrap;
  }

  .goods-count b { color: var(--text); font-weight: 650; }

  /* строки-ссылки реестра */
  tr.rowlink { cursor: pointer; }
  tr.rowlink:hover td { background: var(--surface-2); }
  tr.rowlink a {
    color: inherit;
    text-decoration: none;
    display: block;
    margin: -9px -12px;
    padding: 9px 12px;
  }
  tr.rowlink:hover .cell-num a { color: var(--accent); }

  /* форма поиска приходов */
  .receipt-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
  }

  .receipt-form .field { flex: 0 1 260px; }

  .receipt-form input {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
  }

  /* карточки приходов */
  .receipts {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .receipt {
    border: 1px solid var(--line);
    background: var(--surface);
    min-width: 0;
  }

  .receipt-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    border-left: 3px solid var(--green);
  }

  .receipt-head .doc {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
  }

  .receipt-head .dot { color: var(--text-mute); }
  .receipt-head .supplier { font-size: 12.5px; color: var(--text-dim); }

  .receipt-head .qty {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-mute);
    white-space: nowrap;
  }

  .receipt table { min-width: 560px; }

  /* ---------- «Сервисы» ---------- */

  .services-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .service-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
  }

  .service-head .emoji {
    font-size: 20px;
    line-height: 1.2;
    flex: none;
  }

  .service-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.01em;
    color: var(--text);
    text-wrap: balance;
  }

  .service-head .desc {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--text-mute);
  }

  a.panel.service-link { display: block; text-decoration: none; color: inherit; }
  a.panel.service-link:hover { border-color: var(--accent-deep); }
  a.panel.service-link:hover .service-head h3 { color: var(--accent); }

  .service-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
  }

  .form-row .field { flex: 1 1 220px; }
  .form-row .btn { flex: none; }

  /* статусы задачи экспорта */
  .task-states {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .task-state {
    border: 1px solid var(--line);
    border-left: 3px solid var(--state-bar, var(--line-strong));
    background: var(--surface-2);
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
  }

  .task-state.t-queue { --state-bar: var(--amber); }
  .task-state.t-run   { --state-bar: var(--accent); }
  .task-state.t-done  { --state-bar: var(--green); }
  .task-state.t-fail  { --state-bar: #a05a4a; }

  .task-state .st-title {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: var(--text);
  }

  .task-state.t-queue .st-title { color: var(--amber); }
  .task-state.t-run   .st-title { color: var(--accent); }
  .task-state.t-done  .st-title { color: var(--green); }

  .task-state .st-note {
    font-size: 11.5px;
    color: var(--text-dim);
  }

  .task-state .st-note .file { color: var(--text); }

  .progress-line {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--text-mute);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .progress-track {
    flex: 1 1 120px;
    height: 3px;
    background: var(--surface-3);
    min-width: 80px;
  }

  .progress-track i {
    display: block;
    height: 100%;
    background: var(--amber);
  }

  /* мини-мастер telegram */
  .radio-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text);
    border: 1px solid var(--accent-deep);
    background: var(--accent-soft);
    padding: 7px 10px;
    width: fit-content;
    max-width: 100%;
    cursor: pointer;
  }

  .radio-line input[type="radio"],
  .checks input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    margin: 0;
    flex: none;
    cursor: pointer;
  }

  .radio-line .phone {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--text-mute);
  }

  .preview-line {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-left: 2px solid var(--accent);
    padding: 6px 9px;
  }

  .preview-line .pv { color: var(--text-mute); }

  .checks {
    display: flex;
    gap: 8px 14px;
    flex-wrap: wrap;
  }

  .checks label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
  }

  .checks label:hover { color: var(--text); }

  .requests table { min-width: 520px; }

  /* ---------- вход ---------- */

  .login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 40px 16px;
  }

  .login-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--line);
  }

  .login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
  }

  .login-brand .mark {
    width: 26px;
    height: 26px;
    flex: none;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-deep);
    background: var(--accent-soft);
    color: var(--accent);
  }

  .login-brand h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .login-brand .spacer { flex: 1 1 auto; }

  .login-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .login-body .field { gap: 6px; }

  .input {
    font-family: inherit;
    font-size: 13px;
    padding: 8px 10px;
  }

  .input.is-error { border-color: #8a6a26; }

  .btn-block {
    width: 100%;
    justify-content: center;
    padding: 9px 11px;
    font-size: 13px;
  }

  .btn[disabled] {
    color: var(--text-mute);
    background: var(--surface-3);
    border-color: var(--line-strong);
    cursor: not-allowed;
  }

  .btn[disabled]:hover {
    color: var(--text-mute);
    background: var(--surface-3);
    border-color: var(--line-strong);
  }

  .login-note {
    font-size: 11.5px;
    color: var(--text-mute);
    text-align: center;
  }

  .login-foot {
    color: var(--text-mute);
    font-size: 11.5px;
    text-align: center;
  }

  .login-foot .num { color: var(--text-dim); }

  /* ---------- липкие панели действий ---------- */

  .sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  /* ---------- адаптив компонентов ---------- */

  @media (max-width: 1360px) {
    .dash-col .grid-2 { grid-template-columns: minmax(0, 1fr); }
  }

  @media (max-width: 1100px) {
    .dash-layout { grid-template-columns: minmax(0, 1fr); }
    .events-panel { order: 2; }
  }

  @media (max-width: 1080px) {
    .lead-layout { grid-template-columns: minmax(0, 560px); }
    .services-grid { grid-template-columns: minmax(0, 1fr); }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  @media (max-width: 760px) {
    .lead-layout { grid-template-columns: minmax(0, 1fr); }
    .choice-new-name { padding-left: 12px; }
    .compact-grid { grid-template-columns: minmax(0, 1fr); }
    .confirm-rows { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .confirm-rows dt { margin-top: 6px; }
    .mbar { width: 70px; }
    .step-grid { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
    .picks { grid-template-columns: minmax(0, 1fr); }
    .price-row .field { max-width: none; }
    .result { grid-template-columns: auto minmax(0, 1fr); }
    .result .btn { grid-row: auto; grid-column: 2 / 3; justify-self: start; }
    .receipt-form .field { flex: 1 1 100%; }
    .searchbox { max-width: none; }

    /* мобильный UI: зоны нажатия не меньше 44px, ключевые кнопки — липкие */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .rail-item { min-height: 44px; }
    input[type="text"], input[type="tel"], input[type="number"],
    input[type="password"], input[type="search"], select, .input {
      min-height: 44px;
    }
    .seg label { padding: 12px 14px; }
    .choice-row { min-height: 44px; }
    .form-actions .btn-primary,
    .intake-actions .btn-primary {
      position: sticky;
      bottom: 10px;
      z-index: 10;
    }
  }

  @media (max-width: 460px) {
    .cards { grid-template-columns: minmax(0, 1fr); }
  }

  /* товары */

  .page-head .spacer { flex: 1 1 auto; }

  .item-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 760px;
  }

  .item-kv {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
    gap: 6px 18px;
  }

  .item-kv dt {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-mute);
    align-self: baseline;
  }

  .item-kv dd {
    margin: 0;
    font-size: 12.5px;
    color: var(--text-dim);
    overflow-wrap: anywhere;
  }

  .item-prices-ro {
    display: flex;
    gap: 6px 18px;
    flex-wrap: wrap;
    font-size: 11.5px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
  }

  .markups-note {
    max-width: 860px;
    margin: 0;
    font-size: 12.5px;
    color: var(--text-dim);
    border-left: 3px solid var(--accent-deep);
    background: var(--surface);
    padding: 10px 14px;
  }

  .hint-mute { font-size: 11px; color: var(--text-mute); }

  .pct-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
  }

  .pct-row .field { flex: 1 1 120px; }

  .markup-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
  }

  .markup-actions form { display: inline; margin: 0; }

  .btn-del { color: var(--amber); border-color: #8a6a26; }
  .btn-del:hover { color: var(--text); border-color: var(--amber); }

  @media (max-width: 760px) {
    .item-kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .item-kv dt { margin-top: 6px; }
    .markup-actions { flex-direction: column; align-items: stretch; }
    .markup-actions .btn-sm { min-height: 36px; }
  }

  /* дашборд-виджеты */

  .dash-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .dash-widget { min-width: 0; }
  .w-s { grid-column: span 3; }
  .w-m { grid-column: span 6; }
  .w-l { grid-column: span 12; }

  .dash-widget .w-icon { display: inline-flex; color: var(--text-mute); }
  .dash-widget .w-icon svg { display: block; }

  /* КПИ-плитки внутри панели: без двойной рамки */
  .kpis-embedded { border: 0; }

  /* микрополоска доли кассы */
  .cash-bar {
    display: block;
    height: 3px;
    margin-top: 4px;
    background: var(--surface-3);
    max-width: 180px;
  }

  .cash-bar i {
    display: block;
    height: 100%;
    background: var(--accent);
  }

  .intake-shortcut {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .intake-queue { margin: 0; color: var(--text-dim); font-size: 12.5px; }

  .w-error { color: var(--text-mute); }

  /* режим «Настроить»: виджеты перетаскиваются по сетке */
  .w-drag {
    display: none;
    cursor: grab;
    color: var(--text-mute);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    user-select: none;
  }

  .dash-edit .w-drag { display: inline-block; }

  .dash-edit .dash-widget {
    cursor: grab;
    outline: 1px dashed var(--accent-deep);
    outline-offset: 2px;
  }

  .dash-widget.dragging,
  .drawer-item.dragging { opacity: 0.45; }

  /* левая выдвижная панель настройки */
  .drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(9, 12, 16, 0.55);
  }

  .drawer-scrim[hidden] { display: none; }

  .drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 61;
    width: 340px;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line-strong);
    transform: translateX(-102%);
    transition: transform 0.18s ease-out;
    visibility: hidden;
  }

  .drawer.open { transform: translateX(0); visibility: visible; }

  .drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
  }

  .drawer-head h3 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .drawer-head .spacer { flex: 1 1 auto; }

  .drawer-hint {
    margin: 0;
    padding: 10px 14px;
    font-size: 11.5px;
    color: var(--text-mute);
    border-bottom: 1px solid var(--line);
  }

  .drawer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    overflow-y: auto;
  }

  .drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .drawer-item .drag-handle {
    cursor: grab;
    color: var(--text-mute);
    font-size: 14px;
    user-select: none;
    touch-action: none;
  }

  .drawer-check {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    cursor: pointer;
    min-height: 32px;
  }

  .drawer-check input { accent-color: var(--accent); width: 15px; height: 15px; }

  .drawer-move { display: flex; gap: 4px; }
  .drawer-move .btn-sm { padding: 4px 9px; min-width: 32px; justify-content: center; }

  .drawer-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
  }

  /* адаптив: планшет — виджеты в одну колонку пораньше, s — половина */
  @media (max-width: 1100px) {
    .w-m { grid-column: span 12; }
    .w-s { grid-column: span 6; }
  }

  /* мобильный: одна колонка, drawer на весь экран, зоны >= 44px */
  @media (max-width: 760px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .w-s, .w-m, .w-l { grid-column: auto; }
    .drawer { width: 100vw; border-right: 0; }
    .drawer-item { padding: 10px 14px; }
    .drawer-check { min-height: 44px; }
    .drawer-move .btn-sm { min-height: 44px; min-width: 44px; }
    .drawer-foot .btn-primary { min-height: 44px; flex: 1 1 auto; justify-content: center; }
    #dash-configure { min-height: 44px; }
  }

/* ---------- мобильная полировка: вырезы экрана и жесты ---------- */
@supports (padding: env(safe-area-inset-bottom)) {
  /* нижняя полоса навигации и липкие кнопки не лезут под «домашнюю»
     полоску iPhone и жестовую зону Android */
  @media (max-width: 759px) {
    .rail { padding-bottom: env(safe-area-inset-bottom); }
    .content, main { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
    .form-sticky, .sticky-actions {
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    .drawer { padding-bottom: env(safe-area-inset-bottom); }
  }
  .topbar { padding-top: env(safe-area-inset-top); }
}
@media (max-width: 759px) {
  /* прокрутка таблиц и полос — инерционная, с «примагничиванием» */
  .tablewrap, .rail-inner, .chips-scroll {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
  }
  .rail-inner > a { scroll-snap-align: start; }
  /* поля ввода 16px — iOS иначе зумит страницу при фокусе */
  input, select, textarea { font-size: 16px; }
  /* тап не подсвечивается серым прямоугольником */
  a, button, label, .btn { -webkit-tap-highlight-color: transparent; }
}

/* ---------- прогресс обработки сессии ---------- */
.progress-wrap { padding: 14px 16px 4px; }
.progress {
  height: 8px; border-radius: 4px; background: var(--surface-2, #1d242f);
  border: 1px solid var(--border, #232c38); overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent, #4f9dd4), #7bc0ea);
  transition: width .6s ease;
}
/* «дышащая» полоса, пока идёт распознавание — видно, что процесс жив */
.progress-bar.is-live { animation: pulse-bar 1.8s ease-in-out infinite; }
@keyframes pulse-bar { 50% { opacity: .65; } }
.progress-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; font-size: .85rem; color: var(--text-dim, #8b98a5);
}
.progress-meta .spacer { flex: 1 1 auto; }
.progress-meta .pct {
  font-family: ui-monospace, Consolas, monospace;
  font-variant-numeric: tabular-nums; color: var(--text, #e7edf4);
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; animation: none; }
}


/* ---------- кликабельные строки таблиц ---------- */
.rows-clickable tbody tr[data-href] { cursor: pointer; }
.rows-clickable tbody tr[data-href]:hover td {
  background: var(--surface-2, #1d242f);
}
.rows-clickable tbody tr[data-href]:focus-visible {
  outline: 2px solid var(--accent, #4f9dd4); outline-offset: -2px;
}

/* ---------- вкладки раздела ---------- */
.tabs {
  display: flex; gap: 2px; margin: 0 0 14px;
  border-bottom: 1px solid var(--border, #232c38);
}
.tabs .tab {
  padding: 10px 18px; color: var(--text-dim, #8b98a5);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: .95rem; min-height: 44px; display: inline-flex;
  align-items: center;
}
.tabs .tab:hover { color: var(--text, #e7edf4); opacity: 1; }
.tabs .tab.is-active {
  color: var(--text, #e7edf4); font-weight: 600;
  border-bottom-color: var(--accent, #4f9dd4);
}

/* --- Ассистент: чат --- */
.chat { display: flex; flex-direction: column; gap: 8px; padding: 16px;
  max-height: 55vh; overflow-y: auto; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.msg .bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px;
  background: var(--panel-2, rgba(127,127,127,.12));
  border: 1px solid var(--line, rgba(127,127,127,.25));
  white-space: pre-wrap; word-break: break-word; }
.msg.me .bubble { background: var(--accent-soft, rgba(80,160,120,.18));
  border-color: transparent; }
.msg.sys { justify-content: center; }
.msg.sys span { font-size: .78rem; color: var(--muted, #888);
  text-align: center; max-width: 90%; }
.bubble.typing { opacity: .7; font-style: italic; }
.chat-options { display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 16px 8px; }
.chat-files { display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 16px 8px; }
.action-card { margin: 8px 16px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line, rgba(127,127,127,.3));
  display: flex; flex-direction: column; gap: 10px; }
.ac-buttons { display: flex; gap: 8px; margin: 0; }
.inv-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.inv-row { display: flex; align-items: center; gap: 8px; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--line, rgba(127,127,127,.25)); margin: 0; }
.chat-input input[type="text"] { flex: 1; min-width: 0; }
@media (max-width: 560px) { .msg .bubble { max-width: 92%; } }

/* --- Очередь «Ждут проверки»: карточки, mobile-first --- */
.queue-cards { display: grid; gap: 10px; padding: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.qcard { border: 1px solid var(--line, rgba(127,127,127,.3));
  border-radius: 12px; padding: 12px 14px; display: flex;
  flex-direction: column; gap: 6px; }
.qcard-top { display: flex; justify-content: space-between; gap: 8px;
  font-size: .85rem; }
.qcard-src { font-weight: 600; }
.qcard-target { font-size: 1.05rem; font-weight: 600; }
.qcard-go { margin-top: 6px; text-align: center; padding: 10px 12px; }
@media (max-width: 560px) {
  .queue-cards { grid-template-columns: 1fr; padding: 10px; }
  .qcard-go { padding: 13px 12px; font-size: 1rem; } /* палец */
}

/* --- вкладки настроек и пикеры справочника --- */
.tab-pane { animation: none; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
  align-items: center; }
.pick-chip { padding: 3px 10px; font-size: .78rem; border-radius: 999px; }
@media (max-width: 560px) {
  #settings-tabs { overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; }
  #settings-tabs .tab { white-space: nowrap; }
}

/* --- справка --- */
.help-body { line-height: 1.65; }
.help-body ul { margin: 6px 0 12px; padding-left: 1.3em; }
.help-body li { margin-bottom: 5px; }
.help-body p { margin: 8px 0; }

/* ---------- Календарь ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { font-weight: 600; font-size: 16px; min-width: 150px; text-align: center; }
.cal-filter { display: flex; align-items: center; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.cal-wd { background: var(--surface); padding: 6px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); }
.cal-cell { display: flex; flex-direction: column; gap: 3px; min-height: 92px; padding: 6px; background: var(--surface); color: inherit; text-decoration: none; overflow: hidden; }
.cal-cell:hover { background: var(--accent-soft); }
.cal-cell.is-other { opacity: .45; }
.cal-cell.is-weekend .cal-num { color: var(--text-mute); }
.cal-cell.is-today .cal-num { background: var(--accent); color: #fff; }
.cal-num { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 999px; }
.cal-ev { font-size: 11.5px; line-height: 1.25; padding: 2px 5px; border-radius: 4px; background: var(--accent-soft); border-left: 2px solid var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.st-done { opacity: .6; text-decoration: line-through; border-left-color: var(--green); }
.cal-ev.st-cancelled { opacity: .5; border-left-color: var(--text-mute); }
.cal-more { font-size: 11px; color: var(--text-mute); }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-item { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cal-item:last-child { border-bottom: 0; }
.cal-item.st-done .cal-item-title { text-decoration: line-through; opacity: .7; }
.cal-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.cal-item-title { font-weight: 600; }
.cal-meta { font-size: 13px; color: var(--text-mute); }
.cal-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 720px) {
  .cal-cell { min-height: 56px; padding: 4px; }
  .cal-ev { display: none; }
  .cal-cell .cal-more, .cal-cell .cal-ev:first-of-type { display: block; }
  .cal-item { grid-template-columns: 1fr; gap: 6px; }
}
