/* =============================================
   MORDEN CONSTRUCTION CRM — MAIN STYLESHEET
   WhiteUI-inspired design system
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Brand */
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --brand-blue-pale: #eff6ff;
  --brand-blue-light: #3b82f6;

  /* Layout */
  --sidebar-icon-width: 130px;
  --sidebar-panel-width: 260px;

  /* Backgrounds — depth via subtle layering */
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-hover: #f1f3f5;

  /* Borders */
  --border: #ebebef;
  --border-light: #f0f0f4;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  /* Status colors */
  --green: #059669;
  --green-pale: #ecfdf5;
  --yellow: #d97706;
  --yellow-pale: #fffbeb;
  --red: #dc2626;
  --red-pale: #fef2f2;
  --purple: #7c3aed;
  --purple-pale: #f5f3ff;
  --orange: #ea580c;
  --orange-pale: #fff7ed;
  --cyan: #0891b2;
  --cyan-pale: #ecfeff;

  /* Radii */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Shadows — barely perceptible, depth via background layering not shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.07);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* =============================================
   APP SHELL — TOP HEADER + ICON RAIL + MAIN
   [top header bar — full width]
   [icon rail] [main content]
   ============================================= */

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

/* ── Top Header Bar ── */
#top-header {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px 0 0;
  flex-shrink: 0;
  z-index: 300;
  gap: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 0 12px;
  border-right: 1px solid var(--border);
  height: 100%;
  flex-shrink: 0;
  min-width: var(--sidebar-icon-width);
}

.header-logo {
  width: 30px;
  height: 30px;
  background: #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.header-company {
  display: flex;
  align-items: center;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex: 1;
}

.header-new-msg-btn {
  background: #e2e5e9;
  color: #374151;
  border: none;
  border-radius: var(--radius-xs);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s;
}
.header-new-msg-btn:hover { background: #d1d5db; }

/* Messages dropdown */
.header-messages-wrap {
  position: relative;
}
.header-messages-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background 0.12s;
  white-space: nowrap;
}
.header-messages-btn:hover { background: var(--surface-hover); }
.header-messages-label { font-weight: 500; }
.header-messages-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1200;
  overflow: hidden;
}
.header-messages-dropdown.open { display: block; }
.header-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: background 0.12s;
}
.header-icon-btn:hover { background: var(--surface-hover); }

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.header-user-btn:hover { background: var(--surface-hover); }
.header-user-info { text-align: left; }

/* ── App Body (below header) ── */
#app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Icon Rail (far left, light grey) ── */
#icon-rail {
  width: var(--sidebar-icon-width);
  background: #f0f1f3;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  flex-shrink: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

.rail-label {
  font-size: 10px;
  font-weight: 500;
  color: inherit;
  margin-top: 4px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 0 8px;
  flex: 1;
}

.rail-bottom {
  width: 100%;
  padding: 0 8px;
  margin-top: auto;
}

.rail-btn {
  width: 100%;
  aspect-ratio: unset;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  transition: all 0.15s;
  position: relative;
  padding: 8px 6px;
  gap: 0;
}

.rail-btn svg { width: 19px; height: 19px; }

.rail-btn:hover {
  background: rgba(0,0,0,0.05);
  color: #374151;
}

.rail-btn.active {
  background: #e8f0fe;
  color: #2563eb;
}

.rail-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--brand-blue);
  border-radius: 0 3px 3px 0;
  opacity: 0.7;
}

.nav-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid #f0f1f3;
}

/* ── Sidebar Panel (second column, white) ── */
#sidebar-panel {
  width: var(--sidebar-panel-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-panel-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-welcome {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.sidebar-company {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 16px 20px 8px;
}

/* New Phone Message button in sidebar */
.sidebar-new-msg-btn {
  margin: 0 12px 16px;
  width: calc(100% - 24px);
  background: #e2e5e9;
  color: #374151;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}

.sidebar-new-msg-btn:hover { background: #d1d5db; }
.sidebar-new-msg-btn svg { width: 15px; height: 15px; }

/* Recent messages list in sidebar */
.sidebar-msg-list {
  padding: 0 8px;
  flex: 1;
}

.sidebar-msg-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  margin-bottom: 2px;
}

.sidebar-msg-item:hover { background: var(--surface-hover); }
.sidebar-msg-item.unread { background: var(--brand-blue-pale); }

.sidebar-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
  position: relative;
}

.sidebar-msg-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid white;
}

.sidebar-msg-body { flex: 1; min-width: 0; }

.sidebar-msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-msg-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.sidebar-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── Main Content ── */
#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 28px 28px 40px;
  min-width: 0;
}

