/*
 * app.css — Battle Scanning App
 *
 * Design tokens are lifted directly from the Battle-ERP app.css so both
 * applications share the same visual language. Variable names and values
 * are intentionally identical to the ERP — if the ERP ever updates its
 * palette, update this file to match.
 *
 * This file covers:
 *   1. Design tokens (CSS custom properties)
 *   2. Reset & base typography
 *   3. Three-column app shell (matches ERP layout exactly)
 *   4. Shared components: buttons, inputs, badges, cards, tables
 *   5. Manager web app specific styles
 *   6. PWA mobile styles (loaded on mobile viewports)
 */

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* --- Brand colours --- */
  /* #960019 is Battle's primary red, used on every interactive element.
     These match the ERP exactly — do not change without updating the ERP too. */
  --colour-accent:         #960019;  /* Primary red — buttons, active states, accent text */
  --colour-teal:           #960019;  /* Named "teal" in the ERP for historical reasons — it's red */
  --colour-teal-dark:      #7a0015;  /* Hover/pressed state for all primary elements */

  /* --- Layout backgrounds --- */
  --colour-sidebar:        #f0f0f0;  /* Nav columns and section header backgrounds */
  --colour-sidebar-hover:  #e4e4e4;  /* Nav item hover state */
  --colour-sidebar-active: #e8e8e8;  /* Currently selected nav item */
  --colour-content:        #ffffff;  /* Main content area background */
  --colour-border:         #dddddd;  /* All borders, dividers, and table lines */

  /* --- Typography --- */
  --colour-text:           #333333;  /* Primary text — headings, body, table cells */
  --colour-text-light:     #888888;  /* Secondary text — labels, metadata, muted values */
  --colour-text-white:     #ffffff;  /* Text on dark/coloured backgrounds */

  /* --- Status colours (used for badges and left-border indicators) --- */
  --colour-success-bg:     #edfbee;
  --colour-success-text:   #287030;
  --colour-warning-bg:     #fff3e0;
  --colour-warning-text:   #e65c00;
  --colour-danger-bg:      #fdf0f0;
  --colour-danger-text:    #c0392b;
  --colour-info-bg:        #e8f0ff;
  --colour-info-text:      #2355a0;
  --colour-neutral-bg:     #f0f0f0;
  --colour-neutral-text:   #666666;

  /* --- Sizing & spacing --- */
  --nav-primary-width:     112px;
  --nav-secondary-width:   160px;
  --header-height:         48px;
  --content-padding:       24px;

  /* --- Shadows --- */
  --shadow-card:   0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-modal:  0 8px 32px rgba(0, 0, 0, 0.18);
  --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.12);
}


/* ==========================================================================
   2. RESET & BASE TYPOGRAPHY
   ========================================================================== */

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

html, body {
  height: 100%;
  /* System font stack — matches ERP exactly. No Google Fonts, no webfonts. */
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--colour-text);
  background: var(--colour-content);
}

a {
  color: var(--colour-teal);
  text-decoration: none;
}
a:hover {
  color: var(--colour-teal-dark);
  text-decoration: underline;
}

/* Prevent iOS from enlarging form inputs on tap */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}


/* ==========================================================================
   3. APP SHELL — Single column with top navigation bar
   [top bar full width]
   [content area full width, scrollable]
   ========================================================================== */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- Main content column --- */

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top bar: logo + nav links on left, user info on right */
.content-header {
  height: 68px;
  padding: 0 var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--colour-border);
  background: var(--colour-content);
  font-size: 13px;
  flex-shrink: 0;
  gap: 24px;
}

/* Left side: logo + nav links grouped together */
.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

