/* Plate order form (views/orders/form.php) and order card (views/orders/show.php). */

.small { font-size: 12px; }
.center { text-align: center; }
.warn { color: var(--warn-ink); }
.ok { color: var(--ok-ink); }
.note-warn { background: #FFF6D6; color: #4A3B00; }
.note .grow, .note-info .grow { flex: 1; }
.note { align-items: center; }

.tog {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border-radius: 17px; border: 1px solid var(--field);
  background: #fff; font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; line-height: 1.2;
}
.tog:hover { background: var(--sunk); }
.tog.on { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-ink); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; cursor: pointer; }
.btn.dashed { border-style: dashed; }
.icon-btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.icon-btn.ghost:hover { background: var(--alert-soft); color: var(--alert); }
.seg.full { display: flex; width: 100%; height: 42px; }
.seg.full > * { flex: 1; justify-content: center; }
.small-seg { height: 34px; width: max-content; }

/* ---------- layout ---------- */
.of-page { padding-bottom: 32px; }
.of-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.of-head h1 { font-size: 22px; }
.of-head .grow { flex: 1; }
.of-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.of-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.of-aside { position: sticky; top: 12px; }

.of-sec { overflow: visible; }
.of-sh {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 18px; border: 0; border-bottom: 1px solid #E3E8ED;
  background: none; text-align: left; cursor: default; border-radius: var(--radius) var(--radius) 0 0;
}
.of-sh h2 { font-size: 16px; }
.of-st { flex: 1; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.of-st > .muted { font-size: 13px; }
.of-ok { width: 20px; height: 20px; border-radius: 10px; background: var(--ok); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.of-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 761px) {
  .of-body { display: flex !important; }
  .of-sh .of-st > .muted.show-phone { display: none; }
}

.of-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.of-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.of-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.of-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.of-row .wide2 { grid-column: span 2; }
.of-row.addr3 { grid-template-columns: minmax(0, 1fr) 90px 80px; }
.of-stack { display: flex; flex-direction: column; gap: 12px; }
.client-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; }
.town-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.town-row .addr3 { grid-column: span 1; }
.cod-row { align-items: end; }
.cod-hint { display: flex; flex-direction: column; font-size: 12px; padding-bottom: 4px; }
/* Наложенный платёж, который CRM поставила сама: видно, что это не менеджер (задача владельца 19.09.2026). */
.field.cod-auto .input { background: #F1F8F3; border-color: #9CCBA9; }
.cod-auto-note { color: #2F7A46; }

.field em.ferr { font-style: normal; font-size: 12px; color: var(--alert); min-height: 0; }
.field em.ferr:empty { display: none; }
.has-err .input, .has-err.dtypes .tog { border-color: var(--alert); }
.input:disabled { background: var(--sunk); color: var(--muted); }
.input.filled::placeholder { color: var(--ink); opacity: 1; }
select.input { appearance: none; padding-right: 30px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C232B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
.input-ico { position: relative; display: flex; align-items: center; }
.input-ico > svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-ico .input { padding-left: 36px; }
.input-ico .input::placeholder { color: var(--ink); font-weight: 500; }
.input-tag { position: absolute; right: 10px; font-size: 12px; color: var(--muted); pointer-events: none; }
.input-suffix { position: relative; display: flex; }
.input-suffix i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); }
.input-suffix .input { padding-right: 30px; }

/* combobox */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; max-height: 320px; overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop);
}
.combo-list.wide { min-width: min(460px, 90vw); }
.combo-list button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: 7px; text-align: left; cursor: pointer; font-size: 14px; color: var(--ink);
}
.combo-list button:hover, .combo-list button:focus { background: var(--blue-soft); outline: none; }
.combo-list button b { font-weight: 500; }
.combo-list .muted { font-size: 12px; max-width: 100%; }
.combo-h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px 4px; }

