/* styles.css - ระบบสารสนเทศทำเนียบบุคลากรและกรอบอัตรากำลัง อบจ.ตราด */
:root {
  --primary: #1e3a8a;          /* Tailwind blue-900 */
  --primary-dark: #0f172a;     /* slate-900 / blue-950 */
  --primary-navy: #172554;     /* blue-950 */
  --primary-indigo: #312e81;   /* indigo-900 */
  --primary-light: #2563eb;    /* blue-600 */
  --gold: #d97706;             /* amber-600 */
  --gold-light: #fef3c7;       /* amber-100 */
  --gold-dark: #b45309;        /* amber-700 */
  --accent-gold: #fbbf24;      /* amber-400 */
  --bg-main: #f8fafc;          /* slate-50 */
  --bg-card: #ffffff;
  --text-main: #0f172a;        /* slate-900 */
  --text-muted: #64748b;       /* slate-500 */
  --border-color: #e2e8f0;     /* slate-200 */
  --success: #10b981;          /* emerald-500 */
  --warning: #f59e0b;          /* amber-500 */
  --danger: #ef4444;           /* rose-500 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px 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);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 16px;
  font-family: 'Sarabun', 'Prompt', sans-serif;
  min-height: 100vh;
}

h1, h2, h3, h4, .brand-title, .card-title, .stats-title {
  font-family: 'Prompt', 'Sarabun', sans-serif;
}

