/* Typography and Global Resets */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette (Quantum Brand Enterprise) */
  --bg-main: #f9f9fb;
  --bg-card: #ffffff;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --border-color: #e5e7eb;
  
  --primary-color: #1f2937;
  --primary-hover: #111827;
  --primary-bg-hover: #f3f4f6;
  
  --success: #047857;
  --success-bg: #ecfdf5;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;

  --border-radius: 6px;
  --border-radius-sm: 4px;
  --border-radius-lg: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --focus-ring: 0 0 0 2px rgba(31, 41, 55, 0.2);
  
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --header-height: 70px;
  
  --transition-fast: 0.15s ease;
  --transition-sidebar: 0.28s cubic-bezier(0.2, 0, 0, 1);
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ===================================================
   SIDEBAR NAVIGATION (Hoverable / Smooth Collapsible)
   =================================================== */
.sidebar {
  width: var(--sidebar-collapsed-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow: hidden; /* Main sidebar does not scroll; only sidebar-nav scrolls! */
  transition: width var(--transition-sidebar), box-shadow var(--transition-sidebar);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.02);
}

/* Hover or Pinned Expand State */
.sidebar:hover,
.sidebar.pinned {
  width: var(--sidebar-width);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 4px 0 20px rgba(0, 0, 0, 0.04);
}

/* Sidebar Logo Area */
.sidebar-logo {
  height: var(--header-height);
  min-height: var(--header-height);
  flex-shrink: 0; /* CRITICAL: Never shrink logo! */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: padding var(--transition-sidebar);
}

.sidebar:hover .sidebar-logo,
.sidebar.pinned .sidebar-logo {
  padding: 0 16px;
  justify-content: space-between;
}

.sidebar-logo-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  flex: 1;
  overflow: hidden;
}

/* Compact logo mark (showing in collapsed state) */
.sidebar-logo-compact {
  height: 38px;
  width: 38px;
  max-width: 38px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
  flex-shrink: 0;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Full banner logo (showing in expanded state) */
.sidebar-logo-full {
  max-height: 42px;
  max-width: 175px;
  width: auto;
  object-fit: contain;
  display: none;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.sidebar:hover .sidebar-logo-compact,
.sidebar.pinned .sidebar-logo-compact {
  display: none;
  opacity: 0;
}

.sidebar:hover .sidebar-logo-full,
.sidebar.pinned .sidebar-logo-full {
  display: block;
  opacity: 1;
  transform: scale(1);
}

/* Pin button */
.sidebar-pin-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 6px;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  flex-shrink: 0;
}

.sidebar-pin-btn:hover {
  background-color: var(--bg-main);
  color: var(--text-primary);
}

.sidebar:hover .sidebar-pin-btn,
.sidebar.pinned .sidebar-pin-btn {
  display: flex;
  opacity: 1;
}

.sidebar-pin-btn.active {
  color: var(--primary-color);
  background-color: var(--primary-bg-hover);
}

/* Sidebar Navigation Items */
.sidebar-nav {
  padding: 10px 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 0%;
  min-height: 0; /* CRITICAL: Enables scrolling in flex child! */
  overflow-y: auto; /* Internal scrolling only */
  overflow-x: hidden;
}

/* Custom smooth thin scrollbar on sidebar-nav */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}
.sidebar:hover .sidebar-nav::-webkit-scrollbar-thumb,
.sidebar.pinned .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
}

.nav-item {
  display: flex;
  align-items: center;
  height: 40px;
  min-height: 40px;
  flex-shrink: 0; /* CRITICAL: Can NEVER be crushed to 0px! */
  padding: 0 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color var(--transition-fast), color var(--transition-fast), padding var(--transition-sidebar);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.sidebar:hover .nav-item,
.sidebar.pinned .nav-item {
  padding: 0 14px;
}

.nav-item i,
.nav-item .nav-item-icon {
  font-size: 1.25rem;
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 0 !important;
}

.nav-item .nav-text {
  margin-left: 12px;
  opacity: 0;
  max-width: 0;
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-8px);
  pointer-events: none;
  transition: opacity 0.16s ease, max-width var(--transition-sidebar), transform 0.16s ease;
}

.sidebar:hover .nav-item .nav-text,
.sidebar.pinned .nav-item .nav-text {
  opacity: 1;
  max-width: 180px;
  transform: translateX(0);
  pointer-events: auto;
  transition: opacity 0.22s ease 0.05s, max-width var(--transition-sidebar), transform 0.22s ease 0.05s;
}

.nav-item:hover {
  background-color: var(--bg-main);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--primary-bg-hover);
  color: var(--primary-color);
  font-weight: 700;
}

/* Group Titles (Subtle line divider in collapsed, full title in expanded) */
.nav-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  transition: all var(--transition-sidebar);
  flex-shrink: 0; /* CRITICAL */
  
  /* Collapsed state: neat 1px divider */
  height: 1px;
  padding: 0;
  margin: 8px 6px;
  background-color: var(--border-color);
  border: none;
}

