/* =============================================
   SOLABRAN CRM - MASTER STYLESHEET
   A Green Alternative
   ============================================= */

:root {
  --primary: #1a7a3c;
  --primary-dark: #145f2f;
  --primary-light: #d1fae5;
  --primary-lighter: #ecfdf5;
  --secondary: #64748b;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0369a1;
  --info-light: #e0f2fe;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --dark: #0d1f12;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #0d1f12 0%, #1a7a3c 55%, #22a84f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-brand { text-align: center; margin-bottom: 2rem; color: white; }
.login-logo-img {
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
}
.login-logo-brand {
  max-width: 240px; width: 100%; height: auto;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.4));
}
.login-tagline { font-size: 0.875rem; opacity: 0.65; margin-top: 0.25rem; letter-spacing: 0.05em; }
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.login-card h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--dark); }
.demo-accounts { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.demo-accounts p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 500; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.demo-grid button {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.4rem 0.5rem;
  font-size: 0.8rem; color: var(--text); font-weight: 500;
  transition: all 0.15s;
}
.demo-grid button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* =============================================
   APP LAYOUT
   ============================================= */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: #0d1f12;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.sidebar-header {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--topbar-h);
}
.sidebar-logo { display: flex; align-items: center; justify-content: flex-start; padding: 0.1rem 0; }
.sidebar-logo-img { max-width: 140px; width: 100%; height: auto; object-fit: contain; }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.1rem; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section {
  padding: 0.75rem 1.25rem 0.4rem;
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.3);
  text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.875rem; font-weight: 500;
  border-radius: 0; transition: all 0.15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active { background: rgba(74,222,128,0.15); color: #86efac; border-right: 3px solid #4ade80; }
.nav-item i { width: 18px; text-align: center; font-size: 0.875rem; }
.nav-badge {
  margin-left: auto;
  background: var(--danger); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 0.1rem 0.4rem; border-radius: 10px;
  min-width: 18px; text-align: center;
  display: none;
}
.nav-badge.show { display: block; }
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 0.75rem;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: rgba(255,255,255,0.45); }
.btn-logout {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 1rem; padding: 0.25rem; transition: color 0.15s;
}
.btn-logout:hover { color: #f87171; }

/* MAIN WRAPPER */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-menu-btn { display: none; background: none; border: none; font-size: 1.2rem; color: var(--text-muted); }
.topbar-title { font-size: 1rem; font-weight: 700; flex: 1; color: var(--dark); }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar-search-btn { background: none; border: none; color: var(--text-muted); font-size: 1rem; padding: 0.25rem; }
.topbar-user { cursor: pointer; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 190;
  background: rgba(0,0,0,0.5);
}

/* CONTENT AREA */
.content-area { flex: 1; padding: 1.5rem; overflow-y: auto; overflow-x: hidden; }
.content-area.kanban-active { overflow-x: auto; }

/* =============================================
   FORMS & INPUTS
   ============================================= */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.35rem; }
.form-control {
  width: 100%; padding: 0.6rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem; color: var(--text);
  background: white; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; appearance: none; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-right: 2.5rem; }
.input-icon-btn { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
  text-decoration: none;
}
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border-light); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-info { background: var(--info); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; justify-content: center; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-directions {
  background: #0ea5e9; color: white;
  border: none; border-radius: 6px;
  padding: 0.4rem 0.875rem; font-size: 0.8rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background 0.15s;
}
.btn-directions:hover { background: #0284c7; }
.btn-directions.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
/* Inline map pin button — sits next to address text */
.btn-inline-map {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 0.9rem;
  padding: 0.1rem 0.3rem; border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  display: inline-flex; align-items: center;
}
.btn-inline-map:hover { color: white; background: var(--primary); }

/* =============================================
   CARDS
   ============================================= */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 0.95rem; font-weight: 700; color: var(--dark); }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* =============================================
   TABLES
   ============================================= */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  padding: 0.75rem 1rem;
  text-align: left; font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--bg); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .col-action { width: 120px; text-align: right; }

/* =============================================
   BADGES / STATUS
   ============================================= */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-active, .badge-paid, .badge-accepted, .badge-completed, .badge-approved { background: var(--success-light); color: var(--success); }
