:root {
  --page-bg: #f4f7fb;
  --page-bg-top: #f8fbff;
  --panel-bg: #ffffff;
  --panel-border: #d7e0ef;
  --text-main: #1b355e;
  --text-muted: #61738f;
  --input-border: #c7d3e6;
  --primary: #1d4f91;
  --primary-strong: #173f74;
  --success: #1e9a59;
  --danger: #c0392b;
  --neutral: #7b8596;
  --shadow: 0 8px 24px rgba(21, 52, 94, 0.08);
}

/* Site-wide dark theme (js/theme.js sets data-theme="dark"/"light" on <html>, toggled from
   Dashboard - see .theme-toggle-group below). --primary/--primary-strong are deliberately left
   unchanged - the top nav is already a dark navy blue in the light theme, so it reads fine as-is
   in dark mode too and doesn't need its own override. Badge colors (.badge-success etc.) are also
   left as their light pastel values on purpose - they still read fine against a dark panel, the
   same way GitHub/most dark-mode UIs keep colored status pills light. */
:root[data-theme="dark"] {
  --page-bg: #0b1220;
  --page-bg-top: #0d1524;
  --panel-bg: #111a2c;
  --panel-border: #22314b;
  --text-main: #e6f1ff;
  --text-muted: #8a9bbd;
  --input-border: #2c3c58;
  --success: #2ecc82;
  --danger: #e2695a;
  --neutral: #8a9bbd;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] table,
:root[data-theme="dark"] .modal-panel {
  background: var(--panel-bg);
}

:root[data-theme="dark"] th {
  background: #16213a;
}

:root[data-theme="dark"] tr.clickable-row:hover {
  background: #16213a;
}

/* Theme toggle (Dashboard only - see docs/dashboard.html/js/dashboard.js's wireThemeToggle). */
.theme-toggle-group {
  display: inline-flex;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}

.theme-toggle-btn {
  background: var(--panel-bg);
  color: var(--text-muted);
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle-btn + .theme-toggle-btn {
  border-left: 1px solid var(--panel-border);
}

.theme-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, var(--page-bg-top) 0%, var(--page-bg) 100%);
  color: var(--text-main);
}

/* Optional company background image (General Setup) on authenticated pages (currently
   Dashboard - see js/companyBranding.js's applyAppBackground). A light tint, not a dark one like
   the Login page's version, since this page's cards/text are designed for a light background -
   the photo shows through faintly as texture rather than replacing the theme. .page/#topnav get
   position+z-index below so they still paint above the fixed overlay (a position:fixed element
   with an explicit z-index otherwise paints above non-positioned in-flow content). */
body.app-has-photo-bg {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body.app-has-photo-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(244, 247, 251, 0.8);
  z-index: 0;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

@media (max-width: 480px) {
  .page {
    padding: 14px;
  }
}

.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

h1, h2, h3 {
  color: var(--text-main);
  margin-top: 0;
}

/* Top navigation */
#topnav {
  background: var(--primary);
  box-shadow: var(--shadow);
  position: relative;
  /* Must beat .page's z-index: 1 above - equal z-index falls back to DOM order, and .page (the
     content below the nav, e.g. Dashboard's welcome heading) comes later in the HTML, so a tied
     value let page content paint over the nav's dropdown menus and swallow their clicks. Still
     well under .modal-backdrop's z-index: 100 so modals correctly cover the nav. */
  z-index: 30;
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.topnav-brand {
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.topnav-link {
  color: #dce8fb;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

.topnav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.topnav-link.active {
  background: #fff;
  color: var(--primary-strong);
}

.topnav-group {
  position: relative;
}

.topnav-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: #dce8fb;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.topnav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.topnav-group-toggle.active {
  background: #fff;
  color: var(--primary-strong);
}

.topnav-group-caret {
  font-size: 10px;
  transition: transform 0.15s ease;
}

.topnav-group.open .topnav-group-caret {
  transform: rotate(180deg);
}

.topnav-group-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 210px;
  z-index: 20;
}

.topnav-group.open .topnav-group-menu {
  display: block;
}

.topnav-group-menu .topnav-link {
  display: block;
  color: var(--text-main);
  padding: 8px 10px;
}

.topnav-group-menu .topnav-link:hover {
  background: var(--page-bg);
}

.topnav-group-menu .topnav-link.active {
  background: var(--primary);
  color: #fff;
}

.topnav-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.topnav-logout:hover {
  background: rgba(255, 255, 255, 0.12);
}

.topnav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* Below this width the full link list (~20 items) wraps into a wall of text before any page
   content is visible - see js/nav.js's renderTopNav. Collapse it behind the hamburger toggle
   instead: links stack full-width in a dropdown that's closed by default. */
@media (max-width: 860px) {
  .topnav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topnav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 2px;
    margin-top: 10px;
  }

  .topnav-links.open {
    display: flex;
  }

  .topnav-link {
    padding: 12px 14px;
    border-radius: 6px;
  }

  .topnav-group-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 12px 14px;
  }

  .topnav-group-menu {
    display: none;
    position: static;
    width: 100%;
    margin-top: 0;
    padding: 0 0 0 14px;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .topnav-group.open .topnav-group-menu {
    display: block;
  }

  .topnav-group-menu .topnav-link {
    color: #dce8fb;
  }

  .topnav-group-menu .topnav-link:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .topnav-group-menu .topnav-link.active {
    background: #fff;
    color: var(--primary-strong);
  }

  .topnav-logout {
    margin-top: 6px;
    text-align: center;
  }
}

/* Cards */
.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

/* Login page - dark gradient backdrop behind a frosted-glass sign-in card; swapped for an
   uploaded photo background below when one is set (see js/companyBranding.js's
   applyLoginBackground). */
body.login-backdrop {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 30% 20%, #24466f 0%, #0d1b2a 55%, #05090f 100%);
  position: relative;
  overflow-x: hidden;
}

/* Uploaded a dedicated background image (General Setup) - use it full-bleed instead of the
   gradient+watermark fallback above, with a dark overlay so the glass card keeps enough
   contrast regardless of how busy/light the photo is. */
body.login-backdrop.login-has-photo-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

body.login-backdrop.login-has-photo-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 15, 0.4);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  max-width: 380px;
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  padding: 32px 28px;
}

.login-card h1 {
  color: #fff;
}

.login-card p.muted {
  color: rgba(255, 255, 255, 0.75);
}

.login-card label {
  color: rgba(255, 255, 255, 0.85);
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.nav-card {
  display: block;
  text-decoration: none;
  color: var(--text-main);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 26px 20px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(21, 52, 94, 0.14);
}

.nav-card .icon {
  font-size: 34px;
  margin-bottom: 10px;
}

.nav-card .title {
  font-weight: 700;
  font-size: 16px;
}

/* Forms */
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-main);
  background: #fff;
}

