/* ── Reset ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #f0f2f5;
  color: #222;
  height: 100vh;
  overflow: hidden;
}

/* ── Login ── */
#loginScreen {
  position: fixed;
  inset: 0;
  background: linear-gradient(150deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 360px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: #1a1a2e;
}

.login-logo p {
  color: #888;
  font-size: 0.85rem;
  margin-top: 4px;
}

.lf {
  margin-bottom: 14px;
}

.lf label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #555;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lf input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid #e0e4ea;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  color: #222;
}

.lf input:focus {
  border-color: #007bff;
}

.btn-login {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  display: none;
}

.login-msg.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  display: block;
}

/* ── App layout ── */
#app {
  display: none;
  height: 100vh;
}

#app.visible {
  display: flex;
}

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  background: #1a1a2e;
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
}

.sidebar-brand p {
  font-size: 0.72rem;
  color: #666;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-section {
  font-size: 0.65rem;
  font-weight: 700;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: #aaa;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.nav-item.active {
  background: rgba(0, 123, 255, 0.18);
  color: #60a5fa;
  font-weight: 700;
}

.nav-icon {
  font-size: 1rem;
  width: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #007bff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-chip {
  font-size: 0.68rem;
  color: #666;
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #aaa;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* ── Content area ── */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.content-topbar {
  height: 52px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  flex-shrink: 0;
}

.page-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-right: auto;
}

.site-select-top {
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid #e0e4ea;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #333;
  background: white;
  outline: none;
  cursor: pointer;
  min-width: 150px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1.5px solid #e0e4ea;
  border-radius: 8px;
  background: white;
  color: #555;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #f5f7fa;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
}

.status-dot.ok {
  background: #28a745;
}

.status-dot.err {
  background: #dc3545;
}

.status-text {
  font-size: 0.75rem;
  color: #888;
}

/* ── Pages ── */
.pages {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  flex-direction: column;
  gap: 14px;
}

.page.active {
  display: flex;
}

/* ── Vouchers page: 2 columns ── */
#page-vouchers.active {
  overflow: hidden;
  padding: 0;
}

.vouchers-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 14px;
  height: 100%;
  padding: 16px;
}

