:root {
  --po-bg: #f4f7fb;
  --po-panel: rgba(255, 255, 255, 0.84);
  --po-panel-solid: #ffffff;
  --po-border: rgba(148, 163, 184, 0.24);
  --po-border-strong: rgba(100, 116, 139, 0.3);
  --po-text: #0f172a;
  --po-text-soft: #475569;
  --po-text-muted: #64748b;
  --po-primary: #2563eb;
  --po-primary-soft: rgba(37, 99, 235, 0.1);
  --po-primary-soft-2: rgba(37, 99, 235, 0.16);
  --po-shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.1);
  --po-shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --po-radius-xl: 24px;
  --po-radius-lg: 18px;
  --po-radius-md: 12px;
}

.print-order-body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--po-text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 26%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 22%),
    linear-gradient(180deg, #f8fbff 0%, var(--po-bg) 100%);
}

.main {
  width: 100%;
}

.content {
  width: min(1880px, calc(100vw - 24px));
  margin: 0 auto;
}

.worksheet {
  padding: 14px 0;
}

.red_btn {
  border: 1px solid var(--po-primary-soft-2);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.red_btn:hover {
  transform: translateY(-1px);
  border-color: var(--po-primary);
  background: #f8fbff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.print-order-page {
  padding: 16px;
}

.print-order-header {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.print-order-header-title h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.print-order-header-title p {
  margin: 6px 0 0;
  color: var(--po-text-soft);
  font-size: 14px;
  font-weight: 600;
}

.print-order-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.print-order-actions .red_btn,
.po-cart-footer .red_btn,
.po-review-actions .red_btn {
  margin: 0;
  width: auto;
  min-width: 170px;
}

.print-order-layout {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(360px, 460px);
}

.print-order-clients-area,
.print-order-cards-area,
.print-order-cart-area {
  background: var(--po-panel);
  border: 1px solid var(--po-border);
  border-radius: var(--po-radius-xl);
  padding: 14px;
  backdrop-filter: blur(16px);
  box-shadow: var(--po-shadow-md);
}

.print-order-clients-area {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.print-order-clients-head {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.print-order-clients-head h2 {
  margin: 0;
}

#print-order,
#po-client-filter,
#po-order-desc {
  border: 1px solid var(--po-border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.po-clients-list {
  overflow: auto;
  display: grid;
  gap: 8px;
}

.po-client-item {
  border: 1px solid var(--po-border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
  transition: 0.16s ease;
}

.po-client-item:hover {
  border-color: var(--po-primary-soft-2);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.po-client-item.is-active {
  border-color: var(--po-primary);
  background: #eff6ff;
}

.po-client-item-title {
  font-weight: 700;
  font-size: 14px;
}

.po-client-item-sub {
  color: var(--po-text-muted);
  font-size: 12px;
}

.print-order-cards-area {
  min-height: 640px;
}

.print-order-cart-area {
  position: sticky;
  top: 14px;
}

.print-order-cards-head,
.print-order-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.print-order-cards-head h2,
.print-order-cart-head h2 {
  margin: 0;
}

#po-cards-count,
#po-cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--po-primary-soft);
  color: var(--po-primary);
  font-weight: 700;
}

.po-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.po-card-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.po-card-toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--po-border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.po-favorites-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--po-border);
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  color: var(--po-text);
  font-weight: 700;
  cursor: pointer;
}

.po-card {
  position: relative;
  border: 1px solid var(--po-border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto 1fr;
  transition: 0.16s ease;
}

.po-card:hover {
  transform: translateY(-1px);
  border-color: var(--po-primary-soft-2);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.po-card.is-favorite {
  border-color: rgba(245, 158, 11, 0.55);
}

.po-card-favorite {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #f59e0b;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.po-card-favorite:hover {
  border-color: rgba(245, 158, 11, 0.65);
  background: #fff8e7;
}

.po-card-preview {
  height: 150px;
  background: linear-gradient(140deg, #ecf2ff 0%, #f4f7fb 100%);
  border-bottom: 1px solid var(--po-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.po-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.po-card-noimg {
  color: var(--po-text-muted);
  font-size: 13px;
}

.po-card-body {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: space-between;
}

.po-card-title {
  margin: 0;
  padding: 10px 50px 8px 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  min-height: 46px;
  overflow-wrap: anywhere;
}

.po-card-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.po-card-option {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--po-border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--po-text);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.po-card-option--type {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.po-card-option--base {
  color: #1f2937;
}

.po-card-option-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.35);
  background: #fff;
  flex-shrink: 0;
}

.po-card-option--black .po-card-option-dot {
  background: #111827;
}

.po-card-option--color .po-card-option-dot {
  border: none;
  background: linear-gradient(135deg, #ef4444 0%, #f59e0b 35%, #22c55e 65%, #3b82f6 100%);
}

.po-card-option--empty {
  color: var(--po-text-muted);
  font-weight: 600;
}

.po-card-price {
  color: var(--po-text);
  font-size: 15px;
  font-weight: 800;
}

.po-card-actions {
  display: flex;
  justify-content: stretch;
}

.po-card-actions .red_btn {
  width: 100%;
}

.po-icon-btn {
  border: 1px solid var(--po-border);
  border-radius: 8px;
  background: #fff;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 16px;
}

.po-icon-btn:hover {
  background: #f0f4fc;
}

.po-empty {
  border: 1px dashed var(--po-border-strong);
  border-radius: 12px;
  padding: 14px;
  color: var(--po-text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.76);
}

.po-cart-table {
  width: 100%;
  table-layout: auto;
  margin-bottom: 10px;
  display: none;
}

.po-cart-table th,
.po-cart-table td {
  text-align: left;
  vertical-align: top;
}

.po-cart-table th:nth-child(n + 2),
.po-cart-table td:nth-child(n + 2) {
  text-align: center;
}

.po-cart-qty-cell,
.po-cart-money-cell {
  white-space: nowrap;
}

.po-cart-table input {
  margin: 0;
  border: 1px solid var(--po-border);
  border-radius: 6px;
  padding: 6px;
}

.po-line-actions {
  display: flex;
  gap: 6px;
}

.po-line-actions button {
  border: 1px solid var(--po-border);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  width: 28px;
  height: 28px;
}

.po-line-actions button:hover {
  background: #eef3fb;
}

.po-cart-totals {
  border-top: 1px solid var(--po-border);
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  font-weight: 600;
}

.po-cart-footer {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#po-order-desc {
  flex: 1;
  min-width: 180px;
}

.po-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.po-modal-content {
  position: relative;
  width: 900px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
}

.po-review-content {
  width: 1040px;
}

.po-modal-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  width: auto;
}

.po-item-modal-body table,
.po-review-table {
  width: 100%;
}

.po-item-modal-body input,
.po-item-modal-body select {
  margin: 0;
  border: 1px solid var(--po-border);
  border-radius: 6px;
  padding: 8px;
}

.po-card-cart-form {
  display: grid;
  gap: 12px;
}

.po-product-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.po-product-choice label,
.po-base-color-choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--po-border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
}

.po-product-choice label:has(input:checked),
.po-base-color-choice label:has(input:checked) {
  border-color: var(--po-primary);
  background: #eff6ff;
  color: var(--po-primary);
}

.po-print-type-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.po-print-type-choice label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--po-border);
  border-radius: 999px;
  background: #fff;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #40516a;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.po-print-type-choice label:hover {
  border-color: rgba(37, 99, 235, 0.45);
  background: #f0f6ff;
  color: var(--po-primary);
}

.po-print-type-choice label:has(input:checked) {
  border-color: var(--po-primary);
  background: var(--po-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.po-form-group {
  display: grid;
  gap: 8px;
}

.po-form-group-title {
  color: #40516a;
  font-size: 13px;
  font-weight: 800;
}

.po-base-color-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.po-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}

.po-size-cell {
  border: 1px solid var(--po-border);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.po-size-cell span {
  display: block;
  margin-bottom: 6px;
  color: var(--po-text);
  font-size: 12px;
}

.po-card-cart-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #40516a;
}

.po-card-cart-form input {
  width: 100%;
  box-sizing: border-box;
}

.po-cart-line-meta {
  margin-top: 4px;
  color: var(--po-text-muted);
  font-size: 12px;
}

.po-add-line-btn {
  border: 1px solid #bed1ef;
  background: #e9f1ff;
  border-radius: 6px;
  cursor: pointer;
  padding: 8px 10px;
}

.po-review-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

@media (max-width: 1450px) {
  .print-order-layout {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  }

  .print-order-cart-area {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 1100px) {
  .print-order-layout {
    grid-template-columns: 1fr;
  }

  .print-order-clients-area,
  .print-order-cart-area {
    position: static;
    max-height: none;
  }

  .po-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .po-cards-grid {
    grid-template-columns: 1fr;
  }

  .po-cart-totals {
    grid-template-columns: 1fr;
  }

  .print-order-actions .red_btn,
  .po-cart-footer .red_btn,
  .po-review-actions .red_btn {
    width: 100%;
  }
}
