.pc-check {
  --pc-blue: #003399;
  --pc-blue-soft: #e8eef8;
  --pc-orange: #f18a00;
  --pc-border: #d6dce5;
  --pc-text: #1a1a1a;
  --pc-muted: #5a6570;
  --fns-font: Helvetica, Arial, "Noto Sans", sans-serif;
}

.pc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--pc-border);
}

.pc-tabs__btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--pc-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.pc-tabs__btn:hover {
  color: var(--pc-blue);
}

.pc-tabs__btn.is-active {
  color: var(--pc-blue);
  border-bottom-color: var(--pc-blue);
}

.pc-panel[hidden] {
  display: none !important;
}

.pc-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

.pc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--pc-text);
  min-width: 0;
  max-width: 100%;
}

.pc-field--full {
  grid-column: 1 / -1;
}

.pc-field input,
.pc-field select,
.pc-field textarea {
  font: inherit;
  font-weight: 400;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid var(--pc-border);
  border-radius: 4px;
  background: #fff;
  color: var(--pc-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pc-field input[type="date"],
.pc-field input[type="time"],
.pc-field input[type="datetime-local"] {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.pc-field input[type="date"]::-webkit-calendar-picker-indicator,
.pc-field input[type="time"]::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.pc-field input:focus,
.pc-field select:focus,
.pc-field textarea:focus {
  outline: none;
  border-color: var(--pc-blue);
  box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.12);
}

.pc-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--pc-muted);
}

.pc-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pc-btn {
  appearance: none;
  border: 0;
  border-radius: 4px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.pc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pc-btn--primary {
  background: #f18a00 !important;
  border-color: #f18a00 !important;
  color: #fff !important;
}

.pc-btn--primary:hover:not(:disabled) {
  background: #d97c00 !important;
  border-color: #d97c00 !important;
}

.pc-btn--secondary {
  background: var(--pc-blue);
  color: #fff;
}

.pc-btn--secondary:hover:not(:disabled) {
  background: #002266;
}

.pc-btn--ghost {
  background: var(--pc-blue-soft);
  color: var(--pc-blue);
}

.pc-btn--ghost:hover:not(:disabled) {
  background: #d7e2f5;
}

.pc-scan__viewport {
  width: 100%;
  min-height: 240px;
  background: #0f1724;
  border-radius: 4px;
  overflow: hidden;
}

.pc-scan-fs {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
}

.pc-scan-fs[hidden] {
  display: none !important;
}

.pc-scan-fs__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(0, 0, 0, 0.88);
}

.pc-scan-fs__title {
  font-size: 16px;
  font-weight: 700;
}

.pc-scan-fs__close {
  appearance: none;
  border: 0;
  background: #fff;
  color: #111;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.pc-scan-fs__viewport {
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
}

.pc-scan-fs__viewport video,
.pc-scan-fs__viewport canvas,
.pc-scan-fs__viewport img,
.pc-scan-fs__viewport svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  pointer-events: none; /* Чтобы SVG не перехватывал клики */
}

.pc-scan-fs__viewport #pc-qr-reader,
.pc-scan-fs__viewport > div {
  width: 100% !important;
  height: 100% !important;
}

.pc-scan-fs__hint {
  margin: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.88);
  color: #e8eef7;
}

body.pc-scan-open {
  overflow: hidden;
  touch-action: none;
}

.pc-paste-preview {
  margin-top: 10px;
}

.pc-paste-preview img {
  max-width: 220px;
  border: 1px solid var(--pc-border);
  border-radius: 4px;
}

.pc-status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 14px;
}

.pc-status.is-loading {
  background: var(--pc-blue-soft);
  color: var(--pc-blue);
}

.pc-status.is-error {
  background: #fdecea;
  color: #c0392b;
}

.pc-status.is-info {
  background: #fff7e8;
  color: #8a5a00;
}

.pc-result {
  margin-top: 22px;
  border-top: 1px solid var(--pc-border);
  padding-top: 18px;
}

.pc-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.pc-result__head h2 {
  margin: 0;
  font-size: 20px;
  color: #002266;
}

.pc-result__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pc-ticket {
  border: 1px solid var(--pc-border);
  border-radius: 4px;
  padding: 18px 16px;
  background: #fafbfd;
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
}

.pc-ticket__head {
  margin-bottom: 14px;
  text-align: center;
}

.pc-ticket__head strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.pc-ticket__meta {
  color: var(--pc-muted);
  font-size: 13px;
  margin-top: 4px;
}

.pc-ticket__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 14px;
  table-layout: fixed;
}

.pc-ticket__table th,
.pc-ticket__table td {
  border-bottom: 1px solid var(--pc-border);
  padding: 8px 4px;
  text-align: left;
  vertical-align: top;
}

