/* Crispy Crust Enterprise Sales & Commercial Management Application (@sales_app) */
/* Unified Design System - Strict 13.5px Industrial Precision & Zero Unicode Emojis */

:root {
  font-size: 13.5px;
  --bg-base: #07090e;
  --bg-surface: #0f172a;
  --bg-card: #131d33;
  --bg-card-hover: #182542;
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-focus: #f59e0b;
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --accent-gold: #f59e0b;
  --accent-gold-hover: #fbbf24;
  --accent-gold-glow: rgba(245, 158, 11, 0.2);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.18);
  --accent-blue: #38bdf8;
  --accent-blue-glow: rgba(56, 189, 248, 0.18);
  --accent-red: #f43f5e;
  --accent-red-glow: rgba(244, 63, 94, 0.18);
  --accent-purple: #a855f7;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --header-height: 52px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-family);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TOP HORIZONTAL 52px NAVBAR (Matching POS & ERP Standards)
   ========================================================================== */
.sales-navbar {
  height: var(--header-height);
  min-height: var(--header-height);
  background-color: #0b1120;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.facility-badge-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-gold);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.svg-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

/* Center Horizontal Navigation Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.nav-tab-btn .badge-pill {
  background: var(--accent-gold);
  color: #0b1120;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  margin-right: 2px;
}

/* Header Left Panel: Status Capsule & Profile Menu */
.header-status-panel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  font-size: 11px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseAnimation 2s infinite;
}

@keyframes pulseAnimation {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.user-profile-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
}

.user-profile-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

/* Dropdown Menu */
.dropdown-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: 240px;
  background: #0f172a;
  border: 1px solid rgba(51, 65, 85, 0.9);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: none;
}

.dropdown-menu-popover.show {
  display: block;
}

.dropdown-user-header {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}

.user-name-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
}

.user-code-badge {
  font-size: 11px;
  font-family: monospace;
  color: var(--accent-gold);
  margin-top: 2px;
}

.dropdown-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: right;
  transition: all 0.15s ease;
}

.dropdown-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.dropdown-menu-item.danger {
  color: var(--accent-red);
}

.dropdown-menu-item.danger:hover {
  background: rgba(244, 63, 94, 0.12);
}

/* Mobile Screen Switcher (Hidden on Desktop) */
.mobile-screens-dropdown-wrap {
  display: none;
}

/* ==========================================================================
   MAIN VIEW CONTAINER & INDUSTRIAL DENSITY (13.5px)
   ========================================================================== */
.main-view-container {
  flex: 1;
  padding: 16px 20px 40px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

/* Top Metric / KPI Cards Grid */
.kpi-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
}

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--accent-green);
  margin-top: 2px;
  font-weight: 600;
}

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

.kpi-icon-box.gold { background: var(--accent-gold-glow); color: var(--accent-gold); }
.kpi-icon-box.green { background: var(--accent-green-glow); color: var(--accent-green); }
.kpi-icon-box.blue { background: var(--accent-blue-glow); color: var(--accent-blue); }
.kpi-icon-box.purple { background: rgba(168, 85, 247, 0.18); color: var(--accent-purple); }

/* ==========================================================================
   ODOO-GRADE QUOTATION & ORDER BUILDER (#view-quotations)
   ========================================================================== */
.quotation-builder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  overflow: hidden;
}

/* Stepper Ribbon */
.stepper-ribbon {
  display: flex;
  background: #090e18;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  overflow-x: auto;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  position: relative;
  white-space: nowrap;
}

.step-item .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.step-item.active {
  color: var(--accent-gold);
}

.step-item.active .step-num {
  background: var(--accent-gold);
  color: #0b1120;
}

.step-item.done {
  color: var(--accent-green);
}

.step-item.done .step-num {
  background: var(--accent-green);
  color: #0b1120;
}

/* Builder Action Bar */
.builder-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

.action-bar-left, .action-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gold);
  color: #0b1120;
}

.btn-primary:hover {
  background: var(--accent-gold-hover);
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

.btn-success {
  background: var(--accent-green);
  color: #0b1120;
}

.btn-success:hover {
  background: #34d399;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
}

.btn-outline-gold {
  background: transparent;
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.btn-outline-gold:hover {
  background: var(--accent-gold-glow);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--accent-red);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Form Sections */
.builder-form-body {
  padding: 18px;
}

.sales-warning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fde68a;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-gold);
}

/* Inner Tabs inside Quotation Editor */
.editor-inner-tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  padding-bottom: 2px;
}

.inner-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inner-tab-btn:hover {
  color: var(--text-main);
}

.inner-tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.inner-tab-content {
  display: none;
}

.inner-tab-content.active {
  display: block;
}

/* Data Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 11.5px;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-input {
  width: 100%;
  max-width: 90px;
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
}

/* Totals Summary Panel */
.quotation-summary-panel {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.totals-box {
  width: 320px;
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

.total-row.grand-total {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-gold);
  border-top: 1px dashed var(--border-medium);
  padding-top: 8px;
  margin-top: 4px;
}

/* Upsell Optional Products Grid */
.upsell-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.upsell-card {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.upsell-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.upsell-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill.quotation { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.status-pill.sent { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.status-pill.sales_order { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); }
.status-pill.invoiced { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.status-pill.cancelled { background: rgba(244, 63, 94, 0.15); color: var(--accent-red); }

/* ==========================================================================
   CUSTOMER PORTAL (#view-customer-portal)
   ========================================================================== */
.portal-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-quote-viewer {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.portal-quote-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.salesperson-card {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Digital Signature Canvas Modal / Area */
.signature-canvas-wrap {
  background: #020617;
  border: 2px dashed #334155;
  border-radius: var(--radius-md);
  padding: 8px;
  margin: 14px 0;
  text-align: center;
}

#signature-canvas {
  width: 100%;
  height: 160px;
  background: #0b1120;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  touch-action: none;
}

/* ==========================================================================
   CRM LEADS PIPELINE (#view-leads)
   ========================================================================== */
.pipeline-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-pills-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 5px 12px;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

.filter-pill.active {
  background: var(--accent-gold-glow);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* Priority stars */
.priority-stars {
  color: var(--accent-gold);
  font-size: 13px;
  letter-spacing: 2px;
}

/* ==========================================================================
   PRICING STRATEGIES, LOYALTY & EWALLETS (#view-pricing-loyalty)
   ========================================================================== */
.pricing-loyalty-subnav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
  margin-bottom: 20px;
}

.subnav-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.subnav-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.subnav-content {
  display: none;
}

.subnav-content.active {
  display: block;
}

/* ==========================================================================
   ANALYTICS & CHARTS (#view-analytics)
   ========================================================================== */
.analytics-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.chart-card-title {
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.progress-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  direction: rtl;
}

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

.modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.btn-close-modal:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 0.2s ease-out;
}

.toast.success { border-color: var(--accent-green); color: #34d399; }
.toast.error { border-color: var(--accent-red); color: #f87171; }
.toast.info { border-color: var(--accent-blue); color: #7dd3fc; }

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