/* Battle Ops logo in the top bar */
.header-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* Horizontal nav link strip */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav-link {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--colour-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.header-nav-link:hover {
  background: var(--colour-sidebar);
  color: var(--colour-text);
  text-decoration: none;
}

/* Active nav link — red underline matching the tab style */
.header-nav-link--active {
  color: var(--colour-accent);
  font-weight: 600;
}
.header-nav-link--active:hover {
  color: var(--colour-accent);
}

/* Right side: welcome name + admin + sign out */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.welcome-name {
  color: var(--colour-accent);
  font-weight: 500;
}

.header-sep {
  color: var(--colour-border);
  margin: 0 4px;
}

.content-header a {
  color: var(--colour-text);
  text-decoration: none;
}
.content-header a:hover {
  text-decoration: underline;
}

/* Scrollable content area below the top bar */
.content-main {
  flex: 1;
  overflow-y: auto;
  padding: var(--content-padding);
}


/* ==========================================================================
   4. SHARED COMPONENTS
   ========================================================================== */

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

/* Primary — red fill, used for the main action on a page */
.btn--primary {
  background: var(--colour-teal);
  color: var(--colour-text-white);
  border-color: var(--colour-teal);
}
.btn--primary:hover {
  background: var(--colour-teal-dark);
  border-color: var(--colour-teal-dark);
  color: var(--colour-text-white);
  text-decoration: none;
}

/* Ghost — white fill with grey border, used for secondary actions */
.btn--ghost {
  background: #fff;
  color: var(--colour-text);
  border-color: var(--colour-border);
}
.btn--ghost:hover {
  background: var(--colour-sidebar);
  text-decoration: none;
  color: var(--colour-text);
}

/* Danger — used for destructive actions (delete, revoke) */
.btn--danger {
  background: #fff;
  color: var(--colour-danger-text);
  border-color: #f5c6c6;
}
.btn--danger:hover {
  background: var(--colour-danger-bg);
  text-decoration: none;
}

/* Small variant — for inline actions in tables */
.btn--sm {
  padding: 5px 12px;
  font-size: 12px;
}
.btn--warning {
  background: #fff;
  color: #92400e;
  border-color: #fcd34d;
}
.btn--warning:hover {
  background: #fffbeb;
  text-decoration: none;
}


/* --- Form Inputs --- */

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

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--colour-text-light);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--colour-border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--colour-text);
  background: #fff;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--colour-teal);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 11px;
  color: var(--colour-text-light);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--colour-danger-text);
  margin-top: 4px;
}


/* --- Status Badges --- */
/* Used on order cards and in tables to show status at a glance */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge--complete    { background: var(--colour-success-bg); color: var(--colour-success-text); }
.badge--needs-review{ background: var(--colour-danger-bg);  color: var(--colour-danger-text);  }
.badge--processing  { background: var(--colour-warning-bg); color: var(--colour-warning-text); }
.badge--entered     { background: var(--colour-info-bg);    color: var(--colour-info-text);    }
.badge--draft       { background: var(--colour-neutral-bg); color: var(--colour-neutral-text); }
.badge--submitted   { background: var(--colour-info-bg);    color: var(--colour-info-text);    }


/* --- Section Cards --- */
/* Consistent container for groups of related content */

