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

/* ── Dark Theme (default) ────────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg-base: #0c0c14;
  --bg-surface: #13131f;
  --bg-raised: #1a1a2e;
  --bg-elevated: #222240;
  --bg-hover: #2a2a48;
  --text-primary: #eeeef0;
  --text-secondary: #a0a0b8;
  --text-muted: #6e6e88;
  --accent: #e94560;
  --accent-hover: #ff5a75;
  --accent-muted: rgba(233,69,96,0.15);
  --border: #2a2a3e;
  --border-light: #1f1f32;
  --shadow-search: 0 12px 40px rgba(0,0,0,0.5);
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font-body: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: dark;
}

/* ── Light Theme ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base: #f2f2f7;
  --bg-surface: #ffffff;
  --bg-raised: #f0f0f5;
  --bg-elevated: #e5e5ee;
  --bg-hover: #dddde8;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a66;
  --text-muted: #7a7a96;
  --accent: #d93a55;
  --accent-hover: #c4304a;
  --accent-muted: rgba(217,58,85,0.10);
  --border: #d8d8e4;
  --border-light: #e8e8f0;
  --shadow-search: 0 12px 40px rgba(0,0,0,0.10);
  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;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius);
  display: grid; place-items: center; color: white;
}
.brand-icon svg { width: 20px; height: 20px; }
.brand-text { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-secondary); font-size: 0.938rem; 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); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item-sm { padding: 8px 12px; font-size: 0.875rem; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.sidebar-footer { padding: 14px; 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.75rem; 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 24px; gap: 16px;
  background: var(--bg-surface);
  position: sticky; top: 0; z-index: 50;
}
.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: 480px; position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; pointer-events: none; }
.search-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px 9px 38px;
  color: var(--text-primary); font-family: var(--font-body); font-size: 0.938rem;
  outline: none; transition: border-color 0.15s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }
.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); max-height: 420px; overflow-y: auto;
  z-index: 200; display: none; box-shadow: var(--shadow-search);
}
.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.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 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.938rem; }
.search-item-sub { font-size: 0.813rem; 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: 36px; height: 36px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); 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: 18px; height: 18px; }
.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: 28px; min-width: 0; max-width: 100%; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }
.page-header h1 { font-size: 1.625rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header-sub { font-size: 0.938rem; color: var(--text-secondary); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.875rem; 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); }

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

/* ── Stats ─────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; }
.stat-label { font-size: 0.813rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat-value.danger { color: var(--accent); }
.stat-value.warning { color: #e8920a; }
[data-theme="light"] .stat-value.warning { color: #c77d00; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.875rem; 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: 16px; height: 16px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-hover); color: white; }
.btn-sm { padding: 7px 14px; font-size: 0.813rem; }
.btn-sm svg { width: 14px; height: 14px; }
.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.813rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select, .form-textarea {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; color: var(--text-primary); font-family: var(--font-body);
  font-size: 0.938rem; outline: none; transition: border-color 0.15s; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
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.813rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
select[multiple] { min-height: 120px; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); font-size: 0.938rem; 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: 4px 11px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}

/* Dark mode status badges */
.badge-status { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-status[data-status="Enquiry"]       { background: rgba(107,114,128,0.2); color: #9ca3af; }
.badge-status[data-status="Quoted"]        { background: rgba(168,85,247,0.2); color: #c084fc; }
.badge-status[data-status="Confirmed"]     { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-status[data-status="Scheduled"]     { background: rgba(6,182,212,0.2); color: #22d3ee; }
.badge-status[data-status="In Progress"]   { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-status[data-status="Shot Complete"] { background: rgba(16,185,129,0.2); color: #34d399; }
.badge-status[data-status="Editing"]       { background: rgba(139,92,246,0.2); color: #a78bfa; }
.badge-status[data-status="Review"]        { background: rgba(236,72,153,0.2); color: #f472b6; }
.badge-status[data-status="Delivered"]     { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge-status[data-status="Invoiced"]      { background: rgba(20,184,166,0.2); color: #2dd4bf; }
.badge-status[data-status="Paid"]          { background: rgba(16,185,129,0.25); color: #34d399; }
.badge-status[data-status="On Hold"]       { background: rgba(249,115,22,0.2); color: #fb923c; }
.badge-status[data-status="Cancelled"]     { background: rgba(239,68,68,0.2); color: #f87171; }

/* Light mode status badges — higher contrast for legibility */
[data-theme="light"] .badge-status[data-status="Enquiry"]       { background: rgba(107,114,128,0.12); color: #525860; }
[data-theme="light"] .badge-status[data-status="Quoted"]        { background: rgba(168,85,247,0.12); color: #7c3aed; }
[data-theme="light"] .badge-status[data-status="Confirmed"]     { background: rgba(59,130,246,0.12); color: #2563eb; }
[data-theme="light"] .badge-status[data-status="Scheduled"]     { background: rgba(6,182,212,0.12); color: #0891b2; }
[data-theme="light"] .badge-status[data-status="In Progress"]   { background: rgba(245,158,11,0.12); color: #b45309; }
[data-theme="light"] .badge-status[data-status="Shot Complete"] { background: rgba(16,185,129,0.12); color: #047857; }
[data-theme="light"] .badge-status[data-status="Editing"]       { background: rgba(139,92,246,0.12); color: #6d28d9; }
[data-theme="light"] .badge-status[data-status="Review"]        { background: rgba(236,72,153,0.12); color: #be185d; }
[data-theme="light"] .badge-status[data-status="Delivered"]     { background: rgba(34,197,94,0.12); color: #15803d; }
[data-theme="light"] .badge-status[data-status="Invoiced"]      { background: rgba(20,184,166,0.12); color: #0f766e; }
[data-theme="light"] .badge-status[data-status="Paid"]          { background: rgba(16,185,129,0.15); color: #047857; }
[data-theme="light"] .badge-status[data-status="On Hold"]       { background: rgba(249,115,22,0.12); color: #c2410c; }
[data-theme="light"] .badge-status[data-status="Cancelled"]     { background: rgba(239,68,68,0.12); color: #dc2626; }

/* Priority badges */
.badge-priority { border: 1px solid; }
.badge-priority[data-priority="ASAP"]   { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }
.badge-priority[data-priority="High"]   { border-color: #f59e0b; color: #f59e0b; background: rgba(245,158,11,0.1); }
.badge-priority[data-priority="Normal"] { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.1); }
.badge-priority[data-priority="Low"]    { border-color: #6b7280; color: #6b7280; background: rgba(107,114,128,0.1); }

[data-theme="light"] .badge-priority[data-priority="ASAP"]   { border-color: #dc2626; color: #dc2626; background: rgba(239,68,68,0.08); }
[data-theme="light"] .badge-priority[data-priority="High"]   { border-color: #b45309; color: #b45309; background: rgba(245,158,11,0.08); }
[data-theme="light"] .badge-priority[data-priority="Normal"] { border-color: #2563eb; color: #2563eb; background: rgba(59,130,246,0.08); }
[data-theme="light"] .badge-priority[data-priority="Low"]    { border-color: #6b7280; color: #4b5563; background: rgba(107,114,128,0.08); }

.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: 16px; }
.flash {
  padding: 12px 18px; border-radius: var(--radius); font-size: 0.938rem;
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.flash-success { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.flash-error   { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.flash-info    { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }

[data-theme="light"] .flash-success { background: rgba(34,197,94,0.10); color: #15803d; border-color: rgba(34,197,94,0.25); }
[data-theme="light"] .flash-error   { background: rgba(239,68,68,0.10); color: #dc2626; border-color: rgba(239,68,68,0.25); }
[data-theme="light"] .flash-info    { background: rgba(59,130,246,0.10); color: #2563eb; border-color: rgba(59,130,246,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: 22px;
  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.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 18px;
  display: flex; align-items: center; gap: 6px;
}
.job-pane-title svg { width: 14px; height: 14px; }
.detail-row {
  display: flex; justify-content: space-between; 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.813rem; color: var(--text-muted); flex-shrink: 0; min-width: 100px; }
.detail-value { font-size: 0.938rem; text-align: right; word-break: break-word; }
.brief-text { font-size: 0.938rem; 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: 16px 18px; margin-bottom: 12px;
}
.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.688rem; background: rgba(245,158,11,0.15); color: #fbbf24;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase; font-weight: 700;
}
[data-theme="light"] .note-badge-internal { background: rgba(245,158,11,0.12); color: #b45309; }
.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: 16px; overflow-x: auto;
  padding-bottom: 16px; -webkit-overflow-scrolling: touch;
}
.board-column {
  flex: 0 0 290px; min-width: 270px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.board-col-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.board-col-title { font-size: 0.813rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.board-col-count {
  background: var(--bg-elevated); padding: 2px 9px; border-radius: 999px;
  font-size: 0.75rem; color: var(--text-muted); font-weight: 600;
}
.board-col-body { padding: 10px; max-height: 65vh; overflow-y: auto; }
.board-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 8px;
  transition: border-color 0.15s; display: block; color: var(--text-primary);
}
.board-card:hover { border-color: var(--accent); color: var(--text-primary); }
.board-card-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.board-card-meta { font-size: 0.813rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-card-client { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 14px 18px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-bar .form-select, .filter-bar .form-input {
  width: auto; min-width: 140px; padding: 8px 12px; font-size: 0.875rem;
}
.filter-bar .btn { padding: 8px 14px; }
.view-toggle { display: flex; gap: 0; margin-left: auto; }
.view-toggle .btn {
  border-radius: 0; border-right-width: 0;
}
.view-toggle .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-toggle .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-right-width: 1px; }
.view-toggle .btn.active { background: var(--accent-muted); color: var(--accent); border-color: var(--accent); }

/* ── 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: 420px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 44px 36px;
}
.login-brand {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 36px;
}
.login-brand .brand-icon { width: 44px; height: 44px; }
.login-brand .brand-text { font-size: 1.5rem; }
.login-card .form-group { margin-bottom: 18px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; margin-top: 8px; }

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

/* ── Overdue Indicator ────────────────────────────────────── */
.overdue { color: var(--accent) !important; }
.overdue-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); 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: 420px; }
.error-icon { margin-bottom: 12px; }
.error-icon svg { width: 48px; height: 48px; color: var(--accent); opacity: 0.7; }
.error-code { font-size: 4.5rem; font-weight: 800; color: var(--accent); letter-spacing: -0.04em; }
.error-title { font-size: 1.25rem; font-weight: 600; margin: 4px 0 8px; }
.error-msg { font-size: 1.063rem; 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: 28px;
  width: 100%; max-width: 500px; margin: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.5rem; 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.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
}
.note-badge-general { background: rgba(156,163,175,0.15); color: #9ca3af; }
.note-badge-update { background: rgba(96,165,250,0.15); color: #60a5fa; }
.note-badge-client_comms { background: rgba(168,85,247,0.15); color: #a855f7; }
.note-badge-issue { background: rgba(248,113,113,0.15); color: #f87171; }
.note-badge-meeting { background: rgba(251,146,60,0.15); color: #fb923c; }
.note-badge-delivery { background: rgba(74,222,128,0.15); color: #4ade80; }

/* ── 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; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 18px; }
}

@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; }
}

/* ── 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; }

/* ── 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) ──────────── */
.page-fullh {
  overflow: hidden;
  padding-bottom: 0;
  height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
}

/* ── Job pane full-height fix ────────────────────────────── */
.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;
}
.page-fullh .job-pane {
  height: 100%;
  max-height: none;
  overflow-y: auto;
}

/* ── 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: 12px 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.875rem; }
.client-list-sub { font-size: 0.75rem; 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.5rem; font-weight: 700; letter-spacing: -0.02em; }
.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.938rem;
  width: 100%;
  text-align: right;
  transition: border-color 0.15s, background 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);
}
.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: flex;
  align-items: center;
  gap: 12px;
  z-index: 80;
  transform: translateY(100%);
  transition: transform 0.2s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
.save-bar.visible { 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: 2px;
  padding: 8px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 4px;
}
.pane-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.pane-tab svg { width: 14px; height: 14px; }
.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; }
}

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

/* ── Archived Badge (inline in list rows) ────────────────── */
.badge-archived {
  background: rgba(148,163,184,0.18);
  color: #94a3b8;
  font-size: 0.62rem;
  padding: 2px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
[data-theme="light"] .badge-archived {
  background: rgba(100,116,139,0.12);
  color: #64748b;
}

/* ── 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;
}

/* ── 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); }
}
