/* ==========================================================================
   TBPL ENTERPRISE ERP - LUXURY REAL ESTATE DESIGN SYSTEM
   Modern Executive Theme with Light/Dark Mode & High-Polish UI
   ========================================================================== */

/* Alpine Cloak - Prevent Hydration Layout Shift */
[x-cloak] {
  display: none !important;
}

/* Global Slimline Top Progress Bar - Fixed to prevent layout shift */
.app-top-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  width: 0%;
  z-index: 99999;
  pointer-events: none;
  background: var(--primary, #DC0514);
  opacity: 0;
  transition: width 0.2s ease, opacity 0.3s ease;
}
.app-top-loader.is-loading {
  opacity: 1;
}

:root, [data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.96);
  --border-subtle: #e2e8f0;
  --border-card: #cbd5e1;
  --border-focus: #DC0514;

  /* Consistent TBPL Signature Accent */
  --primary: #DC0514;
  --primary-light: #ef4444;
  --primary-dark: #b5030f;
  --primary-glow: rgba(220, 5, 20, 0.08);
  --accent-gold: #d97706;
  --accent-gold-light: #b45309;
  --accent-gold-glow: rgba(217, 119, 6, 0.12);

  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --danger: #DC0514;
  --danger-bg: rgba(220, 5, 20, 0.08);
  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.08);

  /* Text */
  --text-primary: #0f172a;
  --text-heading: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-silver: #94a3b8;
  --text-inverse: #ffffff;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 66px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(220, 5, 20, 0.12);
}

[data-theme="dark"] {
  --bg-main: #181a1e;
  --bg-surface: #212429;
  --bg-card: #2a2e35;
  --bg-card-hover: #363A40;
  --bg-elevated: #363A40;
  --bg-glass: rgba(33, 36, 41, 0.92);
  --border-subtle: rgba(191, 192, 194, 0.16);
  --border-card: rgba(191, 192, 194, 0.28);
  --border-focus: #DC0514;

  --primary: #DC0514;
  --primary-light: #f03a47;
  --primary-dark: #b5030f;
  --primary-glow: rgba(220, 5, 20, 0.28);
  --accent-gold: #f59e0b;
  --accent-gold-light: #fbbf24;
  --accent-gold-glow: rgba(245, 158, 11, 0.22);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.16);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.16);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.16);
  --info: #BFC0C2;
  --info-bg: rgba(191, 192, 194, 0.16);

  --text-primary: #f8fafc;
  --text-heading: #ffffff;
  --text-secondary: #E8E6E2;
  --text-muted: #BFC0C2;
  --text-silver: #BFC0C2;
  --text-inverse: #212429;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, select, textarea, button, optgroup, option, table {
  font-family: var(--font-body);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.18s ease;
}

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

/* App Shell Structure */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1050;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-header {
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: var(--header-height);
  box-sizing: border-box;
}

.brand-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.sidebar-collapse-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.18s ease;
  flex-shrink: 0;
  box-shadow: none !important;
}

.sidebar-collapse-btn:hover {
  background: var(--bg-card-hover) !important;
  color: var(--primary) !important;
  border-color: var(--border-card) !important;
}

@media (min-width: 1025px) {
  .sidebar-collapse-btn {
    display: inline-flex;
  }
}

.sidebar-close-btn {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.3);
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1040;
  cursor: pointer;
  touch-action: none;
  pointer-events: auto;
}

@media (min-width: 1025px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #DC0514 0%, #b5030f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px var(--primary-glow);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 0;
}

.brand-text .brand-title {
  font-family: 'Times New Roman', Georgia, Garamond, serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  line-height: 1.05;
}

.brand-text .brand-subtitle {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.36em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-top: 1px;
}

.brand-text .brand-tagline {
  font-family: var(--font-body);
  font-size: 0.60rem;
  font-style: italic;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.15;
  margin-top: 1px;
}

.nav-menu {
  list-style: none;
  padding: 0.75rem 0.65rem 1.5rem;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.nav-section-label {
  padding: 1.1rem 0.85rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.18s ease;
  position: relative;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-link.active, .nav-item.active .nav-link {
  background: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
}

.nav-icon {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Fixed Sidebar User Profile & Logout */
.sidebar-user-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 60px;
  position: relative;
  z-index: 20;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e82836 0%, #DC0514 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(220, 5, 20, 0.25);
}

.sidebar-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  display: block;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.2;
}

.sidebar-logout-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--danger);
  color: var(--danger);
  transform: scale(1.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 8px var(--success);
}

