/* ==========================================================================
   Fabian Books - ISBN & QR Code Suite Stylesheet
   Designed for Print Precision, Speed & Publisher Productivity
   ========================================================================== */

:root {
  --header-height: 128px;
  --primary: #1e3a8a;          /* Deep Publisher Blue */
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #d97706;           /* Fabian Books Warm Gold */
  --accent-light: #fef3c7;
  --secondary: #475569;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-times: 'Times New Roman', Times, Baskerville, Georgia, serif;
}

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

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 0.85rem 2rem;
  box-shadow: var(--shadow-md);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 500;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-nav-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, #b45309 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}

.brand-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: -2px;
}

.nav-tabs {
  display: flex;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.5rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-wrapper {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto 1.5rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeInTab 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInTab {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Secondary tab sections keep comfortable breathing space below the header */
#uploadSection,
#singleSection,
#usersSection,
#logsSection {
  padding-top: 1rem;
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Upload Drop Zone
   ========================================================================== */
.dropzone {
  border: 2px dashed #93c5fd;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  display: inline-block;
}

.dropzone-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.dropzone-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.dropzone-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-input-hidden {
  display: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(30, 58, 138, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.4);
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-accent:hover {
  background: #b45309;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #047857;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(40%);
  box-shadow: none !important;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Table Toolbar (Search, Stats, Bulk Actions)
   ========================================================================== */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: var(--header-height, 128px);
  z-index: 90;
  transition: box-shadow 0.2s ease, top 0.15s ease;
}

.toolbar-primary-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.search-box {
  position: relative;
  flex: 0 1 260px;
  min-width: 160px;
  max-width: 300px;
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.85rem;
}

.toolbar-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.stat-chip {
  background: var(--surface-subtle);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-main);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.stat-chip.selected {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #bfdbfe;
}

#btnToolbarSelectAll {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 3px 8px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: all 0.15s ease;
}

#btnToolbarClearSelection {
  display: none;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  padding: 3px 8px;
  font-weight: 600;
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

#btnToolbarClearSelection:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
}

.toolbar-actions-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.toolbar-actions .btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Desktop: Upload New Excel in table toolbar is hidden (desktop uses top nav tab) */
.toolbar-actions #btnGoToUpload {
  display: none !important;
}

/* Centered 2-Row Layout on Medium Screens & Tablets:
   When viewport becomes narrow (<= 1100px) or unmaximized,
   gracefully split into two centered rows with balanced spacing */
@media (max-width: 1100px) and (min-width: 769px) {
  .table-toolbar {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.75rem 1rem !important;
  }

  .toolbar-primary-group {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    gap: 0.65rem !important;
    flex-wrap: wrap !important;
  }

  .toolbar-primary-group .search-box {
    flex: 0 1 280px !important;
    min-width: 190px !important;
    max-width: 320px !important;
  }

  .toolbar-primary-group .toolbar-stats {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    flex-wrap: wrap !important;
  }

  .toolbar-actions-group {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding-top: 0.55rem !important;
    border-top: 1px dashed rgba(226, 232, 240, 0.95) !important;
  }

  .toolbar-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  .toolbar-actions .btn {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.8rem !important;
  }
}

/* ==========================================================================
   Data Table
   ========================================================================== */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.table-scroll {
  max-height: calc(100vh - var(--header-height, 128px) - 130px);
  min-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
}

.logs-table-card {
  padding: 0;
  overflow: hidden;
}

.logs-table-container {
  max-height: 600px;
  overflow-y: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table thead {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border);
}

.custom-table th {
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary);
  border-bottom: 2px solid var(--border);
  user-select: none;
}

.custom-table th.sortable {
  cursor: pointer;
  transition: background-color 0.15s;
}

.custom-table th.sortable:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}

.custom-table th .sort-indicator {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  color: var(--accent);
}

.custom-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: background-color 0.15s;
}

.custom-table tbody tr:not(.skeleton-row) {
  animation: rowFadeIn 0.15s ease-out;
}

@keyframes rowFadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Skeleton Loading Placeholder */
.skeleton-row td {
  padding: 1.25rem 1rem !important;
  background: #ffffff !important;
  border-bottom: 1px solid #f1f5f9;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s infinite ease-in-out;
}

.skeleton-line.skeleton-title {
  width: 60%;
  height: 16px;
}