.nav-group-title-content {
  display: none;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.nav-group-title .chevron {
  display: none;
  opacity: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar:hover .nav-group-title,
.sidebar.pinned .nav-group-title {
  height: auto;
  padding: 8px 12px;
  margin-top: 14px;
  margin-bottom: 4px;
  background-color: transparent;
}

.sidebar:hover .nav-group-title-content,
.sidebar.pinned .nav-group-title-content {
  display: flex;
  opacity: 1;
}

.sidebar:hover .nav-group-title .chevron,
.sidebar.pinned .nav-group-title .chevron {
  display: inline-block;
  opacity: 1;
}

.nav-group-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0; /* CRITICAL */
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 8px 9px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0; /* CRITICAL: Never shrink footer! */
  background: var(--bg-card);
}

.sidebar-quick-search-hint {
  padding: 6px 10px;
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-quick-search-hint .nav-text {
  opacity: 0;
  max-width: 0;
  display: none;
  transition: opacity 0.2s ease;
}

.sidebar:hover .sidebar-quick-search-hint .nav-text,
.sidebar.pinned .sidebar-quick-search-hint .nav-text {
  opacity: 1;
  max-width: 150px;
  display: inline;
}

/* Main Content with Collapsed Sidebar Margin & Flexible Width */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-collapsed-width);
  padding: 24px 28px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 20px;
  margin-top: 0 !important;
  width: calc(100% - var(--sidebar-collapsed-width));
  max-width: calc(100% - var(--sidebar-collapsed-width));
  overflow-x: hidden;
  box-sizing: border-box;
  transition: margin-left var(--transition-sidebar), width var(--transition-sidebar), max-width var(--transition-sidebar);
}

.main-content.sidebar-pinned {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
}

#page-content {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Responsive Breakpoints for Different Laptop Sizes & Zoom Levels */
@media (max-width: 1366px) {
  .main-content {
    padding: 20px 22px;
  }
}

@media (max-width: 1024px) {
  .main-content {
    padding: 16px 18px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 14px;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  align-items: center;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--primary-bg-hover);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-right: 16px;
}

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Data Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

.data-table th {
  background-color: var(--bg-main);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: var(--bg-main);
}

.data-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

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

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-card);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
}

.btn i {
  margin-right: 8px;
}

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

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

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

.btn-secondary:hover {
  background-color: var(--bg-main);
}

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

.btn-danger:hover {
  background-color: #b91c1c;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 9999px;
  line-height: 1;
}

.badge-success {
  background-color: var(--success-bg);
  color: #065f46;
}

.badge-warning {
  background-color: var(--warning-bg);
  color: #92400e;
}

.badge-danger {
  background-color: var(--danger-bg);
  color: #991b1b;
}

.badge-primary {
  background-color: var(--primary-bg-hover);
  color: var(--primary-hover);
}

/* Modal */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(15, 23, 42, 0.6) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.modal, .modal-content {
  background-color: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-fast);
}

.modal.modal-sm, .modal-sm {
  max-width: 480px !important;
  width: 90% !important;
}

.modal.modal-md, .modal-md {
  max-width: 720px !important;
  width: 92% !important;
}

.modal.modal-lg, .modal-lg {
  max-width: 980px !important;
  width: 94% !important;
}

.modal.modal-xl, .modal-xl {
  max-width: 1280px !important;
  width: 96% !important;
}

.modal.modal-2xl, .modal-2xl {
  max-width: 1420px !important;
  width: 98% !important;
}

/* Modal styling improvements */
#edit-po-container > .card {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

#edit-po-container > .card > .card-body {
  padding: 0 !important;
}

@media (max-width: 1100px) {
  .po-info-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 640px) {
  .po-info-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 900px) {
  .utm-discount-grid {
    grid-template-columns: 1fr !important;
  }
  .utm-discount-grid > div:first-child {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color) !important;
  }
}

.modal-overlay.active .modal, .modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--primary-color); }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }

.w-100 { width: 100%; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium { font-weight: 500; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* Filter & Search */
.search-box {
  position: relative;
  width: 100%;
  max-width: 400px;
}
.search-box-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.25rem;
}
.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}
.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}
.tab-item {
  padding: 12px 24px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab-item:hover {
  color: var(--text-primary);
  background-color: var(--bg-main);
}
.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 16px;
}
.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background-color: var(--bg-main);
  color: var(--text-primary);
}

.piutang-alert {
  background-color: #fff1f2 !important;
}
.piutang-alert:hover {
  background-color: #ffe4e6 !important;
}

/* Sidebar Dropdown */
.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  padding-left: 36px;
  margin-top: -4px;
  margin-bottom: 8px;
  gap: 4px;
}

.nav-dropdown-menu.show {
  display: flex;
}

.nav-dropdown-item {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9em;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.nav-dropdown-item:before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 10px;
}

.nav-dropdown-item:hover, .nav-dropdown-item.active {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-dropdown-item:hover:before, .nav-dropdown-item.active:before {
  background: var(--primary-color);
}

.nav-item .dropdown-icon {
  margin-left: auto;
  transition: transform 0.3s;
}

.nav-item.expanded .dropdown-icon {
  transform: rotate(180deg);
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 20px 20px 8px 20px;
  margin-top: 5px;
}

#current-page-title { display: none; }
.page-header { justify-content: flex-end !important; }


/* ========== DARK MODE ========== */
[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --bg-input: #1e293b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}
[data-theme="dark"] .sidebar {
  background-color: #0f172a;
  border-right-color: #1e293b;
}
[data-theme="dark"] .nav-item {
  color: #cbd5e1;
}
[data-theme="dark"] .nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #e2e8f0;
}
[data-theme="dark"] .nav-item.active {
  background-color: var(--primary-bg-hover);
  color: var(--primary-color);
  font-weight: 700;
}
[data-theme="dark"] .nav-label {
  color: #475569 !important;
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .stat-card,
[data-theme="dark"] .card {
  background: #1e293b;
  border-color: #334155;
}
[data-theme="dark"] table {
  color: #e2e8f0;
}
[data-theme="dark"] thead th {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] tbody tr {
  border-bottom-color: #1e293b !important;
}
[data-theme="dark"] tbody tr:hover {
  background: rgba(59, 130, 246, 0.05) !important;
}
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}
[data-theme="dark"] .badge {
  opacity: 0.9;
}
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
  color: #f1f5f9;
}