.section-card {
  background: #fff;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}

.section-card-header {
  padding: 13px 24px;
  background: var(--colour-sidebar);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--colour-text);
  border-bottom: 1px solid var(--colour-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-card-body {
  padding: 20px 24px;
}


/* --- Data Tables --- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--colour-text-light);
  border-bottom: 2px solid var(--colour-border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f5f5f5;
  color: var(--colour-text);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #fafafa;
}

.data-table a {
  color: var(--colour-teal);
}

/* Left-border status stripe on table rows */
.data-table tr.row--complete     td:first-child { border-left: 3px solid var(--colour-success-text); }
.data-table tr.row--needs_review td:first-child { border-left: 3px solid var(--colour-danger-text);  }
.data-table tr.row--processing   td:first-child { border-left: 3px solid #7c3aed;                    }


/* --- Django Messages (flash messages) --- */

.messages {
  list-style: none;
  margin-bottom: 16px;
}

.messages li {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 6px;
}

.messages .success { background: #f0faf0; border: 1px solid #c3e6c3; color: #2d6a2d; }
.messages .error   { background: #fdf0f0; border: 1px solid #f5c6c6; color: var(--colour-accent); }
.messages .warning { background: #fffbf0; border: 1px solid #ffe4a0; color: #7a5f00; }
.messages .info    { background: #f0f8ff; border: 1px solid #b8d8f0; color: #1a4f7a; }


/* --- Modals --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal--sm { max-width: 400px; }

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--colour-text-light);
  line-height: 1;
  padding: 0;
}
.modal-close:hover { color: var(--colour-text); }

.modal-body { padding: 24px; }

.modal-actions {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--colour-border);
  margin-top: 4px;
}


/* --- Page Header / Toolbar --- */

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--colour-text);
  margin: 0;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


/* Page header row (title + optional back link) */
.page-header {
  margin-bottom: 20px;
}
.page-back {
  display: inline-block;
  font-size: 12px;
  color: var(--colour-text-light);
  text-decoration: none;
  margin-bottom: 6px;
}
.page-back:hover { color: var(--colour-accent); }

/* Inline form actions row */
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
}

/* Table: right-aligned action cell */
.cell--actions {
  text-align: right;
  white-space: nowrap;
}

/* Muted table row (inactive drivers) */
.row--muted td {
  opacity: 0.5;
}

/* Flash message alerts */
.alert {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert--success { background: var(--colour-success-bg); color: var(--colour-success-text); }
.alert--error   { background: var(--colour-danger-bg);  color: var(--colour-danger-text);  }
.alert--warning { background: var(--colour-warning-bg); color: var(--colour-warning-text); }
.alert--info    { background: var(--colour-info-bg);    color: var(--colour-info-text);    }

/* Checkbox label */
.form-label--checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--colour-text);
  cursor: pointer;
}


/* ==========================================================================
   5. MANAGER WEB APP — login page
   ========================================================================== */

.login-page {
  min-height: 100vh;
  background: var(--colour-sidebar);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--colour-content);
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  padding: 40px 48px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.login-logo img {
  width: 140px;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--colour-text);
}

.login-card .form-label {
  /* Override the default form-label to match ERP label style exactly */
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--colour-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.login-card .form-input {
  padding: 9px 12px;
}

.btn-login {
  width: 100%;
  padding: 10px;
  background: var(--colour-teal);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}
.btn-login:hover {
  background: var(--colour-teal-dark);
}

.login-errors {
  background: var(--colour-danger-bg);
  border: 1px solid #f5c6c6;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--colour-accent);
}


/* ==========================================================================
   6. SCANNING APP — Order list tabs (PO / SO / MJ)
   ========================================================================== */

/* Tab strip — the three order type tabs at the top of the dashboard */
.order-tabs {
  display: flex;
  border-bottom: 2px solid var(--colour-border);
  margin-bottom: 20px;
}

.order-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--colour-text-light);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.1s;
}

.order-tab:hover {
  color: var(--colour-text);
  text-decoration: none;
}

.order-tab--active {
  color: var(--colour-accent);
  border-bottom-color: var(--colour-accent);
}

/* Order list row — left border color indicates status */
.order-row {
  cursor: pointer;
}
.order-row td:first-child {
  padding-left: 16px;  /* Room for the left border stripe */
}
.order-row--complete      td:first-child { border-left: 4px solid var(--colour-success-text); }
.order-row--needs_review  td:first-child { border-left: 4px solid var(--colour-danger-text);  }
.order-row--rework        td:first-child { border-left: 4px solid #f59e0b;                    }
.order-row--processing    td:first-child { border-left: 4px solid #7c3aed;                    }
.order-row--in_progress   td:first-child { border-left: 4px solid #c2410c;                    }
.order-row--entered       td:first-child { border-left: 4px solid #1a6e2e;                    }
.order-row--draft         td:first-child { border-left: 4px solid #ccc;                       }
.order-row--submitted     td:first-child { border-left: 4px solid var(--colour-info-text);    }


/* ==========================================================================
   7. PWA MOBILE STYLES
   Overrides for the driver's iPhone interface.
   These only apply inside .pwa-shell — the manager web app is unaffected.
   ========================================================================== */

.pwa-shell {
  /* Full-screen on iOS — fills the safe area below the notch */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: var(--colour-content);
  display: flex;
  flex-direction: column;
}

/* PWA top bar */
.pwa-header {
  background: var(--colour-accent);
  color: white;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top)); /* Respect iOS notch */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pwa-header-title {
  font-size: 17px;
  font-weight: 600;
}

.pwa-header-back {
  color: white;
  font-size: 15px;
  text-decoration: none;
  font-weight: 500;
}

/* PWA screen content area */
.pwa-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
}

/* Large touch targets for forklift gloves */
.pwa-btn {
  display: block;
  width: 100%;
  padding: 18px 20px;
  background: var(--colour-teal);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-bottom: 12px;
  transition: background 0.15s;
  /* Minimum touch target size (Apple HIG recommendation: 44px) */
  min-height: 56px;
}
.pwa-btn:hover, .pwa-btn:active {
  background: var(--colour-teal-dark);
}

.pwa-btn--ghost {
  background: transparent;
  border: 2px solid var(--colour-border);
  color: var(--colour-text);
}
.pwa-btn--ghost:hover {
  background: var(--colour-sidebar);
}

.pwa-btn--danger {
  background: var(--colour-danger-text);
}
.pwa-btn--danger:hover {
  background: #a93226;
}

/* Smaller button (manual-entry footer link, etc.) */
.pwa-btn--sm {
  min-height: 44px;
  font-size: 14px;
  margin-bottom: 0;
}

/* Footer below the orders list with the "enter manually" link */
.pwa-orders-manual-footer {
  padding: 12px 16px 20px;
}

/* PO / SO toggle inside the manual-entry modal */
.manual-type-btn {
  flex: 1;
  margin-bottom: 0;
  background: transparent;
  border: 2px solid var(--colour-border);
  color: var(--colour-text);
}
.manual-type-btn--active {
  background: var(--colour-teal);
  border-color: var(--colour-teal);
  color: white;
}

/* PIN pad number display */
.pwa-pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 32px 0 24px;
}

.pwa-pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--colour-border);
  background: transparent;
  transition: background 0.15s;
}

.pwa-pin-dot--filled {
  background: var(--colour-accent);
  border-color: var(--colour-accent);
}

/* Photo capture area */
.pwa-photo-area {
  border: 2px dashed var(--colour-border);
  border-radius: 8px;
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--colour-text-light);
  background: var(--colour-sidebar);
  cursor: pointer;
  margin-bottom: 16px;
}

.pwa-photo-area--filled {
  border-style: solid;
  border-color: var(--colour-teal);
}

.pwa-photo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Bottom action bar — stays above the iOS home indicator */
.pwa-bottom-bar {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--colour-border);
  background: #fff;
  flex-shrink: 0;
}
.pwa-bottom-bar .pwa-btn {
  flex: 1;
  margin-bottom: 0;
}

