/* ============================================================
   ตชด — ระบบข้อมูลทวีคูณ
   Border Patrol Police • Design System v5.0
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800;900&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  /* Green palette */
  --green-950: #060f09;
  --green-900: #0b2218;
  --green-800: #113320;
  --green-700: #17472c;
  --green-600: #1f5e39;
  --green-500: #277648;
  --green-400: #3d9662;
  --green-100: #dff0e7;
  --green-50:  #f0f8f3;

  /* Gold palette */
  --gold-700: #8c6218;
  --gold-600: #aa7a20;
  --gold-500: #c8963c;
  --gold-400: #ddb058;
  --gold-300: #f0cf84;
  --gold-100: #faf3df;

  /* Blue palette */
  --blue-800: #18318a;
  --blue-700: #1f3faa;
  --blue-600: #2850c8;
  --blue-500: #3461e0;
  --blue-400: #5e80ea;
  --blue-100: #e5ecff;

  /* Red palette */
  --red-700:  #7d1818;
  --red-500:  #a82828;
  --red-400:  #c43e3e;
  --red-100:  #fdecec;

  /* Neutral */
  --gray-900: #101814;
  --gray-800: #1c2820;
  --gray-700: #2d3d35;
  --gray-600: #46584e;
  --gray-500: #637568;
  --gray-400: #8da098;
  --gray-300: #bacbc2;
  --gray-200: #d4e0da;
  --gray-100: #e8f0ec;
  --gray-50:  #f4f8f5;
  --white:    #ffffff;

  /* Semantic aliases */
  --primary:        var(--green-700);
  --primary-dark:   var(--green-900);
  --primary-light:  var(--green-500);
  --primary-rgb:    23, 71, 44;
  --accent:         var(--gold-500);
  --gold:           var(--gold-500);
  --cta:            var(--blue-500);
  --cta-dark:       var(--blue-700);
  --danger:         var(--red-500);
  --emerald:        var(--green-500);

  /* Glass surfaces */
  --glass-strong:  rgba(255,255,255,0.84);
  --glass-mid:     rgba(255,255,255,0.68);
  --glass-low:     rgba(255,255,255,0.46);
  --glass-border:  rgba(255,255,255,0.76);
  --glass-inset:   inset 0 1px 0 rgba(255,255,255,0.92);

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(8,24,16,0.06);
  --shadow-sm:  0 2px 8px rgba(8,24,16,0.08);
  --shadow-md:  0 8px 24px rgba(8,24,16,0.10);
  --shadow-lg:  0 16px 40px rgba(8,24,16,0.13);
  --shadow-xl:  0 28px 64px rgba(8,24,16,0.17);
  --shadow-2xl: 0 48px 96px rgba(6,18,12,0.24);

  /* Sidebar */
  --sidebar-bg:           #0d2f20;
  --sidebar-text:         rgba(255,255,255,0.65);
  --sidebar-text-active:  #ffffff;
  --sidebar-border:       rgba(255,255,255,0.08);
  --sidebar-shadow:       16px 0 48px rgba(6,18,12,0.24);
  --sidebar-width:        280px;

  /* Radius */
  --r-xs:  6px;
  --r-sm:  10px;
  --r-md:  16px;
  --r-lg:  22px;
  --r-xl:  28px;

  /* Transition */
  --ease:       cubic-bezier(0.2, 0, 0, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --ease-out:   cubic-bezier(0, 0, 0.2, 1);
  --t-fast: 120ms;
  --t-base: 220ms;
  --t-slow: 380ms;

  /* Font */
  --font: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Legacy compatibility */
  --slate-900: var(--gray-900);
  --slate-800: var(--gray-800);
  --slate-700: var(--gray-700);
  --slate-600: var(--gray-600);
  --slate-500: var(--gray-500);
  --slate-400: var(--gray-400);
  --slate-300: var(--gray-300);
  --slate-200: var(--gray-200);
  --slate-100: var(--gray-100);
  --slate-50:  var(--gray-50);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --radius-xl: var(--r-xl);
  --transition-fast: var(--t-fast) var(--ease);
  --transition-base: var(--t-base) var(--ease);
  --transition-slow: var(--t-slow) var(--ease);
  --rose: var(--red-500);
  --rose-rgb: 168, 40, 40;
  --accent-rgb: 200, 150, 60;
  --accent-glow: rgba(200,150,60,0.18);
  --accent-light: var(--gold-400);
  --navy: #1e2f50;
  --cream: #f7f4ea;
  --brand-blue: var(--blue-500);
  --brand-green: var(--green-800);
  --brand-green-2: var(--green-600);
  --brand-gold: var(--gold-500);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  color: var(--gray-700);
  min-height: 100vh;
  line-height: 1.65;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(200,150,60,0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 100%, rgba(23,71,44,0.10) 0%, transparent 45%),
    linear-gradient(165deg, #f4f8f5 0%, #edf4ef 45%, #f6f3e9 100%);
  background-attachment: fixed;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }
select { appearance: none; -webkit-appearance: none; }

/* ===== UTILITIES ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.required { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-in {
  animation: fadeInUp 0.45s var(--ease) both;
}
.animate-in:nth-child(1) { animation-delay: 0.04s; }
.animate-in:nth-child(2) { animation-delay: 0.08s; }
.animate-in:nth-child(3) { animation-delay: 0.12s; }
.animate-in:nth-child(4) { animation-delay: 0.16s; }
.animate-in:nth-child(5) { animation-delay: 0.20s; }
.animate-in:nth-child(6) { animation-delay: 0.24s; }

/* ===== GLASS CARD MIXIN (applied via class) ===== */
.glass {
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), var(--glass-inset);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  min-height: 42px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: all var(--t-base) var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn .icon { font-size: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: var(--white);
  box-shadow: 0 4px 16px rgba(52,97,224,0.30);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(52,97,224,0.40);
}
.btn-primary:active { transform: translateY(0); }

.btn-success {
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  color: var(--white);
  box-shadow: 0 4px 16px rgba(39,118,72,0.28);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(39,118,72,0.38); }

.btn-danger {
  background: linear-gradient(135deg, var(--red-400), var(--red-700));
  color: var(--white);
  box-shadow: 0 4px 16px rgba(168,40,40,0.28);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(168,40,40,0.38); }

.btn-ghost {
  background: rgba(255,255,255,0.72);
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.9);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

.btn-link {
  color: var(--blue-500);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 0;
  background: none;
  border: none;
}
.btn-link:hover { color: var(--blue-700); text-decoration: underline; }

.btn-sm { padding: 7px 14px; min-height: 34px; font-size: 13px; }
.btn-lg { padding: 14px 32px; min-height: 52px; font-size: 16px; border-radius: var(--r-md); }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
}

