/* =============================================================
   Admin + Company dashboard styles (same file in admin/ and adminco/)
   ============================================================= */
:root {
  --ink: #15171c;
  --ink-2: #4a505c;
  --ink-3: #8a909b;
  --paper: #f4f4f1;
  --surface: #ffffff;
  --line: #e3e3de;
  --line-soft: #efefeb;

  --accent: #2b4acb;
  --accent-soft: #e8ecfb;

  --green: #1f7a52;   --green-bg: #e3f3ea;
  --red: #b3332f;     --red-bg: #fbe8e6;
  --amber: #8a5a00;   --amber-bg: #fdf0d6;
  --slate-bg: #eef0f3;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 22, 28, .05), 0 4px 14px rgba(20, 22, 28, .05);
  --shadow-lg: 0 20px 50px rgba(20, 22, 28, .18);

  --display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Plan-specific pieces: only visible for the company's current plan */
body:not([data-mode="booking"]) [data-plan="booking"],
body:not([data-mode="inventory"]) [data-plan="inventory"],
body:not([data-mode="booking"]):not([data-mode="inventory"]) [data-plan="selling"] { display: none !important; }

/* ---------- Form controls ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label, .field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin: 12px 0 5px;
}
label small, .field-label small { font-weight: 400; color: var(--ink-3); }

/* ---------- Buttons ---------- */
.btn, .modal-btn-primary, .modal-btn-secondary, .add-company-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary, .modal-btn-primary, .add-company-btn { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled), .modal-btn-primary:hover:not(:disabled), .add-company-btn:hover { background: var(--accent); }
.btn-secondary, .modal-btn-secondary { background: var(--surface); border-color: var(--line); }
.btn-secondary:hover:not(:disabled), .modal-btn-secondary:hover:not(:disabled) { border-color: var(--ink-3); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; }

.btn-spinner {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Messages ---------- */
.message-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: var(--slate-bg);
  color: var(--ink-2);
}
.message-error { background: var(--red-bg); color: var(--red); }
.message-success { background: var(--green-bg); color: var(--green); }
.message-notice { background: var(--amber-bg); color: var(--amber); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--ink);
  color: #fff;
}
.brand { font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand span { color: #a9b8ff; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.plan-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
}
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #fff;
  font-weight: 500;
  font-size: 13.5px;
}
.logout-btn:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab-btn {
  padding: 14px 16px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--ink); }

.tab-page { display: none; }
.tab-page.active { display: block; }

/* ---------- Page shell ---------- */
.page, .app-main { max-width: 1240px; margin: 0 auto; padding: 28px; }
.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-toolbar h2 { font-size: 26px; }
.page-toolbar p { color: var(--ink-3); margin-top: 3px; }
.greeting { font-size: 28px; margin-bottom: 4px; }
.greeting-sub { color: var(--ink-3); margin-bottom: 24px; }

