/* ======================================================
   VARIABLES & RESET
   ====================================================== */

:root {
  --bg: #f6f4f1;
  --text: #1c1c1c;
  --muted: #8a8a8a;
  --border: #d9d6d2;

  --success: #16a34a;
  --danger: #991b1b;

  --danger-bg: #fff5f5;
  --danger-border: #f2caca;
}

* { box-sizing: border-box; }

/* ======================================================
   BASE
   ====================================================== */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
}

h1, h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
}

h1 {
  font-size: 32px;
  margin: 0 0 8px;
  letter-spacing: .5px;
}

h2 {
  font-size: 22px;
  margin: 0 0 18px;
  letter-spacing: .4px;
}

.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ======================================================
   LAYOUT
   ====================================================== */

.layout {
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px 48px;
  align-items: start;
  align-content: start;
  grid-auto-rows: min-content; /* важно: строки по контенту */
  grid-template-areas:
    "custSearch custForm"
    "txSearch   txForm"
    "bottom     bottom";
  grid-auto-flow: row;
}

@media (min-width: 1024px) {
  .layout { grid-template-columns: 360px 1fr; }
}

/* single-column layout (void page) */
.layout.single {
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ======================================================
   PANELS & CARDS  (как раньше: высота по контенту)
   ====================================================== */

.panel,
.card {
  border: 1px solid var(--border);
  background: transparent;
  padding: 20px;
}

@media (min-width: 768px) {
  .panel,
  .card { padding: 32px; }
}

@media (min-width: 1024px) {
  .panel,
  .card { padding: 56px 48px; }
}

/* ======================================================
   SEARCH & LISTS
   ====================================================== */

.search { max-width: 480px; }

.search input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--text);
}

.search input:focus {
  outline: none;
  border-bottom-color: var(--text);
}

.hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list.limited {
  max-height: 320px;
  overflow-y: auto;
}

/* ======================================================
   LIST ITEMS (customers / transactions)
   ====================================================== */

.client,
.row {
  cursor: pointer;
  padding: 10px 6px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease, transform 0.15s ease;
  font-size: 13px;
}

.client:hover,
.client.active,
.row:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateX(4px); /* без layout shift */
}

.client .name { font-size: 14px; }

.client .dob,
.muted {
  font-size: 12px;
  color: var(--muted);
}

.status {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.status.ok { color: var(--success); }
.status.fail { color: var(--danger); }

.list-page { display: block; }

.page-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 40px 20px;
}

.row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 120px;
  gap: 16px;
  align-items: center;
}

/* ======================================================
   FORMS
   ====================================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
select {
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 8px 2px;
  font-size: 14px;
  color: var(--text);
}

input:focus,
select:focus {
  outline: none;
  border-bottom-color: var(--text);
}

input[readonly] { cursor: default; }

input:invalid,
select:invalid { border-bottom-color: #dc2626; }

/* ======================================================
   CONFIRM UI (важно для "как на 3 скрине")
   ====================================================== */

.hidden { display: none !important; }

.confirmed {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);

  display: inline-flex;
  align-items: center;
  gap: 6px;

  min-height: 18px;

  visibility: visible;
  opacity: 1;

  transition: opacity 0.15s ease;
}

.confirmed.hidden {
  display: block;        /* ❗ НЕ display:none */
  visibility: hidden;    /* скрыт визуально */
  opacity: 0;
}

/* Этот текст всегда занимает место => ничего не прыгает */
.selected-big {
  display: block;
  margin-top: 16px;
  font-size: 18px;
  font-weight: 500;
  min-height: 24px;
}

@media (max-width: 1023px){
  .layout{
    grid-template-columns: 1fr;
    grid-template-areas:
      "custSearch"
      "custForm"
      "txSearch"
      "txForm"
      "bottom";
  }
}
/* ======================================================
   COLLAPSE LOGIC (ключ)
   ====================================================== */
.ga-cust-search { grid-area: custSearch; }
.ga-cust-form   { grid-area: custForm; }
.ga-tx-search   { grid-area: txSearch; }
.ga-tx-form     { grid-area: txForm; }
.ga-bottom      { grid-area: bottom; }

/* то, что должно скрываться после confirm */
.collapsible { display: block; }

/* когда карточка подтверждена — скрываем форму/детали */
.card.collapsed .collapsible {
  display: block;
}