/* Utility — toggled by JS to hide/show screens */
.hidden { display: none !important; }

/* PWA login screen */
.pwa-login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--colour-sidebar);
  padding: 24px;
}
.pwa-login-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 28px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.10);
}
.pwa-login-logo {
  text-align: center;
  margin-bottom: 20px;
}
.pwa-login-logo img {
  height: 48px;
}
.pwa-login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--colour-text);
  text-align: center;
  margin: 0 0 24px;
}
.pwa-login-error {
  background: var(--colour-danger-bg);
  color: var(--colour-danger-text);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.pwa-form-group {
  margin-bottom: 16px;
}
.pwa-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--colour-text-light);
  margin-bottom: 6px;
}
.pwa-form-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  font-size: 16px;
  color: var(--colour-text);
  background: #fff;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.pwa-form-input:focus {
  outline: none;
  border-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(150,0,25,0.12);
}
.pwa-login-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 8px;
  background: var(--colour-accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 50px;
}
.pwa-login-btn:active {
  background: var(--colour-teal-dark);
}
.pwa-login-btn:disabled {
  opacity: 0.6;
}

/* Sign out link in PWA header */
.pwa-header-signout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

/* Screen headings */
.pwa-screen-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--colour-text);
  margin: 0 0 4px;
  text-align: center;
}
.pwa-screen-subtitle {
  font-size: 14px;
  color: var(--colour-text-light);
  text-align: center;
  margin: 0 0 24px;
}

/* Driver list button — same as pwa-btn but no bottom margin override needed */
.pwa-driver-btn {
  font-size: 18px;
}

/* Back button on PIN screen */
.pwa-back-btn {
  background: none;
  border: none;
  color: var(--colour-accent);
  font-size: 15px;
  font-weight: 500;
  padding: 0 0 16px;
  cursor: pointer;
  display: block;
}

/* Secondary (outline) button */
.pwa-btn--secondary {
  background: transparent;
  border: 2px solid var(--colour-border);
  color: var(--colour-text);
}
.pwa-btn--secondary:hover,
.pwa-btn--secondary:active {
  background: var(--colour-sidebar);
}

/* PIN error message */
.pin-error {
  min-height: 20px;
  text-align: center;
  color: var(--colour-danger-text);
  font-size: 14px;
  margin: 0 0 16px;
}

/* Number keypad grid */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 300px;
  margin: 0 auto;
}
.keypad-btn {
  min-height: 64px;
  font-size: 22px;
  font-weight: 500;
  border: 1px solid var(--colour-border);
  border-radius: 10px;
  background: #fff;
  color: var(--colour-text);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s;
}
.keypad-btn:active {
  background: var(--colour-sidebar);
}
.keypad-btn--action {
  color: var(--colour-accent);
  font-size: 20px;
}
.keypad-btn:disabled {
  opacity: 0.5;
}