/* greeting on the left, big green total sales on the right */
.greeting-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.total-sales {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  cursor: default;
  outline: none;
}
.total-sales-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.total-sales-value { font-family: var(--display); font-size: clamp(28px, 4vw, 40px); font-weight: 700; line-height: 1.1; color: var(--green); }
.total-sales-hint { font-size: 12.5px; color: var(--ink-3); }
/* hover / focus: the same per-product bubble as the stat cards, anchored right */
.total-sales .stat-bubble { left: auto; right: 0; text-align: left; }
.total-sales .stat-bubble::before { left: auto; right: 22px; }
.total-sales:hover .stat-bubble,
.total-sales:focus-within .stat-bubble { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
@media (max-width: 560px) {
  .total-sales { align-items: flex-start; text-align: left; }
  .total-sales .stat-bubble { left: 0; right: auto; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 20px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-head h3 { font-size: 17px; }
.panel-head p { color: var(--ink-3); font-size: 13px; }

.empty-note, .list-empty, .section-empty-hint {
  color: var(--ink-3);
  text-align: center;
  padding: 28px 12px;
}

/* ================= ADMIN: company cards ================= */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.company-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.company-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.company-card h3 { font-size: 17px; }
.company-email { font-size: 13px; color: var(--ink-3); }
.company-desc { font-size: 13.5px; color: var(--ink-2); }
.company-meta { font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.company-card-actions { display: flex; gap: 8px; margin-top: auto; }
.edit-btn, .delete-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  font-size: 13px;
}
.edit-btn:hover { border-color: var(--ink); }
.delete-btn { color: var(--red); }
.delete-btn:hover { background: var(--red-bg); border-color: var(--red-bg); }

.mode-pill {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--slate-bg);
  color: var(--ink-2);
  white-space: nowrap;
}
.mode-pill.is-booking { background: var(--accent-soft); color: var(--accent); }
.mode-pill.is-inventory { background: var(--green-bg); color: var(--green); }
.mode-pill.is-none { background: var(--red-bg); color: var(--red); }

/* plan picker inside the company form */
.plan-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.plan-option { position: relative; margin: 0; }
.plan-option input { position: absolute; opacity: 0; pointer-events: none; }
.plan-option span {
  display: block;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.plan-option small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.plan-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.plan-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.booking-fields { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 2px; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 22, 28, .45);
  overflow-y: auto;
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 24px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.modal-box.is-wide { max-width: 640px; }
.modal-box h3 { font-size: 19px; padding-right: 36px; }
.modal-sub { color: var(--ink-3); font-size: 13.5px; margin-top: 4px; }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--slate-bg);
}
.modal-close svg { width: 16px; height: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair-wide { grid-template-columns: 3fr 2fr; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ink);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 26px; }
.login-card > p { color: var(--ink-3); margin: 4px 0 12px; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 11px; }
.register-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--ink-3);
}
.login-card .register-cta .btn { width: auto; flex: 1; margin-top: 0; }
#registerForm .modal-actions .btn { width: auto; }
/* the bot trap: off screen, never seen by people */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Not subscribed ---------- */
.not-subscribed {
  max-width: 520px;
  margin: 12vh auto 0;
  padding: 36px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.not-subscribed-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-bg);
  color: var(--amber);
}
.not-subscribed h2 { font-size: 22px; margin-bottom: 8px; }
.not-subscribed p { color: var(--ink-2); }
.not-subscribed .btn { margin-top: 20px; }

.loading-screen { text-align: center; color: var(--ink-3); padding: 20vh 20px; }