.vouchers-col-left {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.vouchers-col-right {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.batch-list {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-card {
  border: 1.5px solid #e0e4ea;
  border-radius: 10px;
  padding: 12px;
  background: #fafbfc;
}

.batch-card:hover {
  border-color: #c7d2fe;
  background: #f5f7ff;
}

.batch-card-name {
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
  word-break: break-all;
}

.batch-card-stats {
  font-size: 0.72rem;
  color: #888;
  margin-bottom: 8px;
  line-height: 1.4;
}

.batch-card-actions {
  display: flex;
  gap: 5px;
}

/* Columna izquierda */
.vouchers-col-left {
  overflow-y: hidden !important;
}

/* Aplicamos flexbox únicamente a la tarjeta de lotes */
#batchesCard {
  display: none; /* Se mantiene oculto por defecto */
  flex-direction: column;
  height: 100%;
}

/* Activamos el scroll vertical únicamente en la lista de lotes */
#batchesList.batch-list {
  overflow-y: auto;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-header h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #222;
  margin-right: auto;
}

.card-body {
  padding: 16px;
}

/* ── Search ── */
.search-wrap {
  padding: 10px 16px 0;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 32px;
  border: 1.5px solid #e0e4ea;
  border-radius: 9px;
  font-size: 0.85rem;
  color: #222;
  background: #fafbfc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 9px center;
  outline: none;
}

.search-input:focus {
  border-color: #007bff;
  background-color: white;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 380px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th {
  padding: 9px 13px;
  text-align: left;
  font-size: 0.71rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
  box-shadow: 0 1px 0 #f0f0f0;
}

td {
  padding: 9px 13px;
  border-bottom: 1px solid #f8f9fa;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafbfc;
}

.empty-state {
  text-align: center;
  padding: 28px;
  color: #aaa;
  font-size: 0.86rem;
}

.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
  gap: 5px;
}

.page-info-txt {
  font-size: 0.76rem;
  color: #888;
}

.pagination {
  display: flex;
  gap: 3px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1.5px solid #e0e4ea;
  border-radius: 6px;
  background: white;
  color: #555;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  background: #f5f7fa;
}

.page-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-ellipsis {
  font-size: 0.78rem;
  color: #aaa;
  padding: 0 2px;
}

/* ── Filter tabs ── */
.filter-row {
  display: flex;
  gap: 5px;
  padding: 8px 16px 0;
  flex-wrap: wrap;
  align-items: center;
}

.filter-tab {
  padding: 4px 10px;
  border: 1.5px solid #e0e4ea;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  background: white;
  color: #666;
}

.filter-tab.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

.per-page-select {
  height: 28px;
  padding: 0 6px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.76rem;
  color: #555;
  background: white;
  cursor: pointer;
  outline: none;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-valid {
  background: #ecfdf5;
  color: #065f46;
}

.badge-multi {
  background: #eff6ff;
  color: #1e40af;
}

.badge-used {
  background: #fffbeb;
  color: #92400e;
}

.badge-expired {
  background: #fef2f2;
  color: #991b1b;
}

.badge-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1a1a2e;
  letter-spacing: 0.8px;
}

.uso-cell {
  min-width: 140px;
}

.usage-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.usage-mac {
  font-family: 'Courier New', monospace;
  font-size: 0.73rem;
  color: #555;
}

.usage-time {
  font-size: 0.69rem;
  color: #999;
}

.usage-rest-ok {
  font-size: 0.71rem;
  font-weight: 600;
  color: #065f46;
}

.usage-rest-out {
  font-size: 0.71rem;
  font-weight: 600;
  color: #991b1b;
}

/* ── Buttons ── */
.btn-sm {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid;
  white-space: nowrap;
}

.btn-danger {
  border-color: #fca5a5;
  background: white;
  color: #dc3545;
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-warning {
  border-color: #fbbf24;
  background: white;
  color: #92400e;
}

.btn-warning:hover {
  background: #fffbeb;
}

.btn-info {
  border-color: #93c5fd;
  background: white;
  color: #1e40af;
}

.btn-info:hover {
  background: #eff6ff;
}

.btn-primary-sm {
  height: 34px;
  padding: 0 14px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary-sm:hover {
  background: #0056b3;
}

/* ── Forms ── */
.field {
  margin-bottom: 11px;
}

.field label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: #555;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field input,
.field select {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1.5px solid #e0e4ea;
  border-radius: 9px;
  font-size: 0.87rem;
  color: #222;
  background: #fafbfc;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: #007bff;
  background: white;
}

.form-msg {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 16px 10px;
  display: none;
}

.form-msg.show {
  display: block;
}

.form-msg.ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.form-msg.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ── Voucher presets ── */
.preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preset-btn {
  flex: 1;
  min-width: 40px;
  padding: 6px 3px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  background: white;
  color: #555;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.preset-btn:hover {
  border-color: #007bff;
  color: #007bff;
}

.preset-btn.active {
  background: #007bff;
  border-color: #007bff;
  color: white;
}

.custom-duration {
  display: none;
  gap: 6px;
  margin-top: 6px;
}

.custom-duration input {
  flex: 1;
  height: 32px;
  padding: 0 9px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.86rem;
  outline: none;
}

.custom-duration select {
  height: 32px;
  padding: 0 5px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.8rem;
  outline: none;
  background: white;
}

.quota-warning {
  display: none;
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.79rem;
  color: #92400e;
  margin-top: 7px;
}

.quota-warning.show {
  display: block;
}

.batch-preview-txt {
  font-size: 0.74rem;
  color: #007bff;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  margin-top: 4px;
  min-height: 1.1em;
}

/* ── Users ── */
.user-role-admin {
  background: #eff6ff;
  color: #1e40af;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.71rem;
  font-weight: 700;
}

.user-role-operator {
  background: #f0fdf4;
  color: #166534;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.71rem;
  font-weight: 700;
}

.create-user-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
  align-items: center;
}

@media(max-width:900px) {
  .create-user-form {
    grid-template-columns: 1fr 1fr;
  }
}

.create-user-form input,
.create-user-form select {
  height: 34px;
  padding: 0 9px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.83rem;
  outline: none;
  color: #222;
}

.create-user-form input:focus,
.create-user-form select:focus {
  border-color: #007bff;
}

/* ── Logs ── */
.log-filters {
  display: flex;
  gap: 7px;
  padding: 10px 16px 0;
  flex-wrap: wrap;
  align-items: center;
}

.log-filters input,
.log-filters select {
  height: 32px;
  padding: 0 9px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.8rem;
  outline: none;
  color: #222;
}

.log-filters input[type="date"] {
  width: 140px;
}

.log-filters select {
  width: 145px;
}

.log-source {
  font-size: 0.71rem;
  color: #aaa;
  margin-left: auto;
}

.action-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.ab-login {
  background: #eff6ff;
  color: #1e40af;
}

.ab-create_vouchers {
  background: #ecfdf5;
  color: #065f46;
}

.ab-delete_voucher {
  background: #fef2f2;
  color: #991b1b;
}

.ab-unauthorize_client {
  background: #fffbeb;
  color: #92400e;
}

.ab-site_add {
  background: #f0fdf4;
  color: #166534;
}

.ab-site_remove {
  background: #fef2f2;
  color: #991b1b;
}

.ab-user_create {
  background: #f5f3ff;
  color: #4c1d95;
}

.ab-user_delete {
  background: #fef2f2;
  color: #991b1b;
}

.ab-default {
  background: #f3f4f6;
  color: #374151;
}

.log-time {
  font-size: 0.77rem;
  font-family: 'Courier New', monospace;
  color: #555;
  white-space: nowrap;
}

.log-details {
  font-size: 0.74rem;
  color: #666;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* ── Modals ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  padding: 15px 18px 11px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h3 {
  font-size: 0.97rem;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
}

.modal-close {
  width: 27px;
  height: 27px;
  border: none;
  border-radius: 7px;
  background: #f3f4f6;
  color: #555;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal-close:hover {
  background: #e5e7eb;
}

.modal-body {
  padding: 16px;
}

.info-section {
  margin-bottom: 14px;
}

.info-section-title {
  font-size: 0.71rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 7px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #f8f9fa;
  font-size: 0.84rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: #888;
  font-size: 0.79rem;
}

.info-value {
  color: #222;
  font-weight: 600;
  text-align: right;
  max-width: 65%;
  word-break: break-all;
}

.device-card {
  background: #f8f9fa;
  border-radius: 9px;
  padding: 11px;
  margin-bottom: 7px;
}

.progress-bar-wrap {
  background: #e5e7eb;
  border-radius: 20px;
  height: 5px;
  margin: 7px 0 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: #007bff;
}

.progress-bar.expired {
  background: #dc3545;
}

.site-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.site-item:last-child {
  border-bottom: none;
}

.site-item-code {
  font-family: 'Courier New', monospace;
  font-size: 0.79rem;
  color: #555;
  min-width: 95px;
}

.site-item-name {
  font-size: 0.86rem;
  color: #222;
  font-weight: 600;
  flex: 1;
}

.btn-remove-site {
  width: 25px;
  height: 25px;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  background: white;
  color: #dc3545;
  cursor: pointer;
  font-size: 0.88rem;
}

.add-site-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
  margin-top: 11px;
}

.add-site-form input {
  height: 33px;
  padding: 0 9px;
  border: 1.5px solid #e0e4ea;
  border-radius: 7px;
  font-size: 0.84rem;
  outline: none;
  color: #222;
}

.add-site-form input:focus {
  border-color: #007bff;
}

.btn-add-site {
  height: 33px;
  padding: 0 11px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.print-src-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1.5px solid #e0e4ea;
  border-radius: 9px;
  cursor: pointer;
  margin-bottom: 5px;
}

.print-src-option:hover {
  border-color: #007bff;
  background: #f0f7ff;
}

.print-src-option label {
  cursor: pointer;
  font-size: 0.86rem;
  flex: 1;
}

.psrc-count {
  font-size: 0.79rem;
  font-weight: 700;
  color: #007bff;
}

.print-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 8px 0;
}