/* Status / error messages in the driver list area */
.pwa-status-msg {
  text-align: center;
  color: var(--colour-text-light);
  font-size: 15px;
  line-height: 1.5;
  padding: 40px 0;
}
.pwa-error-msg {
  color: var(--colour-danger-text);
}

/* Shake animation for wrong PIN */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(4px); }
}
.shake {
  animation: shake 0.4s ease-in-out;
}


/* ==========================================================================
   8. KEYPAD BOTTOM SHEET
   ========================================================================== */

/* Tap-to-open PIN field */
.pwa-pin-field {
  cursor: pointer;
  caret-color: transparent;
}
.pwa-pin-field:focus {
  outline: none;
  border-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(150,0,25,0.12);
}

/* Full-screen semi-transparent backdrop */
.keypad-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* The white sheet that slides up */
.keypad-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 0;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  animation: keypad-slide-up 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes keypad-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* Slide-down class applied by JS before hiding */
.keypad-overlay--closing .keypad-sheet {
  animation: keypad-slide-down 0.22s ease-in forwards;
}

@keyframes keypad-slide-down {
  from { transform: translateY(0); }
  to   { transform: translateY(110%); }
}

/* Drag handle at top of sheet */
.keypad-handle {
  width: 36px;
  height: 4px;
  background: var(--colour-border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* PIN dot row inside the keypad sheet */
.keypad-pin-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 4px 0 14px;
}

/* Error message inside the sheet */
.keypad-error-msg {
  text-align: center;
  color: var(--colour-danger-text);
  font-size: 14px;
  min-height: 20px;
  margin: 0 0 10px;
}


/* ==========================================================================
   9. PWA ORDER LIST SCREEN
   ========================================================================== */

/* Back button in PWA header */
.pwa-header-back {
  background: none;
  border: none;
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

/* Tappable order row — fills width, shows order number + title + arrow */
.pwa-order-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 18px 16px;
  margin-bottom: 1px;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--colour-border);
  cursor: pointer;
  text-align: left;
  gap: 10px;
  touch-action: manipulation;
  min-height: 64px;
}

.pwa-order-btn:active {
  background: var(--colour-sidebar);
}

.pwa-order-number {
  font-size: 16px;
  font-weight: 600;
  color: var(--colour-text);
  flex-shrink: 0;
}

.pwa-order-title {
  font-size: 14px;
  color: var(--colour-text-light);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-order-arrow {
  font-size: 22px;
  color: var(--colour-border);
  flex-shrink: 0;
  line-height: 1;
}

/* Search bar pinned below the header */
.pwa-search-bar {
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--colour-border);
  flex-shrink: 0;
}

.pwa-search-input {
  display: block;
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--colour-border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--colour-text);
  background: var(--colour-sidebar) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 12px center;
  -webkit-appearance: none;
  box-sizing: border-box;
}

.pwa-search-input:focus {
  outline: none;
  border-color: var(--colour-accent);
  background-color: #fff;
  box-shadow: 0 0 0 2px rgba(150,0,25,0.10);
}

/* Remove the native ✕ clear button on search inputs */
.pwa-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Content area variant with no top padding (search bar provides spacing) */
.pwa-content--no-top-pad {
  padding-top: 0;
}


/* ==========================================================================
   10. PWA SCANNING SCREEN
   ========================================================================== */

/* Sticky order badge below the header */
.scan-order-badge {
  background: var(--colour-sidebar);
  border-bottom: 1px solid var(--colour-border);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--colour-text);
  flex-shrink: 0;
}

/* Empty-state message inside the pallet list */
.scan-empty-msg {
  padding-top: 32px;
  padding-bottom: 16px;
}

/* Individual pallet card */
.scan-pallet-card {
  background: #fff;
  border: 1px solid var(--colour-border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}

/* Card header row — pallet number + remove button */
.scan-pallet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--colour-border);
}

.scan-pallet-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--colour-text);
}

.scan-pallet-remove {
  background: none;
  border: none;
  color: var(--colour-danger-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  touch-action: manipulation;
}

/* Photo thumbnail — full width, capped height */
.scan-pallet-thumb {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

/* Partial pallet checkbox row */
.scan-partial-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--colour-text);
  cursor: pointer;
  border-top: 1px solid var(--colour-border);
}

