﻿/*!
 * ERP unified theme
 */

/* Base layout adjustments */
body {
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-track {
  background: #374151;
}
.dark ::-webkit-scrollbar-thumb {
  background: #6b7280;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Topbar offset helpers */
:root {
  --sidebar-offset: 4rem;
}

@media (max-width: 1023px) {
  :root {
    --sidebar-offset: 0px;
  }
}

#topbar {
  left: var(--sidebar-offset);
  transition: left 0.3s ease;
}

/* Sidebar styles */
#sidebar {
  --sidebar-width: 17rem;
  --sidebar-bg: #f5f7fb;
  --sidebar-header-bg: #ffffff;
  --sidebar-footer-bg: #eef2f7;
  --sidebar-text: #0f172a;
  --sidebar-muted: #4b5563;
  --sidebar-border: #d7dce5;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  width: var(--sidebar-width);
  transition: transform 0.3s ease;
}

.dark #sidebar {
  --sidebar-bg: #1e2334;
  --sidebar-header-bg: #1f2937;
  --sidebar-footer-bg: #1c2433;
  --sidebar-text: #e6eaf4;
  --sidebar-muted: #cbd5e1;
  --sidebar-border: #3a4158;
}

#sidebar a,
#sidebar button {
  outline: none;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  padding: 0 1.1rem;
  background: var(--sidebar-header-bg);
  border-bottom: 1px solid var(--sidebar-header-bg);
  color: var(--sidebar-text);
}

.dark .sidebar-header {
  color: var(--sidebar-text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.85rem;
  background: linear-gradient(160deg, #3fc6b1, #2ba489);
  color: #0f1b2e;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text .title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--sidebar-text);
}

.brand-text .subtitle {
  font-size: 0.8rem;
  color: var(--sidebar-muted);
  letter-spacing: 0.03em;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem 1rem;
}

.menu-group {
  margin-bottom: 1.2rem;
}

.menu-heading {
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #7f86a2;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.35rem;
}

.menu-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  text-align: left;
  font-size: 0.9rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.menu-link i,
.menu-link svg {
  color: #6ee0c5;
  flex-shrink: 0;
}

.menu-link:hover {
  background: rgba(110, 224, 197, 0.08);
  color: var(--sidebar-text);
  transform: translateX(2px);
}

.menu-link.active {
  background: linear-gradient(90deg, #5ae0c5, #3fc6b1);
  color: #0f1b2e;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.menu-link.active i,
.menu-item.open > .menu-parent i,
.menu-link.active svg,
.menu-item.open > .menu-parent svg {
  color: #0f1b2e;
}

.menu-parent {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem 0.35rem;
  color: var(--sidebar-text);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: none;
}

.menu-submenu {
  display: block;
  padding-left: 0.85rem;
  margin-top: 0.1rem;
  border-left: 1px dashed var(--sidebar-border);
}

.submenu-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.65rem;
  margin: 0.1rem 0;
  border-radius: 0.65rem;
  color: var(--sidebar-muted);
  font-size: 0.85rem;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.submenu-link i,
.submenu-link svg {
  color: #3ba18c;
  flex-shrink: 0;
}

.dark .submenu-link i,
.dark .submenu-link svg {
  color: #6ee0c5;
}

.submenu-link:hover {
  background: rgba(110, 224, 197, 0.08);
  color: var(--sidebar-text);
  transform: translateX(2px);
}

.submenu-link.active {
  background: rgba(90, 224, 197, 0.2);
  color: #0f1b2e;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  font-weight: 600;
}

.sidebar-footer {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--sidebar-footer-bg);
  background: var(--sidebar-footer-bg);
  color: var(--sidebar-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-footer i {
  color: #6ee0c5;
}

@media (max-width: 1023px) {
  #sidebar {
    width: min(18rem, 85vw);
    transform: translateX(-100%);
  }

  #sidebar.sidebar-open {
    transform: translateX(0);
  }
}

/* Quick Access Floating Button */
#quick-access-menu {
  transition: all 0.2s ease-in-out;
  transform-origin: bottom right;
}

#quick-access-fab {
  z-index: 50;
}

/* POS fullscreen helpers */
html.pos-fullscreen,
html.pos-fullscreen body {
  height: 100%;
}

html.pos-fullscreen body {
  overflow: hidden;
}

html.pos-fullscreen #sidebar,
html.pos-fullscreen #sidebar-overlay,
html.pos-fullscreen #topbar {
  display: none !important;
}

