/* KeeBee — Mobile-first styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────── */
/* ── Startup Search Popup Styles ── */
.startup-search-modal {
  max-width: 600px !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
  overflow: hidden;
  animation: modalScaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.startup-search-input-wrap {
  position: relative;
  margin: 10px 0 20px 0;
}

.startup-search-input {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.4rem;
  font-weight: 500;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  background: white;
  color: #1e293b;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.startup-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
}

.startup-search-results {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 12px;
  margin-top: 10px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  background: white;
  border: 1px solid #f1f5f9;
}

.search-result-item:hover {
  background: #f8fafc;
  transform: translateX(4px);
  border-color: #cbd5e1;
}

.search-result-color {
  width: 12px;
  height: 44px;
  border-radius: 4px;
  margin-right: 16px;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  gap: 12px;
  align-items: center;
}

.search-result-stock {
  font-weight: 800;
  color: #1e293b;
  font-size: 1.1rem;
}

.search-result-brand {
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-loc {
  font-weight: 700;
  color: #64748b;
  font-size: 0.85rem;
  text-align: right;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.search-empty-msg {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
  font-style: italic;
  font-size: 1.1rem;
}

/* ────────────────────────────────── */

:root {
  --primary: #1a1a2e;
  --primary-dark: #12122a;
  --accent: #e94560;
  --accent-hover: #c73652;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --cell-empty: #dde1e7;
  --cell-empty-border: #c5cad3;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
  --transition: 0.2s ease;
  --header-height: 56px;
}

/* ─── Header Search ──────────────────────────────────── */
.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  max-width: 160px;
  margin: 0 auto;
  padding: 4px 6px;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  transition: border-color var(--transition), background var(--transition);
}

.header-search:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.3);
}

.search-input-header {
  font-family: inherit;
  font-size: 0.95rem;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  width: 100%;
  min-width: 0;
  color: #fff;
}

.header-search:focus-within .search-input-header {
  color: var(--text);
}

.search-input-header::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.header-search:focus-within .search-input-header::placeholder {
  color: var(--text-muted);
}

.search-btn-header {
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}

.search-btn-header:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.search-btn-header:active {
  transform: scale(0.97);
}

/* ─── Hamburger Menu ─────────────────────────────────── */
.hamburger-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-btn-header {
  font-size: 1.1rem;
}

.hamburger-btn {
  padding: 6px 10px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hamburger-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.hamburger-dropdown.hidden {
  display: none;
}

.dropdown-item {
  background: none;
  border: none;
  border-bottom: 1px solid var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition), color var(--transition);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--surface-2);
  color: var(--accent);
  padding-left: 20px;
}

.dropdown-item.active {
  background: rgba(233, 69, 96, 0.1);
  color: var(--accent);
  border-left: 4px solid var(--accent);
}

/* ─── Submenu Styles ────────────────────────────────── */
.dropdown-submenu {
  position: relative;
  display: flex;
  flex-direction: column;
}

.submenu-toggle {
  justify-content: space-between;
}

.submenu-toggle .arrow {
  font-size: 0.7rem;
  transition: transform var(--transition);
}

.dropdown-submenu.active .submenu-toggle .arrow {
  transform: rotate(90deg);
}

.submenu {
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}

.submenu.hidden {
  display: none;
}

.sub-item {
  padding-left: 36px;
  font-size: 0.9rem;
  opacity: 0.9;
}

.sub-item i {
  font-size: 0.8rem;
  opacity: 0.7;
}

.sub-item.active {
  background: rgba(233, 69, 96, 0.1) !important;
  color: var(--accent) !important;
  font-weight: 600;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-icon-active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}

body.qob-mode-active {
  background-color: #fce8eb;
  /* Light tint of the accent color */
  transition: background-color var(--transition);
}

/* ── Active Mode Banner ──────────────────────────────── */
.active-mode-banner {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: var(--header-height, 56px);
  z-index: 90;
}

