/* Document actions layout improvements */
/* Document actions larger buttons */
.doc-actions .btn-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  font-size: 0.75rem;
  line-height: 1.2;
  margin: 2px 6px 2px 0;
  border-radius: 6px;
}
.doc-actions .btn-action i { font-size: 0.85rem; }
.doc-actions { row-gap: 4px; }
@media (max-width: 992px) {
  .doc-actions .btn-action { flex: 1 1 45%; }
}

/* Vertically center documents table cells */
#documentsTable td, #documentsTable th {
  vertical-align: middle !important;
}

/* Ensure action buttons row stays centered */
#documentsTable .doc-actions { align-items: center; }

/* Improve select alignment in status column */
#documentsTable select.form-select.form-select-sm {
  height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
  display: inline-flex;
  align-items: center;
}
/* ==========================================
   SYSTEM INTERFACE STYLES
   ========================================== */

/* Layout Structure */
body {
  margin: 0;
  overflow-x: hidden;
  font-size: 14px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  button, .btn, a, .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  .form-check-input {
    width: 22px;
    height: 22px;
  }
  
  input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
}

/* Top Header */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(135deg, #0d6efd 0%, #0856d0 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1040;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.dark-mode .top-header {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-bottom: 1px solid #374151;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 16px;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.05);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-header {
  height: 35px;
  width: auto;
}

.brand-text {
  color: white;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  display: none;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-weight: 500;
}

@media (min-width: 768px) {
  .user-name {
    display: block;
  }
}

.btn-theme,
.btn-logout {
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  font-size: 15px;
}

.btn-theme {
  background: rgba(255, 255, 255, 0.12);
}

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.22);
  color: white;
  transform: scale(1.05) rotate(15deg);
}

.btn-logout {
  background: rgba(220, 53, 69, 0.85);
}

.btn-logout:hover {
  background: rgba(220, 53, 69, 1);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  width: 270px;
  height: calc(100vh - 64px);
  background: white;
  border-right: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.03);
}

.dark-mode .sidebar {
  background: #1a1d23;
  border-right-color: #2d3139;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
}

.sidebar.collapsed {
  width: 75px;
}

.sidebar-header {
  padding: 24px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(13, 110, 253, 0.02) 0%, transparent 100%);
}

.sidebar.collapsed .sidebar-header {
  padding: 16px 12px;
}

.sidebar-logo {
  height: 48px;
  width: auto;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.sidebar.collapsed .sidebar-logo {
  height: 36px;
}

.sidebar-title {
  margin: 12px 0 0 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.02em;
}

.sidebar.collapsed .sidebar-title {
  display: none;
}

.sidebar-nav {
  padding: 15px 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 13px 20px;
  color: #6c757d;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  gap: 14px;
  margin: 4px 12px;
  border-radius: 10px;
}

.sidebar.collapsed .sidebar-link {
  padding: 13px 0;
  justify-content: center;
  margin: 4px 8px;
}

.sidebar-link i {
  font-size: 19px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link span {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
}

.sidebar.collapsed .sidebar-link span {
  display: none;
}

.sidebar-link:hover {
  background: rgba(13, 110, 253, 0.08);
  color: var(--primary);
  transform: translateX(4px);
}

.sidebar.collapsed .sidebar-link:hover {
  transform: none;
}

.sidebar-link:hover i {
  transform: scale(1.1);
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.12) 0%, rgba(13, 110, 253, 0.06) 100%);
  color: var(--primary);
  border-right: none;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
}

.dark-mode .sidebar-link:hover {
  background: rgba(102, 179, 255, 0.15);
  color: #66b3ff;
}

.dark-mode .sidebar-link.active {
  background: linear-gradient(90deg, rgba(102, 179, 255, 0.25) 0%, rgba(102, 179, 255, 0.12) 100%);
  color: #66b3ff;
  box-shadow: 0 2px 8px rgba(102, 179, 255, 0.2);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 10px 15px;
}

.sidebar.collapsed .sidebar-divider {
  margin: 10px 5px;
}

/* Main Content */
.main-content {
  margin-left: 270px;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  background: var(--light);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
  margin-left: 75px;
}

.content-wrapper {
  padding: 32px;
  max-width: 100%;
  margin: 0;
}

