/* GO BIKE CRM · centered operational dialogs and automatic SKU hint */

.catalog-drawer-layer,
.stock-drawer-layer,
.ops-drawer-layer,
.purchase-drawer-layer {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.catalog-drawer-layer .catalog-drawer,
.stock-drawer-layer .stock-drawer,
.ops-drawer-layer .ops-drawer,
.purchase-drawer-layer .purchase-drawer {
  width: min(680px, calc(100vw - 40px));
  height: auto;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  animation: catalogModalIn .24s cubic-bezier(.2,.7,.2,1);
}

.catalog-drawer form,
.stock-drawer form,
.ops-drawer form,
.purchase-drawer form {
  height: auto;
  max-height: calc(100dvh - 40px);
}

.ops-drawer-layer .ops-drawer,
.purchase-drawer-layer .purchase-drawer {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}

.ops-drawer-layer .ops-detail-body,
.purchase-drawer-layer .purchase-detail-body {
  min-height: 0;
}

.catalog-form,
.catalog-detail-body,
.stock-transfer-form,
.stock-balance-body {
  min-height: 0;
}

.works-page .works-drawer-body {
  min-height: 0;
}

.drawer.repair-order-create-dialog {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: min(760px, calc(100vw - 40px)) !important;
  max-width: none !important;
  height: auto !important;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 10px)) scale(.98) !important;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2,.7,.2,1);
}

.drawer.repair-order-create-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1) !important;
  animation: repairOrderModalIn .24s cubic-bezier(.2,.7,.2,1) !important;
}

.repair-order-create-dialog > form {
  min-height: 0;
  max-height: calc(100dvh - 40px);
}

.repair-order-create-dialog .drawer-head {
  flex-shrink: 0;
}

.repair-order-create-dialog .drawer-body {
  min-height: 0;
  padding: 18px 20px 22px;
}

.repair-order-create-dialog .drawer-foot {
  flex-shrink: 0;
  justify-content: flex-end;
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--bg-soft));
}

.drawer.repair-order-fullscreen:not(.repair-order-create-dialog) {
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  width: min(1440px, calc(100vw - 28px)) !important;
  max-width: none !important;
  height: min(920px, calc(100dvh - 28px)) !important;
  max-height: calc(100dvh - 28px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 10px)) scale(.98) !important;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2,.7,.2,1);
}

.drawer.repair-order-fullscreen:not(.repair-order-create-dialog).open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1) !important;
  animation: repairOrderModalIn .24s cubic-bezier(.2,.7,.2,1) !important;
}

.repair-order-fullscreen:not(.repair-order-create-dialog) .drawer-head {
  flex-shrink: 0;
}

.repair-order-fullscreen:not(.repair-order-create-dialog) .drawer-body {
  min-height: 0;
}

.works-page .works-drawer {
  top: 50%;
  right: auto;
  bottom: auto;
  left: 50%;
  width: min(680px, calc(100vw - 40px));
  height: auto;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%);
  animation: worksModalIn .24s cubic-bezier(.2,.7,.2,1);
}

.catalog-auto-sku {
  min-height: 67px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 9px 11px;
}

.catalog-auto-sku span,
.catalog-auto-sku small {
  color: var(--fg-4);
  font-size: 10.5px;
  font-weight: 600;
}