.badge-inactive, .badge-on-hold, .badge-needs-revision, .badge-expired, .badge-rejected { background: var(--warning-light); color: var(--warning); }
.badge-overdue, .badge-cancelled { background: var(--danger-light); color: var(--danger); }
.badge-draft, .badge-new { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-sent, .badge-pending-approval, .badge-scheduled { background: var(--info-light); color: var(--info); }
.badge-viewed { background: var(--purple-light); color: var(--purple); }
.badge-part-paid { background: var(--orange-light); color: var(--orange); }
.badge-in-progress { background: var(--primary-light); color: var(--primary); }
.badge-archived { background: #f1f5f9; color: #94a3b8; }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--info-light); color: var(--info); }

/* Priority */
.priority-low { color: var(--text-muted); }
.priority-medium { color: var(--info); }
.priority-high { color: var(--warning); }
.priority-urgent { color: var(--danger); font-weight: 700; }

/* =============================================
   STATS CARDS
   ============================================= */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 1.25rem;
  display: flex; align-items: flex-start; gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-info { flex: 1; }
.stat-body { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }
.stat-sub { font-size: 0.75rem; color: var(--text-light); margin-top: 0.15rem; }

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.page-header h2 { font-size: 1.25rem; font-weight: 800; color: var(--dark); }
.page-header p { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* =============================================
   FILTERS BAR
   ============================================= */
.filter-bar {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  display: flex; gap: 0.75rem; flex-wrap: wrap;
  align-items: center; margin-bottom: 1rem;
}
.filter-bar .form-control { min-width: 160px; max-width: 220px; }
.filter-bar .search-input { flex: 1; min-width: 200px; }
.filter-actions { margin-left: auto; display: flex; gap: 0.5rem; }

/* =============================================
   MODAL
   ============================================= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  animation: fadeIn 0.15s ease;
}
.modal-container {
  position: fixed; inset: 0;
  z-index: 910;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  pointer-events: none;
}
.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 640px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
.modal-box.modal-lg { max-width: 860px; }
.modal-box.modal-xl { max-width: 1100px; }
.modal-box.modal-sm { max-width: 420px; }
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; padding: 0.25rem; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem; justify-content: flex-end;
  flex-shrink: 0;
}

/* =============================================
   TOAST
   ============================================= */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--dark); color: white;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 0.75rem;
  min-width: 260px; max-width: 380px;
  animation: slideLeft 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }
.toast i { font-size: 1rem; }

/* =============================================
   ALERTS
   ============================================= */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #7dd3fc; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }

/* =============================================
   USER AVATAR
   ============================================= */
.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.user-avatar.sm { width: 32px; height: 32px; font-size: 0.7rem; }
.user-avatar.lg { width: 48px; height: 48px; font-size: 0.9rem; }
.user-avatar.xl { width: 56px; height: 56px; font-size: 1rem; }

/* =============================================
   DETAIL PAGE
   ============================================= */
.detail-header {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.detail-header-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.detail-title { font-size: 1.3rem; font-weight: 800; color: var(--dark); }
.detail-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-light); }
.meta-item { }
.meta-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.2rem; }
.meta-value { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 1.25rem; }
.detail-main { min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 1rem; }

