/* =========================================================
   KitStore — shared stylesheet
   Used by index.html, asset-fx6.html, basket.html
   ========================================================= */

:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-hover: #283548;
  --card-alt: #162032;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #334155;
  --text: #f8fafc;
  --sub: #94a3b8;
  --muted: #475569;
  --disabled-text: #64748b;
  --warn: #f59e0b;
  --warn-bg: #451a03;
  --warn-border: #78350f;
  --warn-text: #fef08a;
  --warn-hover: rgba(245, 158, 11, 0.18);
  --amber-status: #fbbf24;
  --danger: #ef4444;
  --danger-status: #f87171;
  --success: #34d399;
  --dark-past: #111827;
  --dark-container: #090e17;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 24px 24px 160px;   /* extra room to scroll past the bottom-most element */
  margin: 0;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
}

@media (max-width: 860px) {
  .container { grid-template-columns: minmax(0, 1fr); }
  .container > * { min-width: 0; }
}

/* ---------- Top nav ---------- */
.top-nav {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
}
.nav-btn-link {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav-btn-link:hover { background: var(--border); }

/* ---------- Headers ---------- */
.page-header h1, .asset-header h1 { margin: 0 0 8px 0; font-size: 28px; }
.page-header p { color: var(--sub); margin: 0; font-size: 14px; }

.meta { color: var(--sub); font-size: 14px; margin-bottom: 20px; display: flex; gap: 12px; }
.meta > span { background: var(--bg); padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- Cards ---------- */
.main-card, .sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

/* ---------- Calendar ---------- */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.calendar-header h3 { margin: 0; font-size: 16px; min-width: 130px; text-align: center; color: var(--text); }
.nav-btn {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 14px; font-weight: bold;
  transition: background 0.15s ease;
}
.nav-btn:hover { background: var(--border); }

.calendar-wrapper { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.days-row { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg); border-bottom: 1px solid var(--border); }
.day-name { padding: 6px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--sub); text-transform: uppercase; }
.dates-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); }

.date-cell {
  background: var(--card); aspect-ratio: 1 / 1; position: relative;
  box-sizing: border-box; transition: background 0.15s ease; user-select: none;
}
.date-num { position: absolute; top: 6px; right: 6px; font-size: 13px; font-weight: 700; line-height: 1; color: var(--muted); z-index: 2; pointer-events: none; }
.date-status { position: absolute; bottom: 6px; left: 6px; font-size: 15px; font-weight: 800; line-height: 1.1; z-index: 2; pointer-events: none; }

.empty { background: var(--bg); }
.past { background: var(--dark-past); }

.green { cursor: pointer; }
.green:hover:not(.selected) { background: var(--card-hover); }
.green .date-status { color: var(--success); }

.amber { cursor: pointer; }
.amber:hover:not(.selected) { background: var(--card-hover); }
.amber .date-status { color: var(--amber-status); }

.red { cursor: not-allowed; opacity: 0.7; }
.red .date-status { color: var(--danger-status); }

.date-cell.selected { background: var(--accent) !important; }
.date-cell.in-range { background: rgba(37, 99, 235, 0.25) !important; }
.date-cell.selected .date-num, .date-cell.in-range .date-num { color: #ffffff !important; }

/* Compact calendar variant (used inside popovers) */
.pip-calendar .calendar-header h3 { font-size: 13px; min-width: 100px; }
.pip-calendar .nav-btn { padding: 4px 8px; font-size: 12px; }
.pip-calendar .date-status { font-size: 12px; }
.pip-calendar .date-num { font-size: 11px; }

/* ---------- Specs ---------- */
.spec-group { margin-bottom: 14px; }
.spec-group strong { color: var(--sub); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.spec-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.spec-list li { padding: 5px 0; border-bottom: 1px solid var(--card-hover); display: flex; justify-content: space-between; }
.spec-list li span.val { color: var(--text); font-weight: 600; text-align: right; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--accent); color: #ffffff; border: none; padding: 12px;
  border-radius: 8px; font-size: 15px; font-weight: bold; width: 100%;
  cursor: pointer; margin-top: 12px; transition: background 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); }
.btn:disabled { background: var(--border); color: var(--disabled-text); cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; margin-top: 10px; width: 100%; }

