/* ═══════════════ OLIVE CRM - BOSTA STYLE ═══════════════ */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
@keyframes spin { to { transform: rotate(360deg); } }

/* PWA standalone mode - safe area for notch/status bar */
@media all and (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  #sidebar { padding-top: env(safe-area-inset-top); }
}

:root {
  --primary: #1e4d0f;
  --primary-light: #2d6b18;
  --primary-dark: #143509;
  --primary-50: #f0f7ed;
  --primary-100: #dcebcf;
  --accent: #c8972a;
  --accent-light: #e8b84b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f0f1f5;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --topbar-h: 56px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
}

html, body {
  height: 100%;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
input, select, textarea, button { font-family: 'Cairo', sans-serif; }
a { text-decoration: none; color: inherit; }

/* ═══════════════ LAYOUT ═══════════════ */
#app { display: flex; min-height: 100vh; }
#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f2a06 0%, #143509 40%, #1a4a0d 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  z-index: 200;
  transition: all .25s ease;
  box-shadow: -2px 0 12px rgba(0,0,0,.15);
}
#main {
  margin-right: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ═══════════════ SIDEBAR ═══════════════ */
.sb-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-brand-icon { font-size: 28px; }
.sb-brand-name { color: #fff; font-weight: 800; font-size: 14px; }
.sb-brand-sub { color: rgba(168,196,154,.7); font-size: 11px; }

.sb-links { padding: 12px 8px; flex: 1; overflow-y: auto; }
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  color: rgba(168,196,154,.8);
  font-size: 13px;
  font-weight: 500;
  transition: all .15s ease;
  margin-bottom: 2px;
  user-select: none;
}
.sb-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sb-link-icon { font-size: 17px; width: 22px; text-align: center; }
.sb-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  margin-right: auto;
}

.sb-user {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sb-status {
  padding: 8px 14px 14px;
  font-size: 11px;
  color: rgba(107,143,94,.8);
}
.sb-status-inner {
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border-radius: var(--radius);
  line-height: 1.9;
}

/* ═══════════════ TOPBAR ═══════════════ */
#topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
#topbar-title { font-size: 16px; font-weight: 700; flex: 1; }

/* ═══════════════ CONTENT ═══════════════ */
#content { flex: 1; overflow-y: auto; }
.page { padding: 24px; max-width: 1400px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ═══════════════ PAGE HEADER ═══════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 20px; font-weight: 800; }
.page-header-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); border-color: var(--text-muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1.5px solid #fca5a5; }
.btn-success { background: #f0fdf4; color: #166534; border: 1.5px solid #86efac; }
.btn-icon { padding: 6px; border-radius: 6px; background: transparent; border: 1px solid var(--border); cursor: pointer; transition: .15s; }
.btn-icon:hover { background: var(--bg); }

/* ═══════════════ TABS (Bosta-style) ═══════════════ */
.tabs-bar {
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 4px;
  overflow-x: auto;
  margin-bottom: 16px;
}
.tab {
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all .15s ease;
  user-select: none;
  white-space: nowrap;
  text-align: center;
}
.tab:hover:not(.active) { background: var(--bg); color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.tab .tab-count {
  display: inline-block;
  background: rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  margin-right: 4px;
}
.tab.active .tab-count { background: rgba(255,255,255,.2); }

/* ═══════════════ FILTER BAR ═══════════════ */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--primary); outline: none; }
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════ CARD ═══════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 16px 20px; }

