/* ShopLine Panel - Premium Design Overhaul */
/* Inspired by Linear.app meets Vercel Dashboard */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* CSS Variables - Exact Color System */
:root {
  /* Background Colors */
  --bg-primary: #08090d;
  --bg-secondary: #0e1016;  
  --bg-card: #12141e;
  --bg-card-hover: #161824;
  --bg-input: #0c0d14;
  
  /* Border Colors */
  --border: #1c1f2e;
  --border-hover: #282c3e;
  --border-focus: #3B82F6;
  
  /* Text Colors */
  --text-primary: #e4e7f0;
  --text-secondary: #8b90a0;
  --text-muted: #5a5f72;
  
  /* Brand Colors */
  --blue: #3B82F6;
  --blue-hover: #2563EB;
  --blue-subtle: rgba(59,130,246,0.08);
  --green: #10B981;
  --green-subtle: rgba(16,185,129,0.08);
  --red: #EF4444;
  --red-subtle: rgba(239,68,68,0.08);
  --yellow: #F59E0B;
  --yellow-subtle: rgba(245,158,11,0.08);
  --purple: #8B5CF6;
  --purple-subtle: rgba(139,92,246,0.08);
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  
  /* Transitions */
  --transition: all 0.15s ease;
  
  /* Shadows */
  --shadow-card: 0 20px 50px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03) inset;
  --shadow-toast: 0 10px 30px rgba(0,0,0,0.3);
  --mobile-header-height: 56px;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  direction: rtl;
  overflow: hidden;
  height: var(--app-height, 100vh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.text-small {
  font-size: 12px;
  font-weight: 500;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* Login Page Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at top, #0f1629 0%, #08090d 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.04);
  text-align: center;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content h2 {
  margin-bottom: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.logo-area {
  margin-bottom: 24px;
}

.logo-monogram {
  width: 64px;
  height: 64px;
  background: var(--blue);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin: 0 auto 16px;
}

.modal-content h2 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
}

.modal-subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 13px;
}

.temp-password-notice {
  background: var(--yellow-subtle);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
  color: var(--yellow);
  font-size: 13px;
  text-align: right;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
  text-align: right;
}

/* Fix date/time inputs for dark theme */
input[type="date"], 
input[type="time"], 
input[type="datetime-local"] {
  color-scheme: dark;
}

/* Use JetBrains Mono for numbers */
.stat-value, 
.financial-amount, 
.badge-number, 
td:nth-child(n) {
  font-family: 'JetBrains Mono', monospace;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: var(--transition);
  direction: rtl;
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-group textarea {
  height: auto;
  min-height: 100px;
  padding: 12px 16px;
  resize: vertical;
}

.form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%235a5f72' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: left 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-left: 44px;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  height: 38px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
  font-family: var(--font-sans);
  position: relative;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--red-subtle);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-large {
  height: 44px;
  padding: 0 20px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Error Message */
.error-message {
  background: var(--red-subtle);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--red);
  font-size: 13px;
  text-align: right;
  margin-top: 16px;
  display: none;
}

.error-message.show {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Main App Layout */
#appContainer {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100vh);
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 0.3s ease 0.1s forwards;
}

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

/* Header */
.header {
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header h1 i {
  color: var(--blue);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

#userDisplayName {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

#userDisplayName::before {
  content: '';
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.notifications-container {
  position: relative;
}

.notifications-bell {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.notifications-bell:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.notifications-bell i {
  font-size: 16px;
}

.notifications-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: 2px solid var(--bg-secondary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(0,0,0,0.35);
  overflow: hidden;
  z-index: 2500;
}

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

.notifications-dropdown-header h3 {
  margin: 0;
  font-size: 14px;
}

.notifications-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.notifications-setting-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.notifications-setting-item input {
  accent-color: var(--blue);
}

.notifications-list {
  max-height: 320px;
  overflow-y: auto;
}

.notifications-empty {
  padding: 20px 14px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

.notification-item {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: right;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

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

.notification-item:hover {
  background: rgba(255,255,255,0.03);
}

.notification-item.unread {
  background: var(--blue-subtle);
}

.notification-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 3px;
}

.notification-item-message {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.notification-item-time {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

/* Main Container */
.main-container {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 999;
}

.nav-menu {
  list-style: none;
  padding: 8px;
  flex: 1;
}

.nav-menu li {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.nav-link i {
  font-size: 18px;
  opacity: 0.6;
  transition: var(--transition);
}

.nav-link:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.nav-link:hover i {
  opacity: 1;
}

.nav-link.active {
  background: var(--blue-subtle);
  color: var(--blue);
  border-right: 2px solid var(--blue);
}

.nav-link.active i {
  opacity: 1;
}

/* Logo Area */
.sidebar::before {
  content: 'ShopLine';
  display: block;
  padding: 20px 24px 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 28px;
  right: 170px;
  width: 6px;
  height: 6px;
  background: var(--blue);
  border-radius: 50%;
}

/* Main Content */
.main-content {
  flex: 1;
  min-height: 0;
  background: var(--bg-primary);
  padding: 24px;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

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

.card-body {
  padding: 20px;
}

.card-body.no-padding {
  padding: 0;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

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

.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 16px 12px;
  text-align: right;
  border-bottom: 2px solid var(--border);
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

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

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

/* Action Buttons in Tables */
.table .action-buttons {
  display: flex;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-urgent,
.badge-critical {
  color: var(--red);
  background: var(--red-subtle);
}

.badge-high {
  color: var(--yellow);
  background: var(--yellow-subtle);
}

.badge-medium {
  color: var(--blue);
  background: var(--blue-subtle);
}

.badge-low {
  color: var(--green);
  background: var(--green-subtle);
}

.badge-open {
  color: var(--red);
  background: var(--red-subtle);
}

.badge-in-progress {
  color: var(--yellow);
  background: var(--yellow-subtle);
}

.badge-done,
.badge-resolved {
  color: var(--green);
  background: var(--green-subtle);
}

.badge-closed {
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
}

/* Financial Summary Cards */
.financial-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.financial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.financial-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.financial-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.financial-icon.income {
  background: var(--green-subtle);
  color: var(--green);
}

.financial-icon.expense {
  background: var(--red-subtle);
  color: var(--red);
}

.financial-icon.balance {
  background: var(--blue-subtle);
  color: var(--blue);
}

.financial-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
}

.financial-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.financial-amount.income {
  color: var(--green);
}

.financial-amount.expense {
  color: var(--red);
}

.financial-amount.balance {
  color: var(--blue);
}

.financial-amount.negative {
  color: var(--red) !important;
}

@media (max-width: 768px) {
  .financial-summary {
    grid-template-columns: 1fr;
  }
}

/* Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
}

.stat-value.cpu {
  color: var(--blue);
}

.stat-value.ram {
  color: var(--purple);
}

.stat-value.disk {
  color: var(--green);
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

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

.progress-fill.cpu {
  background: linear-gradient(90deg, var(--blue), var(--blue-hover));
}

.progress-fill.ram {
  background: linear-gradient(90deg, var(--purple), #7C3AED);
}

.progress-fill.disk {
  background: linear-gradient(90deg, var(--green), #059669);
}

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

/* Chat Styles */
.chat-container {
  height: calc(var(--app-height, 100vh) - 200px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  height: calc(100vh - 280px);
}

.message {
  max-width: 65%;
  word-wrap: break-word;
  animation: messageIn 0.2s ease;
  -webkit-user-select: text;
  user-select: text;
}

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

.message.own {
  align-self: flex-start;
  background: var(--blue);
  color: white;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
}

.message.other {
  align-self: flex-end;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  color: var(--text-primary);
}

.message-sender {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
}

.message-sender.marom {
  color: var(--blue);
}

.message-sender.bar {
  color: var(--green);
}

.message-sender.lenny {
  color: var(--purple);
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

.message.own .message-time {
  color: rgba(255,255,255,0.7);
}

.chat-input-area {
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 20px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  box-sizing: border-box;
}

.chat-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--blue-subtle);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 16px;
}

.chat-send-btn:hover {
  background: var(--blue-hover);
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  min-height: 300px;
  animation: fadeIn 0.3s ease;
}

.empty-state-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 300px;
  line-height: 1.5;
}

.empty-state .btn {
  margin-top: 8px;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 350px;
  box-shadow: var(--shadow-toast);
  display: none;
  z-index: 10000;
  animation: toastIn 0.3s ease;
}

.toast.success {
  border-color: var(--green);
}

.toast.success::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
}

.toast.error {
  border-color: var(--red);
}

.toast.error::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
}

.toast.show {
  display: block;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Loading State */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-size: 14px;
  color: var(--text-muted);
  gap: 12px;
}

.loading i {
  font-size: 18px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* System Info */
.system-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.system-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.system-info-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.system-info-value {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Hamburger Menu Button */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.05);
}

.menu-toggle.active {
  color: var(--blue);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
  :root {
    --mobile-header-height: 52px;
  }

  html.non-chat-scroll,
  body.non-chat-scroll {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #appContainer.non-chat-scroll {
    overflow: visible;
  }

  #appContainer.non-chat-scroll .main-container {
    overflow: visible;
  }

  /* Show hamburger */
  .menu-toggle {
    display: flex;
  }
  
  .main-container {
    flex-direction: column;
  }
  
  /* Sidebar slides in from right */
  .sidebar {
    position: fixed;
    top: var(--mobile-header-height);
    right: 0;
    height: calc(100dvh - var(--mobile-header-height));
    width: 260px;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    box-shadow: none;
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: -5px 0 30px rgba(0,0,0,0.3);
  }
  
  /* Overlay behind sidebar */
  .sidebar.open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 260px;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: -1;
  }
  
  /* Backdrop when sidebar is open */
  .sidebar.open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 260px;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
  }
  
  /* Header */
  .header {
    padding: 0 12px;
    height: 52px;
  }
  
  .header h1 {
    font-size: 14px;
    white-space: nowrap;
  }
  
  .header h1 i {
    display: none;
  }
  
  /* User info compact */
  .user-info {
    gap: 6px;
  }
  
  #userDisplayName {
    font-size: 12px;
  }
  
  #userDisplayName::before {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  
  .user-info .btn {
    height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }
  
  .user-info .btn i {
    font-size: 12px;
  }

  .notifications-dropdown {
    width: min(340px, calc(100vw - 16px));
    inset-inline-end: -90px;
  }

  .notifications-settings {
    grid-template-columns: 1fr;
  }
  
  /* Hide change password button text on mobile */
  #changePasswordBtn {
    font-size: 0;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
  }
  
  #changePasswordBtn i {
    font-size: 14px;
  }
  
  #logoutBtn {
    font-size: 0;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
  }
  
  #logoutBtn i {
    font-size: 14px;
  }
  
  /* Main content full width */
  .main-content {
    padding: 12px;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: auto;
    overscroll-behavior-y: contain;
    min-height: 0;
  }

  .main-content:not(.chat-mode) {
    height: calc(var(--app-height, 100vh) - var(--mobile-header-height));
    min-height: calc(var(--app-height, 100vh) - var(--mobile-header-height));
    max-height: calc(var(--app-height, 100vh) - var(--mobile-header-height));
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }
  
  /* Chat module: edge-to-edge on mobile */
  .main-content.chat-mode,
  .main-content:has(.chat-container) {
    padding: 0;
    overflow: hidden;
    height: 100%;
  }
  
  /* Cards */
  .card-body {
    padding: 12px;
  }
  
  .card-header {
    padding: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Forms */
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    height: 48px;
    font-size: 16px; /* prevents iOS zoom */
  }
  
  .form-group textarea {
    height: auto;
    min-height: 80px;
  }
  
  .form-group label {
    font-size: 11px;
  }
  
  /* Buttons full width (except in chat input area and header) */
  .card .btn,
  .modal .btn,
  form .btn {
    width: 100%;
    height: 44px;
    font-size: 14px;
  }
  
  .btn-small {
    height: 36px;
  }
  
  /* Tables responsive */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  
  .table thead th,
  .table tbody td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  
  .table .action-buttons {
    flex-direction: column;
    gap: 4px;
  }
  
  .table .action-buttons .btn {
    width: auto;
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }
  
  /* Chat mobile - WhatsApp-like full screen */
  .chat-container {
    height: calc(var(--app-height, 100vh) - var(--mobile-header-height)) !important;
    border-radius: 0;
    border: none;
  }
  
  .chat-messages {
    flex: 1;
    min-height: 0;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  .chat-input-area {
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  
  .message {
    max-width: 85%;
  }
  
  .chat-input {
    min-height: 44px;
    height: auto;
    font-size: 16px; /* prevents iOS zoom */
    padding: 10px 16px;
  }
  
  .chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
  }
  
  .chat-attach-btn {
    flex-shrink: 0;
  }
  
  /* Financial summary cards */
  .financial-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .financial-card {
    padding: 14px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  
  .financial-amount {
    font-size: 22px;
  }
  
  /* Dashboard stats */
  .dashboard-stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .stat-card {
    padding: 14px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  /* Empty states */
  .empty-state {
    padding: 40px 16px;
    min-height: 200px;
  }
  
  .empty-state-icon {
    font-size: 36px;
  }
  
  /* Toast */
  .toast {
    right: 12px;
    left: 12px;
    max-width: none;
  }
  
  /* Modal (login/password) */
  .modal-content {
    margin: 16px;
    padding: 24px 20px;
    max-width: none;
    width: calc(100% - 32px);
  }
  
  .logo-monogram {
    width: 56px;
    height: 56px;
    font-size: 20px;
    border-radius: 14px;
  }
  
  /* System info */
  .system-info {
    grid-template-columns: 1fr;
  }
  
  /* Form grid always single column */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Badges smaller */
  .badge {
    height: 22px;
    padding: 0 8px;
    font-size: 10px;
  }
}

/* Focus States */
button:focus,
.btn:focus,
input:focus,
select:focus,
textarea:focus,
.nav-link:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-subtle);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.p-0 { padding: 0; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

/* Animation Utilities */
.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.3s ease;
}

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

/* Print Styles */
@media print {
  .header,
  .sidebar,
  .chat-input-area,
  .btn,
  .toast {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
    max-width: none;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
/* Login button full width */
.modal-content .btn-primary {
  width: 100%;
  height: 44px;
  font-size: 15px;
}

/* Remove instructions section from chat */
/* Fix financial summary - ensure monospace numbers */
.stat-value, .financial-value, .summary-value {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-weight: 700;
}

/* Small phones */
@media (max-width: 380px) {
  .header h1 {
    font-size: 13px;
  }
  
  #userDisplayName {
    display: none;
  }
  
  .user-info .btn {
    padding: 0 6px;
    font-size: 10px;
  }
  
  .modal-content {
    padding: 20px 16px;
  }
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: #888;
  font-size: 0.85rem;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #888;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.typing-text { margin-right: 6px; }

/* Chat input wrapper - contains input + inline buttons */
.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 4px 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
  gap: 4px;
}
.chat-input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--blue-subtle);
}
.chat-input-wrapper .chat-input {
  border: none;
  background: transparent;
  padding: 6px 8px;
  min-height: 32px;
  border-radius: 0;
}
.chat-input-wrapper .chat-input:focus {
  box-shadow: none;
  border-color: transparent;
}

