/* ── Hotel Practica Styles ── */

/* Department colors */
:root {
  --dept-housekeeping: #a16207;   /* was #ca8a04: 2.8:1 on its chip; now >= 4.5:1 */
  --dept-housekeeping-bg: #fefce8;
  --dept-maintenance: #1d4ed8;
  --dept-maintenance-bg: #eff6ff;
  --dept-frontdesk: #15803d;     /* AA 2026-12-02 (was #16a34a, 3.2:1 on its chip) */
  --dept-frontdesk-bg: #f0fdf4;
  --dept-kitchen: #c2410c;       /* AA (was #ea580c) */
  --dept-kitchen-bg: #fff7ed;
  --dept-security: #b91c1c;      /* AA (was #dc2626, 4.4:1) */
  --dept-security-bg: #fef2f2;
  --dept-other: #4b5563;         /* AA (was #6b7280, 4.4:1 on its chip) */
  --dept-other-bg: #f3f4f6;
  --dept-management: #7c3aed;
  --dept-management-bg: #f5f3ff;
  --dept-breakfastbar-bg: var(--dept-kitchen-bg);   /* app.js looks up --dept-<name>-bg */
  /* Recurring accent: a deeper burnt orange, deliberately distinct from Breakfast Bar's orange */
  --recurring: #9a3412;          /* kept distinct from Breakfast Bar, now #c2410c */
}

/* Theme tokens */
:root, [data-theme="light"] {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f0f2f5;
  --text: #1a1a2e;
  --text-secondary: #5f6673;
  --text-muted: #646b78;
  --border: #e5e7eb;
  --border-focus: #3b82f6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-fill: #2563eb;        /* filled buttons / active chips (white text on it) */
  --primary-fill-hover: #1d4ed8;
  --on-primary: #ffffff;
  --on-accent: #ffffff;           /* text on a --primary background (selected chips) */
  --danger: #b91c1c;
  --danger-fill: #b91c1c;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --urgent: #b91c1c;
  --urgent-bg: #fef2f2;
  --high: #c2410c;
  --high-bg: #fff7ed;
  --medium: #2563eb;
  --medium-bg: #eff6ff;
  --low: #15803d;
  --low-bg: #f0fdf4;
  --modal-overlay: rgba(0,0,0,0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #1e293b;
  --bg-hover: #334155;
  --text: #e2e8f0;
  --text-secondary: #a9b6c8;
  --text-muted: #a3b1c5;         /* AA on --bg-hover (was #94a3b8, 4.0:1) */
  --border: #334155;
  --border-focus: #60a5fa;
  --primary: #60a5fa;             /* accent TEXT on dark cards (was #3b82f6, 3.9:1) */
  --primary-hover: #93c5fd;
  --primary-light: #1e3a5f;
  --primary-fill: #2563eb;        /* filled buttons keep white text at >= 4.5:1 */
  --primary-fill-hover: #1d4ed8;
  --on-primary: #ffffff;
  --on-accent: #0f172a;           /* dark: selected chips use the bright accent with dark text (3:1+ vs cards) */
  --danger: #fca5a5;
  --danger-fill: #dc2626;
  --danger-bg: #3b1a1a;
  --success: #22c55e;
  --success-bg: #1a3b2a;
  --warning: #f59e0b;
  --warning-bg: #3b2e1a;
  --urgent: #f87171;
  --urgent-bg: #3b1a1a;
  --high: #f97316;
  --high-bg: #3b2a1a;
  --medium: #60a5fa;
  --medium-bg: #1e3a5f;
  --low: #22c55e;
  --low-bg: #1a3b2a;
  --modal-overlay: rgba(0,0,0,0.6);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --radius: 10px;
  --radius-sm: 6px;
  --dept-housekeeping: #facc15;
  --dept-housekeeping-bg: #3b3410;
  --dept-maintenance: #60a5fa;
  --dept-maintenance-bg: #1e3a5f;
  --dept-frontdesk: #4ade80;
  --dept-frontdesk-bg: #1a3b2a;
  --dept-kitchen: #fb923c;
  --dept-kitchen-bg: #3b2a1a;
  --dept-security: #f87171;
  --dept-security-bg: #3b1a1a;
  --dept-other: #9ca3af;
  --dept-other-bg: #1f2937;
  --dept-management: #a78bfa;
  --dept-management-bg: #2e1a5e;
  --recurring: #fdba74;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

/* ── Login tabs ── */
.login-tabs {
  display: flex; border: 1px solid var(--border); border-radius: 20px;
  overflow: hidden; margin-bottom: 1rem;
}
.login-tab {
  flex: 1; padding: 0.55rem 1rem; font-size: 0.9rem; font-weight: 600; font-family: inherit;
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.login-tab.active { background: var(--primary); color: var(--on-accent); }
.login-tab:not(.active):hover { background: var(--bg-hover); }

/* ── Login ── */
.login-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.5rem;
  width: 100%; max-width: 360px;
}

.login-card h1 { font-size: 1.75rem; text-align: center; margin-bottom: 0.25rem; }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  position: sticky; top: 0; z-index: 100;
}

.topbar h1 { font-size: 1.2rem; display: flex; align-items: center; gap: 0.4rem; }
.topbar h1.logo svg { flex-shrink: 0; }

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

/* ── Forms ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.75rem 0.85rem;
  font-size: 1rem; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 22%, transparent);
}

/* ── Show password row ── */
.show-pass-row {
  display: flex; align-items: center; gap: 0.45rem;
  margin: -0.4rem 0 1rem;
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.show-pass-check {
  width: 18px; height: 18px; accent-color: var(--primary);
  cursor: pointer; flex-shrink: 0;
}
.show-pass-label {
  font-size: 0.85rem; color: var(--text-secondary);
  cursor: pointer;
}

/* ── Password fields with an eye toggle (see pwEnhance in app.js) ── */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 2.7rem; }
.pw-wrap > input::-ms-reveal,
.pw-wrap > input::-ms-clear { display: none; }
.pw-eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-secondary); cursor: pointer; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.pw-eye:hover { color: var(--text); background: var(--bg-hover); }
.pw-eye:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.pw-eye svg { width: 18px; height: 18px; display: block; }

/* ── Buttons ── */
.btn-primary, .btn-outline, .btn-sm, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem; font-weight: 600; font-family: inherit;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s, opacity 0.15s;
  min-height: 44px; min-width: 44px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-full { width: 100%; }

.btn-primary { background: var(--primary-fill); color: var(--on-primary); }
.btn-primary:hover, .btn-primary:active { background: var(--primary-fill-hover); }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover, .btn-outline:active { background: var(--bg-hover); }

.btn-sm {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem; font-size: 0.8rem; min-height: 36px;
}
.btn-sm:hover { background: var(--bg-hover); }

.btn-danger { background: var(--danger-fill); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; padding: 0.3rem;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon:hover { color: var(--text); background: var(--bg-hover); border-radius: var(--radius-sm); }

/* ── Toolbar ── */
.toolbar {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1rem;
}

/* ── Job List ── */
.job-list { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }

.job-card {
  background: var(--bg-card); border: 2px solid var(--dept-color, var(--border)); border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.job-card:hover { border-color: var(--dept-color, var(--border)); background: var(--bg-hover); box-shadow: var(--shadow-sm); }

/* ── Job unread dot (small red circle top-right on unseen cards) ── */
.job-unseen { position: relative; }
.job-card-dot {
  position: absolute; top: 0.5rem; right: 0.5rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-fill);
  z-index: 2;
}

.job-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
  min-width: 0; width: 100%;
  flex: 1 1 100%;
}
.job-card { min-width: 0; }
.recur-card-top { min-width: 0; }

.job-card-location {
  font-size: 0.85rem; color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 0.25rem;
  min-width: 0; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.job-card-location span { overflow: hidden; text-overflow: ellipsis; }
.job-card-location svg { width: 14px; height: 14px; flex-shrink: 0; stroke: var(--text-secondary); }

.job-card-title {
  font-weight: 600; font-size: 1rem; line-height: 1.35;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 100%;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.job-card-badges { display: flex; gap: 0.3rem; flex-shrink: 0; align-self: flex-start; }

.job-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-secondary);
}

.job-card-meta .meta-item {
  display: inline-flex; align-items: center; gap: 0.2rem;
}
.job-card-meta .meta-item svg { width: 13px; height: 13px; flex-shrink: 0; stroke: var(--text-muted); }
.meta-time { margin-left: auto; color: var(--text-muted); font-size: 0.75rem; }

.load-more-wrap { text-align: center; padding: 0.5rem 1rem 2rem; }

/* ── Department colour: whole-card border (all four sides) ── */
.job-card {
  position: relative;
  overflow: hidden;
}
.job-card[data-dept="Housekeeping"] { --dept-color: var(--dept-housekeeping); }
.job-card[data-dept="Maintenance"] { --dept-color: var(--dept-maintenance); }
.job-card[data-dept="Front Desk"] { --dept-color: var(--dept-frontdesk); }
.job-card[data-dept="Breakfast Bar"] { --dept-color: var(--dept-kitchen); }
.job-card[data-dept="Security"] { --dept-color: var(--dept-security); }
.job-card[data-dept="Management"] { --dept-color: var(--dept-management); }
.job-card[data-dept="Other"] { --dept-color: var(--dept-other); }

/* Department chip: represents the dept's colour + icon (job cards, job detail) */
.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}
.dept-chip svg { flex-shrink: 0; width: 13px; height: 13px; }

/* Opened job: dept colour as a left accent on the header, mirroring the card stripe */
.detail-header { box-shadow: inset 4px 0 0 var(--dept-color, transparent); }

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: 0.35rem 0.2rem 0.25rem;
  font-size: 0.65rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; min-height: 48px; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
  position: relative;
}
.bottom-nav a .nav-icon {
  position: relative;
  display: inline-flex;
  font-size: 1.3rem;
  line-height: 1;
}
.topbar-nav-link .nav-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 0;
}
/* bottom-nav equal thirds */
.bottom-nav a { flex: 1 1 0; width: 0; text-align: center; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a:not(.active):active { color: var(--text-secondary); }

/* Unread badge over nav icon */
.nav-unread {
  position: absolute; top: 0.2rem; right: 50%; margin-right: -1.1rem;
  background: var(--danger-fill); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  padding: 0.1rem 0.35rem; border-radius: 999px;
  line-height: 1.2; min-width: 1rem; text-align: center;
  display: none;
}
.nav-unread.show { display: inline; }

/* ── Small red dot for nav/tabs unread indicators ── */
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-fill);
  flex-shrink: 0;
  display: none;
}
.unread-dot.show { display: inline-block; }

.nav-dot {
  position: absolute; top: -2px; right: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-fill);
  display: none;
  pointer-events: none;
}
.nav-dot.show { display: inline-block; }

