/* ═══════════════════════════════════════════════════════════
   LensDesk — Photography CRM Stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── Dark Theme (default) ── Deep Navy / iOS-inspired ────── */
:root,
[data-theme="dark"] {
  --bg-base: #0e0e18;
  --bg-surface: #14141f;
  --bg-raised: #1b1b2a;
  --bg-elevated: #222235;
  --bg-hover: #292942;
  --bg-card: #14141f;
  --text-primary: #f0f0f8;
  --text-secondary: #8888a4;
  --text-muted: #505068;
  --accent: #e94560;
  --accent-hover: #f55575;
  --accent-muted: rgba(233,69,96,0.12);
  --border: #222235;
  --border-light: #1b1b2a;
  --shadow-card: 0 2px 16px rgba(0,0,0,0.4);
  --shadow-search: 0 12px 40px rgba(0,0,0,0.55);
  --shadow-modal: 0 24px 60px rgba(0,0,0,0.55);
  --success: #30d158;
  --danger: #ff453a;
  --warning: #ff9f0a;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: dark;
}

/* ── Light Theme ── iOS White / Clean ───────────────────── */
[data-theme="light"] {
  --bg-base: #f2f2f7;
  --bg-surface: #ffffff;
  --bg-raised: #f2f2f7;
  --bg-elevated: #e8e8f0;
  --bg-hover: #e2e2ea;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #58586c;
  --text-muted: #9494aa;
  --accent: #e94560;
  --accent-hover: #c8384f;
  --accent-muted: rgba(233,69,96,0.08);
  --border: #e5e5ea;
  --border-light: #f2f2f7;
  --shadow-card: 0 1px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.04);
  --shadow-search: 0 8px 32px rgba(26,26,46,0.12);
  --shadow-modal: 0 20px 50px rgba(26,26,46,0.18);
  --success: #34c759;
  --danger: #ff3b30;
  --warning: #ff9f0a;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}
