/* Plate orders list (views/orders) and the global search overlay. */

.vsep { width: 1px; height: 26px; background: var(--field); margin: 0 4px; }
.orders-head .btn-primary { height: 38px; }
.datebar { display: flex; align-items: center; gap: 8px; }
.datebtn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--field); background: #fff; white-space: nowrap; font-size: 14px; cursor: pointer;
}
.datebtn b { font-weight: 600; }
.datebtn:hover { background: var(--sunk); }
.seg > a { color: var(--ink); }
.seg > a.on, .seg > button.on { background: var(--ink); color: #fff; }

.orders-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-selects { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-selects .select { max-width: 190px; }
.totals { color: var(--muted); white-space: nowrap; }
.totals b { font-weight: 600; }

/* table */
.orders-table .plate, .order-cards .plate { max-width: 100%; }
.orders-table .plate-real, .order-cards .plate-real, .clients-table .plate-real { max-width: 100%; }
/* Номер в списке читают глазами, поэтому он крупнее обычного: однострочный занимает ширину колонки,
   а двухстрочный (мото, американские, мини) ещё выше — иначе надпись на нём выходила по 9 пикселей. */
.orders-table .plate-real { height: 34px; font-size: 34px; }
.orders-table .plate-real.two { height: 54px; font-size: 54px; }
.order-cards .plate-real { height: 40px; font-size: 40px; }
.order-cards .plate-real.two { height: 58px; font-size: 58px; }
/* Длинная подпись («AI JA 7710 MOTO», «448-DVD AMEP W») ужималась до 5 пикселей, чтобы влезть в знак —
   номер в списке становился нечитаемым. Держим читаемый минимум, лишнее прячем многоточием: искомый
   номер стоит в начале, а хвост про тип знака и так виден в колонке рядом. */
.orders-table .plate-real .pt, .order-cards .plate-real .pt { min-width: 0; }
.orders-table .plate-real .pt span, .order-cards .plate-real .pt span {
  font-size: max(12px, min(.62em, calc(var(--ar, 4.5) * 1.55em / var(--chars))));
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
/* У двухстрочных знаков нижней границы нет: надпись подбирается по бланку и никогда не обрезается,
   а если номер длинный, он и так вынесен наружу (plate_cell). */
.orders-table .plate-real.two .pt span, .order-cards .plate-real.two .pt span {
  font-size: min(.4em, calc(var(--ar, 1.3) * 1.5em / var(--chars)));
  overflow: visible; text-overflow: clip;
}
.orders-table .plate .t, .order-cards .plate .t { overflow: hidden; text-overflow: ellipsis; display: block; line-height: 20px; }
.orders-table .plate.moto .t.two, .order-cards .plate.moto .t.two { display: flex; }
.orders-table { position: relative; }
.orders-table .dt td { height: 40px; }
.orders-table .dt tbody tr { cursor: pointer; }
.tp { display: flex; align-items: center; min-width: 0; gap: 6px; }
.tp .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qty { flex: none; color: var(--muted); }
.more { flex: none; font-size: 12px; color: var(--blue); white-space: nowrap; }
.sum { font-weight: 500; }
.pay { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cbx { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; vertical-align: middle; }

.bulkbar {
  position: sticky; bottom: 16px; margin: 0 auto 16px; width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 12px; background: var(--ink); color: #fff;
  box-shadow: 0 8px 24px rgba(28, 35, 43, .28); font-size: 13px; z-index: 5;
}
.bulkbar .select.dark { background-color: #33404D; color: #fff; border-color: #33404D; background-image: 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='%23fff' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.bulkbar .btn { height: 32px; }
.icon-btn.dark { background: transparent; border-color: transparent; color: var(--rail-text); width: 32px; height: 32px; }

/* calendar */
.cal-pop { position: absolute; z-index: 40; top: 64px; left: 250px; }
.orders-page { position: relative; }
.cal-body { min-width: 300px; }
.cal-wrap { display: flex; }
.presets { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-right: 1px solid var(--line-soft); width: 190px; }
.presets a, .presets button {
  display: flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 8px; font-size: 14px; color: var(--ink);
  background: none; border: 0; text-align: left; cursor: pointer;
}
.presets a:hover, .presets button:hover { background: var(--sunk); }
.presets .on { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.presets button { color: var(--blue); font-weight: 500; }
.presets .sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.cal-main { padding: 12px 14px 14px; width: 400px; display: flex; flex-direction: column; gap: 10px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; }
.cal-nav .icon-btn { width: 32px; height: 32px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-grid .wd { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; }
.cd { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 48px; border-radius: 9px; gap: 1px; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-soft); }
.cd b { font-size: 15px; font-weight: 600; }
.cd i { font-style: normal; font-size: 11px; color: var(--muted); }
a.cd:hover { background: var(--sunk); color: var(--ink); }
.cd.we b { color: #8A949E; }
.cd.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cd.on { background: var(--ink); box-shadow: none; }
.cd.on b, .cd.on i { color: #fff; }
.cd.future { box-shadow: none; }
.cd.future b { color: #C5CCD3; }
.range-form { display: flex; align-items: flex-end; gap: 8px; }
.range-form .input { height: 38px; }
.cal-hint { font-size: 12px; }

/* phone */
.daystrip-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; }
.daystrip-head .btn-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.days { display: flex; gap: 2px; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 7px; border-radius: 12px; color: var(--ink); }
.day .w, .day .c { font-size: 11px; color: var(--muted); }
.day .d { font-size: 17px; font-weight: 600; }
.day.on { background: var(--ink); color: #fff; }
.day.on .w, .day.on .c { color: var(--rail-text); }
.day.off { color: #AEB8C2; pointer-events: none; }
.order-cards { display: flex; flex-direction: column; background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.ocard { display: flex; flex-direction: column; gap: 6px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.ocard-top, .ocard-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ocard-top .grow { flex: 1; }
.ocard-bottom { font-size: 13px; }
.ocard-bottom .ell { flex: 1; min-width: 0; }
.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 25; height: 56px; padding: 0 20px 0 16px;
  border-radius: 28px; background: var(--blue); color: #fff; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 87, 184, .35);
}
.fab:hover { color: #fff; background: var(--blue-dark); }

@media (max-width: 760px) {
  .orders-page { padding-bottom: calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)); }
  .orders-filters { gap: 8px; }
  .orders-filters .tabs { width: 100%; }
  .filter-selects { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
  .filter-selects > *, .filter-selects .kzs { flex: none; }   /* строка прокручивается вбок: сжимать фильтры нельзя */
  .filter-selects .select { flex: none; }
  .cal-pop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; border-radius: 16px 16px 0 0; z-index: 55; padding-bottom: env(safe-area-inset-bottom); max-height: 85vh; overflow: auto; }
  .cal-wrap { flex-direction: column; }
  .presets { width: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); flex-direction: row; flex-wrap: wrap; }
  .presets a, .presets button { height: 34px; }
  .presets .sep { display: none; }
  .cal-main { width: auto; }
}

/* global search */
.search-layer .scrim { z-index: 60; }
.search-layer .search-pop { z-index: 61; }
.search-in svg { color: var(--blue); }
.search-results .sr { text-decoration: none; }
.search-results .grow { flex: 1; min-width: 0; }
.search-results .carrier {
  width: 30px; height: 24px; border-radius: 5px; background: #EEF0F2; color: var(--ink-2); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.search-empty { padding: 22px 18px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) {
  .search-pop { top: 0; left: 0; right: 0; transform: none; width: 100vw; border-radius: 0 0 14px 14px; }
}

/* type filter and column settings */
.type-filter { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-selects .chip { height: 34px; }
.cols-menu { position: relative; }
.cols-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 240px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; z-index: 30; }
.cols-pop b { margin-bottom: 6px; }
.cols-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.cols-actions .btn { height: 34px; }
.range-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }

/* quick edit: plate number and pencil open the order form */
.plate-edit { display: inline-flex; border-radius: 4px; }
.plate-edit:hover .plate { box-shadow: 0 0 0 3px var(--blue-soft), 0 0 0 4px var(--blue); }
.ghost-edit { width: 32px; height: 32px; border-color: transparent; background: none; color: var(--muted); }
.ghost-edit:hover { background: var(--blue-soft); color: var(--blue); }
.ocard { cursor: pointer; }
.type-menu { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.type-menu .chip-x { width: 30px; height: 30px; border-color: transparent; background: none; }
.goods-pop.type-pop { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); width: min(860px, 94vw); z-index: 40; }
@media (max-width: 760px) { .goods-pop.type-pop { top: 12px; } }
.gp-all .gp-img { color: var(--blue); }

/* phone: compact date row instead of the days strip */
.phone-datebar { display: flex; align-items: center; gap: 6px; }
.phone-datebar .datebtn { flex: 1; min-width: 0; justify-content: center; height: 40px; }
.phone-datebar .icon-btn { width: 40px; height: 40px; flex: none; }
@media (max-width: 760px) {
  .filter-selects > .kzs, .filter-selects > .type-menu, .filter-selects > select { flex: none; }
  .filter-selects .kzs-btn.select { width: auto; min-width: 130px; max-width: 170px; }
  .orders-page { gap: 8px; }
}

/* Order card: the text a manager sends the client (number, quantity, waybill, address). */
.client-copy { display: flex; gap: 10px; align-items: stretch; padding: 0 16px 14px; }
.client-copy-text { flex: 1; min-width: 0; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; line-height: 1.4; background: var(--sunk); color: var(--ink); }
.client-copy .btn { align-self: flex-start; white-space: nowrap; }
@media (max-width: 760px) { .client-copy { flex-direction: column; } .client-copy .btn { align-self: stretch; justify-content: center; } }
.files-panel .files-body { padding: 0 16px 14px; }

/* Quick payment: a button on each search result, the sheet (views/orders/_pay.php) */
.search-results .sr-row { display: flex; align-items: center; }
.search-results .sr-row .sr { flex: 1; min-width: 0; }
.search-results .sr-row:hover .sr { background: var(--blue-soft); }
.search-results .sr-pay { flex: none; margin: 0 12px 0 -6px; }
.op-order { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.op-plate { font-family: var(--font-plate); font-size: 20px; letter-spacing: .04em; }
.op-sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); }
.op-sums > span { display: flex; flex-direction: column; min-width: 0; }
.op-sums b { font-size: 16px; }
.op-sums .ok-ink { color: var(--ok-ink); }
.op-bills { display: flex; flex-wrap: wrap; gap: 6px; }
.op-bills .chip { height: 36px; font-size: 14px; }
@media (max-width: 760px) {
  .search-results .sr-pay { margin-right: 8px; width: 40px; height: 40px; padding: 0; justify-content: center; }
}
.op-pays { list-style: none; margin: -4px 0 0; padding: 0 12px; font-size: 13px; }
.op-pays li { display: flex; gap: 10px; align-items: center; min-height: 26px; }
.op-pays .grow { flex: 1; min-width: 0; }
.op-checks { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }

/* Search by all orders: next to "Новый заказ", not at the far right edge of a wide monitor. */
.orders-head .search-open { height: 38px; gap: 8px; padding: 0 12px 0 11px; color: var(--ink-2); }
.orders-head .search-open .kbd { margin-left: 4px; }
@media (max-width: 760px) { .orders-head .search-open { margin-left: auto; width: 38px; padding: 0; justify-content: center; } }

/* Orders that need a look come first and stand out: problems (error, rework) red, waiting amber. */
.dt tr.row-problem td { background: #FDECEC; }
.dt tr.row-problem td:first-child { box-shadow: inset 4px 0 0 var(--alert); }
.dt tr.row-waiting td { background: #FFF6DC; }
.dt tr.row-waiting td:first-child { box-shadow: inset 4px 0 0 var(--signal); }
.dt tr.row-problem:hover td { background: #FADCDC; }
.dt tr.row-waiting:hover td { background: #FCEEC4; }
.ocard.row-problem { background: #FDECEC; box-shadow: inset 4px 0 0 var(--alert); }
.ocard.row-waiting { background: #FFF6DC; box-shadow: inset 4px 0 0 var(--signal); }

/* Номер рядом с бланком: длинный или двухстрочный внутрь бланка читаемо не помещается (helpers.php,
   plate_cell). Бланк остаётся картинкой, а номер пишется обычным шрифтом и виден целиком. */
.plate-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.plate-cell .plate-real { flex: none; }
.plate-quiet .pt { display: none; }
.plate-label { font-family: var(--font-plate); font-weight: 600; font-size: 16px; letter-spacing: .02em; line-height: 1.1; }
.order-cards .plate-label { font-size: 18px; }
@media (max-width: 760px) { .plate-cell { gap: 6px; } }