/* Push content up above bottom nav */
.has-bottom-nav { padding-bottom: 60px; }
body.msg-page.has-bottom-nav { padding-bottom: 0; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; line-height: 1; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
}
.badge-p-low { background: var(--low-bg); color: var(--low); }
.badge-p-medium { background: var(--medium-bg); color: var(--medium); }
.badge-p-high { background: var(--high-bg); color: var(--high); }
.badge-p-urgent { background: var(--urgent-bg); color: var(--urgent); }
.badge-s-open { background: var(--bg-hover); color: var(--text-secondary); }
.badge-s-in_progress { background: var(--medium-bg); color: var(--medium); }
.badge-s-done { background: var(--success-bg); color: var(--success); }
.badge-s-backburner { background: var(--warning-bg); color: var(--warning); }
.badge-s-trash { background: var(--danger-bg); color: var(--danger); }

/* ── Modal ── */
/* Sheets END ABOVE the always-visible bottom nav, so their action buttons
   (Cancel / Create / Save / Send) can never be covered by it.
   --nav-h is measured in app.js; 56px is a safe fallback before JS runs. */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: var(--nav-h, 56px);
  background: var(--modal-overlay);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s;
}

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

.modal {
  background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px;
  max-height: 100%;
  display: flex; flex-direction: column;
}
/* A sheet without the body/footer split scrolls instead of overflowing */
.modal:not(:has(.modal-body)) { overflow-y: auto; }

.modal h2 { font-size: 1.2rem; padding: 1.25rem 1.5rem 0; margin: 0; flex-shrink: 0; }

.modal-form { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.modal-body { padding: 0.75rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-body .field:first-child { margin-top: 0; }

.form-actions {
  display: flex; gap: 0.6rem;
  padding: 1rem 1.5rem 1.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.form-actions * { flex: 1; }
.form-actions .inv-delete-btn { flex: 0 0 auto; margin-right: auto; }

/* ── Job Detail ── */
.detail-header {
  background: var(--bg-card);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }

.detail-nav button { flex-shrink: 0; }

.detail-title { font-size: 1.3rem; font-weight: 700; min-width: 0; max-width: 100%; overflow-wrap: break-word; word-break: normal; hyphens: none; }

.detail-meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-secondary);
}

.detail-notes {
  background: var(--bg);
  padding: 0.75rem; border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.9rem; white-space: pre-wrap;
  color: var(--text);
}

.detail-actions { display: flex; gap: 0.6rem; margin-top: 0.75rem; flex-wrap: wrap; }
.detail-actions * { flex: 1; min-width: 120px; }

.section { padding: 1rem; border-bottom: 1px solid var(--border); }
.section h3 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--text-secondary); }

/* ── Photo Grid ── */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.4rem; }

.photo-thumb {
  aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-hover); cursor: pointer;
}

.photo-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  image-orientation: from-image;
}

.photo-upload-area {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch;
  margin-bottom: 0.75rem;
}

.photo-upload-area label,
.photo-upload-area .photo-btn {
  flex: 1 1 140px;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.85rem 0.7rem; border: 2px dashed var(--border); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-secondary); font-size: 0.95rem; font-weight: 600;
  min-height: 52px;
  text-align: center;
  background: none; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.photo-upload-area label:hover,
.photo-upload-area label:active,
.photo-upload-area .photo-btn:hover,
.photo-upload-area .photo-btn:active { border-color: var(--primary); color: var(--primary); background: var(--bg-hover); }
.photo-upload-area input[type="file"] { display: none; }

.photo-preview-strip {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.photo-preview-strip:empty { display: none; }
.photo-preview-item {
  position: relative;
  width: 72px; height: 72px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-hover); flex-shrink: 0;
}
.photo-preview-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  image-orientation: from-image;
}
.photo-preview-item .photo-preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.photo-preview-count {
  font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.4rem;
}
.modal-body .photo-upload-area { margin-top: 0.25rem; }
.modal-body .photo-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 0.4rem; }
.modal-body .photo-thumb { cursor: default; }

/* In-page camera. Snapping via the OS camera app can make Android throw this page
   away (the item dialog then vanishes on return), so capture lives inside the page. */
.camera-overlay {
  position: fixed; inset: 0; z-index: 3200; background: #000;
  display: flex; flex-direction: column;
}
.camera-overlay.hidden { display: none; }
.camera-overlay video { flex: 1 1 auto; width: 100%; min-height: 0; object-fit: cover; background: #000; }
.camera-overlay .camera-actions {
  display: flex; gap: 0.6rem; flex: 0 0 auto; background: #000;
  padding: 0.85rem calc(0.85rem + env(safe-area-inset-right)) calc(0.85rem + env(safe-area-inset-bottom)) calc(0.85rem + env(safe-area-inset-left));
}
.camera-overlay .camera-actions button { flex: 1 1 0; min-height: 44px; }

/* ── Comments ── */
.comment { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }

.comment-head {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.2rem;
}
.comment-head strong { color: var(--text); }

.comment-body { font-size: 0.9rem; white-space: pre-wrap; }

.comment-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.comment-form textarea {
  flex: 1; padding: 0.6rem; font-size: 0.9rem; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  resize: none; min-height: 44px;
  outline: none;
}
.comment-form textarea:focus { border-color: var(--border-focus); }
.comment-form button { align-self: flex-end; }
.comment-photo-chip { align-self: center; font-size: 0.78rem; color: var(--text-secondary); background: var(--bg-hover); border-radius: 999px; padding: 0.2rem 0.55rem; cursor: pointer; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-photo-chip.hidden { display: none; }
.comment-form .btn-icon { align-self: flex-end; flex-shrink: 0; }
.comment-photo { margin-top: 0.4rem; }
.comment-photo img { max-width: 240px; border-radius: var(--radius-sm); cursor: pointer; display: block; }

/* ── History ── */
.history-item {
  display: flex; gap: 0.5rem; align-items: flex-start;
  padding: 0.4rem 0; font-size: 0.85rem;
}
.history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin-top: 0.4rem; flex-shrink: 0; }
.history-text { color: var(--text-secondary); }
.history-text strong { color: var(--text); }
.history-time { font-size: 0.75rem; color: var(--text-muted); }

/* ── Error ── */
.error { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }
.hidden { display: none !important; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* ── Lightbox ── */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; cursor: pointer;
}
.lightbox-overlay img { max-width: 95vw; max-height: 95vh; border-radius: 4px; image-orientation: from-image; }

/* ── Loading ── */
.spinner { text-align: center; padding: 2rem; color: var(--text-muted); }

/* Messages Page -- mobile: thread | compose | Channels btn | bottom-nav
   Bottom chrome is position:fixed; body stays overflow:hidden without clipping nav. */
body.msg-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  padding-bottom: 0 !important;
}
body.msg-page .topbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 160;
}

.msg-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  height: calc(100dvh - 52px);
  min-height: 0;
  overflow: hidden;
}
body.msg-page .msg-layout {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  /* padding-bottom for fixed Channels+nav set in mobile media below */
}

/* Messages mobile chrome: keep bottom-nav fixed (never in-flow inside overflow:hidden body).
   Channels bar sits fixed just above nav. msg-layout padding clears both so compose never clips. */
body.msg-page .bottom-nav {
  position: fixed;
  bottom: var(--vv-bottom-offset, 0px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  transform: none;
  border-radius: 0;
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.channel-list {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 90;
}

/* Mobile Channels control (replaces letter-chip row) */
.channels-bar {
  display: none;
  flex-shrink: 0;
  background: var(--bg-card);
  padding: 0.35rem 0.75rem;
}
.channels-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.channels-btn:active { background: var(--bg-hover); }
.channels-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.channels-btn-icon svg { width: 16px; height: 16px; }
.channels-btn-label {
  flex: 1 1 auto;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.channels-btn-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger-fill);
  display: none;
  flex-shrink: 0;
}
.channels-btn-unread.show { display: inline-block; }
.channels-btn-chevron { flex-shrink: 0; color: var(--text-muted); }

/* Channel picker bottom sheet */
.channel-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 220;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.channel-picker-overlay.hidden { display: none; }
.channel-picker-sheet {
  background: var(--bg-card);
  width: 100%;
  max-width: 520px;
  max-height: min(72dvh, 72vh);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
  animation: channelSheetUp 0.2s ease-out;
}
@keyframes channelSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.channel-picker-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0.55rem auto 0.2rem;
  flex-shrink: 0;
}
.channel-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.65rem 1rem;
  flex-shrink: 0;
}
.channel-picker-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
}
.channel-picker-close { color: var(--text-muted); }
.channel-picker-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.5rem 0.75rem;
  min-height: 0;
}
.channel-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.channel-picker-item .channel-item-name { flex: 1 1 auto; min-width: 0; }
.channel-picker-item .channel-unread-badge { margin-left: 0; }
.channel-picker-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
.channel-picker-item:not(.active):active { background: var(--bg-hover); }
.channel-picker-item .dept-icon-msg svg { width: 18px; height: 18px; }

/* Landscape phone (incl. wide+short): compact centered sheet */
.channel-btn {
  flex-shrink: 0; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1rem; font-size: 0.85rem; font-weight: 600; font-family: inherit;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; min-height: 44px;
  -webkit-tap-highlight-color: transparent; transition: all 0.15s;
}
.channel-btn.active { color: var(--text); border-bottom-color: var(--primary); }
.channel-btn:not(.active):hover { background: var(--bg-hover); }
.dept-icon-msg {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dept-icon-msg svg { width: 14px; height: 14px; }
.channel-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.channel-unread-badge {
  margin-left: auto;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-fill);
  flex-shrink: 0;
  display: none;
}
.channel-unread-badge.show { display: inline-block; }

.msg-thread {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.msg-bubble {
  max-width: 85%; padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  align-self: flex-start;
}
.msg-bubble.own {
  align-self: flex-end;
  background: var(--primary-light);
}
.msg-head {
  display: flex; justify-content: space-between; gap: 0.5rem;
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.15rem;
}
.msg-head strong { color: var(--text); }
.msg-bubble.own .msg-head { color: var(--text); }   /* muted grey fails AA on the tinted own bubble in dark themes */
.msg-body { font-size: 0.9rem; white-space: pre-wrap; min-width: 0; max-width: 100%; overflow-wrap: break-word; word-break: normal; hyphens: none; }

/* Compose row must fit narrow phones — never clip Send */
.msg-input-bar {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  min-width: 0;
}
.msg-input-bar input {
  flex: 1 1 auto;
  min-width: 0;
  width: 0; /* allow shrink in flex row */
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  outline: none;
  min-height: 40px;
}
.msg-input-bar input:focus { border-color: var(--border-focus); }
.msg-send-btn {
  flex: 0 0 auto;
  border-radius: 20px;
  padding: 0.5rem 0.85rem;
  min-height: 40px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.msg-job-attach-wrap { position: relative; flex: 0 0 auto; max-width: 42%; }
.msg-job-attach-btn {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.45rem 0.55rem;
  font-size: 0.75rem;
  min-height: 40px;
}
@media (max-width: 380px) {
  .msg-job-attach-text { display: none; }
  .msg-send-btn { padding: 0.5rem 0.65rem; }
}

/* ── Day separator in message threads ── */
.day-sep {
  text-align: center;
  padding: 0.75rem 0 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.day-sep span {
  background: var(--bg);
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
}

/* ── Recurring Page ── */
.recurring-header { padding: 1rem; }
.recurring-list { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.recur-card {
  position: relative; overflow: hidden;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 0.9rem 7.85rem 0.9rem 1rem;
  display: flex; flex-direction: column; gap: 0.3rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
/* Department colour stripe (same idea as job cards) */
.recur-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
}
.recur-card-title { font-weight: 600; font-size: 1rem; line-height: 1.3; flex: 1; min-width: 0; max-width: 100%; overflow-wrap: break-word; word-break: normal; hyphens: none; }
.recur-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-secondary);
}
.recur-card-schedule {
  font-size: 0.85rem; color: var(--text-secondary);
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.recur-card-schedule .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--border); display: inline-block; }
.recur-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; }