/* Workspace */
.workspace {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-main);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed Sidebar on Desktop */
@media (min-width: 1025px) {
  .app-shell.is-collapsed .sidebar,
  html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .app-shell.is-collapsed .workspace,
  html.sidebar-collapsed .workspace {
    margin-left: var(--sidebar-collapsed-width);
  }

  .app-shell.is-collapsed .brand-header,
  html.sidebar-collapsed .brand-header {
    justify-content: center;
    padding: 0.85rem 0.5rem;
  }

  .app-shell.is-collapsed .brand-text,
  html.sidebar-collapsed .brand-text {
    display: none !important;
  }

  .app-shell.is-collapsed .sidebar-collapse-btn i,
  html.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
  }

  .app-shell.is-collapsed .nav-section-label,
  html.sidebar-collapsed .nav-section-label {
    height: 1px;
    padding: 0;
    margin: 0.6rem 0.75rem;
    background: var(--border-subtle);
    color: transparent;
    font-size: 0;
    overflow: hidden;
  }

  .app-shell.is-collapsed .nav-link,
  html.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.65rem 0;
    gap: 0;
    border-radius: var(--radius-md);
  }

  .app-shell.is-collapsed .nav-link span:not(.nav-icon),
  html.sidebar-collapsed .nav-link span:not(.nav-icon),
  .app-shell.is-collapsed .nav-badge,
  html.sidebar-collapsed .nav-badge {
    display: none !important;
  }

  .app-shell.is-collapsed .nav-icon,
  html.sidebar-collapsed .nav-icon {
    font-size: 1.35rem;
    margin: 0;
  }

  .app-shell.is-collapsed .sidebar-user-footer,
  html.sidebar-collapsed .sidebar-user-footer {
    justify-content: center;
    padding: 0.75rem 0.4rem;
  }

  .app-shell.is-collapsed .sidebar-user-details,
  html.sidebar-collapsed .sidebar-user-details,
  .app-shell.is-collapsed .sidebar-logout-btn,
  html.sidebar-collapsed .sidebar-logout-btn {
    display: none !important;
  }
}

/* Topbar */
.topbar {
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  gap: 1.5rem;
  flex-wrap: nowrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.page-titles {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.page-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.page-titles p {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0.15rem 0 0 0;
}

/* Global Logo Dimensions Guard - Prevents Layout Shift, FOUC & Overflow */
img.brand-logo,
img.mobile-logo-img,
.topbar-mobile-logo img,
.brand-info img {
  max-width: 38px !important;
  max-height: 38px !important;
  width: 38px !important;
  height: 38px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}

.topbar-mobile-logo {
  display: none !important;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

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

.sidebar-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: all 0.2s ease;
}

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

.user-profile-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.75rem;
  border-radius: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e82836 0%, #DC0514 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* Content Body */
.content-body {
  padding: 2rem;
  flex: 1;
}

/* Access Roles & Permission Management Grid & Cards */
.roles-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.roles-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.role-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-subtle);
  padding: 1.35rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

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

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.role-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.role-staff-badge {
  font-weight: 600;
  font-size: 0.72rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.role-card-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.role-scope-container {
  margin-bottom: 0.85rem;
}

.role-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.role-badges-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.role-perms-container {
  margin-bottom: 0.5rem;
}

.role-perms-box {
  max-height: 140px;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  font-size: 0.78rem;
  min-width: 0;
  word-break: break-all;
}

.role-perm-item {
  padding: 2px 0;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-card-footer {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.role-members-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.role-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.role-action-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.role-delete-btn {
  padding: 4px 8px;
  color: var(--danger);
}

/* KPI Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

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

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-card-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.stat-card-subtext, .metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Metric Card Aliases */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

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

.metric-card .metric-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.metric-card .metric-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.badge-neutral {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* Sections & Panels */
.section-block, .panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-header h2, .panel-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toolbar form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.toolbar input, .toolbar select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.18s ease;
}

.toolbar input:focus, .toolbar select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
button, .button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--primary);
  color: #ffffff;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.25;
}

.form-action-btn {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  padding: 0 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  text-decoration: none;
}
.form-action-btn i {
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.form-action-btn span {
  display: inline;
  line-height: 1;
  white-space: nowrap;
}

button:hover, .button:hover, input[type="submit"]:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  color: #fff;
}

.button.secondary, button.secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.button.secondary:hover, button.secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card);
}

.button.success {
  background: var(--success);
}

.button.danger {
  background: var(--danger);
}

/* Data Tables */
.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table thead th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tfoot td {
  padding: 0.9rem 1rem;
  border-top: 2px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-heading);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card);
}

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

/* Status Badges */
.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.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-muted   { background: var(--bg-card);    color: var(--text-muted); }

/* Detail Grids */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.detail-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-grid strong {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detail-grid span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Progress Grid */
.progress-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.progress-grid span {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   HIGH-FIDELITY FORM & MODAL CARD DESIGN SYSTEM (Matching TBPL UI)
   ========================================================================== */
.form-card-container, .modal-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  max-width: 820px;
  margin: 1.5rem auto 3rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: formCardEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes formCardEnter {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.form-card-header, .modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.form-card-title, .modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.form-card-body, .modal-body {
  padding: 1.75rem 1.75rem 1.25rem;
  background: var(--bg-surface);
}

.form-card-footer, .modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-surface);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .form-card-container {
    margin: 0.75rem auto;
    border-radius: var(--radius-lg);
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.form-label span.req {
  color: var(--primary);
  font-weight: 700;
}

/* Universal Input, Select, and Textarea Controls */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"],
input[type="url"],
select,
textarea,
.form-input,
.form-select,
.form-textarea,
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.form-group select,
.form-group textarea,
.wizard-body input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.wizard-body select,
.wizard-body textarea,
.wizard-container input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.wizard-container select,
.wizard-container textarea,
.form-card-container input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.form-card-container select,
.form-card-container textarea,
.panel input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.panel select,
.panel textarea,
.panel-form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]):not([type="hidden"]),
.panel-form select,
.panel-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 42px;
  line-height: 1.5;
  outline: none;
  display: block;
  transition: all var(--transition-fast);
}

select,
.form-select,
.form-group select,
.wizard-body select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%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 0.85rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

input[type="date"],
.form-group input[type="date"],
.wizard-body input[type="date"] {
  min-height: 42px;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto !important;
  min-height: auto !important;
  display: inline-block !important;
  cursor: pointer;
}