.btn-add {
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: 0.15s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn-add:hover { background: var(--accent); color: #ffffff; }

.btn-avail {
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 600;
  transition: 0.15s; white-space: nowrap;
}
.btn-avail:hover { background: var(--accent); color: #ffffff; }

/* ---------- Suggested / frequent item rows ---------- */
.suggested-item, .frequent-item {
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-top: 10px; font-size: 13px; background: var(--card-alt);
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px;
}

/* ---------- Alerts / deficits ---------- */
.alert-box { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn-text); border-radius: 8px; padding: 16px; margin-top: 12px; font-size: 12px; }
.alert-box p { color: var(--warn-text); }
.alert-header { display: flex; align-items: center; font-size: 15px; font-weight: bold; margin-bottom: 12px; color: var(--warn-text); }
.deficit-list { font-family: inherit; font-size: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.fix-issue-row {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,0.25); border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 12px 16px; border-radius: 8px; margin-top: 12px; gap: 12px; flex-wrap: wrap;
}

.arrow-container { width: 32px; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.sub-arrow { color: var(--warn); font-size: 15px; font-weight: bold; }

.hover-asset-row { transition: background-color 0.15s ease; border-radius: 8px; padding: 12px 14px; }
.hover-asset-row:hover { background-color: var(--card-hover); }
.alert-box .hover-asset-row:hover { background-color: var(--warn-hover) !important; }

.basket-icon-green { width: 14px; height: 14px; stroke: var(--success); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-left: 6px; vertical-align: text-bottom; }

.empty-state { text-align: center; padding: 32px 16px; color: var(--sub); font-size: 14px; }
.empty-state a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ---------- Slideshow ---------- */
.slideshow-container { position: relative; overflow: hidden; border-radius: 8px; user-select: none; background: var(--dark-container); }
.slide { display: none; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 12px; color: var(--sub); text-align: center; box-sizing: border-box; background-size: cover; background-position: center; word-wrap: break-word; padding: 4px; }
.slide.active { display: flex; }
/* Arrows: no background until hovered; a dark halo keeps the glyph visible on white photos. */
.slide-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: transparent; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,0.9), 0 1px 6px rgba(0,0,0,0.6); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 5; padding: 0; transition: background 0.15s ease; }
.slide-arrow:hover { background: rgba(15,23,42,0.75); text-shadow: none; }
/* Defaults for any slideshow; specific sizes below override. */
.slide-arrow { width: 22px; height: 34px; font-size: 14px; }
.slide-arrow.left { left: 0; border-radius: 0 5px 5px 0; }
.slide-arrow.right { right: 0; border-radius: 5px 0 0 5px; }
.card-photo .slide-arrow { width: 30px; height: 46px; font-size: 18px; }
.category-thumb .slide-arrow { width: 16px; height: 26px; font-size: 11px; }

.main-slideshow { width: 100%; aspect-ratio: 1 / 1; height: auto; margin-left: auto; margin-right: auto; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 24px; }
.main-slideshow .slide { font-size: 13px; }
/* Product photo slides: white backdrop so manufacturer shots (mostly on
   white) sit cleanly; the whole photo is always visible. */
.slide.photo { background: #fff; padding: 0; position: relative; overflow: hidden; }
.slide-photo { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; }
.main-slideshow .slide-arrow { width: 28px; height: 44px; font-size: 16px; }
.main-slideshow .slide-arrow.left { left: 0; border-radius: 0 6px 6px 0; }
.main-slideshow .slide-arrow.right { right: 0; border-radius: 6px 0 0 6px; }

.thumb-slideshow { width: 56px; height: 56px; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.thumb-slideshow .slide-arrow { width: 14px; height: 22px; font-size: 10px; }
.thumb-slideshow .slide-arrow.left { left: 0; border-radius: 0 3px 3px 0; }
.thumb-slideshow .slide-arrow.right { right: 0; border-radius: 3px 0 0 3px; }

/* Asset photos in thumbnails and cards (images are pre-cropped to 1:1). */
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; background: #fff; }
.small-thumb-slideshow { width: 48px; height: 48px; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.small-thumb-slideshow .slide-arrow { width: 12px; height: 20px; font-size: 9px; }
.small-thumb-slideshow .slide-arrow.left { left: 0; border-radius: 0 3px 3px 0; }
.small-thumb-slideshow .slide-arrow.right { right: 0; border-radius: 3px 0 0 3px; }

.slide-counter { position: absolute; bottom: 8px; right: 12px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.15); }

/* Single static icon tile (dynamically-added basket/asset rows with no gallery yet) */
.icon-tile { display: flex; align-items: center; justify-content: center; font-size: 20px; background: linear-gradient(135deg, var(--card), var(--bg)); }

/* ---------- Basket overlay (nav) ---------- */
.basket-wrapper { position: relative; display: inline-block; }
.basket-overlay {
  position: absolute; top: 0; left: 100%; margin-left: 12px; width: 500px;
  background: var(--card-alt); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.7); z-index: 100; padding: 16px;
  display: none; opacity: 0; transform: translateX(-10px); transition: opacity 0.2s ease, transform 0.2s ease;
}
/* transform must be none (not translateX(0)) when open: any transform turns
   the overlay into the containing block for position:fixed descendants,
   which would break the floating date popovers inside it. */
.basket-overlay.show { display: block; opacity: 1; transform: none; }
.basket-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.basket-header h4 { margin: 0; font-size: 16px; }
.basket-items { max-height: 70vh; overflow-y: auto; padding-right: 4px; } /* JS (fitBasketList) extends this to the window bottom */
/* Overlay rows: asset name and date range on one line each. */
.basket-overlay .item-title,
.basket-overlay .item-dates-btn { white-space: nowrap; }

/* ---------- Basket line items (overlay + basket page share this) ---------- */
.basket-item { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 16px; border-bottom: 1px solid var(--border); align-items: center; position: relative; }
.basket-item:last-child { border-bottom: none; }
.item-title { margin: 0 0 4px 0; font-size: 16px; color: var(--text); font-weight: 600; }
.item-meta { color: var(--sub); font-size: 13px; margin: 0; }

.pip-container { position: relative; display: inline-block; }
.item-dates-btn {
  background: var(--bg); padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text);
  cursor: pointer; transition: 0.15s; font-family: inherit; font-weight: normal; margin-top: 8px;
}
.item-dates-btn:hover { background: var(--border); border-color: var(--sub); }
.item-dates-btn strong { font-weight: 600; color: #fff; }

.item-actions { display: flex; align-items: center; gap: 12px; }
.qty-input { width: 44px; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); color: #ffffff; border-radius: 6px; padding: 10px 8px; text-align: center; font-size: 14px; font-family: monospace; }
.qty-input.qty-invalid, .qty-input.qty-invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); outline: none; }