html.pos-fullscreen main {
  padding-top: 0 !important;
  overflow: hidden;
}

html.pos-fullscreen main > div {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
}

/* Landing / marketing home */
body.home-page {
  font-family: 'Inter', sans-serif;
}

.home-page .glass {
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(200, 200, 200, 0.2);
}

/* Contacts list responsive tweaks */
[data-page="contacts-customer-list"] .mobile-optimized {
  font-size: 16px !important;
  line-height: 1.5 !important;
}

[data-page="contacts-customer-list"] .mobile-touch {
  min-height: 44px !important;
  min-width: 44px !important;
}

/* Customer statement printable layout */
.customer-statement-page {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 24px;
  color: #0f172a;
}

.customer-statement-page h1,
.customer-statement-page h2,
.customer-statement-page h3 {
  margin: 0;
}

.customer-statement-page .muted {
  color: #6b7280;
}

.customer-statement-page .grid {
  display: grid;
  gap: 12px;
}

.customer-statement-page .cards-4 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.customer-statement-page .card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.customer-statement-page .section {
  margin-top: 18px;
}

.customer-statement-page .badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  background: #eef2ff;
  color: #4f46e5;
}

.customer-statement-page table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.customer-statement-page th,
.customer-statement-page td {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.customer-statement-page th {
  background: #f3f4f6;
  text-transform: uppercase;
  font-size: 11px;
  color: #4b5563;
}

.customer-statement-page .progress-wrap {
  background: #f3f4f6;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
}

.customer-statement-page .progress {
  height: 10px;
  border-radius: 8px;
}

.customer-statement-page .bar-blue {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.customer-statement-page .bar-amber {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.customer-statement-page .bar-emerald {
  background: linear-gradient(90deg, #10b981, #059669);
}

.customer-statement-page .bar-rose {
  background: linear-gradient(90deg, #f43f5e, #e11d48);
}

.customer-statement-page .text-right {
  text-align: right;
}

/* Admin login */
.admin-login-page {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: white;
}

.admin-login-page .login-header {
  text-align: center;
  margin-bottom: 30px;
}

.admin-login-page .login-header h1 {
  color: #333;
  font-size: 24px;
  margin-bottom: 10px;
}

.admin-login-page .login-header p {
  color: #666;
  font-size: 14px;
}

.admin-login-page .form-group {
  margin-bottom: 20px;
}

.admin-login-page .form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.admin-login-page .form-group input[type="text"],
.admin-login-page .form-group input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

.admin-login-page .form-group input[type="text"]:focus,
.admin-login-page .form-group input[type="password"]:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.admin-login-page .btn-login {
  width: 100%;
  padding: 12px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.admin-login-page .btn-login:hover {
  background: #0056b3;
}

.admin-login-page .error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
  border: 1px solid #f5c6cb;
}

/* Admin dashboard */
.admin-dashboard-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.admin-dashboard-page .dashboard-header {
  text-align: center;
  margin-bottom: 40px;
}

.admin-dashboard-page .dashboard-header h1 {
  color: #333;
  font-size: 28px;
  margin-bottom: 10px;
}

.admin-dashboard-page .dashboard-header p {
  color: #666;
  font-size: 16px;
}

.admin-dashboard-page .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.admin-dashboard-page .stat-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #007bff;
}

.admin-dashboard-page .stat-card h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 18px;
}

.admin-dashboard-page .stat-card .stat-number {
  font-size: 32px;
  font-weight: bold;
  color: #007bff;
  margin-bottom: 5px;
}

.admin-dashboard-page .stat-card .stat-label {
  color: #666;
  font-size: 14px;
}

.admin-dashboard-page .quick-actions,
.admin-dashboard-page .recent-activity {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.admin-dashboard-page .quick-actions h2,
.admin-dashboard-page .recent-activity h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 20px;
}

.admin-dashboard-page .action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.admin-dashboard-page .action-btn {
  display: inline-block;
  padding: 12px 20px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  text-align: center;
  transition: background-color 0.3s;
}

.admin-dashboard-page .action-btn:hover {
  background: #0056b3;
  color: white;
}

.admin-dashboard-page .activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-dashboard-page .activity-item {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.admin-dashboard-page .activity-item:last-child {
  border-bottom: none;
}

.admin-dashboard-page .activity-item .time {
  color: #666;
  font-size: 12px;
}

/* Select2 helpers shared across forms */
[data-page="products-order-form"] .select2-container--default .select2-selection--single,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single,
[data-page="products-quotation-form"] .select2-container--default .select2-selection--single {
  height: 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background-color: #f3f4f6;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
}

[data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #111827 !important;
  line-height: 2.5rem;
  padding-left: 0;
}

[data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
[data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af;
}

[data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow,
[data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0.75rem;
  top: 0;
}

[data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b,
[data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #6b7280 transparent transparent transparent;
  border-width: 5px 5px 0 5px;
}

[data-page="products-order-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
[data-page="purchases-purchase-order-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
[data-page="products-quotation-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent #6b7280 transparent;
  border-width: 0 5px 5px 5px;
}

[data-page="products-order-form"] .select2-dropdown,
[data-page="purchases-purchase-order-form"] .select2-dropdown,
[data-page="products-quotation-form"] .select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 320px;
  overflow-y: auto;
  background-color: #f9fafb;
}

[data-page="products-order-form"] .select2-container--default .select2-search--dropdown .select2-search__field,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-search--dropdown .select2-search__field,
[data-page="products-quotation-form"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.4rem 0.6rem;
  color: #111827;
  background-color: #ffffff;
}

[data-page="products-order-form"] .select2-container--default .select2-results__option,
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option,
[data-page="products-quotation-form"] .select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  color: #111827;
}

[data-page="products-order-form"] .select2-container--default .select2-results__option--highlighted[aria-selected],
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option--highlighted[aria-selected],
[data-page="products-quotation-form"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #3b82f6;
  color: #ffffff;
}

[data-page="products-order-form"] .select2-container--default .select2-results__option[aria-selected=true],
[data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option[aria-selected=true],
[data-page="products-quotation-form"] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #e5e7eb;
  color: #1f2937;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-selection--single,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-selection--single {
  border-color: #4b5563;
  background-color: #374151;
  color: #e5e7eb;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__rendered,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__rendered,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #e5e7eb !important;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #cbd5e1 transparent transparent transparent;
}

.dark [data-page="products-order-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
.dark [data-page="products-quotation-form"] .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent #cbd5e1 transparent;
}

.dark [data-page="products-order-form"] .select2-dropdown,
.dark [data-page="purchases-purchase-order-form"] .select2-dropdown,
.dark [data-page="products-quotation-form"] .select2-dropdown {
  border-color: #4b5563;
  background-color: #1f2937;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-search--dropdown .select2-search__field,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-search--dropdown .select2-search__field,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border-color: #4b5563;
  color: #f9fafb;
  background-color: #111827;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-results__option,
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option,
.dark [data-page="products-quotation-form"] .select2-container--default .select2-results__option {
  color: #e5e7eb;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-results__option--highlighted[aria-selected],
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option--highlighted[aria-selected],
.dark [data-page="products-quotation-form"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #2563eb;
  color: #ffffff;
}

.dark [data-page="products-order-form"] .select2-container--default .select2-results__option[aria-selected=true],
.dark [data-page="purchases-purchase-order-form"] .select2-container--default .select2-results__option[aria-selected=true],
.dark [data-page="products-quotation-form"] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #334155;
  color: #e5e7eb;
}

[data-page="products-price-list-form"] .select2-container--default .select2-selection--single {
  height: 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: #ffffff;
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
}

[data-page="products-price-list-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #374151;
  line-height: 1.5;
  padding: 0;
}

[data-page="products-price-list-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af;
}

[data-page="products-price-list-form"] .select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-page="products-price-list-form"] .select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  color: #374151;
}

[data-page="products-price-list-form"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #3b82f6;
  color: #ffffff;
}

[data-page="products-price-list-form"] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #dbeafe;
  color: #1e40af;
}

.dark [data-page="products-price-list-form"] .select2-container--default .select2-selection--single {
  border-color: #374151;
  background-color: #1f2937;
  color: #f9fafb;
}

.dark [data-page="products-price-list-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f9fafb;
}

.dark [data-page="products-price-list-form"] .select2-dropdown {
  border-color: #374151;
  background-color: #1f2937;
}

.dark [data-page="products-price-list-form"] .select2-container--default .select2-results__option {
  color: #f9fafb;
}

.dark [data-page="products-price-list-form"] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #1e3a8a;
  color: #dbeafe;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-selection--single {
  min-height: 2.25rem;
  border: 1px solid #9ca3af;
  border-radius: 0.5rem;
  background-color: #f8fafc;
  padding: 0.25rem 0.75rem;
  display: flex;
  align-items: center;
  color: #111827;
}

[data-page="billing-invoice-form"] .select2-container--default.select2-container--open .select2-selection--single {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

[data-page="billing-invoice-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #111827 !important;
  line-height: 1.75rem;
  padding-left: 0;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af !important;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0.75rem;
  top: 0;
}

[data-page="billing-invoice-form"] .select2-dropdown {
  border: 1px solid #9ca3af;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 320px;
  overflow-y: auto;
  background-color: #ffffff;
  min-width: 22rem;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  color: #111827;
  background-color: #ffffff;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #e5e7eb;
  color: #111827;
}

[data-page="billing-invoice-form"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #9ca3af;
  border-radius: 0.375rem;
  padding: 0.4rem 0.6rem;
  color: #111827;
  background-color: #ffffff;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-selection--single {
  border-color: #4b5563;
  background-color: #374151;
  color: #e5e7eb;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #e5e7eb !important;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #cbd5e1 transparent transparent transparent;
}

.dark [data-page="billing-invoice-form"] .select2-dropdown {
  border-color: #4b5563;
  background-color: #1f2937;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-results__option {
  color: #e5e7eb;
  background-color: #1f2937;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #2563eb;
  color: #ffffff;
}

.dark [data-page="billing-invoice-form"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border-color: #4b5563;
  color: #f9fafb;
  background-color: #111827;
}

[data-page="billing-invoice-form-new"] #line-items-table.dataTable thead th {
  background: #f3f4f6;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

[data-page="billing-invoice-form-new"] #line-items-table.dataTable tbody td {
  padding: 4px 6px;
  vertical-align: middle;
}

[data-page="billing-invoice-form-new"] #line-items-table.dataTable input,
[data-page="billing-invoice-form-new"] #line-items-table.dataTable .product-lookup input {
  height: 30px;
}

[data-page="billing-invoice-form-new"] #line-items-table_wrapper .dataTables_filter {
  text-align: right;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single {
  min-height: 1.25rem;
  border: 1px solid #9ca3af;
  border-radius: 0.25rem;
  background-color: #ffffff;
  padding: 0 0.125rem;
  display: flex;
  align-items: center;
  color: #111827;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #111827 !important;
  line-height: 1.25rem;
  padding-left: 0;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af !important;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0.75rem;
  top: 0;
}

[data-page="billing-invoice-form-new"] .select2-dropdown {
  border: 1px solid #9ca3af;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 320px;
  overflow-y: auto;
  background-color: #ffffff;
  min-width: 16rem;
}

[data-page="billing-invoice-form-new"] .select2-container {
  width: 100% !important;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  color: #111827;
  background-color: #ffffff;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #e5e7eb;
  color: #111827;
}

[data-page="billing-invoice-form-new"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #9ca3af;
  border-radius: 0.375rem;
  padding: 0.4rem 0.6rem;
  color: #111827;
  background-color: #ffffff;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single {
  border-color: #4b5563;
  background-color: #374151;
  color: #e5e7eb;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #e5e7eb !important;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #cbd5e1 transparent transparent transparent;
}

.dark [data-page="billing-invoice-form-new"] .select2-dropdown {
  border-color: #4b5563;
  background-color: #1f2937;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-results__option {
  color: #e5e7eb;
  background-color: #1f2937;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #2563eb;
  color: #ffffff;
}

.dark [data-page="billing-invoice-form-new"] .select2-container--default .select2-search--dropdown .select2-search__field {
  border-color: #4b5563;
  color: #f9fafb;
  background-color: #111827;
}

[data-page="billing-invoice-form-new"] .invoice-form input[type="text"],
[data-page="billing-invoice-form-new"] .invoice-form input[type="number"],
[data-page="billing-invoice-form-new"] .invoice-form input[type="date"],
[data-page="billing-invoice-form-new"] .invoice-form input[type="email"],
[data-page="billing-invoice-form-new"] .invoice-form select {
  height: 30px;
  min-height: 30px;
  line-height: 1.2;
}

[data-page="billing-invoice-form-new"] input::-webkit-outer-spin-button,
[data-page="billing-invoice-form-new"] input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

[data-page="billing-invoice-form-new"] input[type=number] {
  -moz-appearance: textfield;
}

[data-page="billing-invoice-form-new"] #line-items-table_wrapper {
  overflow-x: auto;
}

@media (max-width: 768px) {
  [data-page="billing-invoice-form-new"] .select2-dropdown {
    min-width: auto;
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }

  [data-page="billing-invoice-form-new"] .select2-container--default .select2-selection--single {
    min-height: 42px;
  }

  [data-page="billing-invoice-form-new"] .invoice-form input[type="text"],
  [data-page="billing-invoice-form-new"] .invoice-form input[type="number"],
  [data-page="billing-invoice-form-new"] .invoice-form input[type="date"],
  [data-page="billing-invoice-form-new"] .invoice-form input[type="email"],
  [data-page="billing-invoice-form-new"] .invoice-form select {
    height: 42px;
    min-height: 42px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  [data-page="billing-invoice-form-new"] #line-items-table {
    display: block;
  }

  [data-page="billing-invoice-form-new"] #line-items-table thead {
    display: none;
  }

  [data-page="billing-invoice-form-new"] #line-items-table tbody {
    display: grid;
    gap: 8px;
  }

  [data-page="billing-invoice-form-new"] #line-items-table tr {
    display: grid;
    grid-template-columns: 1fr;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 10px;
  }

