/* ==========================================================================
   CSS Design System: SSO & WCF Follow-up Tracking System
   Style: Modern Glassmorphism & Enterprise Dashboard (Dark / Light)
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --brand-primary: #0284c7;
  --brand-primary-hover: #0369a1;
  --brand-light: #e0f2fe;
  --brand-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  /* Status Badges */
  --status-active-bg: #dcfce7;
  --status-active-text: #15803d;
  --status-warning-bg: #fef3c7;
  --status-warning-text: #b45309;
  --status-danger-bg: #fee2e2;
  --status-danger-text: #b91c1c;
  --status-info-bg: #e0e7ff;
  --status-info-text: #4338ca;
  --status-purple-bg: #f3e8ff;
  --status-purple-text: #7e22ce;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-main: 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0b1120;
  --bg-secondary: #111c34;
  --bg-card: rgba(17, 28, 52, 0.85);
  --bg-card-hover: #172544;
  --bg-input: #1a2948;
  --border-color: #1e293b;
  --border-hover: #334155;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;

  --brand-primary: #38bdf8;
  --brand-primary-hover: #0ea5e9;
  --brand-light: rgba(56, 189, 248, 0.15);
  --brand-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);

  --status-active-bg: rgba(34, 197, 94, 0.2);
  --status-active-text: #4ade80;
  --status-warning-bg: rgba(245, 158, 11, 0.2);
  --status-warning-text: #fbbf24;
  --status-danger-bg: rgba(239, 68, 68, 0.2);
  --status-danger-text: #f87171;
  --status-info-bg: rgba(99, 102, 241, 0.2);
  --status-info-text: #a5b4fc;
  --status-purple-bg: rgba(168, 85, 247, 0.2);
  --status-purple-text: #d8b4fe;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.2);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  transition: var(--transition);
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.35rem;
  box-shadow: var(--shadow-md);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-counter {
  background: var(--brand-light);
  color: var(--brand-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

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

/* Navigation Tabs Bar */
.nav-tabs-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  padding: 0.85rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--brand-primary);
  background: var(--brand-light);
}

.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.tab-count {
  background: var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.tab-btn.active .tab-count {
  background: var(--brand-primary);
  color: #ffffff;
}

/* Main Content Area */
.app-main {
  flex: 1;
  padding: 1.5rem 2rem 3rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.view-section.active {
  display: block;
}

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

/* Card & Containers */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

/* Dashboard KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-primary);
}

.kpi-card.kpi-danger::before { background: #ef4444; }
.kpi-card.kpi-warning::before { background: #f59e0b; }
.kpi-card.kpi-success::before { background: #10b981; }
.kpi-card.kpi-purple::before { background: #8b5cf6; }

.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.kpi-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: var(--brand-light);
  color: var(--brand-primary);
}

.kpi-danger .kpi-icon-box { background: var(--status-danger-bg); color: var(--status-danger-text); }
.kpi-warning .kpi-icon-box { background: var(--status-warning-bg); color: var(--status-warning-text); }
.kpi-success .kpi-icon-box { background: var(--status-active-bg); color: var(--status-active-text); }
.kpi-purple .kpi-icon-box { background: var(--status-purple-bg); color: var(--status-purple-text); }

/* Dashboard Grid 2 Col */
.dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

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

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 420px;
}

.search-input-wrap svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.65rem 0.85rem 0.65rem 2.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-light);
  background: var(--bg-secondary);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.select-ctrl {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.select-ctrl:focus {
  border-color: var(--brand-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

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

.btn-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

.btn-success {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}

.btn-success:hover {
  background: #10b981;
  color: #ffffff;
}

/* Modern Data Table */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

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

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

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

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
}
.badge-active .badge-dot { background: #22c55e; }

.badge-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}
.badge-warning .badge-dot { background: #f59e0b; }

.badge-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}
.badge-danger .badge-dot { background: #ef4444; }

.badge-info {
  background: var(--status-info-bg);
  color: var(--status-info-text);
}
.badge-info .badge-dot { background: #6366f1; }

.badge-purple {
  background: var(--status-purple-bg);
  color: var(--status-purple-text);
}
.badge-purple .badge-dot { background: #a855f7; }

.badge-debt {
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.2rem;
}

.badge-debt-kor { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-debt-khor { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-debt-prakan { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }

/* Pagination */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.pagination-pages {
  display: flex;
  gap: 0.35rem;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.page-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

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

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-secondary);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label .required {
  color: #ef4444;
}

.form-control {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--brand-primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.form-control[readonly] {
  background: var(--bg-primary);
  cursor: default;
  opacity: 0.85;
}

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

.checkbox-group {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.5rem 0;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--brand-primary);
  width: 16px;
  height: 16px;
}

/* T1 Field Inspection Cards */
.t1-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.t1-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  transition: var(--transition);
}

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

.t1-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.t1-acc {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.t1-company {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.2rem;
}

.t1-address-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.t1-address-box .district-tag {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
}

.t1-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* 360 Employer Dossier */
.employer-profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.profile-header-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.profile-meta-item {
  display: flex;
  flex-direction: column;
}

.profile-meta-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.profile-meta-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.2rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin-top: 1.25rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -2rem;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 3px solid var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

/* District Drill-down */
.district-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.district-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.district-tile:hover, .district-tile.active {
  border-color: var(--brand-primary);
  background: var(--brand-light);
  transform: translateY(-2px);
}

.district-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.district-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin-top: 0.25rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--brand-primary);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left-color: #10b981; }
.toast-danger { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }

/* Autocomplete & Employer Lookup */
.input-with-autocomplete {
  position: relative;
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1100;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  max-height: 290px;
  overflow-y: auto;
  margin-top: 5px;
}

.suggestion-item {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(2, 132, 199, 0.08);
}

[data-theme="dark"] .suggestion-item:hover,
[data-theme="dark"] .suggestion-item.active {
  background: rgba(2, 132, 199, 0.18);
}

.branch-picker-box {
  background: rgba(2, 132, 199, 0.04);
  border: 1px solid rgba(2, 132, 199, 0.3) !important;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem !important;
  margin-top: 0.25rem;
  animation: fadeIn 0.25s ease-out;
}

[data-theme="dark"] .branch-picker-box {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.4) !important;
}

.lookup-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.lookup-badge.badge-success {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.lookup-badge.badge-warning {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

[data-theme="dark"] .lookup-badge.badge-success {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

[data-theme="dark"] .lookup-badge.badge-warning {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}

.input-highlight-pulse {
  animation: inputHighlight 1.2s ease-out;
}

@keyframes inputHighlight {
  0% {
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.45);
    border-color: var(--brand-primary);
  }
  100% {
    box-shadow: none;
    border-color: var(--border-color);
  }
}

/* Master Data Upload Dropzone & Modal Styles */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: var(--bg-input);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand-primary);
  background: rgba(37, 99, 235, 0.05);
  transform: scale(1.01);
}

.dropzone-icon {
  font-size: 2.75rem;
  line-height: 1;
}

.dropzone-text {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.file-details-card {
  margin-top: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  animation: fadeIn 0.2s ease;
}

.file-info-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-icon {
  font-size: 1.5rem;
}

.file-meta {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.file-size {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.upload-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