.catalog-auto-sku strong {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

@keyframes catalogModalIn {
  from { transform: translateY(10px) scale(.98); opacity: .4; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes worksModalIn {
  from { transform: translate(-50%, calc(-50% + 10px)) scale(.98); opacity: .4; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes repairOrderModalIn {
  from { transform: translate(-50%, calc(-50% + 10px)) scale(.98); opacity: .4; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@media (max-width: 720px) {
  .catalog-drawer-layer,
  .stock-drawer-layer,
  .ops-drawer-layer,
  .purchase-drawer-layer {
    padding: 9px;
  }

  .catalog-drawer-layer .catalog-drawer,
  .stock-drawer-layer .stock-drawer,
  .ops-drawer-layer .ops-drawer,
  .purchase-drawer-layer .purchase-drawer {
    width: 100%;
    max-height: calc(100dvh - 18px);
  }

  .catalog-drawer form,
  .stock-drawer form,
  .ops-drawer form,
  .purchase-drawer form {
    max-height: calc(100dvh - 18px);
  }

  .works-page .works-drawer {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }

  .drawer.repair-order-create-dialog {
    width: calc(100vw - 18px) !important;
    max-height: calc(100dvh - 18px);
  }

  .repair-order-create-dialog > form {
    max-height: calc(100dvh - 18px);
  }

  .repair-order-create-dialog .drawer-form-row {
    grid-template-columns: 1fr;
  }

  .drawer.repair-order-fullscreen:not(.repair-order-create-dialog) {
    width: calc(100vw - 18px) !important;
    height: calc(100dvh - 18px) !important;
    max-height: calc(100dvh - 18px);
  }
}

/* Роль владельца: отдельный спокойный акцент в карточке команды. */
.role-badge.owner {
  color: #6d28d9;
  background: rgba(124, 58, 237, 0.09);
  border-color: rgba(124, 58, 237, 0.24);
}

.role-badge.location_manager,
.role-badge.rental_admin {
  background: rgba(37, 99, 235, 0.09);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
}

.role-badge.location_manager .dot,
.role-badge.rental_admin .dot {
  background: #2563eb;
}

[data-theme="dark"] .role-badge.location_manager,
[data-theme="dark"] .role-badge.rental_admin {
  background: rgba(96, 165, 250, 0.13);
  border-color: rgba(96, 165, 250, 0.28);
  color: #93c5fd;
}

[data-theme="dark"] .role-badge.owner {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(167, 139, 250, 0.28);
}

/* Печать внутренних этикеток 58 × 40 мм. */
.barcode-label-layer {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 10, .28);
  backdrop-filter: blur(2px);
}

.barcode-label-dialog {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .2);
  animation: catalogModalIn .24s cubic-bezier(.2,.7,.2,1);
}

.barcode-label-head {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.barcode-label-head h2 { margin: 0; font-size: 18px; }
.barcode-label-head p { margin: 5px 0 0; color: var(--fg-4); font-size: 12px; }
.barcode-label-close { font-size: 20px; line-height: 1; }

.barcode-label-body {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(190px, .72fr);
  gap: 18px;
  padding: 20px;
}

.barcode-label-preview {
  display: grid;
  place-items: center;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #e9e9e6;
  padding: 16px;
}

.barcode-label-preview .gb-label {
  width: 58mm;
  height: 40mm;
  overflow: hidden;
  padding: 2.4mm 3mm 2mm;
  background: #fff;
  color: #000;
  font-family: Arial, sans-serif;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .16);
}

.barcode-label-preview .gb-label header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2mm;
  border-bottom: .35mm solid #000;
  padding-bottom: 1mm;
}

.barcode-label-preview .gb-label header strong { font-size: 10pt; letter-spacing: .2pt; }
.barcode-label-preview .gb-label header b { font-size: 14pt; white-space: nowrap; }
.barcode-label-preview .gb-label-name {
  height: 8mm;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 8.5pt;
  line-height: 1.05;
  font-weight: 700;
}
.barcode-label-preview .gb-label-bars {
  display: block;
  width: 100%;
  height: 16mm;
  fill: #000;
  shape-rendering: crispEdges;
}
.barcode-label-preview .gb-label-sku {
  margin-top: .8mm;
  text-align: center;
  font: 700 8pt monospace;
  letter-spacing: .6pt;
}

.barcode-label-copies { display: flex; flex-direction: column; gap: 7px; align-self: center; }
.barcode-label-copies span { color: var(--fg-3); font-size: 11px; font-weight: 650; }
.barcode-label-copies input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  padding: 0 11px;
  font: inherit;
}
.barcode-label-copies small,
.barcode-label-note { color: var(--fg-4); font-size: 11px; line-height: 1.45; }
.barcode-label-note { grid-column: 1 / -1; margin: 0; }
.barcode-label-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--bg-soft));
}