.import-btn { position: relative; }
.import-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== LAYOUT ===== */
#appPage {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% 8%, rgba(200,150,60,0.16) 0%, transparent 40%),
    linear-gradient(175deg, #143626 0%, #0b2218 60%, #061510 100%);
  border-right: 1px solid rgba(255,255,255,0.07);
  box-shadow: var(--sidebar-shadow);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* Sidebar Brand */
.sidebar-brand {
  padding: 26px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 14px;
}
.sidebar-logo {
  width: 52px;
  height: 52px;
  background: var(--white);
  color: var(--green-800);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
  letter-spacing: -0.5px;
}
.sidebar-logo::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  border: 1.5px solid rgba(200,150,60,0.55);
  pointer-events: none;
}
.sidebar-brand-text h2 {
  font-size: 15px;
  color: var(--white);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0;
}
.sidebar-brand-text small {
  font-size: 12px;
  color: rgba(255,255,255,0.52);
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

/* Sidebar Nav */
.sidebar-nav { padding: 20px 12px; flex: 1; }
.sidebar-nav-label {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,0.40);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 14px;
  margin-bottom: 12px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.62);
  border-radius: 16px;
  transition: all var(--t-base) var(--ease);
  white-space: nowrap;
  margin-bottom: 6px;
  position: relative;
  min-height: 52px;
}
.sidebar-nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.10);
}
.sidebar-nav-item.active {
  color: var(--green-900);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 14px 32px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.96);
}
.sidebar-nav-icon {
  width: 26px;
  font-size: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar User */
.sidebar-user {
  margin: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-user-avatar {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-700));
  color: var(--white);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(200,150,60,0.30);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-dept {
  font-size: 12px;
  color: rgba(255,255,255,0.50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.sidebar-logout {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.50);
  font-size: 18px;
  transition: all var(--t-base) var(--ease);
  flex-shrink: 0;
}
.sidebar-logout:hover {
  background: rgba(196,62,62,0.22);
  color: #ff7b7b;
}

/* ===== MAIN CONTENT AREA ===== */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Bar */
.top-bar {
  margin: 18px 24px 0;
  padding: 14px 20px;
  border-radius: 20px;
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.18);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), var(--glass-inset);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 16px;
  z-index: 100;
}
.top-bar-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1;
}
.top-bar-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  white-space: nowrap;
}
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-bar-date {
  font-size: 13px;
  color: var(--gray-400);
  font-weight: 500;
  white-space: nowrap;
}