/* Card body wrapper — lets a location-paneled card lay out as a row (mirrors .job-card-body) */
.recur-card-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }

/* Recurring marker rail — mirrors the left location panel, labelled "Recurring". */
.recur-card {
  border: 2px solid var(--dept-color, var(--border));
}
.recur-card:hover {
  border-color: var(--dept-color, var(--border));
  background: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}
.recur-rail {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 116px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0.6rem;
  border-left: 1px solid var(--border);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: center;
  pointer-events: none;
}
.recur-card.has-loc { flex-direction: row; align-items: stretch; gap: 0.7rem; }
.recur-card.has-loc .recur-card-body { flex: 1 1 auto; }

/* Toggle switch */
.toggle-wrap {
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.toggle {
  position: relative; width: 44px; height: 24px;
  background: var(--border); border-radius: 12px;
  cursor: pointer; transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  border: none; padding: 0; flex-shrink: 0;
}
.toggle.on { background: var(--success); }
.toggle::after {
  content: ''; position: absolute;
  top: 2px; left: 2px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(20px); }

/* ── Move Control ── */
.move-control { margin-top: 0.75rem; }
.move-control label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 0.3rem; }
.move-control select {
  width: 100%; padding: 0.7rem 0.85rem; font-size: 0.95rem; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; cursor: pointer; -webkit-appearance: none;
}
.move-control select:focus { border-color: var(--border-focus); }

/* Assign Control (v24, managers): same look as Move to; the pair sits side by side
   when they fit and stacks when the screen is too narrow. */
.assign-control { margin-top: 0.75rem; }
.assign-control label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 0.3rem; }
.assign-control select {
  width: 100%; padding: 0.7rem 0.85rem; font-size: 0.95rem; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; cursor: pointer; -webkit-appearance: none;
}
.assign-control select:focus { border-color: var(--border-focus); }
.move-assign-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.detail-actions .move-assign-row { flex: 1 1 100%; }
.move-assign-row .move-control, .move-assign-row .assign-control { flex: 1 1 140px; min-width: 140px; }

/* ── Dept Toggle — equal 50/50 width ── */
.dept-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 20px;
  overflow: hidden;
}
.dept-toggle button {
  flex: 1 1 50%; padding: 0.4rem 0.5rem;
  font-size: 0.8rem; font-weight: 600; font-family: inherit; text-align: center;
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dept-toggle button.active { background: var(--primary); color: var(--on-accent); }
.dept-toggle button:not(.active):hover { background: var(--bg-hover); }

/* ── User dropdown ── */
.user-dropdown {
  position: relative;
  flex-shrink: 0;
}

.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: background 0.15s;
}
.user-menu-btn:hover { background: var(--bg-hover); }
.user-menu-btn svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.user-menu-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  overflow: hidden;
}
.dropdown-menu.open { display: block; }

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-bg); }

.dropdown-divider {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.user-badge {
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--text-secondary);
}
.user-badge strong { color: var(--text); }

/* Red nudge dot on the user menu button while the account has no email on file */
.user-menu-btn { position: relative; }
.user-menu-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 2px var(--bg-card);
}

/* Notification preferences panel (top-right menu → Notifications) */
.notify-device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 0.7rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.notify-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
}
.notify-toggle-row:first-of-type { border-top: none; }
.notify-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Responsive ── */
/* ── Messages desktop: sidebar layout (wide AND tall — exclude landscape phones) ── */
/* ── Location Picker ── */
.lp-container { position: relative; }

.lp-chips {
  display: flex; gap: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.lp-chip {
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem; font-weight: 600; font-family: inherit;
  border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-height: 36px;
}
.lp-chip.active { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.lp-chip:not(.active):hover { background: var(--bg-hover); }

.lp-search {
  width: 100%; padding: 0.75rem 0.85rem;
  font-size: 1rem; font-family: inherit;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.lp-search:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 22%, transparent); }

.lp-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 260px; overflow-y: auto;
  z-index: 300;
  display: none;
}
.lp-results.open { display: block; }

.lp-result {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer; transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid var(--border);
}
.lp-result:last-child { border-bottom: none; }
.lp-result:hover, .lp-result:active { background: var(--bg-hover); }

.lp-result-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-radius: 50%;
}
.lp-result-label { flex: 1; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-result-wing { flex-shrink: 0; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.lp-result-custom .lp-result-label { color: var(--primary); font-weight: 600; }

/* ── Outline primary button (unselected blue) ── */
.btn-outline-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem; font-weight: 600; font-family: inherit;
  border: 1.5px solid var(--primary); border-radius: var(--radius-sm);
  background: transparent; color: var(--primary);
  cursor: pointer; transition: background 0.15s, color 0.15s;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn-outline-primary:hover { background: var(--primary-fill); color: var(--on-primary); }
.btn-outline-primary svg { flex-shrink: 0; }

/* ── Portrait-only New Job button (hidden by default on desktop) ── */
#newJobBtnPortrait {
  display: none;
}

/* ── Mobile portrait: 2-row layout ── */
/* ── Dropdown label (language section) ── */
.dropdown-label {
  display: block;
  padding: 0.4rem 0.8rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: default;
}

/* ── Canned action buttons ── */
.canned-bar {
  padding: 0.3rem 0.5rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
}
.canned-bar .quick-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.canned-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
  min-height: 32px;
}
.canned-btn:hover {
  background: var(--bg-hover);
}
.quick-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Grok polish: suggestions + responsive */
.hint-text {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}
.manage-panel h3 {
  font-size: 0.95rem;
  margin: 0.25rem 0 0.75rem;
}
.suggest-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.suggest-row:last-child { border-bottom: none; }
.suggest-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.suggest-body {
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
}
.suggest-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ── Assets admin window (real-time editor) ── */
.assets-hint { font-size: 0.85rem; color: var(--text-muted); margin: -0.25rem 0 0.75rem; }
.asset-tabs {
  display: flex; gap: 0.3rem;
  background: var(--bg-hover);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}
.asset-tab {
  flex: 1 1 0; min-width: 0;
  padding: 0.45rem 0.4rem;
  border: none; background: transparent; color: var(--text-secondary);
  font: inherit; font-size: 0.85rem; font-weight: 650;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.asset-tab.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm); }
.page-back { padding: 1rem 1rem 0; display: flex; }
.page-back .btn-sm { display: inline-flex; align-items: center; gap: 0.3rem; }
.assets-toolbar {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 0.6rem;
}
.assets-toolbar .lp-search { flex: 1 1 220px; }
.assets-toolbar .lp-chip { min-height: 32px; }
.assets-add {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  margin: 0.6rem 0 0.9rem;
}
.assets-add input, .assets-add select {
  flex: 1 1 160px; min-width: 0;
  padding: 0.5rem 0.65rem; font: inherit; font-size: 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text);
}
.asset-parent-group {
  margin: 1rem 0 0.45rem;
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-secondary);
}
.asset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px 74px 86px;
  align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 0.35rem;
}
.asset-row-room { background: var(--bg-hover); }
.asset-row .asset-name {
  min-width: 0; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 0.35rem;
}
.asset-row-area .asset-name { cursor: pointer; }
.asset-row-area .asset-name:hover { text-decoration: underline dotted; text-underline-offset: 2px; }
.asset-tag {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.04rem 0.4rem; flex-shrink: 0;
}
.asset-row-room .asset-tag { background: var(--bg); }
.asset-parent-static { font-size: 0.8rem; color: var(--text-secondary); }
.asset-row .asset-wing-sel {
  width: 100%; min-width: 0;
  padding: 0.35rem 0.4rem; font: inherit; font-size: 0.8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-secondary);
}
.asset-row .asset-count { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; text-align: right; }
.asset-del { justify-self: end; }
@media (max-width: 600px) {
  .asset-row { grid-template-columns: minmax(0, 1fr) 88px 56px 70px; gap: 0.35rem; }
  .asset-row .asset-count { font-size: 0.7rem; }
}
.asset-inline-input {
  width: 100%; padding: 0.4rem 0.55rem; font: inherit; font-weight: 600;
  border: 1px solid var(--border-focus); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text);
}
/* Review window extras */
.suggest-followup { margin-top: 0.5rem; }
.asset-note { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.4rem; }
.asset-followup-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.asset-editor {
  display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
  margin-top: 0.5rem;
  padding: 0.55rem; border: 1px dashed var(--border); border-radius: var(--radius-sm);
}
.asset-editor .asset-edit-name {
  flex: 1 1 180px; min-width: 0; padding: 0.45rem 0.6rem; font: inherit; font-size: 0.85rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text);
}
.asset-editor .asset-edit-wing {
  flex: 0 0 auto; padding: 0.45rem 0.5rem; font: inherit; font-size: 0.85rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text);
}
.btn-danger-ghost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(6px);
  background: var(--text); color: var(--bg-card);
  padding: 0.5rem 0.9rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s;
  z-index: 500; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  min-height: 36px;
}
.modal-wide {
  max-width: min(560px, 96vw);
}
.dropdown-item, .user-menu-btn, .btn-primary, .btn-outline, .btn-outline-primary, .canned-btn {
  min-height: 44px;
}
.login-card {
  width: min(420px, 94vw);
}
.topbar, .bottom-nav a {
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 899px) {
  .dropdown-menu {
    min-width: 200px;
  }
  .modal {
    max-height: 100%;
  }
  .job-card {
    padding: 0.85rem 1rem;
  }
}