.trash-btn { background: none; border: none; cursor: pointer; padding: 6px; transition: transform 0.2s; display: flex; align-items: center; justify-content: center; }
.trash-btn:hover { transform: scale(1.15); }

/* ---------- Deficit dropdown (accessory options) ---------- */
.deficit-dropdown { display: none; background: rgba(0,0,0,0.15); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-top: 10px; }
.deficit-dropdown.show { display: block; }
.option-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); gap: 12px; margin: 4px 0; padding: 6px 0; }
.option-row:last-child { border-bottom: none; }
.option-indent-prefix { display: flex; align-items: center; width: 142px; justify-content: flex-end; flex-shrink: 0; }

/* ---------- PiP calendar popover ---------- */
.pip-calendar {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 8px; width: 270px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.85); z-index: 200; cursor: default;
}
.pip-calendar.right-align { left: auto; right: 0; }
.pip-calendar.show { display: block; }
/* Deficit alert: host booking photos, booked days (uncovered highlighted),
   then one block per uncovered range. */
.deficit-host { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.host-slideshow { width: 84px; height: 84px; border-radius: 8px; border: 1px solid var(--warn-border); flex-shrink: 0; background: #fff; }
.host-slideshow .slide-arrow { width: 16px; height: 26px; font-size: 10px; }
.host-slideshow .slide-arrow.left { left: 0; border-radius: 0 4px 4px 0; }
.host-slideshow .slide-arrow.right { right: 0; border-radius: 4px 0 0 4px; }
.deficit-host-name { font-size: 15px; font-weight: 700; color: #fff; }
.deficit-host-dates { font-size: 12px; margin: 2px 0 8px; }
.day-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.day-chip { min-width: 26px; height: 26px; padding: 0 4px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; font-size: 12px; font-weight: 700; }
.day-chip.covered { background: rgba(34, 197, 94, 0.15); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.35); }
.day-chip.missing { background: var(--warn); color: #1c1003; border: 1px solid var(--warn); }
.deficit-host-note { font-size: 12px; }
.deficit-range { border-top: 1px solid var(--warn-border); padding-top: 10px; margin-top: 10px; }
.deficit-range-head { font-size: 13px; margin-bottom: 4px; }
.range-pill { display: inline-block; background: var(--warn); color: #1c1003; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }

.nav-left { display: flex; align-items: center; gap: 8px; }
/* KitStore link centred at the top of the page (the container is the frame). */
.container { position: relative; }
.brand-link { position: absolute; left: 50%; top: 0; transform: translateX(-50%); height: 32px; display: flex; align-items: center; box-sizing: border-box; z-index: 2; }
.top-nav .basket-wrapper { margin-left: auto; }
.top-nav .manage-link { margin-left: auto; text-decoration: none; }
.top-nav .manage-link + .basket-wrapper { margin-left: 8px; }

/* ---------- Manage Bookings (manage.html) ---------- */
.manage-page { max-width: none; }
.manage-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.manage-toolbar .btn { width: auto; margin-top: 0; }
.toolbar-spacer { flex: 1; }
.bulk-select { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 13px; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: #93c5fd; }
.btn-outline:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-outline:disabled { background: transparent; border-color: var(--border); color: var(--sub); }
.btn-danger { background: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.manage-flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.manage-flash.ok { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.5); color: #d1fae5; }
.manage-flash.warn { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn-text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.manage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.manage-table th, .manage-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.manage-table thead th { background: var(--card-alt); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.manage-table .head-labels th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--sub); padding-bottom: 4px; border-bottom: none; }
.manage-table .head-filters th { padding-top: 0; }
.manage-table th.sortable { cursor: pointer; user-select: none; }
.manage-table th.sortable:hover { color: var(--text); }
.manage-table th.sorted { color: #93c5fd; }
.sort-arrow { display: inline-block; min-width: 12px; margin-left: 4px; font-size: 10px; }
.filter-suggest { position: fixed; z-index: 600; background: var(--card); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.7); max-height: 320px; overflow-y: auto; padding: 4px 0; font-size: 13px; }
.suggest-item { padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.suggest-item:hover, .suggest-item.active { background: var(--card-hover); color: #fff; }
.detail-stock { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 0; font-size: 13px; }
.stock-line { white-space: nowrap; }
.muted-cell { color: var(--sub); }
.barcode-cell .unit-chip { font-size: 12px; }
.manage-table td[data-col="assets"] { min-width: 220px; }
.modal-lock { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.5); color: #e9d5ff; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin: 0 0 12px; }
.modal input:disabled, .modal .qty-input:disabled { opacity: 0.5; cursor: not-allowed; }
.manage-table td[data-col="picked"], .manage-table td[data-col="collected"], .manage-table td[data-col="restocked"] { white-space: nowrap; }
.manage-table td[data-col="qty"] { text-align: center; font-weight: 700; }
.manage-table td[data-col="description"] { color: var(--sub); min-width: 160px; }
.col-filter { width: 100%; min-width: 80px; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 5px 7px; font: inherit; font-size: 12px; }
.col-filter:focus { outline: none; border-color: var(--accent); }
.booking-row { cursor: pointer; transition: background-color 0.12s; }
.booking-row:hover { background: var(--card-hover); }
.booking-row.expanded { background: var(--card-hover); }
.booking-row.selected { background: rgba(37, 99, 235, 0.14); }
.manage-table td[data-col="asset"] { min-width: 160px; font-weight: 600; }
.manage-table td[data-col="notes"] { min-width: 180px; color: var(--sub); }
.manage-table td[data-col="from"], .manage-table td[data-col="to"], .manage-table td[data-col="requested"],
.manage-table td[data-col="id"] { white-space: nowrap; }
.col-controls { white-space: nowrap; width: 1%; }
.col-select { width: 1%; white-space: nowrap; }
.col-select input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.select-all-btns { display: flex; flex-direction: column; gap: 3px; }
.select-all-btns button { background: transparent; border: 1px solid var(--border); color: #93c5fd; border-radius: 4px; font-size: 11px; padding: 2px 6px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.select-all-btns button:hover { border-color: var(--accent); }
.icon-btn { background: transparent; border: none; color: var(--sub); padding: 4px; border-radius: 5px; cursor: pointer; display: inline-flex; }
.icon-btn:hover:not(:disabled) { color: #fff; background: var(--border); }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.state-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.state-booked { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
.state-picked { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.state-collected { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.state-restocked { background: rgba(52, 211, 153, 0.18); color: #6ee7b7; }
.overdue-yes { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.booking-detail > td { background: var(--bg); padding: 0; }
.booking-detail-inner { padding: 14px 18px 18px; border-left: 3px solid var(--accent); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.detail-head .btn { width: auto; margin-top: 0; }
.detail-note { font-size: 12px; color: var(--sub); margin: 6px 0 10px; }
.detail-items { width: 100%; border-collapse: collapse; }
.detail-items th { font-size: 11px; text-transform: uppercase; color: var(--sub); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.detail-items td { padding: 8px; border-bottom: 1px solid var(--card-hover); vertical-align: middle; }
.detail-item { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.detail-items .num { font-weight: 700; font-size: 14px; }
.stock-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: rgba(52, 211, 153, 0.15); color: #6ee7b7; font-weight: 700; white-space: nowrap; }
.stock-chip.short { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.short-note { font-size: 11px; color: #fca5a5; margin-top: 3px; }
.line-state { white-space: nowrap; }
.units { display: flex; flex-wrap: wrap; gap: 4px; }
.unit-chip { display: inline-flex; align-items: center; gap: 6px; font-family: monospace; font-size: 12px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border); background: var(--card); }
.unit-chip em { font-style: normal; font-family: inherit; font-size: 10px; text-transform: uppercase; opacity: 0.8; }
.unit-picked { border-color: rgba(245, 158, 11, 0.6); }
.unit-collected { border-color: rgba(168, 85, 247, 0.6); }
.unit-restocked { border-color: rgba(52, 211, 153, 0.6); opacity: 0.75; }
.muted { color: var(--sub); font-size: 12px; }
.scan-cell { white-space: nowrap; text-align: right; }
.detail-items .unit-actions { width: 1%; white-space: nowrap; padding-left: 0; padding-right: 0; }
.unit-actions .icon-btn:hover { color: #6ee7b7; }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.7); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 500; overflow-y: auto; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: min(560px, 100%); box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
.modal-title { margin: 0 0 6px; font-size: 18px; }
.modal-sub { color: var(--sub); font-size: 13px; margin: 0 0 12px; }
.modal-body p { font-size: 14px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.modal label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); }
.modal input[type="date"] { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: inherit; color-scheme: dark; }
.modal-label { font-size: 12px; color: var(--sub); margin: 8px 0 6px; }
.edit-items { display: flex; flex-direction: column; gap: 8px; }
.edit-item { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 10px; align-items: center; }
.edit-item-name { font-size: 14px; }
.edit-item-error { grid-column: 2 / -1; font-size: 12px; color: var(--danger-status); }
.edit-item-error:empty { display: none; }
.edit-add { display: flex; gap: 8px; margin-top: 10px; }
.edit-add select { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px; font: inherit; font-size: 13px; }
.edit-add .btn { width: auto; margin-top: 0; }
.modal-error { color: var(--danger-status); font-size: 12px; margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions .btn { width: auto; margin-top: 0; }

/* Merge suggestion (blue, same layout as a deficit alert) */
.merge-box { background: rgba(37, 99, 235, 0.12); border: 1px solid var(--accent); border-radius: 8px; padding: 16px; margin-top: 12px; font-size: 12px; color: var(--text); }
.merge-header { font-size: 15px; font-weight: bold; margin-bottom: 12px; color: #93c5fd; }
.merge-slideshow { border-color: var(--accent); }
.booking-bubble { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #dbeafe; }
.booking-bubble.seg-a { background: rgba(37, 99, 235, 0.45); border: 1px solid rgba(96, 165, 250, 0.6); }
.booking-bubble.seg-b { background: rgba(96, 165, 250, 0.18); border: 1px solid rgba(96, 165, 250, 0.4); }
.merge-btn { margin-top: 4px; }
.bubble-qty { font-style: normal; font-weight: 800; color: #fff; margin-right: -2px; }
.merge-after { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.merge-arrow { font-size: 12px; color: #93c5fd; margin-right: 2px; }
.merge-arrow::after { content: ' \2192'; }
.booking-bubble.result { background: rgba(52, 211, 153, 0.18); border: 1px solid rgba(52, 211, 153, 0.6); color: #d1fae5; }
.merge-btn.confirmed { background: var(--success); color: #000; }

/* Nav basket: deficit count bar above the list */
.basket-deficit-bar { background: var(--warn); color: #1c1003; font-weight: 700; font-size: 13px; text-align: center; padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }

/* Basket rows: bigger photos, tighter padding */
[data-basket-page-items] .basket-item { padding: 10px 16px 10px 8px; }
[data-basket-page-items] .basket-item > div:first-child { align-items: center !important; }
[data-basket-page-items] .thumb-slideshow { width: 88px; height: 88px; }
.basket-overlay .basket-item { padding: 8px 12px 8px 6px; }
.basket-overlay .thumb-slideshow { width: 64px; height: 64px; }
.brand-link { font-weight: 700; font-size: 15px; text-decoration: none; border-color: transparent; }

.cal-offview { display: flex; justify-content: space-between; gap: 8px; margin: -4px 0 8px; font-size: 12px; font-weight: 600; color: var(--accent); }
.cal-warning { margin-top: 8px; font-size: 12px; color: var(--danger-status); text-align: center; }
/* Popovers inside the nav basket overlay: pinned to the viewport by JS
   (placeFloatingPopover) so the overlay's scrolling list can't clip them. */
.pip-calendar.floating { position: fixed; right: auto; margin-top: 0; }

/* ---------- Booking summary sidebar ---------- */
.summary-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 12px; color: var(--sub); }
.summary-row.highlight { font-size: 15px; font-weight: 600; color: var(--text); border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
.notes-box { width: 100%; background: var(--bg); border: 1px solid var(--border); color: #fff; padding: 10px; border-radius: 6px; font-size: 13px; box-sizing: border-box; resize: vertical; margin-top: 8px; }

/* ---------- Asset catalog (index page) ---------- */
.catalog-group { font-size: 18px; margin: 32px 0 12px; }
.catalog-group:first-child { margin-top: 0; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.asset-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-decoration: none; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease; display: block; }
.asset-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.asset-card .card-photo { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; margin-bottom: 12px; background: #fff; }
.asset-card .card-photo .icon-tile { width: 100%; height: 100%; font-size: 36px; }

/* Browse page: category filter column + catalog */
.catalog-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.catalog-filter { position: sticky; top: 24px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.catalog-filter h3 { margin: 0 0 10px; font-size: 14px; color: var(--sub); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-option { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 14px; cursor: pointer; border-radius: 6px; }
.filter-option:hover { background: var(--card-hover); }
.filter-option input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.filter-pic { width: 30px; height: 30px; flex-shrink: 0; border-radius: 5px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.filter-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

.catalog-section:first-child .catalog-group { margin-top: 0; }
@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-filter { position: static; }
}

/* Asset page category chip + same-category popover */
.category-wrapper { position: relative; display: inline-block; }
.category-chip { background: var(--bg); color: var(--sub); font: inherit; font-size: 14px; padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border); cursor: pointer; transition: 0.15s; }
.category-chip:hover { border-color: var(--sub); color: var(--text); }
.chip-caret { font-size: 10px; margin-left: 4px; }
.category-popover { display: none; position: absolute; top: 100%; left: 0; margin-top: 8px; z-index: 150; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.85); width: max-content; max-width: min(640px, 90vw); }
.category-popover.show { display: block; }
.category-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.category-thumb { flex: 0 0 auto; width: 88px; height: 88px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); background: #fff; transition: border-color 0.15s, transform 0.15s; }
.category-thumb:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-page-btn { display: block; text-align: center; text-decoration: none; margin-top: 10px; }
.asset-card h3 { margin: 0 0 4px 0; font-size: 16px; }
.asset-card p { margin: 0; font-size: 13px; color: var(--sub); }

/* Create booking form (booking-form.html) */
a.btn { display: inline-block; text-decoration: none; text-align: center; box-sizing: border-box; }
.form-step { margin-bottom: 18px; }
.form-step-label { display: block; font-size: 13px; font-weight: 700; color: var(--sub); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.user-search { width: min(460px, 100%); box-sizing: border-box; background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; }
.user-search:focus { outline: none; border-color: var(--accent); }
.user-suggest { min-width: 320px; }
.user-option { display: grid; grid-template-columns: 1fr auto; gap: 0 14px; padding: 2px 0; }
.user-option .muted { grid-column: 1; }
.user-open { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: #6ee7b7; }
.user-open.none { color: var(--sub); }
.user-chosen { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: 15px; }
.user-chosen .muted { margin: 0 6px; }
.user-chosen .btn { width: auto; margin-top: 0; }
.form-row { cursor: pointer; }
.form-asset { display: flex; align-items: center; gap: 10px; min-width: 200px; font-weight: 600; }
.manage-table td[data-col="qty"] { text-align: center; font-weight: 700; }
.form-footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin: 14px 0; }
.create-form-btn { width: auto; margin-top: 0; padding: 10px 22px; }
.create-form-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Stock audit (audit.html) — phone first */
.audit-page { max-width: 1100px; margin: 0 auto; }
.audit-h2 { font-size: 16px; margin: 22px 0 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.3px; }
.audit-new { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.audit-new .btn { width: auto; margin-top: 0; }
.audit-list { display: flex; flex-direction: column; gap: 8px; }
.audit-list-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.audit-list-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 180px; }
.audit-list-actions { display: flex; align-items: center; gap: 8px; }
.audit-list-actions .btn, .audit-actions .btn { width: auto; margin-top: 0; }
.phone-card { display: flex; gap: 18px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 6px 0 10px; }
.phone-card p { margin: 6px 0; font-size: 13px; }
.phone-qr { width: 150px; height: 150px; flex-shrink: 0; background: #fff; border-radius: 8px; padding: 4px; }
.phone-qr svg { width: 100%; height: 100%; display: block; }
.phone-url { font-size: 12px; color: #93c5fd; word-break: break-all; }
.scan-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: env(safe-area-inset-top); z-index: 5; background: var(--bg); padding: 6px 0 10px; }
.scan-head .btn { width: auto; margin-top: 0; }
.scan-title { font-size: 18px; font-weight: 700; }
.scan-result { border-radius: 10px; padding: 12px 14px; font-size: 16px; font-weight: 600; margin-bottom: 10px; border: 1px solid var(--border); background: var(--card); min-height: 48px; }
.scan-result.good { background: rgba(52, 211, 153, 0.15); border-color: rgba(52, 211, 153, 0.6); color: #d1fae5; }
.scan-result.new { background: rgba(37, 99, 235, 0.18); border-color: rgba(96, 165, 250, 0.7); color: #dbeafe; }
.scan-result.dup { background: var(--warn-bg); border-color: var(--warn); color: var(--warn-text); }
.scan-result.bad { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.scan-camera { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 60vh; background: #000; border-radius: 12px; overflow: hidden; }
.scan-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-freeze { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-freeze[hidden] { display: none; }
.scan-camera-off { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; background: var(--card); }
.scan-camera-off[hidden] { display: none; }
.scan-camera-off .btn { width: auto; padding: 14px 26px; font-size: 17px; }
.scan-camera-off a { color: #93c5fd; word-break: break-all; }
.scan-tools { display: flex; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.scan-tools .btn { width: auto; margin-top: 0; flex: 1; }
.scan-tools[hidden] { display: none; }
.scan-tools .torch-on { background: #facc15; border-color: #facc15; color: #1c1003; }
.scan-photo { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; width: auto; margin-top: 0; }
.scan-list { display: flex; flex-direction: column; gap: 6px; }
.scan-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.scan-row.pending { opacity: 0.6; }
.scan-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 14px; }
.scan-row-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-unknown-icon { width: 48px; height: 48px; border-radius: 6px; border: 1px dashed var(--border); display: flex; align-items: center; justify-content: center; color: var(--sub); flex-shrink: 0; font-weight: 700; }
.scan-time { font-size: 12px; white-space: nowrap; }
.audit-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.audit-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.audit-tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.audit-tile.warn { border-color: var(--warn); }
.audit-tile-n { font-size: 26px; font-weight: 800; }
.unlinked-group { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.unlinked-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.unlinked-select, .unlinked-batch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unlinked-bar .btn { width: auto; margin: 0; }
.unlinked-why { font-size: 12px; }
.unlinked-tick { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.unlinked-tick input { width: 18px; height: 18px; accent-color: var(--accent); }
.unlinked-row.selected { background: rgba(37, 99, 235, 0.14); margin: 0 -12px; padding: 6px 12px; }
.unlinked-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--card-hover); }
.unlinked-code { font-weight: 700; min-width: 90px; }
.unlinked-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.unlinked-actions .btn { width: auto; margin-top: 0; }
.audit-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.audit-items tr.audit-issue td[data-col="diff"] { color: #fca5a5; font-weight: 700; }
.audit-items td[data-col="owned"], .audit-items td[data-col="barcoded"], .audit-items td[data-col="unbarcoded"], .audit-items td[data-col="inStore"],
.audit-items td[data-col="shouldBeOut"], .audit-items td[data-col="actuallyOut"], .audit-items td[data-col="diff"] { text-align: center; }
.audit-issues { margin: 0 0 8px; padding-left: 18px; color: #fecaca; font-size: 13px; }
.audit-barcodes { display: flex; flex-wrap: wrap; gap: 6px; }
.unit-missing { border-color: rgba(239, 68, 68, 0.6); }
.chip-x { background: none; border: none; color: var(--sub); cursor: pointer; padding: 0 0 0 2px; font-size: 11px; }
.chip-x:hover { color: var(--danger); }
.audit-modal { width: min(620px, 100%); }
.picker-search { width: 100%; margin-bottom: 8px; }
.picker-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.picker-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); font: inherit; cursor: pointer; }
.picker-item:hover:not(.disabled) { border-color: var(--accent); }
.picker-item.chosen { border-color: var(--accent); background: rgba(37, 99, 235, 0.18); }
.picker-item.disabled { opacity: 0.45; cursor: not-allowed; }
.picker-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.picker-count { font-size: 12px; white-space: nowrap; }
.modal .user-search { width: 100%; }
.new-asset-preview img { width: 120px; height: 120px; border-radius: 8px; margin-top: 8px; object-fit: cover; }
.top-nav .audit-link { margin-left: 8px; text-decoration: none; }
.top-nav .audit-link + .basket-wrapper { margin-left: 8px; }


/* Medium widths: the page buttons (Manage Bookings, Stock audit, Basket)
   would run into the centred KitStore title, so they move to a second row. */
@media (max-width: 1000px) {
  .top-nav { height: auto; flex-wrap: wrap; row-gap: 8px; }
  .top-nav > .nav-left { flex: 1 0 100%; min-height: 32px; }
}

/* ==========================================================================
   Phones (≤ 640px): every page. Desktop layout above is unchanged.
   ========================================================================== */
@media (max-width: 640px) {
  body, body.audit-body { padding: calc(env(safe-area-inset-top) + 24px) 12px calc(120px + env(safe-area-inset-bottom)); }
  .container { gap: 16px; }
  .page-header h1, .asset-header h1 { font-size: 22px; }
  .page-header p { font-size: 13px; }
  .main-card, .sidebar-card { padding: 14px; margin-bottom: 16px; border-radius: 10px; }

  /* Top nav: Back (left) + KitStore (centre) on the first row; page links
     (Manage Bookings, Stock audit, Basket) share the second row. */
  .top-nav { height: auto; flex-wrap: wrap; row-gap: 8px; margin-bottom: 14px; }
  .top-nav > .nav-left { flex: 1 0 100%; min-height: 32px; }
  .top-nav .manage-link, .top-nav .audit-link, .top-nav .basket-wrapper { margin-left: 0; flex: 1 1 auto; min-width: 0; }
  .top-nav { column-gap: 6px; }
  .top-nav .manage-link, .top-nav .audit-link, .top-nav .basket-wrapper > .nav-btn-link { justify-content: center; font-size: 12px; padding: 7px 6px; white-space: nowrap; gap: 3px; }
  .top-nav .basket-wrapper > .nav-btn-link { width: 100%; }
  .top-nav .manage-link + .basket-wrapper, .top-nav .audit-link { margin-left: 0; }
  /* Asset page: the basket button floats top-right instead of sitting below the page. */
  .sidebar-nav { position: fixed; top: calc(env(safe-area-inset-top) + 24px); right: 12px; z-index: 300; margin: 0; height: 32px; }
  .sidebar-nav .nav-btn-link { background: var(--card); padding: 6px 10px; font-size: 13px; }

  /* Basket popup: a full-width sheet under the top bar. */
  .basket-overlay { position: fixed; top: calc(env(safe-area-inset-top) + 68px); left: 8px; right: 8px; width: auto; margin-left: 0; padding: 12px; }
  .basket-overlay .item-title, .basket-overlay .item-dates-btn { white-space: normal; }
  .basket-overlay .basket-item { gap: 8px; }

  /* Browse page: categories as a swipeable row of chips above the grid. */
  .catalog-layout { gap: 14px; }
  .catalog-filter { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; background: none; border: none; border-radius: 0; position: sticky; top: env(safe-area-inset-top); z-index: 20; background: var(--bg); scrollbar-width: none; }
  .catalog-filter::-webkit-scrollbar { display: none; }
  .catalog-filter h3 { display: none; }
  .filter-option { flex: 0 0 auto; white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px 5px 5px; background: var(--card); font-size: 13px; position: relative; }
  .filter-option:first-of-type { padding-left: 12px; }
  .filter-option input { position: absolute; opacity: 0; pointer-events: none; }
  .filter-option:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
  .filter-pic { width: 24px; height: 24px; border-radius: 50%; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .asset-card { padding: 8px; border-radius: 10px; }
  .asset-card .card-photo { margin-bottom: 8px; }
  .asset-card h3 { font-size: 14px; }
  .asset-card p { font-size: 12px; }
  .catalog-group { font-size: 16px; margin: 20px 0 10px; }

  /* Suggestion rows (frequently booked, deficit options): photo + name, the
     availability button underneath at full width. */
  .frequent-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 0 !important; }
  .suggested-item, .frequent-item { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .suggested-item > .pip-container { grid-column: 1 / -1; }
  .suggested-item .btn-avail { width: 100%; }

  /* Calendars and popovers fit the screen. */
  .pip-calendar { width: min(300px, calc(100vw - 24px)); }
  .calendar-header h3 { min-width: 0; font-size: 15px; }
  .date-num { top: 4px; right: 4px; font-size: 11px; }
  .date-status { bottom: 4px; left: 4px; font-size: 13px; }
  .category-popover { max-width: calc(100vw - 24px); }

  /* Basket rows (basket page + popup): photo + details, bin on the right. */
  .basket-item { gap: 8px; padding: 10px 6px; }
  .basket-item > div:first-child { min-width: 0; }
  .item-dates-btn { font-size: 12px; padding: 6px 8px; }
  [data-basket-page-items] .thumb-slideshow { width: 64px; height: 64px; }
  .option-row { flex-wrap: wrap; }
  .option-indent-prefix { width: auto; justify-content: flex-start; }
  .deficit-host { gap: 10px; }
  .host-slideshow { width: 64px; height: 64px; }

  /* Admin tables (Manage Bookings, booking form, audit summary) scroll sideways
     inside their frame; toolbars and modals stack. */
  .manage-toolbar { gap: 8px; }
  .manage-toolbar .bulk-select, .manage-toolbar .btn { flex: 1 1 calc(50% - 8px); }
  .toolbar-spacer { display: none; }
  .table-wrap { margin: 0 -12px; border-radius: 0; border-left: none; border-right: none; -webkit-overflow-scrolling: touch; }
  .manage-table { font-size: 12px; }
  .manage-table th, .manage-table td { padding: 6px 8px; }
  /* The first column (tick boxes / edit + cancel) stays put while the table scrolls sideways. */
  .manage-table tr > :first-child { position: sticky; left: 0; z-index: 2; background: var(--card); }
  .manage-table thead tr > :first-child { background: var(--card-alt); z-index: 3; }
  .manage-table tr.booking-detail > td:first-child { background: var(--bg); }
  /* An opened booking stays in view (screen-wide, pinned left) while the wide
     table scrolls; its own unit table scrolls inside it. */
  .booking-detail-inner { padding: 10px; overflow-x: auto; position: sticky; left: 0; width: 100vw; max-width: 100vw; }
  .detail-items { min-width: 560px; }
  .detail-head { font-size: 13px; }
  .detail-stock { flex-direction: column; gap: 4px; }
  .stock-line { white-space: normal; }
  .modal-backdrop { padding: 12px 8px; align-items: flex-start; }
  .modal { padding: 16px; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-actions .btn { flex: 1; }

  /* Create booking form */
  .user-search { width: 100%; }
  .user-chosen { padding: 10px 12px; font-size: 14px; }
  .form-footer { position: sticky; bottom: 0; z-index: 10; background: var(--bg); margin: 0 -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); justify-content: space-between; }
  .create-form-btn { padding: 10px 18px; }

  /* Stock audit */
  .phone-card { flex-direction: column; align-items: flex-start; }
  .unlinked-actions { margin-left: 0; width: 100%; }
  .unlinked-actions .btn { flex: 1; }
  .audit-new .user-search { flex: 1 1 100%; }
  .audit-new .btn { flex: 1; }
  .audit-list-actions { width: 100%; }
  .audit-list-actions .btn { flex: 1; }
  .audit-tiles { grid-template-columns: repeat(2, 1fr); }
}
.trust-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin: 6px 0 10px; font-size: 14px; }
.trust-card summary { cursor: pointer; font-weight: 600; }
.trust-card ol { padding-left: 20px; margin: 10px 0 6px; }
.trust-card li { margin-bottom: 8px; }
.trust-card .btn { width: auto; margin-top: 0; }

/* Phone on http: one-time "trust this PC" prompt (app.js section 12). */
.trust-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(37, 99, 235, 0.18); border: 1px solid rgba(96, 165, 250, 0.6); color: #dbeafe; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.trust-bar span { flex: 1 1 200px; }
.trust-bar a { color: #fff; font-weight: 700; }
.trust-bar button { background: none; border: none; color: #93c5fd; cursor: pointer; font-size: 14px; }

/* Scanner status line (audit.js setStatus): what the camera sees right now. */
.scan-status { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); font-size: 14px; }
.scan-status[hidden] { display: none; }
.scan-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--sub); }
.scan-status.searching .scan-dot { background: #60a5fa; animation: scan-pulse 1.2s ease-in-out infinite; }
.scan-status.seen { border-color: var(--warn); }
.scan-status.seen .scan-dot, .scan-status.blurry .scan-dot { background: #fbbf24; }
.scan-status.dark .scan-dot, .scan-status.paused .scan-dot { background: #f87171; }
.scan-status.read { border-color: rgba(52, 211, 153, 0.6); }
.scan-status.read .scan-dot { background: #34d399; }
@keyframes scan-pulse { 50% { opacity: 0.3; } }

/* Asset management (assets.html) */
.save-state { display: inline-block; font-size: 13px; padding: 5px 10px; border-radius: 999px; margin-bottom: 12px; border: 1px solid var(--border); }
.save-state.saved { color: #6ee7b7; border-color: rgba(52, 211, 153, 0.5); }
.save-state.saving { color: #93c5fd; border-color: rgba(96, 165, 250, 0.6); }
.save-state.error { color: #fecaca; border-color: rgba(239, 68, 68, 0.7); background: rgba(239, 68, 68, 0.12); }
.assets-toolbar { margin-top: 12px; }
.assets-footnote { font-size: 12px; margin-top: 12px; }
.asset-editor-grid { display: grid; grid-template-columns: 260px 1fr; gap: 20px; margin-bottom: 14px; }
.asset-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset-photo { position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--border); }
.asset-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.asset-photo .chip-x { position: absolute; top: 4px; right: 4px; background: rgba(15, 23, 42, 0.8); color: #fff; border-radius: 50%; width: 22px; height: 22px; padding: 0; }
.asset-photo.add { display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--sub); background: var(--bg); cursor: pointer; border-style: dashed; }
.asset-photo.add:hover { color: #fff; border-color: var(--accent); }
.asset-fields { display: flex; flex-direction: column; gap: 10px; }
.asset-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--sub); }
.asset-fields .modal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.asset-fields .user-search { width: 100%; font-size: 14px; padding: 8px 10px; }
.asset-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.asset-editor-actions .btn { width: auto; margin-top: 0; }
.danger-outline { border-color: var(--danger) !important; color: #fca5a5 !important; }
.danger-outline:hover { background: var(--danger) !important; color: #fff !important; }
.barcode-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.barcode-add .user-search { flex: 1 1 260px; width: auto; text-transform: uppercase; }
.barcode-add .btn { width: auto; margin-top: 0; }
.removed-list { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.removed-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--card-hover); }
.removed-row .btn { width: auto; margin-top: 0; }
.link-btn { background: none; border: none; color: #93c5fd; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.audit-links { margin: 0 0 12px; }
.audit-links .btn { width: auto; margin-top: 0; }
@media (max-width: 760px) {
  .asset-editor-grid { grid-template-columns: 1fr; }
  .asset-fields .modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-editor { width: 100vw; position: sticky; left: 0; }
}
.barcode-add .user-search::placeholder { text-transform: none; }

/* Login page */
.login-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 24px; }
.login-card p { margin: 0; }
.login-brand { font-weight: 800; font-size: 18px; }
.login-card .btn { margin-top: 4px; }
.login-card .manage-flash { margin: 0; }
.logout-link { color: var(--sub); font-size: 13px; text-decoration: none; }
.logout-link:hover { color: #fff; text-decoration: underline; }
.login-card .modal-label { display: block; margin: 0; font-size: 13px; }
.login-card .user-search { display: block; width: 100%; margin-top: 6px; background: var(--bg); }

/* Hardware barcode scanner field (audit scan screen) */
.wedge-box { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; font-size: 13px; }
.wedge-box .user-search { width: 100%; }