.mobile-logout-btn {
  display: none;
}

/* Top Nav (pill switcher inside top bar) */
.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.68);
  border-radius: 16px;
  background: rgba(255,255,255,0.36);
}
.top-nav-item {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 12px;
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: all var(--t-base) var(--ease);
}
.top-nav-item:hover {
  color: var(--gray-800);
  background: rgba(255,255,255,0.60);
}
.top-nav-item.active {
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  box-shadow: 0 6px 18px rgba(52,97,224,0.28);
}

/* Main Content Padding */
.main-content {
  padding: 24px;
  padding-bottom: 72px;
  flex: 1;
}

/* ===== WELCOME BANNER ===== */
.welcome-banner {
  background:
    radial-gradient(circle at 10% 20%, rgba(200,150,60,0.55) 0%, transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(255,255,255,0.24) 0%, transparent 28%),
    linear-gradient(135deg, var(--green-800) 0%, var(--green-600) 55%, var(--blue-800) 100%);
  color: var(--white);
  border-radius: var(--r-lg);
  padding: 36px 40px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 56px rgba(8,24,16,0.22);
  border: 1px solid rgba(255,255,255,0.14);
}
.welcome-banner::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-600));
}
.welcome-banner h1 {
  font-size: 34px;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.welcome-banner p {
  opacity: 0.80;
  font-size: 17px;
  max-width: 480px;
  line-height: 1.7;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md), var(--glass-inset);
  transition: all var(--t-base) var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.stat-card-primary::before { background: linear-gradient(180deg, var(--green-500), var(--green-800)); }
.stat-card-blue::before    { background: linear-gradient(180deg, var(--blue-500), var(--blue-800)); }
.stat-card-green::before   { background: linear-gradient(180deg, var(--gold-400), var(--gold-700)); }
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--glass-inset);
}
.stat-icon { font-size: 34px; flex-shrink: 0; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--gray-900); display: block; }
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; }

/* ===== INFO CARD ===== */
.info-card {
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg), var(--glass-inset);
}
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item { display: flex; flex-direction: column; gap: 6px; }
.info-label { font-size: 11px; color: var(--gray-400); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.info-value { font-size: 16px; font-weight: 700; color: var(--gray-900); }

/* ===== SECTION HEADER ===== */
.section-header { margin-top: 28px; margin-bottom: 18px; }
.section-header h2 {
  font-size: 18px;
  color: var(--gray-900);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-header h2::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 20px;
  background: linear-gradient(180deg, var(--gold-400), var(--blue-500));
  border-radius: 4px;
  flex-shrink: 0;
}

/* Admin units header */
.admin-units-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-units-header h2 { margin: 0; }

/* ===== QUICK ACCESS ===== */
.quick-access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.quick-card {
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 24px;
  text-align: left;
  transition: all var(--t-base) var(--ease);
  box-shadow: var(--shadow-md), var(--glass-inset);
  position: relative;
  overflow: hidden;
}
.quick-card::after {
  content: '';
  position: absolute;
  inset: auto 18px 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, var(--green-700), var(--gold-500), var(--blue-600));
  opacity: 0.8;
}
.quick-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glass-inset);
  border-color: rgba(255,255,255,0.9);
}
.quick-icon { font-size: 36px; display: block; margin-bottom: 12px; }
.quick-title { font-size: 15px; font-weight: 800; color: var(--gray-900); }