/* ========== COMMAND PALETTE RESULT ITEM ========== */
.cmd-result-item {
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
  color: #334155;
}
.cmd-result-item:hover,
.cmd-result-item.active {
  background: #f1f5f9;
}
.cmd-result-item i {
  font-size: 18px;
  color: #64748b;
  width: 24px;
  text-align: center;
}
.cmd-result-item .cmd-label {
  font-size: 14px;
  font-weight: 500;
}
.cmd-result-item .cmd-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-left: auto;
}
.cmd-result-group {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== KEYBOARD SHORTCUT TOAST ========== */
.shortcut-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 10000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.shortcut-toast i {
  font-size: 18px;
  color: #3b82f6;
}

/* ========== DRAFT INDICATOR ========== */
.draft-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  animation: pulse 2s infinite;
}
.draft-indicator i {
  font-size: 14px;
}

/* ========== DUPLICATE BUTTON ========== */
.btn-duplicate {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: #64748b;
  font-size: 12px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-duplicate:hover {
  background: #f0f9ff;
  border-color: #3b82f6;
  color: #3b82f6;
}

/* Dark mode for command palette */
[data-theme="dark"] #command-palette-overlay > div {
  background: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] #command-palette-overlay > div > div:first-child {
  border-bottom-color: #334155 !important;
}
[data-theme="dark"] #command-palette-input {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .cmd-result-item {
  color: #e2e8f0;
}
[data-theme="dark"] .cmd-result-item:hover,
[data-theme="dark"] .cmd-result-item.active {
  background: #334155;
}
[data-theme="dark"] .cmd-result-group {
  color: #64748b;
}
[data-theme="dark"] #command-palette-overlay > div > div:last-child {
  background: #0f172a !important;
  border-top-color: #334155 !important;
}

/* Dark mode for shortcut guide */
[data-theme="dark"] #shortcut-guide-overlay > div {
  background: #1e293b !important;
}
[data-theme="dark"] #shortcut-guide-overlay h3 {
  color: #f1f5f9 !important;
}
[data-theme="dark"] #shortcut-guide-overlay td {
  color: #cbd5e1 !important;
}
[data-theme="dark"] #shortcut-guide-overlay kbd {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}


/* ==========================================================================
   EXCEL SPREADSHEET COMPACT & CLEAN DESIGN SYSTEM (NO BORDER RADIUS, NO ICONS)
   ========================================================================== */
.excel-modal {
  border-radius: 0 !important;
  border: 1px solid #94a3b8 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
  background: #ffffff !important;
}

.excel-header {
  border-radius: 0 !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

.excel-toolbar {
  border-radius: 0 !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

.excel-table-container {
  border-radius: 0 !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
}

.excel-grid-table {
  width: 100%;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  border: 1px solid #cbd5e1 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 13px !important;
  margin: 0 !important;
}

.excel-grid-table thead th {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  padding: 6px 8px !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  text-align: center !important;
  white-space: nowrap !important;
  border-radius: 0 !important;
}

.excel-grid-table tbody td {
  border: 1px solid #cbd5e1 !important;
  padding: 0 !important;
  height: 32px !important;
  background: #ffffff;
  vertical-align: middle !important;
  border-radius: 0 !important;
}

.excel-grid-table tbody tr:nth-child(even) td {
  background: #f8fafc !important;
}

.excel-cell-input,
.excel-cell-select {
  width: 100% !important;
  height: 32px !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  background: transparent !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
  color: #0f172a !important;
  font-family: inherit !important;
  box-shadow: none !important;
}

.excel-cell-input:focus,
.excel-cell-select:focus {
  background: #ffffff !important;
  outline: 2px solid #2563eb !important;
  outline-offset: -2px !important;
  z-index: 2 !important;
  position: relative !important;
}

.excel-btn {
  border-radius: 0 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 5px 14px !important;
  box-shadow: none !important;
}

.excel-footer {
  border-radius: 0 !important;
  background: #f1f5f9 !important;
  border-top: 1px solid #cbd5e1 !important;
}


[data-theme="dark"] .sidebar-pin-btn {
  color: #94a3b8;
}
[data-theme="dark"] .sidebar-pin-btn:hover {
  background-color: #1e293b;
  color: #f1f5f9;
}
[data-theme="dark"] .sidebar-pin-btn.active {
  color: #60a5fa;
  background-color: rgba(59, 130, 246, 0.15);
}
[data-theme="dark"] .sidebar-quick-search-hint {
  border-top-color: #334155;
  color: #64748b;
}
[data-theme="dark"] .sidebar-quick-search-hint kbd {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* ==========================================================================
   ENTERPRISE INVOICE & PIUTANG STYLES (Organic, Classy, High-End SaaS)
   ========================================================================== */

.inv-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border-color);
}

.inv-page-title {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.25;
}

.inv-page-desc {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 5px;
}

/* Organic KPI Metric Cards */
.inv-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.inv-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

.inv-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: #cbd5e1;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  transition: width 0.2s ease;
}

.inv-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 4px 10px -3px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