[data-theme="light"] .sidebar {
  box-shadow: 1px 0 0 var(--border);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius);
  display: grid; place-items: center; color: white;
  box-shadow: 0 2px 8px rgba(233,69,96,0.35);
}
.brand-icon svg { width: 18px; height: 18px; }
.brand-text { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.913rem; font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item-sm { padding: 7px 12px; font-size: 0.838rem; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 4px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 6px 0; margin-bottom: 4px; }
.user-pill-info { display: flex; flex-direction: column; }
.user-pill-name { font-size: 0.875rem; font-weight: 600; }
.user-pill-role { font-size: 0.725rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Avatars ──────────────────────────────────────────────── */
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; color: white; flex-shrink: 0;
}
.avatar-xs {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.625rem; font-weight: 700; color: white; flex-shrink: 0;
}

/* ── Main ─────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.main-full { margin-left: 0 !important; }

/* ── Top Bar ──────────────────────────────────────────────── */
.topbar {
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 14px;
  background: var(--bg-surface);
  position: sticky; top: 0; z-index: 50;
}
[data-theme="light"] .topbar { box-shadow: 0 1px 0 var(--border); border-bottom: none; }
.hamburger { display: none; background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 4px; }
.hamburger svg { width: 22px; height: 22px; }
.search-wrapper { flex: 1; max-width: 460px; position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 15px; height: 15px; pointer-events: none; }
.search-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px 8px 36px;
  color: var(--text-primary); font-family: var(--font-body); font-size: 0.9rem;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
[data-theme="light"] .search-input { background: var(--bg-elevated); }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); max-height: 420px; overflow-y: auto;
  z-index: 200; display: none; box-shadow: var(--shadow-search);
  overflow: hidden;
}
.search-results:not(:empty) { display: block; }
.search-group { padding: 8px 0; }
.search-group + .search-group { border-top: 1px solid var(--border); }
.search-group-label { padding: 4px 14px; font-size: 0.725rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.search-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--text-primary); transition: background 0.1s; }
.search-item:hover { background: var(--bg-hover); }
.search-item svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.search-item-title { font-size: 0.9rem; }
.search-item-sub { font-size: 0.8rem; color: var(--text-secondary); margin-left: auto; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── Theme Toggle ─────────────────────────────────────────── */
.theme-toggle {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ── Page ─────────────────────────────────────────────────── */
.page-content { flex: 1; padding: 24px 28px; min-width: 0; max-width: 100%; }
.page-content.page-fullh { padding-bottom: 0; min-height: 0; overflow: hidden; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; }
.page-header-sub { font-size: 0.9rem; color: var(--text-secondary); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.838rem; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-muted); }
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 0.863rem; font-weight: 500; text-decoration: none; margin-bottom: 8px; padding: 4px 0; transition: color 0.15s; }
.back-btn:hover { color: var(--accent); }
.back-btn svg { width: 16px; height: 16px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.card-body { padding: 20px; }
.card-body-tight { padding: 0; }

/* ── Stats ─────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-card); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 1.875rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat-value.danger { color: var(--accent); }
.stat-value.warning { color: #ff9f0a; }
[data-theme="light"] .stat-value.warning { color: #c07800; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-raised); color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.863rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn svg { width: 15px; height: 15px; }
.btn-accent {
  background: var(--accent); border-color: var(--accent); color: white;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(233,69,96,0.3);
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; box-shadow: 0 4px 12px rgba(233,69,96,0.4); }
.btn-sm { padding: 6px 13px; font-size: 0.8rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.763rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select, .form-textarea {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text-primary); font-family: var(--font-body);
  font-size: 0.913rem; outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
  text-align: left;
}
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea { background: var(--bg-surface); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; text-align: left; text-align-last: left; }
option { background: var(--bg-raised); color: var(--text-primary); }
[data-theme="light"] option { background: var(--bg-surface); }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.form-hint { font-size: 0.788rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; padding: 16px 0 12px; border-top: 1px solid var(--border); }
select[multiple] { min-height: 120px; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.713rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted);
  padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th.sortable { padding: 0; }
thead th.sortable a {
  display: flex; align-items: center; gap: 5px;
  padding: 11px 16px; color: var(--text-muted); text-decoration: none;
  white-space: nowrap; transition: color 0.15s;
}
thead th.sortable a:hover { color: var(--text-primary); }
thead th.sortable.sorted-asc a,
thead th.sortable.sorted-desc a { color: var(--text-primary); }
thead th.sortable .sort-icon { opacity: 0.35; font-style: normal; font-size: 0.75rem; }
thead th.sortable.sorted-asc .sort-icon,
thead th.sortable.sorted-desc .sort-icon { opacity: 1; color: var(--accent); }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; vertical-align: middle; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }
td a { color: var(--text-primary); }
td a:hover { color: var(--accent); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.713rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}

/* Status badges — colors applied inline via DB-driven style="background:…;color:…" */
.badge-status { background: var(--bg-elevated); color: var(--text-secondary); }

/* Priority badges — colors applied inline via DB-driven style="border-color:…;color:…;background:…" */
.badge-priority { border: 1px solid; }

.badge-category { padding: 3px 9px; font-size: 0.688rem; border-radius: 5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ── Flash ─────────────────────────────────────────────────── */
.flash-container { padding: 0 28px; padding-top: 14px; }
.flash {
  padding: 11px 16px; border-radius: var(--radius-sm); font-size: 0.9rem;
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
  box-shadow: var(--shadow-card);
}
.flash-success { background: rgba(48,209,88,0.12); color: #30d158; border: 1px solid rgba(48,209,88,0.25); }
.flash-error   { background: rgba(255,69,58,0.12); color: #ff453a; border: 1px solid rgba(255,69,58,0.25); }
.flash-info    { background: rgba(10,132,255,0.12); color: #0a84ff; border: 1px solid rgba(10,132,255,0.25); }

[data-theme="light"] .flash-success { background: rgba(52,199,89,0.10); color: #1a8a3c; border-color: rgba(52,199,89,0.25); }
[data-theme="light"] .flash-error   { background: rgba(255,59,48,0.10); color: #cc2c24; border-color: rgba(255,59,48,0.25); }
[data-theme="light"] .flash-info    { background: rgba(0,122,255,0.10); color: #0055cc; border-color: rgba(0,122,255,0.25); }

.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1.3rem; padding: 0 4px; }

/* ── Job Detail Panes (Horizontal Scroll) ─────────────────── */
.job-panes {
  display: flex; gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 28px;
}
.job-pane {
  flex: 0 0 400px; min-width: 340px;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h) - 140px);
  background: var(--bg-surface);
}
.job-pane:last-child { border-right: none; }
.job-pane-title {
  font-size: 0.713rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.job-pane-title svg { width: 13px; height: 13px; }
.detail-row {
  display: flex; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px solid var(--border-light); gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 0.788rem; color: var(--text-muted); flex-shrink: 0; min-width: 100px; }
.detail-value { font-size: 0.9rem; word-break: break-word; flex: 1; min-width: 0; }
.detail-row > .inline-field,
.detail-row > select.inline-field { flex: 1; min-width: 0; }
.brief-text { font-size: 0.9rem; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; }

/* ── Notes Pane ───────────────────────────────────────────── */
#notesPane { flex: 0 0 440px; min-width: 380px; }

/* ── Notes ─────────────────────────────────────────────────── */
.note-card {
  background: var(--bg-raised); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
  border-left: 3px solid rgba(148,148,170,0.25);
}
.note-card-finance { border-left-color: #ff453a; }
.note-card-tracking { border-left-color: #0a84ff; }
.note-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.note-author { font-size: 0.875rem; font-weight: 600; }
.note-time { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.note-badge-internal {
  font-size: 0.65rem; background: rgba(255,159,10,0.14); color: #ff9f0a;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase; font-weight: 700;
}
[data-theme="light"] .note-badge-internal { background: rgba(255,159,10,0.12); color: #b86e00; }
.note-content { font-size: 0.938rem; line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; }
.note-attachments { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.note-attachment {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; background: var(--bg-elevated); border-radius: var(--radius-sm);
  font-size: 0.813rem; color: var(--text-secondary); transition: background 0.1s;
}
.note-attachment:hover { background: var(--bg-hover); color: var(--text-primary); }
.note-attachment svg { width: 13px; height: 13px; }

.note-form {
  background: var(--bg-raised); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.note-form textarea {
  width: 100%; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.938rem; resize: none;
  min-height: 80px; max-height: 240px; outline: none; overflow-y: auto;
}
.note-form textarea:focus { border-color: var(--accent); }
.note-form-bar {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
}
.note-form-options {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.note-form-select {
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 24px 5px 8px;
  color: var(--text-secondary); font-family: var(--font-body);
  font-size: 0.78rem; outline: none; cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.note-form-select:focus { border-color: var(--accent); }
.note-form-check {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.78rem; color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.note-form-check input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.note-form-attach {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.note-form-attach:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }
.note-form-attach svg { width: 15px; height: 15px; }
.note-form-attach.has-files { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }
.note-file-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light);
}
.note-file-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.813rem; color: var(--text-secondary);
}
.note-file-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.note-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-file-size { color: var(--text-muted); font-size: 0.75rem; flex-shrink: 0; }

/* ── Note Attachment Previews ─────────────────────────────── */
.note-preview-link { display: inline-block; }
.note-preview-img {
  max-width: 100%; max-height: 300px; border-radius: var(--radius-sm);
  display: block; margin-top: 6px; object-fit: contain; cursor: pointer;
}
.note-preview-video {
  max-width: 100%; max-height: 300px; border-radius: var(--radius-sm);
  display: block; margin-top: 6px;
}
.note-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* ── Board / Kanban View ──────────────────────────────────── */
.board-container {
  display: flex; gap: 14px; overflow-x: auto;
  padding-bottom: 16px; -webkit-overflow-scrolling: touch;
}
.board-column {
  flex: 0 0 280px; min-width: 260px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.board-col-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.board-col-title { font-size: 0.763rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.board-col-count {
  background: var(--bg-elevated); padding: 1px 8px; border-radius: 999px;
  font-size: 0.713rem; color: var(--text-muted); font-weight: 600;
}
.board-col-body { padding: 8px; max-height: 65vh; overflow-y: auto; }
.board-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s; display: block; color: var(--text-primary);
}
.board-card:hover { border-color: var(--accent); color: var(--text-primary); box-shadow: 0 2px 8px rgba(233,69,96,0.12); }
.board-card-title { font-size: 0.863rem; font-weight: 600; margin-bottom: 5px; line-height: 1.35; }
.board-card-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-card-client { color: var(--text-muted); font-size: 0.738rem; margin-top: 4px; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px; padding: 12px 16px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.filter-bar .form-select, .filter-bar .form-input {
  width: auto; min-width: 140px; padding: 7px 12px; font-size: 0.863rem;
}
.filter-bar .btn { padding: 7px 13px; }
.view-toggle { display: flex; gap: 0; margin-left: auto; }
.view-toggle .btn {
  border-radius: 0; border-right-width: 0;
  background: var(--accent-muted); border-color: var(--accent); color: var(--accent); opacity: 0.4;
}
.view-toggle .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-toggle .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-right-width: 1px; }
.view-toggle .btn.active { opacity: 1; }
.view-toggle .btn:hover { opacity: 0.75; }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100%; padding: 20px;
  background: var(--bg-base);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 32px;
  box-shadow: var(--shadow-modal);
}
.login-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 32px;
}
.login-brand .brand-icon { width: 42px; height: 42px; }
.login-brand .brand-text { font-size: 1.4rem; }
.login-card .form-group { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 0.963rem; margin-top: 8px; }

/* ── Empty States ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 52px 20px; color: var(--text-muted);
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.9rem; margin-bottom: 16px; }

/* ── Overdue Indicator ────────────────────────────────────── */
.overdue { color: var(--danger) !important; }
.overdue-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); display: inline-block; margin-right: 4px;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Error Page ───────────────────────────────────────────── */
.error-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh; text-align: center;
}
.error-container { max-width: 400px; }
.error-icon { margin-bottom: 12px; }
.error-icon svg { width: 48px; height: 48px; color: var(--accent); opacity: 0.6; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--accent); letter-spacing: -0.04em; }
.error-title { font-size: 1.2rem; font-weight: 700; margin: 4px 0 8px; }
.error-msg { font-size: 1rem; color: var(--text-secondary); margin: 8px 0 24px; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 500;
  align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  width: 100%; max-width: 500px; margin: 20px;
  box-shadow: var(--shadow-modal);
}
.modal-title { font-size: 1.075rem; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.01em; }
.modal-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 1.013rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.4rem; cursor: pointer; padding: 0; line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Column Configuration ────────────────────────────────── */
.columns-config-list { display: flex; flex-direction: column; gap: 2px; }
.columns-config-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--bg-raised); border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.columns-config-item:hover { background: var(--bg-hover); }
.columns-config-item.dragging {
  opacity: 0.5; border-color: var(--accent);
}
.columns-config-grip {
  cursor: grab; color: var(--text-muted);
  display: flex; align-items: center;
}
.columns-config-grip:active { cursor: grabbing; }
.columns-config-grip svg { width: 16px; height: 16px; }
.columns-config-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.875rem; cursor: pointer; flex: 1;
}
.columns-config-label input[type="checkbox"] { cursor: pointer; }

/* ── Note Type Badges ────────────────────────────────────── */
.note-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; white-space: nowrap;
}
.note-badge-general { background: rgba(148,148,170,0.14); color: #9898aa; }
.note-badge-update { background: rgba(10,132,255,0.12); color: #0a84ff; }
.note-badge-client_comms { background: rgba(191,90,242,0.12); color: #bf5af2; }
.note-badge-issue { background: rgba(255,69,58,0.12); color: #ff453a; }
.note-badge-meeting { background: rgba(255,159,10,0.12); color: #ff9f0a; }
.note-badge-delivery { background: rgba(48,209,88,0.12); color: #30d158; }

/* ── Filter Bar additions ────────────────────────────────── */
.filter-bar-right {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}

/* ── Responsive / Mobile ──────────────────────────────────── */
.nav-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99; opacity: 0; transition: opacity 0.25s;
}
.nav-overlay.open { display: block; opacity: 1; }
.hide-mobile { display: inline; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .hide-mobile { display: none; }
  .search-kbd { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .job-pane, #notesPane { flex: 0 0 100%; min-width: 100%; max-width: 100%; box-sizing: border-box; scroll-snap-align: start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 18px; }
  /* Keep horizontal padding for elements before the panes (back btn, page header, tabs).
     The panes themselves use a negative margin to extend full width. */
  .page-content.page-fullh { padding: 12px 18px 0; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar { padding: 0 14px; gap: 10px; }
  .board-column { flex: 0 0 260px; min-width: 250px; }
}

/* ── Display Font ────────────────────────────────────────── */
/* All elements use DM Sans (set in --font-display) for a clean, unified look */
.page-header h1,
.brand-text,
.stat-value,
.error-code,
.client-panel-name,
.modal-title,
.login-brand .brand-text {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

/* ── Dyslexic-Friendly Font Override ─────────────────────── */
[data-font="dyslexic"] {
  --font-body: 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif;
  --font-display: 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif;
}

/* ── Dyslexic Font Toggle (sidebar) ─────────────────────── */
.dyslexic-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
}
.dyslexic-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.dyslexic-toggle svg { width: 14px; height: 14px; flex-shrink: 0; }
[data-font="dyslexic"] .dyslexic-toggle {
  color: var(--accent);
  background: var(--accent-muted);
}

/* ── Utility ──────────────────────────────────────────────── */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-mono { font-family: var(--font-mono); }
.flex-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.863rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 0.25s ease;
  max-width: 360px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.toast-success { background: rgba(48,209,88,0.14); color: #30d158; border: 1px solid rgba(48,209,88,0.28); }
.toast-error   { background: rgba(255,69,58,0.14); color: #ff453a; border: 1px solid rgba(255,69,58,0.28); }
.toast-info    { background: rgba(10,132,255,0.14); color: #0a84ff; border: 1px solid rgba(10,132,255,0.28); }
[data-theme="light"] .toast-success { background: rgba(52,199,89,0.10); color: #1a8a3c; border-color: rgba(52,199,89,0.25); }
[data-theme="light"] .toast-error   { background: rgba(255,59,48,0.10); color: #cc2c24; border-color: rgba(255,59,48,0.25); }
[data-theme="light"] .toast-info    { background: rgba(0,122,255,0.10); color: #0055cc; border-color: rgba(0,122,255,0.25); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-exit { animation: toastOut 0.2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* ── Contact Cards ───────────────────────────────────────── */
.contact-card {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg-raised);
  transition: background 0.1s, border-color 0.1s;
}
.contact-card:hover { background: var(--bg-hover); border-color: var(--border); }

/* ── Dynamic status color (inline style fallback) ─────────── */
.badge-status-dynamic {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 16px; }

/* ── Full-height page layout (split/pane views) ──────────── */

/* Lock the entire viewport chain so nothing above page-fullh can scroll */
body:has(.page-fullh) { height: 100vh; overflow: hidden; }
body:has(.page-fullh) .main-content { height: 100vh; max-height: 100vh; overflow: hidden; }

.page-fullh {
  flex: 1;
  min-height: 0;          /* allow flex to shrink below content size */
  overflow: hidden;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}

/* ── Job pane columns — each scrolls independently ───────── */
.page-fullh .job-panes,
.page-fullh form.job-panes {
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
  margin: 0 -28px;
  padding-left: 28px;
  padding-right: 28px;
  /* Use scroll (not auto) so the horizontal scrollbar is always visible,
     allowing users to drag it without needing Shift+scroll */
  overflow-x: scroll;
  overflow-y: hidden;
  align-items: stretch;
}
.page-fullh .job-pane {
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  /* Contain vertical scroll within each pane so it doesn't propagate */
  overscroll-behavior-y: contain;
  /* Isolate stacking context per pane so scrollbars don't overlap titles */
  isolation: isolate;
  /* Remove top padding so sticky title sits flush at the scroll container top,
     preventing content from scrolling in the gap above the sticky bar */
  padding-top: 0;
}
/* Keep pane titles visible while scrolling */
.page-fullh .job-pane-title {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface);
  /* Stretch into the side/bottom pane padding; no negative top margin needed
     because padding-top on the pane is 0 — title starts flush at the top */
  margin: 0 -22px 18px;
  padding: 22px 22px 10px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Mobile override — must come after the desktop .page-fullh rules ─ */
@media (max-width: 1023px) {
  /* KEEP viewport locked on mobile — panes scroll independently, NOT the page */
  body:has(.page-fullh) { height: 100vh; height: 100dvh; overflow: hidden; }
  body:has(.page-fullh) .main-content { height: 100vh; height: 100dvh; max-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  .page-fullh {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .page-fullh .job-panes,
  .page-fullh form.job-panes {
    flex: 1;
    min-height: 0;
    /* Negative margin counteracts the 18px page-content padding so panes span full width */
    margin: 0 -18px;
    padding: 0;
    overflow-x: scroll;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .page-fullh .job-pane {
    /* Fixed height = remaining viewport, each pane scrolls independently */
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* Remove top padding so sticky title is flush at the scroll container top */
    padding: 0 18px 16px;
    scroll-snap-align: start;
  }
  .page-fullh .job-pane-title {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-surface);
    /* No negative top margin — pane padding-top is 0 */
    margin: 0 -18px 14px;
    padding: 16px 18px 8px;
    border-bottom: 1px solid var(--border-light);
  }
}

/* ── Clients Split Pane ──────────────────────────────────── */
.clients-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin: 0 -28px;
  border-top: 1px solid var(--border);
}
.clients-list-pane {
  flex: 0 0 300px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
}
.clients-list-search {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.clients-list-body {
  flex: 1;
  overflow-y: auto;
}
.client-list-item {
  display: block;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: background 0.1s;
  cursor: pointer;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.client-list-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.client-list-item.active {
  background: var(--accent-muted);
  border-left-color: var(--accent);
  color: var(--text-primary);
}
.client-list-name { font-weight: 600; font-size: 0.863rem; }
.client-list-sub { font-size: 0.725rem; color: var(--text-muted); margin-top: 2px; }
.clients-detail-pane {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: var(--bg-base);
}
.clients-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.938rem;
}

/* ── Client Panel (right pane detail) ────────────────────── */
.client-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.client-panel-name { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.03em; }
.client-panel-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 16px;
}
.client-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.client-info-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.client-panel-notes {
  background: var(--bg-raised);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
}
.client-panel-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}
.client-panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.client-panel-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.client-panel-section-title svg { width: 13px; height: 13px; }

/* ── Inline Edit Inputs ──────────────────────────────────── */
.inline-field {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  width: 100%;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
}
.inline-field:hover {
  background: var(--bg-raised);
  border-color: var(--border);
}
.inline-field:focus {
  background: var(--bg-raised);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}
.inline-field-left { text-align: left; }
textarea.inline-field { resize: vertical; min-height: 60px; text-align: left; }
select.inline-field { text-align: left; cursor: pointer; }
select[multiple].inline-field { min-height: 80px; }

/* ── Save Bar ────────────────────────────────────────────── */
.save-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: var(--bg-surface);
  border-top: 2px solid var(--accent);
  padding: 12px 28px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 80;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}
.save-bar.visible {
  display: flex;
  animation: saveBarSlideIn 0.2s ease;
}
@keyframes saveBarSlideIn {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.save-bar-msg { font-size: 0.875rem; color: var(--text-secondary); flex: 1; }

/* Ensure form.job-panes uses the same flex layout as div.job-panes */
form.job-panes {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1023px) {
  .save-bar { left: 0; }
  .clients-list-pane { flex: 0 0 220px; }
  .clients-detail-pane { padding: 18px; }
}

/* ── Tag Picker (multi-select replacement) ───────────────── */
.tag-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
}
.tag-picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  min-height: 28px;
  align-items: center;
  cursor: pointer;
}
.tag-picker-placeholder {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.tag-picker-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.4;
}
.tag-picker-tag-text { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tag-picker-tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
  transition: opacity 0.1s;
}
.tag-picker-tag-remove:hover { opacity: 1; }
.tag-picker-add {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.tag-picker-add:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent); }
.tag-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 60;
}
.tag-picker-dropdown.open { display: block; }
.tag-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--text-primary);
}
.tag-picker-option:hover { background: var(--bg-hover); }
.tag-picker-option.selected { background: var(--accent-muted); }
.tag-picker-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Pane Tabs (mobile navigation) ───────────────────────── */
.pane-tabs {
  display: none;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 4px;
  position: sticky;
  top: var(--topbar-h);
  background: var(--bg-base);
  z-index: 20;
  flex-shrink: 0;
}
.pane-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.725rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.pane-tab svg { width: 13px; height: 13px; }
.pane-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.pane-tab.active { background: var(--accent-muted); color: var(--accent); }

@media (max-width: 1023px) {
  .pane-tabs { display: flex; padding-left: 18px; padding-right: 18px; position: sticky; scroll-behavior: smooth; }
}

/* ── Pane Bottom Spacer ──────────────────────────────────── */
.pane-bottom-spacer { height: 80px; flex-shrink: 0; }

/* ── Archived Badge (inline in list rows) ────────────────── */
.badge-archived {
  background: rgba(249,115,22,0.12);
  color: #f97316;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
[data-theme="light"] .badge-archived {
  background: rgba(249,115,22,0.10);
  color: #ea580c;
}

/* ── Cross-Browser Form Normalization ────────────────────── */
.form-input,
.form-select,
.form-textarea,
.inline-field,
select.inline-field {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-family: var(--font-body);
  font-size: 0.938rem;
  line-height: 1.5;
}
.form-select,
select.inline-field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
select[multiple].inline-field,
select[multiple].form-select {
  background-image: none;
  padding-right: 14px;
}
/* Safari date input fix */
input[type="date"] {
  -webkit-appearance: none;
  min-height: 38px;
}

/* ── Real-time Collaboration: Viewers & Lock Banner ──────── */
.job-viewers {
  display: flex;
  gap: 0;
}
.viewer-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: white;
  border: 2px solid var(--bg-surface);
  margin-left: -6px;
  cursor: default;
  position: relative;
  z-index: 1;
}
.viewer-avatar:first-child { margin-left: 0; }
.lock-banner {
  background: rgba(255,159,10,0.10);
  border: 1px solid rgba(255,159,10,0.28);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 8px;
}
[data-theme="light"] .lock-banner {
  background: rgba(255,159,10,0.07);
  border-color: rgba(255,159,10,0.22);
}
.lock-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lock-banner-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.lock-banner-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.lock-banner-text strong { color: var(--text-primary); }
.lock-banner-override {
  border-color: rgba(255,159,10,0.4) !important;
  color: #ff9f0a !important;
  background: transparent !important;
  flex-shrink: 0;
}
.lock-banner-override:hover {
  background: rgba(255,159,10,0.12) !important;
}
[data-theme="light"] .lock-banner-override { color: #b86e00 !important; }
.locked-pane {
  pointer-events: none;
  opacity: 0.5;
  user-select: none;
}

/* ── Xero Invoice Rows ──────────────────────────────────── */
.xero-invoice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg-raised);
  font-size: 0.85rem;
}
.xero-invoice-row:hover {
  background: var(--bg-hover);
}

/* ── Smart Address Widget ─────────────────────────────────── */

/* Address row card */
.addr-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.addr-row-header {
  display: flex;
  gap: 8px;
  align-items: center;
}
.addr-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.addr-remove-btn {
  flex-shrink: 0;
  color: var(--text-muted);
}
.addr-remove-btn:hover { color: var(--danger); }

/* Smart input */
.addr-location-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.addr-smart-input {
  flex: 1;
  font-size: 0.88rem;
}
.addr-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: addrSpin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes addrSpin { to { transform: rotate(360deg); } }

.addr-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.addr-type-badge[data-type="w3w"]     { background: #E11F2615; color: #E11F26; }
.addr-type-badge[data-type="coords"]  { background: var(--accent-muted); color: var(--accent); }
.addr-type-badge[data-type="address"] { background: var(--bg-hover); color: var(--text-muted); }

/* Autocomplete dropdown */
.addr-suggestions {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.addr-suggestion {
  padding: 9px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.addr-suggestion:last-child { border-bottom: none; }
.addr-suggestion:hover, .addr-suggestion.active { background: var(--bg-hover); }
.addr-suggestion svg { flex-shrink: 0; color: var(--text-muted); margin-top: 2px; }
.addr-suggestion-text { flex: 1; line-height: 1.4; }
.addr-suggestion-text .text-muted { color: var(--text-muted); font-size: 0.79rem; }

/* Resolved section (map thumb + W3W + navigate) */
.addr-resolved {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Map thumbnail */
.addr-map-thumb {
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  isolation: isolate;
}
.addr-map-thumb:hover .addr-map-expand-hint { opacity: 1; }
.addr-map-container {
  width: 100%;
  height: 100%;
}
.addr-map-expand-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.75rem;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.15s;
}

/* W3W display row */
.addr-w3w-display {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: #E11F2610;
  border-radius: 6px;
  font-size: 0.85rem;
}
.addr-w3w-display .w3w-mark {
  font-weight: 700;
  color: #E11F26;
  font-size: 0.9rem;
}
.addr-w3w-words { color: #E11F26; font-weight: 600; }

/* Navigate button */
.addr-navigate-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  padding: 4px 10px;
}

/* Access notes */
.addr-notes {
  font-size: 0.82rem;
  resize: vertical;
  min-height: 48px;
}

/* ── Full-screen Map Modal ────────────────────────────────── */
#addrMapModal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
}
#addrMapModal.open { display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) {
  #addrMapModal.open { align-items: center; }
}
.addr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.addr-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  border-radius: 16px 16px 0 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
@media (min-width: 600px) {
  .addr-modal-dialog { border-radius: var(--radius); max-height: 80vh; }
}
.addr-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.addr-modal-title { flex: 1; font-weight: 600; font-size: 0.95rem; }
.addr-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
}
.addr-modal-close:hover { color: var(--text-primary); }
.addr-modal-map-wrap {
  flex: 1;
  position: relative;
  min-height: 280px;
}
.addr-modal-map {
  width: 100%;
  height: 100%;
  min-height: 280px;
}
.addr-modal-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
}
.addr-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.addr-modal-info { display: flex; flex-direction: column; gap: 4px; }
.addr-modal-w3w { font-size: 0.85rem; color: #E11F26; font-weight: 600; }
.addr-modal-w3w .w3w-mark { font-weight: 700; margin-right: 2px; }
.addr-modal-address { font-size: 0.85rem; color: var(--text-secondary); }
.addr-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.addr-modal-navigate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
}
.addr-modal-done { margin-left: auto; }

/* Legacy compatibility — keep old class names working */
.address-map-widget { position: relative; }
.address-map-widget .form-input { padding-right: 36px; }
.address-suggestions { /* handled above by .addr-suggestions */ }
.address-map-preview {
  height: 180px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 8px;
  overflow: hidden;
  display: none;
  position: relative;
  isolation: isolate;
}
.address-map-preview.visible { display: block; }

/* ── Job Detail Inline Map ───────────────────────────────── */
.detail-map-preview {
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 8px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

/* ── Full-Page Map View ──────────────────────────────────── */
.map-page-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  margin: -28px;
  position: relative;
  z-index: 0; /* Contain MapKit's internal elements below topbar/sidebar */
}
.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.map-toolbar .form-select {
  width: auto;
  min-width: 140px;
  padding: 8px 30px 8px 12px;
  font-size: 0.875rem;
}
.map-toggle-group {
  display: flex;
  gap: 0;
}
.map-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-right-width: 0;
}
.map-toggle-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.map-toggle-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-right-width: 1px; }
.map-toggle-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: var(--accent);
}
.map-toggle-btn:hover:not(.active) { background: var(--bg-hover); }
.map-toggle-btn svg { width: 16px; height: 16px; }
.map-container {
  flex: 1;
  min-height: 0;
  position: relative;
}
.map-pin-count {
  font-size: 0.813rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ── Status ratio bar (dashboard) ───────────────────────── */
.status-bar-wrap {
  margin-bottom: 20px;
}
.status-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: visible;
  background: var(--bg-elevated);
}
.status-bar-seg {
  transition: width 0.4s ease, filter 0.15s ease;
  min-width: 0;
  position: relative;
  cursor: pointer;
}
.status-bar-seg:first-child {
  border-radius: 999px 0 0 999px;
}
.status-bar-seg:last-child {
  border-radius: 0 999px 999px 0;
}
.status-bar-seg:only-child {
  border-radius: 999px;
}
.status-bar-seg:hover {
  filter: brightness(1.25);
}
.status-bar-seg::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.status-bar-seg::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.status-bar-seg:hover::after,
.status-bar-seg:hover::before {
  opacity: 1;
}
.status-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.status-bar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.status-bar-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── MapKit callout card (custom annotation callouts) ────── */
.map-callout {
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.5;
  min-width: 220px;
  max-width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.map-popup-title {
  font-weight: 700;
  font-size: 0.938rem;
  margin-bottom: 4px;
}
.map-popup-title a { color: var(--text-primary); }
.map-popup-title a:hover { color: var(--accent); }
.map-popup-meta {
  font-size: 0.813rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.map-popup-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.688rem;
  font-weight: 600;
  text-transform: uppercase;
}
.map-popup-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.813rem;
  color: var(--accent);
  font-weight: 500;
}
.map-popup-link:hover { color: var(--accent-hover); }

/* ── System Settings Layout ─────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.settings-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h) - 120px);
}
.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
  white-space: nowrap;
}
.settings-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-tab.active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.settings-tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.settings-tab-danger { color: var(--danger); }
.settings-tab-danger.active { background: rgba(255,69,58,0.1); color: var(--danger); }
.settings-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.settings-content {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h) - 120px);
  background: var(--bg-base);
}
[data-theme="light"] .settings-content { background: var(--bg-raised); }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.settings-section-header h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.settings-section-header > div { display: flex; flex-direction: column; gap: 2px; }

/* Settings filter grid (audit log, feedback) */
.settings-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
}
@media (max-width: 600px) {
  .settings-filter-grid { grid-template-columns: 1fr; }
}

/* Settings status row */
.settings-status-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

/* Import grid */
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.import-stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.import-log {
  background: var(--bg-raised);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 12px 14px;
  border-radius: var(--radius);
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}
.import-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.import-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.import-option input { margin-top: 3px; }
.import-option span { display: flex; flex-direction: column; }
.import-option-danger {
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: rgba(255,69,58,0.04);
}
.import-history { display: flex; flex-direction: column; gap: 8px; }
.import-history-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}
.import-history-item:hover { background: var(--bg-hover); color: inherit; }
.import-history-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }

/* Stat chip (import stats) */
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-val { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* Import badge variants */
.badge-success { background: rgba(48,209,88,0.15); color: var(--success); }
.badge-error   { background: rgba(255,69,58,0.15); color: var(--danger); }
.badge-warning { background: rgba(255,159,10,0.15); color: var(--warning); }
.badge-cancelled { background: rgba(136,136,164,0.15); color: var(--text-secondary); }

/* Mobile: horizontal scrolling tabs */
@media (max-width: 768px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px;
    max-height: none;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .settings-tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.72rem;
    width: auto;
    flex-direction: column;
    gap: 2px;
    text-align: center;
    min-width: 44px;
  }
  .settings-tab span {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 0.02em;
    line-height: 1.1;
    max-width: 54px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .settings-tab svg { width: 18px; height: 18px; }
  .settings-divider { width: 1px; height: 24px; margin: 0 2px; flex-shrink: 0; align-self: center; }
  .settings-content { max-height: none; padding: 16px; }
  .import-grid { grid-template-columns: 1fr; }
}

/* ── Consistency Fixes ─────────────────────────────────────── */

/* Overdue badge — replaces hardcoded inline styles */
.badge-overdue { background: rgba(255,69,58,0.15); color: var(--danger); }
[data-theme="light"] .badge-overdue { background: rgba(255,59,48,0.10); color: #cc2c24; }

/* Active status text */
.text-success { color: var(--success); }

/* Action badges for audit log */
.badge-action-create  { background: rgba(48,209,88,0.15); color: var(--success); }
.badge-action-update  { background: rgba(10,132,255,0.12); color: #0a84ff; }
.badge-action-delete  { background: rgba(255,69,58,0.15); color: var(--danger); }
.badge-action-archive { background: rgba(255,159,10,0.12); color: var(--warning); }
.badge-action-neutral { background: rgba(136,136,164,0.15); color: var(--text-secondary); }

/* Section label — reusable uppercase heading */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Inline check label — used in status role checkboxes */
.inline-check-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 8px;
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
}

/* Drag handle — consistent styling */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  text-align: center;
}
.drag-handle svg { width: 14px; height: 14px; }
.drag-handle:active { cursor: grabbing; }

/* Color input — consistent across admin tables */
.color-input {
  width: 36px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
}

/* Text alignment utility */
.text-center { text-align: center; }

/* Button icon-danger — danger-colored icon button */
.btn-icon-danger { color: var(--danger); }
.btn-icon-danger:hover { color: var(--danger); background: rgba(255,69,58,0.1); }

/* Extra small button */
.btn-xs { padding: 3px 8px; font-size: 0.75rem; }
.btn-xs svg { width: 12px; height: 12px; }

/* Extra small form select */
.form-select-xs { font-size: 0.75rem; padding: 2px 24px 2px 6px; height: auto; min-height: auto; }

/* Inline form (used in feedback status updates) */
.inline-form { display: flex; gap: 4px; align-items: center; }

/* ── Extended Utilities ──────────────────────────────────── */

/* Text utilities */
.text-xs { font-size: 0.75rem; }
.text-md { font-size: 0.938rem; }
.text-lg { font-size: 1.1rem; }
.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }
.text-medium { font-weight: 500; }
.text-italic { font-style: italic; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.08em; }
.text-nowrap { white-space: nowrap; }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }

/* Layout utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 10px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.place-center { display: grid; place-items: center; }

/* Spacing */
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }

/* Sizing */
.w-full { width: 100%; }
.max-w-form { max-width: 640px; }
.max-w-modal-sm { max-width: 420px; }
.max-w-modal { max-width: 480px; }
.min-w-0 { min-width: 0; }

/* Borders & radius */
.border-bottom { border-bottom: 1px solid var(--border); }
.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Icon sizing */
.icon-xs { width: 10px; height: 10px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 18px; height: 18px; }
.icon-xl { width: 24px; height: 24px; }
.icon-2xl { width: 40px; height: 40px; }

/* Form utilities */
.input-disabled { opacity: 0.6; }
.input-color { height: 40px; padding: 4px; }
.resize-y { resize: vertical; }

/* Feedback modal */
.feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
}
.feedback-dialog {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  margin: 1rem;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
}
.feedback-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}
.feedback-success {
  display: none;
  text-align: center;
  padding: 1rem;
}
.required-star { color: var(--danger); }
.btn-close-plain {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

/* Profile page */
.passkey-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.qr-wrapper {
  text-align: center;
  margin-bottom: 12px;
}
.qr-frame {
  display: inline-block;
  background: #fff;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.qr-image {
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}

/* Calendar page */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cal-month-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-dow {
  text-align: center;
  padding: 8px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-cell {
  min-height: 90px;
  border: 1px solid var(--border);
  border-top: none;
}
.cal-cell-day {
  min-height: 90px;
  border: 1px solid var(--border);
  border-top: none;
  padding: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.cal-cell-day:hover { background: var(--bg-elevated); }
.cal-day-num {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  padding: 1px 4px;
}
.cal-day-num-today {
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-event-pill {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 5px;
  border-radius: 3px;
}
.cal-event-more {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 5px;
}
.cal-detail-header {
  padding: 14px 20px;
}
.cal-detail-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.cal-detail-empty {
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.cal-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.cal-status-bar {
  width: 4px;
  height: 36px;
  border-radius: 2px;
  flex-shrink: 0;
}
.cal-detail-info {
  flex: 1;
  min-width: 0;
}
.cal-detail-name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-detail-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.delivery-color { color: #f97316; }

/* Unscheduled jobs section */
.unscheduled-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  list-style: none;
  user-select: none;
}
.unscheduled-count {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Jobs list utilities */
.job-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.job-title-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-row-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.badge-sm { font-size: 0.65rem; padding: 1px 6px; }
.badge-xs { font-size: 0.62rem; padding: 1px 6px; }
.badge-board { font-size: 0.68rem; }
.no-shoot-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.pagination-center {
  justify-content: center;
}
.filter-search { min-width: 180px; }

/* ── Mobile Responsive Tables & Admin ────────────────────── */

/* Column hiding classes — applied in templates */
@media (max-width: 1023px) {
  /* Hide on tablet and below */
  .hide-tablet-col { display: none !important; }

  /* Compact table cells on smaller screens */
  thead th { padding: 8px 10px; font-size: 0.67rem; }
  tbody td { padding: 10px 10px; font-size: 0.84rem; }

  /* Admin settings: compact form inputs inside tables */
  .settings-section table .form-input,
  .settings-section table .form-select {
    padding: 5px 8px;
    font-size: 0.82rem;
    min-width: 0;
  }
  .settings-section table .color-input { width: 30px; height: 26px; }

  /* Inline check labels for display roles — wrap more tightly */
  .settings-section .inline-check-label { font-size: 0.72rem; margin-right: 4px; }

  /* Dashboard tables: more compact */
  .card-body-tight table thead th { padding: 8px 10px; }
  .card-body-tight table tbody td { padding: 8px 10px; }
}

@media (max-width: 600px) {
  /* Hide on small mobile */
  .hide-mobile-col { display: none !important; }

  /* Even more compact tables */
  thead th { padding: 6px 8px; font-size: 0.65rem; }
  tbody td { padding: 8px 8px; font-size: 0.82rem; }

  /* Filter bar: reduce min-width for selects */
  .filter-bar .form-select,
  .filter-bar .form-input {
    min-width: 110px;
    font-size: 0.8rem;
    padding: 5px 10px;
  }
  .filter-search { min-width: 120px; }

  /* Admin settings: stack tracking type inputs vertically */
  .settings-section table .form-input { min-width: 60px; }

  /* Narrower drag handle and row number columns */
  .drag-handle { padding-left: 4px; padding-right: 2px; }
  .row-num { padding-left: 4px; padding-right: 4px; }

  /* Badge compaction */
  .badge { padding: 2px 7px; font-size: 0.65rem; }
  .badge-category { padding: 2px 6px; font-size: 0.62rem; }
}

/* ── PWA safe area ───────────────────────────────────────── */
@supports (padding-top: env(safe-area-inset-top)) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .sidebar { padding-top: env(safe-area-inset-top); }
  .save-bar { padding-bottom: env(safe-area-inset-bottom); }
}