/* ===== DOC FILTER ===== */
.doc-filter-section {
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md), var(--glass-inset);
}
.doc-filter-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.doc-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}
.doc-filter-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.doc-filter-group select {
  padding: 11px 16px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--gray-200);
  background: rgba(255,255,255,0.72);
  font-size: 14px;
  color: var(--gray-800);
  transition: all var(--t-fast) var(--ease);
  min-height: 46px;
}
.doc-filter-group select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(52,97,224,0.14);
}

/* ===== DOC LIST ===== */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-item {
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all var(--t-base) var(--ease);
  box-shadow: var(--shadow-sm), var(--glass-inset);
}
.doc-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), var(--glass-inset);
  border-color: rgba(52,97,224,0.28);
}
.doc-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.doc-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #3461e0 0%, #1a39a8 100%);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(52,97,224,0.30);
}
.doc-icon svg { width: 26px; height: 26px; }
.doc-name { font-size: 16px; font-weight: 700; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-dept {
  font-size: 12px; font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  margin-top: 4px;
}
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #1a1a1a, #3a3a3a);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  transition: all var(--t-base) var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.doc-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.26);
  background: linear-gradient(135deg, #2d2d2d, #555);
}

/* Doc within regular doc-item (override legacy) */
.doc-item .doc-link {
  background: linear-gradient(135deg, #1a1a1a, #3a3a3a);
  color: #fff;
  border: none;
}
.doc-item .doc-link:hover {
  background: linear-gradient(135deg, #333, #555);
}

/* ===== TABLE ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), var(--glass-inset);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: rgba(17,51,32,0.92);
  color: rgba(255,255,255,0.92);
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.data-table th:first-child { border-radius: var(--r-md) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--r-md) 0 0; }
.data-table td {
  padding: 18px 18px;
  font-size: 18px;
  border-bottom: 1px solid rgba(212,224,218,0.45);
  color: var(--gray-700);
  background: transparent;
}
.data-table tbody tr { transition: background var(--t-fast) var(--ease); }
.data-table tbody tr:hover td { background: rgba(52,97,224,0.04); }
.data-table tbody tr:nth-child(even) td { background: rgba(244,248,246,0.50); }
.data-table tbody tr:hover td { background: rgba(52,97,224,0.06); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Dept badge */
.dept-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  background: var(--green-100);
  color: var(--green-700);
  border: 1px solid rgba(23,71,44,0.18);
}

/* Doc count */
.doc-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: var(--blue-500);
  color: var(--white);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
}

/* Action buttons */
.action-btns { display: flex; gap: 6px; }
.action-btn {
  padding: 8px 18px;
  border-radius: var(--r-xs);
  font-size: 16px;
  font-weight: 700;
  transition: all var(--t-fast) var(--ease);
  min-height: 36px;
}
.action-btn-edit {
  background: var(--blue-100);
  color: var(--blue-600);
}
.action-btn-edit:hover { background: var(--blue-500); color: var(--white); }
.action-btn-del {
  background: var(--red-100);
  color: var(--red-500);
}
.action-btn-del:hover { background: var(--red-500); color: var(--white); }

/* ===== ADMIN SECTION ===== */
.admin-section { margin-bottom: 16px; }

.admin-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
}

.admin-search {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.admin-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
}
.admin-search input {
  width: 100%;
  height: 48px;
  padding: 0 18px 0 46px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--gray-200);
  background: rgba(255,255,255,0.84);
  color: var(--gray-900);
  font-size: 14px;
  box-shadow: var(--shadow-xs);
  transition: all var(--t-base) var(--ease);
}
.admin-search input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(52,97,224,0.12), var(--shadow-sm);
}