/* Chat attach button */
.chat-attach-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 14px;
  flex-shrink: 0;
  padding: 0;
}
.chat-attach-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

/* Chat image thumbnail */
.chat-image-thumb {
  max-width: 300px;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.chat-image-thumb:hover { opacity: 0.85; }
.chat-image-link { display: inline-block; }

/* Message time positioning - RTL: time on left */
.message .message-time {
  text-align: left;
}

/* PWA Install button */
.install-app-link {
  background: linear-gradient(135deg, var(--blue-subtle), transparent) !important;
  border: 1px dashed var(--blue) !important;
  border-radius: 8px !important;
  margin: 8px 12px !important;
}
.install-app-link:hover {
  background: var(--blue-subtle) !important;
  border-style: solid !important;
}
.install-app-link i {
  color: var(--blue) !important;
}

/* ===== Chat Upgrade - WhatsApp Style ===== */

/* Chat header bar */
.chat-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.chat-header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.chat-header-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

/* Online indicator */
.online-indicator {
  font-size: 11px;
  color: var(--text-muted);
}
.online-indicator.active {
  color: var(--green);
}
.online-indicator.active::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* User online dot in messages */
.user-online-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* Search bar */
.chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-search-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
}
.chat-search-input:focus {
  border-color: var(--border-focus);
}
.chat-search-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.message.search-highlight {
  box-shadow: 0 0 0 2px var(--yellow);
}

