/* ============================================
   DESIGN SYSTEM - METRONIC STYLE
   PCMS – Project & Contract Management System
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Brand Colors */
  --primary: #3B82F6;
  --primary-light: #93C5FD;
  --primary-dark: #1D4ED8;
  --primary-bg: #EFF6FF;

  /* Semantic Colors */
  --success: #22C55E;
  --success-light: #86EFAC;
  --success-bg: #F0FDF4;
  --warning: #F59E0B;
  --warning-light: #FCD34D;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FCA5A5;
  --danger-bg: #FEF2F2;
  --info: #06B6D4;
  --info-light: #67E8F9;
  --info-bg: #ECFEFF;

  /* Neutral */
  --bg-body: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-header: #FFFFFF;
  --bg-hover: #F8FAFC;
  --bg-active: #EFF6FF;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-white: #FFFFFF;

  /* Border */
  --border-color: #E2E8F0;
  --border-light: #F1F5F9;

  /* Shadows */
  --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 -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* Layout */
  --sidebar-width: 264px;
  --sidebar-collapsed: 78px;
  --header-height: 64px;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* Prevent horizontal scroll on body */
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Typography ---------- */
h1,
.h1 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
}

h2,
.h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

h3,
.h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

h4,
.h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.35;
}

h5,
.h5 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

h6,
.h6 {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.8125rem;
}

.text-base {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1rem;
}

.text-xl {
  font-size: 1.125rem;
}

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

.text-secondary {
  color: var(--text-secondary);
}

.text-primary-c {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.fw-normal {
  font-weight: 400;
}

.fw-medium {
  font-weight: 500;
}

.fw-semibold {
  font-weight: 600;
}

.fw-bold {
  font-weight: 700;
}

/* ---------- Layout ---------- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scroll on main container */
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Important for flex-shrink and containing overflowing children */
  transition: margin-left var(--transition-slow);
}

.app-content {
  flex: 1;
  padding: 24px;
  margin-top: var(--header-height);
}

.container-fluid {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.sidebar-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Sidebar Menu */
.sidebar-menu {
  list-style: none;
  padding: 0 12px;
}

.menu-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

.menu-item {
  margin-bottom: 2px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.menu-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.menu-link.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
}

.menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.menu-link.active .menu-icon,
.menu-link:hover .menu-icon {
  color: var(--primary);
}

.menu-arrow {
  margin-left: auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
  color: var(--text-muted);
  flex-shrink: 0;
}

.menu-item.open>.menu-link .menu-arrow {
  transform: rotate(90deg);
}

/* Submenu */
.submenu {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
  padding-left: 16px;
  margin-left: 20px;
  border-left: 1px solid var(--border-color);
}

.menu-item.open>.submenu {
  max-height: 600px;
}

.submenu .menu-link {
  font-size: 0.8125rem;
  font-weight: 400;
  padding: 6px 12px;
  position: relative;
}

.submenu .menu-link::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--text-muted);
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  transition: all var(--transition-fast);
}

.submenu .menu-link.active::before,
.submenu .menu-link:hover::before {
  background: var(--primary);
  border-color: var(--primary);
}

.menu-badge {
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
  transition: left var(--transition-slow);
}

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

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

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle:hover {
  background: var(--bg-hover);
}

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

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

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

.breadcrumb .separator {
  color: var(--border-color);
}

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 500;
}

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

/* Header Icons */
.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  position: relative;
}

.header-icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-card);
}

/* User Dropdown */
.user-dropdown {
  position: relative;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-btn:hover {
  background: var(--bg-hover);
}

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

.user-info {
  text-align: left;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 200;
  display: none;
  animation: dropdownFadeIn 0.15s ease;
}

.dropdown-menu.show {
  display: block;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

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

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

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

.card-body {
  padding: 20px;
}

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

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-top: 12px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
}

/* KPI Card (PCMS Financial) */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-card.kpi-total::before {
  background: var(--primary);
}

.kpi-card.kpi-paid::before {
  background: var(--success);
}

.kpi-card.kpi-debt::before {
  background: var(--danger);
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 12px;
  line-height: 1.2;
}

.kpi-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-body);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--bg-hover);
}

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