/* (опционально) уменьшаем отступы в схлопнутой карточке, чтобы она стала компактной */
.card.collapsed {
  padding-bottom: 28px;
}

/* ======================================================
   ACTIONS & BUTTONS
   ====================================================== */

.actions,
.confirm-bar {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.confirm-bar { justify-content: flex-end; }
.confirm-bar .selected { margin-right: auto; }

.selected {
  font-size: 12px;
  color: var(--muted);
}

button,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 36px;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover,
.btn-secondary:hover {
  background: var(--text);
  color: #fff;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.items-block{
  margin-top: 20px;
}

.items-header,
.item-row {
  display: grid;
  grid-template-columns: 3fr 80px 140px;
  align-items: center;
  gap: 12px;
}

.items-header {
  margin-top: 20px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #999;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 12px;
}

.item-row {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.col-name {
  font-weight: 500;
}

.col-qty {
  text-align: center;
}

.col-amount {
  text-align: right;
}


/* ======================================================
   BOTTOM ACTIONS (index)
   ====================================================== */

.bottom-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  margin-top: 32px;
}

.taxfree-list-link { justify-self: start; }
.final-submit { justify-self: end; }

.btn-view {
  border: 1px solid #000;
  background: transparent;
}

.btn-void {
  border: 1px solid #c00;
  color: #c00;
  background: transparent;
}

/* ======================================================
   SUCCESS PAGE
   ====================================================== */

.container {
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  padding: 40px;
  border: 1px solid #e5e5e5;
}

.qr {
  margin: 32px 0;
  text-align: center;
}

.qr img {
  width: 180px;
  height: 180px;
}

iframe {
  width: 100%;
  height: 600px;
  border: 1px solid #ddd;
  margin-top: 24px;
}


/* ======================================================
   DECLINE PAGE
   ====================================================== */

.error {
  font-size: 15px;
  margin-bottom: 32px;
  color: var(--danger);
}

/* ======================================================
   VOID PAGE
   ====================================================== */
.warning-full {
  grid-column: 1 / -1; /* 🔥 КЛЮЧ */
  margin-top: 32px;
  padding: 32px 40px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
}

.warning-full h2 {
  margin-top: 0;
  color: var(--danger);
}

.warning-full p {
  margin: 0;
  font-size: 14px;
  color: #7f1d1d;
}

/* ======================================================
   VOID PAGE — COMPACT SPACING
   ====================================================== */

.void-page .layout {
  gap: 24px 32px;
}

.void-page .subtitle {
  margin-bottom: 24px;
}

.void-page .warning-full {
  margin-top: 16px;
}

.void-page .bottom-actions {
  margin-top: 24px;
}
.tx-items {
  margin-top: 24px;
  font-size: 13px;
}

.tx-items-title {
  font-weight: 500;
  margin-bottom: 6px;
}

.tx-items-header,
.tx-item-row {
  display: grid;
  grid-template-columns: 1fr 40px 80px;
  gap: 8px;
}

.tx-items-header {
  color: #999;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.tx-item-row {
  padding: 4px 0;
}

.tx-item-row span:last-child {
  text-align: right;
}

/* ======================================================
   READ-ONLY DETAILS (VOID / SUCCESS)
   ====================================================== */

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
}

.detail {
  display: flex;
  flex-direction: column;
}

.detail label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail .value {
  font-size: 15px;
  font-weight: 500;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ======================================================
   UTILITIES
   ====================================================== */

.hidden {
  display: block;        /* ❗ НЕ display:none */
  visibility: hidden;    /* скрыт визуально */
  opacity: 0;
}

.panel.collapsed {
  display: none;
}

.card.collapsed .form-grid,
.card.collapsed .items-block {
  display: none;
}


/* ======================================================
   Success page
   ====================================================== */
.receipt-wrap {
  width: 320px;
  background: #fff;
  margin: 20px auto;
  padding: 14px 12px;
  box-shadow: 0 0 12px rgba(0,0,0,0.15);
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.35;
  color: #000;
}

/* helpers */
.receipt-center { text-align: center; }
.receipt-bold { font-weight: bold; }
.receipt-small { font-size: 10px; }

/* divider */
.receipt-divider {
  border-top: 1px dashed #000;
  margin: 10px 0;
}

/* rows */
.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0;
}
.receipt-row span:last-child {
  text-align: right;
  white-space: nowrap;
}