.same-primary-address-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.same-primary-address-option:hover {
  border-color: var(--primary-light);
  background: var(--bg-card-hover);
}

.same-primary-address-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-glow);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.same-primary-address-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem !important;
  height: 1.15rem;
  margin: 0;
  flex: 0 0 auto;
  border: 1px solid var(--border-card);
  border-radius: 4px;
  background: var(--bg-surface);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.same-primary-address-option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.same-primary-address-option input[type="checkbox"]:checked {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.same-primary-address-option input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-inverse);
  font-size: 0.8rem;
  font-weight: 700;
}

.same-primary-address-check {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.same-primary-address-option > i {
  color: var(--primary-light);
  font-size: 1.2rem;
}

.same-primary-address-copy {
  min-width: 0;
}

.same-primary-address-copy strong,
.same-primary-address-copy small {
  display: block;
}

.same-primary-address-copy strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.same-primary-address-copy small {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.customer-document-card {
  border: 1px solid var(--border-subtle);
}

.customer-document-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.customer-document-card__heading h4 {
  margin: 0;
  color: var(--text-primary);
}

.customer-document-card__heading .req {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.form-input::placeholder,
.form-textarea::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
  font-size: 0.85rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.wizard-body input:focus,
.wizard-body select:focus,
.wizard-body textarea:focus,
.wizard-container input:focus,
.wizard-container select:focus,
.wizard-container textarea:focus,
.form-card-container input:focus,
.form-card-container select:focus,
.form-card-container textarea:focus,
.panel input:focus,
.panel select:focus,
.panel textarea:focus,
.panel-form input:focus,
.panel-form select:focus,
.panel-form textarea:focus {
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.quick-action-btn.btn-primary, .button.btn-primary, button.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.4rem;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--primary-glow);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.quick-action-btn.btn-primary:hover, .button.btn-primary:hover, button.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.quick-action-btn.btn-secondary, .button.btn-secondary, button.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.3rem;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.quick-action-btn.btn-secondary:hover, .button.btn-secondary:hover, button.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card);
}

/* Forms Backward Compatibility */
.panel-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 820px;
  margin: 1rem auto;
  box-shadow: var(--shadow-md);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}


/* Flash Messages */
.messages {
  margin-bottom: 1.5rem;
}

.message {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.65rem;
  font-weight: 500;
}

.message.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.message.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.message.warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.message.info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info); }