tbody tr.row-overdue {
  background: var(--danger-bg);
}

tbody tr.row-overdue:hover {
  background: #FEE2E2;
}

tbody tr.row-warning {
  background: var(--warning-bg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
  font-family: inherit;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 10px 24px;
  font-size: 0.9375rem;
}

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

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

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

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

.btn-success:hover {
  background: #16A34A;
  color: white;
}

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

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

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

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 10px;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

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

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
}

.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;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

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

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

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

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

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

.badge-neutral {
  background: var(--bg-body);
  color: var(--text-secondary);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-link {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-link:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.page-link.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info {
  background: var(--info-bg);
  color: #0E7490;
  border: 1px solid #A5F3FC;
}

.alert-warning {
  background: var(--warning-bg);
  color: #B45309;
  border: 1px solid #FDE68A;
}

.alert-danger {
  background: var(--danger-bg);
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.alert-success {
  background: var(--success-bg);
  color: #15803D;
  border: 1px solid #BBF7D0;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-backdrop.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

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

.modal-body {
  padding: 20px;
}

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

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---------- Search ---------- */
.search-input-wrapper {
  position: relative;
  max-width: 280px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-input-wrapper .form-control {
  padding-left: 34px;
}

/* ---------- Filters ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-body);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.filter-tab {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  border: none;
  background: none;
  font-family: inherit;
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-state h4 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---------- User/Avatar ---------- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.125rem;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-cell-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.user-cell-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

/* ---------- Status Summary ---------- */
.status-summary-item {
  flex: 1;
  min-width: 100px;
  background: var(--bg-card);
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  text-align: center;
  border: 1px solid rgba(37, 99, 235, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.status-summary-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #60A5FA);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.status-summary-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.15);
}

.status-summary-item:hover::before {
  opacity: 1;
}

.status-summary-count {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.status-summary-label {
  display: flex;
  justify-content: center;
}

/* ---------- Project Info ---------- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-item {
  padding: 12px 0;
}

.info-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

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

.info-value a {
  color: var(--primary);
}

/* ---------- Payment Row (inline add) ---------- */
.payment-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.payment-row:last-child {
  border-bottom: none;
}

/* ---------- Summary Bar ---------- */
.summary-bar {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
  background: var(--bg-body);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.summary-item {
  text-align: center;
  flex: 1;
}

.summary-item-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.summary-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- FAB (Floating Action Button) ---------- */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  z-index: 50;
}

.fab:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
}

/* ---------- Toggle Switch ---------- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 12px;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked+.toggle-slider {
  background: var(--success);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(20px);
}

/* ---------- Chart placeholder ---------- */
.chart-placeholder {
  background: linear-gradient(135deg, var(--bg-body), var(--bg-hover));
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  min-height: 250px;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ---------- Utility ---------- */
.d-flex {
  display: flex;
}

.d-none {
  display: none;
}

.align-items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.gap-5 {
  gap: 20px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-5 {
  margin-bottom: 20px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-5 {
  margin-top: 20px;
}

.mt-6 {
  margin-top: 24px;
}

.p-0 {
  padding: 0;
}

.w-100 {
  width: 100%;
}

.text-end {
  text-align: right;
}

.text-center {
  text-align: center;
}

.flex-1 {
  flex: 1;
}

/* Overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

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

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 1.25rem; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 101;
    box-shadow: var(--shadow-lg);
  }

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

  .app-main {
    margin-left: 0 !important;
    max-width: 100vw;
  }

  .header {
    left: 0 !important;
    padding: 0 16px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .breadcrumb {
    display: none;
  }

  .app-content {
    padding: 16px;
    overflow-x: hidden; /* Prevent content from causing horizontal scroll */
  }

  .container-fluid {
    overflow-x: hidden; /* Contain all children */
  }

  .d-mobile-none {
    display: none !important;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .summary-bar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    background: transparent;
  }

  .summary-item {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
  }

  .summary-item-value {
    font-size: 1rem;
    word-break: break-all;
  }

  .status-summary-item {
    flex: 1 1 calc(50% - 6px);
    padding: 12px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .card-body {
    padding: 16px;
  }

  /* Table responsiveness - contained within card, no negative margin trick */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    position: relative;
    width: 100%;
  }

  .table-wrapper::after {
    content: '← Kéo để xem thêm →';
    display: block;
    text-align: center;
    font-size: 0.625rem;
    color: var(--text-muted);
    padding: 8px 0;
    background: var(--bg-hover);
    border-top: 1px solid var(--border-light);
  }

  table {
    min-width: 500px; /* Scroll within wrapper, not body */
    width: 100%;
  }

  .table-wrapper table th,
  .table-wrapper table td {
    white-space: nowrap;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .user-btn .user-info {
    display: none;
  }

  .header-right {
    gap: 8px;
  }

  /* Dashboard & Page Title Adjustments */
  .page-title {
    font-size: 1.125rem;
  }

  .type-distribution-grid {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    font-size: 0.75rem;
  }
  
  .calendar-day-num {
    width: 28px;
    height: 28px;
  }

  /* Calendar legend wrapping */
  .calendar-legend {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px 14px;
  }

  /* Filter tabs scrollable on mobile */
  .filter-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    max-width: 100%;
  }

  .filter-tab {
    flex-shrink: 0;
  }

  /* Filter bar stacks on mobile */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .filter-bar form {
    width: 100%;
  }

  .filter-bar .search-input-wrapper {
    max-width: 100%;
  }

  /* Payment term selector stacks */
  .payment-term-selector {
    flex-direction: column;
  }

  /* Form row 3-column becomes 1-column */
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  /* Payment row grid (5-col -> 2-col) */
  .payment-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Item row grid (3-col -> 1fr 1fr auto) */
  .item-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .item-row > .form-group:first-child {
    grid-column: 1 / -1;
  }

  /* KPI value text wrapping */
  .kpi-value {
    word-break: break-all;
  }
}

@media (max-width: 576px) {
  .page-title {
    font-size: 1.125rem;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-value {
    font-size: 1rem;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.8125rem;
  }

  .filter-bar {
    padding: 0;
  }

  /* Ensure all fixed-width inline elements respect viewport */
  select.form-control[style*="width"],
  input.form-control[style*="width"] {
    max-width: 100% !important;
  }

  /* Invoice badge smaller */
  .invoice-badge {
    font-size: 0.6875rem;
    padding: 3px 8px;
  }

  /* Stat card value */
  .stat-value {
    font-size: 1rem;
  }

  /* Summary bar items */
  .summary-item-value {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .header {
    height: var(--header-height);
  }

  .stat-value,
  .kpi-value {
    font-size: 0.9375rem;
  }

  .badge {
    padding: 2px 6px;
    font-size: 0.6875rem;
  }

  .app-content {
    padding: 12px;
  }

  .card-body {
    padding: 12px;
  }

  .card-header {
    padding: 10px 12px;
  }
}

/* ---------- Calendar ---------- */
.calendar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

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

.calendar-nav {
  display: flex;
  gap: 6px;
}

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 12px 12px;
}

.calendar-dow {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 0;
}

.calendar-day {
  text-align: center;
  padding: 4px 2px;
  position: relative;
}

.calendar-day-num {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 400;
  cursor: default;
  transition: all var(--transition-fast);
}

.calendar-day.today .calendar-day-num {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.calendar-day.other-month .calendar-day-num {
  color: var(--border-color);
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  min-height: 0;
  padding: 0 2px;
}

.calendar-event {
  display: block;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.5625rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.calendar-event.evt-payment {
  background: #FEE2E2;
  color: #B91C1C;
  border-left: 2px solid var(--danger);
}

.calendar-event.evt-payment-done {
  background: #DCFCE7;
  color: #15803D;
  border-left: 2px solid var(--success);
}

.calendar-event.evt-deadline {
  background: #FEF3C7;
  color: #B45309;
  border-left: 2px solid var(--warning);
}

.calendar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-dot.dot-payment {
  background: var(--danger);
}

.calendar-dot.dot-payment-done {
  background: var(--success);
}

.calendar-dot.dot-deadline {
  background: var(--warning);
}

.calendar-legend {
  display: flex;
  gap: 16px;
  padding: 10px 20px 14px;
  justify-content: center;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ---------- Invoice Workflow ---------- */
.btn-invoice {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid #A5F3FC;
  font-weight: 600;
}

.btn-invoice:hover {
  background: #CFFAFE;
  color: #0E7490;
}

.invoice-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--info-bg);
  color: #0E7490;
  border: 1px solid #A5F3FC;
}

.invoice-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* ---------- Item Details Table ---------- */
.item-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 16px;
}

.item-table th {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-body);
}

.item-table td {
  padding: 10px 12px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

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

.item-table tfoot td {
  font-weight: 600;
  color: var(--text-primary);
  border-top: 2px solid var(--border-color);
  border-bottom: none;
}

/* ---------- Tax Section ---------- */
.tax-summary {
  background: var(--bg-body);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 12px;
}

.tax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8125rem;
}

.tax-row-label {
  color: var(--text-secondary);
}

.tax-row-value {
  font-weight: 600;
  color: var(--text-primary);
}

.tax-row.tax-total {
  border-top: 2px solid var(--border-color);
  margin-top: 6px;
  padding-top: 12px;
}

.tax-row.tax-total .tax-row-label {
  font-weight: 600;
  color: var(--text-primary);
}

.tax-row.tax-total .tax-row-value {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 700;
}

/* ---------- Payment Term ---------- */
.payment-term-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.payment-term-option {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-term-option:hover {
  border-color: var(--primary-light);
}

.payment-term-option.active {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.payment-term-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.payment-term-option.active .payment-term-radio {
  border-color: var(--primary);
}

.payment-term-option.active .payment-term-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.payment-term-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.payment-term-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Item Row (create form) ---------- */
.item-row {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.item-row:last-child {
  border-bottom: none;
}

/* ---------- External Link ---------- */
.external-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-bg);
  transition: all var(--transition-fast);
}

.external-link:hover {
  background: #DBEAFE;
  color: var(--primary-dark);
}

/* ---------- Project Type Badges ---------- */
.badge-type-rawdata {
  background: #EDE9FE;
  color: #7C3AED;
}

.badge-type-qualified {
  background: #ECFDF5;
  color: #059669;
}

.badge-type-socialheat {
  background: #FFF7ED;
  color: #EA580C;
}

.badge-type-leadbuzz {
  background: #EFF6FF;
  color: #2563EB;
}

.badge-type-whitelabel {
  background: #F1F5F9;
  color: #475569;
}

/* ---------- Project Type Distribution Card ---------- */
.type-distribution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.type-dist-item {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: all var(--transition-fast);
}

.type-dist-item:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.type-dist-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.type-dist-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.type-dist-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Admin Type Management ---------- */
.type-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-option:hover,
.color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.15);
}

.color-options-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Print ---------- */
@media print {

  .sidebar,
  .header,
  .sidebar-overlay,
  .fab {
    display: none !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-content {
    margin-top: 0 !important;
    padding: 0 !important;
  }
}

/* ---------- Notes Section ---------- */
.notes-section {
  margin-top: 24px;
}

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

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

.note-item {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.note-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.note-body {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.note-author {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

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

.note-content {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.note-input-wrapper {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.note-input-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.note-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  transition: all var(--transition-fast);
}

.note-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}