/* meta */
.receipt-meta { margin: 4px 0; }

/* items */
.receipt-items-table { font-size: 11px; }

.receipt-col {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* totals */
.receipt-totals { margin-top: 4px; }
.receipt-totals .receipt-bold {
  border-top: 1px dashed #000;
  padding-top: 4px;
  margin-top: 6px;
}

/* planet */
.receipt-planet-logo img {
  max-width: 140px;
  display: block;
  margin: 6px auto;
}
.receipt-planet-qr {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

/* policy */
.receipt-policy-text {
  font-size: 10px;
  line-height: 1.35;
}

/* actions */
.receipt-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.receipt-actions button {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  border: 1px solid #000;
  background: #fff;
  cursor: pointer;
}

/* =========================
   PLANET FINAL BLOCK
   ========================= */

.receipt-planet {
  margin-top: 8px;
}

.receipt-planet-logo img {
  width: 64px;
  height: auto;
  margin: 6px auto 4px;
  display: block;
}

.receipt-planet-text {
  font-size: 9px;
  line-height: 1.35;
  margin-bottom: 6px;
}

.receipt-tag-number {
  font-size: 14px;
  letter-spacing: 0.6px;
  margin: 6px 0 4px;
}

.receipt-planet-site {
  font-size: 11px;
  margin-bottom: 6px;
}

.receipt-planet-qr {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

/* =========================
   PLANET OFFICIAL LAYOUT
   ========================= */

.receipt-planet {
  margin-top: 8px;
}

/* LOGO + TEXT IN ONE LINE */
.receipt-planet-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

/* LOGO CIRCLE */
.receipt-planet-logo-circle {
  width: 42px;
  height: 42px;
  background: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.receipt-planet-logo-circle img {
  width: 22px;
  height: auto;
}

/* TEXT */
.receipt-planet-text {
  font-size: 9px;
  line-height: 1.35;
}

/* TAG NUMBER */
.receipt-tag-number {
  font-size: 14px;
  letter-spacing: 0.6px;
  margin: 6px 0 4px;
}

/* SITE */
.receipt-planet-site {
  font-size: 11px;
  margin-bottom: 6px;
}

/* QR */
.receipt-planet-qr {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

/* ITEMS GRID (fixed) */
.receipt-items-head,
.receipt-items-row {
  display: grid;
  width: 100%;
  grid-template-columns:
    minmax(0, 1fr)  /* desc */
    18px            /* qty */
    52px            /* price */
    46px            /* vat */
    58px;           /* total */  gap: 4px;
  align-items: start;
}

.receipt-items-head{
  font-size: 10.5px;
  font-weight: bold;
}

/* Description: max 2 lines + "..." */
.receipt-col.desc {
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
   line-height: 1.45;           /* чтобы текст "дышал" */
  padding-right: 4px;
}

/* numbers: keep one line */
.receipt-col.qty,
.receipt-col.price,
.receipt-col.vat,
.receipt-col.total {
  white-space: nowrap;
  text-align: right;
  line-height: 1.25;
  font-size: 8.5px;
}

.receipt-items-row {
  padding: 4px 0;              /* расстояние между строками */
  border-bottom: 1px dotted rgba(0,0,0,0.2);
  font-size: 9px;
}

@page {
  size: 78mm auto;
  margin: 0;
}

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #000 !important;
    -webkit-text-stroke: 0.2px #000; /* Chrome */
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    width: 78mm !important;
    font-weight: 600 !important;
    font-size: 12.5px !important;
    font-family: monospace !important;
  }

  body {
    display: block;
  }

  .receipt-wrap {
    width: 78mm !important;
    max-width: 78mm !important;
    margin: 0 !important;
    padding: 4mm 3mm !important;
    box-shadow: none !important;
    font-weight: 600 !important;

    page-break-inside: avoid;
    break-inside: avoid;
  }

  .receipt-items-table,
  .receipt-totals,
  .receipt-planet,
  .receipt-planet-row,
  .receipt-planet-qr,
  .receipt-tag-number {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .receipt-policy {
    page-break-inside: auto;
    break-inside: auto;
  }

  .no-print,
  .receipt-actions {
    display: none !important;
  }

    .receipt-items-row {
    font-size: 10px !important;
  }

  .receipt-small {
    font-size: 9.5px !important;
  }

  .receipt-divider,
  .receipt-items-row {
    border-color: #000 !important;
}

