/* ==========================================================================
   MINIMALIST TECH DESIGN SYSTEM (Linear/Vercel-inspired)
   ========================================================================== */
:root {
  /* Default: Dark Theme */
  --bg-main: #000000;
  --bg-surface: #0a0a0a;
  --bg-card: #0d0d0d;
  --bg-card-hover: #121212;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);
  --border-color-focus: rgba(255, 255, 255, 0.3);

  --accent-primary: #ffffff;
  --accent-secondary: #a3a3a3;
  --accent-bg: rgba(255, 255, 255, 0.08);
  --accent-bg-hover: rgba(255, 255, 255, 0.12);

  --text-primary: #ffffff;
  --text-secondary: #a3a3a3;
  --text-muted: #525252;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.06);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.06);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.06);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --transition-smooth: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #fafafa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  
  --border-color: rgba(0, 0, 0, 0.06);
  --border-color-hover: rgba(0, 0, 0, 0.12);
  --border-color-focus: rgba(0, 0, 0, 0.35);

  --accent-primary: #000000;
  --accent-secondary: #525252;
  --accent-bg: rgba(0, 0, 0, 0.05);
  --accent-bg-hover: rgba(0, 0, 0, 0.08);

  --text-primary: #000000;
  --text-secondary: #525252;
  --text-muted: #a3a3a3;

  --success-bg: rgba(16, 185, 129, 0.04);
  --warning-bg: rgba(245, 158, 11, 0.04);
  --error-bg: rgba(239, 68, 68, 0.04);

  --glass-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   RESET & CORE BASE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background-color 0.22s ease, color 0.22s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.app-container {
  min-height: 100vh;
  display: flex;
  width: 100%;
}

.sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-left: 0.5rem;
}

[data-theme="light"] .brand-section img {
  filter: invert(1);
}

.brand-logo {
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo span {
  color: var(--bg-main);
  font-weight: 800;
  font-size: 0.85rem;
}

.brand-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
}

.nav-item button {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition-smooth);
}

.nav-item button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.6;
}

.nav-item button:hover {
  color: var(--text-primary);
  background: var(--accent-bg);
}

.nav-item.active button {
  background: var(--accent-bg);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-item.active button svg {
  opacity: 1;
}

.user-profile-section {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-info {
  display: flex;
  flex-direction: column;
  padding-left: 0.5rem;
}

.username-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.role-badge {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.logout-btn {
  background: none;
  color: var(--error);
  border: 1px solid var(--border-color);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: var(--transition-smooth);
  width: 100%;
}
.logout-btn:hover {
  background: var(--error-bg);
  border-color: var(--error);
}

/* Main Content Area */
.main-wrapper {
  margin-left: 240px;
  padding: 2rem 3rem;
  width: calc(100% - 240px);
  min-height: 100vh;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1), width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .main-wrapper {
  margin-left: 0;
  width: 100%;
}

/* Top Navbar Header */
.top-navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.top-navbar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.top-navbar-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}
.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-color-hover);
  background: var(--accent-bg);
}

/* ==========================================================================
   UI COMPONENTS (Flat Cards, Tabs)
   ========================================================================== */
.view-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-title h1 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.view-title p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
  margin-bottom: 1.5rem;
}

.glass-card:hover {
  border-color: var(--border-color-hover);
}

.glass-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.glass-card-header h2 {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Alerts and Callouts */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border: 1px solid transparent;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}
.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}
.alert-error {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.alert-icon {
  font-size: 1rem;
  line-height: 1.2;
}

.alert-message {
  font-size: 0.8rem;
  font-weight: 500;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
}
.alert-close:hover {
  opacity: 1;
}

/* ==========================================================================
   FORMS & INPUT CONTROLS
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-smooth);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-color-focus);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-primary, #6366f1);
  outline-offset: 1px;
}

textarea {
  min-height: 90px;
  resize: vertical;
  transition: min-height 0.22s ease;
}

@media (min-height: 850px) {
  textarea {
    min-height: 150px;
  }
}

/* Checkbox and toggles */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.4rem 0;
}