/* TABS */
.tab-nav { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; gap: 0; overflow-x: auto; }
.tab-btn {
  padding: 0.65rem 1rem; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: all 0.15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* =============================================
   ACTIVITY TIMELINE
   ============================================= */
.timeline { padding: 0.5rem 0; }
.timeline-item { display: flex; gap: 0.75rem; padding-bottom: 1.25rem; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 17px; top: 34px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-icon {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; flex-shrink: 0; z-index: 1;
}
.timeline-icon.blue { background: var(--primary-light); color: var(--primary); }
.timeline-icon.green { background: var(--success-light); color: var(--success); }
.timeline-icon.yellow { background: var(--warning-light); color: var(--warning); }
.timeline-icon.red { background: var(--danger-light); color: var(--danger); }
.timeline-icon.purple { background: var(--purple-light); color: var(--purple); }
.timeline-icon.gray { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-text { font-size: 0.875rem; color: var(--text); }
.timeline-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* =============================================
   LINE ITEMS TABLE
   ============================================= */
.line-items-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.line-items-table th {
  background: var(--bg); padding: 0.6rem 0.75rem;
  text-align: left; font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.line-items-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.line-items-table tr:last-child td { border-bottom: none; }
.line-items-table input { border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.5rem; font-size: 0.85rem; width: 100%; }
.line-items-table input:focus { outline: none; border-color: var(--primary); }
.li-totals { margin-top: 1rem; margin-left: auto; max-width: 340px; }
.li-total-row { display: flex; justify-content: space-between; padding: 0.4rem 0; font-size: 0.875rem; }
.li-total-row.grand { font-size: 1rem; font-weight: 800; border-top: 2px solid var(--border); margin-top: 0.5rem; padding-top: 0.75rem; color: var(--dark); }

/* =============================================
   PAYMENT SUMMARY
   ============================================= */
.payment-summary { background: var(--bg); border-radius: var(--radius); padding: 1rem; }
.ps-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; font-size: 0.875rem; }
.ps-row.grand { font-weight: 800; font-size: 1rem; color: var(--dark); border-top: 2px solid var(--border); margin-top: 0.5rem; padding-top: 0.75rem; }
.ps-row.green { color: var(--success); }
.ps-row.red { color: var(--danger); font-weight: 700; }

/* =============================================
   QUICK ADD MENU
   ============================================= */
.quick-add-menu { position: fixed; inset: 0; z-index: 800; display: none; }
.quick-add-menu.show { display: block; }
.qa-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.qa-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: white; border-radius: 16px 16px 0 0;
  padding: 1.5rem; z-index: 1;
  animation: slideUpPanel 0.25s ease;
}
.qa-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.qa-header h3 { font-size: 1rem; font-weight: 700; }
.qa-header button { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; }
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.qa-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem 0.5rem;
  font-size: 0.8rem; font-weight: 600; color: var(--text);
  transition: all 0.15s;
}
.qa-grid button i { font-size: 1.25rem; color: var(--primary); }
.qa-grid button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; display: block; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; max-width: 360px; margin: 0 auto 1.25rem; }

/* =============================================
   CUSTOMER CARD (KANBAN STYLE)
   ============================================= */
.customer-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem;
  cursor: pointer; transition: all 0.15s;
}
.customer-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.customer-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.customer-info h3 { font-size: 0.9rem; font-weight: 700; }
.customer-info p { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.1rem; }
.tag { display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; background: var(--primary-light); color: var(--primary); border-radius: 20px; font-size: 0.7rem; font-weight: 600; }

/* =============================================
   BACK BUTTON
   ============================================= */