/* Reply preview above input */
.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-right: 3px solid var(--blue);
  flex-shrink: 0;
}
.reply-preview-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.reply-preview-user {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
}
.reply-preview-text {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.reply-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

/* Reply quote in message bubble */
.reply-quote {
  background: rgba(255,255,255,0.06);
  border-right: 2px solid var(--blue);
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.reply-quote:active {
  background: rgba(255,255,255,0.15);
}
.reply-quote-user {
  display: block;
  font-weight: 600;
  color: var(--blue);
  font-size: 10px;
}
.reply-quote-text {
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.message.own .reply-quote {
  background: rgba(255,255,255,0.12);
  border-right-color: rgba(255,255,255,0.5);
}
.message.own .reply-quote-user {
  color: rgba(255,255,255,0.8);
}
.message.own .reply-quote-text {
  color: rgba(255,255,255,0.6);
}

/* Emoji picker */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  right: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 100;
  max-width: 280px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.emoji-item {
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  text-align: center;
  transition: background 0.1s;
  user-select: none;
}
.emoji-item:hover {
  background: rgba(255,255,255,0.08);
}
.chat-emoji-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.chat-emoji-btn:hover {
  background: rgba(255,255,255,0.05);
}

/* Reactions */
.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.reaction-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.reaction-badge:hover {
  background: rgba(255,255,255,0.12);
}
.reaction-badge.mine {
  background: var(--blue-subtle);
  border-color: var(--blue);
}
.message.own .reaction-badge {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
}
.message.own .reaction-badge.mine {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

/* Reaction picker popup */
.reaction-picker-popup {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: popIn 0.15s ease;
}
.reaction-emoji-option {
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: transform 0.1s;
  user-select: none;
}
.reaction-emoji-option:hover {
  transform: scale(1.3);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

/* Context menu */
.msg-context-menu {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  min-width: 140px;
  animation: popIn 0.12s ease;
  z-index: 9999;
}
.msg-context-menu > div {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}
.msg-context-menu > div:hover {
  background: rgba(255,255,255,0.05);
}
.msg-context-menu .ctx-delete {
  color: var(--red);
}

/* Deleted message */
.deleted-msg {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}

/* Reply button on message hover */
.msg-reply-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.3);
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: var(--transition);
  z-index: 5;
}
.message:hover .msg-reply-btn {
  display: flex;
}
.msg-reply-btn:hover {
  background: rgba(0,0,0,0.5);
  color: var(--text-primary);
}
.message {
  position: relative;
}

/* Read receipts */
.read-receipt {
  margin-right: 4px;
  font-size: 11px;
}
.receipt-sent {
  color: var(--text-muted);
}
.receipt-delivered {
  color: var(--text-muted);
}
.receipt-read {
  color: #53bdeb;
}

/* Typing indicator for users */
#userTypingIndicator {
  padding: 4px 16px;
  font-size: 12px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .emoji-picker {
    right: 10px;
    left: 10px;
    bottom: 65px;
    max-width: none;
  }
  .emoji-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .msg-reply-btn {
    display: none !important;
  }
  .reply-preview-text {
    max-width: 180px;
  }
  .chat-header-bar {
    padding: 10px 12px;
  }
  .reaction-picker-popup {
    position: fixed !important;
    bottom: 80px !important;
    right: 10px !important;
    left: 10px !important;
    top: auto !important;
    justify-content: center;
  }
}

/* Attach menu - WhatsApp style */
.attach-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 299;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.attach-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px 40px;
  gap: 24px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  z-index: 300;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.attach-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s;
  padding: 8px 0;
}
.attach-menu-item:active {
  transform: scale(0.9);
}
.attach-menu-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.attach-menu-item span {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* File attachment link */
.chat-file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
  margin-top: 4px;
  transition: background 0.15s;
}
.chat-file-link:hover {
  background: rgba(255,255,255,0.1);
}
.chat-file-link i {
  font-size: 18px;
}

mark.search-mark {
  background: #ffeb3b;
  color: #000;
  border-radius: 2px;
  padding: 0 2px;
}

.search-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-nav-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.search-counter {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 40px;
  text-align: center;
}
.message.search-current {
  border-right: 3px solid #ffeb3b;
}

.voice-record-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(233,30,99,0.1), rgba(233,30,99,0.05));
  border-radius: 24px;
  border: 2px solid #E91E63;
}
.voice-cancel-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #E91E63;
  font-size: 20px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-cancel-btn:active {
  background: rgba(233,30,99,0.2);
}
.voice-timer {
  color: #E91E63;
  font-size: 18px;
  font-weight: 700;
  min-width: 50px;
  font-variant-numeric: tabular-nums;
}
.voice-recording-dot {
  width: 12px;
  height: 12px;
  background: #E91E63;
  border-radius: 50%;
  animation: pulse-record 1s infinite;
  flex-shrink: 0;
}
.voice-send-btn {
  background: #00a884;
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: auto;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,168,132,0.3);
}
.voice-send-btn:active {
  transform: scale(0.9);
}
@keyframes pulse-record {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.5; }
}
.chat-audio-msg {
  min-width: 220px;
  max-width: 280px;
}
.chat-audio-msg audio {
  display: none;
}
.audio-custom-player {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,150,136,0.15);
  border-radius: 12px;
  padding: 8px 12px;
}
.chat-audio-msg .audio-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00a884;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.chat-audio-msg .audio-play-btn:active {
  background: #008f72;
}
.audio-progress-wrap {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  min-width: 80px;
}
.audio-progress-bar {
  height: 100%;
  background: #00a884;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}
.chat-audio-msg .audio-time {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 35px;
  text-align: center;
}
.chat-video-msg video {
  max-width: 300px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Image Preview Overlay */
.image-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.95);
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}
.preview-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
}
.preview-close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-title {
  color: white;
  font-size: 16px;
  font-weight: 600;
}
.preview-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.preview-main-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.preview-thumbs {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  justify-content: center;
  overflow-x: auto;
}
.preview-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.preview-thumb.active {
  border-color: #00a884;
}
.preview-thumb.add-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 24px;
  font-weight: 300;
}
.preview-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.5);
}
.preview-caption {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 12px 18px;
  color: white;
  font-size: 16px;
  outline: none;
}
.preview-caption::placeholder {
  color: rgba(255,255,255,0.5);
}
.preview-send-btn {
  width: 48px;
  height: 48px;
  background: #00a884;
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-send-btn:active {
  transform: scale(0.9);
}

/* Sales Dashboard */
.sales-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sales-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sales-updated-at {
  color: var(--text-muted);
  font-size: 12px;
}

.sales-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.sales-summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.sales-summary-card.count-card {
  background: linear-gradient(160deg, rgba(59,130,246,0.12), rgba(59,130,246,0.04));
}

.sales-summary-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.sales-summary-title {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 6px;
}

.sales-summary-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}