.skeleton-line.skeleton-sub {
  width: 35%;
  height: 12px;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.custom-table tbody tr:hover {
  background-color: #f8fafc;
}

.custom-table tbody tr.row-selected {
  background-color: #eff6ff !important;
}

/* Row Checkbox & Drag Handle */
.col-check {
  width: 44px;
  text-align: center;
}

.row-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--primary);
}

.book-title-cell {
  font-weight: 600;
  color: var(--text-main);
  max-width: 320px;
}

.book-title-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-top: 2px;
}

/* ISBN Cell with Times New Roman standard */
.isbn-cell {
  font-family: var(--font-times);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #1e293b;
}

.url-cell {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-link {
  color: var(--info);
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.url-link:hover {
  text-decoration: underline;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #a7f3d0;
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid #bae6fd;
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.badge-muted {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
}

.badge-muted:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Inline Edit Tooltips */
.editable-hint {
  font-size: 0.7rem;
  color: var(--text-light);
  cursor: pointer;
  margin-left: 0.35rem;
}

/* ==========================================================================
   Table Meta Field Wrappers & Labels
   ========================================================================== */
.col-mobile-label {
  display: none;
}
.desktop-only-inline {
  display: inline;
}
.meta-field-wrap {
  display: contents;
}
.meta-field-val {
  display: contents;
}

/* ==========================================================================
/* ==========================================================================
   Floating Action Bar (Mobile Only - Hidden on Desktop)
   ========================================================================== */
.floating-action-bar {
  display: none !important;
}

/* ==========================================================================
   Single Generator Form
   ========================================================================== */
.generator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .generator-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.single-secondary-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-label span.req {
  color: var(--danger);
}

.form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Live Preview Box */
.preview-pane {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  min-height: 360px;
  box-sizing: border-box;
}

.preview-tag-box {
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 8px;
  padding: 1.25rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-md);
  margin-bottom: 1rem;
}

.tag-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.4rem;
}

.tag-author {
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 0.75rem;
}

.tag-codes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tag-barcode-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.tag-qr-wrap {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.preview-card-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: var(--transition-base);
  width: 100%;
  box-sizing: border-box;
}

.preview-card-item:hover {
  border-color: #cbd5e1;
}

.preview-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.preview-card-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.02em;
}

.preview-box-clean {
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.url-edit-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 100%;
}

.url-edit-badge:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.toolbar-actions .btn:hover {
  transform: translateY(-1px);
}

/* Activity Logs Toolbar (Desktop) */
.logs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.logs-primary-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
}

.logs-primary-group .search-box {
  flex: 0 1 360px;
  max-width: 420px;
}

.logs-actions-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.logs-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.btn-clear-text-short {
  display: none;
}

.btn-clear-text-full {
  display: inline;
}

.url-badge-readonly {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: default;
  max-width: 100%;
}

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

.isbn-status-tag {
  font-size: 0.72rem;
  margin-top: 2px;
}
.isbn-status-tag.isbn-valid {
  color: #059669;
}
.isbn-status-tag.isbn-invalid {
  color: #e11d48;
  font-weight: 600;
}

/* Single Generator Download Actions (Desktop & Base) */
.single-actions-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  margin-top: 1.5rem;
  box-sizing: border-box;
}

.single-actions-wrap #btnDownloadSingleTag {
  width: 100%;
  justify-content: center;
  font-weight: 600;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  box-sizing: border-box;
}

.single-sub-actions {
  display: flex;
  gap: 0.65rem;
  width: 100%;
  box-sizing: border-box;
}

.single-sub-actions #btnDownloadSingleBarcode,
.single-sub-actions #btnDownloadSingleQr {
  flex: 1;
  width: 50%;
  min-width: 0;
  justify-content: center;
  padding: 0.65rem 0.6rem;
  font-size: 0.86rem;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Modal Barcode & QR Preview Box (Balanced Desktop Sizing) */
.modal-preview-box {
  background: #ffffff;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.modal-preview-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 36px;
  width: 100%;
}

.modal-preview-actions .btn {
  min-height: 34px;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000 !important;
  padding: 1rem;
  overflow-y: auto;
}

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

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Progress bar inside modal */
.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  width: 0%;
  transition: width 0.15s ease;
}