.checkbox-group input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-main);
}
.btn-primary:hover {
  background: var(--accent-secondary);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--accent-bg);
  border-color: var(--border-color-hover);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}
.btn-danger:hover {
  background: var(--error-bg);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   VIEWS - LOGIN PANEL
   ========================================================================== */
.login-screen {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: var(--bg-main);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  box-shadow: var(--glass-shadow);
  text-align: center;
}

.login-logo {
  width: 32px;
  height: 32px;
  background: var(--accent-primary);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.login-logo svg {
  width: 14px;
  height: 14px;
  fill: var(--bg-main);
}

.login-card h2 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.login-card p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 1.75rem;
}

.login-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==========================================================================
   VIEWS - DASHBOARD OVERVIEW
   ========================================================================== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
}

.metric-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: var(--transition-smooth);
}

.metric-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.metric-card:hover .metric-icon {
  background: var(--accent-primary);
  color: var(--bg-main);
}

.metric-details {
  display: flex;
  flex-direction: column;
}

.metric-value {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Table Design */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--accent-bg);
}

/* ==========================================================================
   VIEWS - LOOKUP & PROFILE SEARCH
   ========================================================================== */
.search-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
}

.search-input-wrapper input {
  padding-left: 2.1rem;
  font-size: 0.85rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  transition: var(--transition-smooth);
}

@media (min-width: 1400px) {
  .profile-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.participant-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  display: inline-block;
  margin-bottom: 0.35rem;
}

/* View Mode Details Layout */
.profile-view-section {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}
.profile-view-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-view-section h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.profile-view-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 1400px) {
  .profile-view-grid {
    grid-template-columns: 1fr 1fr;
  }
  .profile-view-grid .profile-view-item.full-width {
    grid-column: 1 / -1;
  }
}

.profile-view-item {
  display: flex;
  flex-direction: column;
}

.profile-view-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.profile-view-value {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

#profile-edit-form {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 1rem;
}



/* Badges */
.pms-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  margin: 0.1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-secondary);
}

/* Tabs UI Component */
.tab-headers {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

/* Timeline Layout */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline-item {
  border-left: 1.5px solid var(--border-color);
  padding-left: 1rem;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 5px;
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
}

.timeline-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.timeline-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
  color: var(--text-primary);
}

.timeline-content {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   CUSTOM AUTOCOMPLETE DROPDOWN
   ========================================================================== */
.autocomplete-container {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color-focus);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 150;
  box-shadow: var(--glass-shadow);
  display: none;
  list-style: none;
  margin-top: 2px;
}

.autocomplete-item {
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--accent-bg);
  color: var(--text-primary);
}

/* ==========================================================================
   VIEWS - REPORTS & CHARTS
   ========================================================================== */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.chart-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   ADMIN TAB PANEL LAYOUT
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.admin-nav-menu-col {
  min-width: 0;
  width: 100%;
}

.admin-panes-col {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.admin-nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-nav-category-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #94a3b8);
  padding: 0.65rem 0.5rem 0.2rem 0.5rem;
  user-select: none;
  list-style: none;
}

.admin-nav-category-header:first-child {
  padding-top: 0.1rem;
}