#app-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================
   STATISTICS CARDS
   ========================================== */

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  gap: 22px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  min-height: 130px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, #4dabf7 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover::before {
  opacity: 1;
}

.dark-mode .stat-card {
  background: linear-gradient(135deg, #1f2937 0%, #1a1d23 100%);
  border-color: #374151;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode .stat-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: #4b5563;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: rgba(13, 110, 253, 0.2);
}

.stat-icon {
  width: 74px;
  height: 74px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.stat-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  transform: scale(0);
  transition: transform 0.5s ease;
}

.stat-card:hover .stat-icon::before {
  transform: scale(1);
}

.stat-icon i {
  font-size: 30px;
  position: relative;
  z-index: 1;
}

.stat-icon.bg-primary {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
}

.stat-icon.bg-success {
  background: linear-gradient(135deg, #198754 0%, #157347 100%);
}

.stat-icon.bg-warning {
  background: linear-gradient(135deg, #ffc107 0%, #ffb300 100%);
}

.stat-icon.bg-info {
  background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
}

.stat-details {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  margin: 0;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 14px;
  color: #6c757d;
  margin: 6px 0 0 0;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.dark-mode .stat-label {
  color: #9ca3af;
}

.dark-mode .stat-value {
  color: #66b3ff;
}

/* ==========================================
   REVENUE & CUSTOMER ITEMS
   ========================================== */

.revenue-item,
.customer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.revenue-item:last-child,
.customer-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.revenue-item:first-child,
.customer-item:first-child {
  padding-top: 0;
}

/* ==========================================
   CARDS & TABLES
   ========================================== */

.card {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 28px;
  height: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.dark-mode .card {
  background: linear-gradient(135deg, #1f2937 0%, #1a1d23 100%);
  border-color: #374151;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border-color: #4b5563;
}

.dark-mode .card-title {
  color: #66b3ff;
}

.card-title {
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--primary);
  font-size: 19px;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  font-size: 20px;
}

.dark-mode .table {
  background-color: #1a1d23;
  border-collapse: collapse;
}

.dark-mode .table-responsive {
  background-color: transparent;
  overflow-x: hidden;
}

.table-responsive {
  overflow-x: hidden;
  width: 100%;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background-color: rgba(13, 110, 253, 0.05);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 12px;
  color: #495057;
}

.dark-mode .table thead th {
  background-color: rgba(102, 179, 255, 0.15);
  color: #e8eaed;
  border-color: #374151;
}

.table tbody tr {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.table tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.04);
  transform: scale(1.005);
}

.dark-mode .table tbody tr {
  background-color: #1f2937;
  border-top: 1px solid #2d3139;
}

.dark-mode .table tbody tr:nth-child(even) {
  background-color: #25282c;
}

.dark-mode .table tbody tr:nth-child(odd) {
  background-color: #1f2937;
}

.dark-mode .table tbody tr:hover {
  background-color: #2d3748 !important;
  border-color: #4b5563;
  box-shadow: 0 2px 8px rgba(102, 179, 255, 0.15);
}

.dark-mode .table tbody tr:hover td {
  background-color: #2d3748 !important;
  color: #f3f4f6 !important;
}

.dark-mode .table tbody td {
  color: #d1d5db;
  border-color: #2d3139;
  background-color: transparent;
}

.table tbody td {
  padding: 14px 12px;
  vertical-align: middle;
}

/* ==========================================
   PRODUCT CARDS
   ========================================== */

.product-item {
  transition: opacity 0.3s;
}

.product-selector-card {
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid var(--border-color);
}

.product-selector-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
  transform: translateY(-2px);
}

.price-info {
  font-size: 14px;
  color: var(--success);
  font-weight: 600;
}

/* Product item controls in quotation table */
.product-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.subscription-plan-selector {
  min-width: 180px;
  max-width: 220px;
}

.btn-xs {
  padding: 4px 12px;
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ==========================================
   SUMMARY PANEL
   ========================================== */

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.summary-item:last-child {
  border-bottom: none;
  padding-top: 15px;
}

/* ==========================================
   MODALS
   ========================================== */

.modal {
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  border-radius: 12px;
  border: none;
}

.dark-mode .modal-content {
  background: #1f2124;
  color: var(--dark);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 20px;
}

.modal-title {
  font-weight: 600;
  color: var(--primary);
}

/* ==========================================
   BADGES
   ========================================== */

.badge {
  font-weight: 600;
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 8px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge i {
  font-size: 11px;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */

.notification {
  position: fixed;
  top: 84px;
  right: 24px;
  background: white;
  padding: 18px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  min-width: 320px;
  max-width: 450px;
  opacity: 0;
  transform: translateX(450px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(0, 0, 0, 0.1);
  font-size: 15px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.5;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-success {
  border-left: 5px solid #198754;
  background: #d1e7dd;
  color: #0a3622;
}

.notification-error {
  border-left: 5px solid #dc3545;
  background: #f8d7da;
  color: #58151c;
}

.notification-warning {
  border-left: 5px solid #ffc107;
  background: #fff3cd;
  color: #664d03;
}

.notification-info {
  border-left: 5px solid #0dcaf0;
  background: #cff4fc;
  color: #055160;
}

.dark-mode .notification {
  background: #1f2937;
  color: #e8eaed;
  border: 1px solid #374151;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
  border-radius: 10px;
  font-weight: 500;
  padding: 10px 20px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #0d6efd 0%, #0856d0 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0b5ed7 0%, #0747a6 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13, 110, 253, 0.35);
}

.btn-outline-primary {
  border-width: 2px;
  font-weight: 600;
}

.btn-outline-primary:hover {
  background-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

/* Product Filter Buttons - Equal Width */
.product-filter-group {
  display: flex;
  width: 100%;
}

.product-filter-group .btn {
  flex: 1;
  min-width: 0;
}

/* Select2 Styling */
.select2-container {
  width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
  border-radius: 10px !important;
  border: 2px solid var(--border-color) !important;
  padding: 11px 16px !important;
  min-height: 48px !important;
  display: flex !important;
  align-items: center !important;
}

.select2-container--bootstrap-5 .select2-selection--single {
  height: auto !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  padding: 0 !important;
  line-height: 1.5 !important;
  color: inherit !important;
  display: block !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
  height: 100% !important;
  top: 0 !important;
  right: 10px !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear {
  margin-right: 10px !important;
  color: white !important;
  background-color: #dc3545 !important;
  border: 2px solid #dc3545 !important;
  border-radius: 4px !important;
  width: 24px !important;
  height: 24px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  font-weight: bold !important;
  transition: all 0.2s ease !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear:hover {
  background-color: #bb2d3b !important;
  border-color: #b02a37 !important;
  transform: scale(1.1) !important;
}

.select2-container--bootstrap-5 .select2-dropdown {
  border-radius: 10px !important;
  border: 2px solid var(--border-color) !important;
  margin-top: 4px !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown {
  padding: 8px !important;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
  border-radius: 8px !important;
  border: 2px solid var(--border-color) !important;
  padding: 8px 12px !important;
  width: 100% !important;
}

.select2-container--bootstrap-5 .select2-results__option {
  padding: 10px 16px !important;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--primary) !important;
  color: white !important;
}

.dark-mode .select2-container--bootstrap-5 .select2-selection {
  background-color: #1f2937 !important;
  color: #e8eaed !important;
  border-color: #374151 !important;
}

.dark-mode .select2-container--bootstrap-5 .select2-dropdown {
  background-color: #1f2937 !important;
  border-color: #374151 !important;
}

.dark-mode .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
  background-color: #111827 !important;
  color: #e8eaed !important;
  border-color: #374151 !important;
}

.dark-mode .select2-container--bootstrap-5 .select2-results__option {
  color: #e8eaed !important;
}

.dark-mode .select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--primary) !important;
  color: white !important;
}

/* ==========================================
   FORM CONTROLS
   ========================================== */

.form-control,
.form-select {
  border-radius: 10px;
  border: 2px solid var(--border-color);
  padding: 11px 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.12);
  transform: translateY(-1px);
}

.dark-mode .form-control,
.dark-mode .form-select {
  background-color: #1f2937;
  color: #e8eaed;
  border-color: #374151;
}

.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
  background-color: #1f2937;
  color: #e8eaed;
  border-color: #66b3ff;
  box-shadow: 0 0 0 0.25rem rgba(102, 179, 255, 0.15);
}

.dark-mode .form-control::placeholder {
  color: #6b7280;
}

.form-label {
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: #495057;
  letter-spacing: 0.01em;
}

.dark-mode .form-label {
  color: #d1d5db;
  font-weight: 600;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

/* Mobile Responsive (768px and below) */
@media (max-width: 768px) {
  .top-header {
    height: 60px;
    padding: 0 12px;
  }
  
  .logo-header {
    height: 28px;
  }
  
  .brand-text {
    font-size: 16px;
  }
  
  .sidebar-toggle {
    width: 38px;
    height: 38px;
  }
  
  .sidebar {
    top: 60px;
    height: calc(100vh - 60px);
    transform: translateX(-100%);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.12);
    width: 270px;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .sidebar.show ~ .sidebar-overlay {
    display: block;
  }
  
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
  
  .main-content {
    margin-left: 0 !important;
    margin-top: 60px;
    min-height: calc(100vh - 60px);
  }
  
  .content-wrapper {
    padding: 16px 12px;
  }
  
  /* Stats Cards */
  .stat-card {
    margin-bottom: 12px;
    padding: 16px;
    min-height: 100px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .stat-icon {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  
  .stat-icon i {
    font-size: 22px;
  }
  
  /* Tables */
  .table-responsive {
    font-size: 12px;
    margin: 0 -12px;
    padding: 0 12px;
  }
  
  .table thead th {
    font-size: 11px;
    padding: 10px 6px;
    white-space: nowrap;
  }
  
  .table tbody td {
    padding: 10px 6px;
    font-size: 12px;
  }
  
  /* Hide less important columns on mobile */
  .table td:nth-child(n+5),
  .table th:nth-child(n+5) {
    display: none;
  }
  
  /* Keep action column visible */
  .table td:last-child,
  .table th:last-child {
    display: table-cell !important;
  }
  
  /* Buttons */
  .btn {
    font-size: 13px;
    padding: 8px 14px;
  }
  
  .btn-sm {
    font-size: 11px;
    padding: 5px 10px;
  }
  
  .btn-group {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  /* Modals */
  .modal-dialog {
    margin: 8px;
    max-width: calc(100% - 16px);
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
  }
  
  /* Page Header */
  .page-header {
    padding: 16px;
  }
  
  .page-header h2 {
    font-size: 20px;
  }
  
  /* Action Bar */
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .action-bar-left,
  .action-bar-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .search-box {
    width: 100%;
    margin-bottom: 8px;
  }
  
  /* Forms */
  .form-label {
    font-size: 13px;
  }
  
  .form-control,
  .form-select {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  /* Notifications */
  .notification {
    top: 68px;
    right: 8px;
    left: 8px;
    min-width: auto;
    max-width: none;
    font-size: 13px;
    padding: 14px 16px;
  }
  
  /* Cards */
  .card {
    margin-bottom: 16px;
  }
  
  .card-body {
    padding: 16px;
  }
}

/* Tablet Responsive (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
  .sidebar {
    width: 240px;
  }
  
  .main-content {
    margin-left: 240px;
  }
  
  .content-wrapper {
    padding: 24px 20px;
  }
  
  .table-responsive {
    font-size: 13px;
  }
  
  .stat-card {
    padding: 20px;
  }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
  .top-header {
    padding: 0 8px;
  }
  
  .brand-text {
    display: none;
  }
  
  .header-right {
    gap: 6px;
  }
  
  .btn-theme,
  .btn-logout {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .page-header h2 {
    font-size: 18px;
  }
  
  .stat-card {
    padding: 12px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  .stat-icon {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
  
  .modal-title {
    font-size: 18px;
  }
  
  .table tbody td {
    font-size: 11px;
    padding: 8px 4px;
  }
  
  .badge {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  /* Subscription-specific mobile improvements */
  #checklistContainer .table td,
  #checklistContainer .table th {
    white-space: nowrap;
  }
  
  #checklistContainer .table td:nth-child(2) {
    min-width: 140px;
  }
  
  .action-bar .btn {
    width: 100%;
    margin-bottom: 6px;
  }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .top-header {
    height: 50px;
  }
  
  .sidebar {
    top: 50px;
    height: calc(100vh - 50px);
  }
  
  .main-content {
    margin-top: 50px;
  }
  
  .notification {
    top: 58px;
  }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.text-muted {
  color: #6c757d !important;
}

.dark-mode .text-muted {
  color: #9ca3af !important;
}

.dark-mode .text-success {
  color: #4ade80 !important;
}

.dark-mode .text-warning {
  color: #fbbf24 !important;
}

.dark-mode .text-danger {
  color: #f87171 !important;
}

.dark-mode .text-info {
  color: #38bdf8 !important;
}

.cursor-pointer {
  cursor: pointer;
}

.sticky-top {
  position: sticky;
  z-index: 1000;
}

/* Loading State */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(13, 110, 253, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #6c757d;
}

.empty-state i {
  font-size: 64px;
  color: #dee2e6;
  margin-bottom: 20px;
  display: block;
}

.empty-state h4 {
  font-size: 20px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 24px;
}

/* Page Header */
.page-header {
  background: white;
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}

.dark-mode .page-header {
  background: linear-gradient(135deg, #1f2937 0%, #1a1d23 100%);
  border-color: #374151;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.dark-mode .page-header h2,
.dark-mode .page-header h3,
.dark-mode .page-header h4 {
  color: #66b3ff;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.page-header p {
  color: #6c757d;
  margin: 0;
  font-size: 14px;
}

/* Breadcrumb */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 24px;
  font-size: 14px;
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s;
}

.breadcrumb-item a:hover {
  color: #0b5ed7;
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: #6c757d;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.action-bar-left,
.action-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Search Box */
.search-box {
  position: relative;
  width: 280px;
}

.search-box input {
  padding-left: 42px;
  border-radius: 10px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
  font-size: 16px;
}

/* Document Output Styling */
#documentOutput {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px;
  background: white;
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  /* Receipt/Document layout sizing to prevent oversized header */
  #printableReceipt,
  #documentOutput {
    max-width: 800px;
    margin: 0 auto;
  }
  
  .document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid #0d6efd;
  }
  
  .document-header .logo {
    max-height: 70px;
    max-width: 200px;
    width: auto;
    height: auto;
    display: block;
    margin-bottom: 8px;
  }
  
  .company-info {
    font-size: 12px;
    line-height: 1.7;
    color: #495057;
  }
  
  .document-title {
    text-align: right;
  }
  
  .document-title h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    color: #0d6efd;
    letter-spacing: 1px;
  }
  
  .document-title p {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #495057;
  }
  
  /* Info Section */
  .document-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
  }
  
  .document-info > div {
    display: grid;
    align-items: center;
  }
  
  .document-info > div > div {
    padding: 6px 8px;
  }
  
  .document-info > div > div:nth-child(4n+1),
  .document-info > div > div:nth-child(4n+3) {
    font-weight: 600;
  }
  
  .section-title {
    font-size: 16px;
    margin-top: 12px;
  }
  
  .pricing-table th,
  .pricing-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  /* Reduce margins to keep receipt within a single page when possible */
  @page {
    margin: 12mm;
  }
  /* Hide URL and other browser print headers/footers */
  @page {
    size: auto;
  }
  
  /* Remove URL from print */
  body::after {
    content: none !important;
  }
  
  /* Hide elements that shouldn't be printed */
  .no-print,
  .sidebar,
  .top-header,
  .btn,
  button,
  .modal-backdrop {
    display: none !important;
  }
  
  /* Ensure document prints cleanly */
  #documentOutput {
    display: block !important;
    margin: 0;
    padding: 20px;
  }
  
  /* Optimize table printing */
  .pricing-table {
    page-break-inside: auto;
  }
  
  .pricing-table thead {
    display: table-header-group;
  }
  
  .pricing-table tbody tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  
  .pricing-table tfoot {
    display: table-footer-group;
  }
  
  /* Allow feature lists to break across pages if needed */
  .feature-list {
    page-break-inside: auto;
  }
  
  .feature-list li {
    page-break-inside: avoid;
  }
  
  /* Prevent orphaned content at top of sections */
  .document-header,
  .document-to {
    page-break-inside: avoid;
    page-break-after: avoid;
  }
  
  .signature-section,
  .document-footer {
    page-break-inside: avoid;
  }
  
  /* Ensure section title stays with content */
  .section-title {
    page-break-after: avoid;
  }
  
  /* Keep at least 3 lines together when breaking */
  h1, h2, h3, h4, h5 {
    page-break-after: avoid;
    orphans: 3;
    widows: 3;
  }
  
  p, li {
    orphans: 3;
    widows: 3;
  }
  
  /* Prevent single table rows at page breaks */
  tr {
    orphans: 2;
    widows: 2;
  }
}

/* ==========================================
   SUBSCRIPTION DARK MODE FIXES
   ========================================== */

.dark-mode .table-success,
.dark-mode .table-warning,
.dark-mode .table-danger {
  background-color: transparent !important;
  border-left: 3px solid;
}

.dark-mode .table-success {
  border-left-color: #4ade80;
}

.dark-mode .table-warning {
  border-left-color: #fbbf24;
}

.dark-mode .table-danger {
  border-left-color: #f87171;
}

.dark-mode .fw-bold.text-dark,
.dark-mode .text-dark {
  color: #e8eaed !important;
}

.dark-mode .badge.bg-light {
  background-color: #374151 !important;
  color: #e8eaed !important;
  border-color: #4b5563 !important;
}

.dark-mode .form-check-input {
  background-color: #1f2937;
  border-color: #4b5563;
}

.dark-mode .form-check-input:checked {
  background-color: #66b3ff;
  border-color: #66b3ff;
}

.dark-mode .btn-group {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.dark-mode .nav-pills {
  background-color: #1a1d23 !important;
}

.dark-mode .nav-pills .nav-link {
  color: #9ca3af;
  background-color: transparent;
}

.dark-mode .nav-pills .nav-link:hover {
  color: #66b3ff;
  background-color: rgba(102, 179, 255, 0.1);
}

.dark-mode .nav-pills .nav-link.active {
  color: #ffffff;
  background-color: #0d6efd;
}

.dark-mode .bg-light {
  background-color: #1a1d23 !important;
}

/* ==========================================
   REVENUE BREAKDOWN STYLING
   ========================================== */

.revenue-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.revenue-card {
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e9ecef;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.revenue-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.revenue-header {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.revenue-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.revenue-icon.invoice {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
}

.revenue-icon.subscription {
  background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.revenue-icon.total {
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.revenue-icon.pending {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
}

.revenue-header > div:last-child {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.revenue-label {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.revenue-value {
  font-size: 18px;
  font-weight: 700;
  color: #0d6efd;
}

.revenue-value.total {
  font-size: 20px;
  color: #28a745;
}

.revenue-value.pending {
  color: #ffc107;
}

.revenue-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 10px;
  margin-top: 8px;
  overflow: hidden;
}

.revenue-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd 0%, #0856d0 100%);
  border-radius: 10px;
  transition: width 0.6s ease;
}

.revenue-fill.subscription-fill {
  background: linear-gradient(90deg, #17a2b8 0%, #138496 100%);
}

.total-card {
  background: linear-gradient(135deg, #d1f4e0 0%, #e8f8f0 100%);
  border: 2px solid #28a745;
}

.total-card .revenue-value {
  font-size: 22px;
}

.pending-card {
  background: linear-gradient(135deg, #fffaf0 0%, #fffbf5 100%);
  border: 2px solid #ffc107;
}

/* Dark Mode */
.dark-mode .revenue-card {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-color: #374151;
}

.dark-mode .revenue-label {
  color: #9ca3af;
}

.dark-mode .revenue-value {
  color: #60a5fa;
}

.dark-mode .revenue-value.total {
  color: #4ade80;
}

.dark-mode .revenue-value.pending {
  color: #fbbf24;
}

.dark-mode .revenue-bar {
  background: #374151;
}

.dark-mode .total-card {
  background: linear-gradient(135deg, #164e63 0%, #0f3460 100%);
  border-color: #059669;
}

.dark-mode .pending-card {
  background: linear-gradient(135deg, #78350f 0%, #5a2e0f 100%);
  border-color: #fbbf24;
}