.scan-partial-check {
  width: 20px;
  height: 20px;
  accent-color: var(--colour-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Case count row — visible when partial is checked */
.scan-partial-count {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 14px;
}

.scan-partial-count-label {
  font-size: 13px;
  color: var(--colour-text-light);
  flex-shrink: 0;
}

.scan-case-count-input {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  font-size: 16px;
  color: var(--colour-text);
  -webkit-appearance: none;
}
.scan-case-count-input:focus {
  outline: none;
  border-color: var(--colour-accent);
  box-shadow: 0 0 0 2px rgba(150,0,25,0.12);
}

/* "Add Pallet Photo" button section */
.scan-add-section {
  padding: 8px 0 20px;
}

.scan-add-btn {
  background: transparent;
  border: 2px dashed var(--colour-border);
  color: var(--colour-text);
  font-size: 15px;
  font-weight: 600;
}
.scan-add-btn:hover,
.scan-add-btn:active {
  background: var(--colour-sidebar);
  border-color: var(--colour-accent);
  color: var(--colour-accent);
}

/* ── Upload / result screen ── */

.scan-result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px;
  min-height: 60vh;
}

.scan-result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto 20px;
}

.scan-result-icon--uploading {
  background: var(--colour-info-bg);
  color: var(--colour-info-text);
  animation: pulse 1.2s ease-in-out infinite;
}

.scan-result-icon--done {
  background: var(--colour-success-bg);
  color: var(--colour-success-text);
}

.scan-result-icon--error {
  background: var(--colour-danger-bg);
  color: var(--colour-danger-text);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.scan-result-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--colour-text);
  margin: 0 0 10px;
}

.scan-result-subtitle {
  font-size: 14px;
  color: var(--colour-text-light);
  line-height: 1.6;
  margin: 0;
}


/* ==========================================================================
   11. MANAGER WEB APP — SESSION LIST & DETAIL
   ========================================================================== */

/* ── Status badges ── */

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.status-badge--submitted    { background: var(--colour-info-bg);    color: var(--colour-info-text);    }
.status-badge--in_progress  { background: #fff3e0;                  color: #c2410c;                    } /* Orange — driver in progress */
.status-badge--processing   { background: #f3e8ff;                  color: #7c3aed;                    } /* Purple — Validating */
.status-badge--needs_review { background: var(--colour-danger-bg);  color: var(--colour-danger-text);  } /* Red — Flagged */
.status-badge--complete     { background: var(--colour-success-bg);  color: var(--colour-success-text); }
.status-badge--entered      { background: var(--colour-success-bg);  color: var(--colour-success-text); }
.status-badge--ai           { background: #ede9fe;                   color: #5b21b6; }  /* Purple — AI auto-completed */
.status-badge--rework       { background: #fff3cd;                   color: #92400e; }  /* Amber — sent back for rescan */
.status-badge--critical     { background: #fef2f2;                   color: #b91c1c; }  /* Red — critical errors auto-reworked */
.status-badge--draft        { background: var(--colour-sidebar);     color: var(--colour-text-light);   }
.status-badge--warning      { background: var(--colour-warning-bg);  color: var(--colour-warning-text); }
.status-badge--booked       { background: #dbeafe;                   color: #1d4ed8;                    } /* Blue — Booked */
.status-badge--manual       { background: #e0f2fe;                   color: #0369a1;                    } /* Sky — driver-entered manual order */

/* ── Session meta grid (summary row in detail view) ── */

.session-meta-grid {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.session-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-meta-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--colour-text-light);
}

.session-meta-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--colour-text);
}

/* ── Pallet photo thumbnail ── */

.pallet-thumb {
  display: block;
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--colour-border);
}

.pallet-thumb-missing {
  display: block;
  width: 72px;
  height: 54px;
  background: var(--colour-sidebar);
  border-radius: 4px;
  border: 1px solid var(--colour-border);
  line-height: 54px;
  text-align: center;
  font-size: 13px;
  color: var(--colour-text-light);
}

/* ── Confidence bar ── */

.confidence-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-bar {
  display: inline-block;
  width: 56px;
  height: 6px;
  background: var(--colour-border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.confidence-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--colour-success-text);
  transition: width 0.3s ease;
}

.confidence-bar-fill--low {
  background: var(--colour-danger-text);
}

.confidence-low {
  color: var(--colour-danger-text);
  font-weight: 600;
}

/* Clickable table rows */
.order-row {
  cursor: pointer;
}
.order-row:hover td {
  background: #fafafa;
}

/* ── Inline-editable pallet fields ── */

.pallet-edit-input {
  width: 100%;
  min-width: 90px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  color: var(--colour-text);
  background: transparent;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}

.pallet-edit-input--num {
  max-width: 80px;
}

.pallet-edit-input:hover {
  border-color: var(--colour-border);
  background: var(--colour-sidebar);
}

.pallet-edit-input:focus {
  outline: none;
  border-color: var(--colour-accent);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(150,0,25,0.10);
}

/* Manager manually corrected — shown in accent colour */
.pallet-edit-input--corrected {
  color: var(--colour-accent);
  font-weight: 600;
}

/* Transient save feedback */
.pallet-edit-input--saving {
  border-color: var(--colour-border) !important;
  opacity: 0.6;
}

.pallet-edit-input--saved {
  border-color: var(--colour-success-text) !important;
  background: var(--colour-success-bg) !important;
}

.pallet-edit-input--error {
  border-color: var(--colour-danger-text) !important;
  background: var(--colour-danger-bg) !important;
}

/* Per-pallet delete button */
.pallet-delete-btn {
  background: none;
  border: none;
  color: var(--colour-text-light);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
}
.pallet-delete-btn:hover {
  color: var(--colour-danger-text);
  background: var(--colour-danger-bg);
}

/* ── Manager "take a look" review flag ── */
.pallet-flag-cell { white-space: nowrap; }
.pallet-flag-btn {
  background: none;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  color: #9ca3af;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.pallet-flag-btn:hover { border-color: #f59e0b; color: #b45309; }
.pallet-flag-btn--on {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}
.pallet-flag-note {
  display: block;
  margin-top: 4px;
  width: 118px;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.35;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 3px 5px;
  resize: none;        /* height is managed automatically as the note grows */
  overflow: hidden;
  box-sizing: border-box;
}
.pallet-flag-note.hidden { display: none; }
.pallet-row--flagged td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }

/* ── PWA document upload section ── */

.scan-doc-section {
  border-top: 1px solid var(--colour-border);
  padding-top: 16px;
  margin-top: 4px;
}

.scan-doc-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--colour-text-light);
  margin-bottom: 8px;
  display: block;
}

.scan-doc-btn {
  background: transparent;
  border: 1px solid var(--colour-border);
  color: var(--colour-text-light);
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  margin-bottom: 8px;
}
.scan-doc-btn:hover,
.scan-doc-btn:active {
  border-color: var(--colour-text-light);
  background: var(--colour-sidebar);
  color: var(--colour-text);
}

.scan-doc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.scan-doc-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--colour-sidebar);
  border: 1px solid var(--colour-border);
  border-radius: 16px;
  font-size: 12px;
  color: var(--colour-text);
}