.back-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  background: none; border: none; cursor: pointer; margin-bottom: 1rem;
  padding: 0; transition: color 0.15s;
}
.back-btn:hover { color: var(--primary); }
.back-btn i { font-size: 0.8rem; }

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  .print-doc { max-width: 800px; margin: 0 auto; font-family: 'Inter', sans-serif; }
  .print-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 3px solid #1e40af; }
  .print-company h1 { font-size: 1.5rem; font-weight: 800; color: #1e40af; }
  .print-doc-type { text-align: right; }
  .print-doc-type h2 { font-size: 2rem; font-weight: 800; color: #1e293b; }
  .print-addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
  .print-section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #94a3b8; margin-bottom: 0.5rem; }
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
  .print-table th { background: #1e40af; color: white; padding: 0.6rem 0.75rem; text-align: left; font-size: 0.8rem; }
  .print-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #e2e8f0; font-size: 0.85rem; }
  .print-totals { margin-left: auto; max-width: 300px; }
  .print-total-row { display: flex; justify-content: space-between; padding: 0.35rem 0; font-size: 0.875rem; }
  .print-total-row.grand { font-size: 1.1rem; font-weight: 800; border-top: 2px solid #1e40af; margin-top: 0.5rem; padding-top: 0.75rem; color: #1e40af; }
  .print-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; font-size: 0.8rem; color: #64748b; }
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideLeft { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUpPanel { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; color: var(--text-muted); gap: 0.75rem; }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { flex-direction: row; flex-wrap: wrap; }
  .detail-side .card { flex: 1; min-width: 280px; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-close { display: block; }
  .sidebar-overlay.show { display: block; }
  .main-wrapper { margin-left: 0; }
  .topbar-menu-btn { display: block; }
  .topbar { padding: 0 1rem; }
  .content-area { padding: 1rem; }
  .form-row, .form-row-3, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .solar-viz-grid { grid-template-columns: 1fr !important; }
  .solar-viz-grid .compass-card { width: 100% !important; max-width: 100% !important; }
  .solar-viz-grid .compass-card canvas { max-width: 180px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .btn-text { display: none; }
  .filter-bar { padding: 0.6rem; }
  .filter-bar .form-control { min-width: 130px; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
  .qa-grid { grid-template-columns: repeat(3, 1fr); }
  .detail-side { flex-direction: column; }
  .lc-cat-tabs { gap: 0.4rem; }
  .lc-cat-tab { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
  .lc-step-card { padding: 1rem; }
}

/* =============================================
   LOAD CALCULATOR
   ============================================= */
.lc-step-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.lc-step-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 0.25rem;
}
.lc-step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lc-step-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--dark);
}
.lc-step-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.lc-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.lc-cat-tab {
  padding: 0.4rem 0.875rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.lc-cat-tab:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.lc-cat-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.lc-appliance-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  min-height: 90px;
}
.lc-appliance-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transform: translateY(-1px);
}
.lc-mini-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
  text-align: center;
  background: white;
  transition: border-color 0.15s;
}
.lc-mini-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ── Load Calculator Main Tabs ── */
.lc-main-tab {
  padding: 0.55rem 1.1rem;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: -2px;
  border-radius: 0;
}
.lc-main-tab:hover {
  color: var(--primary);
  background: var(--primary-lighter);
  border-radius: 6px 6px 0 0;
}
.lc-main-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

/* ── Topology guide responsive tables ── */
@media (max-width: 768px) {
  .lc-main-tab { padding: 0.45rem 0.7rem; font-size: 0.78rem; }
  .lc-main-tab i { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .modal-box { margin: 0; border-radius: 16px 16px 0 0; max-height: 95vh; align-self: flex-end; width: 100%; }
  .modal-container { align-items: flex-end; padding: 0; }
  .tab-btn { padding: 0.55rem 0.75rem; font-size: 0.8rem; }
}

/* =============================================
   MOBILE BOTTOM NAV (optional enhancement)
   ============================================= */
@media (max-width: 768px) {
  .data-table .hide-mobile { display: none; }
  .content-area { padding-bottom: 1.5rem; }
}

/* =============================================
   RESOURCE LIBRARY
   ============================================= */
.rl-manual-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.12s, border-color 0.15s;
}
.rl-manual-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: #cbd5e1;
}

/* =============================================
   MISC HELPERS
   ============================================= */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.fw-semi { font-weight: 600; }
.fs-sm { font-size: 0.8rem; }
.fs-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.color-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Info List */
.info-list { list-style: none; }
.info-list li { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0; border-bottom: 1px solid var(--border-light); font-size: 0.875rem; }
.info-list li:last-child { border-bottom: none; }
.info-list .info-label { color: var(--text-muted); min-width: 120px; font-size: 0.8rem; flex-shrink: 0; }
.info-list .info-value { font-weight: 500; word-break: break-word; }

/* Confirmation */
.confirm-body { text-align: center; padding: 1rem 0; }
.confirm-body i { font-size: 2.5rem; color: var(--danger); margin-bottom: 1rem; }
.confirm-body h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.confirm-body p { color: var(--text-muted); font-size: 0.875rem; }

/* Section Title */
.section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }

/* Number input */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* =============================================
   KANBAN BOARD STYLES
   ============================================= */

/* Page Header */
.kanban-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem;
}
.kanban-header-left h2 { font-size: 1.25rem; font-weight: 800; color: var(--dark); margin: 0; }
.kanban-header-left p  { font-size: 0.8rem; color: var(--text-muted); margin: 0.15rem 0 0; }
.kanban-header-right   { display: flex; align-items: center; gap: 0.75rem; }

/* View Toggle */
.kanban-view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kvt-btn {
  background: white; border: none; padding: 0.45rem 0.75rem;
  color: var(--text-muted); font-size: 0.875rem; cursor: pointer;
  transition: all 0.15s;
}
.kvt-btn:hover  { background: var(--bg); color: var(--text); }
.kvt-btn.active { background: var(--primary); color: white; }