@media (max-width: 640px) {
  .barcode-label-layer { padding: 9px; }
  .barcode-label-dialog { width: 100%; max-height: calc(100dvh - 18px); }
  .barcode-label-body { grid-template-columns: 1fr; padding: 14px; }
  .barcode-label-note { grid-column: 1; }
  .barcode-label-preview { min-height: 190px; padding: 10px; }
  .barcode-label-preview .gb-label { transform: scale(.9); }
}

/* Сканер штрихкода в мобильной карточке заказ-наряда. */
.barcode-scan-trigger { margin-left: auto; white-space: nowrap; }
.barcode-scan-layer {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 10, .48);
  backdrop-filter: blur(3px);
}
.barcode-scan-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .26);
}
.barcode-scan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.barcode-scan-head h2 { margin: 0; font-size: 18px; }
.barcode-scan-head p { margin: 4px 0 0; color: var(--fg-4); font-size: 11.5px; }
.barcode-scan-close { font-size: 21px; line-height: 1; }
.barcode-scan-body { min-height: 0; overflow-y: auto; padding: 16px; }
.barcode-scan-video {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 11px;
  background: #111;
}
.barcode-scan-video video { width: 100%; height: 100%; display: block; object-fit: cover; }
.barcode-scan-video span {
  position: absolute;
  inset: 27% 9%;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .28);
  pointer-events: none;
}
.barcode-scan-state {
  min-height: 42px;
  margin: 11px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.4;
}
.barcode-scan-state.success { background: #16a34a12; color: #15803d; }
.barcode-scan-state.error { background: #dc262612; color: #b91c1c; }
.barcode-scan-state.busy { color: var(--fg); }
.barcode-scan-actions { display: flex; gap: 8px; }
.barcode-photo-button { flex: 1; cursor: pointer; text-align: center; }
.barcode-photo-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.barcode-manual-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.barcode-manual-form label { display: grid; gap: 7px; }
.barcode-manual-form label > span { color: var(--fg-3); font-size: 11px; font-weight: 650; }
.barcode-manual-form label > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.barcode-manual-form input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: 600 13px var(--font-mono);
  text-transform: uppercase;
}
.barcode-scan-success { min-height: 320px; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; }
.barcode-scan-success[hidden], .barcode-scan-capture[hidden] { display: none; }
.barcode-scan-check { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: #16a34a18; color: #15803d; font-size: 28px; font-weight: 800; }
.barcode-scan-success strong { font-size: 18px; }
.barcode-scan-success span { color: var(--fg-3); font-size: 12px; }
.barcode-scan-success-actions { display: flex; gap: 8px; margin-top: 12px; }

@media (max-width: 640px) {
  .barcode-scan-layer { align-items: end; padding: 0; }
  .barcode-scan-dialog { width: 100%; max-height: 96dvh; border-radius: 16px 16px 0 0; }
  .barcode-scan-body { padding: 12px; }
  .barcode-scan-trigger { width: 100%; margin-left: 0; }
  .repair-order-fullscreen:not(.repair-order-create-dialog) .order-action-bar { flex-wrap: wrap; }
  .barcode-scan-success-actions { width: 100%; flex-direction: column; }
  .barcode-scan-success-actions .btn { width: 100%; }
}

/* Реквизиты городской точки */
.requisites-page { max-width: 1100px; margin: 0 auto; }
.requisites-location-picker { display: flex; margin-bottom: 16px; }
.requisites-location-picker label { display: grid; gap: 6px; min-width: min(420px, 100%); }
.requisites-location-picker label > span,
.requisites-grid label > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.requisites-location-picker select,
.requisites-grid input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
}
.requisites-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.requisites-banner div { display: grid; gap: 2px; }
.requisites-banner b { font-size: 16px; }
.requisites-banner div span { font-size: 12.5px; color: var(--fg-3); }
.requisites-error {
  padding: 11px 13px;
  margin-bottom: 14px;
  border: 1px solid #ef444466;
  border-radius: var(--radius-sm);
  background: #ef44440d;
  color: #b91c1c;
  font-size: 13px;
}
.requisites-sections { display: grid; gap: 14px; }
.requisites-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
}
.requisites-card h2 { margin: 0 0 16px; font-size: 15px; }
.requisites-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.requisites-grid label { display: grid; gap: 6px; }
.requisites-grid label.wide { grid-column: 1 / -1; }
.requisites-grid input[readonly] { background: var(--bg-soft); color: var(--fg-2); cursor: default; }
.requisites-grid input[readonly]:placeholder-shown { color: var(--fg-4); }
.requisites-updated { padding: 12px 2px 0; color: var(--fg-4); font-size: 11.5px; text-align: right; }

