/*
===================================================================
   MK SPICEPOD TRADERS - Admin Panel Stylesheet
   Modern, Pixel-Perfect, High-Performance Dashboard
===================================================================
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --admin-sidebar-bg: #072a19;
  --admin-sidebar-active: #0f4b2d;
  --admin-sidebar-hover: #0a3a22;
  --admin-header-bg: #072a19;
  
  --primary: #0b4328;
  --primary-light: #166534;
  --primary-soft: #edf7f0;
  
  --accent-gold: #e59a1f;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f97316;
  
  --bg-admin: #f4f6f8;
  --bg-card: #ffffff;
  
  --text-dark: #1e293b;
  --text-body: #475569;
  --text-muted: #8e9cae;
  --text-white: #ffffff;
  
  --border-color: #e5e7eb;
  --border-card: #eaedf1;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;
  
  --transition: all 0.25s ease;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-admin);
  color: var(--text-body);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================================================================
   ADMIN LAYOUT STRUCTURE
=================================================================== */
.admin-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 250px;
  background-color: var(--admin-sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition);
  z-index: 100;
}

.sidebar-header {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-badge {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.25rem;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: #6ee7b7;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Sidebar Menu */
.sidebar-nav {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-category-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 1px;
  padding: 10px 12px 4px;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: #94a3b8;
  transition: var(--transition);
}

.sidebar-link:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ffffff;
}

.sidebar-link:hover i {
  color: #86efac;
}

.sidebar-link.active {
  background-color: var(--admin-sidebar-active);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.sidebar-link.active i {
  color: #34d399;
}

.sidebar-link .badge-count {
  margin-left: auto;
  background-color: var(--accent-gold);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-sidebar-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #f87171;
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sidebar-logout:hover {
  background-color: #ef4444;
  color: #ffffff;
}

/* ===================================================================
   MAIN VIEWPORT & TOPBAR
=================================================================== */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-admin);
}

.admin-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-dark);
  cursor: pointer;
}

.page-current-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.btn-visit-site {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  background-color: var(--primary-soft);
  color: var(--primary-color);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(11, 67, 40, 0.15);
  transition: var(--transition);
}