/* Filters */
.kanban-filters {
  display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap;
  background: white; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.65rem 1rem; margin-bottom: 0.875rem;
}
.kanban-search-wrap {
  position: relative; flex: 1; min-width: 200px;
}
.kanban-search-wrap i {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.8rem; pointer-events: none;
}
.kanban-search-input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.5rem 0.75rem 0.5rem 2.2rem;
  font-size: 0.875rem; color: var(--text); font-family: inherit;
  transition: border-color 0.15s;
}
.kanban-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,64,175,0.1); }
.kanban-filter-select { min-width: 140px; max-width: 180px; height: 36px; font-size: 0.8rem; }

/* Stats row */
.kanban-stats-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.kanban-stat-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem; border-radius: 20px;
  border: 1px solid; font-size: 0.8rem; font-weight: 600;
  white-space: nowrap;
}

/* Board */
.kanban-board {
  display: flex; gap: 0.875rem; align-items: flex-start;
  overflow-x: auto; padding-bottom: 1.5rem;
  min-height: calc(100vh - 320px);
  -webkit-overflow-scrolling: touch;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Column */
.kb-column {
  flex: 0 0 280px; width: 280px;
  background: var(--bg); border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 280px);
  overflow: hidden;
}

.kb-col-header {
  padding: 0.875rem 1rem 0.75rem;
  background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.kb-col-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; font-weight: 700; color: var(--dark);
}
.kb-col-title i { font-size: 0.8rem; }
.kb-col-badges { display: flex; align-items: center; gap: 0.5rem; }
.kb-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 20px; border: 1px solid;
  font-size: 0.72rem; font-weight: 700;
}
.kb-col-add-btn {
  width: 24px; height: 24px; border-radius: 6px;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.kb-col-add-btn:hover { background: var(--primary); border-color: var(--primary); color: white; }

.kb-col-body {
  flex: 1; overflow-y: auto; padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.65rem;
  transition: background 0.15s;
  -webkit-overflow-scrolling: touch;
}
.kb-col-body::-webkit-scrollbar { width: 4px; }
.kb-col-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
.kb-col-body.drag-over { background: rgba(30,64,175,0.04); }

.kb-col-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.5rem; padding: 2rem 1rem;
  color: var(--text-light); font-size: 0.8rem;
  border: 2px dashed var(--border); border-radius: var(--radius);
  text-align: center; min-height: 100px;
  transition: all 0.15s;
}
.kb-col-empty i { font-size: 1.25rem; opacity: 0.4; }
.kb-col-empty.drag-over {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary);
}

/* Card */
.kb-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: grab; user-select: none;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  position: relative;
  /* overflow:hidden removed — it was clipping the card context menu dropdown */
  display: flex;
}
.kb-card:hover {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.kb-card:active { cursor: grabbing; }
.kb-card-dragging {
  opacity: 0.45; transform: rotate(2deg) scale(0.97);
  box-shadow: var(--shadow-lg);
}

.kb-card-stripe {
  width: 3px; flex-shrink: 0;
}
.kb-card-inner {
  flex: 1; padding: 0.75rem; min-width: 0;
}

.kb-card-title {
  font-size: 0.875rem; font-weight: 700; color: var(--dark);
  line-height: 1.3; margin-bottom: 0.5rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-card-customer {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem;
}
.kb-customer-dot {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 800; color: white;
  flex-shrink: 0;
}

.kb-card-tags {
  display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.65rem;
}
.kb-tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.45rem; border-radius: 20px; border: 1px solid transparent;
  font-size: 0.68rem; font-weight: 600; white-space: nowrap;
}
.kb-tag-overdue {
  background: var(--danger-light); color: var(--danger);
  border-color: #fca5a5;
}
.kb-tag-date {
  background: var(--bg); color: var(--text-muted); border-color: var(--border);
}

.kb-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 0.5rem; border-top: 1px solid var(--border-light);
}
.kb-card-meta {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: var(--text-light);
}
.kb-card-actions {
  display: flex; align-items: center; gap: 0.4rem;
}

.kb-assignee {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 700; cursor: default;
  border: 2px solid white; box-shadow: 0 0 0 1px var(--border);
  flex-shrink: 0;
}
.kb-assignee-empty {
  background: var(--bg); color: var(--text-muted);
  border: 1px dashed var(--border); box-shadow: none;
  font-size: 0.65rem;
}