.chips-info { display: flex; gap: 8px; }
.info-chip { flex: 1; min-width: 0; padding: 6px 12px; border-radius: 8px; background: var(--sunk); display: flex; flex-direction: column; }
.info-chip span { font-size: 12px; color: var(--muted); }
.info-chip b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-chip.good { background: var(--ok-soft); }
.info-chip.good b { color: var(--ok-ink); }
.info-chip.bad { background: var(--alert-soft); }
.info-chip.bad b { color: var(--alert-ink); }
.info-chip.warn { background: var(--signal-soft); }
.saved-addr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- plate lines ---------- */
.plates-body { padding-top: 4px; gap: 0; }
.pl-line { display: block; padding: 14px 0; border-bottom: 1px solid #E3E8ED; }
.pl-line.locked .pl-fields { opacity: .85; }
/* Подсказка типа знака: вопрос базы знаний и варианты, цена на каждой кнопке (задача 0013). */
.pl-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 8px; }
.pl-suggest .muted { font-size: 13px; }
.pl-suggest-opt { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 4px 9px; border: 1px solid #D7DEE5; border-radius: 8px; background: #fff; font-size: 13px; cursor: pointer; }
.pl-suggest-opt:hover { border-color: #2F6FE4; }
.pl-suggest-opt.on { border-color: #2F6FE4; background: #EDF3FE; }
.pl-suggest-opt b { white-space: nowrap; }
.pl-suggest-hide { border: 0; background: none; color: #7C8B99; font-size: 13px; cursor: pointer; padding: 4px 6px; }
.pl-suggest-hide:hover { color: #2F6FE4; }
.pl-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pl-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.pick { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.pick img { width: 48px; height: 28px; object-fit: contain; border-radius: 3px; flex: none; }
.pick .grow { flex: 1; }
.plate-input { font-family: var(--font-plate); font-weight: 600; font-size: 21px; letter-spacing: .05em; text-transform: uppercase; }
.plate-input::placeholder { color: #B8C1CA; text-transform: none; }
.pl-grid .stepper { height: 42px; }
.pl-grid .stepper button { width: 38px; display: flex; align-items: center; justify-content: center; }
.pl-grid .stepper input { width: 46px; }
.stepper.disabled { opacity: .5; pointer-events: none; }
textarea.input.note-in { min-height: 42px; height: 42px; padding-top: 10px; resize: none; overflow: hidden; line-height: 1.35; }
.acc-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acc-row .tog { min-height: 32px; padding: 3px 10px 3px 6px; }
.acc-row .tog img { width: 26px; height: 20px; object-fit: contain; }
.acc-row .add-acc { padding-left: 10px; color: var(--blue); border-style: dashed; }
.acc-pop {
  position: absolute; z-index: 25; top: calc(100% + 4px); left: 0; width: min(520px, 92vw); background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column;
}
.acc-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; }
.acc-pop-head .icon-btn { border-color: transparent; }
.acc-list { max-height: 420px; overflow: auto; padding: 0 8px; }
.acc-it { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.acc-it.on { background: var(--blue-soft); }
.acc-name { font-size: 14px; }
.acc-qty { height: 32px; }
.acc-qty > * { padding: 0 10px; }
.acc-pop-foot { display: flex; justify-content: flex-end; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.gp-img { width: 56px; height: 36px; display: flex; align-items: center; justify-content: center; flex: none; }
.gp-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dup-warn { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: #FFF6D6; color: #4A3B00; font-size: 13px; }
.pl-add { padding: 12px 0 2px; display: flex; align-items: center; gap: 12px; }
.pl-add .grow { flex: 1; }
.group-total { font-size: 14px; color: var(--muted); }
.group-total b { color: var(--ink); font-size: 17px; margin-left: 6px; }

/* plate preview on the goods' empty plate (goods.bg_path) */
.plate-bg { position: relative; width: 100%; max-width: 240px; container-type: size; }
.plate-bg.square { max-width: 150px; }
.plate-bg > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.plate-bg .pt {
  position: absolute; inset: 0 3% 0 3%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-plate); font-weight: 600; line-height: .95; white-space: nowrap; letter-spacing: .02em;
}
.plate-bg.band .pt { left: 11%; }
.plate-bg .pt span { font-size: min(64cqh, calc(170cqw / var(--chars))); }
.plate-bg.two .pt { inset: 8% 5% 6% 5%; gap: 2%; }
.plate-bg.two.band .pt span:first-child { padding-left: 20%; }
.plate-bg.two .pt span { font-size: min(40cqh, calc(150cqw / var(--chars))); }
.plate-bg.ghost .pt { opacity: .35; }

/* plate type picker: categories + goods with their pictures */
.goods-pop {
  position: absolute; z-index: 25; top: calc(100% + 4px); left: 0; width: min(760px, 92vw); background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-pop); display: flex; flex-direction: column; overflow: hidden;
}
.gp-head { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line-soft); }
.gp-head .grow { flex: 1; }
.gp-head .icon-btn { border-color: transparent; }
.gp-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); height: min(460px, 60vh); }
.gp-body:has(.gp-cats[style*="display: none"]) { grid-template-columns: minmax(0, 1fr); }
.gp-cats { overflow: auto; padding: 6px; border-right: 1px solid var(--line-soft); background: #FAFBFC; }
.gp-cats button {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: 7px; text-align: left; cursor: pointer; font-size: 13.5px; color: var(--ink);
}
.gp-cats button i { font-style: normal; font-size: 12px; color: var(--muted); }
.gp-cats button:hover { background: var(--sunk); }
.gp-cats button.on { background: var(--ink); color: #fff; }
.gp-cats button.on i { color: var(--rail-text); }
.gp-items { overflow: auto; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; align-content: start; }
.gp-it {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; border: 1px solid var(--line-soft); background: #fff;
  border-radius: 9px; cursor: pointer; color: var(--ink); text-align: center;
}
.gp-it .gp-img { width: 100%; height: 56px; }
.gp-it:hover { border-color: var(--blue); background: var(--blue-soft); }
.gp-it.on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--blue-soft); }
.gp-name { font-size: 12.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gp-empty { padding: 16px; grid-column: 1 / -1; }

.bill-list { padding: 6px; }
.bill-list .input { height: 36px; margin-bottom: 4px; }
.bill-list button.sel { background: var(--ink); color: #fff; }
.ttn-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px; align-items: end; }

/* ---------- delivery ---------- */
.dtypes { display: flex; gap: 6px; flex-wrap: wrap; }
.ttn-box { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--sunk); }
.ttn-flags { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ttn-flags .grow { flex: 1; }
.ttn-done { display: flex; align-items: center; gap: 8px; color: var(--ok-ink); }

.status-seg { margin-bottom: 6px; }
/* Status and urgency: one quiet line above delivery. */
.prod-strip { padding: 8px 12px; }
.ps-line { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.ps-label { font-size: 12px; color: var(--muted); }
.ps-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.ps-seg > template { display: none; }
.ps-seg button { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 0; border-right: 1px solid var(--line-soft); background: none;
  font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.ps-seg button:last-child { border-right: 0; }
.ps-seg button:hover { background: var(--sunk); }
.ps-seg button svg { color: var(--muted); }
.ps-seg button.on { background: var(--ink); color: #fff; font-weight: 600; }
.ps-seg button.on svg { color: currentColor; }
.ps-group { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.ps-seg.ps-urg { border: 0; overflow: visible; background: none; flex-wrap: wrap; gap: 4px; }
.ps-urg button { border: 1px solid var(--line); border-radius: 8px; height: 28px; padding: 0 8px; }
.ps-urg button:last-child { border-right: 1px solid var(--line); }
.ps-urg button.on { border-color: var(--ink); }
.ps-urg button.on.hot { background: var(--signal-soft); color: var(--signal-ink); border-color: var(--signal); }
.ps-seg.has-err { border-color: var(--alert); }
.ps-done { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.ps-done .input { height: 30px; font-size: 13px; padding: 0 8px; width: 190px; }
.ps-bell { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.ps-bell:hover { border-color: var(--blue); color: var(--ink); }
.ps-bell.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-ink); font-weight: 600; }
.ps-more { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.ps-more:hover, .ps-more.on { background: var(--sunk); color: var(--ink); }
.prod-strip > .ferr { display: block; margin-top: 4px; }
.ps-extra { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
@media (max-width: 760px) {
  .ps-line .grow { display: none; }
  .ps-urg { flex-wrap: wrap; }
  .ps-urg button span { font-size: 12px; }
}
.of-title-link { color: inherit; border-bottom: 1px dashed var(--line); }
.of-title-link:hover { color: var(--blue); border-bottom-color: var(--blue); }
.more-status { max-width: 100%; width: max-content; }

/* ---------- summary ---------- */
.sum-body { gap: 10px; }
.sum-lines { display: flex; flex-direction: column; }
.sum-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.sum-line .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sum-line .from-order { color: var(--ink-2); }
.price-in { width: 110px; height: 34px; text-align: right; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px; }
.sum-total span { font-weight: 600; font-size: 16px; }
.sum-total b { font-size: 28px; font-weight: 600; }
.sum-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.sum-meta .btn-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.pay-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--sunk); }
.pay-box .btn-link { align-self: flex-start; }
.sum-rest { display: flex; justify-content: space-between; }

.of-bar { display: none; }

@media (max-width: 1100px) {
  .of-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .pl-line { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  /* One column: payment comes before delivery, because cash on delivery is counted from what is already paid. */
  .of-grid { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .of-grid > *, .of-main > * { min-width: 0; }
  .of-main { display: contents; }
  .of-plates { order: 1; }
  .of-client { order: 2; }
  .prod-strip { order: 3; }
  .of-aside { position: static; order: 4; }
  .of-delivery { order: 5; }
}
@media (max-width: 760px) {
  .of-page { padding-bottom: calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)); }
  .of-head h1 { font-size: 18px; }
  .of-sh { cursor: pointer; min-height: 60px; border-bottom: 0; }
  .of-sec.open .of-sh { border-bottom: 1px solid #E3E8ED; }
  .of-st { flex-direction: column; align-items: flex-start; gap: 1px; }
  .of-sec.open .of-chev svg { transform: rotate(180deg); }
  .of-body { padding: 12px 14px 14px; }
  .of-row.two, .of-row.three, .of-row.four, .client-row, .town-row, .prod-row { grid-template-columns: minmax(0, 1fr); }
  .of-row .wide2 { grid-column: auto; }
  .of-row.addr3 { grid-template-columns: minmax(0, 1fr) 72px 64px; }
  .pl-grid { grid-template-columns: minmax(0, 1fr) auto; }
  .pl-grid > .combo { grid-column: 1 / -1; }
    .pl-line { gap: 10px; }
  .acc-pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)); width: auto; z-index: 40; }
  .acc-list { max-height: 55vh; }
  .acc-it { grid-template-columns: 44px minmax(0, 1fr); }
  .acc-it .acc-qty { grid-column: 1 / -1; justify-self: start; }
  .ttn-row { grid-template-columns: minmax(0, 1fr); }
  .input { height: 46px; font-size: 16px; }
  .dtypes { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
  .goods-pop { position: fixed; left: 8px; right: 8px; top: 12px; width: auto; z-index: 40; }
  .gp-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - 180px); }
  .gp-cats { display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); padding: 8px; }
  .gp-cats button { width: auto; flex: none; white-space: nowrap; border: 1px solid var(--field); border-radius: 17px; padding: 6px 12px; background: #fff; }
  .gp-cats button .ell { overflow: visible; }
  .gp-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .of-bar {
    display: flex; align-items: center; gap: 14px; position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 29;
    background: #fff; border-top: 1px solid var(--line); padding: 10px 14px;
  }
  body:has(.of-bar) .toasts { bottom: calc(var(--tabbar-h) + 88px + env(safe-area-inset-bottom)); }
  .of-bar-sum { display: flex; flex-direction: column; line-height: 1.2; }
  .of-bar-sum b { font-size: 21px; font-weight: 600; }
  .of-bar .grow { flex: 1; }
}

/* ---------- order card ---------- */
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.card-main, .card-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.plates-list { display: flex; flex-direction: column; }
.pl-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.pl-row:last-child { border-bottom: 0; }
.pl-row.deleted { opacity: .5; }
.pl-row .plate { max-width: 260px; }
.pl-row .plate .t { overflow: hidden; text-overflow: ellipsis; }
.pl-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.pl-info b { font-weight: 500; }
.pl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; padding: 14px 16px; }
.kv > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv > div.wide { grid-column: 1 / -1; }
.kv span { font-size: 12px; color: var(--muted); }
.kv b { font-weight: 500; overflow-wrap: anywhere; }
.kv .parcel-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.money-box { padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 4px; }
.money-box .line { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.money-box .line.big { font-size: 16px; font-weight: 600; padding: 6px 0; border-top: 1px solid var(--line-soft); margin-top: 4px; }
.pay-row { display: flex; gap: 10px; font-size: 13px; padding: 4px 0; border-top: 1px dashed var(--line-soft); }
.pay-row .grow { flex: 1; min-width: 0; }
.files { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px; }
.files .thumb { width: 100%; height: 72px; }
.files .thumb.file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--ink-2); padding: 4px; cursor: pointer; }
.history { list-style: none; margin: 0; padding: 6px 16px 12px; }
.history li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.history li:last-child { border-bottom: 0; }
.history .grow { flex: 1; min-width: 0; }
.effect-fail { align-items: center; }
.effect-fail .grow { flex: 1; }
@media (max-width: 900px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pl-row .pl-plate { grid-column: 1 / -1; }
  .history li { flex-wrap: wrap; }
}
.pl-note { font-size: 13px; color: var(--ink-2); background: #FFF6D6; border-radius: 6px; padding: 2px 8px; align-self: flex-start; }
.of-files { margin-top: 12px; }

/* "Добавить к заказу": orders of the client that can still take more plates */
.attach-box { border: 1px solid #BFD4EE; background: var(--blue-soft); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.attach-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--blue-ink); }
.attach-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; background: #fff; border-radius: 8px; padding: 6px 8px; }
.attach-plate { font-family: var(--font-plate); font-weight: 600; font-size: 18px; letter-spacing: .03em; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 6px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-info { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 760px) {
  .attach-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .attach-info { grid-column: 1 / -1; order: 3; }
}

/* order source: a quiet little button, most orders never get one */
.src-pick { position: relative; align-self: start; }
.src-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 13px;
  border: 1px dashed var(--field); background: none; color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.src-btn:hover { border-color: var(--blue); color: var(--blue); }
.src-btn.set { border-style: solid; border-color: var(--field); background: #fff; color: var(--ink); }
.src-pop {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 180px; padding: 6px;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop);
}
.src-opt { display: block; width: 100%; padding: 6px 10px; border: 0; background: none; border-radius: 6px; text-align: left; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.src-opt:hover { background: var(--sunk); }
.src-opt.on { font-weight: 600; background: var(--blue-soft); }
.src-opt.muted { color: var(--muted); }

/* Accessories and the plate's tools share one line (the big preview is gone). */
.pl-foot { display: flex; align-items: flex-start; gap: 10px; }
.pl-foot > .acc-row { flex: 1; min-width: 0; }
.pl-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.pl-tools .muted { margin-right: 6px; font-size: 13px; }
.pl-tool { width: 34px; height: 34px; color: var(--muted); }
.pl-tool:hover { color: var(--blue); background: var(--blue-soft); }
.pl-tool.pl-del:hover { color: var(--alert); background: var(--alert-soft); }
.fio-name-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fio-add { font-size: 12px; font-weight: 500; }
.np-org-row { align-items: start; }

/* «Вставити дані клієнта» */
.paste-report { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); font-size: 13px; }
.paste-conflict { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; color: var(--signal-ink); }
.paste-choice { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.paste-choice .tog { height: auto; min-height: 30px; padding: 4px 10px; text-align: left; white-space: normal; }
.paste-warn { margin: 0; padding-left: 18px; color: var(--signal-ink); }
.paste-extra b { font-weight: 600; }
.field.paste-filled .input { background: #F1F8F3; }
.field.paste-low .input { background: var(--signal-soft); box-shadow: inset 0 0 0 1px var(--signal); }
.field.paste-unverified .input, .field.paste-unverified select.input { background: #FFF3F0; box-shadow: inset 0 0 0 1px var(--alert); }
.paste-head { display: flex; align-items: baseline; gap: 8px; }
.paste-head .grow { flex: 1; }

/* Fiscal receipt in the order card: link, picture download / share. */
.receipt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.receipt-line b a { display: inline-flex; align-items: center; gap: 4px; }
.receipt-tools { display: inline-flex; gap: 6px; }
.receipt-tools .btn { min-height: 32px; padding: 4px 10px; font-size: 13px; }
/* Waybill label viewer in the order card. */
.ttn-open { font: inherit; display: inline-flex; align-items: center; gap: 4px; }
dialog.ttn-sheet { max-width: min(760px, calc(100vw - 24px)); }
.ttn-sheet .panel-head { gap: 8px; }
.ttn-sheet .panel-head h2 { flex: 1; }
.ttn-frame { position: relative; height: min(78vh, 900px); background: var(--sunk); }
.ttn-frame > span { position: absolute; inset: 0; display: grid; place-items: center; z-index: 0; }
.ttn-frame iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; background: transparent; }
.receipt-sheet .panel-head { gap: 8px; }
.receipt-sheet .panel-head h2 { flex: 1; }
.receipt-img { max-height: 78vh; overflow: auto; padding: 12px 16px 16px; text-align: center; background: var(--sunk); }
.receipt-img img { max-width: min(100%, 420px); background: #fff; box-shadow: 0 2px 10px rgba(28, 35, 43, .12); }

/* A price in the order summary: a click edits it. */
.price-click { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; font: inherit; color: inherit; cursor: text; border-bottom: 1px dashed var(--line); }
.price-click:hover { background: var(--sunk); border-bottom-color: var(--blue); }
.sum-total .price-total { font-size: 28px; font-weight: 600; }

/* A ready waybill (a dealer's own): whose Nova Poshta account it is in */
.ttn-owner { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ttn-owner .ttn-sender { max-width: 360px; }
.ttn-owner .ferr { display: block; font-size: 12px; color: var(--alert); }

/* Plate number mask on/off (config/plate_masks.php) */
.mask-toggle { margin-left: 6px; padding: 0 6px; height: 18px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; vertical-align: 1px; }
.mask-toggle:hover { border-color: var(--blue); color: var(--blue-ink); }
.mask-toggle.off { border-style: dashed; }

/* «Получатель» and «Доставку платит»: two short pickers side by side, on the phone too — they are
   almost never changed, and two rows of buttons pushed the waybill off the screen. */
.of-row.np-who-row { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
@media (max-width: 760px) {
  .of-row.np-who-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