/* ==========================================================================
   Toast Notifications
   Desktop: Positioned at Bottom-Left to prevent covering the header or tools
   Mobile: Positioned at Bottom-Center (defined in responsive media query)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  right: auto;
  top: auto;
  display: flex;
  flex-direction: column-reverse; /* Stack toasts cleanly upward */
  gap: 0.5rem;
  z-index: 999999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.25);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideInBottomLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-width: 400px;
  backdrop-filter: blur(8px);
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast.toast-info {
  border-left: 4px solid var(--info);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

@keyframes slideInBottomLeft {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  width: 100%;
}

.footer-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.catalog-help-tip {
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Authentication & Login Screen
/* Zero-flicker session state guard:
   When no session is present, keep portal content hidden.
/* Zero-flicker session state guard:
   When no session is present, keep portal content hidden.
   When session is present, immediately hide the login overlay from frame 0. */
html:not(.has-auth-session) .app-header,
html:not(.has-auth-session) .main-wrapper,
html:not(.has-auth-session) .app-footer,
html:not(.has-auth-session) .floating-bar {
  display: none !important;
}

/* User session bar in header (Desktop only) & mobile drawer user */
.user-session-bar,
.mobile-nav-user {
  display: none;
}

@media (min-width: 769px) {
  html.has-auth-session .user-session-bar {
    display: flex !important;
  }
}

html.has-auth-session .mobile-nav-user {
  display: block !important;
}

/* Role guards: Base state hides all admin-only controls by default */
.admin-only {
  display: none !important;
}

html.user-printer .admin-only,
body.user-printer .admin-only {
  display: none !important;
}

html.user-admin .tab-btn.admin-only,
body.user-admin .tab-btn.admin-only {
  display: flex !important;
}

html.user-admin .mobile-nav-item.admin-only,
body.user-admin .mobile-nav-item.admin-only {
  display: flex !important;
}

html.user-admin .btn.admin-only,
body.user-admin .btn.admin-only {
  display: inline-flex !important;
}

/* Login Overlay: Hidden by default so it never flashes or drops over authenticated users */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at top right, rgba(30, 58, 138, 0.95), rgba(15, 23, 42, 0.98));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

/* Show only when explicitly unauthenticated */
html.unauthenticated .login-overlay,
body.unauthenticated .login-overlay,
html:not(.has-auth-session) .login-overlay {
  display: flex !important;
}

html.has-auth-session .login-overlay,
body.authenticated .login-overlay {
  display: none !important;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  max-width: 440px;
  width: 100%;
  padding: 2.5rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.login-brand-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--accent) 0%, #b45309 100%);
  color: #ffffff;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 0 10px 15px -3px rgba(217, 119, 6, 0.4);
  margin-bottom: 1rem;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.login-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin-top: 0.25rem;
  margin-bottom: 1.75rem;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecdd3;
  color: #be123c;
  font-size: 0.82rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: none;
  text-align: left;
}

/* Password Input Wrapper & Cute Animated Eye Toggle */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper .form-input {
  width: 100%;
  padding-right: 2.85rem !important;
}

.btn-password-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  color: #64748b;
  transition: color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  z-index: 2;
}

.btn-password-toggle:hover {
  background: rgba(30, 58, 138, 0.08);
  color: #1e3a8a;
  transform: translateY(-50%) scale(1.12);
}

.btn-password-toggle:active {
  transform: translateY(-50%) scale(0.92);
}

.btn-password-toggle:focus-visible {
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.35);
}

.cute-eye-icon {
  display: block;
  overflow: visible;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Default State: Closed cute eye with peaceful curved eyelid & lashes */
.eye-group-closed {
  opacity: 1;
  transform-origin: 12px 12px;
  transform: scale(1);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.eye-group-open {
  opacity: 0;
  transform-origin: 12px 12px;
  transform: scale(0.4) scaleY(0.2);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Fluttering eyelash micro-animation on hover */
.btn-password-toggle:not(.is-visible):hover .eye-lash-1 {
  animation: lashFlutterLeft 0.5s ease-in-out infinite alternate;
}
.btn-password-toggle:not(.is-visible):hover .eye-lash-2 {
  animation: lashFlutterCenter 0.5s ease-in-out 0.1s infinite alternate;
}
.btn-password-toggle:not(.is-visible):hover .eye-lash-3 {
  animation: lashFlutterRight 0.5s ease-in-out 0.2s infinite alternate;
}

@keyframes lashFlutterLeft {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-10deg); }
}
@keyframes lashFlutterCenter {
  0% { transform: translateY(0); }
  100% { transform: translateY(1.2px); }
}
@keyframes lashFlutterRight {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(10deg); }
}