.btn-exit-mode {
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-exit-mode:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* ─── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

input[type="text"],
input[type="search"],
input[type="number"],
.edit-brand-input,
.card-inline-input,
.modal-input {
  text-transform: uppercase;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Utilities ───────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Header ─────────────────────────────────────────── */
.app-header {
  background: var(--primary);
  color: #fff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header h1 .bee-icon {
  font-size: 1.3rem;
}

.logo-img {
  height: 28px;
  width: auto;
  vertical-align: middle;
  border-radius: 4px;
  transition: opacity 0.3s ease;
}

.logo-initial {
  opacity: 0;
}

.logo-startup {
  opacity: 1 !important;
  animation: flyToHeader 3.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 1000;
}

/* ─── Header Stats ───────────────────────────────────── */
.header-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin-left: auto;
  margin-right: 8px;
  user-select: none;
  white-space: nowrap;
}

.header-stat-item {
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  padding: 2px 4px;
}

.header-stat-item:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.header-stat-item:active {
  transform: translateY(0);
}

.header-stat-item.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.stat-sep {
  opacity: 0.4;
  font-weight: 300;
}

@media (max-width: 600px) {
  .header-stats {
    display: none;
    /* Hide on very small screens to avoid header clutter */
  }
}

/* ─── Main content ───────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 16px;
  padding-bottom: 80px;
  /* Space for footer */
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Search section ─────────────────────────────────── */
.search-section {
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
  background: transparent;
  padding: 4px 8px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}

.search-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.search-btn:active {
  transform: scale(0.97);
}

.search-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding-left: 4px;
}

/* ─── Status / result message ────────────────────────── */
.status-bar {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 0;
  color: var(--text-muted);
  min-height: 32px;
}

.status-bar.error {
  color: var(--accent);
}

.status-bar.success {
  color: #16a34a;
}

/* ─── Results navigator ──────────────────────────────── */
.results-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow);
}

.results-nav.visible {
  display: flex;
}

.nav-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}

.nav-btn:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.nav-btn:disabled {
  background: var(--cell-empty);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.nav-counter {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 90px;
  text-align: center;
}

.nav-btn-header {
  background: transparent;
  color: inherit;
  border: none;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), opacity var(--transition);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  font-family: monospace;
}

.nav-btn-header:hover {
  transform: scale(1.15);
}

.nav-btn-header:active {
  transform: scale(0.9);
}

.nav-btn-header:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ─── Key Card ───────────────────────────────────────── */
.key-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
  display: none;
  animation: slideIn 0.25s ease;
  transition: grid-column var(--transition);
}

.key-card.visible {
  display: block;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-brand-bar {
  padding: 10px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.card-body {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: center;
}

/* 4-column variant: label | value | label | value */
.card-body-4col {
  grid-template-columns: auto 1fr auto 1fr;
}

/* Location value spans the last 3 cols */
.card-body-4col .span3 {
  grid-column: span 3;
}

.card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding-top: 4px;
  white-space: nowrap;
}

.card-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.card-location {
  font-size: 1rem;
  font-weight: 700;
}

.refs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ref-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
}

/* Card edit button */
.card-actions {
  padding: 8px 16px 12px;
  border-top: 1px solid var(--border);
}

.card-edit-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.card-edit-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
}

/* ─── Modal ──────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.open {
  display: flex;
  animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 36px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUpModal 0.25s ease;
}

@keyframes slideUpModal {
  from {
    transform: translateY(40px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal {
    border-radius: var(--radius);
  }
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--primary);
}

.modal-location {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker {
  width: 48px;
  height: 40px;
  padding: 2px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: none;
}

.color-value {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn-cancel {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-cancel:hover {
  background: var(--border);
  color: var(--text);
}

.modal-status {
  margin-top: 12px;
  font-size: 0.82rem;
  min-height: 20px;
  color: var(--text-muted);
}

.modal-status.success {
  color: #16a34a;
  font-weight: 500;
}

.modal-status.error {
  color: var(--accent);
  font-weight: 500;
}


.boards-section {
  display: none;
}

.boards-section.visible {
  display: block;
}

/* Board controls bar */
.board-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.board-toggle-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.board-toggle-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
}

.board-toggle-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}


.boards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.board-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-title {
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  text-align: center;
}

.board-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.board-grid {
  display: grid;
  /* col-header + 18 data cols */
  grid-template-columns: 18px repeat(18, 1fr);
  padding: 4px;
  gap: 2px;
}

.grid-header {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
}

.col-header {
  text-align: center;
}

.row-header {
  text-align: right;
  padding-right: 4px;
}

.grid-cell {
  width: 100%;
  height: 16px;
  border-radius: 2px;
  background: var(--cell-empty);
  border: 1px solid var(--cell-empty-border);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.grid-cell:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.grid-cell.highlighted {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0, 0, 0, 0.4);
  transform: scale(1.15);
  z-index: 1;
  position: relative;
}