/* ── Photo lightbox ── */

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.photo-lightbox.hidden {
  display: none;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover {
  background: rgba(255,255,255,0.15);
}
.pallet-thumb--clickable {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.pallet-thumb--clickable:hover {
  opacity: 0.8;
}

/* ── Compact PWA pallet rows (replaces large cards) ── */

.scan-pallet-count-bar {
  font-size: 12px;
  font-weight: 600;
  color: var(--colour-text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 6px 0 8px;
}

.scan-pallet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--colour-border);
}
.scan-pallet-row:last-child {
  border-bottom: none;
}
.scan-pallet-row--partial {
  background: var(--colour-warning-bg, #fffbeb);
  margin: 0 -8px;
  padding: 8px 8px;
  border-radius: 6px;
  border-bottom: none;
  margin-bottom: 2px;
}

.scan-pallet-row-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--colour-border);
  flex-shrink: 0;
}

.scan-pallet-row-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-pallet-row-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--colour-text);
  min-width: 64px;
}

.scan-pallet-row-partial {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--colour-text-light);
  cursor: pointer;
}
.scan-pallet-row-partial input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.scan-pallet-row-cases {
  width: 80px;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--colour-border);
  border-radius: 4px;
  background: var(--colour-bg);
  color: var(--colour-text);
}

.scan-pallet-row-remove {
  background: transparent;
  border: none;
  color: var(--colour-text-light);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.scan-pallet-row-remove:hover {
  color: var(--colour-danger-text);
  background: var(--colour-danger-bg);
}

/* Existing pallet row (from server, read-only) */
.scan-pallet-row--existing {
  background: var(--colour-sidebar);
  opacity: 0.9;
}

.scan-pallet-row-thumb--done {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 5px;
  background: var(--colour-success-bg);
  color: var(--colour-success-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.scan-pallet-existing-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--colour-success-bg);
  color: var(--colour-success-text);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
}

/* Resume in-progress modal */
.pwa-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.pwa-modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow-modal);
}

