/* === 1. GOOGLE FONTS IMPORT === */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === 2. CSS CUSTOM PROPERTIES ===
   Aliased to the Helmyx brand tokens (assets/css/hx-tokens.css, loaded
   before this file) so the whole app — every component below that
   references var(--primary), var(--success), etc. — re-themes from one
   place instead of hundreds of individual color edits. Status colors map
   to the brand's own nautical vocabulary: success=On course,
   warning=Drifting, danger=Off course, info=Charted. */
:root {
  /* Colors - Primary (brand: navy is the primary; teal is its gradient partner) */
  --primary: var(--hx-navy-800);
  --primary-dark: var(--hx-navy-700);   /* "hover on primary" per brand tokens */
  --primary-light: var(--hx-teal-500);  /* the brand gradient's other stop */
  --primary-rgb: 10, 58, 107;

  /* Colors - Success -> On course */
  --success: var(--hx-on-course);
  --success-dark: var(--hx-on-course-text);
  --success-light: #62C1A1;
  --success-rgb: 14, 159, 110;

  /* Colors - Warning -> Drifting */
  --warning: var(--hx-drifting);
  --warning-dark: var(--hx-drifting-text);
  --warning-light: #F0C368;
  --warning-rgb: 232, 163, 23;

  /* Colors - Danger -> Off course */
  --danger: var(--hx-off-course);
  --danger-dark: var(--hx-off-course-text);
  --danger-light: #E48680;
  --danger-rgb: 214, 69, 59;

  /* Colors - Info -> Charted */
  --info: var(--hx-charted);
  --info-dark: var(--hx-charted-text);
  --info-light: #77ACD9;
  --info-rgb: 46, 127, 196;

  /* Theme Colors */
  --sidebar-bg: var(--hx-navy-900);
  --sidebar-item: var(--hx-navy-800);
  --sidebar-text: var(--hx-slate-400);
  --sidebar-active-text: var(--hx-white);

  --topbar-bg: var(--hx-white);
  --page-bg: var(--hx-mist);
  --card-bg: var(--hx-white);

  /* Text Colors */
  --text-primary: var(--hx-ink);
  --text-secondary: var(--hx-slate-600);
  --text-muted: var(--hx-slate-400);

  /* Border & Shadows */
  --border-color: var(--hx-slate-100);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: var(--hx-shadow-float);

  /* Border Radius */
  --border-radius-sm: 6px;
  --border-radius: var(--hx-radius-card);
  --border-radius-lg: 16px;

  /* Dimensions */
  --sidebar-width: 280px;
  --topbar-height: 64px;
  --trial-banner-height: 40px;

  /* Typography & Transitions */
  --transition: 0.2s ease;
  --font-family: 'Inter', sans-serif;
  --font-family-display: var(--hx-font-display);
}

/* === 3. RESET & BASE === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Display/heading type — Montserrat, per brand guide ("the wordmark, display,
   headlines"). Applied by selector rather than editing every rule below so
   existing weight/size/margin declarations are untouched. */
h1, h2, h3, h4, h5, h6,
.page-title, .card-title, .stat-value, .modal-title, .auth-title {
  font-family: var(--font-family-display);
  font-weight: 700;
}

/* === 4. LAYOUT === */
.app-wrapper {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: width var(--transition);
}

.sidebar.collapsed {
  width: 70px;
}

.main-wrapper {
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left var(--transition), width var(--transition);
}

.sidebar.collapsed + .main-wrapper {
  margin-left: 70px;
  width: calc(100% - 70px);
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--topbar-height);
  background-color: var(--topbar-bg);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 99;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  transition: left var(--transition);
}

.sidebar.collapsed ~ .main-wrapper .topbar {
  left: 70px;
}