.dark [data-page="billing-invoice-form-new"] #line-items-table tr {
    background: #1f2937;
    border-color: #374151;
  }

  [data-page="billing-invoice-form-new"] #line-items-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
  }

  [data-page="billing-invoice-form-new"] #line-items-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #4b5563;
    margin-right: 10px;
  }

.dark [data-page="billing-invoice-form-new"] #line-items-table td::before {
    color: #9ca3af;
  }

  [data-page="billing-invoice-form-new"] #line-items-table td:last-child {
    justify-content: flex-end;
  }
}

/* Styles guide sample classes */
.loading-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* Utility classes from the style guide (still using Tailwind @apply syntax for reference) */
.btn-primary {
  @apply inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2;
}

.btn-secondary {
  @apply inline-flex items-center px-4 py-2 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 text-sm font-medium rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2;
}

.btn-danger {
  @apply inline-flex items-center px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2;
}

.btn-success {
  @apply inline-flex items-center px-4 py-2 bg-green-600 hover:bg-green-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2;
}

.btn-ghost {
  @apply inline-flex items-center px-4 py-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700 text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2;
}

.btn-sm {
  @apply px-3 py-1.5 text-xs;
}

.btn-md {
  @apply px-4 py-2 text-sm;
}

.btn-lg {
  @apply px-6 py-3 text-base;
}