.pc-ticket__table th {
  color: var(--pc-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* № */
.pc-ticket__table th:nth-child(1),
.pc-ticket__table td:nth-child(1),
.pc-ticket__col-n {
  width: 28px;
  max-width: 28px;
  white-space: nowrap;
  text-align: center;
  padding-left: 2px;
  padding-right: 2px;
}

/* Наименование — переносится на следующую строку */
.pc-ticket__table th:nth-child(2),
.pc-ticket__table td:nth-child(2),
.pc-ticket__col-name {
  width: auto;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  text-align: left;
}

/* Цена, Кол-во, Сумма — по центру, без переноса */
.pc-ticket__table th:nth-child(3),
.pc-ticket__table td:nth-child(3),
.pc-ticket__col-price {
  width: 72px;
  min-width: 72px;
  white-space: nowrap !important;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}

.pc-ticket__table th:nth-child(4),
.pc-ticket__table td:nth-child(4),
.pc-ticket__col-qty {
  width: 52px;
  min-width: 52px;
  white-space: nowrap !important;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}

.pc-ticket__table th:nth-child(5),
.pc-ticket__table td:nth-child(5),
.pc-ticket__col-sum {
  width: 72px;
  min-width: 72px;
  white-space: nowrap !important;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}

.pc-ticket__total {
  font-size: 16px;
  margin-bottom: 10px;
}

.pc-ticket__fiscal {
  margin-top: 10px;
  font-size: 13px;
  color: var(--pc-muted);
  line-height: 1.5;
}

.pc-ticket__qr {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--pc-border);
  text-align: center;
}

.pc-ticket__qr-title {
  font-weight: 700;
  margin-bottom: 10px;
  color: #002266;
}

.pc-ticket__qr img {
  display: inline-block;
  border: 1px solid var(--pc-border);
  border-radius: 4px;
  background: #fff;
}

.pc-ticket__qr-raw {
  display: none;
  margin-top: 10px;
  font-size: 11px;
  color: var(--pc-muted);
  word-break: break-all;
  text-align: left;
}

/* HTML чека от API */
.pc-result__body .b-check_table {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--pc-border);
}

.pc-result__body .b-check_table td,
.pc-result__body .b-check_table th {
  padding: 6px 8px;
  vertical-align: top;
}

.pc-result__body .b-check_center {
  text-align: center;
}

.pc-result__body .b-check_itogo {
  font-weight: 700;
}

.pc-result__body .b-check_item td {
  border-top: 1px solid #eee;
}

@media (max-width: 640px) {
  .pc-form__grid {
    grid-template-columns: 1fr;
  }

  .pc-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pc-tabs__btn {
    padding: 10px 12px;
    font-size: 14px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .pc-ticket__table {
    font-size: 13px;
  }

  .pc-ticket__table th,
  .pc-ticket__table td {
    padding: 7px 3px;
  }

  .pc-ticket__table th:nth-child(3),
  .pc-ticket__table td:nth-child(3),
  .pc-ticket__col-price {
    width: 64px;
    min-width: 64px;
  }

  .pc-ticket__table th:nth-child(4),
  .pc-ticket__table td:nth-child(4),
  .pc-ticket__col-qty {
    width: 48px;
    min-width: 48px;
  }

  .pc-ticket__table th:nth-child(5),
  .pc-ticket__table td:nth-child(5),
  .pc-ticket__col-sum {
    width: 64px;
    min-width: 64px;
  }

  .pc-ticket__col-n,
  .pc-ticket__col-price,
  .pc-ticket__col-qty,
  .pc-ticket__col-sum,
  .pc-ticket__table th:nth-child(1),
  .pc-ticket__table td:nth-child(1),
  .pc-ticket__table th:nth-child(3),
  .pc-ticket__table td:nth-child(3),
  .pc-ticket__table th:nth-child(4),
  .pc-ticket__table td:nth-child(4),
  .pc-ticket__table th:nth-child(5),
  .pc-ticket__table td:nth-child(5) {
    white-space: nowrap !important;
    text-align: center;
    font-size: 12px;
  }

  .pc-result__body .b-check_table {
    max-width: 100%;
  }
}

.fns-recent-list-wrapper {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 16px;
  margin-bottom: 24px;
}

.pc-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pc-recent-list li {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.pc-recent-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.fns-recent-item__link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}

.fns-recent-item__link:hover {
  opacity: 0.8;
}

.fns-recent-item__sum {
  font-weight: 700;
  color: #003399;
  font-size: 15px;
}

.fns-recent-item__org {
  font-size: 13px;
  color: #333;
}

.pc-recent-list time {
  font-size: 12px;
  color: #888;
}

/* PDF preview modal */
.pc-pdf-preview {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pc-pdf-preview[hidden] {
  display: none !important;
}

.pc-pdf-preview__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 27, 51, 0.55);
}

.pc-pdf-preview__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.pc-pdf-preview__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid #e5eaf0;
  background: #f7f9fc;
}

.pc-pdf-preview__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pc-pdf-preview__frame-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #edf1f5;
}

.pc-pdf-preview__frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.pc-pdf-preview__loading {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: #4b5c73;
  font-size: 14px;
}

.pc-pdf-preview__actions .pc-btn,
.pc-pdf-preview__actions a,
.pc-pdf-preview__actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #c9d3e0;
  background: #fff;
  color: #0c1b33;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pc-pdf-preview__actions .pc-btn--primary,
.pc-pdf-preview__actions a.pc-btn--primary {
  background: #1a56c4;
  border-color: #1a56c4;
  color: #fff;
}

body.pc-pdf-preview-open {
  overflow: hidden;
}