/* Footer */
.app-footer {
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.pagination a, .pagination span {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==========================================================================
   AUTHENTICATION & ACCESS MANAGEMENT (LOGIN UI)
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: 
    radial-gradient(circle at top right, rgba(2, 132, 199, 0.15), transparent 38rem),
    radial-gradient(circle at bottom left, rgba(217, 119, 6, 0.12), transparent 34rem),
    var(--bg-main);
  transition: background var(--transition-normal);
}

.auth-theme-bar {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
}

.auth-theme-bar .theme-toggle-btn,
.auth-theme-toggle {
  width: auto !important;
  min-width: 92px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-theme-bar .theme-toggle-btn i,
.auth-theme-toggle i {
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: transform 0.3s ease, color 0.2s ease;
}

.auth-theme-bar .theme-toggle-btn:hover,
.auth-theme-toggle:hover {
  border-color: var(--border-focus);
  color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.auth-theme-bar .theme-toggle-btn:hover i,
.auth-theme-toggle:hover i {
  transform: rotate(18deg) scale(1.12);
}

.auth-theme-bar .theme-toggle-btn:active,
.auth-theme-toggle:active {
  transform: translateY(0) scale(0.96);
}

@media (max-width: 480px) {
  .auth-theme-bar {
    top: 1rem;
    right: 1rem;
  }
  .auth-theme-bar .theme-toggle-btn,
  .auth-theme-toggle {
    min-width: 80px;
    height: 34px;
    padding: 0 0.75rem;
    font-size: 0.8rem;
  }
}
.auth-shell {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}

.auth-panel {
  width: min(440px, 100%);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  position: relative;
  animation: authFadeIn 0.35s ease-out;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  width: 56px;
  height: 56px;
  font-size: 1.4rem;
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 20px var(--primary-glow);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

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

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.3);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.auth-error i {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.input-with-icon .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.15rem;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  z-index: 1;
}

.input-with-icon .form-input {
  width: 100%;
  padding-left: 2.85rem !important;
  padding-right: 2.85rem !important;
  height: 46px;
  font-size: 0.92rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.input-with-icon .form-input:focus {
  outline: none;
  background: var(--bg-surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-toggle-pwd {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 1;
}

.btn-toggle-pwd:hover {
  color: var(--text-primary);
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.auth-options .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-submit {
  width: 100%;
  height: 46px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.auth-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.auth-credentials-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.auth-credentials-hint code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(2, 132, 199, 0.1);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

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

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE ALIGNMENT & MOBILE/TABLET DESIGN SYSTEM
   ========================================================================== */

/* Breakpoint 1: Tablets & Smaller Desktops (<= 1024px) */
@media (max-width: 1024px) {
  /* Layout & Shell */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    max-width: 84vw;
    z-index: 1050;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.35);
  }
  .sidebar-close-btn {
    display: inline-flex !important;
  }
  .sidebar-toggle-btn {
    display: inline-flex !important;
  }
  .sidebar-collapse-btn {
    display: none !important;
  }
  .workspace {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Topbar Header on Tablet */
  .topbar {
    padding: 0 1.25rem !important;
    min-height: 64px !important;
    height: auto !important;
    gap: 0.75rem !important;
  }
  .global-search-trigger {
    min-width: 160px !important;
    max-width: 220px !important;
    font-size: 0.82rem !important;
    padding: 0.4rem 0.75rem !important;
  }
  .search-kbd {
    display: none !important;
  }

  /* Content Body & Panels */
  .content-body {
    padding: 1.25rem 1.25rem !important;
  }
  .panel, .section-block {
    padding: 1.25rem !important;
    margin-bottom: 1.25rem !important;
  }

  /* Split Detail Layouts */
  .agreement-detail-layout,
  .payment-detail-layout,
  .detail-split-grid,
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 2fr 1.2fr"],
  div[style*="2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  /* Grids */
  .stats-grid, .metrics-grid, .dashboard-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 1rem !important;
  }
  .roles-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)) !important;
    gap: 1rem !important;
  }
  .wizard-card, .form-card-container, .modal-container, .panel-form {
    max-width: 100% !important;
    margin: 1rem auto 2rem !important;
  }
}

/* Breakpoint 2: Mobile Screens & Phablets (<= 768px) */
@media (max-width: 768px) {
  /* Topbar Mobile */
  .topbar {
    padding: 0 0.85rem !important;
    min-height: 56px !important;
    height: 56px !important;
    max-height: 56px !important;
    gap: 0.5rem !important;
    flex-wrap: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 90 !important;
  }
  .topbar-left {
    gap: 0.65rem !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
  }
  /* Remove title text across every page on mobile screens */
  .page-titles {
    display: none !important;
  }
  /* Mobile Project Logo Beside Hamburger */
  .topbar-mobile-logo {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    position: static !important;
    transform: none !important;
    cursor: pointer !important;
    flex: 0 0 auto !important;
  }
  .topbar-mobile-logo .mobile-logo-img {
    height: 32px !important;
    max-height: 32px !important;
    width: auto !important;
    max-width: 100px !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 6px !important;
  }
  .topbar-right {
    gap: 0.35rem !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
  }
  .global-search-trigger {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: var(--radius-md) !important;
    justify-content: center !important;
  }
  .global-search-trigger span,
  .global-search-trigger kbd {
    display: none !important;
  }
  .global-search-trigger i {
    font-size: 1.15rem !important;
    margin: 0 !important;
  }
  .theme-toggle-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.05rem !important;
    flex-shrink: 0 !important;
  }
  .sidebar-toggle-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.15rem !important;
    flex-shrink: 0 !important;
  }

  /* Header action buttons if placed in topbar-right */
  .topbar-right > div,
  .topbar-header-actions {
    width: 100% !important;
    order: 3 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    padding-top: 0.4rem !important;
    border-top: 1px dashed var(--border-subtle) !important;
    margin-top: 0.25rem !important;
  }
  .topbar-right > div .button,
  .topbar-right > div form,
  .topbar-right > div form button,
  .topbar-header-actions .button,
  .topbar-header-actions form,
  .topbar-header-actions form button {
    flex: 1 1 auto !important;
    font-size: 0.78rem !important;
    padding: 0.35rem 0.65rem !important;
    height: 34px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Content Body */
  .content-body {
    padding: 0.85rem 0.75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Panels & Sections */
  .panel, .section-block {
    padding: 1rem 0.85rem !important;
    margin-bottom: 1rem !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .section-header {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem !important;
    padding-bottom: 0.65rem !important;
  }
  .section-header h2, .panel-title {
    font-size: 1.05rem !important;
  }

  /* Filter Toolbars & Search Controls in List Views */
  .panel form,
  .toolbar form,
  .table-toolbar-wrap {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .panel form > div,
  .toolbar form > div,
  .table-toolbar-left,
  .table-toolbar-right {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0.65rem !important;
    flex: 1 1 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .panel form input,
  .panel form select,
  .toolbar form input,
  .toolbar form select,
  .table-toolbar-wrap input,
  .table-toolbar-wrap select {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  .panel form > div > div[style*="min-width"],
  .toolbar form > div > div[style*="min-width"] {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
  }
  .panel form button,
  .panel form a.button,
  .toolbar form button,
  .toolbar form a.button,
  .table-toolbar-wrap button,
  .table-toolbar-wrap a.button {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    height: 40px !important;
    box-sizing: border-box !important;
  }
  .col-toggle-dropdown {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .col-toggle-dropdown button {
    width: 100% !important;
    justify-content: center !important;
    height: 40px !important;
    box-sizing: border-box !important;
  }
  .col-toggle-menu {
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    z-index: 100 !important;
  }

  /* Form Layouts & Grids */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    margin-bottom: 0.75rem !important;
  }
  .form-group {
    margin-bottom: 0.85rem !important;
    width: 100% !important;
  }

  /* Form Card & Modals */
  .form-card-container,
  .modal-container,
  .panel-form {
    margin: 0.25rem 0 1.25rem !important;
    padding: 0 !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .form-card-header,
  .modal-header {
    padding: 0.85rem 1rem !important;
  }
  .form-card-title,
  .modal-title {
    font-size: 1.1rem !important;
  }
  .form-card-body,
  .modal-body {
    padding: 1rem 0.85rem !important;
  }
  .form-card-footer,
  .modal-footer,
  .form-actions {
    padding: 0.85rem !important;
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .form-card-footer button,
  .form-card-footer a,
  .modal-footer button,
  .modal-footer a,
  .form-actions button,
  .form-actions a {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 42px !important;
  }

  /* Multi-Step Wizard */
  .wizard-card {
    margin: 0.25rem 0 1.5rem !important;
    border-radius: var(--radius-lg) !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .wizard-header {
    padding: 1rem 0.85rem 0.85rem !important;
  }
  .wizard-title-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    margin-bottom: 0.75rem !important;
    gap: 0.5rem !important;
  }
  .wizard-main-title {
    font-size: 1.1rem !important;
    line-height: 1.25 !important;
  }
  .wizard-subtitle {
    font-size: 0.75rem !important;
  }
  .wizard-stepper {
    margin: 0.5rem 0 0 !important;
    width: 100% !important;
    justify-content: space-between !important;
  }
  .wizard-stepper-line {
    top: 15px !important;
    left: 16px !important;
    right: 16px !important;
    height: 2px !important;
  }
  .wizard-step-node {
    flex: 1 !important;
  }
  .wizard-step-circle {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.78rem !important;
  }
  .wizard-step-label {
    font-size: 0.68rem !important;
    margin-top: 0.35rem !important;
    max-width: 90px !important;
    white-space: normal !important;
    text-align: center !important;
    line-height: 1.15 !important;
    word-break: break-word !important;
  }
  .wizard-body {
    padding: 1rem 0.85rem 0.5rem !important;
  }
  .wizard-step-intro {
    margin-bottom: 1rem !important;
    padding-bottom: 0.65rem !important;
  }
  .wizard-step-heading {
    font-size: 0.95rem !important;
    line-height: 1.3 !important;
  }
  .wizard-step-desc {
    font-size: 0.76rem !important;
  }
  .wizard-footer {
    flex-direction: column-reverse !important;
    gap: 0.65rem !important;
    align-items: stretch !important;
    padding: 0.85rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .wizard-footer > div {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    align-items: stretch !important;
  }
  .wizard-footer .quick-action-btn,
  .wizard-footer .button,
  .wizard-footer a.quick-action-btn,
  .wizard-footer button.quick-action-btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 42px !important;
    font-size: 0.88rem !important;
    margin: 0 !important;
  }

  /* Tab Navigation Bars */
  .tabs-nav,
  .tabs-nav-bar {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding: 0.3rem 0.4rem !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 1rem !important;
    scrollbar-width: none !important;
  }
  .tabs-nav::-webkit-scrollbar,
  .tabs-nav-bar::-webkit-scrollbar {
    display: none !important;
  }
  .tab-nav-btn,
  .tab-link {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
  }

  /* Data Tables */
  .data-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 0.75rem !important;
  }
  .data-table th,
  .data-table td {
    padding: 0.65rem 0.75rem !important;
    font-size: 0.8rem !important;
  }
  .pagination {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }
  .pagination a,
  .pagination span {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.78rem !important;
  }

  /* Detail Grids & Stats */
  .detail-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    padding: 0.85rem !important;
    border-radius: var(--radius-md) !important;
  }
  .stats-grid,
  .metrics-grid,
  .dashboard-metrics-grid,
  .projects-grid,
  .audit-kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 0.65rem !important;
    margin-bottom: 1rem !important;
  }
  .stat-card,
  .metric-card {
    padding: 0.85rem !important;
  }
  .stat-card-value,
  .metric-card .metric-value {
    font-size: 1.4rem !important;
    margin-bottom: 0.2rem !important;
  }
  .stat-card-title {
    font-size: 0.74rem !important;
  }

  /* Roles and Permissions Mobile */
  .roles-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  .roles-toolbar-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .roles-toolbar a.button,
  .roles-toolbar-actions form,
  .roles-toolbar-actions form button,
  .roles-toolbar-actions a.button {
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }
  .roles-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .role-card {
    padding: 1.15rem 0.95rem !important;
    border-radius: var(--radius-md) !important;
  }
  .role-card-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  .role-card-actions {
    width: 100% !important;
    justify-content: stretch !important;
  }
  .role-card-actions a.button,
  .role-card-actions form {
    flex: 1 1 auto !important;
  }
  .role-card-actions form button {
    width: 100% !important;
    justify-content: center !important;
  }
}

/* Breakpoint 3: Small Mobile Screens (<= 480px) */
@media (max-width: 480px) {
  .content-body {
    padding: 0.65rem 0.5rem !important;
  }
  .panel, .section-block {
    padding: 0.75rem 0.65rem !important;
  }
  .stats-grid,
  .metrics-grid,
  .dashboard-metrics-grid,
  .projects-grid,
  .audit-kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .wizard-step-label {
    font-size: 0.62rem !important;
    max-width: 70px !important;
  }
  .wizard-step-circle {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.7rem !important;
  }
  .wizard-stepper-line {
    top: 13px !important;
    left: 10px !important;
    right: 10px !important;
  }
  .app-footer {
    padding: 1rem 0.75rem !important;
    font-size: 0.72rem !important;
  }
  .auth-panel {
    padding: 1.5rem 1rem !important;
  }
  .auth-title {
    font-size: 1.4rem !important;
  }
  .auth-shell {
    padding: 1.25rem 0.75rem !important;
  }
}

/* ==========================================================================
   HTMX Seamless In-Place Update Transitions & Indicators
   ========================================================================== */
tr.htmx-swapping,
.htmx-swapping {
  opacity: 0 !important;
  transform: translateX(12px) scale(0.98);
  transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.htmx-settling {
  transition: all 250ms ease-in-out;
}

.htmx-highlight {
  animation: htmxFlash 1.4s ease-out;
}

@keyframes htmxFlash {
  0% {
    background-color: rgba(220, 5, 20, 0.15);
  }
  100% {
    background-color: transparent;
  }
}

/* ==========================================================================
   GLOBAL LOADING SYSTEM & ANIMATIONS
   ========================================================================== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin,
.loading-spinner {
  display: inline-block;
  animation: spin 0.8s linear infinite !important;
  transform-origin: center center;
}

/* Slimline Executive Top Progress Bar */
.app-top-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, #f59e0b 50%, var(--primary) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 12px var(--primary-glow), 0 0 6px rgba(245, 158, 11, 0.7);
  z-index: 99999999;
  pointer-events: none;
  opacity: 0;
  transition: width 0.22s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.28s ease;
  animation: loaderGradientShift 2s linear infinite;
}

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

/* Button & Action Loading State */
.btn-loading,
button[disabled].is-loading,
.button.is-loading,
.quick-action-btn.is-loading,
.auth-submit.btn-loading {
  position: relative !important;
  pointer-events: none !important;
  cursor: wait !important;
  opacity: 0.88 !important;
  transition: all 0.2s ease !important;
}

.btn-loading i.spin,
.btn-loading .loading-spinner-icon {
  animation: spin 0.8s linear infinite !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* HTMX Indicator Enhancements */
.htmx-indicator {
  display: none !important;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex !important;
  animation: fadeIn 0.2s ease-out;
}

.htmx-indicator i {
  animation: spin 0.8s linear infinite;
}

.htmx-request.button,
button.htmx-request,
.htmx-request.quick-action-btn {
  opacity: 0.82;
  pointer-events: none;
  cursor: wait;
}

/* Live Search Loading Animation */
.search-box.is-searching .input-icon i,
.input-with-icon.is-searching .input-icon i,
div.is-searching span i {
  animation: spin 0.8s linear infinite !important;
  color: var(--primary) !important;
}

/* Modern Skeleton Placeholder Shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
  display: block;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* ==========================================================================
   Floating Toast Notification System (SPA Feedback)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: min(92vw, 380px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 500;
  color: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastSlideIn 280ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 240ms ease-out;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-item.toast-leave {
  opacity: 0;
  transform: translateX(20px) scale(0.95);
}

.toast-item.toast-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-item.toast-error {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-item.toast-warning {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #1A1816;
}

.toast-item.toast-info {
  background: linear-gradient(135deg, var(--secondary) 0%, #25282D 100%);
  border: 1px solid var(--border-subtle);
}

.toast-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
  line-height: 1.35;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 0 0 0.4rem;
  line-height: 1;
  transition: opacity 150ms ease;
}

.toast-close:hover {
  opacity: 1;
}

@media (max-width: 640px) {
  .toast-container {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    max-width: 100%;
  }
}

/* ==========================================================================
   UNIVERSAL CONFIRMATION MODAL POPUP UI
   ========================================================================== */
.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 18, 24, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

.confirm-modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-backdrop.is-active .confirm-modal-dialog {
  transform: scale(1) translateY(0);
}

.confirm-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.confirm-modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.confirm-modal-icon-badge.danger {
  background: rgba(220, 5, 20, 0.12);
  color: var(--primary);
  border: 1px solid rgba(220, 5, 20, 0.25);
}

.confirm-modal-icon-badge.warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.confirm-modal-icon-badge.info {
  background: rgba(5, 150, 105, 0.12);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.confirm-modal-title-wrap {
  flex: 1;
}

.confirm-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.confirm-modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.confirm-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

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

.confirm-modal-body {
  padding: 1.25rem 1.5rem;
}

.confirm-modal-message {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
}

.confirm-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.5rem 1.25rem 1.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}

.confirm-modal-btn-proceed.danger {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--primary-glow) !important;
}

.confirm-modal-btn-proceed.warning {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  border-color: #d97706 !important;
  color: #ffffff !important;
}

.confirm-modal-btn-proceed.success {
  background: linear-gradient(135deg, #059669, #047857) !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

/* ==========================================================================
   TABBED NAVIGATION SYSTEM (Agreement Case Detail & Complex Views)
   ========================================================================== */
.tabs-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.35rem 0.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.tab-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.tab-nav-btn.is-active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.tab-nav-btn.is-active i {
  color: #ffffff !important;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-card);
  color: var(--text-muted);
  line-height: 1;
  transition: all 0.18s ease;
}

.tab-nav-btn.is-active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.tab-pane {
  animation: tabPaneFade 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tabPaneFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   GLOBAL SEARCH COMPONENT & AUTOCOMPLETE MODAL
   ========================================================================== */
.global-search-trigger {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: 20px !important;
  padding: 0.45rem 0.95rem !important;
  color: var(--text-muted) !important;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.18s ease;
  min-width: 220px;
  max-width: 320px;
  box-shadow: none !important;
}

.global-search-trigger:hover {
  border-color: var(--border-card) !important;
  background: var(--bg-card-hover) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm) !important;
}

.global-search-trigger i {
  font-size: 1.05rem;
  color: var(--text-muted);
}

.global-search-trigger:hover i {
  color: var(--primary);
}

.search-kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

.global-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 1rem 2rem;
  animation: searchBackdropIn 0.18s ease;
}

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

.global-search-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  animation: searchModalSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes searchModalSlide {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.global-search-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.global-search-icon {
  font-size: 1.35rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.global-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
}

.global-search-input::placeholder {
  color: var(--text-muted);
}

.global-search-close-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.global-search-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.global-search-results {
  overflow-y: auto;
  padding: 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.global-search-category {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.global-search-cat-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.global-search-cat-header i {
  color: var(--primary);
  font-size: 0.9rem;
}

.global-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  gap: 0.75rem;
}

.global-search-item:hover, .global-search-item.is-selected {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  transform: translateX(3px);
}

.global-search-item:hover .global-search-item-title {
  color: var(--primary);
}

.global-search-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.global-search-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.global-search-item-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-shortcut-hints {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.search-shortcut-hints span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   TIDY DATA TABLES - STICKY HEADERS, COLUMN VISIBILITY & PER-COLUMN FILTERS
   ========================================================================== */
.data-table-wrapper {
  overflow-x: auto;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.86rem;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem 1.1rem;
  border-bottom: 2px solid var(--border-subtle);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  white-space: nowrap;
  user-select: none;
}

[data-theme="dark"] .data-table thead th {
  background: var(--bg-surface);
  border-bottom-color: var(--border-card);
}

.data-table tbody td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tfoot td {
  padding: 0.95rem 1.1rem;
  border-top: 2px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-heading);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

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

/* Column Visibility Dropdown Component */
.table-toolbar-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1;
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.col-toggle-dropdown {
  position: relative;
}

.col-toggle-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  min-width: 210px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  animation: colMenuSlide 0.15s ease;
}

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

.col-toggle-menu-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.25rem;
}

.col-toggle-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.col-toggle-item:hover {
  background: var(--bg-card);
}

.col-toggle-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ==========================================================================
   MULTI-STEP FORM WIZARD & INLINE VALIDATION SYSTEM
   ========================================================================== */
.wizard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  max-width: 860px;
  margin: 1.5rem auto 3rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: formCardEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.wizard-header {
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.wizard-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.wizard-main-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.wizard-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress Stepper Bar */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 0.75rem 0 0.25rem;
}

.wizard-stepper-line {
  position: absolute;
  top: 18px;
  left: 36px;
  right: 36px;
  height: 3px;
  background: var(--border-subtle);
  z-index: 1;
}

.wizard-stepper-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

.wizard-step-node {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  outline: none;
  flex: 1;
}

.wizard-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-card);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.wizard-step-node.is-active .wizard-step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-glow);
  transform: scale(1.08);
}

.wizard-step-node.is-complete .wizard-step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.wizard-step-node.has-error .wizard-step-circle {
  background: var(--danger, #ef4444) !important;
  border-color: var(--danger, #ef4444) !important;
  color: #fff !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important;
  animation: pulseError 1.5s infinite;
}

.wizard-step-node.has-error .wizard-step-label {
  color: var(--danger, #ef4444) !important;
  font-weight: 700;
}

@keyframes pulseError {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.wizard-step-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.45rem;
  text-align: center;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
}

.wizard-step-node:hover .wizard-step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.wizard-step-node:hover .wizard-step-label {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.18);
}

.wizard-step-node.is-active .wizard-step-label {
  color: var(--primary);
  font-weight: 700;
}

.wizard-step-node.is-complete .wizard-step-label {
  color: var(--text-primary);
}

.registration-wizard {
  max-width: 1040px;
}

.registration-wizard .wizard-stepper {
  gap: 0.25rem;
}

.registration-wizard .wizard-step-node {
  min-width: 0;
}

.registration-wizard .wizard-step-label {
  max-width: 74px;
  white-space: normal;
  line-height: 1.2;
  font-size: 0.68rem;
}

.wizard-body {
  padding: 2rem 2rem 1.5rem;
  background: var(--bg-surface);
}

.wizard-step-pane {
  animation: wizardPaneIn 0.25s ease;
}

@keyframes wizardPaneIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.wizard-step-intro {
  margin-bottom: 1.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.wizard-step-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wizard-step-heading i {
  color: var(--primary);
  font-size: 1.2rem;
}

.wizard-step-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.wizard-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

/* Customer Registration Wizard Continue Button Highlight & Validation States */
.wizard-btn-continue {
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  font-weight: 600;
}

.wizard-btn-continue.is-eligible {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 4px 14px var(--primary-glow, rgba(220, 5, 20, 0.28)) !important;
  cursor: pointer !important;
  opacity: 1 !important;
}

.wizard-btn-continue.is-eligible:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220, 5, 20, 0.38) !important;
}

.wizard-btn-continue.is-disabled,
.wizard-btn-continue:disabled {
  background: var(--bg-card) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text-muted) !important;
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}

.wizard-step-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  max-width: 340px;
  line-height: 1.3;
}


/* Inline Form Validation */
.field-error-msg {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 4px;
  animation: fieldShake 0.2s ease;
}

@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.form-input.is-invalid, .form-select.is-invalid, .form-textarea.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-bg) !important;
}

.form-input.is-valid, .form-select.is-valid, .form-textarea.is-valid {
  border-color: var(--success) !important;
}

/* ==========================================================================
   MINIMAL & USER-FRIENDLY PROFILE PAGE
   ========================================================================== */
.profile-wrapper {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.profile-layout-split {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .profile-layout-split {
    grid-template-columns: 1fr;
  }
}

/* Profile Identity Card (Left) */
.profile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 2.25rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.profile-avatar-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #a0040f 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 20px var(--primary-glow);
  margin-bottom: 1.25rem;
  position: relative;
}

.profile-avatar-circle .online-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
  border: 3px solid var(--bg-surface);
}

.profile-card-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.profile-card-handle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.profile-card-divider {
  width: 100%;
  height: 1px;
  background: var(--border-subtle);
  margin: 1.25rem 0;
}

.profile-details-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.profile-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.profile-detail-label {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.profile-detail-label i {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

/* Profile Content Card (Right) */
.profile-content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.profile-segmented-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  padding: 0.5rem 0.75rem 0;
  gap: 0.5rem;
}

.profile-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

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

.profile-tab-item.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.profile-body-section {
  padding: 2rem;
}

.profile-section-header {
  margin-bottom: 1.5rem;
}

.profile-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.profile-section-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.35rem 0 0 0;
}

.profile-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.25rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.topbar-profile-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.topbar-profile-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--border-focus);
}