/* Active / Visible State: Cute open eye blinking, glancing, and sparkling */
.btn-password-toggle.is-visible {
  color: #1e3a8a;
}

.btn-password-toggle.is-visible .eye-group-closed {
  opacity: 0;
  transform: scale(0.4) scaleY(0.2);
}

.btn-password-toggle.is-visible .eye-group-open {
  opacity: 1;
  transform: scale(1);
  animation: eyeBlinkPeek 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-password-toggle.is-visible .eye-pupil-group {
  transform-origin: 12px 12px;
  animation: pupilGlance 1.4s ease-in-out infinite alternate;
}

.btn-password-toggle.is-visible .eye-sparkle-main {
  transform-origin: 10.4px 10px;
  animation: sparkleGleam 1.4s ease-in-out infinite alternate;
}

@keyframes eyeBlinkPeek {
  0% { transform: scale(0.5) scaleY(0.1); }
  45% { transform: scale(1.18); }
  75% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes pupilGlance {
  0% { transform: translate(0, 0); }
  35% { transform: translate(1.4px, -0.6px); }
  70% { transform: translate(-1.2px, 0.4px); }
  100% { transform: translate(0, 0); }
}

@keyframes sparkleGleam {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.9; }
}

/* User Session Bar in Header */
.user-session-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-pill {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #ffffff;
}

.user-pill.printer {
  background: #0284c7;
}

.user-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: #ffffff;
}

/* ==========================================================================
   Activity Logs Table & Users Management
   ========================================================================== */