.admin-nav-item button {
  width: 100%;
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.admin-nav-item button:hover {
  color: var(--text-primary);
  background: var(--accent-bg);
}

.admin-nav-item.active button {
  background: var(--accent-bg);
  color: var(--text-primary);
  font-weight: 600;
}

.admin-pane {
  display: none;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.admin-pane.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.admin-pane .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.admin-pane .table-responsive table {
  width: 100%;
  border-collapse: collapse;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.modal-backdrop, .modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  animation: fadeIn 0.15s ease-out;
}

.modal-content, .modal-card {
  width: 92%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-close-btn, .modal-close {
  background: transparent !important;
  border: none !important;
  color: var(--text-muted, #94a3b8) !important;
  font-size: 1.35rem !important;
  line-height: 1 !important;
  width: 28px !important;
  height: 28px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  border-radius: 50% !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.modal-close-btn:hover, .modal-close:hover {
  color: var(--text-primary, #ffffff) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.children-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.children-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.8rem;
}

.children-table-wrapper th {
  white-space: nowrap;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.45rem 0.55rem;
  color: var(--text-secondary);
}

.children-table-wrapper td {
  padding: 0.45rem 0.55rem;
  vertical-align: middle;
}

.children-table-wrapper td.col-nowrap {
  white-space: nowrap;
}

.children-table-wrapper td.col-notes {
  min-width: 130px;
  max-width: 240px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

/* ==========================================================================
   CHILDREN RECORDS CARDS (Compact, High-Usability Responsive Layout)
   ========================================================================== */
.children-records-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.child-record-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition-smooth);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.child-record-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.child-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.child-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.child-name {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.child-type-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.child-card-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  margin-left: auto;
}

.child-card-actions .row-action-btn {
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  line-height: 1;
}

.child-card-actions .row-action-btn svg {
  width: 13px;
  height: 13px;
}

.child-card-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: var(--accent-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
}

.child-timeline-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.child-detail-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 600;
}

.child-detail-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-body);
}

.child-notes-row {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--accent-bg);
  border-left: 2.5px solid var(--border-color-focus);
  padding: 0.4rem 0.6rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.4;
  word-break: break-word;
}

.child-notes-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 0.3rem;
}

.child-notes-text {
  color: var(--text-secondary);
}

.child-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  margin: 0.85rem 0 0.4rem 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.child-section-title:first-child {
  margin-top: 0;
}

@media (max-width: 480px) {
  .child-card-header {
    flex-wrap: wrap;
  }
  .child-card-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
  .child-card-details {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    padding: 0.35rem 0.45rem;
  }
  .child-detail-label {
    font-size: 0.6rem;
  }
  .child-detail-value {
    font-size: 0.75rem;
  }
}


/* Conflict highlights */
.conflict-highlight {
  border: 1.5px solid var(--warning) !important;
  background: var(--warning-bg) !important;
}

.conflict-db-value {
  font-size: 0.7rem;
  color: var(--warning);
  font-weight: bold;
  margin-top: 0.15rem;
}

/* ==========================================================================
   RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 950px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
  .report-grid {
    grid-template-columns: 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 1rem;
  }
  .admin-nav-item button {
    padding: 0.45rem 0.65rem;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    max-height: 500px;
    position: relative;
    padding: 1rem;
    overflow: hidden;
    transition: max-height 0.22s ease-out, padding 0.22s ease-out, border 0.22s ease-out;
  }
  .sidebar-collapsed .sidebar {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border: none !important;
    transform: none !important;
  }
  .brand-section {
    margin-bottom: 1rem;
  }
  .nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 1rem;
  }
  .nav-item button {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    padding: 1.5rem;
  }
  .user-profile-section {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
  }
  .logout-btn {
    width: auto;
  }
  .top-navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   ULTRA-WIDE SCREEN VIEWPORT OPTIMIZATIONS
   ========================================================================== */
@media (min-width: 1600px) {
  .profile-layout {
    grid-template-columns: 1fr 1fr;
  }
  .profile-view-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .profile-view-grid .profile-view-item.full-width {
    grid-column: 1 / -1;
  }

  .report-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .report-grid .glass-card:last-child {
    grid-column: span 1;
  }
}

@media (min-width: 2000px) {
  .profile-layout {
    grid-template-columns: 1fr 1fr;
  }
  .profile-view-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  #profile-edit-form {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   TOAST NOTIFICATION SYSTEM
   ========================================================================== */
#toast-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999999 !important;
}

.toast {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--border-color) !important;
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.65rem 1rem;
  min-width: 260px;
  max-width: 380px;
}

.toast-loading {
  border-left: 3px solid var(--accent-primary) !important;
}

.toast-success {
  border-left: 3px solid var(--success) !important;
}

.toast-error {
  border-left: 3px solid var(--error) !important;
}