.topbar-profile-btn.active {
  background: rgba(220, 5, 20, 0.08);
  color: var(--primary);
  border-color: var(--primary);
}

.sidebar-user-profile-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary) !important;
}

/* ==========================================================================
   CUSTOMER NOTES MODAL & TOPBAR BUTTON - EXECUTIVE SUITE
   ========================================================================== */

.topbar-notes-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.topbar-notes-btn i {
  font-size: 1.15rem;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.topbar-notes-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(220, 5, 20, 0.12);
}

.topbar-notes-btn:hover i {
  transform: scale(1.1);
}

.customer-notes-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99980;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 1rem 2rem;
  overflow-y: auto;
  animation: searchBackdropIn 0.2s ease;
}

.customer-notes-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 780px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: searchModalSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.notes-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.notes-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notes-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(220, 5, 20, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.notes-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0;
  line-height: 1.3;
}

.notes-modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.notes-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notes-modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.notes-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.notes-selector-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.notes-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notes-selector-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notes-customer-select-box {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0 0.85rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.notes-customer-select-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.notes-customer-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.notes-cust-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.notes-cust-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.notes-cust-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.notes-cust-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.notes-view-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.notes-tab-btn-group {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.notes-tab-btn {
  background: transparent;
  border: none;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.notes-tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.notes-tool-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.notes-tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--primary);
}

.notes-bullet-textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 150px;
  outline: none;
  transition: border-color 0.15s ease;
}