/* Card context menu */
.kb-card-menu-wrap { position: relative; }
.kb-menu-btn {
  width: 26px; height: 26px;
  background: none; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted); font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s;
}
.kb-menu-btn:hover { background: var(--bg); color: var(--text); border-color: var(--text-muted); }

.kb-card-menu {
  /* Fixed positioning so it escapes overflow:auto on .kb-col-body */
  position: fixed;
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 190px; z-index: 600;
  display: none; flex-direction: column;
  overflow: hidden; animation: slideUp 0.12s ease;
}
.kb-card-menu.open { display: flex; }
.kb-card-menu button {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.875rem; font-size: 0.82rem; font-weight: 500;
  background: none; border: none; color: var(--text);
  cursor: pointer; text-align: left; transition: background 0.1s;
  width: 100%;
}
.kb-card-menu button:hover { background: var(--bg); color: var(--primary); }
.kb-card-menu button i { width: 14px; text-align: center; font-size: 0.78rem; }
.kb-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 0; flex-shrink: 0; }
.kb-menu-label {
  padding: 0.3rem 0.875rem 0.15rem;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}

/* Drop placeholder */
.kb-drop-placeholder {
  height: 80px; border: 2px dashed var(--primary);
  border-radius: var(--radius); background: var(--primary-light);
  flex-shrink: 0; pointer-events: none;
  animation: fadeIn 0.15s ease;
}

/* View toggle label */
.kvt-label { font-size: 0.78rem; font-weight: 600; }

/* Scroll hint */
.kb-scroll-hint {
  display: none; text-align: center; padding: 0.5rem;
  font-size: 0.75rem; color: var(--text-light);
  margin-top: 0.5rem;
}

/* ---- KANBAN RESPONSIVE ---- */
@media (max-width: 768px) {
  .kanban-board {
    scroll-snap-type: x mandatory;
    gap: 0.65rem;
    padding-bottom: 1rem;
  }
  .kb-column {
    flex: 0 0 calc(100vw - 3rem);
    width: calc(100vw - 3rem);
    scroll-snap-align: start;
    max-height: calc(100vh - 240px);
  }
  .kanban-filters {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  .kanban-filter-select { min-width: 120px; }
  .kb-card-menu { right: auto; left: 0; }
  .kb-scroll-hint { display: block; }
  .kvt-label { display: none; }
}

@media (max-width: 480px) {
  .kanban-stats-row { gap: 0.35rem; }
  .kanban-stat-pill { font-size: 0.72rem; padding: 0.25rem 0.5rem; }
  .kb-column { flex: 0 0 calc(100vw - 2rem); width: calc(100vw - 2rem); }
}

/* =============================================
   PRODUCT CATALOG
   ============================================= */

/* Category sections */
.catalog-category-section {
  margin-bottom: 2rem;
}
.catalog-category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.catalog-cat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.catalog-cat-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.catalog-cat-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.catalog-row-inactive { opacity: 0.5; }
.catalog-table td { vertical-align: middle; }

/* ─── Line Item Editor Enhancements ─── */
.li-row td { vertical-align: middle; }

.li-desc-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.li-desc-input {
  flex: 1;
  min-width: 0;
}
.li-catalog-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--primary-lighter);
  color: var(--primary);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  transition: all 0.15s;
}
.li-catalog-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.li-remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: background 0.15s;
}
.li-remove-btn:hover { background: var(--danger-light); }

.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: all 0.15s;
}
.btn-outline-primary:hover {
  background: var(--primary-lighter);
}

/* ─── Product Picker Modal ─── */
.product-picker-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 65vh;
}
.product-picker-search {
  position: relative;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.product-picker-search-icon {
  position: absolute;
  left: 1.75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}
.product-picker-search .form-control {
  padding-left: 2.25rem;
}
.product-picker-categories {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  scrollbar-width: none;
}
.product-picker-categories::-webkit-scrollbar { display: none; }
.picker-cat-tab {
  flex-shrink: 0;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 0.3rem;
}
.picker-cat-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-lighter);
}
.picker-cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.picker-cat-tab.active i { color: white !important; }