.spinner-tiny {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.selected-top-item {
  border-color: var(--accent-primary) !important;
  background: var(--accent-bg) !important;
}

.selected-top-autocomplete {
  background: var(--accent-bg) !important;
  color: var(--text-primary) !important;
}

/* Co-Parent Side-by-Side Layout and Autocomplete CSS */
.profile-layout.co-parent-active {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(280px, 1fr) !important;
  max-width: 100%;
}

@media (max-width: 1300px) {
  .profile-layout.co-parent-active {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 950px) {
  .profile-layout.co-parent-active {
    grid-template-columns: 1fr !important;
  }
}

/* Co-Parent Link Badges in View Mode */
.co-parents-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.co-parent-badge-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.co-parent-badge-link:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Edit Form Link Badges */
.co-parent-edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-primary);
}

.co-parent-edit-badge .remove-btn {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: bold;
  transition: var(--transition-smooth);
}

.co-parent-edit-badge .remove-btn:hover {
  color: var(--accent-danger);
}

.autocomplete-item.selected-top-autocomplete {
  background: var(--accent-bg);
  color: var(--text-primary);
}

/* Active profile focus outline in side-by-side mode */
.profile-layout.co-parent-active #profile-card {
  box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-lg) !important;
  border-color: var(--accent-primary) !important;
}

/* Row action button styling and transitions */
.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.row-action-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.row-action-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Custom Multi-select Dropdown styles */
.custom-multiselect-container {
  position: relative;
  width: 100%;
}

.custom-multiselect-trigger {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  min-height: 31px;
}

.custom-multiselect-trigger::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-secondary);
  margin-left: 8px;
  display: inline-block;
  transition: transform 0.2s ease;
}

.custom-multiselect-container.open,
.custom-multiselect-container.active {
  z-index: 1000;
}

.custom-multiselect-container.open .custom-multiselect-trigger::after,
.custom-multiselect-container.active .custom-multiselect-trigger::after {
  transform: rotate(180deg);
}

.custom-multiselect-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 1050;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
  padding: 0.4rem;
}

.custom-multiselect-container.open .custom-multiselect-options,
.custom-multiselect-container.active .custom-multiselect-options {
  display: block;
}

.custom-multiselect-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-secondary);
}

.custom-multiselect-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.custom-multiselect-option input {
  cursor: pointer;
  width: auto;
}

.custom-multiselect-container.disabled .custom-multiselect-trigger {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.1);
}

/* Filter Field Header with Label & Regex Search Button */
.filter-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  width: 100%;
}

.filter-field-header label {
  margin-bottom: 0 !important;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-regex-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  line-height: 1;
  position: relative;
}

.filter-regex-btn svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.filter-regex-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-primary);
  border-color: var(--border-color);
}

.filter-regex-btn.active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.filter-regex-btn.has-value::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
}

/* Collapsible Regex Search Panel */
.filter-regex-panel {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-top: 0.4rem;
  animation: filterFadeInDown 0.2s ease-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-regex-panel.open {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-regex-input {
  width: 100% !important;
  font-size: 0.8rem !important;
  font-family: 'Consolas', 'Courier New', monospace;
  padding: 0.4rem 0.6rem !important;
  background: var(--bg-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  transition: var(--transition-smooth);
}

.filter-regex-input:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) !important;
}

.filter-regex-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-regex-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
  flex: 1;
}

.btn-match-case {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition-smooth);
  user-select: none;
  margin-left: auto;
}

.btn-match-case:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-match-case.active {
  background: var(--accent-primary);
  color: var(--bg-main);
  border-color: var(--accent-primary);
  font-weight: 600;
}

.btn-match-case .case-badge {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.75rem;
  background: rgba(128, 128, 128, 0.2);
  padding: 0 4px;
  border-radius: 3px;
}

/* Enhanced Dropdown Search & Options Header */
.filter-options-header {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.25rem 0.25rem 0.45rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.35rem;
}

.filter-options-search {
  flex: 1;
  font-size: 0.75rem !important;
  padding: 0.25rem 0.45rem !important;
  background: var(--bg-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
}

.filter-options-actions {
  display: flex;
  gap: 0.25rem;
}

.filter-options-actions button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-options-actions button:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
}