.btn-loading {
  @apply opacity-50 cursor-not-allowed;
}

.btn-loading::after {
  content: '';
  @apply inline-block w-4 h-4 ml-2 border-2 border-white border-t-transparent rounded-full animate-spin;
}

.input-primary {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200;
}

.input-error {
  @apply border-red-500 focus:ring-red-500 focus:border-red-500;
}

.input-success {
  @apply border-green-500 focus:ring-green-500 focus:border-green-500;
}

.select-primary {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200;
}

.textarea-primary {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors duration-200 resize-vertical;
}

.checkbox-primary {
  @apply h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 rounded transition-colors duration-200;
}

.radio-primary {
  @apply h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600 transition-colors duration-200;
}

.form-group {
  @apply mb-4;
}

.form-label {
  @apply block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2;
}

.form-help {
  @apply mt-1 text-sm text-gray-500 dark:text-gray-400;
}

.form-error {
  @apply mt-1 text-sm text-red-600 dark:text-red-400;
}

.card {
  @apply bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700;
}

.card-header {
  @apply px-6 py-4 border-b border-gray-200 dark:border-gray-700;
}

.card-body {
  @apply px-6 py-4;
}

.card-footer {
  @apply px-6 py-4 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-700;
}

.badge {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}

.badge-success {
  @apply bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200;
}

