:root{
      --void:#0a0b0d;
      --surface:#14161b;
      --surface-2:#1b1e24;
      --line:rgba(255,255,255,.08);
      --line-strong:rgba(255,255,255,.16);
      --ink:#eef0f2;
      --ink-dim:#8b909c;
      --ink-faint:#5a5f68;
      --brass:#c3a36e;
      --brass-ink:#1b1509;
      --brass-soft:rgba(195,163,110,.14);
      --blue:#8faccd;
      --amber:#d1975a;
      --sage:#7ab592;
      --rose:#cd7681;
      --r-s:10px;
      --r-m:14px;
      --r-l:22px;
    }
    *{ -webkit-tap-highlight-color: transparent; }
    body{
      background: radial-gradient(1100px 560px at 50% -8%, rgba(195,163,110,.08), transparent 60%), var(--void);
      font-family:'Manrope',-apple-system,BlinkMacSystemFont,sans-serif;
      color:var(--ink);
    }
    .mono{ font-family:'JetBrains Mono',monospace; }
    ::selection{ background: var(--brass-soft); }
    ::-webkit-scrollbar{ width:0; height:0; }
    :focus-visible{ outline:2px solid var(--brass); outline-offset:2px; border-radius:6px; }
    .hide-scrollbar::-webkit-scrollbar{ display:none; }
    .hide-scrollbar{ -ms-overflow-style:none; scrollbar-width:none; }

    .frost{ background: rgba(19,21,26,.88); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border:1px solid var(--line); }
    .panel{ background: var(--surface); border:1px solid var(--line); border-radius: var(--r-m); }
    .panel-flat{ background: rgba(255,255,255,.02); border:1px solid var(--line); border-radius: var(--r-m); }
    .panel-raised{ background: var(--surface-2); border:1px solid var(--line-strong); border-radius: var(--r-l); }
    .divider{ border-top:1px solid var(--line); }
    .plate{ background:#f3f1ec; color:#14130f; border:1px solid #14130f; letter-spacing:.4px; }

    .btn{ display:inline-flex; align-items:center; justify-content:center; gap:.4rem; font-weight:700; border-radius: var(--r-s); transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease; }
    .btn:active{ transform: scale(.96); }
    .btn-primary{ background: var(--brass); color: var(--brass-ink); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset; }
    .btn-primary:hover{ background:#cdae7c; }
    .btn-secondary{ background: var(--surface-2); border:1px solid var(--line-strong); color: var(--ink); }
    .btn-secondary:hover{ background:#22252c; }
    .btn-success{ background: rgba(122,181,146,.15); border:1px solid rgba(122,181,146,.35); color: var(--sage); }
    .icon-btn{ width:2rem; height:2rem; display:inline-flex; align-items:center; justify-content:center; border-radius: var(--r-s); background: rgba(255,255,255,.04); border:1px solid var(--line); color: var(--ink-dim); transition: color .15s, border-color .15s, transform .12s; }
    .icon-btn:hover{ color: var(--ink); border-color: var(--line-strong); }
    .icon-btn:active{ transform: scale(.94); }
    .icon-btn-danger{ color: var(--rose); background: rgba(205,118,129,.08); border-color: rgba(205,118,129,.2); }

    .chip{ padding:.4rem .8rem; border-radius: var(--r-s); font-size:.72rem; font-weight:600; background: rgba(255,255,255,.03); border:1px solid var(--line); color: var(--ink-dim); white-space:nowrap; transition: background .15s, color .15s, border-color .15s; }
    .chip:hover{ color: var(--ink); }
    .chip.is-active{ background: var(--brass-soft); border-color: rgba(195,163,110,.4); color: var(--brass); }
    .nav-btn{ display:flex; flex-direction:column; align-items:center; gap:.25rem; flex:1; color: var(--ink-faint); transition: color .15s; padding:.3rem 0; }
    .nav-btn.is-active{ color: var(--brass); }

    .field-label{ display:block; font-size:.7rem; color: var(--ink-dim); margin-bottom:.35rem; font-weight:600; }
    .field{ width:100%; padding:.65rem .8rem; border-radius: var(--r-s); background: var(--void); border:1px solid var(--line-strong); color: var(--ink); font-size:.8rem; }
    .field::placeholder{ color: var(--ink-faint); }
    .field:focus{ outline:none; border-color: var(--brass); }

    .badge{ display:inline-flex; align-items:center; padding:.2rem .6rem; border-radius:999px; font-size:.62rem; font-weight:700; border:1px solid transparent; white-space:nowrap; }
    .badge-ordered{ background: rgba(143,172,205,.12); color: var(--blue); border-color: rgba(143,172,205,.28); }
    .badge-transit{ background: rgba(209,151,90,.12); color: var(--amber); border-color: rgba(209,151,90,.28); }
    .badge-arrived{ background: rgba(122,181,146,.12); color: var(--sage); border-color: rgba(122,181,146,.28); }
    .badge-issued{ background: rgba(139,144,156,.12); color: var(--ink-dim); border-color: rgba(139,144,156,.28); }
    .badge-tax{ background: rgba(209,151,90,.1); color: var(--amber); border-color: rgba(209,151,90,.24); }

    .badge-urgent{ background: rgba(205,118,129,.15); color: var(--rose); border-color: rgba(205,118,129,.35); animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
    .badge-today{ background: rgba(209,151,90,.18); color: var(--amber); border-color: rgba(209,151,90,.4); }

    .swipe-card{ touch-action: pan-y; transition: transform 0.18s ease-out; position: relative; }
    .empty{ text-align:center; padding:2.4rem 1rem; color: var(--ink-faint); font-size:.75rem; border:1px dashed var(--line-strong); border-radius: var(--r-m); }
    .money{ color: var(--sage); }
  
    /* ===== Карточка авто, документ для клиента, печать ===== */
    .badge-neutral{ background: rgba(139,144,156,.12); color: var(--ink-dim); border-color: rgba(139,144,156,.28); }
    .field{ -webkit-user-select:text; user-select:text; }

    .sheet{ border-radius: var(--r-l) var(--r-l) 0 0; border-bottom:none; max-height:92vh; }
    .vc-row{ display:flex; align-items:flex-start; gap:.75rem; padding:.75rem; border-radius: var(--r-m); border:1px solid var(--line); background: rgba(255,255,255,.02); cursor:pointer; transition: background .15s, border-color .15s; }
    .vc-row.is-selected{ background: var(--brass-soft); border-color: rgba(195,163,110,.4); }

    .doc-toolbar{ position:sticky; top:0; z-index:3; display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.6rem .75rem; padding-top:calc(.6rem + env(safe-area-inset-top)); background: rgba(19,21,26,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom:1px solid var(--line); }

    .app-toast{ position:fixed; left:50%; bottom:6.5rem; transform:translate(-50%,12px); background: var(--surface-2); border:1px solid var(--line-strong); color: var(--ink); padding:.55rem .9rem; border-radius: var(--r-s); font-size:.75rem; font-weight:600; opacity:0; pointer-events:none; transition: opacity .18s, transform .18s; z-index:80; }
    .app-toast.is-on{ opacity:1; transform:translate(-50%,0); }

    /* Лист документа (белая бумага, читается и на телефоне, и на A4) */
    .doc-paper{ background:#fff; color:#15171a; max-width:794px; margin:0 auto; padding:28px 26px 32px; border-radius:6px; font-family:'Manrope',-apple-system,BlinkMacSystemFont,sans-serif; font-size:12px; line-height:1.5; box-shadow:0 10px 40px rgba(0,0,0,.5); -webkit-user-select:text; user-select:text; -webkit-print-color-adjust:exact; print-color-adjust:exact; }
    .doc-paper *{ box-sizing:border-box; }
    .doc-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:16px; flex-wrap:wrap; }
    .doc-accent{ width:30px; height:3px; background:#c3a36e; margin-bottom:9px; }
    .doc-company-name{ font-size:17px; font-weight:800; letter-spacing:-.01em; line-height:1.2; }
    .doc-muted{ color:#6b7079; font-size:11px; }
    .doc-title-block{ text-align:right; }
    .doc-title{ font-size:21px; font-weight:800; letter-spacing:-.015em; line-height:1.15; }
    .doc-docno{ margin-top:4px; font-size:12px; color:#3a3d44; font-weight:600; }
    .doc-rule{ border-top:1.5px solid #15171a; margin:16px 0 14px; }
    .doc-info{ display:grid; grid-template-columns:repeat(6, 1fr); gap:1px; background:#dfe1e5; border:1px solid #dfe1e5; border-radius:4px; overflow:hidden; margin-bottom:20px; }
    .doc-info > div{ background:#fff; padding:8px 11px; min-width:0; }
    .doc-label{ font-size:10px; color:#6b7079; margin-bottom:1px; font-weight:600; letter-spacing:.01em; }
    .doc-val{ font-weight:700; font-size:12.5px; overflow-wrap:anywhere; }
    .doc-val.vin{ letter-spacing:.04em; }
    .doc-table{ width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
    .doc-table th{ background:#f2f3f5; text-align:left; font-size:10px; font-weight:700; color:#4a4f57; padding:8px; white-space:nowrap; border-top:1px solid #dfe1e5; border-bottom:1px solid #dfe1e5; }
    .doc-table td{ padding:9px 8px; border-bottom:1px solid #e9ebee; vertical-align:top; }
    .doc-table tbody tr:last-child td{ border-bottom:1px solid #dfe1e5; }
    .doc-table .c-num{ width:28px; color:#8a8f98; }
    .doc-table th.c-num{ color:#4a4f57; }
    .doc-table .c-art{ width:120px; font-size:11px; color:#4a4f57; overflow-wrap:anywhere; }
    .doc-table .c-qty{ width:48px; text-align:center; }
    .doc-table .c-price{ width:80px; text-align:right; white-space:nowrap; }
    .doc-table .c-sum{ width:90px; text-align:right; white-space:nowrap; font-weight:700; }
    .doc-table th.c-price, .doc-table th.c-sum{ text-align:right; }
    .doc-table th.c-qty{ text-align:center; }
    .doc-table tr{ break-inside:avoid; page-break-inside:avoid; }
    .doc-table thead{ display:table-header-group; }
    .doc-table tr.doc-section td{ background:#fafbfc; font-size:10.5px; font-weight:800; color:#15171a; padding:7px 8px; border-bottom:1px solid #dfe1e5; }
    .doc-sub{ font-size:10.5px; color:#6b7079; margin-top:1px; }
    .doc-sub span{ display:inline-block; margin-right:8px; }
    .doc-sub .sub-art{ display:none; }
    .doc-totals{ margin:14px 0 0 auto; width:min(100%, 290px); font-variant-numeric:tabular-nums; break-inside:avoid; }
    .doc-totals > div{ display:flex; justify-content:space-between; gap:14px; padding:4px 2px; color:#3a3d44; }
    .doc-totals > .doc-total-main{ margin-top:6px; padding:9px 10px; background:#f2f3f5; border-radius:4px; font-size:14px; font-weight:800; color:#15171a; }
    .doc-words{ margin-top:16px; padding-top:12px; border-top:1px solid #e9ebee; font-size:11.5px; color:#3a3d44; }
    .doc-words b{ color:#15171a; font-weight:700; }
    .doc-note{ margin-top:16px; padding:2px 0 2px 11px; border-left:3px solid #c3a36e; white-space:pre-line; }
    .doc-terms{ margin-top:16px; padding-top:10px; border-top:1px solid #e9ebee; color:#6b7079; font-size:10.5px; white-space:pre-line; }
    .doc-sign{ display:flex; gap:32px; margin-top:38px; break-inside:avoid; }
    .doc-sign > div{ flex:1; font-size:10.5px; color:#6b7079; }
    .doc-sign span{ display:block; border-bottom:1px solid #15171a; height:24px; margin-bottom:4px; }
    @media (max-width:520px){
      .doc-paper{ padding:20px 16px 24px; }
      .doc-title-block{ text-align:left; }
      .doc-title{ font-size:19px; }
      .doc-info{ grid-template-columns:repeat(2, 1fr); }
      .doc-info > div{ grid-column:span 1 !important; }
      .doc-info > div.car, .doc-info > div.last-full{ grid-column:span 2 !important; }
      .doc-table th{ font-size:9.5px; padding:7px 3px; }
      .doc-table td{ padding:8px 3px; font-size:11.5px; }
      .doc-table .c-art{ display:none; }
      .doc-table .c-num{ width:18px; }
      .doc-table .c-qty{ width:34px; }
      .doc-table .c-price{ width:56px; }
      .doc-table .c-sum{ width:64px; }
      .doc-sub .sub-art{ display:inline-block; }
    }

    /* Печать: показываем только лист документа */
    @page{ size:A4; margin:14mm; }
    @media print{
      html, body{ background:#fff !important; }
      body{ display:block !important; min-height:0 !important; padding:0 !important; }
      body > *:not(#modal-doc){ display:none !important; }
      #modal-doc{ position:static !important; inset:auto !important; overflow:visible !important; background:#fff !important; }
      .no-print{ display:none !important; }
      #doc-paper-wrap{ padding:0 !important; }
      .doc-paper{ box-shadow:none !important; border-radius:0 !important; padding:0 !important; max-width:none !important; margin:0 !important; }
    }

    /* ===== Заказы: карточки, редактор ===== */
    .oc{ border-left-width:3px; cursor:pointer; }
    .oc-ordered{ border-left-color: var(--blue); }
    .oc-transit{ border-left-color: var(--amber); }
    .oc-arrived{ border-left-color: var(--sage); }
    .oc-late{ border-left-color: var(--rose); }
    .oc-car{ display:inline-flex; align-items:center; gap:.4rem; padding:.2rem .55rem; border-radius: var(--r-s); background: rgba(255,255,255,.04); border:1px solid var(--line); font-size:.7rem; font-weight:700; color: var(--ink); }
    .oc-item{ display:flex; justify-content:space-between; gap:.75rem; font-size:.75rem; padding:.35rem 0; border-top:1px dashed var(--line); }
    .oc-item:first-child{ border-top:none; }

    .ed-item{ background: rgba(255,255,255,.025); border:1px solid var(--line); border-radius: var(--r-m); padding:.75rem; }
    .ed-num{ width:1.5rem; height:1.5rem; display:inline-flex; align-items:center; justify-content:center; border-radius:999px; background: var(--brass-soft); color: var(--brass); font-size:.7rem; font-weight:800; flex-shrink:0; margin-top:.6rem; }
    .ed-stepper{ display:flex; align-items:stretch; border:1px solid var(--line-strong); background: var(--void); border-radius: var(--r-s); overflow:hidden; }
    .ed-stepper button{ width:2.6rem; font-weight:800; font-size:1rem; color: var(--ink-dim); }
    .ed-stepper button:active{ background: rgba(255,255,255,.06); }
    .ed-stepper span, .ed-stepper input{ flex:1; min-width:0; text-align:center; font-family:'JetBrains Mono',monospace; font-weight:700; font-size:.85rem; color: var(--ink); display:flex; align-items:center; justify-content:center; background:transparent; border:none; outline:none; }
    .ed-sug{ display:flex; flex-direction:column; gap:.3rem; }
    .ed-sug-btn{ display:flex; align-items:center; gap:.6rem; width:100%; padding:.45rem .6rem; border:1px dashed var(--line-strong); border-radius: var(--r-s); font-size:.72rem; color: var(--ink); text-align:left; background: rgba(255,255,255,.02); }
    .ed-sug-btn span:first-child{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .ed-pick{ display:flex; align-items:center; gap:.5rem; width:100%; padding:.55rem .7rem; border-radius: var(--r-s); border:1px solid var(--line); background: rgba(255,255,255,.02); text-align:left; font-size:.75rem; color: var(--ink); }
    .ed-pick.is-on{ background: var(--brass-soft); border-color: rgba(195,163,110,.4); }

    .ed-auto{ font-size:.62rem; font-weight:800; padding:.1rem .45rem; border-radius:999px; border:1px solid var(--line-strong); color: var(--brass); background:transparent; }
    .ed-auto.is-on{ background: var(--brass-soft); border-color: rgba(195,163,110,.45); }
    .ed-lbl{ display:flex; align-items:center; justify-content:space-between; min-height:1.5rem; white-space:nowrap; }

    /* ===== АвтоТО: поиск, карточки, фильтры ===== */
    .av-status{ display:inline-flex; align-items:center; gap:.4rem; padding:.3rem .6rem; border-radius:var(--r-s); background: rgba(255,255,255,.04); border:1px solid var(--line); font-size:.65rem; font-weight:700; color:var(--ink-dim); }
    .av-dot{ width:.5rem; height:.5rem; border-radius:999px; background:var(--ink-faint); display:inline-block; flex-shrink:0; }
    .av-dot.ok{ background:var(--sage); box-shadow:0 0 6px var(--sage); }
    .av-dot.warn{ background:var(--amber); }
    .av-dot.bad{ background:var(--rose); }
    .av-hist{ padding:.3rem .6rem; font-size:.68rem; }
    .av-hist.is-pin{ border-color:rgba(195,163,110,.4); color:var(--brass); }
    .icon-btn.is-on{ color:var(--brass); border-color:rgba(195,163,110,.5); background:var(--brass-soft); }

    .av-card{ background: var(--surface); border:1px solid var(--line); border-radius: var(--r-m); padding:.8rem; }
    .av-card.is-cmp{ border-color:rgba(195,163,110,.55); }
    .av-price{ font-weight:800; font-size:1.05rem; color:var(--sage); line-height:1.1; }
    .av-tags{ display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.5rem; }
    .av-tags:empty{ display:none; }
    .av-tag{ display:inline-flex; align-items:center; padding:.12rem .45rem; border-radius:999px; font-size:.6rem; font-weight:700; background: rgba(255,255,255,.05); color:var(--ink-dim); border:1px solid var(--line); white-space:nowrap; }
    .av-tag.ok{ background: rgba(122,181,146,.12); color:var(--sage); border-color: rgba(122,181,146,.3); }
    .av-tag.warn{ background: rgba(209,151,90,.12); color:var(--amber); border-color: rgba(209,151,90,.3); }
    .av-tag.bad{ background: rgba(205,118,129,.12); color:var(--rose); border-color: rgba(205,118,129,.3); }
    .av-tag.best{ background: var(--brass-soft); color:var(--brass); border-color: rgba(195,163,110,.4); }
    .av-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:.35rem .8rem; margin-top:.5rem; font-size:.68rem; color:var(--ink-dim); }
    .av-meta > span{ display:inline-flex; align-items:center; gap:.25rem; }
    .av-rel{ gap:.35rem !important; }
    .av-bar{ display:inline-block; width:2.6rem; height:.32rem; border-radius:999px; background: rgba(255,255,255,.1); overflow:hidden; vertical-align:middle; }
    .av-bar > i{ display:block; height:100%; border-radius:999px; background:var(--ink-dim); }
    .av-bar.g > i{ background:var(--sage); } .av-bar.a > i{ background:var(--amber); } .av-bar.r > i{ background:var(--rose); }
    .av-actions{ display:flex; align-items:center; gap:.4rem; margin-top:.65rem; }
    .av-actions .ed-stepper button{ width:2rem; padding:.5rem 0; }

    .av-group{ background: rgba(255,255,255,.02); border:1px solid var(--line); border-radius: var(--r-m); overflow:hidden; }
    .av-group.is-exact{ border-color:rgba(195,163,110,.3); }
    .av-group-head{ display:flex; align-items:center; justify-content:space-between; gap:.6rem; width:100%; padding:.75rem .8rem; }
    .av-group-body{ padding:0 .55rem .55rem; }
    .av-group-body .av-card{ background: var(--surface-2); }

    .av-skel{ height:.7rem; width:100%; border-radius:6px; margin:0 auto; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.1), rgba(255,255,255,.04)); background-size:200% 100%; animation: avshimmer 1.4s linear infinite; }
    @keyframes avshimmer{ 0%{ background-position:200% 0; } 100%{ background-position:-200% 0; } }

    .av-cmp{ border-collapse:collapse; font-size:.72rem; min-width:100%; }
    .av-cmp th{ text-align:left; color:var(--ink-dim); font-weight:600; padding:.45rem .5rem .45rem 0; white-space:nowrap; position:sticky; left:0; background: var(--surface-2); }
    .av-cmp td{ padding:.45rem .6rem; border-top:1px solid var(--line); color:var(--ink); min-width:6.5rem; }
    .av-cmp tr:first-child td, .av-cmp tr:first-child th{ border-top:none; }
    .av-cmp .best{ color:var(--sage); font-weight:800; }

    .av-hist-bars{ display:flex; align-items:flex-end; gap:.35rem; height:4.6rem; overflow-x:auto; }
    .av-hist-bars > div{ display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:.2rem; min-width:1.6rem; }
    .av-hist-bars i{ display:block; width:1rem; border-radius:4px 4px 0 0; background: var(--brass); }
    .av-hist-bars span{ font-size:.55rem; color:var(--ink-dim); }
    .av-sub{ display:flex; flex-wrap:wrap; gap:.4rem 1rem; margin-top:.6rem; padding-top:.55rem; border-top:1px dashed var(--line); }
    .av-link{ display:inline-flex; align-items:center; gap:.3rem; font-size:.68rem; font-weight:700; color:var(--ink-dim); padding:.15rem 0; }
    .av-link.on{ color:var(--brass); }


.service-visit-line .field{min-width:0;padding:.5rem .45rem;font-size:.68rem}
.service-visit-line .icon-btn{width:2rem;height:2rem}
.auth-gate{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:1rem;background:rgba(8,9,11,.96);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
.auth-gate.hidden{display:none}
.auth-card{width:min(100%,25rem);display:flex;flex-direction:column;gap:.7rem;padding:1.5rem;border:1px solid var(--line-strong);border-radius:22px;background:var(--surface);box-shadow:0 24px 80px rgba(0,0,0,.55)}
.auth-card h1{font-size:1.1rem;font-weight:800;color:var(--ink);margin:0;text-align:center}
.auth-mark{display:grid;place-items:center;width:3rem;height:3rem;margin:0 auto .3rem;border-radius:14px;background:var(--brass);color:var(--brass-ink);font-weight:900;letter-spacing:.05em}
.auth-subtitle,.auth-footnote{margin:0;text-align:center;font-size:.72rem;color:var(--ink-dim)}
.auth-status{font-size:.75rem;color:var(--blue);text-align:center;min-height:1.1rem}
.auth-error{font-size:.75rem;color:var(--rose);text-align:center;min-height:1rem}
.maintenance-line{display:flex;justify-content:space-between;gap:.6rem;padding:.45rem 0;border-top:1px solid var(--line);font-size:.7rem}