.badge-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.badge-action.badge-download {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.badge-action.badge-search {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.badge-action.badge-auth {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.badge-action.badge-admin {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}
.badge-action.badge-assign {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.badge-action.badge-export {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.badge-action.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.users-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) {
  .users-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Deduplication & Conflict Resolution Modal
   ========================================================================== */
.dedup-summary {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.dedup-stat-chip {
  flex: 1;
  min-width: 140px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  text-align: center;
}

.dedup-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.dedup-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.dedup-stat-chip.warning {
  background: #fffbeb;
  border-color: #fde68a;
}
.dedup-stat-chip.warning .dedup-stat-num {
  color: #b45309;
}

.dedup-stat-chip.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.dedup-stat-chip.success .dedup-stat-num {
  color: #047857;
}

.conflict-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  margin-bottom: 1.5rem;
}

.conflict-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.conflict-item:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Mobile Navigation Drawer & Hamburger Button
   ========================================================================== */
.btn-mobile-menu {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  color: #ffffff;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-mobile-menu:hover,
.btn-mobile-menu:active {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0.96);
}

.btn-mobile-menu span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 2px;
}

.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-nav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(85vw, 320px);
  height: 100%;
  background: #0f172a;
  color: #ffffff;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.25rem;
  box-sizing: border-box;
  overflow-y: auto;
}

.mobile-nav-overlay.open .mobile-nav-drawer {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1rem;
}

.mobile-nav-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s ease;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.mobile-nav-user {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1.25rem;
}

.mobile-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.mobile-nav-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.mobile-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.mobile-nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.mobile-nav-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.mobile-nav-text {
  display: flex;
  flex-direction: column;
}

.mobile-nav-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.mobile-nav-desc {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1px;
}

.mobile-nav-item.active .mobile-nav-desc {
  color: rgba(255, 255, 255, 0.8);
}

.mobile-nav-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Mobile Responsive Styles (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --header-height: 52px;
  }

  html, body {
    max-width: 100vw;
    overflow-x: clip;
  }

  /* 1. Header & Navigation */
  .app-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 52px !important;
    box-sizing: border-box !important;
    z-index: 500 !important;
    padding: 0.45rem 0.85rem !important;
  }

  .header-container {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0 !important;
  }

  .header-top-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  .header-nav-row {
    display: none !important;
  }

  .brand-section {
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  /* Mobile: Hide subtitle, badge, desktop tabs, and desktop session bar */
  .brand-subtitle {
    display: none !important;
  }

  .brand-badge {
    display: none !important;
  }

  .nav-tabs {
    display: none !important;
  }

  .user-session-bar,
  html.has-auth-session .user-session-bar,
  body.authenticated .user-session-bar {
    display: none !important;
  }

  /* Show hamburger button on mobile */
  .btn-mobile-menu {
    display: flex !important;
  }

  .desktop-only-inline {
    display: none !important;
  }

  /* 2. Main Wrapper & Footer */
  .main-wrapper {
    margin: 0 auto 1rem auto;
    padding: 0 0.65rem;
  }

  .app-footer {
    padding: 1rem 0.65rem;
  }

  #uploadSection,
  #singleSection,
  #usersSection,
  #logsSection {
    padding-top: 0.65rem;
  }

  /* 3. Table Toolbar (Sticky on Mobile directly below Header) */
  #catalogSection .table-toolbar,
  #logsSection .table-toolbar,
  .logs-toolbar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 52px !important;
    z-index: 450 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
    padding: 0.55rem 0.7rem !important;
    gap: 0.45rem !important;
    margin-top: 0 !important;
    margin-bottom: 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
    transition: box-shadow 0.2s ease !important;
  }

  .logs-actions-group {
    display: flex !important;
    width: 100% !important;
    padding-top: 0.35rem !important;
    border-top: 1px dashed #e2e8f0 !important;
  }

  .logs-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 0.35rem !important;
  }

  .logs-actions .btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    justify-content: center !important;
    padding: 0.42rem 0.2rem !important;
    font-size: 0.74rem !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .logs-actions .btn span:first-child {
    margin-right: 2px !important;
  }

  .btn-clear-text-full {
    display: none !important;
  }

  .btn-clear-text-short {
    display: inline !important;
  }

  .toolbar-primary-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.4rem !important;
  }

  .toolbar-actions-group {
    display: flex !important;
    width: 100% !important;
    padding-top: 0.35rem !important;
    border-top: 1px dashed #e2e8f0 !important;
  }

  .search-box {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 38px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .search-input {
    display: block !important;
    width: 100% !important;
    height: 38px !important;
    font-size: 0.84rem !important;
    padding: 0 0.75rem 0 2.2rem !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
    outline: none !important;
    background: #ffffff !important;
  }

  /* Activity Logs: Row 1 has search input on left and events count on right */
  #logsSection .logs-primary-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #logsSection .search-box {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 38px !important;
    box-sizing: border-box !important;
  }

  #logsSection .search-input {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 38px !important;
    box-sizing: border-box !important;
  }

  #logsSection .logs-stats {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    width: auto !important;
    min-width: auto !important;
  }

  #logsSection .logs-stats #logCountStat {
    padding: 0.32rem 0.55rem !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    background: #eff6ff !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
    border-radius: var(--radius-sm) !important;
    line-height: 1.2 !important;
  }

  .search-icon {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
    pointer-events: none !important;
    line-height: 1 !important;
    z-index: 2 !important;
  }

  .toolbar-stats {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    width: 100% !important;
    gap: 0.25rem !important;
    margin: 0 !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .toolbar-stats::-webkit-scrollbar {
    display: none !important;
  }

  .stat-chip {
    padding: 0.16rem 0.38rem !important;
    font-size: 0.68rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  #btnToolbarClearSelection {
    font-size: 0.68rem !important;
    padding: 0.16rem 0.42rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  #btnToolbarSelectAll {
    margin-left: auto !important;
    font-size: 0.68rem !important;
    padding: 0.16rem 0.42rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .toast-container {
    top: auto !important;
    bottom: 1.25rem !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: max-content !important;
    max-width: calc(100vw - 2rem) !important;
    z-index: 999999 !important;
    align-items: center !important;
    flex-direction: column-reverse !important;
  }

  .toast {
    max-width: 100% !important;
    width: auto !important;
    justify-content: center !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4) !important;
    animation: slideInBottomCenter 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-size: 0.82rem !important;
    padding: 0.65rem 1rem !important;
  }

  @keyframes slideInBottomCenter {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .toolbar-actions {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
    margin: 0 !important;
  }

  /* Admin Action Buttons (Mobile < 768px):
     Row 1 (3 items in single row): ZIP, Assign, Delete
     Row 2 (2 items in second row): Upload Excel, All ZIP
     Saves vertical space and eliminates clumsy 3rd row
  */
  html.user-admin .toolbar-actions #btnToolbarDownloadSelected,
  body.user-admin .toolbar-actions #btnToolbarDownloadSelected,
  html.user-admin .toolbar-actions #btnToolbarAssignSelected,
  body.user-admin .toolbar-actions #btnToolbarAssignSelected,
  html.user-admin .toolbar-actions #btnToolbarDeleteSelected,
  body.user-admin .toolbar-actions #btnToolbarDeleteSelected {
    display: inline-flex !important;
    flex: 1 1 calc((100% - 0.7rem) / 3) !important;
    max-width: calc((100% - 0.7rem) / 3) !important;
    min-width: 0 !important;
    padding: 0.45rem 0.25rem !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.25rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
  }

  html.user-admin .toolbar-actions #btnGoToUpload,
  body.user-admin .toolbar-actions #btnGoToUpload,
  html.user-admin .toolbar-actions #btnBulkExport,
  body.user-admin .toolbar-actions #btnBulkExport {
    display: inline-flex !important;
    flex: 1 1 calc((100% - 0.35rem) / 2) !important;
    max-width: calc((100% - 0.35rem) / 2) !important;
    min-width: 0 !important;
    padding: 0.45rem 0.5rem !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
  }

  /* Printer & Unauthenticated View: Download ZIP & Download All as ZIP (50% - 50% in 1 row) */
  html.user-printer .toolbar-actions #btnToolbarDownloadSelected,
  body.user-printer .toolbar-actions #btnToolbarDownloadSelected,
  html.user-printer .toolbar-actions #btnBulkExport,
  body.user-printer .toolbar-actions #btnBulkExport,
  html.unauthenticated .toolbar-actions #btnToolbarDownloadSelected,
  body.unauthenticated .toolbar-actions #btnToolbarDownloadSelected,
  html.unauthenticated .toolbar-actions #btnBulkExport,
  body.unauthenticated .toolbar-actions #btnBulkExport {
    display: inline-flex !important;
    flex: 1 1 calc(50% - 0.2rem) !important;
    min-width: 0 !important;
    padding: 0.48rem 0.5rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-sm) !important;
  }

  html.user-printer .toolbar-actions #btnToolbarAssignSelected,
  body.user-printer .toolbar-actions #btnToolbarAssignSelected,
  html.user-printer .toolbar-actions #btnToolbarDeleteSelected,
  body.user-printer .toolbar-actions #btnToolbarDeleteSelected,
  html.user-printer .toolbar-actions #btnGoToUpload,
  body.user-printer .toolbar-actions #btnGoToUpload,
  html.unauthenticated .toolbar-actions #btnToolbarAssignSelected,
  body.unauthenticated .toolbar-actions #btnToolbarAssignSelected,
  html.unauthenticated .toolbar-actions #btnToolbarDeleteSelected,
  body.unauthenticated .toolbar-actions #btnToolbarDeleteSelected,
  html.unauthenticated .toolbar-actions #btnGoToUpload,
  body.unauthenticated .toolbar-actions #btnGoToUpload {
    display: none !important;
  }

  /* 4. Book Catalog: Table to Cards Transformation */
  #catalogSection .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  #catalogSection .table-scroll {
    max-height: none;
    overflow-x: visible;
    overflow-y: visible;
  }

  #catalogSection .custom-table,
  #catalogSection .custom-table tbody {
    display: block;
    width: 100%;
  }

  #catalogSection .custom-table thead {
    display: none;
  }

  #catalogSection .custom-table tr {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    transition: all 0.2s ease;
    gap: 0.4rem;
  }

  #catalogSection .custom-table tr.row-selected {
    background: #f0f7ff;
    border-color: #3b82f6;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
  }

  #catalogSection .custom-table td {
    display: block;
    padding: 0;
    border: none;
    width: 100%;
  }

  /* Card Top Row: Checkbox on Left, Status Badge on Right */
  #catalogSection .custom-table td.col-check {
    order: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 26px;
    margin-bottom: 0.2rem;
    cursor: pointer;
    user-select: none;
  }

  #catalogSection .custom-table td.col-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
  }

  #catalogSection .custom-table td.col-check::after {
    content: "Select Book";
    font-size: 0.76rem;
    font-weight: 600;
    color: #64748b;
  }

  #catalogSection .custom-table tr.row-selected td.col-check::after {
    content: "Selected";
    color: #2563eb;
    font-weight: 700;
  }

  #catalogSection .custom-table td.col-status {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: auto;
    z-index: 2;
  }

  #catalogSection .custom-table td.col-status .badge {
    font-size: 0.7rem;
    padding: 0.22rem 0.55rem;
    font-weight: 600;
  }

  /* Card Row 2: Book Title (100% full width, no overlapping) */
  #catalogSection .custom-table td.book-title-cell {
    order: 2;
    padding: 0;
    margin-bottom: 0.35rem;
    width: 100%;
  }

  #catalogSection .custom-table td.book-title-cell span {
    font-size: 0.98rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    display: block;
  }

  #catalogSection .book-title-sub {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 3px;
  }

  /* Card Row 3: ISBN Row */
  #catalogSection .custom-table td.col-isbn {
    order: 3;
    width: 100%;
    display: block;
    padding: 0.1rem 0;
  }

  /* Card Row 4: URL Row */
  #catalogSection .custom-table td.col-url,
  #catalogSection .custom-table td.col-url.url-cell {
    order: 4;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    padding: 0.1rem 0;
    box-sizing: border-box !important;
  }

  .meta-field-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    box-sizing: border-box;
    width: 100%;
  }

  .col-mobile-label {
    display: inline-block !important;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 42px;
    flex-shrink: 0;
  }

  .meta-field-val {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
  }

  /* Card Row 3 (ISBN): Number on Left, Valid ISBN-13 pinned to the Right */
  .col-isbn .meta-field-val {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex: 1 !important;
    min-width: 0 !important;
    gap: 0.4rem !important;
  }

  .col-isbn .isbn-cell {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    flex-shrink: 0 !important;
  }

  .col-isbn .isbn-status-tag {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    text-align: right !important;
    white-space: nowrap !important;
    margin-top: 0 !important;
  }

  .col-isbn .isbn-status-tag.isbn-valid {
    color: #059669 !important;
  }

  .col-isbn .isbn-status-tag.isbn-invalid {
    color: #e11d48 !important;
  }

  /* Card Row 4 (LINK): Expands to full 100% width, accommodating maximum content */
  .col-url .meta-field-wrap {
    width: 100% !important;
  }

  .col-url .meta-field-val {
    display: flex !important;
    flex: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .meta-field-val .url-cell,
  .meta-field-val .url-badge-readonly,
  .meta-field-val .url-edit-badge {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0.32rem 0.55rem !important;
    font-size: 0.78rem !important;
    overflow: hidden !important;
  }

  .meta-field-val .url-text {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
  }

  .meta-field-val .badge {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Card Row 5: Actions */
  #catalogSection .custom-table td.col-actions {
    order: 5;
    margin-top: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  #catalogSection .custom-table td.col-actions .btn {
    padding: 0.42rem 0.8rem;
    font-size: 0.8rem;
  }

  #catalogSection .custom-table td.col-actions button:first-child {
    flex: 1;
    justify-content: center;
  }

  /* 5. Single Generator: Responsive Mobile Card & Preview Sizing */
  #singleSection {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #singleSection .generator-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.15rem !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  #singleSection .card,
  #singleSection .preview-pane {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 1.15rem 1rem !important;
    border-radius: var(--radius-lg) !important;
    box-sizing: border-box !important;
    box-shadow: var(--shadow-sm) !important;
    background: #ffffff !important;
    overflow: hidden !important;
  }

  #singleSection .card-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    font-size: 1.05rem !important;
    padding-bottom: 0.6rem !important;
    margin-bottom: 1rem !important;
  }

  #singleSection .form-group {
    margin-bottom: 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #singleSection .form-label {
    font-size: 0.84rem !important;
    margin-bottom: 0.35rem !important;
  }

  #singleSection .form-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0.6rem 0.75rem !important;
    font-size: 0.88rem !important;
  }

  #singleSection .form-hint {
    font-size: 0.75rem !important;
    line-height: 1.35 !important;
  }

  .single-actions-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.55rem !important;
    width: 100% !important;
    margin-top: 1.25rem !important;
    box-sizing: border-box !important;
  }

  .single-actions-wrap #btnDownloadSingleTag {
    width: 100% !important;
    padding: 0.65rem 0.85rem !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  .single-sub-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.55rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .single-sub-actions #btnDownloadSingleBarcode,
  .single-sub-actions #btnDownloadSingleQr {
    width: 100% !important;
    flex: none !important;
    padding: 0.62rem 0.85rem !important;
    font-size: 0.84rem !important;
    font-weight: 600 !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  #singleSection .preview-pane {
    align-items: stretch !important;
    justify-content: flex-start !important;
    min-height: auto !important;
    text-align: center !important;
  }

  #singleSection .preview-card-item {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden !important;
  }

  #singleSection .preview-box-clean {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.5rem !important;
    overflow: hidden !important;
  }

  #singleTagCanvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    border-radius: 6px !important;
    object-fit: contain !important;
  }

  #singleBarcodeCanvas {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
  }

  .single-secondary-previews {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 0.75rem !important;
    box-sizing: border-box !important;
  }

  @media (max-width: 480px) {
    .single-secondary-previews {
      grid-template-columns: 1fr !important;
    }
  }

  /* 6. Printer Users Management: Table to Card Transformation (No horizontal overflow) */
  #usersSection .table-container {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #usersSection .custom-table,
  #usersSection .custom-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #usersSection .custom-table thead {
    display: none;
  }

  #usersSection .custom-table tr.user-card-row {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
  }

  #usersSection .custom-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.15rem 0;
    border: none;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.86rem;
  }

  #usersSection .custom-table td.col-user-action {
    margin-top: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
    justify-content: flex-end;
  }

  #usersSection .custom-table .col-mobile-label {
    display: inline-block !important;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 75px;
  }

  /* 7. Activity Logs & Audit Trail: Table to Card Transformation (Natural full page scroll like catalog) */
  #logsSection .card,
  #logsSection .logs-card,
  #logsSection .logs-table-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  #logsSection .table-container,
  #logsSection .logs-table-container {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  #logsSection .custom-table,
  #logsSection .custom-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #logsSection .custom-table thead {
    display: none;
  }

  #logsSection .custom-table tr.log-card-row {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
  }

  #logsSection .custom-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.2rem 0;
    border: none;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.86rem;
    gap: 0.5rem;
  }

  #logsSection .custom-table td.col-log-time {
    border-bottom: 1px dashed #f1f5f9;
    padding-bottom: 0.4rem;
    margin-bottom: 0.2rem;
  }

  #logsSection .custom-table td.col-log-details {
    border-top: 1px dashed #f1f5f9;
    padding-top: 0.4rem;
    margin-top: 0.2rem;
  }

  #logsSection .custom-table .col-mobile-label {
    display: inline-block !important;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 60px;
    flex-shrink: 0;
  }

  /* 5. Floating Action Bar: Permanently removed on mobile as requested */
  .floating-action-bar,
  .floating-action-bar.visible {
    display: none !important;
  }

  /* Hide desktop keyboard Shift instructions on mobile */
  .shift-select-tip {
    display: none !important;
  }

  /* 6. Modals on Mobile */
  .modal-overlay {
    z-index: 10000 !important;
    padding: 0.5rem !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: auto !important;
    max-height: 94vh !important;
    border-radius: 14px !important;
  }

  .modal-header {
    padding: 0.85rem 1rem !important;
    position: sticky !important;
    top: 0 !important;
    background: #ffffff !important;
    z-index: 10 !important;
  }

  .modal-title {
    font-size: 1rem !important;
  }

  .modal-body {
    padding: 1rem !important;
    max-height: calc(94vh - 110px) !important;
    overflow-y: auto !important;
  }

  #previewModal .modal-body > div:last-child {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }

  /* 7. Canvas responsive scale */
  #modalTagCanvas,
  #modalBarcodeCanvas,
  #singleBarcodeCanvas,
  #singleTagCanvas {
    max-width: 100% !important;
    height: auto !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .shift-select-tip {
    display: none !important;
  }
}

/* =========================================================================
   Infinite Scroll Sentinel & Loading Spinner
   ========================================================================= */
.infinite-scroll-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.1rem 1rem;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 500;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.infinite-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: infinite-spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

/* =========================================================================
   Global Database Selection Banner
   ========================================================================= */
.global-select-banner {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #1e40af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  animation: fadeInBanner 0.2s ease-out;
}

.global-select-banner strong {
  color: #1d4ed8;
  font-weight: 700;
}

.btn-link-banner {
  background: none;
  border: none;
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  margin-left: 4px;
  transition: color 0.15s ease;
}

.btn-link-banner:hover {
  color: #1e40af;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