/* ── Inline job link in messages ── */
.msg-job-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.msg-bubble.own .msg-job-link { color: var(--primary); }
.msg-job-attach-wrap { position: relative; flex-shrink: 0; }
.msg-job-attach-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.msg-job-attach-btn.active, .msg-job-attach-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.msg-job-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: min(280px, 70vw);
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 40;
  display: none;
}
.msg-job-picker.open { display: block; }
.msg-job-picker button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.msg-job-picker button:hover { background: var(--bg-hover); }
.msg-job-picker .empty {
  padding: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.msg-job-chip-go {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Message attach menu (paperclip dropdown) + photo preview ── */
.msg-attach-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.msg-attach-ic { flex-shrink: 0; }
.msg-attach-menu button span { white-space: nowrap; }
.msg-photo-file-input { display: none !important; }
.msg-photo-preview {
  position: absolute;
  left: 0.55rem;
  bottom: calc(100% + 6px);
  z-index: 41;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: min(240px, 60vw);
}
.msg-photo-preview[hidden] { display: none; }
.msg-photo-chip {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  background: var(--bg-card);
}
.msg-photo-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-photo-chip button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* Photos inside a message bubble */
.msg-photos {
  margin-top: 0.35rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.3rem;
  max-width: 300px;
}
.msg-photos img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
  cursor: pointer;
  image-orientation: from-image;
}
.msg-photos:not(.multi) { grid-template-columns: 1fr; max-width: 240px; }
.msg-photos:not(.multi) img { aspect-ratio: auto; height: auto; }

/* ── Hotel Practica logo menu ── */
.logo-dropdown {
  position: relative;
  flex-shrink: 0;
}
.logo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}
.logo-btn:hover { background: var(--bg-hover); }
.logo-btn svg { flex-shrink: 0; }
.logo-chevron {
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.logo-btn[aria-expanded="true"] .logo-chevron { transform: rotate(180deg); }
.dropdown-menu-left {
  left: 0;
  right: auto;
  min-width: 200px;
}

/* ── Work List control ── */
.worklist-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}
.worklist-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.worklist-btn:hover { background: var(--bg-hover); }
.worklist-btn[aria-expanded="true"] {
  border-color: var(--primary);
  color: var(--primary);
}
.worklist-btn svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s;
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
}
.worklist-btn[aria-expanded="true"] svg { transform: translateY(-50%) rotate(180deg); }
.worklist-btn #workListLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}
.worklist-menu {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  min-width: 180px;
  max-width: min(92vw, 280px);
  z-index: 120;
}
.worklist-menu .worklist-option {
  text-align: center;
}
.worklist-menu .worklist-option.active {
  background: var(--bg-hover);
  color: var(--primary);
  font-weight: 700;
}

/* ── Filters control (dashboard) ── */
.filters-dropdown {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.filters-btn:hover { background: var(--bg-hover); }
.filters-btn[aria-expanded="true"] {
  border-color: var(--primary);
  color: var(--primary);
}
.filters-btn svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s;
}
.filters-btn[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.filters-btn #filtersLabel,
.filters-btn #deptPickerLabel,
.filters-btn #areaPickerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}
.filters-menu {
  left: 0;
  right: auto;
  min-width: 200px;
  max-width: min(92vw, 280px);
  max-height: min(70vh, 420px);
  overflow-y: auto;
  z-index: 120;
  padding: 0.35rem 0;
}
.filters-section-label {
  padding: 0.45rem 0.9rem 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.filters-menu .filter-option.active {
  background: var(--bg-hover);
  color: var(--primary);
  font-weight: 700;
}
/* ===== Messages in-flow chrome (portrait-safe) =====
   Thread scrolls; compose + Channels + bottom-nav are layout siblings, never overlays.
   Desktop uses the same Channels-button aesthetic (no broken bottom sidebar). */
body.msg-page {
  display: flex !important;
  flex-direction: column !important;
  height: var(--app-height, 100dvh) !important;
  max-height: var(--app-height, 100dvh) !important;
  overflow: hidden !important;
  padding-bottom: 0 !important;
}
body.msg-page .topbar {
  flex: 0 0 auto !important;
  position: relative !important;
  z-index: 160;
}
body.msg-page .msg-layout {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding-bottom: 0 !important;
  /* kill desktop grid leftovers */
  grid-template-columns: none !important;
  grid-template-rows: none !important;
}
body.msg-page .msg-thread {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding-bottom: 0.75rem !important;
  -webkit-overflow-scrolling: touch;
  max-width: none !important;
  margin: 0 !important;
  width: 100% !important;
  grid-column: auto !important;
  grid-row: auto !important;
}
body.msg-page .channel-list {
  display: none !important;
}
body.msg-page .msg-input-bar,
body.msg-page .msg-input-bar:not(.hidden) {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  z-index: 5 !important;
  flex: 0 0 auto !important;
  grid-column: auto !important;
  grid-row: auto !important;
}
body.msg-page .channels-bar {
  display: block !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 100% !important;
  z-index: 5 !important;
  flex: 0 0 auto !important;
  min-height: 0 !important;
}
body.msg-page .bottom-nav {
  display: flex !important;
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  max-width: none !important;
  width: 100% !important;
  flex: 0 0 auto !important;
  z-index: 5 !important;
}

/* While typing: only hide chrome on short LANDSCAPE (portrait always keeps Channels + bottom-nav). */
html.msg-page, body.msg-page {
  overscroll-behavior: none;
}

/* ── Inventory ── */
.inventory-page { padding-bottom: 1.5rem; }
.inventory-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; padding: 1rem 1rem 0.5rem; flex-wrap: wrap;
}
.inventory-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.inventory-subtitle { margin: 0.2rem 0 0; color: var(--text-secondary); font-size: 0.88rem; }
.inventory-header .btn-primary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1rem; white-space: nowrap;
}
.inventory-toolbar {
  display: flex; flex-direction: column; gap: 0.65rem;
  padding: 0.5rem 1rem 0.75rem;
}
.inventory-search-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 0.75rem;
}
.inventory-search-wrap svg { flex-shrink: 0; stroke: var(--text-muted); }
.inventory-search {
  flex: 1; border: none; background: transparent; color: var(--text);
  font: inherit; padding: 0.7rem 0; outline: none; min-width: 0;
}
.inventory-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.inv-chip {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
  border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit; min-height: 36px;
}
.inv-chip.active { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.inv-chip:not(.active):hover { background: var(--bg-hover); }
.inventory-list { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.inv-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.85rem 1rem; cursor: pointer; transition: border-color 0.15s, background 0.15s, box-shadow 0.2s;
}
.inv-card:hover { border-color: var(--primary); background: var(--bg-hover); }
.inv-card-low {
  border-color: var(--warning);
  background: var(--warning-bg);
  box-shadow: inset 3px 0 0 var(--danger);
}
.inv-card-flash { animation: invFlash 1.1s ease-in-out 2; }
@keyframes invFlash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px var(--primary); border-color: var(--primary); }
}
.inv-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.inv-card-title { font-weight: 650; font-size: 1.02rem; line-height: 1.3; min-width: 0; overflow-wrap: break-word; }
.badge-inv-low { background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.inv-card-desc { margin-top: 0.25rem; font-size: 0.85rem; color: var(--text-secondary); }
.inv-card-cat { margin-top: 0.4rem; }
.inv-cat-chip {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.01em;
  background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border);
}
.inv-cat-chip-empty { font-weight: 500; font-style: italic; color: var(--text-secondary); }   /* was 60% opacity: 2.4:1 */
.inv-card-stats {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.1rem; margin-top: 0.65rem;
  font-size: 0.85rem; color: var(--text-secondary);
}
.inv-card-stats small { color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; font-size: 0.68rem; }
.inv-qty strong { font-size: 1.15rem; color: var(--text); }
.inv-qty-low strong { color: var(--danger); }
.inv-card-meta {
  margin-top: 0.7rem; font-size: 0.75rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between; gap: 0.85rem;
}
.inv-card-meta > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inventory-empty .btn-primary, .inventory-empty .btn-create { margin-top: 0.85rem; }
.inv-qty-row { display: flex; align-items: center; gap: 0.5rem; }
.inv-qty-row input[type="number"] { flex: 1; text-align: center; font-weight: 600; }
.inv-stepper {
  width: 44px; min-width: 44px; padding: 0; font-size: 1.25rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.dropdown-item-active { color: var(--primary); font-weight: 650; }
/* msg-chrome visible-viewport lock */
html.msg-page,
html#msgHtml {
  height: var(--app-height, 100dvh) !important;
  max-height: var(--app-height, 100dvh) !important;
  overflow: hidden !important;
}
body.msg-page {
  height: var(--app-height, 100dvh) !important;
  max-height: var(--app-height, 100dvh) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}
body.msg-page .msg-layout {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  max-height: none !important;
}
body.msg-page .channels-bar,
body.msg-page .bottom-nav,
body.msg-page .msg-input-bar {
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
}
/* Mobile: never hide Channels / bottom-nav (desktop exception follows) */
body.msg-page .channels-bar {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
}
body.msg-page .bottom-nav {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  max-width: none !important;
  width: 100% !important;
}
.msg-job-attach-btn { display: inline-flex; align-items: center; gap: 0.35rem; }
.msg-job-attach-icon { flex-shrink: 0; width: 16px; height: 16px; }