@media (max-width: 720px) {
  .requisites-grid { grid-template-columns: 1fr; }
  .requisites-grid label.wide { grid-column: auto; }
  .requisites-banner { align-items: flex-start; flex-direction: column; }
  .requisites-page .page-head { align-items: flex-start; flex-direction: column; }
  .requisites-page .btn.primary { width: 100%; }
}

/* Существующий раздел «Платежи» для управляющего городской точки */
.location-payments-page { max-width: 1400px; margin: 0 auto; }
.location-payments-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.location-payment-metric { display: grid; gap: 5px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.location-payment-metric > span { color: var(--fg-3); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.location-payment-metric > b { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.location-payment-metric > small { color: var(--fg-4); font-size: 11.5px; }
.location-payments-filters { display: grid; grid-template-columns: repeat(3, minmax(145px, 1fr)) minmax(220px, 1.4fr) auto; gap: 10px; align-items: end; padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.location-payments-filters label { display: grid; gap: 5px; }
.location-payments-filters label > span { color: var(--fg-3); font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.location-payments-filters input,
.location-payments-filters select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg); color: var(--fg); font: inherit; }
.location-payments-filter-actions { display: flex; gap: 7px; }
.location-payments-note { padding: 10px 13px; margin-bottom: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-soft); color: var(--fg-3); font-size: 12px; }
.location-payments-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.location-payments-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.location-payments-table th { padding: 11px 13px; border-bottom: 1px solid var(--line-strong); background: var(--bg-soft); color: var(--fg-3); font-size: 10.5px; font-weight: 650; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
.location-payments-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); color: var(--fg-2); font-size: 12.5px; vertical-align: middle; }
.location-payments-table tr:last-child td { border-bottom: 0; }
.location-payments-table tbody tr:hover { background: var(--bg-soft); }
.location-payments-table td b { display: block; color: var(--fg); font-weight: 600; }
.location-payments-table td small { display: block; max-width: 190px; overflow: hidden; color: var(--fg-4); font-family: var(--font-mono); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.location-payment-amount { color: var(--fg)!important; font-size: 13px!important; font-weight: 650; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.location-payment-status { display: inline-flex; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 650; white-space: nowrap; }
.location-payment-status.good { background: #22c55e18; color: #15803d; }
.location-payment-status.warn { background: #f59e0b18; color: #b45309; }
.location-payment-status.bad { background: #ef444418; color: #b91c1c; }
.location-payment-status.neutral { background: var(--bg-soft); color: var(--fg-3); }
.location-payments-limit { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--fg-4); font-size: 11.5px; text-align: center; }

@media (max-width: 1050px) {
  .location-payments-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 700px) {
  .location-payments-metrics { grid-template-columns: 1fr; }
  .location-payments-filters { grid-template-columns: 1fr; }
  .location-payments-filter-actions .btn { flex: 1; }
}