.pwa-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--colour-text);
  margin-bottom: 10px;
}

.pwa-modal-body {
  font-size: 15px;
  color: var(--colour-text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.pwa-modal-hint {
  font-size: 13px;
  color: var(--colour-text-light);
  margin-bottom: 20px;
}

/* Tappable existing pallet thumbnail */
.scan-pallet-row-thumb--tappable {
  cursor: pointer;
  transition: opacity 0.15s;
}
.scan-pallet-row-thumb--tappable:hover,
.scan-pallet-row-thumb--tappable:active {
  opacity: 0.75;
}

/* PWA photo lightbox */
.pwa-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 300;
}
.pwa-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  touch-action: none;          /* JS handles pinch / pan / double-tap zoom */
  transform-origin: center center;
  will-change: transform;
}
.pwa-lightbox-close {
  position: absolute;
  top: 16px;
  left: 16px;                  /* top-LEFT per request */
  z-index: 310;                /* stay tappable above the zoomed photo */
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Settings page ── */

.settings-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--colour-border);
  margin-bottom: 24px;
}

.settings-tab {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--colour-text-light);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover {
  color: var(--colour-text);
}
.settings-tab--active {
  color: var(--colour-primary);
  border-bottom-color: var(--colour-primary);
  font-weight: 600;
}

.settings-info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-info-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
}

.settings-info-label {
  width: 200px;
  flex-shrink: 0;
  color: var(--colour-text-light);
  font-weight: 500;
}

.settings-info-value {
  color: var(--colour-text);
}


/* ── Notification bell ── */

.notif-bell-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}

.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--colour-text-light);
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.notif-bell-btn:hover {
  color: var(--colour-text);
  background: rgba(0,0,0,0.05);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #960019;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  padding: 0 3px;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid var(--colour-content);
  line-height: 1;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid var(--colour-border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 500;
  overflow: hidden;
}

.notif-panel-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--colour-text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--colour-border);
  background: #fafafa;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--colour-border);
  transition: background 0.1s;
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item:hover {
  background: #fafafa;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-msg {
  font-size: 13px;
  color: var(--colour-text);
  line-height: 1.4;
  word-break: break-word;
}
.notif-item-msg a {
  color: var(--colour-primary);
  text-decoration: none;
}
.notif-item-msg a:hover {
  text-decoration: underline;
}

.notif-item-time {
  font-size: 11px;
  color: var(--colour-text-light);
  margin-top: 3px;
}

.notif-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 1px;
}

.notif-action-btn {
  background: none;
  border: 1px solid var(--colour-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  color: var(--colour-text-light);
  transition: background 0.12s, color 0.12s;
}
.notif-action-btn:hover {
  background: var(--colour-primary);
  color: #fff;
  border-color: var(--colour-primary);
}
.notif-action-btn--delete:hover {
  background: var(--colour-danger-text);
  border-color: var(--colour-danger-text);
}

.notif-empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--colour-text-light);
  text-align: center;
}

/* ── Dashboard filter bar ── */

.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dash-filter-bar--inner {
  padding: 12px 16px 0;
  margin-bottom: 12px;
  border-bottom: none;
}

.dash-filter-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dash-filter-input {
  padding: 7px 30px 7px 10px;
  border: 1px solid var(--colour-border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  width: 200px;
  background: #fff;
  color: var(--colour-text);
}
.dash-filter-input:focus {
  outline: none;
  border-color: var(--colour-primary);
}
.dash-filter-date {
  width: 160px;
  cursor: pointer;
}

.dash-filter-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--colour-text-light);
  padding: 0;
  line-height: 1;
}
.dash-filter-clear:hover {
  color: var(--colour-text);
}

/* ── Collapsible section headers ── */

.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--colour-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--colour-border);
  background: #fafafa;
}
.dash-section-header:hover {
  background: #f4f4f4;
}

.dash-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--colour-border);
  color: var(--colour-text-light);
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
}

.dash-chevron {
  font-size: 14px;
  color: var(--colour-text-light);
  transition: transform 0.2s;
  display: inline-block;
}

/* ── Pagination ── */

.dash-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--colour-border);
  font-size: 13px;
}

.dash-pagination-info {
  color: var(--colour-text-light);
  margin-right: auto;
}

.dash-pagination-page {
  color: var(--colour-text-light);
}

.notif-recipient-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
}