/* Header */
.app-header {
  background: linear-gradient(110deg, #0f172a 0%, #1e3a8a 45%, #172554 100%);
  color: #ffffff;
  padding: 12px 20px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.45);
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  gap: 15px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px;
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.brand-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.badge-org {
  background: rgba(251, 191, 36, 0.2);
  color: #fde047;
  border: 1px solid rgba(251, 191, 36, 0.45);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.badge-sub {
  color: #bfdbfe;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-live {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

.brand-title {
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.brand-subtitle {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.btn-primary {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #172554 0%, #1d4ed8 100%);
  box-shadow: 0 4px 8px rgba(30, 58, 138, 0.35);
}

.btn-secondary {
  background-color: #64748b;
  color: #ffffff;
}
.btn-secondary:hover {
  background-color: #475569;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #ffffff;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(4px);
}
.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fde047;
  color: #fde047;
}

.btn-outline-secondary {
  background: transparent;
  color: #475569;
  border-color: #cbd5e1;
}

.btn-outline-danger {
  background: transparent;
  color: #f87171;
  border-color: #f87171;
}

/* Containers */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px;
}

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

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(226, 232, 240, 0.85);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}

/* Public Stats */
.public-stats-section {
  margin-bottom: 18px;
}

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

.stats-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
}

.badge-total {
  background-color: var(--gold-light);
  color: var(--gold-dark);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #fde68a;
  font-size: 0.95rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.stat-item-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
  cursor: pointer;
  transition: all 0.18s ease;
}

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

.stat-item-card.active-cat {
  background: #eff6ff;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.stat-item-card.cat-kru { border-left-color: #8b5cf6; }
.stat-item-card.cat-emp { border-left-color: #0d9488; }
.stat-item-card.cat-empkru { border-left-color: #ea580c; }

.stat-item-title {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.stat-item-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
}

/* Search Box */
.search-filter-section {
  margin-bottom: 24px;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 44px 14px 44px;
  font-size: 1.15rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s;
  background-color: #ffffff;
}

.search-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

.btn-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-col {
  flex: 1;
  min-width: 220px;
}

.filter-col label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.filter-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: #ffffff;
  outline: none;
}

.search-status-bar {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Staff Cards Grid */
.staff-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.staff-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-holder-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.25;
}

.badge-pos-no {
  font-size: 0.8rem;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  font-family: monospace;
}

.card-title-line {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
}

.badge-level {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #e0f2fe;
  color: #0369a1;
  font-weight: 500;
  margin-left: 6px;
}

.card-aff-line {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-extra-badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 4px;
  background-color: #fef08a;
  color: #854d0e;
  font-weight: 600;
}

.card-quick-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.quick-chip {
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

.chip-tenure {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.chip-retire {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.chip-contract {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.mobile-expand-hint {
  display: none;
  font-size: 0.76rem;
  color: var(--primary-light);
  margin-left: auto;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.card-details-box {
  background: #f8fafc;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid #f1f5f9;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.detail-value {
  font-weight: 600;
  color: #1e293b;
}

/* Badges */
.badge-cat {
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.cat-gov { background: #dbeafe; color: #1e40af; }
.cat-gov-kru { background: #ede9fe; color: #6d28d9; }
.cat-emp { background: #ccfbf1; color: #0f766e; }
.cat-emp-kru { background: #ffedd5; color: #c2410c; }

.badge-ctr-ok { background: #dcfce7; color: #15803d; }
.badge-ctr-warn { background: #fef9c3; color: #a16207; }
.badge-ctr-crit { background: #fee2e2; color: #b91c1c; }
.badge-ctr-exp { background: #991b1b; color: #ffffff; }

/* Admin View */
.admin-tabs-nav {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
  overflow-x: auto;
}

.admin-tab-btn {
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
}

.admin-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.admin-tab-content {
  display: none;
}

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

/* KPI Row */
.kpi-cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.kpi-val {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 4px;
}

.kpi-lbl {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Budget Calc */
.budget-calc-box {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius);
}

.budget-input-group {
  flex: 1;
  min-width: 280px;
}

.budget-result-group {
  flex: 1;
  min-width: 280px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.table-styled {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table-styled th {
  background-color: #f1f5f9;
  color: #334155;
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
}

.table-styled td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.table-styled tr:hover {
  background-color: #f8fafc;
}

/* Admin Table Toolbar */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-search {
  flex: 1;
  min-width: 240px;
}

.toolbar-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

/* Table Inline Edit */
.table-container {
  overflow-x: auto;
  max-height: 680px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #ffffff;
}

.table-inline-edit {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table-inline-edit th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 600;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border-color);
  text-align: left;
  z-index: 10;
  white-space: nowrap;
}

.table-inline-edit td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table-inline-edit tr.row-vacant {
  background-color: #fef2f2;
}

.table-inline-edit tr:hover {
  background-color: #f8fafc;
}

.table-inline-edit tr.row-vacant:hover {
  background-color: #fee2e2;
}

/* Cell Input */
.cell-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 0.85rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  outline: none;
  transition: all 0.2s;
}

.cell-input:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.cell-input:focus {
  border-color: var(--primary-light);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.2);
}

.cell-saved {
  animation: flashGreen 1.2s ease-out;
}

@keyframes flashGreen {
  0% { background-color: #86efac; }
  100% { background-color: transparent; }
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-card.modal-lg {
  max-width: 760px;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

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

/* Form controls */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  outline: none;
  background-color: #ffffff;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

.code-box {
  font-family: monospace;
  font-size: 0.85rem;
  white-space: pre;
}

/* Utilities */
.d-none { display: none !important; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: #0284c7; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }


/* ==========================================================================
   PHASE 2: macOS Magnification Dock & Native Anchored Micro-Tooltip Styles
   ========================================================================== */

body {
  padding-bottom: 92px;
}

/* 1. Native Anchored Micro-Tooltip (Never follows cursor, never blocks line of sight) */
.floating-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 5px 10px;
  box-shadow: 0 6px 16px -3px rgba(15, 23, 42, 0.32);
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
  line-height: 1.3;
  color: #f8fafc;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
  transition: opacity 0.14s ease, transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-tooltip.place-below {
  transform: translateY(-4px) scale(0.97);
}

.floating-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tooltip-title {
  color: #fde047;
  font-weight: 600;
}

.tooltip-sep {
  color: rgba(255, 255, 255, 0.35);
  margin: 0 6px;
}

.tooltip-desc {
  color: #e2e8f0;
  font-weight: 400;
}

/* 2. Authentic macOS Magnification Dock */
.macos-dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 58px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 7px 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dock-item {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #e2e8f0;
  position: relative;
  flex-shrink: 0;
  transition: width 0.09s ease-out, height 0.09s ease-out, transform 0.09s ease-out, background 0.15s, color 0.15s, border-color 0.15s;
}

.dock-item:hover {
  background: rgba(37, 99, 235, 0.38);
  border-color: rgba(147, 197, 253, 0.5);
  color: #ffffff;
}

.dock-item.active {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.85), rgba(37, 99, 235, 0.75));
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde047;
}

.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: -5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fde047;
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48%;
  height: 48%;
  pointer-events: none;
}

.dock-icon svg {
  width: 100%;
  height: 100%;
}

/* Native macOS floating pill label above dock icon */
.dock-pill {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.dock-item:hover .dock-pill {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.dock-separator {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 3px;
  align-self: center;
}

/* 3. Action Buttons with Crisp SVG Line Icons */
.btn-action-group {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-action:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
}

.btn-action svg {
  width: 14px;
  height: 14px;
}

.btn-action-primary {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.btn-action-primary:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.btn-action-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}
.btn-action-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-action-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}
.btn-action-warning:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

/* 4. Salary Adjustment Tab Styles */
.salary-control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.salary-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

.table-salary-input {
  width: 100%;
  padding: 3px 6px;
  font-size: 0.84rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
  background: #ffffff;
}

.table-salary-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.15);
}

/* ==========================================================================
   Mobile-First Responsive Layout (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Header */
  .app-header {
    padding: 8px 12px;
  }
  .header-container {
    gap: 8px;
  }
  .brand-group {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  .brand-logo-img {
    width: 38px !important;
    height: 38px !important;
    flex-shrink: 0;
  }
  .brand-title {
    font-size: 0.92rem;
    line-height: 1.2;
  }
  .brand-subtitle {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions .btn {
    padding: 6px 10px;
    font-size: 0.78rem;
    min-height: 34px;
    white-space: nowrap;
    border-radius: 8px;
  }

  /* 2. Container & 2x2 Category Grid */
  .container,
  .container-fluid {
    padding: 12px 10px;
  }
  .stats-header {
    margin-bottom: 8px;
  }
  .stats-title {
    font-size: 0.88rem;
  }
  .badge-total {
    font-size: 0.8rem;
    padding: 2px 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-item-card {
    padding: 8px 10px;
  }
  .stat-item-title {
    font-size: 0.8rem;
  }
  .stat-item-num {
    font-size: 1.1rem;
  }

  /* 3. Sticky Compact Search & Filter Bar */
  .search-filter-section {
    position: sticky;
    top: 54px;
    z-index: 85;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  }
  .search-box-wrapper {
    margin-bottom: 8px;
  }
  .search-input {
    padding: 9px 36px 9px 36px;
    font-size: 16px;
    border-radius: 8px;
  }
  .search-icon {
    left: 10px;
    font-size: 16px;
  }
  .filters-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .filter-col {
    min-width: 0;
  }
  .filter-col label {
    font-size: 0.74rem;
    margin-bottom: 2px;
  }
  .filter-select {
    padding: 6px 8px;
    font-size: 0.82rem;
    border-radius: 8px;
  }
  .search-status-bar {
    margin-top: 6px;
    font-size: 0.8rem;
  }

  /* 4. Mobile Staff Cards (Single-Column, Zero Overflow, Tap-to-Expand Details) */
  .staff-cards-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .staff-card {
    padding: 13px 14px;
    gap: 7px;
    cursor: pointer;
  }
  .card-holder-name {
    font-size: 1.06rem;
  }
  .card-title-line {
    font-size: 0.9rem;
  }
  .card-aff-line {
    flex-wrap: wrap;
    font-size: 0.82rem;
    gap: 6px;
  }
  .mobile-expand-hint {
    display: inline-block;
  }
  .card-details-box {
    display: none;
    padding: 9px 10px;
    font-size: 0.82rem;
  }
  .staff-card.is-expanded .card-details-box {
    display: flex;
  }
  .staff-card.is-expanded .mobile-expand-hint {
    transform: rotate(180deg);
  }
  .detail-row {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* 5. Mobile Bottom Dock & Admin Responsive Adjustments */
  .floating-tooltip {
    display: none !important;
  }
  .macos-dock {
    bottom: 8px;
    max-width: calc(100vw - 16px);
    overflow-x: auto;
    height: 52px;
    padding: 5px 10px;
    gap: 6px;
    border-radius: 16px;
    justify-content: flex-start;
  }
  .dock-item {
    width: 40px !important;
    height: 40px !important;
    transform: none !important;
  }
  .dock-pill {
    display: none !important;
  }
  .kpi-cards-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-card {
    padding: 10px;
  }
  .kpi-val {
    font-size: 1.4rem;
  }
  .kpi-lbl {
    font-size: 0.78rem;
  }
  .modal-card {
    padding: 16px;
    width: 95%;
    max-height: 92vh;
  }
}