.notes-bullet-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.notes-bullets-rendered-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.notes-bullet-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.notes-bullet-row:hover {
  border-color: var(--border-card);
  background: var(--bg-card-hover);
}

.notes-bullet-icon {
  color: var(--primary);
  font-size: 1.1rem;
  margin-top: 1px;
  flex-shrink: 0;
}

.notes-bullet-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
}

.notes-bullet-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.notes-bullet-row:hover .notes-bullet-actions {
  opacity: 1;
}

.notes-bullet-item-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.notes-bullet-item-btn:hover {
  background: var(--bg-surface);
  color: var(--primary);
}

.notes-bullet-item-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.notes-add-bullet-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.notes-add-bullet-input {
  flex: 1;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0 0.85rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
}

.notes-add-bullet-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.notes-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.notes-empty-state {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Details & Slabs - Two-Column Layout & Customer Notes Panel
   ========================================================================== */
.details-slabs-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 1.5rem;
  align-items: start;
}

.details-form-column {
  min-width: 0;
}

.customer-notes-column {
  min-width: 0;
}

.customer-notes-card {
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
}

@media (min-width: 992px) {
  .customer-notes-sticky {
    position: sticky;
    top: calc(var(--header-height, 66px) + 1.25rem);
    max-height: calc(100vh - var(--header-height, 66px) - 2.5rem);
    overflow-y: auto;
  }
}