.page-content {
  margin-top: var(--topbar-height);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

/* === 5. SIDEBAR STYLES === */
.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-icon img { width: 100%; height: 100%; }

.sidebar-logo .logo-text {
  white-space: nowrap;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
}
.sidebar-logo .logo-text img { height: 18px; width: auto; }

.sidebar.collapsed .sidebar-logo .logo-text {
  opacity: 0;
  display: none;
}

.sidebar-nav {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  color: var(--sidebar-text);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 24px 4px;
  margin-top: 12px;
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: all var(--transition);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-item.active {
  background-color: var(--primary);
  color: white;
  box-shadow: inset 3px 0 0 rgba(255,255,255,0.5);
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  background-color: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 700;
}

.sidebar.collapsed .nav-item .nav-text,
.sidebar.collapsed .nav-item .nav-badge {
  display: none;
}

.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: rgba(255,255,255,0.05);
}

.sidebar-user .user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-user .user-name {
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user .user-role {
  color: var(--sidebar-text);
  font-size: 0.75rem;
}

.sidebar.collapsed .sidebar-user .user-info {
  display: none;
}

/* === 6. TOPBAR === */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--page-bg);
  color: var(--primary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

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

.search-box input {
  background-color: #F1F5F9;
  border: none;
  border-radius: 20px;
  padding: 8px 16px 8px 36px;
  font-size: 0.875rem;
  color: var(--text-primary);
  width: 250px;
  transition: width var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-box input:focus {
  width: 300px;
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
  background-color: white;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.notif-bell {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-bell:hover {
  background: #F1F5F9;
  color: var(--primary);
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid white;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 1000;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notif-dropdown {
  width: 380px;
  max-height: 480px;
  display: flex;
  flex-direction: column;
}

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

.notif-header h6 {
  font-size: 1rem;
  font-weight: 600;
}

.notif-header a {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
}

.notif-body {
  overflow-y: auto;
  max-height: 380px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}

.notif-item:hover {
  background: #F8FAFC;
}

.notif-item.unread {
  border-left: 3px solid var(--primary);
  background: rgba(var(--primary-rgb), 0.02);
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-title {
  font-size: 0.875rem;
  font-weight: 600;
}

.notif-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  transition: background var(--transition);
  position: relative;
}

.user-menu:hover {
  background: #F1F5F9;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-dropdown {
  min-width: 200px;
  padding: 8px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: background var(--transition);
}

.dropdown-item:hover {
  background: #F1F5F9;
  color: var(--primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

/* === 7. PAGE HEADER === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

/* === 8. CARDS === */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

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

.card-body {
  padding: 20px;
  flex: 1;
}

.card-footer {
  padding: 16px 20px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
}

/* === 9. STAT/KPI CARDS === */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.stat-icon.success { background: linear-gradient(135deg, var(--success), var(--success-light)); color: white; }
.stat-icon.warning { background: linear-gradient(135deg, var(--warning), var(--warning-light)); color: white; }
.stat-icon.danger { background: linear-gradient(135deg, var(--danger), var(--danger-light)); color: white; }
.stat-icon.info { background: linear-gradient(135deg, var(--info), var(--info-light)); color: white; }

.stat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* === 10. BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  font-family: var(--font-family);
  outline: none;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(var(--primary-rgb), 0.2);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 8px rgba(var(--primary-rgb), 0.3);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(var(--success-rgb), 0.2);
}
.btn-success:hover:not(:disabled) { box-shadow: 0 6px 8px rgba(var(--success-rgb), 0.3); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(var(--danger-rgb), 0.2);
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 6px 8px rgba(var(--danger-rgb), 0.3); transform: translateY(-1px); }

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-primary);
  border-color: #F1F5F9;
}
.btn-secondary:hover:not(:disabled) {
  background: #E2E8F0;
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover:not(:disabled) {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: #F1F5F9;
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 4px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-secondary.btn-loading::after, .btn-ghost.btn-loading::after, .btn-outline-primary.btn-loading::after {
  border-color: rgba(var(--primary-rgb), 0.3);
  border-top-color: var(--primary);
}

/* === 11. FORMS === */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-family);
  background-color: white;
  color: var(--text-primary);
  transition: all var(--transition);
}

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

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  outline: none;
}

.form-control:disabled {
  background-color: #F8FAFC;
  cursor: not-allowed;
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-color: rgba(var(--danger-rgb), 0.05);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.1);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 100%;
}
.input-icon.left { left: 0; }
.input-icon.right { right: 0; }

.input-with-icon-left { padding-left: 40px; }
.input-with-icon-right { padding-right: 40px; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* File Upload */
.file-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px 20px;
  text-align: center;
  background-color: #F8FAFC;
  cursor: pointer;
  transition: all var(--transition);
}
.file-upload-zone:hover, .file-upload-zone.dragover {
  border-color: var(--primary);
  background-color: rgba(var(--primary-rgb), 0.05);
}
.file-upload-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 12px;
}
.file-upload-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.file-upload-text strong {
  color: var(--primary);
}

/* === 12. TABLES === */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

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

.table thead th {
  background-color: #F8FAFC;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
}

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

.table tbody tr:hover {
  background-color: rgba(0,0,0,0.01);
}

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

.table .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === 13. BADGES/PILLS === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}

.badge-primary { background-color: rgba(var(--primary-rgb), 0.1); color: var(--primary-dark); }
.badge-success { background-color: rgba(var(--success-rgb), 0.1); color: var(--success-dark); }
.badge-warning { background-color: rgba(var(--warning-rgb), 0.1); color: var(--warning-dark); }
.badge-danger { background-color: rgba(var(--danger-rgb), 0.1); color: var(--danger-dark); }
.badge-info { background-color: rgba(var(--info-rgb), 0.1); color: var(--info-dark); }
.badge-secondary { background-color: #F1F5F9; color: var(--text-secondary); }

/* Status specific */
.badge-active, .badge-completed, .badge-approved, .badge-paid { background-color: rgba(var(--success-rgb), 0.1); color: var(--success-dark); }
.badge-draft, .badge-inactive { background-color: #F1F5F9; color: var(--text-secondary); }
.badge-pending, .badge-under_review { background-color: rgba(var(--warning-rgb), 0.1); color: var(--warning-dark); }
.badge-cancelled, .badge-rejected, .badge-failed { background-color: rgba(var(--danger-rgb), 0.1); color: var(--danger-dark); }

/* === 14. ALERTS/TOASTS === */
.alert {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
  border-left: 4px solid transparent;
  background-color: white;
  box-shadow: var(--shadow-sm);
}
.alert-success { border-left-color: var(--success); background-color: rgba(var(--success-rgb), 0.05); }
.alert-error { border-left-color: var(--danger); background-color: rgba(var(--danger-rgb), 0.05); color: var(--danger-dark); font-weight: 600; }
.alert-warning { border-left-color: var(--warning); background-color: rgba(var(--warning-rgb), 0.05); }
.alert-info { border-left-color: var(--info); background-color: rgba(var(--info-rgb), 0.05); }

.alert-icon { font-size: 1.25rem; flex-shrink: 0; }
.alert-success .alert-icon { color: var(--success); }
.alert-error .alert-icon { color: var(--danger); }
.alert-warning .alert-icon { color: var(--warning); }
.alert-info .alert-icon { color: var(--info); }

.alert-content { flex: 1; font-size: 0.875rem; }
.alert-title { font-weight: 600; margin-bottom: 4px; }
.alert-dismiss { cursor: pointer; color: var(--text-muted); transition: color 0.2s; background: none; border: none; font-size: 1.1rem; }
.alert-dismiss:hover { color: var(--text-primary); }

/* === 14b. TRIAL COUNTDOWN BANNER ===
   Fixed overlay bar above the sidebar/topbar (both position:fixed, z-index
   99/100) — a normal-flow element here would render underneath them and be
   invisible. body.has-trial-banner shifts those + page-content down by
   --trial-banner-height to make room instead of being covered. */
.trial-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--trial-banner-height);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}
.trial-banner .trial-banner-cta {
  color: white;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  padding: 3px 12px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.trial-banner .trial-banner-cta:hover { background: rgba(255,255,255,0.3); }
.trial-banner.trial-banner-urgent { background: linear-gradient(90deg, var(--danger-dark), var(--danger)); animation: trial-banner-pulse 1.6s ease-in-out infinite; }
@keyframes trial-banner-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

body.has-trial-banner .sidebar {
  top: var(--trial-banner-height);
  height: calc(100vh - var(--trial-banner-height));
}
body.has-trial-banner .topbar {
  top: var(--trial-banner-height);
}
body.has-trial-banner .page-content {
  margin-top: calc(var(--topbar-height) + var(--trial-banner-height));
}
@media (max-width: 480px) {
  .trial-banner { font-size: 0.7rem; gap: 8px; padding: 0 10px; }
  .trial-banner .trial-banner-cta { padding: 3px 8px; }
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: white;
  box-shadow: var(--shadow-lg);
  border-radius: var(--border-radius);
  padding: 16px;
  min-width: 300px;
  max-width: 400px;
  border-left: 4px solid transparent;
  animation: slide-in-right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast.removing {
  animation: slide-out-right 0.3s ease forwards;
}

@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slide-out-right {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* === 15. MODALS === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  background-color: white;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal {
  transform: scale(0.95);
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }

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

.modal-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background-color: #F8FAFC;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-bottom-left-radius: var(--border-radius-lg);
  border-bottom-right-radius: var(--border-radius-lg);
}

/* === 16. PROGRESS BARS === */
.progress {
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.6s ease;
}
.progress-sm { height: 4px; }
.progress-lg { height: 12px; }
.progress-success .progress-bar { background: linear-gradient(90deg, var(--success), var(--success-light)); }
.progress-warning .progress-bar { background: linear-gradient(90deg, var(--warning), var(--warning-light)); }
.progress-danger .progress-bar { background: linear-gradient(90deg, var(--danger), var(--danger-light)); }

/* === 17. TABS === */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  gap: 24px;
}
.tab-item {
  padding: 12px 4px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
  top: 1px;
}
.tab-item:hover { color: var(--primary); }
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

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

/* === 18. PAGINATION === */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 24px;
}
.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: white;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover:not(.disabled):not(.active) {
  background-color: #F1F5F9;
}
.page-btn.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #F8FAFC;
}