.msg-inv-link {
  color: var(--primary);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.msg-inv-link:active { opacity: 0.85; }


/* toolbar-quad foursquare */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1rem 0.5rem;
}
.toolbar .worklist-dropdown {
  width: 100%;
  flex: none;
  justify-content: stretch;
  position: relative;
}
.toolbar .worklist-btn {
  width: 100%;
  justify-content: center;
  border-radius: var(--radius-sm);
  min-height: 44px;
}
.toolbar .worklist-menu {
  left: 0;
  right: 0;
  transform: none;
  width: 100%;
  max-width: none;
}
/* New Job now occupies the former top work-list slot (full width). */
.toolbar > #newJobBtnPortrait {
  width: 100%;
  justify-content: center;
}
.toolbar-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0.5rem;
  width: 100%;
  align-items: stretch;
}
.toolbar-quad .filters-dropdown {
  width: 100%;
  min-width: 0;
  display: flex;
}
.toolbar-quad .dept-toggle {
  display: contents;
}
.toolbar-quad-btn,
.toolbar-quad #newJobBtnPortrait,
.toolbar-quad .filters-btn,
.toolbar-quad .dept-toggle button,
#deptToggle button.toolbar-quad-btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
  font-weight: 650;
}
#newJobBtnPortrait {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
}
.toolbar-quad .filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: none;
}
.toolbar-quad .filters-btn #filtersLabel,
.toolbar-quad .filters-btn #deptPickerLabel,
.toolbar-quad .filters-btn #areaPickerLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
#deptToggle button.toolbar-quad-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#deptToggle button.toolbar-quad-btn.active {
  background: var(--primary);
  color: var(--on-accent);
  border-color: var(--primary);
}
/* Dept + Area pickers: two cells side by side; label truncates to fit the cell. */
.toolbar-quad .dept-picker,
.toolbar-quad .area-picker {
  min-width: 0;
}
.toolbar-quad .dept-picker .filters-btn,
.toolbar-quad .area-picker .filters-btn {
  justify-content: space-between;
}
.toolbar-quad .dept-picker .filters-btn > span,
.toolbar-quad .area-picker .filters-btn > span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.toolbar-quad .dept-picker .filters-menu,
.toolbar-quad .area-picker .filters-menu {
  min-width: 100%;
}
.newjob-inset-bar { display: none !important; }
.meta-claimed {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Recurring job cards in All Jobs carry the same labelled rail as the Recurring page. */
.job-card.job-recurring {
  padding-right: 7.85rem;
}
.badge-recurring {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(230, 126, 34, 0.18);
  color: var(--recurring);
  text-transform: uppercase;
}
.meta-claimed { font-weight: 650; color: var(--text); }

/* =====================================================================
   ===== PC =====
   Desktop / wide+tall layout. Canonical condition: (min-width: 900px) and (min-height: 600px).
   Everything here previously existed as 8 separate duplicate/near-duplicate declarations of
   this same query scattered through the file; consolidated into one block, source order preserved.
   ===================================================================== */
@media (min-width: 900px) and (min-height: 600px) {
  /* Required override: an unconditional shared rule later in the file forces
     body.msg-page .bottom-nav to display:flex !important (mobile default). This PC-scoped
     !important re-hides it on desktop; same specificity, so source order (PC bucket comes
     after shared) decides the tie. */
  body.msg-page .bottom-nav {
    display: none !important;
  }

  /* was bare (min-width:600px) with no height guard -- landscape phones no longer inherit this */
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

  /* was bare (min-width:600px) 720px tier -- superseded, main-content is single-sourced at 960 below */
  .modal { border-radius: var(--radius); margin-bottom: auto; }
  .modal-overlay { align-items: center; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  /* Desktop: left channel sidebar + thread/compose column (channelList is last in DOM) */
  body.msg-page {
    display: block;
    height: auto;
    overflow: auto;
  }
  body.msg-page .msg-layout {
    flex: none;
  }
  .channels-bar { display: none !important; }
  /* channel-picker visible -- Channels button used on desktop too */

  .msg-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr auto;
    height: calc(100vh - 52px);
    height: calc(100dvh - 52px);
    min-height: calc(100vh - 52px);
    min-height: calc(100dvh - 52px);
    overflow: hidden;
  }
  .channel-list {
    display: flex !important;
    grid-column: 1;
    grid-row: 1 / -1;
    flex-direction: column;
    width: 240px;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: none;
    border-right: 1px solid var(--border);
    box-shadow: none;
  }
  .channel-btn {
    flex: 0 0 auto;
    width: auto;
    border-bottom: none;
    border-right: 2px solid transparent;
    white-space: normal;
    word-break: break-word;
    justify-content: flex-start;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    overflow: visible;
  }
  .channel-btn.active { border-bottom: none; border-right-color: var(--primary); }
  .channel-unread-badge {
    position: static;
    margin-left: auto;
  }
  .msg-thread {
    grid-column: 2;
    grid-row: 1;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 0.5rem;
  }
  .msg-input-bar {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;
    z-index: auto;
  }
  body.msg-page .msg-layout {
    padding-bottom: 0;
  }

  /* main-content: single source of truth, PC only (720px tablet tier removed) */
  .main-content { max-width: 960px; margin: 0 auto; }
  .detail-header, .section { max-width: 960px; margin: 0 auto; }

  /* Hide bottom nav on desktop */
  .bottom-nav { display: none; }
  .has-bottom-nav { padding-bottom: 0; }
  /* No bottom nav here, so sheets may use the full viewport height */
  .modal-overlay { bottom: 0; }

  /* Topbar nav for desktop */
  .topbar-nav { display: flex; align-items: center; gap: 0.25rem; margin-left: 1rem; }
  .topbar-nav-link {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.4rem 0.75rem; font-size: 0.85rem; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .topbar-nav-link svg { width: 18px; height: 18px; }
  .topbar-nav-link:hover { background: var(--bg-hover); color: var(--text); }
  .topbar-nav-link.active { color: var(--primary); }

  /* Wider cards on desktop */
  .job-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.75rem 1.1rem;
  }
  .job-card-location {
    font-size: 0.95rem; font-weight: 600; color: var(--text-secondary);
    min-width: 0;
  }
  .job-card-location svg { width: 16px; height: 16px; stroke: var(--text-secondary); }
  .job-card-title { font-size: 1.05rem; width: 100%; flex: 0 0 auto; }
  .job-card-badges { align-self: flex-start; }
  .job-card-meta { width: 100%; margin-left: 0; }
  .job-card-meta .meta-item svg { width: 14px; height: 14px; }
  .meta-time { font-size: 0.85rem; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 0rem; }

  /* Wide desktop: full-width messages column (not a skinny center rail) -- bottom-nav:none already set above */
  body.msg-page .msg-layout,
  body.msg-page .msg-input-bar,
  body.msg-page .channels-bar {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }
  body.msg-page .msg-layout {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body.msg-page .msg-thread {
    max-width: none !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
  body.msg-page .msg-input-bar,
  body.msg-page .channels-bar {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  /* was bare (min-width:600px) -- landscape phones (844x390) inherited this row layout; now PC-only */
  .inventory-toolbar { flex-direction: row; align-items: center; }
  .inventory-search-wrap { flex: 1; }

  .toolbar-quad {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
  .toolbar .worklist-dropdown {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
  /* Hero New Job pill keeps the old top-pill width cap */
  .toolbar > #newJobBtnPortrait {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Channels cell hugs its label ("Channels · <Department>") instead of stretching across the screen. */
  /* ---- Desktop messages: centered single column; Channels pill folded into the composer row ----
     (the left channel-list is hidden on desktop, so the old 240px grid column was dead space
      that pushed own bubbles to the far-right edge) */
  body.msg-page .msg-layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr auto !important;
    max-width: none !important;
    width: 100% !important;
    height: calc(100dvh - 52px) !important;
    min-height: 0 !important;
  }
  body.msg-page .msg-thread {
    grid-column: 1 !important;
    grid-row: 1 !important;
    max-width: 860px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 1.25rem 0.75rem !important;
  }
  body.msg-page .msg-input-bar:not(.hidden) {
    grid-column: 1 !important;
    grid-row: 2 !important;
    max-width: 860px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    border-top: none !important;
    /* Grid (not flex) so the Channels pill and the message input get identical track widths.
       Flex distributes equal content-box sizes, which left the input ~24px wider (its padding+border). */
    display: grid !important;
    grid-template-columns: 1fr 1fr auto auto;
    align-items: center;
    column-gap: 0.35rem;
  }
  body.msg-page #msgInput { width: 100% !important; min-width: 0 !important; }
  body.msg-page .msg-job-attach-wrap { width: auto !important; }
  /* Channels pill: first item in the composer row; border-only + dept-tinted, no grey slab */
  body.msg-page .channels-bar {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    background: transparent !important;
    border-top: none !important;
  }
  body.msg-page .channels-btn {
    width: 100% !important;
    max-width: 100% !important;
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
    border-radius: 20px !important;
    padding: 0.5rem 0.7rem !important;
    min-height: 40px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
  }
  body.msg-page .channels-btn:hover { border-color: var(--dept-color, var(--primary)) !important; }
  body.msg-page .channels-btn-label { color: inherit !important; }
  body.msg-page .channels-btn-chevron { color: var(--text-muted) !important; opacity: 1; }
}


/* =====================================================================
   ===== PORTRAIT =====
   Mobile portrait phones. Canonical condition: (max-width: 600px) and (orientation: portrait).
   ===================================================================== */
@media (max-width: 600px) and (orientation: portrait) {
  #newJobBtnPortrait {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.65rem;
    font-size: 0.88rem;
    min-height: 44px;
    flex-shrink: 0;
  }

  .worklist-btn { width: 100%; justify-content: center; }
  .worklist-menu {
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
  }

  .filters-menu {
    right: 0;
    left: auto;
  }
}


/* =====================================================================
   ===== LANDSCAPE =====
   Mobile / short-viewport landscape (incl. wide-but-short windows, e.g. 1200x500).
   Canonical condition: (orientation: landscape) and (max-height: 600px) -- one catch, not six.
   Previously spread across 6 different unrelated queries (some width-only, so they missed
   wide-short windows; some max-width:600 only, so they missed wide phones held sideways).
   ===================================================================== */
@media (orientation: landscape) and (max-height: 600px) {
  .photo-upload-area label, .photo-upload-area .photo-btn { min-height: 44px; padding: 0.55rem 0.6rem; font-size: 0.85rem; }
  .photo-preview-item { width: 56px; height: 56px; }

  .channel-picker-overlay {
    align-items: center;
    padding: 0.5rem;
  }
  .channel-picker-sheet {
    max-height: min(88dvh, 88vh);
    max-width: min(420px, 92vw);
    border-radius: 14px;
    animation: none;
  }
  body.msg-page .channels-bar { padding: 0.25rem 0.6rem; }
  body.msg-page .channels-btn { min-height: 40px; padding: 0.35rem 0.65rem; font-size: 0.85rem; }

  .topbar { min-height: 48px; }
  .bottom-nav { min-height: 48px; height: auto; }
  .main-content { padding-bottom: 60px; }
  .btn-sm, .canned-btn { min-height: 40px; } /* .tab removed: dead selector, matched 0 elements */

  body.msg-page.msg-composing .channels-bar {
    display: none !important;   /* the bottom nav stays (MB-16) */
  }

  @media (max-height: 420px) {
    body.msg-page.msg-composing .topbar { display: none !important; }
  }
}


/* =====================================================================
   ===== shared =====
   Non-PC default chrome: applies whenever PC's condition is false (these two conditions are
   exact complements -- max-width:899/max-height:599 vs min-width:900/min-height:600 -- so
   every viewport matches exactly one side, order between them is inconsequential).
   ===================================================================== */
/* Mobile / short viewports (non-PC default): hide letter-chip sidebar; show Channels button.
   Also hides topbar-nav. Include max-height so landscape phones (>900px wide, short height)
   stay on mobile chrome. PC bucket below re-shows these on desktop. */
@media (max-width: 899px), (max-height: 599px) {
  .channel-list { display: none !important; }
  .channels-bar { display: block; }
  .topbar-nav { display: none; }

  /* Fixed Channels bar just above fixed bottom-nav */
  body.msg-page .channels-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--msg-nav-h);
    z-index: 140;
    width: 100%;
    box-sizing: border-box;
  }

  /* Stack: compose (fixed) above Channels (fixed) above bottom-nav (fixed) */
  body.msg-page {
    --msg-nav-h: calc(48px + env(safe-area-inset-bottom, 0px) + var(--vv-bottom-offset, 0px));
    --msg-channels-h: 58px;
    --msg-compose-h: 64px;
  }
  body.msg-page .channels-bar {
    bottom: var(--msg-nav-h);
    min-height: var(--msg-channels-h);
  }
  body.msg-page .msg-input-bar:not(.hidden) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--msg-nav-h) + var(--msg-channels-h));
    z-index: 145;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
  }
  /* The Channels pill folds into the composer row on DESKTOP only; on mobile it keeps its own
     full-width row above the input (same stacking as before). */
  body.msg-page .msg-input-bar { flex-wrap: wrap; }
  body.msg-page .channels-bar { flex: 1 1 100% !important; width: auto !important; }
  /* Clearance on the scrolling thread so last bubble sits above fixed compose/channels/nav */
  body.msg-page .msg-layout {
    padding-bottom: 0;
  }
  body.msg-page .msg-thread {
    padding-bottom: 0;
  }
}