.sales-summary-subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.sales-content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(380px, 2fr);
  gap: 16px;
}

.sales-top-products-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sales-top-product-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.01);
}

.sales-rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(16,185,129,0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sales-product-meta {
  min-width: 0;
}

.sales-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-product-subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.sales-product-revenue {
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
  text-align: left;
}

.sales-chart-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sales-chart-bars {
  height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px 8px;
  background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(59,130,246,0.01));
  display: flex;
  align-items: flex-end;
  gap: 6px;
  overflow-x: auto;
}

.sales-bar-group {
  min-width: 26px;
  flex: 1 0 26px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.sales-bar {
  width: 100%;
  max-width: 20px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  box-shadow: 0 4px 10px rgba(37,99,235,0.35);
  min-height: 0;
}

.sales-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
}

.sales-chart-footer {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 1200px) {
  .sales-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sales-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .sales-summary-grid {
    grid-template-columns: 1fr;
  }

  .sales-summary-value {
    font-size: 21px;
  }

  .sales-chart-bars {
    height: 220px;
  }
}

/* Orders Module */
.orders-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.orders-stat-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.orders-stat-card.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 300% 100%;
  animation: ordersSkeleton 1.2s infinite linear;
}

@keyframes ordersSkeleton {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

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

.orders-stat-value {
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.orders-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.orders-filters .filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.orders-filters .filter-group label {
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.orders-search-group {
  grid-column: span 1;
}

.orders-table-wrap {
  min-height: 120px;
}

.orders-table tbody tr {
  cursor: pointer;
}

.orders-table tbody tr.selected {
  background: rgba(59, 130, 246, 0.12);
}

.order-number {
  font-weight: 700;
  font-family: var(--font-mono);
}

.order-customer {
  font-weight: 600;
}

.order-customer-email {
  color: var(--text-muted);
  font-size: 12px;
}

.order-total {
  font-family: var(--font-mono);
  font-weight: 600;
}

.order-status-select {
  width: 100%;
  min-width: 126px;
  height: 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  padding: 0 10px;
}

.order-status-badge {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.status-processing {
  background: var(--yellow-subtle);
  color: var(--yellow);
}

.status-completed {
  background: var(--green-subtle);
  color: var(--green);
}

.status-on-hold {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
}

.status-cancelled {
  background: var(--red-subtle);
  color: var(--red);
}

.status-pending {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.orders-pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.orders-page-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.orders-page-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.orders-page-indicator {
  color: var(--text-secondary);
  font-size: 12px;
}

.order-details-card {
  margin-top: 18px;
}

.order-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.order-details-id {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.order-details-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.order-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.order-details-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.01);
}

.order-details-panel h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 10px;
}

.order-line-items,
.order-notes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-line-items li,
.order-notes-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.01);
}

.line-item-name,
.note-text {
  font-weight: 600;
}

.line-item-meta,
.note-meta {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
}

.order-address {
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.order-notes-title {
  margin-top: 10px;
}

.order-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state.compact {
  min-height: 160px;
}

@media (max-width: 980px) {
  .orders-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orders-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .orders-filters {
    grid-template-columns: 1fr;
  }

  .orders-page-controls {
    width: 100%;
    justify-content: space-between;
  }

  .orders-page-indicator {
    font-size: 11px;
  }
}
