:root {
  --primary-gradient: linear-gradient(135deg, #14b8a6, #10b981);
  --primary-gradient-login-header: linear-gradient(135deg, #0d9488 0%, #14b8a6 35%, #10b981 70%, #06b6d4 100%);
  --primary-gradient-login-button: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #10b981 100%);
  --primary-gradient-login-border: linear-gradient(90deg, #06b6d4, #14b8a6, #10b981);
  --primary-gradient-login-card: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 50%, #f0fdfa 100%);

  --primary-solid: #06b6d4;
  --primary-teal: #14b8a6;
  --primary-green: #10b981;
  --primary-glow: rgba(6, 182, 212, 0.4);

  /* Bootstrap theme variable overrides (remove default blue) */
  --bs-primary: var(--primary-teal);
  --bs-primary-rgb: 20, 184, 166;
  --bs-success: var(--primary-green);
  --bs-success-rgb: 16, 185, 129;
  --bs-info: var(--primary-solid);
  --bs-info-rgb: 6, 182, 212;
  --bs-link-color: var(--primary-teal);
  --bs-link-hover-color: #0d9488;

  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --bg-header: #f9fafb;
  --bg-hover: #f8f9fa;

  --text-primary: #374151;
  --text-heading: #1f2937;
  --text-muted: #6b7280;

  --border-light: #e5e7eb;
  --border-card: #f1f3f4;
  --border-table: #dee2e6;
  --border-form: #d1d5db;

  --shadow-card: 0 3px 12px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
  --shadow-topbar: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-dropdown: 0 10px 40px rgba(0, 0, 0, 0.12);

  --radius-card: 12px;
  --radius-button: 8px;
  --radius-table: 12px;
  --radius-dropdown: 12px;

  --sidebar-bg: linear-gradient(180deg, #1a472a 0%, #0d2818 100%);
  --sidebar-icon: #4ade80;
  --sidebar-link: rgba(255, 255, 255, 0.85);
  --sidebar-link-hover-bg: rgba(74, 222, 128, 0.1);
  --sidebar-link-active-bg: rgba(74, 222, 128, 0.15);
  --sidebar-link-active: #4ade80;
  --sidebar-header-bg: rgba(0, 0, 0, 0.15);
  --sidebar-header-border: rgba(255, 255, 255, 0.1);
}

/* Base */
html,
body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-light);
  color: var(--text-primary);
}

a {
  color: var(--primary-teal);
  text-decoration: none;
}

a:hover {
  color: var(--primary-teal);
  text-decoration: underline;
}

/* Layout */
.main-content {
  padding: 20px !important;
}

.page-header {
  background: var(--bg-white);
  padding: 14px 20px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.page-header h1,
.page-header h2,
.page-header h3,
.page-header h4,
.page-header h5 {
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.breadcrumb {
  margin-bottom: 0;
}

.breadcrumb a {
  text-decoration: none;
}

/* Sidebar */
.sidebar {
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
}

.sidebar h4 {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar .nav-link {
  color: var(--sidebar-link);
  border-radius: 0;
  margin: 2px 0;
  transition: background-color 0.2s ease, color 0.2s ease;
  padding: 12px 20px;
  font-size: 0.9rem;
}

.sidebar .nav-link i {
  width: 1.5em;
  text-align: center;
  color: var(--sidebar-icon);
}

.sidebar .nav-link:hover {
  background: var(--sidebar-link-hover-bg);
  color: #fff;
}

.sidebar .nav-link.active {
  background: var(--sidebar-link-active-bg);
  color: var(--sidebar-link-active);
  border-left: 3px solid var(--sidebar-link-active);
}

.sidebar-divider {
  border-color: rgba(255, 255, 255, 0.12) !important;
  opacity: 1;
}

/* Topbar (user menu top right) */
.topbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-topbar);
  padding: 10px 20px;
  min-height: 56px;
  margin: -20px -20px 20px -20px;
}

.topbar-inner {
  min-height: 36px;
}

.btn-topbar-user {
  background: transparent !important;
  border: 1px solid var(--border-form) !important;
  border-radius: var(--radius-button) !important;
  color: var(--text-heading) !important;
  padding: 6px 14px !important;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-topbar-user:hover {
  border-color: var(--primary-teal) !important;
  color: var(--primary-teal) !important;
  background: rgba(20, 184, 166, 0.06) !important;
}

.btn-topbar-user:focus {
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.topbar-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
}

.topbar-user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.topbar-caret {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-dropdown {
  min-width: 220px;
  padding: 0.5rem 0;
}

.topbar-dropdown .dropdown-header {
  padding: 12px 16px;
  white-space: normal;
}

.topbar-dropdown .dropdown-item {
  padding: 10px 16px;
}

.topbar-dropdown .dropdown-item i {
  width: 1.25em;
  color: var(--text-muted);
}

/* Avatars */
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.user-avatar--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.875rem;
}

.user-avatar--lg {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 1.25rem;
}

.user-avatar--xl {
  width: 80px;
  height: 80px;
  border-radius: 15px;
  font-size: 2rem;
}

/* Cards */
.card {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-light);
  padding: 20px 25px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card-body {
  padding: 25px;
}

/* Table containers */
.table-container,
.report-card {
  background: var(--bg-white);
  border-radius: var(--radius-table);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table thead th {
  background: var(--bg-hover);
  color: #495057;
  font-weight: 700;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border-table);
  padding: 12px;
}

.table td {
  padding: 12px;
  border-color: var(--border-card);
  vertical-align: middle;
}

.table-hover tbody tr:hover {
  background: var(--bg-hover);
}

/* Buttons */
.btn {
  border-radius: var(--radius-button);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary,
.btn-success,
.btn-info {
  background: var(--primary-gradient) !important;
  border: none !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.btn-outline-primary {
  color: var(--primary-teal) !important;
  border-color: var(--primary-teal) !important;
}

.btn-outline-primary:hover {
  background: rgba(20, 184, 166, 0.1) !important;
  color: var(--primary-teal) !important;
  transform: translateY(-1px);
}

.btn-outline-secondary:hover {
  transform: translateY(-1px);
}

.btn-action {
  padding: 0.25rem 0.5rem;
  margin: 0 0.125rem;
  border-radius: 6px;
}

/* Forms */
.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-heading);
}

.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid var(--border-form);
  padding: 12px 15px;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.input-group-text {
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--border-form);
  border-right: none;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.form-control.with-icon {
  border-radius: 0 10px 10px 0;
  border-left: none;
}

/* Dropdowns */
.dropdown-menu {
  border-radius: var(--radius-dropdown);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.dropdown-item:hover {
  background: rgba(20, 184, 166, 0.08);
}

/* Modals */
.modal-content {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-dropdown);
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 20px 25px;
}

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 20px 25px;
}

/* Stat cards */
.stat-card {
  border: none;
  border-radius: 12px;
  min-height: 100px;
  display: flex;
  align-items: stretch;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card .card-body {
  padding: 14px 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.stat-card h3 {
  font-size: 1.5rem;
  line-height: 1.2;
}

.stat-card p {
  font-size: 0.85rem;
  line-height: 1.3;
  margin-bottom: 0;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.85;
}

/* Dashboard sections (HRMS-style) */
.dashboard-section-title {
  color: var(--text-heading);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
}

.dashboard-section-title i {
  color: var(--primary-teal);
}

.dashboard-widget {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.dashboard-widget .card-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 18px;
  font-weight: 600;
}

.dashboard-widget .card-header h6 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.dashboard-widget-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-card);
  font-size: 0.9rem;
}

.dashboard-widget-item:last-child {
  border-bottom: none;
}

.dashboard-widget-item i {
  width: 1.5em;
  margin-right: 10px;
}

.dashboard-widget-item strong {
  color: var(--text-heading);
}

.dashboard-widget .chart-container {
  position: relative;
  width: 100%;
}

/* Dashboard stat card gradients */
.card-customers {
  background: linear-gradient(135deg, #14b8a6 0%, #10b981 100%);
  color: #fff;
}
.card-products {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}
.card-leads {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
}
.card-quotes {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}
.card-orders {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}
.card-invoices {
  background: linear-gradient(135deg, #14b8a6 0%, #10b981 100%);
  color: #fff;
}

/* Reports stat card gradients */
.card-sales {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}
.card-invoices {
  background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
  color: #fff;
}
.card-collection {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

/* Activity items */
.activity-item {
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--bg-hover);
  transition: background-color 0.2s ease;
}
.activity-item:hover {
  background: #e9ecef;
}

/* Leads */
.lead-card {
  border-left: 4px solid var(--primary-teal);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.probability-bar,
.payment-progress {
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  background: var(--primary-gradient);
}

/* Reports */
.report-filters {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.report-table {
  font-size: 0.9rem;
}

.chart-container {
  position: relative;
  height: 400px;
}

/* Customers credit rating colors */
.credit-rating-A {
  color: #10b981;
  font-weight: 700;
}
.credit-rating-B {
  color: #14b8a6;
  font-weight: 700;
}
.credit-rating-C {
  color: #f59e0b;
  font-weight: 700;
}
.credit-rating-D {
  color: #dc2626;
  font-weight: 700;
}

/* Products stock indicators */
.stock-low {
  color: #dc2626;
  font-weight: 700;
}
.stock-warning {
  color: #f59e0b;
  font-weight: 700;
}
.stock-ok {
  color: #10b981;
  font-weight: 600;
}

/* Settings */
.settings-card {
  background: var(--bg-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.settings-card .card-header {
  background: var(--primary-gradient);
  color: #fff;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  border: none;
}

.nav-tabs .nav-link {
  border-radius: 10px 10px 0 0;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-tabs .nav-link.active {
  background: var(--primary-gradient) !important;
  color: #fff !important;
  border-color: var(--primary-teal) !important;
}

.nav-tabs .nav-link:hover {
  color: var(--primary-teal);
}

.nav-tabs .nav-link i {
  color: var(--primary-teal);
}

.nav-tabs .nav-link.active i {
  color: #fff;
}

.logo-preview {
  max-width: 200px;
  max-height: 100px;
  border-radius: 8px;
}

/* Login page */
body.login-page {
  background: var(--primary-gradient-login-header);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Error page */
body.error-page {
  background: var(--primary-gradient-login-header);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-container {
  background: var(--primary-gradient-login-card);
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(20, 184, 166, 0.2);
  border: 1px solid rgba(20, 184, 166, 0.2);
  text-align: center;
  max-width: 520px;
  width: 92%;
}

.error-icon {
  font-size: 5rem;
  color: #dc2626;
  margin-bottom: 1.5rem;
}

.error-code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary-teal);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
}

.error-message {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.btn-home {
  background: var(--primary-gradient-login-button);
  border: none;
  border-radius: 12px;
  padding: 12px 30px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
}

.btn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.4);
  filter: brightness(1.08);
  color: #fff;
  text-decoration: none;
}

.error-details {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(20, 184, 166, 0.2);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login-container {
  background: var(--primary-gradient-login-card);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(20, 184, 166, 0.2);
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header i {
  font-size: 3rem;
  color: var(--primary-teal);
  margin-bottom: 1rem;
}

.login-header h2 {
  color: var(--text-heading);
  font-weight: 700;
}

.btn-login {
  background: var(--primary-gradient-login-button) !important;
  border: none !important;
  border-radius: 12px;
  padding: 12px 30px;
  font-weight: 700;
  transition: all 0.2s ease;
  color: #fff !important;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.4);
  filter: brightness(1.08);
}

/* Quotation edit page */
.quotation-header {
  background: var(--primary-gradient);
  color: #fff;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(20, 184, 166, 0.18);
}

.total-section {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 20px;
}

/* Responsive */
@media (max-width: 991.98px) {
  .main-content {
    padding: 15px !important;
  }

  .topbar {
    margin: -15px -15px 15px -15px;
    padding: 10px 15px;
  }

  .page-header {
    padding: 14px 15px;
  }

  .table-responsive {
    border-radius: var(--radius-table);
  }
}

@media (max-width: 767.98px) {
  .page-header .d-flex.justify-content-between {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .login-container {
    margin: 0 12px;
  }
}