.admin-page-size {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-500);
  font-size: 13px;
  white-space: nowrap;
}
.admin-page-size select {
  height: 48px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--gray-200);
  background: rgba(255,255,255,0.84);
  color: var(--gray-900);
  font-weight: 700;
  font-size: 13px;
}

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--glass-mid);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}
.admin-pagination-info { color: var(--gray-500); font-size: 13px; font-weight: 600; }
.admin-pagination-actions, .pagination-pages {
  display: flex; align-items: center; gap: 6px;
}
.pagination-btn, .pagination-page {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--gray-200);
  background: rgba(255,255,255,0.80);
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--t-base) var(--ease);
}
.pagination-btn:hover:not(:disabled), .pagination-page:hover, .pagination-page.active {
  background: var(--blue-500);
  color: var(--white);
  border-color: var(--blue-500);
  box-shadow: 0 4px 12px rgba(52,97,224,0.28);
}
.pagination-btn:disabled { opacity: 0.38; cursor: not-allowed; }
.pagination-ellipsis { color: var(--gray-400); font-weight: 700; padding: 0 2px; }
.table-empty { padding: 28px 16px; text-align: center; color: var(--gray-500); font-weight: 600; }

/* ===== DIVIDER ===== */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 18px;
  font-size: 12px; color: var(--gray-400); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,18,13,0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--t-base) var(--ease);
  padding: 24px;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(32px) saturate(1.3);
  -webkit-backdrop-filter: blur(32px) saturate(1.3);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  transform: scale(0.96) translateY(12px);
  transition: transform var(--t-base) var(--ease);
  border: 1px solid rgba(255,255,255,0.90);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}
.modal-header h2 {
  font-size: 20px;
  color: var(--gray-900);
  font-weight: 800;
}
.modal-close {
  width: 34px; height: 34px;
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--gray-400);
  background: var(--gray-50);
  transition: all var(--t-fast) var(--ease);
}
.modal-close:hover { background: var(--red-100); color: var(--red-500); }
.modal form { padding: 24px 28px 28px; }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

/* Confirm Modal content padding */
#confirmModal p { padding: 16px 28px; color: var(--gray-600); font-size: 15px; line-height: 1.6; }

/* ===== DOC FIELDS (modal) ===== */
.doc-field-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: end;
}
.doc-field-remove {
  width: 40px; height: 40px;
  background: var(--red-100);
  color: var(--red-500);
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--t-fast) var(--ease);
  flex-shrink: 0;
  border: 1px solid #fecaca;
}
.doc-field-remove:hover { background: var(--red-500); color: var(--white); border-color: var(--red-500); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px; right: 28px;
  background: linear-gradient(135deg, var(--green-600), var(--green-800));
  color: var(--white);
  padding: 14px 22px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.38s var(--ease);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: linear-gradient(135deg, var(--red-400), var(--red-700)); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-400);
  font-size: 15px;
  background: var(--glass-mid);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.empty-state .icon { font-size: 52px; margin-bottom: 16px; opacity: 0.40; }
.empty-state h3 { font-size: 18px; color: var(--gray-600); margin-bottom: 8px; font-weight: 700; }
.empty-state p { font-size: 14px; color: var(--gray-400); }

/* ===== PAGE VISIBILITY ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 22px 26px;
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.16);
  -webkit-backdrop-filter: blur(24px) saturate(1.16);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md), var(--glass-inset);
}
.page-header > div { flex: 1; }
.page-header h1 {
  font-size: 26px;
  color: var(--gray-900);
  font-weight: 900;
  letter-spacing: -0.3px;
}
.page-header p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 22% 25%, rgba(200,150,60,0.22) 0%, transparent 36%),
    radial-gradient(circle at 80% 75%, rgba(52,97,224,0.16) 0%, transparent 36%),
    linear-gradient(150deg, var(--green-950) 0%, var(--green-800) 55%, var(--navy) 100%);
}
.login-wrapper::after {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: fadeIn 2s ease;
}

.login-box {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.97);
  padding: 48px 44px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 440px;
  animation: scaleIn 0.55s var(--ease);
  border: 1px solid rgba(255,255,255,0.90);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.logo-circle {
  width: 84px; height: 84px;
  background: var(--white);
  color: var(--green-800);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  margin: 0 auto 20px;
  box-shadow: 0 12px 36px rgba(23,71,44,0.22), inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
  letter-spacing: -0.5px;
}
.logo-circle::before {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 27px;
  border: 2px solid rgba(200,150,60,0.65);
}
.login-box h1 { font-size: 22px; color: var(--gray-900); font-weight: 800; }
.login-subtitle { text-align: center; color: var(--gray-400); font-size: 14px; margin-bottom: 32px; }

.error-msg {
  background: var(--red-100);
  color: #7d1818;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  display: none;
  border: 1px solid #fecaca;
  font-weight: 600;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}
.login-footer p { font-size: 13px; color: var(--gray-400); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-sm);
  font-size: 15px;
  transition: all var(--t-base) var(--ease);
  background: rgba(255,255,255,0.88);
  color: var(--gray-900);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(52,97,224,0.12);
  background: var(--white);
}
.form-group input::placeholder { color: var(--gray-300); }
.form-hint { display: block; margin-top: 5px; color: var(--gray-400); font-size: 12px; }

/* ===== PERSONNEL PROFILE CARD ===== */
.personnel-records { display: grid; gap: 16px; margin-top: 4px; }