.inv-kpi-card.kpi-total::before { background: linear-gradient(180deg, #3b82f6, #1d4ed8); }
.inv-kpi-card.kpi-paid::before { background: linear-gradient(180deg, #10b981, #047857); }
.inv-kpi-card.kpi-pending::before { background: linear-gradient(180deg, #f59e0b, #b45309); }
.inv-kpi-card.kpi-overdue::before { background: linear-gradient(180deg, #ef4444, #b91c1c); }

.inv-kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.inv-kpi-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.kpi-total .inv-kpi-icon { background: #eff6ff; color: #2563eb; }
.kpi-paid .inv-kpi-icon { background: #ecfdf5; color: #059669; }
.kpi-pending .inv-kpi-icon { background: #fffbeb; color: #d97706; }
.kpi-overdue .inv-kpi-icon { background: #fef2f2; color: #dc2626; }

.inv-kpi-label {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.inv-kpi-count-pill {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-main);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-variant-numeric: tabular-nums;
}

.inv-kpi-value {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  margin-bottom: 6px;
}

.inv-kpi-value.paid-val { color: #047857; }
.inv-kpi-value.pending-val { color: #b45309; }
.inv-kpi-value.overdue-val { color: #b91c1c; }

.inv-kpi-subtext {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Organic Segmented Nav */
.inv-segmented-nav {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  gap: 4px;
}

.inv-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.inv-nav-btn:hover {
  color: var(--text-primary);
  background: #f8fafc;
}

.inv-nav-btn.active {
  background: #111827;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.15);
}

.inv-nav-count {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.inv-nav-btn.active .inv-nav-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Organic Filter Bar */
.inv-filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.inv-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) minmax(140px, 1.3fr) minmax(130px, 1.1fr) minmax(140px, 1.3fr) minmax(140px, 1.2fr) auto;
  gap: 12px;
  align-items: center;
}

@media (max-width: 1200px) {
  .inv-filter-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.inv-kpi-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 2px 4px;
  flex-wrap: wrap;
  gap: 8px;
}

.inv-filter-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.04);
}

.inv-btn-reset-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.18s ease;
}

.inv-btn-reset-filter:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

.inv-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.inv-search-icon {
  position: absolute;
  left: 12px;
  font-size: 17px;
  color: #94a3b8;
  pointer-events: none;
}

.inv-input-search {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}

.inv-input-search:focus,
.inv-select-custom:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.inv-select-custom {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.inv-btn-action {
  height: 38px;
  padding: 0 16px;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.inv-btn-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.inv-btn-action.primary-btn {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.inv-btn-action.primary-btn:hover {
  background: #1f2937;
  border-color: #1f2937;
}

/* Organic Table System */
.inv-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.inv-table-ribbon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.inv-table-styled {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.84rem;
  line-height: 1.45;
  margin: 0;
}

.inv-table-styled thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.inv-table-styled thead th.center { text-align: center; }
.inv-table-styled thead th.right { text-align: right; }

.inv-table-styled thead th.sortable-col-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.inv-table-styled thead th.sortable-col-header:hover {
  background-color: #f1f5f9;
  color: var(--primary);
}
.inv-table-styled thead th.sortable-col-header:hover .sort-icon-badge.inactive {
  opacity: 0.8 !important;
  color: var(--primary);
}
.sort-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.sort-icon-badge.active {
  color: var(--primary);
}
[data-theme="dark"] .inv-table-styled thead th.sortable-col-header:hover {
  background-color: #1e293b;
  color: #60a5fa;
}
[data-theme="dark"] .sort-icon-badge.active {
  color: #60a5fa;
}

.inv-table-styled tbody tr {
  transition: background-color 0.15s ease;
}

.inv-table-styled tbody tr:hover {
  background-color: #f8fafc;
}

.inv-table-styled tbody td {
  padding: 14px 16px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

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

.inv-table-styled tbody td.center { text-align: center; }
.inv-table-styled tbody td.right { text-align: right; }

/* Elegant Typography & Badges in Rows (Strictly Plus Jakarta Sans) */
.inv-po-badge {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  color: #0f172a;
  display: block;
  letter-spacing: -0.01em;
}

.inv-invoice-badge {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  color: #2563eb;
  display: block;
  letter-spacing: -0.01em;
}

.inv-subtext {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

/* Organic Customer Avatar / Pill */
.inv-cust-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-cust-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.inv-cust-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.84rem;
  line-height: 1.35;
}

/* Due Date Pill */
.inv-due-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.inv-due-pill.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.inv-due-pill.warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.inv-due-pill.success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.inv-due-pill.normal {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Amount in Table */
.inv-amount-cell {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

/* Status Badges */
.inv-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.inv-status-pill.paid {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.inv-status-pill.unpaid {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.inv-status-pill.overdue {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Modern Action Buttons */
.inv-action-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.inv-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inv-btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.inv-btn-settle {
  height: 32px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
  cursor: pointer;
  transition: all 0.15s ease;
}

.inv-btn-settle:hover {
  background: #d1fae5;
  border-color: #059669;
  color: #065f46;
  transform: translateY(-1px);
}

/* Customer Summary Card in Tab 2 */
.inv-cust-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.inv-cust-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.07);
  border-color: #cbd5e1;
}

.inv-cust-progress-wrap {
  margin: 12px 0;
}

.inv-cust-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
}

.inv-cust-progress-fill {
  height: 100%;
  background: #10b981;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Dark Mode Overrides for Organic Inv Styles */
[data-theme="dark"] .inv-page-title { color: #f8fafc; }
[data-theme="dark"] .inv-kpi-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .inv-kpi-count-pill { background: #0f172a; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .inv-kpi-value { color: #f8fafc; }
[data-theme="dark"] .inv-segmented-nav { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .inv-nav-btn { color: #94a3b8; }
[data-theme="dark"] .inv-nav-btn:hover { background: #334155; color: #f8fafc; }
[data-theme="dark"] .inv-nav-btn.active { background: #3b82f6; color: #ffffff; }
[data-theme="dark"] .inv-filter-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .inv-input-search,
[data-theme="dark"] .inv-select-custom { background: #0f172a; border-color: #334155; color: #f8fafc; }
[data-theme="dark"] .inv-btn-action { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .inv-btn-action:hover { background: #334155; }
[data-theme="dark"] .inv-table-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .inv-table-ribbon { background: #0f172a; border-bottom-color: #334155; }
[data-theme="dark"] .inv-table-styled thead th { background: #0f172a; border-bottom-color: #334155; color: #94a3b8; }
[data-theme="dark"] .inv-table-styled tbody tr:hover { background-color: #334155; }
[data-theme="dark"] .inv-table-styled tbody td { color: #f1f5f9; border-bottom-color: #334155; }
[data-theme="dark"] .inv-po-badge { color: #f8fafc; }
[data-theme="dark"] .inv-invoice-badge { color: #60a5fa; }
[data-theme="dark"] .inv-amount-cell { color: #f8fafc; }
[data-theme="dark"] .inv-cust-avatar { background: #0f172a; color: #cbd5e1; border-color: #334155; }
[data-theme="dark"] .inv-cust-name { color: #f8fafc; }
[data-theme="dark"] .inv-btn-icon { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .inv-btn-icon:hover { background: #334155; color: #ffffff; }
[data-theme="dark"] .inv-cust-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .inv-cust-progress-bar { background: #334155; }

/* ===================================================
   RESPONSIVE DASHBOARD GRID SYSTEM (Laptop & Zoom Friendly)
   =================================================== */

.dash-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

@media (max-width: 1360px) {
  .dash-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .dash-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dash-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.dash-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
}

@media (max-width: 1150px) {
  .dash-charts-row {
    grid-template-columns: 1fr;
  }
}

.dash-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  width: 100%;
}

@media (max-width: 980px) {
  .dash-two-col-grid {
    grid-template-columns: 1fr;
  }
}

.dash-sales-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
}

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

@media (max-width: 580px) {
  .dash-sales-grid {
    grid-template-columns: 1fr;
  }
}

.dash-three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  width: 100%;
}

@media (max-width: 1080px) {
  .dash-three-col-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   SYSTEM ACTIVITY & LAST UPDATED HUB
   ========================================== */
.dash-activity-grid {
  display: grid;
  grid-template-columns: 260px 220px 1fr;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .dash-activity-grid {
    grid-template-columns: 1fr 1fr;
  }
  .dash-activity-grid > div:nth-child(3) {
    grid-column: span 2;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
  }
}

@media (max-width: 640px) {
  .dash-activity-grid {
    grid-template-columns: 1fr;
  }
  .dash-activity-grid > div:nth-child(1),
  .dash-activity-grid > div:nth-child(2) {
    border-right: none !important;
    border-bottom: 1px solid #f1f5f9;
    padding-right: 0 !important;
    padding-bottom: 12px;
  }
  .dash-activity-grid > div:nth-child(3) {
    grid-column: span 1;
  }
}

.act-tab-btn {
  transition: all 0.15s ease;
  cursor: pointer;
}
.act-tab-btn:hover:not(.active) {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* ==========================================
   DASHBOARD TIME HORIZON ACTIVE TABS & CONTROLS
   ========================================== */
.dash-time-filter-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  margin-bottom: 24px;
}

.dash-horizon-nav {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  gap: 3px;
}

.dash-horizon-btn {
  border: none;
  background: transparent;
  color: #475569;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.dash-horizon-btn:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.dash-horizon-btn.active {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .dash-time-filter-card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .dash-horizon-nav {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dash-horizon-btn {
  color: #94a3b8;
}

[data-theme="dark"] .dash-horizon-btn:hover:not(.active) {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .dash-horizon-btn.active {
  background: #0f172a;
  color: #f8fafc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   DASHBOARD SECTION 3: CASH INFLOW DUE DATE TABS
   ========================================== */
.dash-inflow-nav {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  gap: 3px;
  max-width: 100%;
  overflow-x: auto;
}

.dash-inflow-btn {
  border: none;
  background: transparent;
  color: #475569;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.dash-inflow-btn:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.dash-inflow-btn.active {
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .dash-inflow-nav {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dash-inflow-btn {
  color: #94a3b8;
}

[data-theme="dark"] .dash-inflow-btn:hover:not(.active) {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .dash-inflow-btn.active {
  background: #2563eb;
  color: #ffffff;
}

/* ==========================================
   INTERACTIVE KPI CARDS & DRILLDOWN MODAL
   ========================================== */
.interactive-kpi-card {
  cursor: pointer !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.interactive-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.09), 0 4px 6px -2px rgba(15, 23, 42, 0.04) !important;
}

.interactive-kpi-card:active {
  transform: translateY(0) scale(0.99);
}

.interactive-kpi-card .kpi-drilldown-hint {
  opacity: 0.7;
  transform: translateX(0);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: 4px;
}

.interactive-kpi-card:hover .kpi-drilldown-hint {
  opacity: 1;
  transform: translateX(2px);
}

.interactive-kpi-card[data-kpi-type="TOTAL_PO"]:hover {
  border-color: #3b82f6 !important;
}
.interactive-kpi-card[data-kpi-type="TOTAL_PO"] .kpi-drilldown-hint {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.interactive-kpi-card[data-kpi-type="BILLED"]:hover {
  border-color: #f59e0b !important;
}
.interactive-kpi-card[data-kpi-type="BILLED"] .kpi-drilldown-hint {
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.interactive-kpi-card[data-kpi-type="UNBILLED"]:hover {
  border-color: #64748b !important;
}
.interactive-kpi-card[data-kpi-type="UNBILLED"] .kpi-drilldown-hint {
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.interactive-kpi-card[data-kpi-type="COLLECTED"]:hover {
  border-color: #10b981 !important;
}
.interactive-kpi-card[data-kpi-type="COLLECTED"] .kpi-drilldown-hint {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.interactive-kpi-card[data-kpi-type="PROFIT"]:hover {
  border-color: #6366f1 !important;
}
.interactive-kpi-card[data-kpi-type="PROFIT"] .kpi-drilldown-hint {
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
}

/* Modal Tab Styles for Audit */
.audit-modal-nav {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
}

.audit-modal-tab-btn {
  border: none;
  background: transparent;
  color: #475569;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.audit-modal-tab-btn:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.audit-modal-tab-btn.active {
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Dark mode overrides */
[data-theme="dark"] .interactive-kpi-card:hover {
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .audit-modal-nav {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .audit-modal-tab-btn {
  color: #94a3b8;
}

[data-theme="dark"] .audit-modal-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
}

@keyframes qicSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-loader {
  animation: qicSpin 0.75s linear infinite;
  display: inline-block;
}

/* ══════════════════════════════════════════════════════════════
   OFFER MODULE STYLES (Clean & High Clarity - Apple/iOS Style)
   ══════════════════════════════════════════════════════════════ */

/* KPI Row */
.offer-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .offer-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .offer-kpi-row { grid-template-columns: 1fr; } }

.offer-kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}
.offer-kpi-card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.offer-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.offer-kpi-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.offer-kpi-val {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 4px;
}

.offer-kpi-sub {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.offer-kpi-card.kpi-offering .offer-kpi-sub { color: #2563eb; }
.offer-kpi-card.kpi-accepted .offer-kpi-sub { color: #16a34a; }
.offer-kpi-card.kpi-cancelled .offer-kpi-sub { color: #dc2626; }

.offer-filter-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.10);
  color: #2563eb;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  vertical-align: middle;
}

/* Filter Grid */
.offer-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 900px) { .offer-filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .offer-filter-grid { grid-template-columns: 1fr; } }

/* Status Badges (Clean Text Pill) */
.offer-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.offer-status-badge.status-offering {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.20);
}
.offer-status-badge.status-accepted {
  background: rgba(22, 163, 74, 0.08);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.20);
}
.offer-status-badge.status-cancelled {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.20);
}

/* Sales Pill */
.offer-sales-pill {
  display: inline-block;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* Explicit Action Buttons (High Clarity, No Raw Glyphs) */
.btn-offer-action {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.3;
}
.btn-offer-accept {
  background: rgba(22, 163, 74, 0.10);
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.25);
}
.btn-offer-accept:hover {
  background: #16a34a;
  color: #ffffff;
}
.btn-offer-cancel {
  background: transparent;
  color: #64748b;
  border-color: #cbd5e1;
}
.btn-offer-cancel:hover {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.20);
}
.btn-offer-delete {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 4px 6px;
}
.btn-offer-delete:hover {
  color: #dc2626;
}

/* Document Button */
.btn-offer-doc {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.06);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.20);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-offer-doc:hover {
  background: #2563eb;
  color: #ffffff;
}

/* ── Google Drive Document Preview Modal (Centered, Solid & Large Viewport) ── */
.offer-doc-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(15, 23, 42, 0.75) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999999 !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  opacity: 1 !important;
}

.offer-doc-modal-box {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 14px !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5) !important;
  width: 95vw !important;
  max-width: 1240px !important;
  height: 90vh !important;
  max-height: 900px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  margin: auto !important;
  position: relative !important;
  opacity: 1 !important;
}

.offer-doc-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 14px 20px !important;
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  flex-shrink: 0 !important;
}

.offer-doc-modal-body {
  flex: 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background-color: #f1f5f9 !important;
  position: relative !important;
}

.offer-doc-modal-footer {
  padding: 10px 20px !important;
  background-color: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  flex-shrink: 0 !important;
}

[data-theme="dark"] .offer-doc-modal-box {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .offer-doc-modal-header {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .offer-doc-modal-footer {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .offer-doc-modal-body {
  background-color: #0f172a !important;
}

@media (max-width: 768px) {
  .offer-doc-modal-overlay {
    padding: 8px !important;
  }
  .offer-doc-modal-box {
    width: 100vw !important;
    height: 94vh !important;
    max-height: none !important;
    border-radius: 10px !important;
  }
  .offer-doc-modal-header {
    padding: 10px 14px !important;
  }
  .offer-doc-modal-footer {
    padding: 8px 14px !important;
  }
}

/* ===================================================
   SIDEBAR USER & BRANCH WIDGET (ENTERPRISE THEME)
   =================================================== */
.sidebar-user-branch {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: all var(--transition-sidebar);
  flex-shrink: 0;
  overflow: hidden;
}

/* 1. Compact View (Collapsed Sidebar: 70px) */
.sidebar-branch-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  width: 100%;
  cursor: pointer;
  user-select: none;
}

.sidebar-branch-avatar-wrap {
  position: relative;
  display: inline-flex;
}

.sidebar-branch-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-bg-hover);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  transition: all var(--transition-fast);
}

.sidebar-branch-compact:hover .sidebar-branch-avatar-mini {
  background: var(--bg-main);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.sidebar-branch-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.sidebar-branch-status-dot.dot-dev { background-color: #6366f1; }
.sidebar-branch-status-dot.dot-superadmin { background-color: #2563eb; }
.sidebar-branch-status-dot.dot-staff { background-color: #10b981; }

.sidebar-branch-code-badge {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: inherit;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bg-main);
}

/* 2. Expanded View (Hovered / Pinned Sidebar: 260px) */
.sidebar-branch-expanded {
  display: none;
  opacity: 0;
  padding: 10px 12px;
  transition: opacity 0.2s ease;
}

.sidebar:hover .sidebar-branch-compact,
.sidebar.pinned .sidebar-branch-compact {
  display: none;
}

.sidebar:hover .sidebar-branch-expanded,
.sidebar.pinned .sidebar-branch-expanded {
  display: block;
  opacity: 1;
}

.sidebar-user-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition-fast);
}

.sidebar-user-card:hover {
  border-color: #cbd5e1;
}

.sidebar-user-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
  flex-shrink: 0;
}

.sidebar-user-text {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.sidebar-user-email {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-role-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.sidebar-role-pill.role-dev {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.sidebar-role-pill.role-superadmin {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.sidebar-role-pill.role-staff {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Branch scope in widget */
.sidebar-branch-box {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-branch-caption {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-branch-select-container {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-branch-select-container i.ph-caret-down {
  position: absolute;
  right: 8px;
  pointer-events: none;
  font-size: 11px;
  color: var(--text-secondary);
}

.sidebar-branch-select-input {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 24px 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.sidebar-branch-select-input:hover {
  border-color: #cbd5e1;
}

.sidebar-branch-select-input:focus {
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

.sidebar-branch-locked-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-branch-locked-card i {
  color: var(--text-muted);
  font-size: 12px;
}

/* Dark mode adjustments for sidebar-user-branch */
[data-theme="dark"] .sidebar-user-branch {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

[data-theme="dark"] .sidebar-user-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .sidebar-user-card:hover {
  border-color: #475569;
}

[data-theme="dark"] .sidebar-user-avatar {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .sidebar-branch-avatar-mini {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .sidebar-branch-select-input {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .sidebar-branch-locked-card {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

[data-theme="dark"] .sidebar-role-pill.role-dev {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="dark"] .sidebar-role-pill.role-superadmin {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .sidebar-role-pill.role-staff {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   QUANTUM EXECUTIVE AI ASSISTANT WIDGET & FAB STYLES
   ========================================================================== */

.quantum-ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5), 0 8px 10px -6px rgba(37, 99, 235, 0.4);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  user-select: none;
}

.quantum-ai-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 28px -5px rgba(37, 99, 235, 0.6), 0 10px 12px -6px rgba(37, 99, 235, 0.4);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.quantum-ai-fab:active {
  transform: translateY(0) scale(0.98);
}

.ai-fab-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #ffffff;
}

.ai-fab-label {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.2px;
}

.ai-fab-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: aiFabPulse 2s infinite;
}

@keyframes aiFabPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* LIVE CALL FLOATING BUTTON */
.quantum-call-fab {
  position: fixed;
  bottom: 24px;
  right: 180px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 12px;
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.5), 0 8px 10px -6px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.quantum-call-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 14px 28px -5px rgba(16, 185, 129, 0.6);
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.quantum-call-fab:active {
  transform: translateY(0) scale(0.98);
}

.call-fab-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #ffffff;
}

/* WIDGET CONTAINER */
.quantum-ai-widget {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 400px;
  height: 580px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: aiWidgetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', sans-serif;
}

@keyframes aiWidgetSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-widget-header {
  padding: 14px 18px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.15rem;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.ai-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.ai-status {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-header-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #cbd5e1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.ai-header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* CHAT BODY */
.ai-widget-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: aiMsgFade 0.2s ease;
}

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

.ai-msg.user {
  align-self: flex-end;
}

.ai-msg.assistant {
  align-self: flex-start;
}

.ai-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  word-break: break-word;
}

.ai-msg.user .ai-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-msg.assistant .ai-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.ai-bubble p {
  margin: 0 0 6px 0;
}
.ai-bubble p:last-child {
  margin-bottom: 0;
}
.ai-bubble ul, .ai-bubble ol {
  margin: 4px 0 6px 18px;
  padding: 0;
}
.ai-bubble li {
  margin-bottom: 4px;
}
.ai-bubble strong {
  color: #0f172a;
}
.ai-msg.user .ai-bubble strong {
  color: #ffffff;
}

.ai-time {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 4px;
}
.ai-msg.user .ai-time {
  text-align: right;
}

/* QUICK PROMPT CHIPS */
.ai-widget-chips {
  padding: 8px 12px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.ai-widget-chips::-webkit-scrollbar {
  display: none;
}

.ai-chip-btn {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chip-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

/* FOOTER INPUT */
.ai-widget-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-input {
  flex: 1;
  resize: none;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
  outline: none;
  max-height: 90px;
  transition: border-color 0.2s;
}

.ai-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.ai-btn-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-btn-send:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}

.ai-btn-send:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

/* TYPING INDICATOR */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: fit-content;
}
.ai-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: aiTypingBounce 1.4s infinite ease-in-out both;
}
.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes aiTypingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
  .quantum-call-fab {
    bottom: calc(68px + env(safe-area-inset-bottom, 16px)) !important;
    right: 76px !important;
    z-index: 10001 !important;
    padding: 10px 12px;
  }
  .call-fab-label {
    display: none;
  }
  .quantum-ai-fab {
    bottom: calc(68px + env(safe-area-inset-bottom, 16px)) !important;
    right: 16px !important;
    z-index: 10001 !important;
    padding: 10px 12px;
  }
  .ai-fab-label {
    display: none;
  }
  .quantum-ai-widget {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    z-index: 100005 !important;
  }
  .qlc-pill {
    bottom: calc(68px + env(safe-area-inset-bottom, 16px)) !important;
    right: 16px !important;
    z-index: 10001 !important;
  }
  .qlc-card {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    justify-content: space-between;
  }
}

/* ==============================================================================
   QUANTUM EXECUTIVE LIVE VOICE CALL (WEBRTC) STYLES
   ============================================================================== */

/* Trigger Call button in AI Chat Header */
.ai-header-btn.ai-call-btn {
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.35);
  margin-right: 4px;
  position: relative;
}
.ai-header-btn.ai-call-btn:hover {
  background: #2563eb;
  color: #ffffff;
  transform: scale(1.05);
}
.ai-header-btn.ai-call-btn::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 1.5px solid #0f172a;
}

/* Call Prompt Banner in Chat */
.ai-call-banner {
  margin: 12px 14px 4px 14px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.ai-call-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-call-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.ai-call-banner-text {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.35;
}
.ai-call-banner-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.ai-call-banner-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* FULL MODAL OVERLAY */
.qlc-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: qlcFadeIn 0.3s ease;
}

@keyframes qlcFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.qlc-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.qlc-card {
  position: relative;
  z-index: 2;
  width: 520px;
  max-width: calc(100vw - 32px);
  background: #0b1329;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 40px rgba(59, 130, 246, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #ffffff;
}

/* MODAL HEADER */
.qlc-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qlc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qlc-logo-dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.qlc-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}
.qlc-sub {
  font-size: 11px;
  color: #94a3b8;
}
.qlc-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.qlc-btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* MODAL BODY & ORB */
.qlc-body {
  padding: 32px 24px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qlc-orb-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.qlc-orb-pulse-outer {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0) 70%);
  transition: transform 0.1s ease-out;
}

.qlc-orb-pulse-middle {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(139, 92, 246, 0) 70%);
  transition: transform 0.1s ease-out;
}

.qlc-orb-core {
  position: relative;
  z-index: 3;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #ffffff;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: qlcOrbFloat 3s ease-in-out infinite;
}

@keyframes qlcOrbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Orb States */
.orb-listening {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.4) !important;
}
.pulse-listening {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, rgba(16, 185, 129, 0) 70%) !important;
}

.orb-speaking {
  background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%) !important;
  box-shadow: 0 0 50px rgba(14, 165, 233, 0.9), inset 0 0 25px rgba(255, 255, 255, 0.5) !important;
  animation: qlcOrbSpeaking 1.2s ease-in-out infinite alternate !important;
}
@keyframes qlcOrbSpeaking {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.08); }
}
.pulse-speaking {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.5) 0%, rgba(99, 102, 241, 0) 70%) !important;
}

.orb-querying {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.8) !important;
}
.pulse-querying {
  background: radial-gradient(circle, rgba(245, 158, 11, 0.45) 0%, rgba(245, 158, 11, 0) 70%) !important;
}

.orb-thinking {
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%) !important;
  box-shadow: 0 0 35px rgba(217, 70, 239, 0.7) !important;
}

/* STATUS BADGE */
.qlc-status-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}
.qlc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.3s ease;
}
.qlc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}
.qlc-status-badge.status-connected .qlc-status-dot { background: #10b981; animation: aiDotGlow 1.5s infinite; }
.qlc-status-badge.status-listening .qlc-status-dot { background: #10b981; }
.qlc-status-badge.status-speaking .qlc-status-dot { background: #38bdf8; animation: aiDotGlow 1.2s infinite; }
.qlc-status-badge.status-querying .qlc-status-dot { background: #f59e0b; animation: aiDotGlow 0.8s infinite; }
.qlc-status-badge.status-connecting .qlc-status-dot { background: #3b82f6; animation: aiDotGlow 1s infinite; }

@keyframes aiDotGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.qlc-timer {
  font-family: monospace;
  font-size: 13px;
  color: #94a3b8;
  letter-spacing: 1px;
}

/* LIVE CAPTIONS */
.qlc-captions-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}
.qlc-caption-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qlc-caption-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}
.qlc-caption-box.ai-caption .qlc-caption-label {
  color: #60a5fa;
}
.qlc-caption-text {
  font-size: 13px;
  line-height: 1.5;
  color: #f1f5f9;
}
.qlc-caption-text.text-muted {
  color: #64748b;
  font-style: italic;
}

/* MODAL FOOTER CONTROLS */
.qlc-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(15, 23, 42, 0.6);
}
.qlc-control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.25s ease;
}
.qlc-control-btn.btn-mute {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.qlc-control-btn.btn-mute:hover {
  background: rgba(255, 255, 255, 0.2);
}
.qlc-control-btn.btn-mute.muted {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}
.qlc-control-btn.btn-hangup {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px -4px rgba(239, 68, 68, 0.5);
}
.qlc-control-btn.btn-hangup:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -4px rgba(239, 68, 68, 0.6);
}

/* MINIMIZED FLOATING PILL */
.qlc-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  padding: 8px 16px 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  cursor: pointer;
  animation: qlcPillSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.qlc-pill-orb {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
}
.qlc-pill-pulse {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  animation: qlcPillPulse 1.8s infinite;
}
@keyframes qlcPillPulse {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.qlc-pill-info {
  display: flex;
  flex-direction: column;
}
.qlc-pill-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.qlc-pill-status {
  font-size: 10.5px;
  color: #94a3b8;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qlc-pill-timer {
  font-family: monospace;
  font-size: 12px;
  color: #60a5fa;
  font-weight: 600;
}
.qlc-pill-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}
.qlc-pill-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.qlc-pill-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}
.qlc-pill-btn.qlc-pill-hangup {
  background: #dc2626;
}
.qlc-pill-btn.qlc-pill-hangup:hover {
  background: #b91c1c;
}

/* ===================================================
   PROGRESSIVE WEB APP (PWA) STYLES
   =================================================== */
.pwa-banner-card {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom, 16px));
  left: 16px;
  right: 16px;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 100010;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pwaSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (min-width: 769px) {
  .pwa-banner-card {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 380px;
  }
}

@keyframes pwaSlideUp {
  from {
    transform: translateY(120%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-banner-hide {
  animation: pwaSlideDown 0.3s ease forwards !important;
}

@keyframes pwaSlideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(120%);
    opacity: 0;
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-banner-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.pwa-banner-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pwa-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.pwa-btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: none;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.pwa-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

/* Standalone adjustments for iOS Notch & Home Bar */
.pwa-standalone {
  padding-top: env(safe-area-inset-top, 0px);
}
.pwa-standalone .mobile-bottom-nav {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px) !important;
}


