
  :root {
    --ink: #17262b; --muted: #66777c; --line: #dde5e8;
    --accent: #5db5e6; --accent-d: #2f95cf; --bg-input: #eef3fd; --danger: #c0392b;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
  [hidden] { display: none !important; }

  /* ================= вход ================= */
  .wrap { display: grid; grid-template-columns: 1.55fr 1fr; min-height: 100vh; }
  .hero { position: relative; overflow: hidden; color: #fff; padding: 84px 38px 40px;
    background: linear-gradient(140deg, #0b9196 0%, #07505a 36%, #04292f 72%, #021518 100%); }
  .hero svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
  .hero > *:not(svg) { position: relative; z-index: 1; }
  .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 52px; }
  .brand .mark { border: 3px solid #fff; border-radius: 14px; padding: 4px 12px 5px; font-weight: 800; font-size: 26px; letter-spacing: .5px; line-height: 1; }
  .brand .name { font-size: 22px; font-weight: 300; letter-spacing: .5px; }
  .hero h1 { font-size: 26px; font-weight: 400; line-height: 1.3; margin: 0 0 30px; max-width: 560px; }
  .hero ul { list-style: none; padding: 0; margin: 0; max-width: 560px; }
  .hero li { display: flex; align-items: center; gap: 14px; font-size: 18px; margin: 0 0 20px; }
  .hero li svg { flex: none; width: 22px; height: 22px; }
  .hero .title { font-size: 44px; font-weight: 300; letter-spacing: .5px; line-height: 1.15; }
  .panel { padding: 190px 40px 40px; }
  .panel-inner { width: 100%; max-width: 480px; }
  h2 { font-size: 26px; margin: 0 0 18px; font-weight: 700; }

  label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
  .field { margin-bottom: 20px; position: relative; }
  input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], select {
    width: 100%; height: 42px; padding: 0 12px; font-size: 15px; color: var(--ink);
    border: 1px solid #b9c3c7; border-radius: 3px; background: var(--bg-input); outline: none; font-family: inherit;
  }
  select { padding-right: 8px; }
  input:focus, select:focus { border-color: var(--accent-d); box-shadow: 0 0 0 2px rgba(47,149,207,.18); background: #fff; }
  input[disabled], select[disabled] { background: #eef1f2; color: #6c7b80; cursor: not-allowed; }
  .eye { position: absolute; right: 8px; top: 7px; width: 28px; height: 28px; border: 0; background: transparent; cursor: pointer; color: #6c7b80; padding: 0; }
  .eye svg { width: 20px; height: 20px; }
  .field.has-eye input { padding-right: 42px; }

  .actions { display: flex; align-items: center; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
  button.go { height: 44px; padding: 0 28px; border: 0; border-radius: 2px; cursor: pointer; background: var(--accent); color: #fff;
    font-weight: 700; letter-spacing: .6px; font-size: 14px; box-shadow: 0 2px 4px rgba(0,0,0,.18); font-family: inherit; min-width: 130px; font-size: 20px; }
  button.go:hover { background: var(--accent-d); }
  button.go[disabled] { opacity: .65; cursor: default; }
  button.link { color: var(--accent-d); background: none; border: 0; padding: 0; font: inherit; font-size: 14px; cursor: pointer; }
  button.link:hover { text-decoration: underline; }

  .msg { margin-top: 18px; padding: 12px 14px; border-radius: 3px; font-size: 14px; display: none; }
  .msg.err { display: block; background: #fdeceb; color: #9c2a22; border: 1px solid #f4c7c3; }
  .msg.info { display: block; background: #eef6fb; color: #1d5878; border: 1px solid #cfe5f3; }
  .msg.ok { display: block; background: #e6f5ea; color: #1d6e3a; border: 1px solid #c3e5cd; }

  .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 8px; }
  .spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--accent-d); }
  @keyframes spin { to { transform: rotate(360deg); } }


  /* вход: карточка по центру */
  .wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: #e6ebee; }
  .card { width: 100%; max-width: 560px; background: #fff; border-radius: 10px; box-shadow: 0 6px 28px rgba(30,50,60,.16); padding: 84px 48px 56px; }
  .wordmark { text-align: center; font-size: 34px; font-weight: 600; letter-spacing: .4px; color: #2f3f49; margin: 0 0 64px; }
  .card input[type=text], .card input[type=password] { height: 46px; border-radius: 8px; border: 1px solid #8e9da3; background: #fff; font-size: 17px; padding: 0 16px; }
  .card input::placeholder { color: #6c7b80; }
  .card input:focus { border-color: #0f6cbf; box-shadow: 0 0 0 3px rgba(15,108,191,.18); }
  .card .eye { top: 9px; right: 10px; }
  .card button.go { background: #0f6cbf; border-radius: 8px; height: 46px; min-width: 0; padding: 0 28px; font-size: 17px; font-weight: 400; letter-spacing: 0; box-shadow: none; }
  .card button.go:hover { background: #0c5a9f; }
  @media (max-width: 600px) { .card { padding: 56px 22px 40px; } .wordmark { font-size: 28px; margin-bottom: 44px; } }

  /* ================= кабинет ================= */
  #app { min-height: 100vh; background: #f4f7f8; }
  #bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 100; transition: width .4s ease, opacity .3s; opacity: 0; }
  #bar.run { opacity: 1; width: 78%; transition: width 6s cubic-bezier(.1,.7,.3,1); }
  #bar.done { opacity: 0; width: 100%; transition: width .2s, opacity .4s .2s; }

  .topbar { color: #fff; background: linear-gradient(120deg, #0b9196 0%, #07505a 55%, #04292f 100%); }
  .topbar-in { max-width: 1280px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  .topbar .brand { margin: 0; gap: 12px; }
  .topbar .brand .mark { font-size: 18px; border-width: 2px; border-radius: 10px; padding: 3px 9px 4px; }
  .topbar .brand .name { font-size: 20px; }
  .topbar .profile { margin-left: auto; position: relative; }
  .topbar .profile-btn { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: #fff; cursor: pointer; font-family: inherit; }
  .topbar .profile-btn:hover, .topbar .profile-btn[aria-expanded="true"] { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
  .topbar .profile-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .topbar .avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.45); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; letter-spacing: .5px; flex: none; }
  .topbar .profile-btn .chev { width: 16px; height: 16px; opacity: .8; transition: transform .2s; }
  .topbar .profile-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .profile-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(4,41,47,.22); padding: 6px; z-index: 60; }
  .profile-menu .pm-head { padding: 10px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; line-height: 1.35; }
  .profile-menu .pm-head b { display: block; font-size: 14px; }
  .profile-menu .pm-head span { font-size: 12.5px; color: var(--muted); }
  .profile-menu .pm-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 5px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
  .profile-menu .pm-item:hover, .profile-menu .pm-item:focus-visible { background: #eef6fa; outline: none; }
  .profile-menu .pm-out { color: var(--danger); }
  @media (max-width: 560px) { .topbar .profile-btn .who { display: none; } }
  .topbar .who { text-align: left; line-height: 1.25; }
  .topbar .who b { display: block; font-size: 15px; font-weight: 600; }
  .topbar .who span { font-size: 12px; opacity: .85; }
  .topbar .tb-btn { color: #fff; border: 1px solid rgba(255,255,255,.55); background: transparent; border-radius: 3px; padding: 8px 14px; font-size: 13px; cursor: pointer; font-family: inherit; }
  .topbar .tb-btn:hover { background: rgba(255,255,255,.14); }

  .content { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
  .tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
  .tab { padding: 10px 18px; border: 0; background: none; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; font-family: inherit; }
  .tab.on { color: var(--ink); border-bottom-color: var(--accent-d); }

  .toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
  .toolbar .search { flex: 1 1 300px; }
  .toolbar input[type=search] { background: #fff; height: 44px; }
  .btn2 { height: 44px; padding: 0 16px; background: #fff; border: 1px solid #b9c3c7; border-radius: 3px; cursor: pointer; font-size: 13.5px; color: var(--ink); font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
  .btn2:hover { border-color: var(--accent-d); color: var(--accent-d); }
  .btn2.danger { color: var(--danger); border-color: #e4b4ae; }
  .btn2.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
  button.go.danger { background: var(--danger); }
  button.go.danger:hover { background: #a03024; }
  .selbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: -4px 0 12px; background: #fdf3f1; border: 1px solid #f0cfc9; border-radius: 6px; font-size: 14px; }
  .selbar span { font-weight: 600; margin-right: auto; }
  .selbar .btn2 { height: 36px; }
  td.sel, th.sel { width: 34px; padding-right: 0; }
  .sel input, .order-sel input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent-d); }
  .order-sel { display: flex; align-items: center; padding-left: 18px; }
  tr.picked td { background: #fff6f4; }
  .btn2.primary { background: var(--accent-d); border-color: var(--accent-d); color: #fff; font-weight: 600; }
  .btn2.primary:hover { background: #2380b5; color: #fff; }
  .btn2[disabled] { opacity: .6; cursor: default; }

  .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--ink); }
  .chip b { font-weight: 700; }
  .chip.on { background: #e1f1fb; border-color: var(--accent-d); }
  .stat { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

  .order { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; overflow: hidden; }
  .order.flash { animation: flash 1.6s ease; }
  @keyframes flash { 0% { box-shadow: 0 0 0 3px rgba(93,181,230,.7); } 100% { box-shadow: 0 0 0 0 rgba(93,181,230,0); } }
  .order-top { display: flex; align-items: center; }
  .order-h { flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; background: #fff; border: 0; cursor: pointer; text-align: left; font-family: inherit; color: var(--ink); }
  .order-h:hover { background: #f8fbfc; }
  .order-h .no { font-weight: 700; font-size: 16px; min-width: 140px; }
  .order-h .meta { color: var(--muted); font-size: 13.5px; }
  .order-h .dealer { font-size: 13.5px; font-weight: 600; }
  .order-h .badges { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
  .order-h .chev { width: 18px; height: 18px; flex: none; transition: transform .2s; color: var(--muted); }
  .order.open .chev { transform: rotate(180deg); }
  .order-add { margin: 0 12px 0 0; flex: none; }
  .order-b { display: none; padding: 0 18px 12px; border-top: 1px solid var(--line); overflow-x: auto; }
  .order.open .order-b { display: block; }

  table { width: 100%; border-collapse: collapse; font-size: 14px; }
  thead th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
  tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr.cancelled td:not(.act) { opacity: .55; }
  td.num, th.num { text-align: right; }
  td.art { font-family: Consolas, "Courier New", monospace; font-size: 14px; white-space: nowrap; }
  td.act { width: 44px; text-align: right; }
  .dim { color: var(--muted); }
  .iconbtn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; color: #4b5a5f; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
  .iconbtn:hover { border-color: var(--accent-d); color: var(--accent-d); background: #f3fafe; }
  .iconbtn svg { width: 17px; height: 17px; }

  .badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
  .b-done  { background: #d6f0df; color: #14602f; }
  .b-ok    { background: #e1f3e6; color: #1d6e3a; }
  .b-info  { background: #dcecfa; color: #17588a; }
  .b-svh   { background: #ebe3f7; color: #55338c; }
  .b-recv  { background: #d9f1f0; color: #0f6e6e; }
  .b-trans { background: #fde9d2; color: #8a4a0b; }
  .b-pick  { background: #fff3cc; color: #7a5a00; }
  .b-wait  { background: #e8edef; color: #4b5a5f; }
  .b-bad   { background: #fbdcda; color: #9c2a22; }

  .empty { text-align: center; color: var(--muted); padding: 50px 10px; background: #fff; border: 1px dashed var(--line); border-radius: 6px; }
  .more { text-align: center; margin: 16px 0; }
  .foot { margin-top: 24px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
  .box { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }

  /* ================= окна ================= */
  .modal-bg { position: fixed; inset: 0; background: rgba(8,24,28,.55); display: flex; align-items: flex-start; justify-content: center; padding: 30px 16px; z-index: 60; overflow-y: auto; }
  .modal { background: #fff; border-radius: 6px; width: 100%; max-width: 560px; padding: 24px 26px 22px; box-shadow: 0 18px 50px rgba(0,0,0,.35); margin: auto; }
  .modal.wide { max-width: 860px; }
  .modal h3 { margin: 0 0 4px; font-size: 20px; }
  .modal .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .ro { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 12px 14px; background: #f3f8f9; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 16px; font-size: 13.5px; }
  .ro span { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; display: block; }
  .hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
  .chk { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; margin: 4px 0 16px; cursor: pointer; }
  .chk input { width: 18px; height: 18px; }
  .sect { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
  .nline { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px 4px; margin-bottom: 12px; background: #fafcfc; position: relative; }
  .nline .rm { position: absolute; top: 8px; right: 8px; }
  .nline .grid3 { display: grid; grid-template-columns: 1.3fr 1.3fr .7fr 1fr; gap: 0 12px; }
  .modal .btns { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }

  /* ================= уведомления ================= */
  #toasts { position: fixed; right: 18px; bottom: 78px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(380px, calc(100vw - 36px)); }
  .toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: 6px; color: #fff; font-size: 14px; line-height: 1.4; box-shadow: 0 6px 22px rgba(0,0,0,.25); animation: tin .25s ease; }
  .toast.ok { background: #1d7a46; }
  .toast.err { background: #b3372c; }
  .toast.info { background: #2a6f93; }
  .toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
  @keyframes tin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  @media (max-width: 900px) {
    .wrap { grid-template-columns: 1fr; }
    .hero { padding: 26px 22px 24px; }
    .brand { margin-bottom: 14px; }
    .hero .title { font-size: 28px; }
    .hero ul { display: none; }
    .panel { padding: 28px 20px 36px; }
    .topbar .who { margin-left: 0; text-align: left; width: 100%; order: 3; }
    .content { padding: 14px 12px 50px; }
    .order-h .badges { margin-left: 0; }
    .order-b { padding: 0 12px 10px; overflow: visible; }
    .grid2, .nline .grid3 { grid-template-columns: 1fr; }
    table, thead, tbody, tr, td { display: block; }
    thead { display: none; }
    tbody tr { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; margin: 10px 0; }
    tbody td { border: 0 !important; padding: 5px 0; display: flex; justify-content: space-between; gap: 16px; text-align: right; align-items: center; }
    tbody td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; text-align: left; flex: none; }
    td.act { width: auto; }
    td.act::before { content: ''; }
  }

  .order-b > .sub { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
  .order-b h3 { margin: 0; font-size: 18px; }
  h3.sect { margin: 22px 0 10px; }

  /* ================= локальные заказы, вкладка загрузок ================= */

  /* единые кнопки действий */
  .abtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 6px;
         border: 1px solid var(--accent-d); background: var(--accent-d); color: #fff; font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer;
         text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
  .abtn:hover { background: #2581b6; border-color: #2581b6; }
  .abtn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(47,149,207,.3); }
  .abtn[disabled] { opacity: .55; cursor: default; }
  .abtn.abtn-ghost { background: #fff; color: var(--accent-d); }
  .abtn.abtn-ghost:hover { background: #eef7fd; }
  .abtn-ic { display: inline-flex; } .abtn-ic svg { width: 17px; height: 17px; }
  .abtn .spinner { width: 14px; height: 14px; }
  .imp-count { margin-left: 2px; padding: 2px 8px; border-radius: 999px; background: #e1f1fb; color: var(--accent-d); font-size: 12px; font-weight: 600; }
  .file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

  /* вкладка загрузок */
  .imp-grid { display: grid; gap: 14px; }
  .imp-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
  .imp-head { display: flex; align-items: center; gap: 16px; }
  .imp-ic { flex: none; width: 44px; height: 44px; border-radius: 10px; background: #e8f4fb; color: var(--accent-d); display: inline-flex; align-items: center; justify-content: center; }
  .imp-ic svg { width: 22px; height: 22px; }
  .imp-title { flex: 1; min-width: 0; }
  .imp-title h3 { margin: 0; font-size: 16.5px; font-weight: 600; line-height: 1.35; }
  .imp-title h3 .tip { margin-left: 8px; vertical-align: -3px; }
  .imp-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
  .imp-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .imp-out:not(:empty), .days-panel { margin-top: 14px; }
  .imp-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
  .days-table { max-width: 560px; }
  .imp-card input.days { width: 90px; height: 34px; text-align: right; }

  /* «!» с всплывающим описанием */
  .tip { position: relative; display: inline-flex; }
  .tip-btn { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--accent-d); background: #fff; color: var(--accent-d);
             font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
  .tip-btn:hover, .tip.open .tip-btn { background: var(--accent-d); color: #fff; }
  .tip-pop { display: none; position: absolute; left: 50%; top: calc(100% + 10px); transform: translateX(-50%); z-index: 30; width: 360px; max-width: 80vw;
             background: #1f2d33; color: #fff; font-size: 13px; font-weight: 400; line-height: 1.5; padding: 12px 14px; border-radius: 8px;
             box-shadow: 0 8px 24px rgba(0,0,0,.18); white-space: pre-line; text-align: left; }
  .tip-pop::before { content: ''; position: absolute; top: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: #1f2d33; }
  .tip:hover .tip-pop, .tip.open .tip-pop, .tip-btn:focus-visible + .tip-pop { display: block; }
  @media (max-width: 720px) {
    .imp-head { flex-wrap: wrap; }
    .imp-acts { width: 100%; justify-content: stretch; }
    .imp-acts .abtn { flex: 1; }
    .tip-pop { left: auto; right: -40px; transform: none; width: 280px; }
    .tip-pop::before { left: auto; right: 44px; }
  }
  td.note { max-width: 260px; white-space: normal; font-size: 13px; }
  td.act { white-space: nowrap; }
  td.act .iconbtn + .iconbtn { margin-left: 6px; }

  /* ================= движение заказа ================= */
  .order-top > .order-tl { flex: none; margin-right: 10px; }
  td.st-cell { white-space: nowrap; }
  .iconbtn.tl-mini { width: 26px; height: 26px; margin-left: 6px; vertical-align: middle; border-color: transparent; color: var(--muted); }
  .iconbtn.tl-mini:hover { border-color: var(--line); }
  .iconbtn.tl-mini svg { width: 15px; height: 15px; }
  .tl-line { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
  .tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
  .tl-head .art { font-family: Consolas, "Courier New", monospace; font-size: 14.5px; }
  .tl-head .badge { margin-left: auto; }
  ol.tl { list-style: none; margin: 0; padding: 0; }
  .tl-step { position: relative; display: flex; gap: 12px; padding: 0 0 14px; }
  .tl-step:last-child { padding-bottom: 0; }
  .tl-step::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
  .tl-step:last-child::before { display: none; }
  .tl-step.done::before { background: #7cc79a; }
  .tl-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 2px; border: 2px solid #b9c3c7; background: #fff; position: relative; z-index: 1; }
  .tl-step.done .tl-dot { background: #2e9e5b; border-color: #2e9e5b; }
  .tl-step.current .tl-dot { background: #fff; border-color: var(--accent-d); box-shadow: 0 0 0 4px rgba(47,149,207,.18); }
  .tl-step.bad .tl-dot { background: var(--danger); border-color: var(--danger); }
  .tl-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-width: 0; }
  .tl-title { font-size: 14px; }
  .tl-step.todo .tl-title { color: var(--muted); }
  .tl-step.current .tl-title { font-weight: 700; }
  .tl-step.bad .tl-title { color: var(--danger); font-weight: 700; }
  .tl-date { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .tl-date.plan { color: var(--muted); font-style: italic; }
  .tl-hint { flex-basis: 100%; font-size: 12.5px; color: var(--muted); }
  .tl-wait { padding: 30px 10px; }

  /* официальное название ДЦ + маркетинговое мелко */
  .order-h .dealer .brand { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
  td .brand { font-size: 12px; color: var(--muted); }
  .tl-name { font-size: 13.5px; color: var(--ink); margin: 0 0 12px; }
  .tl-head { margin-bottom: 8px; }

  /* поле пароля с «глазиком» в окнах */
  .pw-wrap { position: relative; }
  .pw-wrap input { padding-right: 44px; }
  .pw-wrap .eye { top: 50%; right: 8px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; }
  .pw-wrap .eye:hover { color: var(--accent-d); }
  .pw-wrap .eye:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 1px; }

  /* сортировка инвойсов по клику на заголовок */
  .th-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
  .th-sort:hover, .th-sort.on { color: var(--ink); }
  .th-sort:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; border-radius: 2px; }
  .th-arr { font-size: 10px; opacity: .45; }
  .th-sort.on .th-arr { opacity: 1; color: var(--accent-d); }
  th.num .th-sort { flex-direction: row-reverse; }

  /* ================= товары из Китая: позиции дилеров, состав инвойса, распределение ================= */
  .b-unpaid { background: #fbe3ec; color: #8e2350; }
  td .warn { color: var(--danger); font-size: 12px; }
  .b-paid { background: #dff3ea; color: #1a6a45; }
  td.pname { min-width: 180px; max-width: 360px; white-space: normal; font-size: 13px; line-height: 1.35; }
  td.dealer-cell { min-width: 170px; font-size: 13.5px; font-weight: 600; }
  td.dealer-cell .brand { display: block; font-weight: 400; }
  .cn-body { display: block; border-top: 0; }
  .toolbar select.tsel { width: auto; min-width: 150px; height: 40px; }
  td.free { color: #1a6a45; font-weight: 700; }
  .modal.xwide { max-width: 1180px; }
  .inv-bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
  .inv-sum { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 13.5px; color: var(--muted); }
  .inv-sum b { color: var(--ink); font-size: 15px; }
  .inv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .inv-tools input[type=search] { width: 220px; height: 40px; }
  .inv-tools select { width: auto; height: 40px; }
  .inv-items { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
  .items-table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
  td.dcs { min-width: 150px; white-space: normal; }
  td.hintc { color: var(--muted); font-size: 12.5px; }
  .dc-tag { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 999px; background: #e1f1fb; color: #17588a; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
  .dc-tag.locked { background: #dff3ea; color: #1a6a45; }
  .dc-tag.locked::after { content: ' ✓'; }
  .alloc-rows { display: grid; gap: 8px; margin: 14px 0 10px; }
  .alloc-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 90px minmax(120px, 1fr) auto; gap: 8px; align-items: center; }
  .alloc-row input, .alloc-row select { height: 38px; }
  .alloc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
  .alloc-tools .chip[disabled] { opacity: .45; cursor: default; }
  .alloc-sum { font-size: 13.5px; color: var(--muted); margin: 6px 0 4px; }
  .alloc-sum.over { color: var(--danger); font-weight: 700; }
  ul.sum-list { margin: 8px 0 0 18px; line-height: 1.7; }
  @media (max-width: 720px) {
    .alloc-row { grid-template-columns: 1fr 80px; }
    .alloc-row input[type=text] { grid-column: 1 / -1; }
    .inv-tools input[type=search] { width: 100%; }
  }

  .b-cn { background: #fde8d7; color: #9a3d07; }
  /* фильтры по столбцам (как в Excel) */
  .colf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
  .colf-lbl { font-size: 13px; color: var(--muted); }
  .colf-btn { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
  .colf-btn:hover { border-color: #9aa7b4; }
  .colf-btn.on { border-color: #2a7ab8; background: #e8f2fa; color: #17588a; font-weight: 600; }
  .colf-reset { font-size: 13.5px; }
  .colf { position: absolute; z-index: 60; width: 320px; max-width: calc(100vw - 16px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(16, 32, 48, .16); padding: 10px; }
  .colf input[type=search] { width: 100%; height: 36px; margin-bottom: 6px; }
  .colf-list { max-height: 280px; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0 10px; }
  .colf-item { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 13.5px; cursor: pointer; }
  .colf-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .colf-item input { width: auto; height: auto; margin: 0; }
  .colf-all { font-weight: 600; }
  .colf-n { color: var(--muted); font-weight: 400; font-size: 12.5px; }
  .colf-btns { display: flex; gap: 12px; align-items: center; }
  /* фильтр в заголовке столбца (как в Excel) */
  .th-f { display: inline-flex; align-items: center; gap: 6px; }
  .th-fbtn { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid #b9c3cd; border-radius: 3px; background: #fff; color: #4b5866; cursor: pointer; flex: none; }
  .th-fbtn svg { width: 11px; height: 11px; }
  .th-fbtn:hover { border-color: #2a7ab8; color: #2a7ab8; }
  .th-fbtn.on { border-color: #2a7ab8; background: #2a7ab8; color: #fff; }
  .colf-bar { display: none !important; }
  @media (max-width: 720px) { .colf-bar:not([hidden]) { display: flex !important; } }
  .to-top { position: fixed; right: 22px; bottom: 22px; z-index: 70; width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
            display: flex; align-items: center; justify-content: center; background: var(--accent-d); color: #fff; box-shadow: 0 6px 18px rgba(4,41,47,.28);
            transition: transform .15s ease, opacity .2s ease; }
  .to-top[hidden] { display: none; }
  .to-top svg { width: 22px; height: 22px; }
  .to-top:hover { transform: translateY(-2px); }
  .to-top:focus-visible { outline: 3px solid #fff; outline-offset: -6px; }
  @media print { .to-top { display: none; } }
  button.link.st-next { display: block; margin-top: 4px; padding: 0; font-size: 12px; white-space: normal; text-align: left; color: var(--accent-d); }
  .tl-line > button.link.st-next { margin: 6px 0 0 26px; font-size: 13px; }