.filter-options-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

@keyframes filterFadeInDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bf-calendar-day {
  transition: var(--transition-smooth);
}

.bf-calendar-day:hover {
  border-color: var(--border-color-focus) !important;
  transform: translateY(-1px);
}

.dashboard-grid-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1100px) {
  .dashboard-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Registration Vetting & Builder Styles */
.nav-badge {
  background: var(--accent-primary);
  color: var(--bg-main);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  margin-left: auto;
}

.mapping-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.mapping-tag.system {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--accent-primary);
}

.mapping-tag.custom {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.split-vetting-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .split-vetting-grid {
    grid-template-columns: 1fr;
  }
}

.question-answer-item {
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
}

/* ==========================================================================
   CUSTOMIZABLE DASHBOARD GRID & EDIT MODE STYLES
   ========================================================================== */
.dashboard-custom-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  width: 100%;
  align-items: start;
  margin-bottom: 2rem;
}

.widget-span-12 { grid-column: span 12; }
.widget-span-11 { grid-column: span 11; }
.widget-span-10 { grid-column: span 10; }
.widget-span-9 { grid-column: span 9; }
.widget-span-8 { grid-column: span 8; }
.widget-span-7 { grid-column: span 7; }
.widget-span-6 { grid-column: span 6; }
.widget-span-5 { grid-column: span 5; }
.widget-span-4 { grid-column: span 4; }
.widget-span-3 { grid-column: span 3; }

@media (max-width: 1100px) {
  .widget-span-8,
  .widget-span-7,
  .widget-span-5 {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .dashboard-custom-grid > * {
    grid-column: span 12 !important;
  }
}

/* Dashboard Edit Banner */
.dashboard-edit-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  animation: fadeIn 0.15s ease-out;
}

.dashboard-edit-banner .edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
}

.dashboard-edit-banner .edit-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  color: var(--text-secondary);
}

.dashboard-edit-banner .edit-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Dashboard Widget Container in Edit Mode */
.dashboard-widget-container {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.dashboard-widget-container.is-editing {
  border: 1px dashed var(--border-color-hover);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  background: var(--accent-bg);
}

.dashboard-widget-container.is-editing .glass-card {
  margin-bottom: 0;
}

.dashboard-widget-container.dragging {
  opacity: 0.4;
  transform: scale(0.99);
}

.dashboard-widget-container.drag-over {
  outline: 2px dashed var(--accent-secondary);
  outline-offset: 3px;
  background: var(--accent-bg-hover);
}

/* Widget Edit Controls Header */
.widget-edit-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  gap: 0.5rem;
}

.widget-drag-handle {
  cursor: grab;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  user-select: none;
  color: var(--text-secondary);
}

.widget-drag-handle svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.widget-drag-handle:active {
  cursor: grabbing;
}

.widget-edit-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.widget-edit-btn-group button,
.widget-edit-btn-group select {
  font-size: 0.72rem;
  padding: 0.22rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition-smooth);
}

.widget-edit-btn-group button svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.widget-edit-btn-group button:hover {
  background: var(--accent-bg-hover);
  border-color: var(--border-color-focus);
}

.widget-delete-btn:hover {
  background: var(--error-bg) !important;
  border-color: var(--error) !important;
  color: var(--error) !important;
}

/* Component Catalog Modal Styling */
.catalog-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  gap: 0.5rem;
}

.catalog-tab-btn {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.catalog-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.preset-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.preset-widget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  transition: var(--transition-smooth);
}

.preset-widget-card:hover {
  border-color: var(--border-color-focus);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.preset-widget-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preset-widget-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preset-widget-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Custom Component Creator Form */
.custom-creator-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.column-selector-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.column-pill-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.column-pill-checkbox:has(input:checked) {
  background: var(--accent-bg);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.creator-preview-box {
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 260px;
  overflow: auto;
  margin-top: 0.5rem;
}

/* Accessibility Focus Rings */
:focus-visible {
  outline: 2px solid var(--accent-color, #3b82f6) !important;
  outline-offset: 2px !important;
}