.personnel-profile-card {
  border-radius: var(--r-xl);
  overflow: hidden;
  position: relative;
  background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg), var(--glass-inset);
}
.personnel-profile-card::before {
  content: '';
  position: absolute;
  inset: -80px -80px auto auto;
  width: 220px; height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(200,150,60,0.22), transparent 66%);
  pointer-events: none;
}
.personnel-profile-card::after {
  content: '';
  position: absolute;
  inset: auto auto -100px -80px;
  width: 240px; height: 240px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(23,71,44,0.14), transparent 66%);
  pointer-events: none;
}

.profile-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 28px 30px;
  background:
    radial-gradient(circle at 10% 22%, rgba(200,150,60,0.14), transparent 30%),
    linear-gradient(120deg, rgba(255,255,255,0.76), rgba(240,248,244,0.42));
  border-bottom: 1px solid rgba(255,255,255,0.55);
  position: relative; z-index: 1;
}

.profile-mark {
  width: 62px; height: 62px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent),
              linear-gradient(135deg, var(--green-700), var(--green-500));
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.36);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 12px 28px rgba(23,71,44,0.24);
}

.profile-title { color: var(--gray-900); font-size: 30px; font-weight: 900; line-height: 1.2; }
.profile-subtitle { margin-top: 4px; color: var(--gray-500); font-size: 17px; font-weight: 500; }

.personnel-profile-card .info-grid {
  padding: 24px 28px 28px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  position: relative; z-index: 1;
}
.personnel-profile-card .info-item {
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,0.70), rgba(246,250,248,0.36));
  box-shadow: 0 10px 28px rgba(8,24,16,0.06), var(--glass-inset);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
  min-height: 96px;
}
.personnel-profile-card .info-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(8,24,16,0.09), var(--glass-inset);
}
.personnel-profile-card .info-item.full-width { grid-column: 1 / -1; }
.personnel-profile-card .info-label { color: var(--gray-400); font-size: 18px; text-transform: none; letter-spacing: 0; }
.personnel-profile-card .info-value { color: var(--gray-900); font-size: 26px; font-weight: 700; }

/* ===== BUDGET SECTION ===== */
.budget-section {
  position: relative; z-index: 1;
  margin: 0 28px 28px;
  padding: 20px;
  border: 1px solid rgba(52,97,224,0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 10%, rgba(52,97,224,0.11), transparent 30%),
    linear-gradient(145deg, rgba(255,255,255,0.76), rgba(240,246,255,0.44));
  box-shadow: 0 16px 48px rgba(30,64,175,0.08), var(--glass-inset);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.budget-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.budget-section-title { color: var(--gray-900); font-size: 22px; font-weight: 900; }
.budget-section-subtitle { margin-top: 2px; color: var(--gray-500); font-size: 16px; font-weight: 600; }
.budget-count {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--blue-600);
  background: var(--blue-100);
  font-size: 16px;
  font-weight: 900;
}
.budget-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.budget-pill {
  min-height: 120px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,0.80), rgba(255,255,255,0.44));
  box-shadow: 0 10px 28px rgba(30,64,175,0.07), var(--glass-inset);
  transition: transform var(--t-base) var(--ease);
}
.budget-pill:hover { transform: translateY(-2px); }
.budget-year { color: var(--blue-700); font-size: 32px; font-weight: 900; line-height: 1.1; }
.budget-note {
  margin-top: 10px;
  color: var(--blue-700);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.45;
}
.budget-empty { grid-column: 1 / -1; color: var(--gray-500); font-weight: 700; padding: 14px; }