/* ── Messages: composer can start hidden (no channel yet) — keep the channel control reachable.
   The Channels pill now lives inside the composer, so a plain display:none would hide it too. ── */
body.msg-page #msgInputBar.hidden { display: flex !important; }
body.msg-page #msgInputBar.hidden > *:not(.channels-bar) { visibility: hidden; }
body.msg-page #msgInputBar.hidden > .channels-bar { visibility: visible; }

/* ─═ Creation buttons (New Job / New Recurring Job): ticket-stub shape ─═
   Deliberately NOT the generic "+ pill" that every app ships. The asymmetric corner +
   left stripe echo the department stripe on the card the button creates. ─═ */
.btn-create {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  position: relative;
  overflow: hidden;
  padding: 0.6rem 1rem 0.6rem 1.2rem;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 650;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s, border-color 0.15s, transform 0.1s;
}
.btn-create::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--create-accent, var(--primary));
  border-radius: 16px 0 0 4px;
}
.btn-create > svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-create:hover { filter: brightness(1.08); }
.btn-create:active { transform: translateY(1px); }

/* New Job: the theme's primary colour for everyone (2026-12-02; it used to borrow the user's
   department colour, which made it purple for Management). */
.btn-create.dept, .btn-create.newjob-hero {
  --create-accent: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);   /* a solid edge: >= 3:1 against the page in every theme (2026-12-02) */
}

/* New Recurring Job: recurring accent box (no stripe) */
.btn-create.recurring {
  background: var(--primary-light);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
}
.btn-create.recurring::before { display: none; }

/* New item (inventory): same ticket-stub family as New Job. Inventory has no
   department, so it takes the primary-blue tint (the New Recurring Job treatment). */
.btn-create.inv-hero {
  --create-accent: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
}

/* The dashboard toolbar chip rules are more specific - restate the shape there */
.toolbar-quad #newJobBtnPortrait.btn-create {
  border-radius: 16px 16px 16px 4px;
  padding: 0.6rem 0.9rem 0.6rem 1.15rem;
  font-size: 0.9rem;
}

/* ══ Job search (messages top bar, right side) ══ */
.job-search { position: relative; display: flex; align-items: center; }
.job-search-input {
  width: 220px;
  padding: 0.35rem 0.8rem;
  font-family: inherit; font-size: 0.85rem; line-height: 26px;
  color: var(--text); background: var(--bg-input);
  border: 1px solid var(--border); border-radius: 999px;
  outline: none; min-height: 38px; box-sizing: border-box;
  white-space: nowrap; overflow: hidden; cursor: text;
}
.job-search-input:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }
.job-search-input:focus { border-color: var(--border-focus); }
.job-search-toggle { display: none; }
.job-search-toggle .ic-close { display: none; }
.job-search.open .job-search-toggle .ic-search { display: none; }
.job-search.open .job-search-toggle .ic-close { display: block; }

.job-search-results {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 210;
  width: min(430px, 92vw); max-height: 62vh; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 0.35rem;
}
.job-search-results.hidden { display: none; }
.job-search-row {
  display: block; width: 100%; text-align: left; font-family: inherit;
  background: transparent; border: none; border-radius: var(--radius-sm);
  padding: 0.55rem 0.6rem; cursor: pointer;
}
.job-search-row:hover, .job-search-row:focus { background: var(--bg-hover); }
.job-search-row-top { display: flex; align-items: center; gap: 0.45rem; justify-content: space-between; }
.job-search-title { font-size: 0.9rem; font-weight: 600; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-search-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.35rem; font-size: 0.72rem; color: var(--text-secondary); }
.job-search-sub { color: var(--text-muted); }
.badge-oneoff { background: var(--bg-hover); color: var(--text-secondary); }
.job-search-empty, .job-search-count { padding: 0.5rem 0.6rem; font-size: 0.78rem; color: var(--text-muted); }
.job-search-count { border-top: 1px solid var(--border); }
.job-search-group { padding: 0.45rem 0.6rem 0.2rem; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.job-filter-row { background: var(--bg-hover); }
.job-filter-tag { display: inline-flex; align-items: center; justify-content: center; font-size: 0.62rem; font-weight: 700; line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary); border: 1px solid var(--border); border-radius: 999px; padding: 0.05rem 0.4rem; flex: 0 0 auto; }

/* Active global filter chip (top bar) */
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.5rem;
  padding: 0.3rem 0.55rem; border-radius: 999px; border: 1px solid var(--primary);
  background: var(--bg-card); color: var(--primary); cursor: pointer;
  font-family: inherit; font-size: 0.78rem; font-weight: 650; -webkit-tap-highlight-color: transparent;
}
.filter-chip:hover { background: var(--bg-hover); }
.filter-chip-word { color: var(--text-muted); font-weight: 600; }
.filter-chip-x { font-size: 1rem; line-height: 1; }
@media (max-width: 899px), (max-height: 599px) {
  .filter-chip-word { display: none; }
  .filter-chip { margin-left: 0.35rem; }
}

/* Sits immediately right of the Messages nav link */
.topbar-nav .job-search { margin-left: 0.5rem; }

/* Narrow desktops: keep the field from crowding the bar */
@media (max-width: 1100px) and (min-height: 600px) {
  .job-search-input { width: 160px; }
}

/* Mobile / short: the nav is normally hidden — keep the search in it, pushed right */
@media (max-width: 899px), (max-height: 599px) {
  .topbar-nav { display: flex !important; margin-left: auto; gap: 0; }
  .topbar-nav > .topbar-nav-link { display: none !important; }
  .topbar-nav .job-search { margin-left: 0; }
  .job-search-toggle { display: inline-flex; align-items: center; }
  .job-search-input { display: none; }
  .job-search.open { flex: 1 1 auto; }
  .job-search.open .job-search-input { display: block; width: 100%; }
  .topbar.search-open .logo-dropdown,
  .topbar.search-open .topbar-right { display: none !important; }
  .topbar.search-open .topbar-nav { flex: 1 1 auto; margin-left: 0; }
  .job-search.open .job-search-results { left: 0; right: 0; width: auto; }
}

/* ══ Location margin panel on job cards: wing + floor/room ══
   Content is wrapped in .job-card-body so a paneled card can lay out as a row. */
.job-card-body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.job-card.has-loc { flex-direction: row; align-items: stretch; gap: 0.7rem; }
.job-card.has-loc .job-card-body { flex: 1 1 auto; }

.job-loc-panel {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 0.35rem;
  padding-right: 0.7rem;
  border-right: 1px solid var(--border);
  min-width: 116px; max-width: 46%;
}
.job-loc-lines { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.job-loc-wing {
  display: inline-flex; align-items: center; gap: 0.28rem;
  font-size: 0.82rem; font-weight: 700; color: var(--text); line-height: 1.2;
}
.job-loc-wing .wing-svg { width: 14px; height: 14px; flex-shrink: 0; }
.job-loc-line { font-size: 0.74rem; line-height: 1.25; color: var(--text-secondary); }
.job-loc-glyph { margin-left: auto; display: inline-flex; align-items: center; color: var(--text-secondary); }   /* pin: >= 3:1 (was muted at 60% opacity) */
.job-loc-glyph svg { width: 17px; height: 17px; }

@media (max-width: 600px) {
  .job-loc-panel { min-width: 84px; max-width: 42%; padding-right: 0.5rem; gap: 0.2rem; }
  .job-loc-glyph { display: none; }
  .job-loc-wing { font-size: 0.76rem; }
  .job-loc-line { font-size: 0.7rem; }
  .recur-rail { width: 84px; padding: 0 0.35rem; font-size: 0.66rem; }
  .recur-card, .job-card.job-recurring { padding-right: 5.75rem; }
}

/* ── Small job/recurring code (J-0001 / R-0001) — tucked away, searchable ── */
.job-code {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── @mentions ── */
.mention {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-hover);   /* darker in light themes, lighter in dark: >= 4.5 on the tinted bubble */
  border-radius: 6px;
  padding: 0 0.2em;
  font-weight: 650;
}
.msg-bubble.own .mention { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary-hover); }
.mention-dd {
  position: fixed;
  z-index: 300;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0.25rem;
}
.mention-dd-item {
  display: flex; align-items: center;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: none; background: transparent; color: var(--text);
  font: inherit; font-size: 0.85rem; text-align: left;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
}
.mention-dd-item.active, .mention-dd-item:hover { background: var(--bg-hover); }

/* ── Recurring detail view: static rows ── */
.recur-detail-rows { display: flex; flex-direction: column; gap: 0.35rem; }
.recur-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; font-size: 0.9rem; }
.recur-detail-label { color: var(--text-secondary); flex-shrink: 0; }
.recur-detail-value { text-align: right; min-width: 0; overflow-wrap: break-word; }
.recur-detail-loc { margin-top: 0.5rem; }
.recur-detail-loc .job-loc-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.45rem 0.7rem; }

/* Admin queue: auto-created assets flagged for review stand out from staff suggestions */
.badge-review {
  background: rgba(230, 126, 34, 0.18);
  color: var(--recurring);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
  font-size: 0.68rem;
}
.badge-accepted {
  background: var(--low-bg);
  color: var(--low);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
  font-size: 0.68rem;
}
.badge-rejected {
  background: var(--danger-bg);
  color: var(--danger);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 700;
  font-size: 0.68rem;
}

/* Job detail: parent asset (wing) shown ABOVE the child asset (location name) */
.detail-loc { display: inline-flex; flex-direction: column; gap: 0.1rem; align-items: flex-start; }
.detail-loc-parent { display: inline-flex; align-items: center; gap: 0.28rem; font-weight: 700; color: var(--text); }
.detail-loc-parent .wing-svg { width: 13px; height: 13px; flex-shrink: 0; }
.detail-loc-child { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--text-secondary); }
.detail-loc-child svg { width: 13px; height: 13px; flex-shrink: 0; stroke: var(--text-muted); }

/* ── Composer: Send + clip sit side by side (clip right of Send) and match size ── */
.msg-input-bar .msg-send-btn,
.msg-input-bar .msg-job-attach-btn {
  width: 88px !important;
  min-width: 88px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 20px !important;
  font-size: 0.85rem !important;
}
.msg-input-bar .msg-job-attach-wrap { max-width: none !important; }
/* The clip is now the right-most control, so open its menu inward (not past the right edge). */
.msg-input-bar .msg-attach-menu { left: auto !important; right: 0 !important; }

/* ── Notifications: toast stack + enable prompt ── */
.nt-wrap {
  position: fixed; top: 0.8rem; right: 0.8rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 600; max-width: min(360px, 92vw);
  pointer-events: none;
}
.nt-toast {
  pointer-events: auto; cursor: pointer;
  display: flex; align-items: flex-start; gap: 0.6rem;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.7rem 0.85rem;
  opacity: 0; transform: translateX(12px); transition: opacity 0.2s, transform 0.2s;
}
.nt-toast.show { opacity: 1; transform: translateX(0); }
.nt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: 0 0 auto; }
.nt-text { min-width: 0; }
.nt-title { font-weight: 700; font-size: 0.9rem; line-height: 1.25; }
.nt-body { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; word-break: break-word; }
.nt-toast.nt-low_stock { border-left-color: var(--warning); }
.nt-toast.nt-low_stock .nt-dot { background: var(--warning); }
.nt-toast.nt-new_job { border-left-color: var(--success); }
.nt-toast.nt-new_job .nt-dot { background: var(--success); }