/* ─── Empty state ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.95rem;
}

/* ─── Desktop layout ─────────────────────────────────── */
@media (min-width: 700px) {
  .app-main {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px 0;
    align-items: start;
    justify-items: stretch;
  }

  /* Key card lives in column 1, same row as boards */
  .key-card {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  /* When expanded for editing, keep it at a readable width and centered */
  .key-card.expanded {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: 500px;
    margin: 0 0 24px 0;
  }

  /* Boards always span full width and sit below the card/search */
  .boards-section {
    grid-column: 1 / -1;
    width: 100%;
    justify-self: stretch;
  }

  /* Boards already handle their column/row logic above */

  .empty-state {
    grid-column: 1 / -1;
  }

  .boards-container {
    flex-direction: row;
  }

  .board-wrapper {
    flex: 1;
    min-width: 0;
  }

  .board-grid {
    min-width: 0;
  }
}

/* ─── Compact Card View Mode ─────────────────────────── */
.compact-card-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.compact-row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.compact-stock {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.compact-location {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  margin-top: auto;
  padding-top: 8px;
}

.compact-qty-row {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.compact-qty-item {
  display: flex;
  gap: 4px;
  align-items: center;
}

.compact-qty-val {
  font-weight: 600;
  color: var(--text);
}

/* ─── Loading spinner ────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Admin page styles ──────────────────────────────── */
.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.admin-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--primary);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.file-drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.04);
  color: var(--accent);
}

.file-drop-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

#fileInput {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--cell-empty);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin: 12px 0;
  display: none;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f97316);
  border-radius: 6px;
  transition: width 0.3s ease;
  width: 0%;
}

.import-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 24px;
}

.import-status.success {
  color: #16a34a;
  font-weight: 500;
}

.import-status.error {
  color: var(--accent);
  font-weight: 500;
}

.preview-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  display: none;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.preview-table th {
  background: var(--primary);
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
}

.preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.preview-table tr:last-child td {
  border-bottom: none;
}

.preview-table tr:nth-child(even) {
  background: var(--surface-2);
}

/* ─── Inline Card Edit Mode ──────────────────────────── */

/* Edit brand row — replaces coloured brand bar in edit mode */
.edit-brand-row {
  display: flex;
  align-items: stretch;
  min-height: 52px;
  transition: background var(--transition);
}

.edit-brand-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  color: inherit;
  min-width: 0;
}

.edit-brand-input::placeholder {
  opacity: 0.5;
  font-weight: 400;
}

.edit-color-picker {
  width: 48px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  background: transparent;
  padding: 8px 6px;
  flex-shrink: 0;
}

/* Visible colour picker row */
.edit-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.edit-color-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Colour picker icon button (in brand bar) */
.edit-color-btn {
  flex-shrink: 0;
  width: 52px;
  background: rgba(0, 0, 0, 0.18);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.edit-color-btn:hover {
  background: rgba(0, 0, 0, 0.30);
}

.edit-color-native {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Inline inputs inside card-body */
.card-inline-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
}

.card-inline-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

/* Action buttons row inside card */
.edit-actions {
  flex-wrap: wrap;
  align-items: center;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.83rem;
}

/* Card edit status line */
.card-edit-status {
  font-size: 0.8rem;
  padding: 2px 20px 10px;
  min-height: 22px;
  color: var(--text-muted);
}

.card-edit-status.success {
  color: #16a34a;
  font-weight: 600;
}

.card-edit-status.error {
  color: var(--accent);
  font-weight: 600;
}

/* ── Rapid Entry Modals (QOB & QIS) ──────────────────── */

/* Full-screen backdrop for immersion */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--primary-dark), 0.95);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.25s ease;
}

.modal-backdrop.hidden {
  display: none;
}

/* Modal Container styles designed to dominate mobile screen but cap on desktop */
.qob-modal,
.qis-modal {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUpModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition), color var(--transition);
}

.close-btn:hover {
  background: var(--surface);
  color: var(--accent);
}

.modal-body {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.qob-large-input,
.qis-large-input {
  width: 100%;
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  padding: 12px 16px;
  height: auto;
  margin-top: 4px;
  margin-bottom: 15px;
  letter-spacing: -0.02em;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 12px;
  color: var(--primary);
  outline: none;
  transition: all var(--transition);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.qob-large-input:focus,
.qis-large-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.15);
}

.qob-large-input::placeholder,
.qis-large-input::placeholder {
  color: var(--border);
}