/* ===== UNITS GRID ===== */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.unit-card-wrapper { position: relative; }

.unit-card {
  width: 100%;
  text-align: left;
  padding: 22px;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  /* Glass card style */
  background:
    radial-gradient(circle at 12% 10%, rgba(200,150,60,0.12) 0%, transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,0.78), rgba(245,250,247,0.50));
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), var(--glass-inset);
}
.unit-card:hover {
  transform: translateY(-4px);
  border-color: rgba(52,97,224,0.28);
  box-shadow: var(--shadow-lg), var(--glass-inset);
}

.unit-card .unit-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.unit-card .unit-card-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  color: var(--white);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(52,97,224,0.26);
}
.unit-card .unit-card-name-container { flex: 1; min-width: 0; }
.unit-card .unit-card-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.3;
}
.unit-card .unit-card-address {
  font-size: 17px;
  color: var(--gray-500);
  margin-bottom: 14px;
  line-height: 1.5;
}
.unit-card .unit-card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: var(--gray-400);
  padding-top: 12px;
  border-top: 1px solid rgba(148,163,184,0.18);
}
.unit-card .unit-card-stats span { font-weight: 700; color: var(--blue-500); }

.unit-card-delete {
  position: absolute;
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  background: rgba(255,255,255,0.90);
  border: 1.5px solid rgba(252,200,200,0.80);
  color: var(--red-400);
  opacity: 0;
  transition: all var(--t-fast) var(--ease);
  z-index: 10;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.unit-card-wrapper:hover .unit-card-delete { opacity: 1; }
.unit-card-delete:hover {
  background: var(--red-500);
  color: var(--white);
  border-color: var(--red-500);
  transform: scale(1.08);
}

/* ===== PDF PREVIEW ===== */
.pdf-preview-container {
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--gray-100);
  background: rgba(255,255,255,0.60);
}
.pdf-preview-header h2 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.pdf-iframe { width: 100%; height: 75vh; border: none; background: var(--white); }

/* ===== UPLOAD STATUS ===== */
.upload-status {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--gray-700);
  min-height: 20px;
}

/* ===== BENEFITS ADMIN LIST ===== */
.benefits-admin-list { display: flex; flex-direction: column; gap: 10px; }
.benefit-admin-item {
  background: var(--glass-mid);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--t-base) var(--ease);
  box-shadow: var(--shadow-sm);
}
.benefit-admin-item:hover { box-shadow: var(--shadow-md); }
.benefit-admin-info { display: flex; align-items: center; gap: 12px; }
.benefit-admin-icon { font-size: 24px; }
.benefit-admin-name { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.benefit-admin-desc { font-size: 13px; color: var(--gray-400); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1280px) {
  :root { --sidebar-width: 260px; }
}

@media (max-width: 1024px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .top-bar-main {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .top-nav { width: 100%; overflow-x: auto; }
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 272px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }

  .top-bar { margin: 12px 12px 0; }
  .main-content { padding: 14px 12px 72px; }

  .login-box { padding: 36px 26px; }
  .logo-circle { width: 70px; height: 70px; font-size: 17px; }

  .welcome-banner { padding: 26px 22px; }
  .welcome-banner h1 { font-size: 22px; }

  .stats-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; gap: 12px; }
  .quick-access-grid { grid-template-columns: 1fr; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header h1 { font-size: 22px; }

  .profile-heading { padding: 20px 22px; align-items: flex-start; }
  .profile-title { font-size: 22px; }
  .personnel-profile-card .info-grid { grid-template-columns: 1fr; padding: 18px 20px; }

  .budget-section { margin: 0 16px 20px; }
  .budget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .doc-item { flex-direction: column; align-items: flex-start; }
  .doc-link { width: 100%; justify-content: center; }

  .modal { padding: 0; }
  .modal form { padding: 20px 22px 24px; }
  .modal-header { padding: 20px 22px 0; }

  .mobile-logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid rgba(220,60,60,0.25);
    background: rgba(220,60,60,0.07);
    color: #c0392b;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
  }

  .admin-table-toolbar, .admin-pagination { flex-direction: column; align-items: stretch; }
  .admin-search { min-width: 0; }
  .admin-page-size, .admin-pagination-actions { justify-content: space-between; }
  .pagination-pages { overflow-x: auto; }

  .units-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

@media (max-width: 480px) {
  .login-box { padding: 28px 20px; }
  .welcome-banner { padding: 22px 18px; }
  .welcome-banner h1 { font-size: 20px; }
  .budget-grid { grid-template-columns: 1fr 1fr; }
  .page-header { padding: 16px 18px; }
  .top-bar { margin: 10px 10px 0; padding: 12px 14px; }
}

/* ===== DETAIL FIXES ===== */

/* Modal header — bottom separator */
.modal-header {
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 18px;
  margin-bottom: 0;
}

/* Confirm modal — body text and actions padding */
.modal > p {
  padding: 18px 28px 0;
  color: var(--gray-600);
  font-size: 15px;
  line-height: 1.65;
}
.modal > .modal-actions {
  padding: 0 28px 24px;
  margin-top: 0;
  border-top: none;
}

/* PDF Upload modal — form-like padding */
.modal-lg > .form-group,
.modal-lg > .upload-status {
  margin: 20px 28px 0;
}
.modal-lg > .form-group:last-of-type { margin-bottom: 0; }

/* Unit card name container — flex for future use */
.unit-card-name-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Doc items container */
#documentsList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Table empty row */
.table-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--gray-400);
  font-weight: 600;
  font-size: 14px;
}