.print-layout-cell {
  background: #f8f9fa;
  border-radius: 7px;
  padding: 9px;
  text-align: center;
}

.plc-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #007bff;
}

.plc-lbl {
  font-size: 0.71rem;
  color: #888;
}

.print-preview-list {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid #f0f0f0;
  border-radius: 7px;
  font-size: 0.79rem;
}

.ppl-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-bottom: 1px solid #f8f9fa;
}

.ppl-row:last-child {
  border-bottom: none;
}

.ppl-code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: #1a1a2e;
  font-size: 0.8rem;
}

.ppl-meta {
  color: #999;
  font-size: 0.73rem;
  flex: 1;
}

.ppl-more {
  text-align: center;
  padding: 5px;
  color: #007bff;
  font-size: 0.76rem;
  font-style: italic;
}

.btn-print-main {
  width: 100%;
  height: 42px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  border: none;
  border-radius: 9px;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a1a2e;
  margin-right: auto;
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Print media ── */
#printArea {
  display: none;
}

@media print {
  body>*:not(#printArea) {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }

  @page {
    size: letter landscape;
    margin: 10mm;
  }

  .print-page {
    width: 259mm;
    height: 196mm;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2.5mm;
    box-sizing: border-box;
    page-break-after: always;
    break-after: page;
  }

  .print-page:last-child {
    page-break-after: avoid;
    break-after: avoid;
  }

  .pv {
    border: 0.4pt solid #ccc;
    border-radius: 2mm;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5mm 2mm;
    background: white;
    text-align: center;
  }

  .pv-empty {
    border-color: transparent;
    background: transparent;
  }

  .pv-logo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.12;
    padding: 3mm;
    pointer-events: none;
  }

  .pv-net {
    font-size: 5.5pt;
    font-weight: 700;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.3pt;
  }

  .pv-code {
    font-size: 13pt;
    font-family: 'Courier New', monospace;
    font-weight: 800;
    color: #111;
    letter-spacing: 1pt;
    margin: 1mm 0 0.5mm;
    line-height: 1;
  }

  .pv-dur {
    font-size: 9pt;
    color: #333;
    font-weight: 700;
  }

  .pv-note {
    font-size: 5.5pt;
    color: #888;
    margin-top: 0.5mm;
  }

  .pv-biz {
    font-size: 5pt;
    color: #aaa;
    position: absolute;
    bottom: 1mm;
  }
}