/* =============================================
   PAGE HEADER
   ============================================= */

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

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #e8f0fe;
  color: #3b6fd4;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header-icon svg { width: 18px; height: 18px; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* =============================================
   CARDS
   ============================================= */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  width: 100%;
  box-sizing: border-box;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 20px;
}

/* =============================================
   STAT CARDS
   ============================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: 8px;
  border: none;
  padding: 20px 20px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 18px; height: 18px; }

/* Icon accent backgrounds — desaturated ~50% */
.stat-icon.blue  { background: #e8f0fe; color: #3b6fd4; }
.stat-icon.green { background: #e6f4ed; color: #2d8a5e; }
.stat-icon.yellow{ background: #fef6e4; color: #b8860b; }
.stat-icon.red   { background: #fde8e8; color: #c0392b; }
.stat-icon.purple{ background: #ede8fb; color: #6d4ab0; }
.stat-icon.cyan  { background: #e4f4f8; color: #1a7a96; }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-trend {
  font-size: 11px;
  color: var(--text-muted);
}

/* =============================================
   DASHBOARD LAYOUT
   ============================================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* =============================================
   PIPELINE BAR
   ============================================= */

.pipeline-visual {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
  margin-bottom: 10px;
}

.pipeline-visual-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  transition: flex 0.3s;
  min-width: 0;
  overflow: hidden;
}

.pipeline-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pipeline-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.pipeline-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipeline-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pipeline-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pipeline-pill:hover {
  border-color: #9ca3af;
  color: #374151;
}

.pipeline-pill.active {
  background: #e2e5e9;
  border-color: #d1d5db;
  color: #374151;
  font-weight: 600;
}

.pipeline-pill .count {
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 1px 5px;
  font-size: 10px;
}

.pipeline-pill.active .count {
  background: rgba(0,0,0,0.08);
}

/* =============================================
   TABLES
   ============================================= */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover td {
  background: var(--surface-hover);
  cursor: pointer;
}

/* Legacy alias */
.client-table { width: 100%; border-collapse: collapse; }
.client-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}
.client-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.client-table tr:last-child td { border-bottom: none; }
.client-table tbody tr:hover td { background: var(--surface-hover); cursor: pointer; }

.client-name { font-weight: 600; font-size: 13px; }

.client-project-num {
  font-size: 11px;
  color: var(--brand-blue);
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--brand-blue-pale);
  border: 1px solid #bfdbfe;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 600;
}

/* =============================================
   STATUS BADGES
   ============================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

/* Status badges — softer fill, lower contrast */
.badge-new-lead            { background: #e8f0fe; color: #3b5fc0; }
.badge-estimate-requested  { background: #fef0e6; color: #a0522d; }
.badge-estimate-sent       { background: #fef8e7; color: #8a6914; }
.badge-active-project      { background: #e6f4ed; color: #2d6a4f; }
.badge-on-hold             { background: #ede8fb; color: #5a3e9e; }
.badge-complete            { background: #edf7f0; color: #2d6a4f; }
.badge-urgent              { background: #fde8e8; color: #922b21; }
.badge-new                 { background: #e8f0fe; color: #3b5fc0; }
.badge-read                { background: #f1f3f5; color: #5a6472; }
.badge-handled             { background: #e6f4ed; color: #2d6a4f; }
.badge-open                { background: #fef0e6; color: #a0522d; }
.badge-done                { background: #e6f4ed; color: #2d6a4f; }
.badge-in-progress         { background: #fef8e7; color: #8a6914; }

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn svg { width: 14px; height: 14px; }

.btn-primary {
  background: #e2e5e9;
  color: #374151;
  box-shadow: none;
}
.btn-primary:hover { background: #d1d5db; box-shadow: none; }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); border-color: #d1d5db; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; font-weight: 600; }

/* =============================================
   FORMS
   ============================================= */

.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

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

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-control::placeholder { color: var(--text-muted); }

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* =============================================
   SEARCH BAR
   ============================================= */

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  flex: 1;
  max-width: 340px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-bar:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.search-bar svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  width: 100%;
}

.search-bar input::placeholder { color: var(--text-muted); }

/* =============================================
   TEAM AVATARS
   ============================================= */

.team-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 10px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

/* =============================================
   MESSAGE ITEMS (sidebar & list)
   ============================================= */

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}

.message-item:last-child { border-bottom: none; }

.message-item:hover {
  background: var(--surface-hover);
  margin: 0 -20px;
  padding: 12px 20px;
  border-radius: 8px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

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

.message-caller {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-preview {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.message-time { font-size: 11px; color: var(--text-muted); }

/* =============================================
   TASK ITEMS
   ============================================= */

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.task-item:last-child { border-bottom: none; }

.task-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-check:hover { border-color: var(--brand-blue); background: var(--brand-blue-pale); }

.task-title-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.task-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.task-client-link {
  font-size: 11px;
  color: var(--brand-blue);
  font-weight: 500;
}

.task-due {
  font-size: 11px;
  color: var(--text-muted);
}

.task-due.overdue { color: var(--red); font-weight: 600; }

/* =============================================
   CLIENT DETAIL
   ============================================= */

.client-detail-header {
  background: var(--surface);
  border-radius: var(--radius);
  border: none;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.client-detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

/* =============================================
   FOLDER PATH
   ============================================= */

.folder-path {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
}

.folder-path svg { width: 14px; height: 14px; color: var(--yellow); flex-shrink: 0; }

/* =============================================
   MAP LINK BUTTONS
   ============================================= */

.map-links { display: flex; gap: 8px; flex-wrap: wrap; }

.map-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.map-link-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.map-link-btn svg { width: 12px; height: 12px; }

/* =============================================
   MODAL
   ============================================= */

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#modal-overlay.hidden { display: none; }

#modal-container {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

#modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  transition: all 0.12s;
}

#modal-close:hover { background: var(--red-pale); color: var(--red); border-color: #fca5a5; }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-right: 32px;
  letter-spacing: -0.2px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}

.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.warning { background: #92400e; }

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

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.empty-state svg { width: 40px; height: 40px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* =============================================
   PHONE MESSAGE FORM (Pink Sheet)
   ============================================= */

.flag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.flag-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  user-select: none;
  background: var(--surface);
}

.flag-pill:hover { border-color: var(--brand-blue); color: var(--brand-blue); background: var(--brand-blue-pale); }
.flag-pill.active { border-color: var(--brand-blue); background: var(--brand-blue-pale); color: var(--brand-blue); }
.flag-pill.urgent.active { border-color: var(--red); background: var(--red-pale); color: var(--red); }

.flag-pill input[type="checkbox"] { display: none; }

/* =============================================
   MESSAGES VIEW TABLE
   ============================================= */

.messages-table { width: 100%; border-collapse: collapse; }

.messages-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}

.messages-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.messages-table tr:last-child td { border-bottom: none; }
.messages-table tbody tr:hover td { background: var(--surface-hover); cursor: pointer; }
.messages-table tr.msg-new td { background: #fefce8; }
.messages-table tr.msg-urgent td { background: #fef2f2; }

/* =============================================
   SETTINGS
   ============================================= */

.team-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.team-member-row:last-child { border-bottom: none; }

/* =============================================
   SCROLLBAR
   ============================================= */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* =============================================
   UTILITY
   ============================================= */

.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.font-mono    { font-family: 'SF Mono', 'Fira Code', monospace; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================
   MAP BUTTONS (inline link style)
   ============================================= */

.btn-map-opengis, .btn-map-google {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-map-opengis:hover { background: #eff6ff; color: var(--brand-blue); border-color: #bfdbfe; }
.btn-map-google:hover  { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

/* =============================================
   DIVIDER
   ============================================= */

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

/* =============================================
   PINK SHEET (message detail modal)
   ============================================= */

.pink-sheet {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* =============================================
   FILE BROWSER
   ============================================= */

.file-row { transition: background 0.1s; }
.file-row:hover { background: var(--surface-2); }
.file-row:last-child { border-bottom: none !important; }

/* =============================================
   PHOTO GALLERY
   ============================================= */

.photo-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface-2);
}

.photo-upload-zone:hover,
.photo-upload-zone.drag-over {
  border-color: var(--brand-blue);
  background: var(--brand-blue-pale);
}

.photo-upload-zone svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.photo-upload-zone p { font-size: 13px; color: var(--text-secondary); }
.photo-upload-zone span { font-size: 11px; color: var(--text-muted); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.photo-thumb:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: flex-end;
  padding: 8px;
}

.photo-thumb:hover .photo-thumb-overlay { opacity: 1; }

.photo-thumb-meta {
  color: white;
  font-size: 10px;
  line-height: 1.3;
}

.photo-thumb-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: rgba(220,38,38,0.85);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.photo-thumb:hover .photo-thumb-delete { display: flex; }

/* Lightbox */
#photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#photo-lightbox.hidden { display: none; }

#photo-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

#photo-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#photo-lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* =============================================
   MOBILE RESPONSIVE — BREAKPOINTS
   ============================================= */

/* Tablet: hide sidebar panel, keep icon rail */
@media (max-width: 900px) {
  #sidebar-panel {
    display: none;
  }

  #main-content {
    padding: 20px 16px 32px;
  }

  .client-detail-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }

  .settings-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile: collapse icon rail to bottom nav bar */
@media (max-width: 600px) {
  body { overflow: auto; }

  #app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  /* Hide desktop icon rail */
  #icon-rail {
    display: none;
  }

  /* Main content takes full width, add bottom padding for nav */
  #main-content {
    flex: 1;
    padding: 16px 12px 80px;
    overflow-y: auto;
    min-height: calc(100vh - 60px);
  }

  /* Bottom navigation bar */
  #mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #1a1d27;
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 500;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0 4px;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 8px;
    transition: color 0.15s;
    position: relative;
  }

  .mobile-nav-btn svg { width: 20px; height: 20px; }

  .mobile-nav-btn span {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3px;
  }

  .mobile-nav-btn.active { color: #60a5fa; }

  .mobile-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--red);
    color: white;
    font-size: 8px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #f0f1f3;
  }

  /* Floating New Message button */
  #mobile-fab {
    position: fixed;
    bottom: 72px;
    right: 16px;
    width: 52px;
    height: 52px;
    background: var(--brand-blue);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    z-index: 490;
    transition: transform 0.15s, box-shadow 0.15s;
  }

  #mobile-fab:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(37,99,235,0.5); }

  /* Stats: single column on small screens */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card { padding: 14px; }

  /* Tables: hide less important columns */
  .messages-table th:nth-child(3),
  .messages-table td:nth-child(3),
  .messages-table th:nth-child(5),
  .messages-table td:nth-child(5) {
    display: none;
  }

  .clients-table th:nth-child(3),
  .clients-table td:nth-child(3),
  .clients-table th:nth-child(5),
  .clients-table td:nth-child(5) {
    display: none;
  }

  /* Modal: full screen on mobile */
  #modal-overlay { padding: 0; align-items: flex-end; }

  #modal-container {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px 16px;
  }

  /* Page header: stack on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .page-header-actions .btn { flex: 1; justify-content: center; }

  /* Client detail: single column */
  .client-detail-grid { grid-template-columns: 1fr; }

  /* Photo grid: 2 columns on mobile */
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Flag grid: 2 columns on mobile */
  .flag-grid { grid-template-columns: repeat(2, 1fr); }

  /* Toast: full width on mobile */
  #toast-container { left: 12px; right: 12px; bottom: 72px; }
  .toast { max-width: 100%; }

  /* Folder path: smaller font */
  .folder-path { font-size: 10px; }
}

/* ── Photo Gallery ─────────────────────────────────────────────────────────── */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary, #f3f4f6);
  border: 1px solid var(--border);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.photo-thumb:hover img { transform: scale(1.04); }

.photo-thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  padding: 20px 8px 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-thumb:hover .photo-thumb-overlay { opacity: 1; }

.photo-thumb-name {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-thumb-meta {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.photo-action-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 4px;
  color: #fff;
  padding: 3px 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s;
}

.photo-action-btn:hover { background: rgba(255,255,255,0.35); }

/* Lightbox */
#photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#photo-lightbox.hidden { display: none; }

#photo-lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#photo-lightbox-caption {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
}

#photo-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#photo-lightbox-close:hover { background: rgba(255,255,255,0.25); }

@media (max-width: 600px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .photo-thumb-overlay { opacity: 1; }
}

/* =============================================
   LEAD / INQUIRY MODULE — Additional Styles
   ============================================= */

.badge-lead-new       { background: #e8f0fe; color: #3b5fc0; }
.badge-lead-contacted { background: #fef8e7; color: #8a6914; }
.badge-lead-quoted    { background: #fef0e6; color: #a0522d; }
.badge-lead-won       { background: #e6f4ed; color: #2d6a4f; }
.badge-lead-lost      { background: #fde8e8; color: #922b21; }
.badge-lead-deferred  { background: #ede8fb; color: #5a3e9e; }

.btn-success {
  background: #059669; color: #fff; border: none;
  border-radius: var(--radius-xs); padding: 8px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.btn-success:hover { background: #047857; }

/* Lead detail header (reuses client-detail-header) */
.lead-detail-header {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

/* ============================================================
   HELP CENTER
   ============================================================ */
.help-layout { display:flex; height:100%; min-height:0; overflow:hidden; }
.help-sidebar { width:240px; flex-shrink:0; background:var(--surface); border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
.help-sidebar-header { padding:20px 16px 12px; border-bottom:1px solid var(--border); }
.help-sidebar-title { font-size:15px; font-weight:700; color:var(--text-primary); }
.help-sidebar-subtitle { font-size:11px; color:var(--text-muted); margin-top:2px; }
.help-search-wrap { padding:10px 12px; border-bottom:1px solid var(--border); }
.help-search-input { width:100%; padding:7px 10px; border:1px solid var(--border); border-radius:8px; font-size:12px; background:#f8f9fb; color:var(--text-primary); box-sizing:border-box; outline:none; }
.help-search-input:focus { border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,0.1); }
.help-nav { flex:1; overflow-y:auto; padding:8px 0; }
.help-nav-item { display:flex; align-items:center; gap:10px; width:100%; padding:9px 14px; border:none; background:transparent; cursor:pointer; text-align:left; color:var(--text-secondary); font-size:13px; transition:background 0.12s,color 0.12s; position:relative; }
.help-nav-item:hover { background:#f1f3f5; color:var(--text-primary); }
.help-nav-item.active { background:#e8f0fe; color:#2563eb; font-weight:600; }
.help-nav-item.active::before { content:""; position:absolute; left:0; top:50%; transform:translateY(-50%); width:3px; height:22px; background:#2563eb; border-radius:0 3px 3px 0; }
.help-nav-icon { font-size:15px; width:20px; text-align:center; flex-shrink:0; }
.help-nav-label { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.help-content { flex:1; overflow-y:auto; padding:32px 40px; min-width:0; background:#f8f9fb; }
.help-article { max-width:760px; }
.help-article-header { display:flex; align-items:center; gap:12px; margin-bottom:24px; padding-bottom:16px; border-bottom:2px solid var(--border); }
.help-article-icon { font-size:28px; }
.help-article-title { font-size:22px; font-weight:700; color:var(--text-primary); }
.help-article-body h2 { font-size:20px; font-weight:700; color:var(--text-primary); margin:0 0 16px; }
.help-article-body h3 { font-size:13px; font-weight:700; color:var(--text-secondary); margin:24px 0 10px; text-transform:uppercase; letter-spacing:0.5px; }
.help-article-body p { font-size:14px; line-height:1.65; color:var(--text-secondary); margin:0 0 14px; }
.help-article-body ul,.help-article-body ol { font-size:14px; line-height:1.65; color:var(--text-secondary); margin:0 0 14px; padding-left:22px; }
.help-article-body li { margin-bottom:6px; }
.help-article-body code { background:#f1f5f9; border:1px solid var(--border); border-radius:4px; padding:1px 6px; font-size:12px; font-family:monospace; color:#1e40af; }
.help-article-body kbd { background:#f1f5f9; border:1px solid #cbd5e1; border-bottom-width:2px; border-radius:4px; padding:1px 7px; font-size:12px; color:var(--text-primary); }
.help-article-body strong { color:var(--text-primary); font-weight:600; }
.help-article-footer { margin-top:40px; padding-top:16px; border-top:1px solid var(--border); }
.help-table-wrap { overflow-x:auto; margin:0 0 16px; border-radius:8px; border:1px solid var(--border); }
.help-table { width:100%; border-collapse:collapse; font-size:13px; }
.help-table thead tr { background:#f8fafc; }
.help-table th { padding:10px 14px; text-align:left; font-weight:600; color:var(--text-secondary); font-size:12px; text-transform:uppercase; letter-spacing:0.4px; border-bottom:1px solid var(--border); }
.help-table td { padding:10px 14px; color:var(--text-secondary); border-bottom:1px solid var(--border); line-height:1.5; }
.help-table tbody tr:last-child td { border-bottom:none; }
.help-table tbody tr:hover td { background:#f1f3f5; }
.help-tip { background:#eff6ff; border:1px solid #bfdbfe; border-left:4px solid #3b82f6; border-radius:6px; padding:12px 14px; font-size:13px; color:#1e40af; margin:16px 0; line-height:1.6; }
.help-warning { background:#fffbeb; border:1px solid #fde68a; border-left:4px solid #f59e0b; border-radius:6px; padding:12px 14px; font-size:13px; color:#92400e; margin:16px 0; line-height:1.6; }
.help-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:80px 40px; text-align:center; color:var(--text-muted); }
.help-search-results-header { font-size:13px; color:var(--text-muted); margin-bottom:16px; }
.help-search-results-header strong { color:var(--text-primary); }
.help-search-result-card { display:flex; align-items:flex-start; gap:14px; padding:16px; background:var(--surface); border:1px solid var(--border); border-radius:10px; margin-bottom:10px; cursor:pointer; transition:box-shadow 0.12s,border-color 0.12s; }
.help-search-result-card:hover { border-color:#2563eb; box-shadow:0 2px 8px rgba(37,99,235,0.1); }
.help-search-result-icon { font-size:22px; flex-shrink:0; width:32px; text-align:center; }
.help-search-result-title { font-size:14px; font-weight:600; color:var(--text-primary); margin-bottom:4px; }
.help-search-result-excerpt { font-size:13px; color:var(--text-muted); line-height:1.5; }
.help-search-result-excerpt mark { background:#fef9c3; color:var(--text-primary); border-radius:2px; padding:0 2px; }
/* Contextual Tooltips */
.help-tooltip-wrap { display:inline-flex; align-items:center; position:relative; vertical-align:middle; }
.help-tooltip-btn { width:18px; height:18px; border-radius:50%; background:#e0e7ff; color:#3730a3; border:none; cursor:pointer; font-size:11px; font-weight:700; line-height:1; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; transition:background 0.12s; padding:0; }
.help-tooltip-btn:hover { background:#c7d2fe; }
.help-tooltip-popover { display:none; position:absolute; left:26px; top:50%; transform:translateY(-50%); background:var(--surface); border:1px solid var(--border); border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,0.12); padding:12px 14px; width:260px; z-index:2000; flex-direction:column; gap:8px; }
.help-tooltip-popover.open { display:flex; }
.help-tooltip-text { font-size:13px; line-height:1.55; color:var(--text-secondary); }
.help-tooltip-link { font-size:12px; font-weight:600; color:#2563eb; text-decoration:none; display:inline-block; margin-top:4px; }
.help-tooltip-link:hover { text-decoration:underline; }
@media (max-width:768px) { .help-sidebar { display:none; } .help-content { padding:20px 16px; } }