/* ================= COMPANY: stat cards (booking) ================= */
.stats-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
  transition: height .35s ease;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease, opacity .2s;
}
.stat-card.is-sibling-hidden { opacity: 0; pointer-events: none; }
.stat-card.is-expanded { z-index: 5; }
.card-summary { width: 100%; padding: 18px; border: 0; background: none; text-align: left; }
.stat-card.is-expanded .card-summary { cursor: default; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.stat-value { font-family: var(--display); font-size: 30px; font-weight: 600; margin-top: 4px; }
.stat-hint { font-size: 12px; color: var(--ink-3); }
.card-detail { display: none; padding: 0 18px 18px; height: calc(100% - 96px); }
.stat-card.detail-visible .card-detail { display: flex; flex-direction: column; }
.detail-head { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.detail-close { display: none; }
.stat-card.detail-visible .detail-close { display: inline-flex; }
.detail-list { overflow-y: auto; flex: 1; border-top: 1px solid var(--line-soft); }

.paid-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
}
.paid-strip strong { font-family: var(--display); font-size: 22px; }

/* order rows */
.order-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.order-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.order-user { font-weight: 600; }
.order-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.order-date, .order-refund { font-size: 13px; color: var(--ink-2); }
.order-contact { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.order-phone { color: var(--green); font-weight: 600; text-decoration: none; }
.order-status, .pill-tag, .prod-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 0;
  white-space: nowrap;
}
.pill-price { background: var(--slate-bg); color: var(--ink); }
.pill-confirmed { background: var(--green-bg); color: var(--green); align-self: flex-start; }
.pill-reason { background: var(--red-bg); color: var(--red); }
/* the three row buttons: same size and shape everywhere, so the payment
   flow reads the same on every booking and order */
.row-actions { display: flex; flex-direction: column; gap: 6px; flex: none; width: 150px; }
.act {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.act:disabled { cursor: not-allowed; opacity: .4; }
.act-go { background: var(--green); border-color: var(--green); color: #fff; }
.act-go:hover:not(:disabled) { background: #186343; }
.act-stop { background: var(--surface); border-color: var(--red-bg); color: var(--red); }
.act-stop:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: #fff; }
.act-doc { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.act-doc:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
/* a finished step: same box, not clickable */
.act-status { cursor: default; }
.act-status-go { background: var(--green-bg); color: var(--green); }
.act-status-stop { background: var(--red-bg); color: var(--red); }
.act-spacer { visibility: hidden; }
.pill-discount { background: var(--green-bg); color: var(--green); }
.pill-ref { background: var(--slate-bg); color: var(--ink-2); font-family: ui-monospace, Menlo, monospace; font-weight: 500; }

/* ---------- Month calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; }
.cal-head h3 { min-width: 150px; text-align: center; font-size: 16px; }
.cal-nav {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 6px; }
.cal-dow span { text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cal-week { position: relative; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 0.72;
  border: 1px solid var(--line-soft);
  margin: -1px 0 0 -1px;
  padding: 5px 7px;
}
.cal-cell.empty { background: #fafaf8; }
.cal-cell.today { background: var(--accent-soft); }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cal-cell.today .cal-num { color: var(--accent); }
/* bars sit below the day number so they never cover it */
.cal-bars-layer { position: absolute; top: 26px; right: 0; bottom: 4px; left: 0; pointer-events: none; }
.cal-bar { position: absolute; border-radius: 6px; pointer-events: auto; cursor: default; opacity: .92; }
.cal-bar:hover { opacity: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.cal-bar.is-half-left { border-radius: 6px 0 0 6px; }
.cal-bar.is-half-right { border-radius: 0 6px 6px 0; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); margin-top: 12px; }
.cal-legend .swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.swatch-today { background: var(--accent-soft); border: 1px solid var(--accent); }
.swatch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }

/* month view: Hour-setting bookings as small coloured dots, top-right of the day */
.cal-cell { position: relative; }
.cal-dots { position: absolute; top: 5px; right: 5px; display: flex; gap: 3px; align-items: center; z-index: 2; }
.cal-dot { display: block; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--surface); cursor: default; }
.cal-dots em { font-style: normal; font-size: 10px; font-weight: 600; color: var(--ink-3); }

/* week view: Day-setting bookings as lines across the top */
.week-allday { display: grid; grid-template-columns: 64px 1fr; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.week-allday-label { font-size: 11px; color: var(--ink-3); text-align: right; padding: 3px 8px 0 0; }
.week-allday-track { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 20px; gap: 3px 0; }
.week-allday-bar {
  margin: 0 3px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}
.week-allday-empty { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); padding: 2px 4px; }
/* dark blue line at the current time */
.week-now-line { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #1e3a8a; z-index: 3; pointer-events: none; }
.week-now-line span { position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #1e3a8a; }

.cal-tooltip {
  position: fixed;
  z-index: 200;
  max-width: 260px;
  padding: 10px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.tt-title { font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tt-dot { width: 9px; height: 9px; border-radius: 50%; }
.tt-row { opacity: .85; }
.tt-status { display: inline-block; margin-top: 6px; padding: 1px 8px; border-radius: 999px; font-weight: 600; text-transform: capitalize; }

/* ---------- Week calendar (hour mode) ---------- */
.week-scroll { overflow-x: auto; }
.week-inner { min-width: 760px; }
.week-dow { display: grid; grid-template-columns: 64px repeat(7, 1fr); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.week-dow span { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.week-body { display: grid; grid-template-columns: 64px 1fr; max-height: 560px; overflow-y: auto; }
.week-hour-label { height: 44px; font-size: 11px; color: var(--ink-3); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.week-grid { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); }
.week-day-col { position: relative; border-left: 1px solid var(--line-soft); }
.week-today-col { background: rgba(43, 74, 203, .04); }
.week-hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft); }
.week-block {
  position: absolute;
  left: 3px;
  right: 3px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  line-height: 1.3;
}
.wb-time { display: block; font-weight: 400; opacity: .9; }

/* ================= PRODUCTS TAB ================= */
.mode-toggle { display: inline-flex; padding: 3px; background: var(--slate-bg); border-radius: 10px; }
.mode-btn { padding: 7px 14px; border: 0; border-radius: 8px; background: none; font-weight: 600; color: var(--ink-2); }
.mode-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.mode-hint { color: var(--ink-3); font-size: 13px; margin-top: 8px; }

.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.save-bar .btn-primary { background: #fff; color: var(--ink); }
.save-bar .btn-primary:hover:not(:disabled) { background: #a9b8ff; }

.product-section { margin-top: 26px; }
.product-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-name-input {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
  font-family: var(--display);
  font-size: 18px !important;
  font-weight: 600;
  border-color: transparent !important;
  background: transparent !important;
  padding-left: 4px !important;
}
.section-name-input:hover { border-color: var(--line) !important; }
.section-name-input:focus { background: var(--surface) !important; border-color: var(--accent) !important; }

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.product-card.is-draft { border: 2px dashed var(--accent); }
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--slate-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-clickable { cursor: pointer; }
.thumb-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 22, 28, .55);
  color: #fff;
  font-weight: 600;
  opacity: 0;
  transition: opacity .2s;
}
.thumb-clickable:hover .thumb-overlay { opacity: 1; }
.img-count, .draft-badge {
  position: absolute;
  top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(20, 22, 28, .7);
  color: #fff;
}
.img-count { right: 8px; }
.draft-badge { left: 8px; background: var(--accent); }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
.time-row select { padding: 7px 6px; font-size: 13px; }
.time-sep { font-size: 12px; color: var(--ink-3); }
.add-slot-btn { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-weight: 600; font-size: 12.5px; }
.time-hint, .swatch-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.time-hint.is-error { color: var(--red); font-weight: 600; }
.time-hint:empty { display: none; }
.section-mode .mode-btn { padding: 5px 11px; font-size: 12.5px; }
.slot-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.slot-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.slot-tag-remove { width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(43, 74, 203, .15); color: var(--accent); line-height: 1; }
.slot-tags-empty { font-size: 12.5px; color: var(--ink-3); }
.swatch-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-btn { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.swatch-btn.is-selected { border-color: #fff; box-shadow: 0 0 0 2px var(--ink); }
.exclusion-btn, .stock-btn {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  font-size: 13px;
}
.remove-product { padding: 8px; border: 0; border-radius: var(--radius-sm); background: var(--red-bg); color: var(--red); font-weight: 600; font-size: 13px; }
.stock-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; min-height: 38px; background: var(--slate-bg); border-radius: var(--radius-sm); font-size: 13px; }
.stock-line strong { font-family: var(--display); font-size: 17px; }

/* ---------- Exclusion calendar ---------- */
.excl-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 10px; }
.excl-head h4 { min-width: 150px; text-align: center; }
.excl-dow, .excl-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.excl-dow span { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.excl-cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--slate-bg); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.excl-cell:hover:not(.empty):not(.is-past) { background: var(--accent-soft); }
.excl-cell.empty { background: none; cursor: default; }
.excl-cell.is-past { opacity: .35; cursor: default; }
.excl-cell.is-excluded { background: var(--red); color: #fff; }
.excl-toggle { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 500; color: var(--ink); }
.excl-toggle input { width: auto; }
.excl-time-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin-top: 8px; }

/* ---------- Image manager ---------- */
.image-modal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.image-modal-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--slate-bg); }
.image-modal-item img { width: 100%; height: 100%; object-fit: cover; }
.image-modal-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(20, 22, 28, .7); color: #fff; }
.image-modal-remove svg { width: 13px; height: 13px; }
.image-modal-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.image-modal-footer span { font-size: 13px; color: var(--ink-3); }

/* ---------- Cancel reasons ---------- */
.reason-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.reason-opt { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 500; color: var(--ink); cursor: pointer; }
.reason-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.reason-opt input { width: auto; }

/* ================= INVENTORY ================= */
.inv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.inv-stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.inv-stat.is-alert .stat-value { color: var(--amber); }
.inv-stat.is-danger .stat-value { color: var(--red); }

.inv-filter { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.inv-filter input { width: 210px; }
.inv-filter select { width: auto; }

.table-scroll { overflow-x: auto; margin: 0 -20px -20px; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.inv-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  background: #fafaf8;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.inv-table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.inv-table tr:last-child td { border-bottom: 0; }
.inv-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-product { display: flex; align-items: center; gap: 10px; }
.inv-product img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; background: var(--slate-bg); flex: none; }
.inv-product small { display: block; color: var(--ink-3); }

.stock-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.stock-ok { background: var(--green-bg); color: var(--green); }
.stock-low { background: var(--amber-bg); color: var(--amber); }
.stock-out { background: var(--red-bg); color: var(--red); }

.inv-columns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 20px; }
.inv-columns .panel + .panel { margin-top: 0; }
.log-list { max-height: 460px; overflow-y: auto; margin: 0 -4px; }

/* Bookings / History / Orders / Stock history: a FIXED height that scrolls,
   so the panels don't grow or shrink as rows are added or filtered.
   Change this number to make those lists taller or shorter. */
.log-list.sales-list { height: 520px; max-height: none; }

/* filter bar above Export to Excel / Download all invoices */
.sales-filter {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(230px, 1.6fr) minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
.sales-filter > * { min-width: 0; }
.sales-filter input, .sales-filter select { width: 100%; min-width: 0; padding: 7px 10px; font-size: 13px; }
.sales-filter-dates { display: flex; align-items: center; gap: 6px; }
.sales-filter-dates input { min-width: 0; flex: 1; }
.sales-filter-dates span { color: var(--ink-3); }
.sales-filter-actions { display: flex; gap: 6px; }
.sales-filter-note { min-height: 1em; margin-top: 6px; font-size: 12.5px; color: var(--accent); }
.sales-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
@media (max-width: 1100px) {
  .sales-filter { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .sales-filter { grid-template-columns: 1fr; }
}
.log-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.log-row:last-child { border-bottom: 0; }
.log-row small { display: block; color: var(--ink-3); }
.log-change { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-change.up { color: var(--green); }
.log-change.down { color: var(--red); }

.order-actions { display: flex; gap: 6px; }
.status-pending { background: var(--slate-bg); color: var(--ink-2); }
.status-completed, .status-confirmed { background: var(--green-bg); color: var(--green); }
.status-cancelled { background: var(--red-bg); color: var(--red); }

.stock-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.settings-grid form .btn { margin-top: 16px; }

/* ---------- Discount codes ---------- */
.discount-panel { margin-top: 20px; }
.discount-form {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr 1fr 1.1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}
.discount-value { display: flex; gap: 6px; }
.discount-value input { min-width: 0; flex: 1; }
.discount-value select { width: auto; flex: none; }
.discount-form-actions { display: flex; gap: 6px; }
.discount-form-actions .btn { white-space: nowrap; }
#dcCode { text-transform: uppercase; }
.discount-panel .table-wrap { overflow-x: auto; }
.discount-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13.5px; }
.discount-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.discount-table td { padding: 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.discount-table td:last-child { text-align: right; white-space: nowrap; }
.discount-table .code-cell { font-family: ui-monospace, Menlo, monospace; font-weight: 700; letter-spacing: .04em; }
.discount-table tr.is-off td:not(:last-child) { color: var(--ink-3); }
.discount-table td:last-child .btn + .btn { margin-left: 6px; }
.qr-box { display: flex; gap: 16px; align-items: center; }
.qr-frame { width: 120px; height: 120px; flex: none; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--ink-3); font-size: 12px; text-align: center; overflow: hidden; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }


/* ---------- Admin: website fields ---------- */
.form-group { border: 0; border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 6px; }
.form-group legend { font-family: var(--display); font-weight: 600; font-size: 15px; padding-right: 8px; }
.field-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }
.field-hint code { background: var(--slate-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
#fSiteFolderSelect + #fSiteFolder { margin-top: 8px; }
.cover-picker { display: flex; gap: 14px; align-items: center; }
.cover-preview { width: 132px; aspect-ratio: 16 / 10; flex: none; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--slate-bg); color: var(--ink-3); font-size: 12px; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 12px 0 0; font-weight: 500; color: var(--ink); cursor: pointer; }
.check-row input { width: auto; }
.company-card-cover { margin: -18px -18px 0; aspect-ratio: 16 / 7; background: var(--slate-bg); }
.company-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.site-line { font-size: 13px; }
.site-line a { font-weight: 600; word-break: break-all; }
.site-line .muted { color: var(--ink-3); }
.pill-featured { background: var(--amber-bg); color: var(--amber); }
.pill-hidden { background: var(--slate-bg); color: var(--ink-3); }
.card-pills { display: flex; gap: 6px; flex-wrap: wrap; }


/* ================= ADMIN: company list ================= */
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.admin-filters select { width: auto; min-width: 150px; }
.search-box {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-weight: 400;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; padding: 10px 0; box-shadow: none !important; background: transparent; }
.result-count { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }

.company-list { display: flex; flex-direction: column; gap: 14px; }
.co-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.co-main {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 16px;
}
.co-thumb {
  width: 120px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
}
.co-thumb img { width: 100%; height: 100%; object-fit: cover; }
.co-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.co-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.co-title h3 { font-size: 18px; }
.co-meta { font-size: 13px; color: var(--ink-3); }
.co-meta strong { color: var(--ink-2); font-weight: 500; }
.co-desc { font-size: 13.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.co-site { font-size: 12.5px; }
.co-site code { background: var(--slate-bg); padding: 1px 6px; border-radius: 4px; }
.co-site .warn { color: var(--amber); font-weight: 600; }

/* None / Booking / Inventory switch */
.plan-switch {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 4px;
  padding: 3px;
  background: var(--slate-bg);
  border-radius: 10px;
}
.plan-btn {
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}
.plan-btn:hover:not(.is-on) { color: var(--ink); }
.plan-btn.is-on { background: var(--surface); box-shadow: var(--shadow); }
.plan-btn.is-on[data-set-plan="none"] { color: var(--red); }
.plan-btn.is-on[data-set-plan="booking"] { color: var(--accent); }
.plan-btn.is-on[data-set-plan="inventory"] { color: var(--green); }

.co-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 170px; }
.products-btn .chev { transition: transform .2s; }
.products-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.co-delete { background: none; border: 0; color: var(--red); font-size: 12.5px; font-weight: 600; padding: 4px; }
.co-delete:hover { text-decoration: underline; }
.badge-warn { background: var(--amber-bg); color: var(--amber); }

/* products dropdown */
.co-products { border-top: 1px solid var(--line); padding: 14px 16px 16px; background: #fafaf8; border-radius: 0 0 var(--radius) var(--radius); }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cp-head h4 { font-family: var(--display); font-size: 15px; }
.cp-head p { font-size: 12.5px; color: var(--ink-3); }
.cp-tools { display: flex; gap: 8px; }
.cp-tools input { width: 200px; padding: 7px 10px; font-size: 13px; }
.cp-tools select { width: auto; padding: 7px 10px; font-size: 13px; }

.product-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}
.p-card {
  flex: 0 0 210px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.p-card.is-inactive { opacity: .6; }
.p-card.needs-link { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.p-img { aspect-ratio: 4 / 3; background: var(--slate-bg); display: grid; place-items: center; font-size: 12px; color: var(--ink-3); }
.p-img img { width: 100%; height: 100%; object-fit: cover; }
.p-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; flex: 1; }
.p-body strong { font-size: 14px; }
.p-price { font-size: 13px; font-weight: 600; }
.p-price s { color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.p-sub { font-size: 12px; color: var(--ink-3); }
.p-link { font-size: 12px; word-break: break-all; }
.p-link.is-missing { color: var(--amber); font-weight: 600; }
.p-body .btn { margin-top: auto; }
.p-body .p-link + .btn { margin-top: 8px; }
.cp-empty { font-size: 13px; color: var(--ink-3); padding: 12px 0; }

/* product link modal */
.link-options { grid-template-columns: 1fr 1fr; }
.path-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.path-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.path-input input { border: 0; border-radius: 0; box-shadow: none !important; min-width: 80px; }
.path-part {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--slate-bg);
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .co-main { grid-template-columns: 88px 1fr; }
  .co-thumb { width: 88px; font-size: 24px; }
  .co-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .co-actions .btn { flex: 1; }
}
@media (max-width: 560px) {
  .co-main { grid-template-columns: 1fr; }
  .co-thumb { width: 100%; aspect-ratio: 16 / 7; }
  .link-options { grid-template-columns: 1fr; }
  .cp-tools { width: 100%; }
  .cp-tools input { flex: 1; width: auto; }
}


/* ---------- Invoices ---------- */
.pill-invoice { background: var(--accent-soft); color: var(--accent); }
.detail-head { flex-wrap: wrap; }


/* ================= OVERVIEW: stat cards, bubbles, calendar card ================= */
/* numbers shrink to fit their card (dashboard.js sets the exact size) */
.inv-stat { position: relative; min-width: 0; }
.inv-stat .stat-value { white-space: nowrap; overflow: hidden; text-overflow: clip; line-height: 1.15; }
.inv-stat .stat-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* chat-bubble list shown when hovering (or tabbing to) a card's number */
.inv-stat.has-bubble { cursor: help; outline: none; }
.inv-stat.has-bubble:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.stat-bubble {
  position: absolute;
  top: calc(100% - 6px);
  left: 14px;
  z-index: 30;
  width: max-content;
  min-width: 220px;
  max-width: 300px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  pointer-events: none;
}
/* the little tail pointing up at the number */
.stat-bubble::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 22px;
  border: 7px solid transparent;
  border-top: 0;
  border-bottom-color: var(--ink);
}
.inv-stat.has-bubble:hover .stat-bubble,
.inv-stat.has-bubble:focus-within .stat-bubble { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
.inv-stats > .inv-stat:nth-last-child(-n+2) .stat-bubble { left: auto; right: 14px; }
.inv-stats > .inv-stat:nth-last-child(-n+2) .stat-bubble::before { left: auto; right: 22px; }
.stat-bubble strong { display: block; font-family: var(--display); font-size: 13.5px; margin-bottom: 6px; }
.stat-bubble ul { list-style: none; max-height: 230px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.stat-bubble li { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.stat-bubble li:first-child { border-top: 0; }
.stat-bubble li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.stat-bubble li b { font-weight: 600; white-space: nowrap; }
.stat-bubble .muted { opacity: .6; }

/* calendar card: black, first in the row, grows into the full calendar */
.cal-card {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.cal-card-summary {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  text-align: left;
}
.cal-card-summary:hover { background: #24272f; }
.cal-card .stat-label { color: rgba(255, 255, 255, .6); }
.cal-card .stat-hint { color: rgba(255, 255, 255, .55); }
.cal-card-next { font-family: var(--display); font-size: 19px; font-weight: 600; line-height: 1.2; }

/* the calendar card is two boxes wide: Day countdown | Hour countdown */
.inv-stats > .cal-card { grid-column: span 2; }
.cal-half { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; }
.cal-half + .cal-half { border-left: 1px solid rgba(255, 255, 255, .14); }
@media (max-width: 560px) {
  .inv-stats > .cal-card { grid-column: 1 / -1; }
}

/* Month / Week switch in the open calendar */
.cal-view-toggle { display: inline-flex; padding: 3px; margin-left: auto; margin-right: 10px; background: rgba(255, 255, 255, .12); border-radius: 10px; }
.cal-view-btn { padding: 6px 14px; border: 0; border-radius: 8px; background: none; color: rgba(255, 255, 255, .75); font-weight: 600; font-size: 13px; }
.cal-view-btn.active { background: #fff; color: var(--ink); }
.cal-card.is-open { grid-column: 1 / -1; padding: 16px; }
.cal-card.is-open .cal-card-summary { display: none; }
.cal-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-card-top h3 { font-size: 17px; }
.cal-card-close { background: rgba(255, 255, 255, .12); color: #fff; border: 0; }
.cal-card-close:hover { background: rgba(255, 255, 255, .22); }
.cal-card-inner { background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: 18px; }

/* ================= manual booking / order ================= */
.manual-panel .panel-head { margin-bottom: 0; }
.manual-form { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.manual-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 14px; }
.manual-total { font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink-2); }


/* ---------- colour pickers ---------- */
.section-color { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.section-color-pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.section-color-pick:hover { border-color: var(--ink-3); }
input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }


/* ================= PRODUCTS TAB: one row per product ================= */
/* like the company list in admin: photo | fields | buttons, stacked down */
.products-grid { display: flex; flex-direction: column; gap: 12px; }
.products-grid > .product-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px;
  gap: 18px;
  align-items: start;
  padding: 14px;
}

/* move up / down: two buttons on the left of every saved card */
.products-grid > .product-card[data-product-id] { position: relative; padding-left: 46px; }
.move-btns {
  position: absolute;
  top: 50%;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateY(-50%);
}
.move-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.move-btn:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: #fff; }
.move-btn:disabled { opacity: .3; cursor: not-allowed; }
/* the card that just moved: lifted above the one it slides past, briefly outlined */
.product-card.is-moving { z-index: 2; animation: card-moved 1s ease; }
@keyframes card-moved {
  0%, 40% { box-shadow: 0 0 0 2px var(--accent), var(--shadow-lg); }
  100% { box-shadow: var(--shadow); }
}
@media (prefers-reduced-motion: reduce) {
  .product-card.is-moving { animation: none; }
}
.products-grid .thumb { border-radius: var(--radius-sm); overflow: hidden; }
.product-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
}
.pf { min-width: 0; }
.pf .field-label { margin: 0 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-full { grid-column: 1 / -1; }
.pf input[type="color"] { width: 38px; height: 38px; border-radius: var(--radius-sm); }
.pf input[type="color"]::-webkit-color-swatch { border-radius: 6px; }
.pf input[type="color"]::-moz-color-swatch { border-radius: 6px; }
.card-actions { display: flex; flex-direction: column; gap: 8px; }
.card-actions > * { width: 100%; }
.product-card.is-draft .draft-badge { left: 6px; top: 6px; }

@media (max-width: 1000px) {
  .product-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .products-grid > .product-card { grid-template-columns: 110px minmax(0, 1fr); }
  .card-actions { grid-column: 1 / -1; flex-direction: row; }
  .card-actions > * { width: auto; flex: 1; }
}
@media (max-width: 480px) {
  .products-grid > .product-card { grid-template-columns: 1fr; }
  .product-body { grid-template-columns: 1fr; }
}


/* a choice that isn't available (e.g. folder links for a company without a plan) */
.plan-option input:disabled + span { opacity: .45; cursor: not-allowed; }
/* the Management tab when the company has no plan */
.tab-btn.is-locked { color: var(--ink-3); opacity: .7; }
.tab-btn.is-locked.active { opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .inv-columns, .settings-grid { grid-template-columns: 1fr; }
  .discount-form { grid-template-columns: 1fr 1fr; }
  .discount-form-actions { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar, .tabs { padding-left: 16px; padding-right: 16px; }
  .page, .app-main { padding: 18px 16px; }
  .field-pair, .plan-options { grid-template-columns: 1fr; }
  .company-grid { grid-template-columns: 1fr; }
  .cal-cell { padding: 3px 4px; }
  .order-row { flex-direction: column; }
  .row-actions { flex-direction: row; width: 100%; }
  .row-actions .act { flex: 1; min-width: 0; }
  .act-spacer { display: none; }
  .plan-badge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