.form-row {
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-grid-single {
  grid-template-columns: 1fr;
}

.form-group {
  margin-bottom: 20px;
}

.form-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--panel-border);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary {
  background: var(--neutral);
  color: #fff;
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
  font-size: 13px;
}

th {
  background: #eef3fb;
  color: var(--text-main);
  font-weight: 700;
}

tr.clickable-row {
  cursor: pointer;
}

tr.clickable-row:hover {
  background: #f2f7ff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

/* Transfer Orders' Line Items table (js/transferOrders.js) needs its item/variant suggestion
   dropdowns to extend below the table without being clipped. Plain .table-wrap can't allow that:
   per the CSS overflow spec, when overflow-x is 'auto' and overflow-y is left at its 'visible'
   default, the browser silently forces overflow-y to 'auto' too - so the dropdown was being
   clipped/scrolled away by the table-wrap itself, not actually hidden. This override restores
   true 'visible' on both axes for this one table. */
.line-items-wrap {
  overflow: visible;
}

/* Manage modal's lines table (js/transferOrders.js's renderManageLines) needs the same treatment -
   its "Serials to Ship" .serial-tag-dropdown is position:absolute within this table-wrap, so a
   plain .table-wrap's forced overflow-y:auto clipped/scrolled it away instead of letting it float
   over the Pancake Sync section below. */
.manage-lines-wrap {
  overflow: visible;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-success { background: #e3f7ea; color: var(--success); }
.badge-warning { background: #fff3d6; color: #a6720a; }
.badge-danger { background: #fbe4e1; color: var(--danger); }
.badge-neutral { background: #eef1f6; color: var(--neutral); }
.badge-primary { background: #e2ecfb; color: var(--primary); }
.badge-purple { background: #ece5fa; color: #7b5bc9; }
.badge-glass { background: #dcf1fb; color: #146b96; }

.pancake-order-id-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.pancake-order-id-link:hover { text-decoration: underline; }

/* Status count summary bar (Online Orders page) */
.status-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 16px;
}

.status-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.status-summary-pill:hover {
  border-color: var(--primary);
}

/* Applied to whichever pill's status currently matches the status filter box, so clicking a
   pill to filter the list gives a clear "this is the active filter" indication. */
.status-summary-pill.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(29, 79, 145, 0.18);
}

.status-summary-pill .status-summary-count {
  font-size: 16px;
  font-weight: 700;
}

/* Grouped Confirmed/Printed/To Ship tabs + card list (Online Order Staff view, Online Orders page)
   - built for a phone screen: big tap targets, one column, no horizontal scrolling. */
.grouped-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.grouped-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.grouped-tab-btn:hover {
  border-color: var(--primary);
}

.grouped-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(29, 79, 145, 0.18);
}

.grouped-tab-count {
  font-size: 18px;
  font-weight: 800;
}

.order-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  padding: 14px 16px;
}

.order-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-card-id {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.order-card-customer {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 10px;
}

.order-card-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  font-size: 13px;
}

.order-card-label {
  color: var(--neutral);
  font-weight: 600;
}

.order-card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.order-card-actions .btn {
  flex: 1;
  text-align: center;
  padding: 10px 12px;
  font-size: 14px;
}

/* Dashboard status overview cards */
.stat-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 20px 0 30px;
}

.stat-card {
  display: block;
  text-decoration: none;
  color: var(--text-main);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(21, 52, 94, 0.14);
}

.stat-card .stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.stat-card .stat-icon {
  font-size: 16px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-card.stat-confirmed .stat-value { color: var(--primary); }
.stat-card.stat-printed .stat-value { color: #a6720a; }
.stat-card.stat-to-ship .stat-value { color: #7b5bc9; }
.stat-card.stat-shipped .stat-value { color: var(--success); }
.stat-card.stat-cancelled .stat-value { color: var(--danger); }

/* Dashboard notification center - attention-needed items (e.g. Requested transfer orders sitting
   unshipped). Amber, matching the "Requested" status badge color elsewhere in the portal, so the
   two visually reinforce each other. */
.notification-center {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}

.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff3d6;
  border: 1px solid #f0d9a0;
  border-radius: 10px;
  padding: 14px 20px;
  color: #7a5a05;
}

.notification-item .notification-message {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.notification-item .notification-icon {
  font-size: 18px;
}

.notification-item .notification-action {
  flex-shrink: 0;
  white-space: nowrap;
  font-weight: 700;
  color: #a6720a;
  text-decoration: none;
  border: 1px solid #a6720a;
  border-radius: 6px;
  padding: 6px 12px;
  background: #fff;
  transition: background 0.15s ease, color 0.15s ease;
}

.notification-item .notification-action:hover {
  background: #a6720a;
  color: #fff;
}

/* Dashboard financial overview cards (super users only), grouped into "Monthly"/"Daily" sections */
.finance-section-heading {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.finance-section-heading:first-child {
  margin-top: 20px;
}

.finance-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 0 0 6px;
}

.finance-card {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 22px 24px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(21, 52, 94, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.finance-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(21, 52, 94, 0.24);
}

.finance-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.finance-card.finance-receive {
  background: linear-gradient(135deg, #f5934a 0%, #c0392b 100%);
}

.finance-card.finance-sales {
  background: linear-gradient(135deg, #22b6a3 0%, #1d4f91 100%);
}

.finance-card.finance-walkin {
  background: linear-gradient(135deg, #f2994a 0%, #6a3093 100%);
}

.finance-card.finance-daily-online {
  background: linear-gradient(135deg, #56ab2f 0%, #1d4f91 100%);
}

.finance-card.finance-daily-walkin {
  background: linear-gradient(135deg, #f7971e 0%, #b3336a 100%);
}

.finance-card.finance-expense {
  background: linear-gradient(135deg, #8a5cf6 0%, #c0392b 100%);
}

.finance-card.finance-daily-expense {
  background: linear-gradient(135deg, #c0392b 0%, #6a3093 100%);
}

.finance-card.finance-purchase {
  background: linear-gradient(135deg, #4a90d9 0%, #173f74 100%);
}

.finance-card .finance-value.placeholder {
  font-size: 22px;
  font-weight: 700;
  opacity: 0.9;
}

.finance-card .finance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.finance-card .finance-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.88);
}

.finance-card .finance-icon {
  font-size: 22px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.finance-card .finance-value {
  font-size: 34px;
  font-weight: 800;
  margin-top: 14px;
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
}

.finance-card .finance-sub {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  z-index: 1;
}

/* Dashboard "Sales by Staff (Confirmed By)" cards (super users only) - one card per Sales User,
   each with three clickable figures (Daily/Monthly/Previous Month) that deep-link into Online
   Orders scoped to that staff member + period (see js/dashboard.js's loadSalesByStaff and
   onlineOrders.js's confirmedBy/period URL handling). */
.staff-sales-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 0 0 6px;
}

.staff-sales-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.staff-sales-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.staff-sales-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Rank badge (staffRankBadgeHtml in js/dashboard.js) - top 3 get a medal emoji (larger, no pill
   background needed), the rest get a plain "#N" pill. */
.staff-rank-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.staff-rank-badge-top {
  background: transparent;
  font-size: 22px;
  padding: 0;
}

.staff-sales-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22b6a3 0%, #1d4f91 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.staff-sales-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
}

.staff-sales-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.staff-sales-stat {
  display: block;
  text-decoration: none;
  background: var(--page-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.staff-sales-stat:hover {
  background: #e2ecfb;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.staff-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.staff-stat-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.staff-stat-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 420px) {
  .staff-sales-stats {
    grid-template-columns: 1fr;
  }
}

/* Per-staff monthly target progress block (staffTargetHtml in js/dashboard.js) - only rendered
   when that staff member has a target set in User Setup. Smaller-scale version of the site-wide
   .target-progress-track/.target-progress-fill pair, sized to fit inside a staff card. */
.staff-sales-target {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.staff-target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.staff-target-percent {
  font-size: 13px;
  color: var(--primary);
}

.staff-target-track {
  height: 8px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

.staff-target-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22b6a3 0%, #1d4f91 100%);
  transition: width 0.4s ease;
}

.staff-target-fill-over {
  background: linear-gradient(90deg, #f5934a 0%, #1e9a59 100%);
}

.staff-target-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Dashboard monthly sales target progress card (super users only) */
.target-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin: 6px 0 30px;
}

.target-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.target-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.target-label .finance-icon {
  font-size: 18px;
  background: rgba(29, 79, 145, 0.1);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.target-percent {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.target-progress-track {
  margin-top: 14px;
  height: 16px;
  border-radius: 999px;
  background: #e7edf6;
  overflow: hidden;
}

.target-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22b6a3 0%, #1d4f91 100%);
  transition: width 0.4s ease;
}

.target-progress-fill.target-over {
  background: linear-gradient(90deg, #f5934a 0%, #1e9a59 100%);
}

.target-details {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Misc */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

.success-text {
  color: var(--success);
  font-size: 13px;
  margin-top: 8px;
}

/* Glass-thickness safety warning (Custom Aquarium > Dimensions step) needs to stand out more
   than a routine field-validation message - it's flagging a structural safety issue, not just a
   missing dropdown selection. */
#customDimsErrorMsg {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 55, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
  z-index: 100;
}

.modal-panel {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.hidden {
  display: none !important;
}

/* Online Order Lines - hides Unit Cost/Price/Discount/Gross/Net Amount columns for Online Order
   Staff accounts (js/onlineOrderLines.js toggles this on <body>), per "they dont need to see
   price". */
body.hide-price-columns .price-col {
  display: none !important;
}

.line-items-table input,
.line-items-table select {
  padding: 6px 8px;
  font-size: 13px;
}

.line-items-table .line-qty {
  /* Sized for a 4-digit qty, not the auto-layout table's full column width. */
  width: 60px;
}

/* Item/Variant lookup suggestion dropdowns (Transfer Orders' line items - js/transferOrders.js) */
.item-search-cell {
  position: relative;
}

.item-suggest-dropdown,
.variant-suggest-dropdown,
.serial-tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  margin-top: 2px;
}

.item-suggest-option {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.item-suggest-option:hover,
.item-suggest-option.active {
  background: var(--page-bg);
}

.item-suggest-option .item-suggest-code {
  font-weight: 600;
  color: var(--text-main);
}

.item-suggest-option .item-suggest-name {
  color: var(--text-muted);
  margin-left: 6px;
}

.item-suggest-empty {
  padding: 8px 10px;
  font-size: 13px;
}

.item-suggest-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--panel-border);
  font-size: 12px;
}

/* Serial-tag picker (Manage modal's Ship flow, Production Category lines - js/transferOrders.js) -
   reuses .item-search-cell/.item-suggest-dropdown/.item-suggest-option's positioning/search-result
   styling above, adding just the chip list and the "N / required" count. */
.serial-tag-picker {
  position: relative;
  min-width: 180px;
}

.serial-tag-count {
  font-size: 11px;
  margin-bottom: 4px;
}

.serial-tag-count.satisfied { color: var(--success); }
.serial-tag-count.unsatisfied { color: var(--danger); }

.serial-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.serial-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--primary);
  font-size: 12px;
}

.serial-tag-chip-remove {
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.item-suggest-pager .btn {
  padding: 2px 8px;
  font-size: 12px;
}

.section-divider {
  border-top: 1px solid var(--panel-border);
  margin: 18px 0;
}

/* Online Order Lines - per-line attachments (js/onlineOrderLines.js) */
.attachment-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.attachment-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.attachment-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  display: block;
}

.attachment-file-chip {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef3fb;
  color: var(--primary);
  font-size: 12px;
  text-decoration: none;
}

.attachment-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

/* Online Order Lines - "Photos Sent With Status Updates" gallery (js/onlineOrderLines.js,
   supabase_online_order_status_photo.sql). Bigger than .attachment-thumb since these are the
   actual evidence photos, not incidental line-item reference chips. */
.status-photo-card {
  position: relative;
  width: 140px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-bg);
}

.status-photo-thumb {
  width: 140px;
  height: 140px;
  object-fit: cover;
  display: block;
}

.status-photo-meta {
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.4;
}

.status-photo-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

/* Delivery page - month calendar + day-detail map */
.delivery-month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Wrapper the weekday header + calendar grid both sit in (see docs/delivery.html) - lets the
   7-column grid keep a readable per-day width and scroll sideways on narrow screens instead of
   squishing every cell down to unreadable. */
.delivery-calendar-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.delivery-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}

/* Delivery calendar on real phone widths - the desktop grid (above) relied on sideways scrolling
   at min-width:560px, which meant reading the month meant scrolling both the page AND the grid.
   Mobile calendar apps solve this by keeping 7 columns fluid to the screen width and swapping full
   event text for small dots (see .delivery-day-cell .badge below) - the day cell itself is still
   tappable for the full stop list via the existing day-detail panel, so no information is lost,
   just deferred one tap. */
@media (max-width: 640px) {
  .delivery-month-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .delivery-month-nav h2 {
    min-width: 0 !important;
    width: 100%;
    order: -1;
  }

  #assignOrderBtn {
    display: block;
    width: 100%;
    padding: 12px 16px;
  }

  .delivery-calendar-grid {
    min-width: 0;
    gap: 3px;
  }

  .delivery-weekday-cell {
    font-size: 10px;
    padding: 2px 0;
  }

  /* Fixed-route labels ("Route Name - Warehouse X, Warehouse Y") never fit a ~45px-wide mobile
     column - the same info still surfaces per-day as a purple dot (below) and in full in the
     fixed-route row of the day-detail table (js/delivery.js's fixedRouteRowHtml). */
  .delivery-weekday-route {
    display: none;
  }

  .delivery-day-cell {
    min-height: 46px;
    padding: 4px;
    border-radius: 6px;
  }

  .delivery-day-number {
    font-size: 12px;
    margin-bottom: 2px;
  }

  /* Text badges collapse to small colored dots - still distinguishable by color (neutral/purple/
     glass) and tappable for the real detail, without needing to fit readable text into a cell a
     few dozen pixels wide. The stop-count badge (badge-primary) is the one number worth reading
     at a glance, so it keeps its text instead of becoming a blank dot. */
  .delivery-day-cell .badge {
    width: 7px;
    height: 7px;
    min-width: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    line-height: 0;
    margin: 0 2px 2px 0;
    vertical-align: middle;
  }

  .delivery-day-cell .badge-primary {
    width: auto;
    height: auto;
    min-width: 0;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 9px;
    line-height: 1.4;
  }
}

.delivery-weekday-cell {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.delivery-fixed-route-row {
  background: var(--panel-bg);
  font-style: italic;
  color: var(--text-muted);
}

.delivery-weekday-route {
  font-size: 11px;
  font-weight: 400;
  color: var(--primary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delivery-day-cell {
  min-height: 84px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.delivery-day-cell:hover {
  box-shadow: var(--shadow);
}

.delivery-day-cell-empty {
  background: transparent;
  border: none;
  cursor: default;
}

.delivery-day-cell.has-stops {
  border-color: var(--primary);
}

.delivery-day-cell.today {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.delivery-day-cell.no-delivery {
  background: repeating-linear-gradient(45deg, var(--panel-bg), var(--panel-bg) 8px, var(--panel-border) 8px, var(--panel-border) 9px);
  opacity: 0.75;
}

.delivery-day-cell .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.delivery-day-cell.selected {
  background: var(--primary);
  border-color: var(--primary);
}

.delivery-day-cell.selected .delivery-day-number {
  color: #fff;
}

.delivery-day-number {
  font-weight: 600;
  margin-bottom: 6px;
}

#dayMap {
  height: 320px;
  margin-top: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

#quoteMap {
  height: 320px;
  margin-top: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

/* Driver Route View (Delivery Team only, docs/delivery.html's #driverRouteView) - single day's
   route map + stop cards, see js/delivery.js's renderDriverRouteView. */
#driverRouteMap {
  height: 280px;
  margin-top: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

.driver-stop-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.driver-stop-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.driver-stop-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* Per "make the whole button of order ID clickable" - previously just underlined text (a real
   <button>, but with padding:0 its clickable box was only as big as the text itself, a poor touch
   target on a phone). Now a proper padded pill so the whole visible button is one obvious tap
   target, at least 40px tall (close to the ~44px touch-target guideline). */
.driver-stop-order-id {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  background: rgba(29, 79, 145, 0.08);
  border: 1px solid rgba(29, 79, 145, 0.25);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.driver-stop-order-id:active {
  background: rgba(29, 79, 145, 0.16);
}

.driver-stop-customer {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.driver-stop-address {
  font-size: 13px;
  color: var(--text-muted);
}

.driver-stop-route,
.driver-stop-notes {
  font-size: 12px;
  margin-top: 6px;
}

/* Driver Route View "tech" motif - per the fintech-app-style mockup shared for the Delivery Team
   screen specifically (not a site-wide re-theme - every other page keeps the portal's normal
   light theme). Own local variables so nothing here leaks into/depends on the shared --primary/
   --panel-bg tokens used everywhere else. The dark map style that makes google.maps match this is
   in js/delivery.js's DRIVER_MAP_DARK_STYLE, applied only when renderDayMap's mapElId is
   'driverRouteMap'. */
#driverRouteView {
  --tech-bg: #0b1220;
  --tech-panel: #111a2c;
  --tech-border: #22314b;
  --tech-accent: #22d3ee;
  --tech-accent-2: #14b8a6;
  --tech-text: #e6f1ff;
  --tech-text-muted: #7c8aa5;

  background: var(--tech-bg);
  color: var(--tech-text);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(3, 8, 16, 0.35);
}

#driverRouteView h2 {
  color: var(--tech-accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

#driverRouteView .btn-secondary {
  background: transparent;
  border: 1px solid var(--tech-accent-2);
  color: var(--tech-accent-2);
}

#driverRouteView .btn-secondary:hover {
  background: rgba(20, 184, 166, 0.12);
}

#driverRouteView #driverRouteMap {
  border: 1px solid var(--tech-border);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.1);
}

#driverRouteView .muted {
  color: var(--tech-text-muted);
}

#driverRouteView .driver-stop-card {
  background: var(--tech-panel);
  border: 1px solid var(--tech-border);
  border-left: 3px solid var(--tech-accent-2);
  box-shadow: 0 8px 20px rgba(3, 8, 16, 0.3);
}

#driverRouteView .driver-stop-order-id {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--tech-accent);
  font-family: 'Consolas', 'Courier New', monospace;
  letter-spacing: 0.4px;
}

#driverRouteView .driver-stop-order-id:active {
  background: rgba(34, 211, 238, 0.22);
}

#driverRouteView .driver-stop-customer {
  color: var(--tech-text);
}

#driverRouteView .driver-stop-address,
#driverRouteView .driver-stop-route,
#driverRouteView .driver-stop-notes {
  color: var(--tech-text-muted);
}

#driverRouteView .badge {
  background: rgba(34, 211, 238, 0.12);
  color: var(--tech-accent);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

/* Driver order detail modal - opened from a stop card, so it keeps the same dark/teal motif even
   though .modal-backdrop/.modal-panel normally render on the portal's default light theme. */
.driver-detail-panel {
  background: #111a2c;
  color: #e6f1ff;
  max-width: 480px;
}

.driver-detail-panel h2 {
  color: #22d3ee;
}

.driver-detail-panel .btn-secondary {
  background: transparent;
  border: 1px solid #14b8a6;
  color: #14b8a6;
}

.driver-detail-row {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.driver-detail-row .muted {
  color: #7c8aa5;
}

.driver-detail-products-heading {
  color: #22d3ee;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 16px 0 8px;
}

.driver-detail-products {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.driver-detail-products li {
  background: #0b1220;
  border: 1px solid #22314b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.driver-detail-product-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.driver-detail-product-note {
  margin-top: 4px;
  font-size: 12px;
}

.driver-detail-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

#deliveryEstimateMap {
  height: 220px;
  margin-top: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
}

/* Item Setup - table + side factbox layout (js/itemSetup.js) */
.item-setup-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.item-setup-table-col {
  flex: 1;
  min-width: 0;
}

.item-factbox {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}

@media (max-width: 900px) {
  .item-setup-layout {
    flex-direction: column;
  }

  .item-factbox {
    width: 100%;
    position: static;
  }
}

.factbox-section-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.factbox-image-thumb {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  display: block;
}

.factbox-variant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-border);
}

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

.factbox-variant-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.factbox-variant-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eef3fb;
  flex-shrink: 0;
}

.factbox-variant-info {
  min-width: 0;
  flex: 1;
}

.factbox-variant-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.factbox-variant-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Shared pagination bar (js/pagination.js) - sits directly under a .table-wrap */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 4px 2px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-page-size {
  width: auto;
  padding: 6px 8px;
  font-size: 13px;
}

/* Company branding (see js/companyBranding.js) - collapses to nothing when no logo/info is set
   yet, so pages that opt in don't need a placeholder box. */
.company-logo-img {
  max-height: 70px;
  max-width: 260px;
}

/* Letterhead - bordered box, logo on the left and company name/Facebook/address/contact/DTI no.
   stacked on the right, used at the top of printable pages. */
.letterhead {
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--text-main);
  border-radius: 4px;
  padding: 14px 24px;
  margin-bottom: 20px;
}

.letterhead-logo {
  max-height: 90px;
  max-width: 110px;
  flex-shrink: 0;
}

.letterhead-info {
  flex: 1;
  text-align: center;
}

.letterhead-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.letterhead-line {
  font-size: 13px;
  color: var(--text-main);
}

/* Signature lines on printable documents (e.g. Transfer Order print view) - a blank underline
   for a physical/pen signature plus a printed label underneath, side by side. */
.print-signature-row {
  display: flex;
  gap: 60px;
  margin-top: 64px;
}

.print-signature-block {
  flex: 1;
}

.print-signature-line {
  border-bottom: 1px solid var(--neutral, #333);
  height: 40px;
}

.print-signature-label {
  margin-top: 6px;
  font-size: 13px;
  color: var(--neutral, #555);
}

/* Per-order Delivery Receipt (docs/delivery-receipt.html) - mirrors the Pancake-generated
   delivery receipt layout: one continuous bordered box, divided into sections by a bottom
   border on each, rather than the standalone/centered .letterhead used elsewhere. */
.delivery-receipt {
  border: 1px solid var(--text-main);
  border-radius: 4px;
  overflow: hidden;
}

.delivery-receipt-section {
  padding: 14px 24px;
  border-bottom: 1px solid var(--panel-border);
}

.delivery-receipt-section:last-child {
  border-bottom: none;
}

.delivery-receipt-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.delivery-receipt-logo {
  max-height: 90px;
  max-width: 110px;
  flex-shrink: 0;
}

.delivery-receipt-company-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.delivery-receipt-line {
  font-size: 13px;
  color: var(--text-main);
}

.delivery-receipt-title {
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.delivery-receipt-note {
  color: var(--danger);
  font-weight: 600;
  margin-top: 10px;
}

.delivery-receipt-fee {
  font-weight: 600;
  margin-top: 6px;
}

.delivery-receipt-terms {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.delivery-receipt-terms li {
  margin-bottom: 8px;
}

.delivery-receipt-signature-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
}

.delivery-receipt-signature-left > div {
  margin-bottom: 10px;
}

.delivery-receipt-signature-right {
  white-space: nowrap;
}

/* "Production Order" print layout - a larger-font warehouse packing list (see
   transfer-order-print-production.html / js/transferOrderPrintProduction.js), deliberately
   plainer than the customer-facing standard Transfer Order print - no letterhead/signature
   formality, just big and easy to read from a few feet away on the production floor. */
.production-order-print h1 {
  font-size: 32px;
}

/* Header fields (From/To Warehouse, Requested Date/By) are bumped up from the site's normal
   13px label/14px value sizing, same "big and easy to read from a few feet away" goal as the
   line table below. Target Delivery Date shares this same size - only its color singles it out. */
.production-order-print .form-grid label {
  font-size: 18px;
}

.production-order-print .form-grid .muted {
  font-size: 20px;
  color: var(--text-main);
}

.production-order-print .target-delivery-row label,
.production-order-print .target-delivery-row .muted {
  color: var(--danger);
  font-weight: 700;
}

.production-order-table th,
.production-order-table td {
  font-size: 20px;
  padding: 12px 10px;
}

/* Order Confirmation Timing dashboard (super users only) - hand-rolled CSS bars, no charting
   library (this portal doesn't use one anywhere - see docs/order-timing-dashboard.html). Each
   bar's height is set inline as a percentage of that series' own max count. */
.timing-section {
  margin: 0 0 26px;
}

.timing-section-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.timing-section-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.timing-bar-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 0 4px;
}

.timing-bar-row.timing-bar-row-hours .timing-bar-col {
  min-width: 0;
}

.timing-bar-col {
  flex: 1 1 0;
  min-width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.timing-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #4a90d9 0%, var(--primary) 100%);
  transition: transform 0.15s ease;
}

.timing-bar-row.timing-bar-row-confirmed .timing-bar {
  background: linear-gradient(180deg, #22b6a3 0%, var(--success) 100%);
}

.timing-bar-col:hover .timing-bar {
  transform: scaleY(1.03);
  transform-origin: bottom;
}

.timing-bar-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.timing-bar-count {
  font-size: 10px;
  color: var(--text-main);
  font-weight: 700;
}

/* Top Selling Items report - horizontal bars (item names need a horizontal layout, unlike the
   short day-of-week/hour-of-day labels the vertical .timing-bar-* classes above are built for). */
.item-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.item-rank-label {
  width: 220px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-rank-bar-track {
  flex: 1;
  background: var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
  height: 22px;
}

.item-rank-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), #4d7fc4);
}

.item-rank-count {
  width: 90px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 640px) {
  .item-rank-label {
    width: 120px;
    font-size: 12px;
  }
  .item-rank-count {
    width: 70px;
    font-size: 12px;
  }
}

/* Public "Order Now" customer wizard (docs/order-now.html / js/orderNow.js) - no login, no
   #topnav, shared with the rest of the portal only via css variables + .btn/.card/.badge.
   Visually it's its own "app" - a wrapped wizard-card sitting over a soft gradient backdrop with
   a faint watermark of the company logo, so it reads as a polished mini storefront rather than a
   bare form. All overrides of the shared .btn/.card/input rules below are scoped under
   .wizard-page so the rest of the (staff-facing) portal is untouched. */
body:has(.wizard-page) {
  background: radial-gradient(circle at 15% -10%, #e4edfb 0%, transparent 55%),
    radial-gradient(circle at 100% 0%, #eef6f0 0%, transparent 45%),
    linear-gradient(180deg, #f8fbff 0%, var(--page-bg) 100%);
  min-height: 100vh;
}

.wizard-watermark {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-repeat: no-repeat;
  background-position: center 12%;
  background-size: min(62vw, 460px);
  opacity: 0.05;
  filter: grayscale(1);
  pointer-events: none;
}

/* Rounded, friendly app-style face for the whole Order Now page (per direct request, matching a
   shared mockup) - #cartBar/#confirmModal included since they're rendered outside .wizard-page
   (fixed-position overlays kept as body-level siblings) but still belong to the same page. Loaded
   via Google Fonts link in order-now.html's <head>; falls back to the portal's normal system font
   stack if it's ever slow/unavailable to load. */
.wizard-page,
#cartBar,
#confirmModal {
  font-family: 'Poppins', "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.wizard-page {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 16px 110px;
}

.wizard-header {
  text-align: center;
  margin-bottom: 22px;
}

.promo-banner {
  max-width: 720px;
  margin: 0 auto 22px;
  padding: 12px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f5934a 0%, #c0392b 100%);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(192, 57, 43, 0.25);
}

.wizard-header .company-logo-img {
  display: block;
  margin: 0 auto 12px;
  max-height: 64px;
  filter: drop-shadow(0 4px 10px rgba(21, 52, 94, 0.12));
}

.wizard-header h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--primary-strong), var(--primary) 60%, #2f7fd6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

.wizard-header p.muted {
  margin: 6px 0 0;
  font-size: 14px;
}

.wizard-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(21, 52, 94, 0.1);
  padding: 26px 22px;
  position: relative;
}

@media (max-width: 480px) {
  .wizard-card {
    padding: 20px 16px;
    border-radius: 16px;
  }
}

.wizard-progress {
  display: flex;
  align-items: center;
  margin: 2px 0 28px;
}

.wizard-progress-step {
  flex: 1;
  height: 4px;
  background: var(--panel-border);
  position: relative;
}

.wizard-progress-step::before {
  content: attr(data-step);
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel-border);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.wizard-progress-step:first-child {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.wizard-progress-step:last-child {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.wizard-progress-step.done,
.wizard-progress-step.active {
  background: var(--primary);
}

.wizard-progress-step.done::before {
  content: '\2713';
  background: var(--success);
}

.wizard-progress-step.active::before {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 0 4px rgba(29, 79, 145, 0.18);
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
  animation: wizardStepIn 0.25s ease;
}

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

.customize-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--panel-bg);
  border-radius: 20px;
  text-align: center;
  padding: 30px;
  animation: customizeLoadingFadeIn 0.2s ease;
}

.customize-loading-icon {
  font-size: 44px;
  animation: customizeLoadingBounce 1.1s ease-in-out infinite;
}

.customize-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid #d7e0ef;
  border-top-color: var(--primary);
  animation: customizeLoadingSpin 0.8s linear infinite;
}

.customize-loading-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  max-width: 320px;
}

@keyframes customizeLoadingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes customizeLoadingBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.wizard-step-title {
  margin-bottom: 4px;
  font-size: 20px;
}

/* Buttons, scoped to the Order Now page only - bigger touch targets, pill shape, gradient
   primary. #cartBar/#confirmModal are included even though they're rendered outside .wizard-page
   (fixed-position overlays, kept as body-level siblings for stacking) so every button on this
   page reads consistently. */
.wizard-page .btn,
#cartBar .btn,
#confirmModal .btn {
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.wizard-page .btn-primary,
#cartBar .btn-primary,
#confirmModal .btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 8px 18px rgba(21, 52, 94, 0.25);
}

.wizard-page .btn-primary:hover,
#cartBar .btn-primary:hover,
#confirmModal .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(21, 52, 94, 0.32);
}

.wizard-page .btn-secondary,
#confirmModal .btn-secondary {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--input-border);
  box-shadow: none;
}

.wizard-page .btn-secondary:hover,
#confirmModal .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.wizard-page .btn-success,
#cartBar .btn-success {
  box-shadow: 0 8px 18px rgba(30, 154, 89, 0.28);
}

.wizard-page input[type="text"],
.wizard-page input[type="email"],
.wizard-page input[type="number"],
.wizard-page select,
.wizard-page textarea {
  padding: 11px 12px;
  border-radius: 10px;
  border-color: var(--input-border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  /* iOS Safari auto-zooms the whole page on focusing any input under 16px - the shared portal
     base rule is 14px (fine for staff on desktop), which made every field in this customer-facing
     mobile wizard trigger that zoom. */
  font-size: 16px;
}

.wizard-page input[type="text"]:focus,
.wizard-page input[type="email"]:focus,
.wizard-page input[type="number"]:focus,
.wizard-page select:focus,
.wizard-page textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.15);
}

.wizard-page label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.category-grid,
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

/* Colorful gradient tap tiles (per direct request, matching a shared mockup) - a small 6-color
   palette cycling by DOM position via :nth-child, so it applies to both the fixed 3-card mode
   picker (Standard/Customize/Estimate Delivery) and the dynamically-rendered category grid
   without any JS changes. Every color stays inside the site's existing navy/teal/green tokens
   (no new hues introduced) per "keep current brand colors". */
.category-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, var(--primary), var(--primary-strong));
  border: none;
  border-radius: 18px;
  box-shadow: 0 14px 26px -12px rgba(21, 52, 94, 0.45);
  padding: 26px 14px 20px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 32px -12px rgba(21, 52, 94, 0.5);
}