.push-prompt {
  position: fixed; left: 0.8rem; right: 0.8rem; bottom: 0.9rem;
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 0.6rem 0.75rem;
  z-index: 610; max-width: min(520px, 94vw); margin: 0 auto;
}
.push-prompt-text { flex: 1 1 auto; font-size: 0.85rem; font-weight: 600; }
.push-prompt-btn { flex: 0 0 auto; padding: 0.4rem 0.9rem; min-height: 36px; }
.push-prompt-x {
  flex: 0 0 auto; border: none; background: none; color: var(--text-muted);
  font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 0.2rem;
}

@media (max-width: 480px) {
  .nt-wrap { top: 0.5rem; right: 0.5rem; left: 0.5rem; max-width: none; }
}

/* Inline text link button (Forgot password?, Back to sign in) */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary, #2563eb);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Inventory item thumbnail on the list card */
.inv-card-photo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--border);
}

/* Inventory: grouping, restock shortfall, quick +/- and history */
.inv-group-btn {
  min-height: 36px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, #fff);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.inv-group-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-tint, rgba(37, 99, 235, 0.08));
}
.inv-group-head {
  margin: 0.75rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.inv-group-count {
  font-weight: 400;
  color: var(--text-muted);
}
.inv-order {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--danger, #dc2626);
}
.inv-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  margin-left: auto;
}
.inv-step {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, #fff);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.inv-step:active { background: var(--bg-hover); }
/* "Saved" confirmation inside the item dialog — the dialog stays open. */
.inv-saved {
  /* Floating confirmation: pinned to the viewport so the green tick is seen
     wherever the item dialog is scrolled, and it stays put if the dialog closes. */
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 320;
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--success, #16a34a);
  color: #fff;
  font-size: 0.92rem; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: invSavedPop 0.2s ease-out;
}
@keyframes invSavedPop {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.inv-saved.hidden { display: none; }
.inv-history { display: flex; flex-direction: column; gap: 0.3rem; max-height: 220px; overflow-y: auto; }
.inv-history-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.inv-history-meta { color: var(--text-muted); white-space: nowrap; }

/* PWA install hint (login page, phones only - shown by app.js) */
.install-hint {
  width: 100%; max-width: 360px;
  margin-top: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0.9rem 1rem;
  text-align: center;
}
.install-hint-title { font-weight: 600; margin-bottom: 0.35rem; }
.install-hint-steps { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.7rem; }
.install-hint .install-hint-btn { min-height: 40px; }

/* ── Inventory filters (panel + watch stars) ── */
.inventory-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.inv-filter-btn,
.inv-low-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
  border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.82rem; font-weight: 600;
  font-family: inherit; cursor: pointer; min-height: 36px;
}
.inv-filter-btn svg { stroke: currentColor; flex: 0 0 auto; }
.inv-filter-btn:hover, .inv-low-pill:hover { background: var(--bg-hover); }
.inv-filter-btn.has-filters {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-tint, rgba(37, 99, 235, 0.08));
}
.inv-filter-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--primary-fill); color: var(--on-primary); font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.inv-low-pill {
  color: var(--danger, #dc2626);
  border-color: var(--danger-bg, #fee2e2);
  background: var(--danger-bg, #fee2e2);
}
.inv-low-pill.active { border-color: var(--danger, #dc2626); box-shadow: inset 0 0 0 1px var(--danger, #dc2626); }
.inv-low-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #dc2626); flex: 0 0 auto; }

.inv-watch {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 1.15rem; line-height: 1; padding: 0.1rem 0.25rem; flex: 0 0 auto;
  color: var(--text-muted); border-radius: 8px;
}
.inv-watch:hover { color: var(--warning); background: var(--bg-hover); }
.inv-watch.on { color: var(--warning); }
.inv-card-watched { box-shadow: inset 3px 0 0 var(--warning); }
.inv-card-low.inv-card-watched { box-shadow: inset 3px 0 0 var(--danger, #dc2626), inset 6px 0 0 #d97706; }
.inv-watched-chip { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 50%, transparent); }

.inv-filter-modal { max-width: 460px; }
.inv-filter-section { padding: 0.35rem 0 0.6rem; border-bottom: 1px solid var(--border); }
.inv-filter-section:last-of-type { border-bottom: none; }
.inv-filter-head {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary); margin: 0.3rem 0 0.35rem;
}
.inv-filter-opt {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.42rem 0; font-size: 0.92rem; cursor: pointer; color: var(--text);
}
.inv-filter-opt input { width: 18px; height: 18px; accent-color: var(--primary); flex: 0 0 auto; }
.inv-filter-opt-count { margin-left: auto; color: var(--text-muted); font-size: 0.82rem; }
.inv-filter-cats { display: flex; flex-direction: column; max-height: 38vh; overflow-y: auto; }
.inv-filter-cat span:first-of-type { min-width: 0; overflow-wrap: break-word; }
.inv-check-row { display: flex; align-items: flex-start; gap: 0.55rem; cursor: pointer; }
.inv-check-row input { width: 18px; height: 18px; accent-color: var(--primary); margin-top: 2px; flex: 0 0 auto; }
.inv-check-row .hint-text { display: block; margin-top: 0.1rem; }

/* Inventory: unsaved-changes prompt */
.unsaved-list {
  display: flex; flex-direction: column; gap: 0.35rem;
  max-height: 40vh; overflow-y: auto; margin-top: 0.4rem;
}
.unsaved-row {
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-hover);
}
.unsaved-label { font-weight: 650; font-size: 0.86rem; color: var(--text-secondary); }
.unsaved-from { color: var(--text-muted); text-decoration: line-through; }
.unsaved-arrow { color: var(--text-muted); }
.unsaved-to { font-weight: 650; color: var(--primary); }
.unsaved-note { color: var(--text-secondary); font-size: 0.86rem; }

/* Inventory: view switch (Category / A-Z) */
.inv-view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elevated, #fff);
}
.inv-view-opt {
  min-height: 36px;
  padding: 0 0.7rem;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.inv-view-opt + .inv-view-opt { border-left: 1px solid var(--border); }
.inv-view-opt.active {
  color: var(--primary);
  background: var(--primary-tint, rgba(37, 99, 235, 0.08));
  font-weight: 600;
}

/* ══ Phones (360-390px): nothing may push the page sideways; long names get an ellipsis ══ */
.topbar { gap: 0.5rem; min-width: 0; }
.logo-dropdown { flex: 0 1 auto; min-width: 0; }
.logo-btn { max-width: 100%; min-width: 0; }
.logo-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right, .topbar-nav { flex-shrink: 0; }
@media (max-width: 899px), (max-height: 599px) {
  .logo-btn > span { max-width: none; }
  .topbar-right { gap: 0.25rem; }
  #userMenuBtn { max-width: 30vw; min-width: 0; }
  #userMenuBtn > svg { flex-shrink: 0; }
  #userMenuBtn > span { display: inline-block; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* comfortable tap targets for the chips people press */
  .lp-chip, .filter-chip, .chip { min-height: 40px; }
}
.user-email { font-size: 0.78rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.user-email-missing { color: var(--warning); font-weight: 600; }
.user-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* Custom departments: a stable, readable colour pair per name (hash -> palette). AA in light and dark. */
:root, [data-theme="light"] {
  --dc-0: #0f766e; --dc-0-bg: #f0fdfa;
  --dc-1: #be185d; --dc-1-bg: #fdf2f8;
  --dc-2: #4338ca; --dc-2-bg: #eef2ff;
  --dc-3: #0e7490; --dc-3-bg: #ecfeff;
  --dc-4: #4d7c0f; --dc-4-bg: #f7fee7;
  --dc-5: #be123c; --dc-5-bg: #fff1f2;
  --dc-6: #0369a1; --dc-6-bg: #f0f9ff;
  --dc-7: #a21caf; --dc-7-bg: #fdf4ff;
  --dc-8: #92400e; --dc-8-bg: #fffbeb;
  --dc-9: #047857; --dc-9-bg: #ecfdf5;
  --dc-10: #6d28d9; --dc-10-bg: #f5f3ff;
  --dc-11: #334155; --dc-11-bg: #f1f5f9;
}
[data-theme="dark"] {
  --dc-0: #5eead4; --dc-0-bg: #134e4a;
  --dc-1: #f9a8d4; --dc-1-bg: #500724;
  --dc-2: #a5b4fc; --dc-2-bg: #1e1b4b;
  --dc-3: #67e8f9; --dc-3-bg: #164e63;
  --dc-4: #bef264; --dc-4-bg: #1a2e05;
  --dc-5: #fda4af; --dc-5-bg: #4c0519;
  --dc-6: #7dd3fc; --dc-6-bg: #0c4a6e;
  --dc-7: #f0abfc; --dc-7-bg: #4a044e;
  --dc-8: #fcd34d; --dc-8-bg: #451a03;
  --dc-9: #6ee7b7; --dc-9-bg: #064e3b;
  --dc-10: #c4b5fd; --dc-10-bg: #2e1065;
  --dc-11: #cbd5e1; --dc-11-bg: #1e293b;
}

/* Readable grey text (AA >= 4.5:1): darker greys in light mode, lighter in dark mode (vars above). */
[data-theme="dark"] .inv-view-opt.active { color: #ffffff; }
/* ── QA fixes 2026-12-01 ── */
/* Long unbroken words / URLs must wrap instead of widening the page. */
.detail-title, .detail-notes, .comment-body, .comment-text, .comment, .job-title, .job-card,
.msg-bubble, .msg-body, .msg-text, .suggest-body, .inv-card, .inv-name, .inv-desc, .inv-meta,
.history-detail, .history-item, .job-search-sub, .modal-content p, .empty-state,
.inv-card-title, .detail-loc-child, .suggest-meta, .recurring-card, .rec-title {
  overflow-wrap: anywhere;
  word-break: normal;
  min-width: 0;
}
/* Inventory Category / A–Z switch: readable in dark mode (it had a white pill). */
.inv-view-switch { background: var(--bg-card); }
[data-theme="dark"] .inv-view-opt { color: var(--text-secondary); }
[data-theme="dark"] .inv-view-opt.active { color: #ffffff; background: var(--primary-light); box-shadow: inset 0 0 0 1px var(--primary); }
/* "My jobs" quick chip (techs) */
.quick-chips { display: flex; gap: 0.5rem; margin: 0 0 0.6rem; flex-wrap: wrap; }
.quick-chips.hidden { display: none; }
.chip-toggle {
  min-height: 36px; padding: 0 0.9rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer;
}
.chip-toggle.active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); font-weight: 600; }
/* Buttons locked while their request is in flight */
button[aria-busy="true"] { opacity: 0.6; cursor: progress; }
/* Manage: inline email editor + missing-email count */
.manage-noemail-count { padding: 0.45rem 0.6rem; margin-bottom: 0.5rem; border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--text); font-size: 0.88rem; }
.inline-email { display: flex; gap: 0.4rem; width: 100%; margin-top: 0.45rem; flex-wrap: wrap; }

/* Role management (Manage users): a small role dropdown with an inline confirm. */
.role-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.role-select { min-height: 40px; max-width: 9.5rem; padding: 0 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); font-size: 0.85rem; }
.role-select:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }
.role-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text); }
.role-msg { flex-basis: 100%; font-size: 0.8rem; }
.role-msg.ok { color: var(--low); }
.role-msg.err { color: var(--danger); }
.inline-email input { flex: 1 1 12rem; min-width: 0; min-height: 36px; padding: 0 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text); font: inherit; }
/* Job page: friendly "Job not found" */
.jnf-hidden { display: none !important; }
.job-not-found { text-align: center; padding: 3rem 1rem; }
.job-not-found h2 { margin: 0 0 0.5rem; color: var(--text); }
.job-not-found p { color: var(--text-secondary); margin: 0 0 1.25rem; }
.job-not-found .btn-primary { display: inline-block; text-decoration: none; padding: 0.6rem 1.2rem; }
#jobError.draft-note { color: var(--text-secondary); background: var(--primary-light); }
/* Light-mode text that sat just under 4.5:1 */
html:not([data-theme="dark"]) .btn-create.inv-hero,
html:not([data-theme="dark"]) .btn-create.recurring { color: var(--primary); }
html:not([data-theme="dark"]) .badge-review { color: #9a3412; }
/* ══ Dashboard: filters pinned to the bottom (phone / tablet, 2026-12-02) ══
   Same breakpoint the rest of the app uses for "not desktop". In-flow flex chrome, no overlays:
   top bar, job list (the only scroller), controls block, bottom nav. Desktop keeps its layout. */
@media (max-width: 899px), (max-height: 599px) {
  body.dash-page {
    display: flex; flex-direction: column;
    height: var(--app-height, 100dvh); max-height: var(--app-height, 100dvh);
    overflow: hidden; padding-bottom: 0 !important;
    overscroll-behavior: none;
  }
  body.dash-page .topbar { flex: 0 0 auto; position: relative; z-index: 160; }
  body.dash-page .main-content {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    padding-bottom: 0 !important; max-width: none; margin: 0;
  }
  body.dash-page .dash-scroll {
    order: 1; flex: 1 1 auto; min-height: 0;
    overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-top: 0.6rem; overscroll-behavior: contain;
  }
  body.dash-page .dash-scroll .job-list { padding-bottom: 0.75rem; }
  body.dash-page .dash-scroll .load-more-wrap { padding: 0 1rem 1rem; }
  body.dash-page .dash-controls {
    order: 2; flex: 0 0 auto; position: relative; z-index: 20;
    background: var(--bg-card); border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    padding: 0.45rem 0.75rem 0.5rem;
  }
  body.dash-page .dash-controls .toolbar { padding: 0; gap: 0.4rem; }
  body.dash-page .dash-controls .toolbar-quad { gap: 0.4rem; }
  body.dash-page .dash-controls .toolbar-quad-btn,
  body.dash-page .dash-controls .toolbar > #newJobBtnPortrait,
  body.dash-page .dash-controls .toolbar .worklist-btn { min-height: 42px; padding-top: 0.4rem; padding-bottom: 0.4rem; }
  body.dash-page .dash-controls .quick-chips { margin: 0 0 0.4rem; }
  body.dash-page .bottom-nav {
    order: 3; display: flex; position: relative; left: auto; right: auto; bottom: auto;
    transform: none; max-width: none; width: 100%; flex: 0 0 auto; z-index: 30; border-radius: 0;
  }
  /* Menus open UPWARD (the controls sit at the bottom) and are capped to the room above (JS sets --menu-max). */
  body.dash-page .dash-controls .dropdown-menu {
    top: auto; bottom: 100%; margin-top: 0; margin-bottom: 0.3rem;
    max-height: var(--menu-max, 60vh); overflow-y: auto; overscroll-behavior: contain;
    z-index: 140;
  }
  body.dash-page .dash-controls .toolbar-quad .filters-dropdown:nth-child(even) .dropdown-menu { left: auto; right: 0; }
  body.dash-page .dash-controls .toolbar .worklist-menu { left: 0; right: auto; transform: none; width: max(100%, 180px); }
  /* Searching (keyboard up): give the list the whole screen */
  body.dash-page:has(.topbar.search-open) .dash-controls { display: none; }   /* the nav bar is never hidden (MB-16) */
}
/* Wider (tablet portrait) or short (landscape phone): one compact row of five controls */
@media (max-height: 599px), (min-width: 600px) and (max-width: 899px) {
  body.dash-page .dash-controls .toolbar { flex-direction: row; align-items: stretch; flex-wrap: nowrap; }
  body.dash-page .dash-controls .toolbar > #newJobBtnPortrait { width: auto; flex: 0 0 auto; padding-left: 0.85rem; padding-right: 0.85rem; }
  body.dash-page .dash-controls .toolbar-quad { flex: 1 1 auto; min-width: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: auto; }
  body.dash-page .dash-controls .toolbar-quad .filters-dropdown:nth-child(even) .dropdown-menu { left: 0; right: auto; }
  body.dash-page .dash-controls .toolbar-quad .filters-dropdown:nth-child(4) .dropdown-menu { left: auto; right: 0; }
  body.dash-page .dash-controls .toolbar .worklist-menu { width: max(100%, 180px); }
}
@media (max-height: 599px) {
  body.dash-page .dash-controls { padding: 0.3rem 0.6rem; }
  body.dash-page .dash-controls .toolbar-quad-btn,
  body.dash-page .dash-controls .toolbar > #newJobBtnPortrait,
  body.dash-page .dash-controls .toolbar .worklist-btn { min-height: 38px; font-size: 0.82rem; }
  body.dash-page .dash-controls .quick-chips { margin-bottom: 0.3rem; }
  body.dash-page .bottom-nav a { min-height: 42px; }
}

/* ══ Movable dashboard controls + theme picker (2026-12-02) ══ */
.ctl-flip { display: none; }
@media (max-width: 899px), (max-height: 599px) {
  body.dash-page .dash-controls .toolbar { flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  body.dash-page .dash-controls .toolbar > #newJobBtnPortrait { flex: 1 1 0; width: auto; min-width: 0; }
  body.dash-page .dash-controls .toolbar > .toolbar-quad { flex: 1 0 100%; min-width: 0; }
  body.dash-page .ctl-flip {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text-secondary); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  body.dash-page .ctl-flip:hover, body.dash-page .ctl-flip:active { color: var(--primary); border-color: var(--primary); }
  body.dash-page .ctl-flip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
  body.dash-page .ctl-flip .ctl-flip-icon { transition: transform 0.15s; }
  body.dash-page .ctl-flip.points-down .ctl-flip-icon { transform: rotate(180deg); }
  /* Controls at the TOP: under the top bar, list below, menus open downward */
  body.dash-page.ctl-top .dash-controls {
    order: 0; border-top: 0; border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }
  body.dash-page.ctl-top .dash-controls .dropdown-menu { top: 100%; bottom: auto; margin-top: 0.3rem; margin-bottom: 0; }
}
@media (max-height: 599px), (min-width: 600px) and (max-width: 899px) {
  body.dash-page .dash-controls .toolbar { flex-wrap: nowrap; }
  body.dash-page .dash-controls .toolbar > #newJobBtnPortrait { flex: 0 0 auto; }
  body.dash-page .dash-controls .toolbar > .toolbar-quad { flex: 1 1 auto; order: 1; }
  body.dash-page .ctl-flip { order: 2; }
}
@media (max-height: 599px) {
  body.dash-page .ctl-flip { min-height: 40px; flex-basis: 40px; width: 40px; }
}

/* Theme item in the user menu, and its sheet */
#themeMenuItem { display: flex; align-items: center; gap: 0.5rem; }
#themeMenuItem .theme-menu-icon { flex-shrink: 0; color: var(--primary); }
.theme-sheet { max-width: 420px; }
.theme-options { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.theme-option {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  min-height: 48px; padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.theme-option:hover { background: var(--bg-hover); }
.theme-option.active { border-color: var(--primary); background: var(--primary-light); }
.theme-option:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.theme-swatch { display: inline-flex; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.theme-swatch > span { flex: 1 1 0; }
.theme-option-label { flex: 1 1 auto; min-width: 0; }
.theme-check { flex: 0 0 auto; color: var(--primary); visibility: hidden; }
.theme-option.active .theme-check { visibility: visible; }

/* ══ Filled buttons in dark mode keep a visible shape (>= 3:1 vs the card) in every theme (2026-12-02) ══
   A 1px lighter edge in the theme's accent text colour; inset, so nothing moves. */
.btn-primary,
.btn-primary.btn-sm { box-shadow: inset 0 0 0 1px var(--primary); }   /* light mode too: a pale accent keeps its fill but gets a dark edge */
[data-theme="dark"] .btn-danger { box-shadow: inset 0 0 0 1px var(--danger); }

/* Placeholders: the browser default grey is 3.2:1 on dark inputs. Muted text token = >= 4.5:1 in every theme. */
::placeholder { color: var(--text-muted); opacity: 1; }

/* ══ Nav guard rescue (MB-16): last resort if the bottom bar was pushed off screen by anything ══ */
html.nav-rescue .bottom-nav {
  display: flex !important; visibility: visible !important; opacity: 1 !important;
  position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
  transform: none !important; width: 100% !important; max-width: none !important; z-index: 2147483000 !important;
}
html.nav-rescue body { padding-bottom: 56px !important; }
/* The bar never collapses */
.bottom-nav { flex-shrink: 0; }


/* ── Email verification + low-stock email UI (2026-12-03) ── */
.email-status-row {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-top: 0.6rem;
}
.email-status-row .badge { flex-shrink: 0; }
#emailStatusMsg { margin-top: 0.4rem; }
.user-filter-row {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.inline-email { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; flex-basis: 100%; margin-top: 0.4rem; }
.inline-email-warn { flex-basis: 100%; color: var(--warning); }
.notify-toggle-row input:disabled { opacity: 0.5; }
.user-email-unverified { margin-left: 0.35rem; }

/* Instant send feedback + notice blocks (Brevo round, 2026-12) */
.btn-spinner { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: btn-spin .8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.notice { padding: 10px 12px; border-radius: 8px; font-weight: 600; border: 1px solid transparent; }
.notice-ok { color: var(--success, #16a34a); background: rgba(22,163,74,0.12); border-color: rgba(22,163,74,0.42); }
.notice-bad { color: var(--danger, #dc2626); background: rgba(220,38,38,0.10); border-color: rgba(220,38,38,0.42); }
#fpSpam { margin: 0.35rem 0 0; }