@media (max-width: 991px) {
  .details-slabs-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .customer-notes-sticky {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* ==========================================================================
   Timestamped Customer Notes Activity & Timeline
   ========================================================================== */
.note-composer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

/* ==========================================================================
   MINIMAL CHAT & COMMENTS NOTES UI
   ========================================================================== */
.note-composer-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 10px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  position: relative;
}

.note-composer-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
  background: var(--bg-surface);
}

.note-composer-textarea {
  width: 100%;
  min-height: 66px;
  max-height: 220px;
  padding: 0.7rem 0.85rem 0.38rem;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.55;
  resize: vertical;
  display: block;
}

.note-composer-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.72;
}

.note-composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.38rem 0.75rem 0.45rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.note-composer-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.note-composer-hint kbd {
  font-family: var(--font-mono, monospace);
  font-size: 0.63rem;
  padding: 1px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  color: var(--text-secondary);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.note-send-btn {
  height: 28px;
  padding: 0 0.85rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-sm, 6px);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  border: none;
  transition: all 0.15s ease;
}

.note-send-btn:hover:not(:disabled) {
  background: var(--primary-dark, #b80411);
  transform: translateY(-1px);
}

.note-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.notes-timeline-stream {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
}

.note-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 0.68rem 0.85rem;
  transition: all 0.15s ease;
  position: relative;
}

.note-item-card:hover {
  background: var(--bg-surface);
  border-color: var(--border-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.note-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.32rem;
  gap: 0.5rem;
}

.note-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 102, 204, 0.12);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.note-author-name {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-heading);
}

.note-time-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}

.note-item-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.note-item-card:hover .note-item-actions {
  opacity: 1;
}

.note-action-icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-action-icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.note-action-icon-btn.danger:hover {
  color: var(--danger);
  background: rgba(220, 5, 20, 0.08);
  border-color: rgba(220, 5, 20, 0.2);
}

.note-item-body {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 1px;
}