.badge-warning {
  @apply bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200;
}

.badge-danger {
  @apply bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200;
}

.badge-info {
  @apply bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200;
}

.badge-neutral {
  @apply bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200;
}

.status-online {
  @apply inline-block w-2 h-2 bg-green-500 rounded-full;
}

.status-offline {
  @apply inline-block w-2 h-2 bg-gray-400 rounded-full;
}

.status-away {
  @apply inline-block w-2 h-2 bg-yellow-500 rounded-full;
}

.status-busy {
  @apply inline-block w-2 h-2 bg-red-500 rounded-full;
}

.text-truncate {
  @apply truncate;
}

.shadow-card {
  @apply shadow-sm;
}

.shadow-modal {
  @apply shadow-xl;
}

@media (max-width: 640px) {
  .btn-full-mobile {
    @apply w-full;
  }

  .card-mobile-padding {
    @apply px-4 py-3;
  }
}

.dark .input-primary {
  @apply bg-gray-700 border-gray-600 text-white placeholder-gray-400;
}

.dark .select-primary {
  @apply bg-gray-700 border-gray-600 text-white;
}

.dark .textarea-primary {
  @apply bg-gray-700 border-gray-600 text-white placeholder-gray-400;
}

.focus-ring:focus {
  @apply outline-none ring-2 ring-blue-500 ring-offset-2;
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-in-right {
  animation: slideInRight 0.3s ease-in-out;
}

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

.slide-in-left {
  animation: slideInLeft 0.3s ease-in-out;
}

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

.hover-lift {
  @apply transition-transform duration-200 hover:-translate-y-1 hover:shadow-lg;
}

.loading-overlay {
  @apply fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50;
}

.loading-overlay-content {
  @apply bg-white dark:bg-gray-800 rounded-lg p-6 shadow-xl;
}