/* Section header — flex for admin units header reuse */
.section-header.admin-units-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Welcome banner animation */
.welcome-banner { animation: fadeInUp 0.5s var(--ease) both; }
.personnel-records .info-card { animation: fadeInUp 0.5s var(--ease) 0.08s both; }

/* Smooth page transitions */
.page.active { animation: fadeIn 0.3s var(--ease); }

/* Input focus ring — consistent across login and modals */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--blue-500) !important;
  box-shadow: 0 0 0 4px rgba(52,97,224,0.13) !important;
}

/* Sidebar active item — green text (police brand) */
.sidebar-nav-item.active {
  color: var(--green-900);
}

/* Custom scrollbar for main content */
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 6px; }

/* Doc link within regular doc-item */
.doc-item .doc-link {
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  box-shadow: 0 6px 18px rgba(52,97,224,0.22);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.doc-item .doc-link:hover {
  box-shadow: 0 10px 24px rgba(52,97,224,0.34);
  transform: translateY(-1px);
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
}

/* ===== GLOBAL FONT SIZE INCREASE (v2.0) ===== */
html { font-size: 24px; }

body { font-size: 20px; }

input, select, textarea { font-size: 18px; }

.btn { font-size: 19px; }
.btn-sm { font-size: 17px; }
.btn-lg { font-size: 22px; }

.stat-icon { font-size: 44px; }
.stat-value { font-size: 28px; }
.stat-label { font-size: 18px; }

.info-label { font-size: 15px; }
.info-value { font-size: 22px; }

.quick-icon { font-size: 48px; }

/* Scale up common text sizes */
h1 { font-size: 2.4rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.7rem; }
h4 { font-size: 1.5rem; }

/* Sidebar text */
.sidebar-link { font-size: 19px; }
.sidebar-section-title { font-size: 15px; }

/* Table */
table, th, td { font-size: 17px; }

/* Cards */
.card, .card-body { font-size: 18px; }

/* Modal */
.modal-title { font-size: 26px; }
.modal-body { font-size: 18px; }

/* Form labels */
.form-label, label { font-size: 17px; }

/* Badge */
.badge { font-size: 16px; }

/* Footer */
footer { font-size: 17px; }

/* Landing page */
#loginPage h1 { font-size: 3rem; }
#loginPage h2 { font-size: 2.2rem; }
#loginPage p { font-size: 1.3rem; }
#loginPage .ls-login-label { font-size: 18px; }
#loginPage .ls-field label { font-size: 18px; }
#loginPage .ls-field input { font-size: 20px; }
#loginPage .ls-submit-btn { font-size: 20px; }

/* Responsive */
@media (max-width: 768px) {
  html { font-size: 20px; }
  body { font-size: 18px; }
  input, select, textarea { font-size: 17px; }
}