.btn-visit-site:hover {
  background-color: var(--primary-color);
  color: #ffffff;
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b4328, #10b981);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.admin-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* ===================================================================
   ADMIN CONTENT & SECTIONS
=================================================================== */
.admin-content {
  padding: 26px 28px;
  flex: 1;
}

.admin-tab-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.admin-tab-section.active {
  display: block;
}

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

/* ===================================================================
   DASHBOARD STATS (4 TOP CARDS)
=================================================================== */
.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 26px;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon-green { background-color: #d1fae5; color: #059669; }
.stat-icon-blue { background-color: #dbeafe; color: #2563eb; }
.stat-icon-purple { background-color: #ede9fe; color: #7c3aed; }
.stat-icon-orange { background-color: #ffedd5; color: #ea580c; }

.stat-label {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

/* ===================================================================
   RECENT ORDERS TABLE CARD
=================================================================== */
.dashboard-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 26px;
  overflow: hidden;
}

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

.dashboard-card-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
}

.link-action {
  color: #2563eb;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.link-action:hover {
  text-decoration: underline;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background-color: #f8fafc;
  color: #64748b;
  font-weight: 700;
  padding: 12px 20px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-card);
}

.admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-dark);
  vertical-align: middle;
}

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

.admin-table tr:hover {
  background-color: #f8fafc;
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pending { background-color: #fef3c7; color: #d97706; }
.status-confirmed { background-color: #d1fae5; color: #059669; }
.status-shipped { background-color: #e0f2fe; color: #0284c7; }
.status-delivered { background-color: #dcfce7; color: #15803d; }
.status-cancelled { background-color: #fee2e2; color: #dc2626; }

/* ===================================================================
   BOTTOM ROW: SALES OVERVIEW & QUICK ACTIONS
=================================================================== */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}

.chart-wrapper {
  padding: 20px;
  height: 250px;
  position: relative;
}

.quick-actions-list {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-quick-action:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(11, 67, 40, 0.25);
}

.btn-quick-action i {
  font-size: 1.1rem;
}

/* ===================================================================
   PRODUCTS & CRUD VIEW
=================================================================== */
.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.search-filter-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 500px;
}

.admin-input-search {
  flex: 1;
  padding: 9px 14px 9px 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  outline: none;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2394a3b8' viewBox='0 0 24 24'%3E%3Cpath d='M21.71 20.29l-5.4-5.39A8 8 0 1 0 4 11a8 8 0 0 0 12.31 6.31l5.39 5.4a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zM11 17a6 6 0 1 1 6-6 6 6 0 0 1-6 6z'/%3E%3C/svg%3E") no-repeat 10px center;
  background-size: 18px;
}

.admin-select-filter {
  padding: 9px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  background-color: #ffffff;
  outline: none;
}

.btn-primary-admin {
  background-color: var(--primary);
  color: #ffffff;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary-admin:hover {
  background-color: var(--primary-light);
}

.table-product-img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-edit { background-color: #f1f5f9; color: #475569; }
.btn-edit:hover { background-color: #e2e8f0; color: #0f172a; }

.btn-delete { background-color: #fee2e2; color: #ef4444; }
.btn-delete:hover { background-color: #f87171; color: #ffffff; }

.btn-whatsapp-sm { background-color: #dcfce7; color: #15803d; }
.btn-whatsapp-sm:hover { background-color: #22c55e; color: #ffffff; }

/* ===================================================================
   MODAL DIALOG
=================================================================== */
.admin-modal-overlay,
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.admin-modal-overlay.active,
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-box,
.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  padding: 26px;
  position: relative;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-admin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.modal-header-admin h3 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--text-dark);
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #94a3b8;
  cursor: pointer;
}

.form-group-admin {
  margin-bottom: 16px;
}

.form-group-admin label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.form-control-admin {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
}

.form-control-admin:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 67, 40, 0.12);
}

/* Image Upload Dropzone & Previews */
.image-upload-wrapper {
  border: 2px dashed #cbd5e1;
  background-color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  margin-top: 6px;
}

.image-upload-wrapper:hover {
  border-color: var(--primary);
  background-color: var(--primary-soft);
}

.image-upload-wrapper input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-preview-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.upload-img-preview {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  background-color: #ffffff;
}

.upload-icon-label {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 6px;
}

.upload-hint {
  font-size: 0.78rem;
  color: #64748b;
}

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

/* ===================================================================
   ADMIN LIVE CHAT & INBOX WORKSPACE (PIXEL PERFECT ALIGNMENT)
=================================================================== */
.admin-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-chat-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  color: #065f46;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid #a7f3d0;
}

.admin-chat-layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 200px);
  min-height: 560px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Left Customer List Pane */
.admin-chat-sidebar {
  width: 320px;
  min-width: 290px;
  max-width: 350px;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  flex-shrink: 0;
  min-height: 0;
}

.admin-chat-search-box {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  flex-shrink: 0;
}

.admin-chat-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
  box-sizing: border-box;
}

.admin-chat-search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 67, 40, 0.1);
}

.admin-chat-customer-list {
  flex: 1 1 auto;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 0;
}

.admin-chat-cust-item {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-chat-cust-item:hover {
  background: #f1f5f9;
}

.admin-chat-cust-item.active {
  background: #ecfdf5;
  border-left: 4px solid var(--accent-green);
}

.admin-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.admin-chat-cust-info {
  flex: 1;
  min-width: 0;
}

.admin-chat-cust-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.admin-chat-cust-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.admin-chat-cust-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.admin-chat-cust-snippet {
  font-size: 0.78rem;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.admin-chat-badge-unread {
  background: var(--accent-green);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

/* Right Chat Message Pane */
.admin-chat-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  min-width: 0;
  min-height: 0;
}

.admin-chat-header-bar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
}

.admin-chat-active-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-chat-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-chat-action {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--text-dark);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-chat-action:hover {
  background: #e2e8f0;
}

.btn-chat-action.whatsapp {
  background: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

.btn-chat-action.whatsapp:hover {
  background: #1eb956;
}

.admin-chat-messages-container {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.admin-msg-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}

.admin-msg-bubble-row.admin {
  align-self: flex-end;
  align-items: flex-end;
}

.admin-msg-bubble-row.customer,
.admin-msg-bubble-row.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.admin-msg-bubble {
  padding: 10px 15px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.admin-msg-bubble-row.admin .admin-msg-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.admin-msg-bubble-row.customer .admin-msg-bubble {
  background: #ffffff;
  color: var(--text-dark);
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.admin-msg-bubble-row.bot .admin-msg-bubble {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.admin-msg-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Quick Canned Responses */
.admin-chat-canned-bar {
  padding: 8px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-canned-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-canned-chip:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Reply Input Bar */
.admin-chat-input-area {
  padding: 12px 18px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-chat-reply-input {
  flex: 1;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-chat-reply-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 67, 40, 0.15);
}

.btn-admin-reply-send {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-admin-reply-send:hover {
  background: var(--primary-light);
}

/* Modal styling for Auto-Message Settings */
.auto-config-box {
  max-width: 780px;
  max-height: 88vh;
  overflow-y: auto;
}

.auto-config-group {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.auto-config-group label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.auto-config-group .help-hint {
  font-size: 0.76rem;
  color: #64748b;
  margin-bottom: 8px;
  line-height: 1.35;
}

.auto-config-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  min-height: 75px;
  resize: vertical;
  box-sizing: border-box;
}

.auto-config-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 67, 40, 0.15);
}

/* Data Safety & Backup Cards in Settings */
.data-backup-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
}

.data-backup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.data-safe-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
}

.backup-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.btn-backup-action {
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-backup-action:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* ===================================================================
   ADMIN PANEL RESPONSIVE BREAKPOINTS & MOBILE DRAWER
=================================================================== */

/* Backdrop overlay when mobile sidebar is open */
.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
  .admin-chat-layout {
    grid-template-columns: 280px 1fr;
  }
}

@media (max-width: 768px) {
  .admin-layout {
    position: relative;
    overflow-x: hidden;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    bottom: 0;
    z-index: 10000;
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.25);
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .admin-sidebar.open {
    left: 0 !important;
  }

  .sidebar-toggle-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text-dark);
    border: 1px solid #cbd5e1;
    font-size: 1.1rem;
    cursor: pointer;
  }

  .admin-topbar {
    padding: 10px 14px;
  }

  .page-current-title {
    font-size: 1.15rem;
  }

  .btn-visit-site span {
    display: none;
  }

  .btn-visit-site {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .admin-content {
    padding: 14px 12px;
  }

  /* 4 Stat Cards on Mobile: 2x2 grid */
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 12px;
    gap: 10px;
  }

  .stat-card .stat-icon-wrap {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .stat-card .stat-number {
    font-size: 1.3rem;
  }

  .stat-card .stat-label {
    font-size: 0.72rem;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Chat Module Mobile Responsive View */
  .admin-chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 160px);
    min-height: 520px;
    position: relative;
  }

  .admin-chat-sidebar {
    height: 100%;
    border-right: none;
  }

  .admin-chat-layout.chat-active .admin-chat-sidebar {
    display: none;
  }

  .admin-chat-main-pane {
    display: none;
    height: 100%;
  }

  .admin-chat-layout.chat-active .admin-chat-main-pane {
    display: flex;
    flex-direction: column;
  }

  .admin-chat-header-bar {
    padding: 10px 14px;
  }

  /* Modals on Mobile */
  .admin-modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 18px 14px !important;
    margin: 10px auto !important;
    max-height: 92vh !important;
    border-radius: 14px;
  }

  .modal-header-admin {
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .modal-header-admin h3 {
    font-size: 1.1rem;
  }

  .admin-login-box {
    max-width: 92vw;
    border-radius: 16px;
  }

  .admin-login-header {
    padding: 24px 20px 18px;
  }

  .admin-login-body {
    padding: 20px 18px;
  }

  .invoice-calc-summary {
    justify-content: stretch;
    padding: 12px 14px;
  }

  .calc-summary-rows {
    width: 100%;
  }

  .invoice-paper-wrapper {
    padding: 16px 12px;
  }

  .invoice-meta-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 14px;
  }

  .invoice-paper-header {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  .invoice-type-tag {
    text-align: left;
  }

  .invoice-footer-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .invoice-sign-box {
    text-align: left;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .stats-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   QUOTATION & TAX INVOICE SYSTEM STYLES
   =================================================================== */

.badge-quotation {
  background: #f3e8ff;
  color: #7e22ce;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-invoice {
  background: #ecfdf5;
  color: #047857;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-doc-draft {
  background: #f1f5f9;
  color: #64748b;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-doc-sent {
  background: #e0f2fe;
  color: #0284c7;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-doc-paid {
  background: #dcfce7;
  color: #15803d;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Invoice Builder Modal Elements */
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 15px;
  font-size: 0.85rem;
}

.invoice-items-table th {
  background: #f8fafc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
}

.invoice-items-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.invoice-calc-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 15px 0;
  display: flex;
  justify-content: flex-end;
}

.calc-summary-rows {
  width: 320px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.88rem;
  color: #475569;
}

.calc-row.grand-total {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px dashed #cbd5e1;
  margin-top: 8px;
  padding-top: 8px;
}

/* ===================================================================
   OFFICIAL PRINTABLE GST INVOICE & PROFORMA QUOTATION PAPER
   =================================================================== */

.invoice-paper-wrapper {
  background: #ffffff;
  padding: 30px 35px;
  border-radius: 8px;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  margin: 0 auto;
  max-width: 820px;
}

.invoice-paper-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0b4328;
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.invoice-company-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.invoice-logo-badge {
  width: 52px;
  height: 52px;
  background: #0b4328;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.4rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -1px;
}

.invoice-company-details h2 {
  font-size: 1.35rem;
  margin: 0;
  color: #0b4328;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.invoice-company-details p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.invoice-type-tag {
  text-align: right;
}

.invoice-type-tag h1 {
  font-size: 1.4rem;
  color: #0b4328;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.invoice-doc-number {
  font-size: 0.95rem;
  font-weight: 700;
  color: #047857;
  margin-top: 4px;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: #f8fafc;
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.invoice-meta-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #0b4328;
  margin: 0 0 8px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 4px;
}

.invoice-meta-box p {
  margin: 3px 0;
  font-size: 0.85rem;
  color: #334155;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.85rem;
}

.print-table th {
  background: #0b4328;
  color: #ffffff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  border: 1px solid #0b4328;
}

.print-table td {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  color: #1e293b;
}

.print-table tr:nth-child(even) td {
  background: #fafafa;
}

.invoice-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

.invoice-bank-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 0.8rem;
}

.invoice-bank-card h5 {
  margin: 0 0 6px;
  color: #0b4328;
  font-size: 0.82rem;
  font-weight: 700;
}

.invoice-sign-box {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
}

.invoice-sign-box p {
  margin: 0;
  font-size: 0.82rem;
  color: #475569;
}

.invoice-sign-box .sign-space {
  height: 45px;
}

/* Print Rules */
@media print {
  body * {
    visibility: hidden;
  }
  .invoice-paper-wrapper, .invoice-paper-wrapper * {
    visibility: visible;
  }
  .invoice-paper-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .modal-overlay {
    position: static;
    background: transparent;
    padding: 0;
  }
  .modal-content {
    box-shadow: none;
    padding: 0;
    max-width: 100% !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ===================================================================
   ADMIN AUTHENTICATION, LOGIN MODAL & PASSWORD SECURITY
=================================================================== */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(7, 42, 25, 0.96) 0%, rgba(3, 18, 11, 0.98) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInModal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-login-overlay.hidden {
  display: none !important;
}

.admin-login-box {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: slideUpModal 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-login-header {
  background: linear-gradient(135deg, #072a19 0%, #0b4328 100%);
  padding: 32px 28px 24px;
  text-align: center;
  color: #ffffff;
  position: relative;
}

.admin-login-badge {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.admin-login-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.admin-login-sub {
  font-size: 0.82rem;
  color: #a7f3d0;
}

.admin-login-body {
  padding: 28px 28px 24px;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 42px !important;
}

.btn-toggle-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.btn-toggle-eye:hover {
  color: #0b4328;
}

.password-strength-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
  position: relative;
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-text {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  color: #64748b;
}

.admin-security-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px;
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}

.admin-security-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.admin-security-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-auth-badge {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-profile-pill {
  cursor: pointer;
  position: relative;
  user-select: none;
}

.admin-profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15);
  min-width: 210px;
  padding: 8px;
  display: none;
  z-index: 1000;
}

.admin-profile-dropdown.show {
  display: block;
  animation: fadeInModal 0.2s ease;
}

.admin-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.admin-dropdown-item:hover {
  background: #f1f5f9;
  color: #0b4328;
}

.admin-dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 6px 0;
}