.category-card::after {
  content: '';
  position: absolute;
  top: -34%;
  right: -18%;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
  pointer-events: none;
}

.category-card:nth-child(6n+2) { background: linear-gradient(155deg, #2c6bb8, var(--primary-strong)); }
.category-card:nth-child(6n+3) { background: linear-gradient(155deg, #2596a8, #1c7f8c); }
.category-card:nth-child(6n+4) { background: linear-gradient(155deg, #3fa5b3, #1c6b76); }
.category-card:nth-child(6n+5) { background: linear-gradient(155deg, #29b06d, var(--success)); }
.category-card:nth-child(6n) { background: linear-gradient(155deg, #7c8aa8, #4e5d80); }

.category-card .muted {
  color: rgba(255, 255, 255, 0.86);
}

.category-card .category-icon {
  position: relative;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.category-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Customize tab bar (docs/order-now.html's data-step="customize-tabs") - per "so they can see the
   stand / aquarium / filtration only in one page": Aquarium/Stand/Filtration/Accessories switch
   instantly (js/orderNow.js's switchCustomizeTab) instead of navigating to a separate page each. */
/* Folder-tab look: a single strip of tabs sitting flush on top of the content below, like tabs on
   a manila folder - the active tab's background matches the content panel and its bottom border
   is erased right where it meets the divider line, so it reads as "part of" the panel while the
   other tabs sit a shade further back. Deliberately never wraps to a second row (min-width:0 lets
   items shrink below their text's natural width instead) - a folder never has a tab dangling on
   its own row underneath the others, so labels truncate with an ellipsis on very narrow screens
   instead. */
.customize-tab-bar {
  display: flex;
  gap: 4px;
  margin: 16px 0 16px;
  border-bottom: 2px solid var(--panel-border);
}

/* Each tab keeps the same per-section color used by the category tiles (gradient tap tiles
   above) as a top accent stripe + active label color, so the tab strip still reads as part of the
   same colorful system instead of a plain navy/white toggle. */
.customize-tab-btn[data-tab="aquarium"] { --tab-color: var(--primary); --tab-color-strong: var(--primary-strong); }
.customize-tab-btn[data-tab="stand"] { --tab-color: #2c6bb8; --tab-color-strong: var(--primary-strong); }
.customize-tab-btn[data-tab="filtration"] { --tab-color: #2596a8; --tab-color-strong: #1c7f8c; }
.customize-tab-btn[data-tab="stickers"] { --tab-color: #29b06d; --tab-color-strong: var(--success); }

.customize-tab-btn {
  flex: 1;
  min-width: 0;
  background: var(--page-bg);
  border: 1px solid var(--panel-border);
  border-top: 3px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 8px 10px;
  margin-bottom: -2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.customize-tab-btn:hover {
  color: var(--tab-color-strong, var(--primary));
}

.customize-tab-btn.active {
  background: var(--panel-bg);
  border-color: var(--panel-border);
  border-top-color: var(--tab-color, var(--primary));
  border-bottom: 2px solid var(--panel-bg);
  color: var(--tab-color-strong, var(--primary-strong));
  box-shadow: 0 -6px 14px -10px rgba(21, 52, 94, 0.35);
  position: relative;
  z-index: 1;
}

/* The four builder sections (data-step="custom-dims" etc.) stay .wizard-step (so their own
   internal fields/canvas/JS are untouched) - they still just use .wizard-step/.wizard-step.active
   above for show/hide, js/orderNow.js's applyCustomizeTabVisibility only decides which ONE of them
   gets .active at a time instead of goToStep doing it. */

@media (max-width: 480px) {
  .customize-tab-btn {
    padding: 7px 5px;
    font-size: 11px;
  }
}

.item-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-top: 3px solid var(--primary);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(21, 52, 94, 0.12);
}

.item-card-img,
.item-card-img-placeholder {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef3fb;
}

.item-card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.item-card-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
}

.item-card-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 15px;
}

.item-card-stock {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tappable area of the card that opens the details modal (image/name/price) - kept separate from
   the qty-stepper/Add button below it, which add directly without opening anything. */
.item-card-tap-area {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-detail-modal-panel {
  max-width: 420px;
}

.item-detail-image-wrap img,
.item-detail-image-wrap .item-card-img-placeholder {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef3fb;
}

.item-detail-image-wrap .item-card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}

.item-detail-name {
  margin: 14px 0 4px;
  font-size: 18px;
}

.item-detail-price {
  font-weight: 800;
  color: var(--primary);
  font-size: 20px;
}

.item-detail-stock {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.item-detail-description-label {
  margin-top: 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.item-detail-description {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

#itemDetailQtyStepper {
  margin-top: 18px;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.qty-stepper button {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: #eaf2fd;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.12s ease;
}

.qty-stepper button:hover {
  background: #dbe8fb;
}

.qty-stepper input {
  width: 64px;
  text-align: center;
  padding: 6px 4px;
  font-size: 15px;
}

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  padding: 14px 20px;
  /* Notch/home-indicator iPhones reserve a gesture area at the bottom of the screen - without
     this, the bar's bottom edge (and its buttons) sit flush against it. max() keeps the normal
     14px padding on devices with no inset at all. */
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 24px rgba(21, 52, 94, 0.2);
  z-index: 50;
}

.cart-bar-info {
  font-weight: 700;
}

.cart-bar-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 400;
}

.cart-line-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 6px 14px -12px rgba(21, 52, 94, 0.4);
}

.cart-line-row:last-child {
  margin-bottom: 0;
}

.cart-line-name {
  font-weight: 600;
  font-size: 14px;
}

.cart-line-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.cart-line-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 6px;
}

.view-cart-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.view-cart-link:hover {
  text-decoration: underline;
}

.cart-line-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--primary);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.cart-qty-btn:hover {
  background: #eef5ff;
}

.cart-qty-value {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 18px;
  padding-top: 14px;
  margin-top: 6px;
  border-top: 2px solid var(--panel-border);
}

.wizard-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
}

.checkbox-stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  background: #fbfcfe;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checkbox-row:has(input:checked) {
  border-color: var(--primary);
  background: #eef4fd;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.checkbox-row-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.field-example-links {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}

.option-example-link {
  font-size: 12px;
  font-weight: 400;
  color: var(--primary);
  text-decoration: underline;
}

.option-tip {
  font-size: 11px;
  font-weight: 600;
  color: #1e7a5a;
  background: #e4f7ee;
  padding: 1px 8px;
  border-radius: 999px;
}

.fulfillment-toggle {
  display: flex;
  gap: 10px;
}

.fulfillment-option {
  flex: 1;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
}

.fulfillment-option.selected {
  border-color: var(--primary);
  background: #e2ecfb;
  color: var(--primary);
}

.fulfillment-option.option-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.location-toggle {
  display: grid;
  gap: 10px;
}

.location-option {
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
}

.location-option.selected {
  border-color: var(--primary);
  background: #e2ecfb;
}

.location-option-name {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.location-option.selected .location-option-name {
  color: var(--primary);
}

.location-option-address {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.aquarium-canvas-wrap {
  position: relative;
  border: 1px solid var(--panel-border);
  border-top: 4px solid var(--primary);
  background: linear-gradient(180deg, #eaf2fd 0%, #f8fbff 55%, #ffffff 100%);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 18px;
  box-shadow: 0 14px 26px -16px rgba(21, 52, 94, 0.35);
}

.aquarium-rotate-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.aquarium-rotate-btn:hover {
  background: #ffffff;
}

.aquarium-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  /* Matches the canvas's drawing-buffer width/height attributes (720x260, see
     setupCustomCanvas()) - keeps the isometric drawing's proportions correct at any container
     width instead of stretching to a fixed CSS height. */
  aspect-ratio: 720 / 260;
}

/* Per-Type reference photo on the standalone Accessories/Stickers step (docs/order-now.html /
   js/orderNow.js's standaloneStickerTypeImageMap) - swapped whenever Type changes, hidden
   entirely (via the element's onerror handler) until a real photo exists for that type. */
.sticker-type-reference-img {
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 220px;
  object-fit: cover;
  margin: 0 auto 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.custom-price-card {
  margin-bottom: 18px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  background: linear-gradient(135deg, #eef5ff, #e4edfb);
  border-color: #cfe0f7;
  border-radius: 16px;
}

.custom-price-card .custom-price-note {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.custom-price-gallons-badge {
  display: block;
  margin: 8px auto 0;
  width: fit-content;
  padding: 3px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  background: #d7f5e3;
  border-radius: 999px;
}

.custom-price-disclaimer {
  margin-top: -12px;
  margin-bottom: 18px;
  text-align: center;
  font-size: 11px;
  color: var(--danger);
}

.dims-summary-card {
  margin-bottom: 18px;
  font-size: 16px;
  line-height: 1.9;
  border-radius: 16px;
  border-left: 4px solid var(--primary);
}

/* Aquarium tab only - the preview image now sits above this card (per direct request), so it
   needs its own top gap the same way it used to get "for free" from being the first element. */
.aquarium-canvas-wrap + .dims-summary-card {
  margin-top: 18px;
}

.dims-summary-card strong {
  color: var(--primary);
}

.dims-summary-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-top: 4px;
}

/* Calls out Glass Thickness specifically (per direct request) in the Aquarium summary card
   (#customAquariumSummary) - same amber tone as .rule-notice, since thickness is the field most
   tied to the glass-safety rules shown just below it. */
.dims-summary-glass-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 700;
  color: #7a5a05;
  background: #fff3d6;
}

/* Stand summary specifically (per direct request) - two columns for the whole detail list, not
   just the decluttered options at the bottom, unlike the shared .dims-summary-card layout the
   Aquarium flow's #customAquariumSummary still uses. */
#customStandSummary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

#customStandSummary .dims-summary-options-grid {
  grid-column: 1 / -1;
}

.rule-notice {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff3d6;
  border: 1px solid #f0d9a0;
  color: #7a5a05;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

/* Positive/reassuring variant of .rule-notice (e.g. RSPetStop Delivery's accountability note) -
   same shape, green-toned instead of caution-yellow. */
.rule-notice-positive {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #e3f7ea;
  border: 1px solid #b7e6c9;
  color: #17693f;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.confirm-order-note {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fdecea;
  border: 1px solid #f3b9b2;
  color: #8a2a1f;
  font-size: 13px;
  line-height: 1.5;
}

.confirm-modal-panel {
  max-width: 360px;
  text-align: center;
}

.confirm-modal-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.confirm-modal-panel p {
  font-size: 16px;
  line-height: 1.55;
  color: var(--text-main);
  margin: 0 0 22px;
}

.confirm-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-modal-buttons .btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
}

.confirmation-box {
  text-align: center;
  padding: 30px 16px;
  border-radius: 16px;
}

.confirmation-box .confirmation-icon {
  font-size: 54px;
  display: block;
  margin-bottom: 12px;
}

.confirmation-order-no {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin: 10px 0;
}

.payment-policy {
  margin-top: 18px;
  padding: 20px;
  border-radius: 16px;
}

.payment-policy-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.payment-policy-subhead {
  margin: 18px 0 8px;
  font-size: 15px;
}

.payment-policy-list {
  margin: 0 0 4px;
  padding-left: 20px;
  line-height: 1.6;
}

.payment-policy-callout {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #eaf4ff;
  border: 1px solid #bcdcff;
  color: #144a7c;
  font-size: 13px;
  line-height: 1.6;
}

.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 10px 0;
}

.payment-method-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid #e2e8ee;
}

.payment-method-name {
  font-weight: 700;
  margin-bottom: 6px;
}

.payment-method-line {
  font-size: 13px;
  color: var(--text-muted, #555);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .cart-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  /* Fixed two-column option/spec grids get cramped once .wizard-card's own padding (16px on this
     width, see the earlier @media (max-width: 480px) block) eats into the ~360-390px phone
     viewport - one column reads far better than wrapped/truncated two-up labels. */
  .dims-summary-options-grid,
  #customStandSummary {
    grid-template-columns: 1fr;
  }

  .delivery-receipt-section {
    padding: 14px 12px;
  }
}

/* Dashboard mobile pass - per "can you make the UI experience quality good or very user
   friendly" on a phone. The existing auto-fit grids (.finance-card-grid/.stat-card-grid/
   .staff-sales-grid) already collapse to a single column on real phone widths on their own
   (minmax() math), so this is everything ELSE that needed a deliberate mobile treatment: big
   numbers that could wrap awkwardly, a 3-column mini-grid that only stacked below 420px (too
   narrow to cover most phones), comfortably-sized tap targets instead of desktop-scaled ones, and
   the nav-card grid - the biggest single change, from a tall single column of large centered
   tiles (lots of scrolling for ~15 links) to a compact icon+text list row, the way a native app's
   menu screen reads. .nav-card-text is a markup-only wrapper (dashboard.html) that's invisible to
   the existing desktop layout (divs still just stack top-to-bottom by default) and only becomes a
   flex column here. */
@media (max-width: 640px) {
  .finance-card .finance-value {
    font-size: 26px;
  }

  .finance-card {
    padding: 18px 18px;
  }

  .stat-card .stat-value {
    font-size: 26px;
  }

  .staff-sales-stats {
    grid-template-columns: 1fr;
  }

  #pushNotifyBtn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 13px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .nav-card {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 14px 16px;
  }

  .nav-card:hover {
    transform: none;
  }

  .nav-card .icon {
    font-size: 26px;
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .nav-card-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .nav-card-text .muted {
    font-size: 12px;
  }

  .modal-backdrop {
    padding: 16px;
    align-items: center;
  }

  .modal-panel {
    padding: 18px;
  }

  #pushNotifyPromptModal .toolbar > h2 {
    font-size: 16px;
  }

  .push-prompt-actions {
    flex-direction: column-reverse;
  }

  #pushNotifyPromptModal .btn {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
  }

  .notification-item {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
  }

  .notification-item .notification-message {
    justify-content: center;
  }

  #dayMap {
    height: 240px;
  }
}

/* Printable pages (Delivery Manifest) - hide nav/buttons, reset the page background to plain
   white so it doesn't waste ink/toner on the gradient body background used on-screen. */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .table-wrap {
    border: none;
    overflow: visible;
  }

  /* Printed output should always be light regardless of the on-screen theme - a dark-mode print
     would otherwise come out with navy card/table/input backgrounds and near-white text on the
     forced-white body above (unreadable). Resets every dark-theme token back to its light value;
     same :root[data-theme="dark"] selector as the definition itself (css/styles.css, near the
     top) so this wins on specificity ties by simply appearing later in the file, while print
     media scoping keeps it from affecting the on-screen dark theme at all. */
  :root[data-theme="dark"] {
    --page-bg: #f4f7fb;
    --page-bg-top: #f8fbff;
    --panel-bg: #ffffff;
    --panel-border: #d7e0ef;
    --text-main: #1b355e;
    --text-muted: #61738f;
    --input-border: #c7d3e6;
    --success: #1e9a59;
    --danger: #c0392b;
    --neutral: #7b8596;
    --shadow: 0 8px 24px rgba(21, 52, 94, 0.08);
  }

  table,
  input,
  select,
  textarea,
  .modal-panel {
    background: #fff;
  }

  th,
  tr.clickable-row:hover {
    background: #eef3fb;
  }
}