/* ═══════════════ TABLE (Bosta-style) ═══════════════ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.tbl td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.tbl tr { transition: background .1s; }
.tbl tbody tr:hover td { background: #f9fafb; }
.tbl-customer-name { font-weight: 600; color: var(--text); }
.tbl-customer-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tbl-phone { direction: ltr; text-align: right; font-size: 13px; color: var(--text-secondary); }
.tbl-actions { display: flex; gap: 4px; }

/* ═══════════════ BADGES ═══════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* Status badges */
.status-first_attempt { color: #22c55e; background: #f0fdf4; }
.status-second_attempt { color: #eab308; background: #fefce8; }
.status-third_attempt { color: #1e293b; background: #f1f5f9; }
.status-confirmed { color: #16a34a; background: #dcfce7; }
.status-rejected { color: #dc2626; background: #fee2e2; }
.status-waiting_transfer { color: #65a30d; background: #ecfccb; }
.status-postponed { color: #9333ea; background: #f3e8ff; }
.status-shipped { color: #0891b2; background: #cffafe; }
.status-duplicate { color: #374151; background: #f3f4f6; }

/* ═══════════════ STAT CARDS ═══════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin-top: 4px; }

/* ═══════════════ PAGINATION ═══════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}
.pagination .page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: .15s;
  font-family: 'Cairo', sans-serif;
}
.pagination .page-btn:hover { background: var(--bg); }
.pagination .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 12px; color: var(--text-secondary); }

/* ═══════════════ GRIDS ═══════════════ */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* ═══════════════ FORMS ═══════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
input[type=text], input[type=tel], input[type=email],
input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color .2s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }
select { cursor: pointer; }

/* ═══════════════ MODAL ═══════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0,0,0,.15);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-wide { max-width: 680px; }
.modal-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: 16px 16px 0 0;
}
.modal-hdr h3 { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-ftr {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-radius: 0 0 16px 16px;
}

/* ═══════════════ CUSTOMER DETAIL ═══════════════ */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}
.detail-name { font-size: 20px; font-weight: 800; }
.detail-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.qbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s ease;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  min-width: 75px;
  user-select: none;
}
.qbtn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.qbtn-icon { font-size: 22px; }

/* ═══════════════ TIMELINE ═══════════════ */
.tl-item { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.tl-item::before {
  content: '';
  position: absolute;
  right: 15px;
  top: 34px;
  width: 2px;
  bottom: 0;
  background: var(--border-light);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  border: 2px solid var(--border-light);
  background: #fff;
}

/* ═══════════════ CHAT BUBBLES ═══════════════ */
.bubble-out {
  background: var(--primary-100);
  border-radius: 12px 12px 2px 12px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 75%;
}
.bubble-in {
  background: #f3f4f6;
  border-radius: 12px 12px 12px 2px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 75%;
}

/* ═══════════════ WHATSAPP CHAT VIEW ═══════════════ */
.wa-chat-container {
  display: flex;
  height: calc(100vh - 56px);
  direction: rtl;
  overflow: hidden;
  margin: -20px;
}
.wa-chat-list {
  width: 340px;
  min-width: 280px;
  border-left: 1px solid var(--border);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wa-chat-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-chat-search {
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
}
.wa-chat-search:focus { border-color: var(--primary); outline: none; }
.wa-chat-list-items {
  flex: 1;
  overflow-y: auto;
}
.wa-chat-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background .15s;
}
.wa-chat-item:hover { background: var(--bg); }
.wa-chat-item.active { background: var(--primary-50); border-right: 3px solid var(--primary); }
.wa-chat-item.unread { background: #f0fdf4; }
.wa-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.wa-chat-item-info { flex: 1; min-width: 0; }
.wa-chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.wa-chat-item-name { font-weight: 700; font-size: 13px; }
.wa-chat-item-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.wa-chat-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wa-chat-item-preview {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.wa-unread-badge {
  background: #25d366;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 6px;
}
.wa-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #efeae2;
  min-width: 0;
}
.wa-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wa-msg-row { display: flex; }
.wa-msg-out { justify-content: flex-start; }
.wa-msg-in  { justify-content: flex-end; }
.wa-msg-meta {
  font-size: 10px;
  color: #6b7280;
  margin-top: 4px;
}
.wa-chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-chat-input-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
}
.wa-chat-input-bar input:focus { border-color: var(--primary); outline: none; }
.wa-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
}
@media (max-width: 768px) {
  .wa-chat-container { flex-direction: column; position: relative; }
  .wa-chat-list { width: 100%; height: 100%; border-left: none; }
  .wa-chat-panel { position: absolute; inset: 0; z-index: 10; display: none; }
  .wa-chat-container.chat-open .wa-chat-list { display: none; }
  .wa-chat-container.chat-open .wa-chat-panel { display: flex; }
  .wa-chat-empty { display: none !important; }
  .wa-chat-back-btn { display: inline-flex !important; }
  .wa-chat-container { margin: -12px; height: calc(100vh - 56px); }
}
@media (min-width: 769px) {
  .wa-chat-back-btn { display: none !important; }
}

/* ═══════════════ PROGRESS BAR ═══════════════ */
.prog { height: 6px; border-radius: 3px; background: var(--border-light); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  z-index: 2000;
  animation: toastIn .3s ease;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
}
@keyframes toastIn { from { transform: translateX(-50%) translateY(-10px); opacity: 0; } }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

/* ═══════════════ WA NOTIFICATION BANNER ═══════════════ */
.wa-notif-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 2px solid #25d366;
  border-radius: 16px;
  padding: 16px 20px;
  z-index: 3000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 4px rgba(37,211,102,0.15);
  animation: waNotifIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 460px;
  width: 90%;
}
@keyframes waNotifIn {
  from { transform: translateX(-50%) translateY(-30px) scale(0.95); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.wa-notif-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #25d366, #128c7e);
  border-radius: 16px 16px 0 0;
}

/* ═══════════════ AVATAR ═══════════════ */
.av {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

/* ═══════════════ ALERTS ═══════════════ */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-red { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-green { background: #f0fdf4; color: #166534; border: 1px solid #a7f3d0; }
.alert-orange { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.alert-yellow { background: #fef9c3; color: #a16207; border: 1px solid #fde68a; }

/* ═══════════════ WHATSAPP DOT ═══════════════ */
.wa-status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 4px; }

/* ═══════════════ LOGIN ═══════════════ */
#login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f2a06, #1a4a0d, #2d6b18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 48px rgba(0,0,0,.2);
}

/* ═══════════════ UTILITIES ═══════════════ */
.hidden { display: none !important; }
.flex { display: flex; align-items: center; }
.gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap8 { gap: 8px; }
.gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap14 { gap: 14px; } .gap16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.jcsb { justify-content: space-between; }
.f1 { flex: 1; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ═══════════════ EMPTY STATE ═══════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; font-weight: 600; }

/* ═══════════════ CUSTOMER TOOLTIP ═══════════════ */
.cust-tooltip {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(20,53,9,.22), 0 2px 12px rgba(0,0,0,.08);
  border: 1px solid rgba(30,77,15,.12);
  width: 340px;
  pointer-events: none;
  opacity: 0;
  transform: scale(.96) translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  overflow: hidden;
}
.cust-tooltip.show { opacity: 1; transform: scale(1) translateY(0); }
.tt-header { padding: 14px 16px; background: linear-gradient(135deg, #143509, #1e5a10, #2d6b18); color: #fff; display: flex; gap: 10px; align-items: center; }
.tt-avatar { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: #fff; flex-shrink: 0; }
.tt-name { font-weight: 800; font-size: 14px; }
.tt-sub { font-size: 11px; color: #b5d4a7; margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.tt-body { padding: 10px 16px; }
.tt-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f0f2ed; font-size: 12px; }
.tt-row:last-child { border: none; }
.tt-label { color: var(--text-secondary); font-weight: 600; }
.tt-val { font-weight: 700; color: var(--text); direction: ltr; text-align: left; }
.tt-notes { padding: 8px 16px 10px; background: #f9faf7; border-top: 1px solid var(--border-light); font-size: 11px; color: var(--text-secondary); max-height: 50px; overflow: hidden; }
.tt-footer { padding: 6px 16px; background: #f0f2ed; text-align: center; font-size: 10px; color: var(--text-muted); font-weight: 600; }

/* ═══════════════ PERFORMANCE CARDS ═══════════════ */
.perf-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.perf-card.top { border: 2px solid var(--accent); }
.perf-medal { font-size: 28px; }
.perf-score { font-size: 32px; font-weight: 900; }
.perf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.perf-stat {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.perf-stat-icon { font-size: 18px; }
.perf-stat-val { font-size: 16px; font-weight: 800; margin-top: 2px; }
.perf-stat-lbl { font-size: 11px; color: var(--text-muted); }

/* ═══════════════ RESPONSIVE ═══════════════ */
#menu-btn { display: inline-flex; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }

/* Desktop: collapsible sidebar */
@media (min-width: 769px) {
  #app.sb-hidden #sidebar { transform: translateX(100%); }
  #app.sb-hidden #main { margin-right: 0; }
}

@media (max-width: 768px) {
  #sidebar { transform: translateX(100%); width: 260px; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-right: 0; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .overlay.show { display: block; }
  .desktop-only { display: none !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; font-size: 18px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page { padding: 12px; }
  #topbar { padding: 0 12px; gap: 8px; }
  #topbar-title { font-size: 14px; }
  .tabs-bar { border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
  .tab { padding: 7px 12px; font-size: 12px; }
  .filter-bar { flex-direction: column; gap: 8px; }
  .search-box { min-width: 100%; }
  .page-header { gap: 8px; }
  .page-header h1 { font-size: 16px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-stats { width: 100%; display: flex; }
  .page-header-stats .btn { flex: 1; font-size: 11px; padding: 6px 8px; }
  .card { border-radius: var(--radius); overflow: hidden; max-width: 100%; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .page { overflow-x: hidden; }
  .tbl th, .tbl td { padding: 8px 10px; font-size: 12px; }
  .tbl .mob-hide { display: none; }
  .perf-stats { grid-template-columns: repeat(2, 1fr); }
  .detail-header { gap: 10px; }
  .detail-name { font-size: 16px; }
  .quick-actions { gap: 6px; }
  .qbtn { min-width: 60px; padding: 8px 6px; font-size: 10px; }
  .qbtn-icon { font-size: 18px; }
  .modal-box { border-radius: 12px; }
  .modal-body { padding: 14px; }
  .wa-notif-banner { padding: 12px 14px; border-radius: 12px; }
  .cust-tooltip { width: 280px; }
}
@media (min-width: 769px) { .mobile-only { display: none !important; } }

/* ═══════════════ ONLINE USERS + STAFF CHAT ═══════════════ */
.topbar-online { display:flex; align-items:center; gap:6px; padding:0 12px; flex-shrink:0; }
.online-avatar { position:relative; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border-radius:50%; color:#fff; font-size:11px; font-weight:700; cursor:pointer; transition:transform 0.15s; }
.online-avatar:hover { transform:scale(1.15); }
.online-dot { position:absolute; bottom:0; right:0; width:10px; height:10px; background:#16a34a; border:2px solid #fff; border-radius:50%; }
.staff-chat-badge { position:absolute; top:-2px; left:-2px; min-width:16px; height:16px; background:#ef4444; color:#fff; font-size:9px; font-weight:700; border-radius:99px; display:flex; align-items:center; justify-content:center; padding:0 4px; }
.staff-msg { display:flex; flex-direction:column; max-width:70%; margin-bottom:8px; }
.staff-msg.me { align-self:flex-end; }
.staff-msg.other { align-self:flex-start; }
.staff-msg .bubble { padding:8px 12px; border-radius:12px; font-size:13px; line-height:1.5; word-break:break-word; }
.staff-msg.me .bubble { background:#dcfce7; border-bottom-left-radius:12px; border-bottom-right-radius:4px; }
.staff-msg.other .bubble { background:#f3f4f6; border-bottom-left-radius:4px; border-bottom-right-radius:12px; }
.staff-msg .msg-time { font-size:10px; color:#9ca3af; margin-top:2px; padding:0 4px; }
.staff-msg.me .msg-time { text-align:left; }
.staff-msg.other .msg-time { text-align:right; }

/* ═══════════════ PRINT STYLES ═══════════════ */
@media print {
  body * { visibility: hidden; }
  .invoice-print, .invoice-print * { visibility: visible; }
  .invoice-print { position: absolute; left: 0; top: 0; width: 100%; }
  #sidebar, #topbar, .btn, .modal-overlay { display: none !important; }
}