/* === 19. TIMELINE/ACTIVITY === */
.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
}
.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 24px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
}
.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--primary);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 4px white;
}
.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.timeline-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}
.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === 20. EMPTY STATE === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
}
.empty-state-icon {
  font-size: 4rem;
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 20px;
}
.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-state-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 24px;
  max-width: 400px;
}

/* === 21. AVATARS === */
.avatar {
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.75rem; }
.avatar-group { display: flex; align-items: center; }
.avatar-group .avatar { border: 2px solid white; margin-left: -8px; }
.avatar-group .avatar:first-child { margin-left: 0; }

/* === 22. LOADER === */
.spinner {
  border: 2px solid rgba(var(--primary-rgb), 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-md { width: 32px; height: 32px; border-width: 3px; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
.page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* === 24. DASHBOARD SPECIFIC === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.chart-card {
  min-height: 350px;
}
.project-card {
  position: relative;
}
.project-card .status-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

/* === 25. RESPONSIVE === */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .topbar {
    left: 0 !important;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .page-content { padding: 16px; }
  .card-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* === 28. UTILITIES === */
.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.truncate-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === BOOTSTRAP COLOR OVERRIDE ===
   Some views (dashboard, finance, notifications) use Bootstrap 5 utility
   classes directly (.bg-primary, .btn-success, .text-info, etc.) instead of
   this file's own component classes. Bootstrap 5.3 builds those utilities
   from its own --bs-* custom properties, so redefining them here (loaded
   after the Bootstrap CDN stylesheet) re-themes every .bg-primary/.btn-info/
   .text-danger/etc. across the app without hunting down each usage. */
:root {
  --bs-primary: var(--primary);
  --bs-primary-rgb: var(--primary-rgb);
  --bs-success: var(--success);
  --bs-success-rgb: var(--success-rgb);
  --bs-info: var(--info);
  --bs-info-rgb: var(--info-rgb);
  --bs-warning: var(--warning);
  --bs-warning-rgb: var(--warning-rgb);
  --bs-danger: var(--danger);
  --bs-danger-rgb: var(--danger-rgb);
}
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); }
.btn-success { --bs-btn-bg: var(--success); --bs-btn-border-color: var(--success); --bs-btn-hover-bg: var(--success-dark); --bs-btn-hover-border-color: var(--success-dark); }
.btn-info { --bs-btn-bg: var(--info); --bs-btn-border-color: var(--info); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--info-dark); --bs-btn-hover-border-color: var(--info-dark); }
.btn-warning { --bs-btn-bg: var(--warning); --bs-btn-border-color: var(--warning); --bs-btn-hover-bg: var(--warning-dark); --bs-btn-hover-border-color: var(--warning-dark); }
.btn-danger { --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger); --bs-btn-hover-bg: var(--danger-dark); --bs-btn-hover-border-color: var(--danger-dark); }