.product-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border-light);
}
.picker-item:hover {
  background: var(--primary-lighter);
}
.picker-item:last-child { border-bottom: none; }
.picker-item-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.picker-item-body {
  flex: 1;
  min-width: 0;
}
.picker-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-item-price {
  text-align: right;
  flex-shrink: 0;
}
.picker-price-amount {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}
.picker-price-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.picker-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.product-picker-hint {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Input with $ prefix */
.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix {
  position: absolute;
  left: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}
.input-with-prefix .form-control {
  padding-left: 1.5rem;
}

@media (max-width: 768px) {
  .picker-item-desc { display: none; }
  .picker-price-unit { display: none; }
  .catalog-category-section { overflow-x: auto; }
}

/* =============================================
   SOLABRAN PRODUCT PICKER (NEW DESIGN)
   ============================================= */
.picker-toolbar {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0 0.75rem;
  flex-wrap: wrap;
}
.picker-results {
  max-height: 55vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  margin-top: 0.25rem;
}
.picker-category-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--primary-lighter);
  border-bottom: 1px solid var(--primary-light);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  position: sticky;
  top: 0;
  z-index: 1;
}
.picker-cat-count {
  margin-left: auto;
  background: white;
  border: 1px solid var(--primary-light);
  color: var(--primary);
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}
.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.12s;
  gap: 1rem;
}
.picker-item:hover {
  background: var(--primary-lighter);
}
.picker-item:last-child { border-bottom: none; }
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-item-meta { text-align: right; flex-shrink: 0; }
.picker-item-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
}
.picker-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}
.picker-item-tax {
  font-size: 0.72rem;
  margin-top: 0.15rem;
}
.picker-item-tax.taxable { color: var(--text-muted); }
.picker-item-tax.exempt { color: var(--success); font-weight: 600; }
.picker-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* =============================================
   LINE ITEM EDITOR — SOLABRAN STYLE
   ============================================= */
.li-input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
  transition: border 0.12s, background 0.12s;
}
/* Number inputs in qty/price/tax/disc columns — centred text, no spinners on hover */
.li-row td input[type="number"].li-input {
  text-align: right;
  -moz-appearance: textfield;
}
.li-row td input[type="number"].li-input::-webkit-inner-spin-button,
.li-row td input[type="number"].li-input::-webkit-outer-spin-button {
  opacity: 0;
}
.li-row td input[type="number"].li-input:focus::-webkit-inner-spin-button,
.li-row td input[type="number"].li-input:focus::-webkit-outer-spin-button {
  opacity: 1;
}
.li-input:hover { border-color: var(--border); background: white; }
.li-input:focus { border-color: var(--primary); background: white; outline: none; box-shadow: 0 0 0 3px rgba(26,122,60,0.12); }
.li-subtotal-cell {
  text-align: right;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.9rem;
  padding-right: 0.5rem;
}
.li-cat-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  background: var(--bg);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-light);
}
.li-remove-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.li-remove-btn:hover { color: var(--danger); background: var(--danger-light); }
.li-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  background: var(--primary-lighter);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.li-hint i { color: var(--primary); }

/* =============================================
   PRODUCT CATALOG PAGE
   ============================================= */
.row-inactive { opacity: 0.55; }
.row-inactive td { color: var(--text-muted) !important; }

/* =============================================
   SOLABRAN BRAND OVERRIDES
   ============================================= */

/* Login page */
.login-logo-brand {
  max-width: 240px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.4));
}

/* Sidebar logo */
.sidebar-logo-img {
  max-width: 148px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Nav active — green */
.nav-item.active {
  background: rgba(74,222,128,0.12);
  color: #86efac;
  border-right: 3px solid #4ade80;
}

/* Primary button — green */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Badge active green */
.badge-active, .badge-paid, .badge-accepted, .badge-completed, .badge-approved {
  background: #d1fae5;
  color: #065f46;
}

/* Print: remove sidebar interference */
@media print {
  .sidebar, .topbar, .quick-add-menu, .toast-container, #modal-container, #modal-backdrop { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .content-area { padding: 0 !important; }
  #print-area { display: block !important; }
  body { background: white !important; }
}

/* =============================================
   RESPONSIVE ADJUSTMENTS
   ============================================= */
@media (max-width: 640px) {
  .picker-toolbar { flex-direction: column; }
  .picker-item-meta { display: none; }
  .li-cat-tag { display: none; }
}