.qob-hint,
.qis-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0;
  padding-top: 8px;
}

.qob-hint strong,
.qis-hint strong {
  color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}


/* Specific QIS styles */
.qis-body {
  min-height: 280px;
}

.qis-step {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.qis-step.hidden {
  display: none;
}

.qis-error {
  color: var(--accent);
  font-weight: 600;
  margin-top: -20px;
  margin-bottom: 25px;
  font-size: 0.95rem;
  text-align: center;
  padding: 8px;
}

/* ─── QIS Actions ────────────────────────────────── */
.qis-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: -10px;
  margin-bottom: 25px;
}

.qis-btn {
  padding: 18px;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  cursor: pointer;
  transition: transform 0.1s, filter 0.2s;
  text-transform: uppercase;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.qis-btn:active {
  transform: scale(0.96);
}

.qis-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.qis-btn-add {
  background: #22c55e;
  /* Green */
}

.qis-btn-update {
  background: #38bdf8;
  /* Blue */
}

.qis-btn-offboard {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.1s, background 0.2s;
}

.qis-btn-offboard:active {
  transform: scale(0.98);
}

.qis-btn-offboard.hidden {
  display: none;
}

/* Off-Board List */
.offboard-modal {
  max-width: 500px;
}

.offboard-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

.offboard-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.offboard-item:hover {
  border-color: transparent;
  background: #fff;
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.offboard-item-color {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.offboard-item-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.offboard-item-brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.offboard-item-meta {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 12px;
}

.offboard-item-qty {
  margin-left: auto;
  padding: 4px 10px;
  background: #f0f7ff;
  color: #3b82f6;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.qob-details,
.qis-details {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  text-align: left;
}

.qob-details.hidden {
  display: none;
}

.qob-brand,
.qis-brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.qob-stock,
.qis-loc {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.qob-color {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 600;
}

.color-swatch-small {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  display: inline-block;
}

/* Animations */
@keyframes slideUpModal {
  from {
    transform: translateY(60px) scale(0.95);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* .qty-row / .qty-field removed — fields now live directly in the 4-col card-body grid */

/* ── Image section (edit mode) ───────────────────────── */
.img-section {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.img-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 12px;
  margin: 0 -12px;
  border-radius: 6px;
  transition: background 0.2s;
}

.img-section-title:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Each image slot row */
.img-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.img-slot:last-child {
  border-bottom: none;
}

.img-slot-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  width: 72px;
  flex-shrink: 0;
}

.img-slot-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
  cursor: pointer;
}

.img-slot-ph {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.img-slot-btns {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.img-slot-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: background var(--transition);
}

.img-slot-btn:hover {
  background: var(--surface);
}

.img-slot-btn.danger {
  color: var(--accent);
}

.img-slot-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* ── Image gallery (view mode) ───────────────────────── */
.view-images {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.view-images:empty {
  display: none;
}

.view-img-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.view-img-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.view-img-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.view-img-thumb:hover {
  transform: scale(1.05);
}

/* Full-screen image viewer */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.viewer-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  object-fit: contain;
}

.viewer-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  z-index: 10010;
}

.viewer-close:hover {
  background: var(--accent);
  transform: scale(1.1);
}

/* viewer-info-bar removed - moved to top controls */

.viewer-metadata {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 14px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-metadata span {
  opacity: 0.9;
}

.viewer-actions {
  display: flex;
  gap: 12px;
}

.viewer-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  backdrop-filter: blur(10px);
}

.viewer-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: #fff;
  transform: translateY(-2px);
}

.viewer-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

/* ─── Viewer Controls Row ───────────────────────────── */
.viewer-controls {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 80px;
  /* Leave space for close button */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  z-index: 10010;
}

.viewer-ctrl-group {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.viewer-ctrl-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
  backdrop-filter: blur(8px);
}

.viewer-ctrl-btn:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.4);
}

.viewer-ctrl-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

.viewer-zoom-level {
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  padding: 0 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

/* ─── Cropper integration in Viewer ──────────────────── */
.viewer-cropper-wrap {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 10005;
}

.viewer-cropper-wrap.visible {
  display: block;
}

.viewer-cropper-actions {
  position: absolute;
  top: 70px;
  left: 20px;
  display: flex;
  gap: 8px;
  z-index: 10001;
}

/* viewer-btn.primary override removed - unified above */
.viewer-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.viewer-btn.primary:hover {
  background: var(--accent-hover);
}

/* ── Search Highlighting ───────────────────────────── */
@keyframes highlight-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px #000;
    z-index: 10;
  }

  50% {
    box-shadow: 0 0 0 4px #fbbf24, 0 0 15px #facc15;
    z-index: 10;
  }
}

@keyframes highlight-breathe {

  0%,
  100% {
    box-shadow: 0 0 0 3px #000, 0 0 10px rgba(0, 0, 0, 0.5);
    transform: scale(1.15);
    z-index: 100;
  }

  50% {
    box-shadow: 0 0 0 6px #fbbf24, 0 0 25px 8px #facc15;
    transform: scale(1.35);
    z-index: 100;
  }
}

.grid-cell.search-match {
  transform: scale(1.05);
  z-index: 10;
  animation: highlight-pulse 2s infinite ease-in-out;
}

.grid-cell.search-active {
  z-index: 100;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: highlight-breathe 1.2s infinite ease-in-out;
}

/* ── Floating Navigator ────────────────────────────── */
.floating-nav {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  border: 1px solid rgba(250, 204, 21, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  pointer-events: none;
}

.floating-nav.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.floating-nav-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.floating-nav-btn:hover {
  background: #f8fafc;
  transform: scale(1.05);
  border-color: var(--accent);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.floating-nav-btn:active {
  transform: scale(0.95);
}

.floating-nav-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  padding: 0 10px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.nav-arrow {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
}

@media (max-width: 600px) {
  .floating-nav {
    width: 90%;
    padding: 8px 12px;
    bottom: 20px;
    gap: 8px;
  }

  .floating-nav-btn {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .floating-nav-info {
    min-width: 80px;
  }
}


/* ── Rapid Photo Mode (KP) ─────────────────────────── */
.kp-modal {
  max-width: 600px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.kp-camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.kp-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kp-status-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.kp-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kp-step-indicator {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.kp-step {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.kp-step.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.kp-capture-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.kp-btn-primary {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.kp-btn-primary:active {
  transform: scale(0.96);
}

.kp-btn-secondary {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.kp-btn-secondary:active {
  transform: scale(0.92);
}

/* ── Cropper Styles ─────────────────────────────────── */
.camera-video-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.cropper-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.cropper-box {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.6);
  cursor: move;
  pointer-events: auto;
  min-width: 60px;
  min-height: 60px;
  box-sizing: border-box;
  left: 10%;
  top: 10%;
  width: 80%;
  height: 80%;
}

.cropper-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 4px;
  pointer-events: auto;
  z-index: 10;
}

.cropper-handle.tl {
  top: -12px;
  left: -12px;
  cursor: nwse-resize;
}

.cropper-handle.tr {
  top: -12px;
  right: -12px;
  cursor: nesw-resize;
}

.cropper-handle.bl {
  bottom: -12px;
  left: -12px;
  cursor: nesw-resize;
}

.cropper-handle.br {
  bottom: -12px;
  right: -12px;
  cursor: nwse-resize;
}

.cropper-viewfinder {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Grid lines for cropper */
.cropper-viewfinder::before,
.cropper-viewfinder::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.3);
}

.cropper-viewfinder::before {
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.cropper-viewfinder::after {
  left: 33.33%;
  right: 33.33%;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.kp-nav-row {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.kp-nav-btn {
  flex: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.kp-nav-btn:hover {
  background: var(--border);
}

.kp-error {
  margin-top: 12px;
  color: #f87171;
  font-size: 0.82rem;
  text-align: center;
  font-weight: 500;
}

/* ── Lightbox ────────────────────────────────────────── */
/* ─── Camera modal ───────────────────────────────────── */
.camera-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeInModal 0.2s ease;
}

.camera-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 640px;
  padding: 16px;
}

.camera-video {
  width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  object-fit: cover;
  background: #000;
  display: block;
}

.camera-error {
  color: #f87171;
  font-size: 0.85rem;
  min-height: 20px;
  text-align: center;
}

.camera-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

.camera-btn.primary {
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  font-size: 1rem;
}

.camera-btn.primary:hover {
  background: var(--accent-hover);
  transform: scale(1.04);
}

.camera-btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.camera-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ─── Bee Animation ──────────────────────────────────── */

@keyframes flyToHeader {
  0% {
    transform: translate(80vw, 80vh) rotate(-45deg) scale(0);
    opacity: 0;
  }

  15% {
    transform: translate(60vw, 40vh) rotate(20deg) scale(2);
    opacity: 1;
  }

  40% {
    transform: translate(20vw, 60vh) rotate(-20deg) scale(2.5);
  }

  65% {
    transform: translate(50vw, 20vh) rotate(10deg) scale(2);
  }

  85% {
    transform: translate(10vw, 10vh) rotate(-10deg) scale(1.5);
  }

  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
}

.logo-flying {
  animation: flyAround 3s cubic-bezier(0.45, 0.05, 0.55, 0.95);
  position: relative;
  z-index: 9999;
  pointer-events: none;
}

@keyframes flyAround {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  20% {
    transform: translate(40vw, 35vh) rotate(45deg) scale(2);
  }

  40% {
    transform: translate(55vw, 45vh) rotate(135deg) scale(2.5);
  }

  60% {
    transform: translate(40vw, 55vh) rotate(225deg) scale(2.5);
  }

  80% {
    transform: translate(25vw, 45vh) rotate(315deg) scale(2);
  }

  100% {
    transform: translate(0, 0) rotate(360deg) scale(1);
  }
}

/* ── Take Photos Setup Modal ── */
.tp-setup-modal {
  max-width: 440px;
}

.tp-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tp-checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
  color: var(--text);
}

.tp-checkbox-item:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.tp-checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* .tp-slot-pill used for dynamic step indicator in Take Photos mode */
.tp-slot-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-transform: uppercase;
}

.tp-slot-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 8px rgba(233, 69, 96, 0.2);
}

/* ─── Laptop Hamburger Menu Drawer ────────────── */
@media (min-width: 1024px) {
  body {
    transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.menu-pinned {
    padding-right: 320px;
  }

  .hamburger-dropdown {
    position: fixed !important;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: 320px;
    height: auto;
    margin-top: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    border-left: 1px solid var(--border) !important;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    z-index: 2000;
  }

  .hamburger-dropdown.hidden {
    transform: translateX(100%);
    display: flex !important;
  }

  body.menu-pinned .hamburger-dropdown {
    transform: translateX(0);
    display: flex !important;
  }

  .dropdown-item {
    padding: 16px 24px;
    font-size: 1.05rem;
  }
}

.kp-res-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}

.kp-res-select:hover {
  border-color: var(--accent);
  color: var(--text);
}

.version-tag {
  position: fixed;
  bottom: 60px;
  /* Above footer */
  right: 8px;
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.4;
  pointer-events: none;
  z-index: 9999;
  font-weight: 600;
  font-family: monospace;
}

/* ─── Footer Stats ───────────────────────────────────── */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 16px;
  z-index: 1000;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
}

.footer-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.footer-stat[style*="cursor: pointer"]:hover {
  transform: translateY(-2px);
  opacity: 0.8;
}

.footer-stat[style*="cursor: pointer"]:active {
  transform: translateY(0);
}

.footer-stat.active {
  background: rgba(233, 69, 96, 0.1) !important;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
}

.footer-stat.active .stat-label {
  color: var(--accent);
}

.footer-stat.active .stat-value {
  color: var(--accent);
}

.stat-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .app-footer {
    padding: 12px 24px;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }
}

/* ── Numpad positioning adjustments ──────────────────── */
body.numpad-active .modal-backdrop {
  align-items: flex-start;
  padding-top: env(safe-area-inset-top, 16px);
  padding-bottom: 400px;
  /* Leave room for numpad */
  background: rgba(15, 23, 42, 0.4);
  /* Less dimming to keep context */
}

@media (max-width: 600px) {

  body.numpad-active .qob-modal,
  body.numpad-active .qis-modal {
    max-height: 48vh;
    /* Keep it in the top half */
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  }

  /* Condense margins even further when numpad is up */
  body.numpad-active .modal-header {
    padding: 8px 16px;
  }

  body.numpad-active .modal-body {
    padding: 12px;
  }

  body.numpad-active .qob-details,
  body.numpad-active .qis-details {
    margin-bottom: 4px;
    padding: 6px 10px;
  }

  body.numpad-active .modal-label {
    font-size: 0.75rem;
    margin-bottom: 0px;
  }
}

padding: 12px;
}

body.numpad-active .qob-details,
body.numpad-active .qis-details {
  margin-bottom: 4px;
  padding: 6px 10px;
}

body.numpad-active .modal-label {
  font-size: 0.75rem;
  margin-bottom: 0px;
}
}