/* ═══════════════════════════════════════════════════════════════
   Civilian DBMS  ·  Professional UI  ·  v2.0
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── CSS Design Tokens ───────────────────────────────────────── */
:root {
  /* Brand */
  --primary:          #1d4ed8;
  --primary-hover:    #1e40af;
  --primary-dark:     #1e3a8a;
  --primary-soft:     #eff6ff;
  --primary-border:   #bfdbfe;

  /* Semantic */
  --success:          #059669;
  --success-light:    #ecfdf5;
  --success-border:   #a7f3d0;
  --warning:          #d97706;
  --warning-light:    #fffbeb;
  --warning-border:   #fde68a;
  --danger:           #dc2626;
  --danger-light:     #fef2f2;
  --danger-border:    #fecaca;
  --info:             #0284c7;
  --info-light:       #f0f9ff;
  --info-border:      #bae6fd;

  /* Neutral */
  --bg:               #f1f5f9;
  --bg-subtle:        #f8fafc;
  --card-bg:          #ffffff;
  --border:           #e2e8f0;
  --border-strong:    #cbd5e1;
  --text:             #0f172a;
  --text-secondary:   #334155;
  --text-muted:       #64748b;
  --text-disabled:    #94a3b8;

  /* Nav */
  --nav-bg:           #0f172a;
  --nav-height:       66px;

  /* Shadows */
  --shadow-xs:  0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-sm:  0 1px 3px 0 rgba(0,0,0,.1),  0 1px 2px -1px rgba(0,0,0,.1);
  --shadow:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-md:  0 6px 12px -2px rgba(0,0,0,.1), 0 3px 6px -3px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);

  /* Radii */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease:  cubic-bezier(.4,0,.2,1);
  --speed: 180ms;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; display: block; }

/* ── Typography Scale ────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Uppercase label utility */
.label-upper {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* ── Container ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1340px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ════════════════════════════════════════════════════════════════
   NAVIGATION BAR
   ════════════════════════════════════════════════════════════════ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  height: var(--nav-height);
  border-bottom: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: var(--nav-height);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.nav-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}
.nav-brand:hover .nav-brand-icon { background: var(--primary-hover); }
.nav-brand span { color: #f8fafc; }

/* Nav links */
.nav-links {
  display: flex;
  list-style: none;
  gap: 2px;
  margin: 0 auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--speed) var(--ease);
  white-space: nowrap;
}
.nav-link i { font-size: 0.8rem; }
.nav-link:hover { color: #f1f5f9; background: rgba(255,255,255,.08); }
.nav-link.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 1px 4px rgba(29,78,216,.5);
}

/* User area */
.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.nav-user-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
}
.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  transition: var(--speed);
}

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0;
}
.breadcrumb-bar .container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.bc-sep { color: #cbd5e1; font-size: 0.7rem; }
.bc-current { color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }

/* ── Main Content ────────────────────────────────────────────── */
.main-content { padding: 2rem 0 3.5rem; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--nav-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  color: #475569;
  text-align: center;
  padding: 1.1rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ════════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-subtle);
}
.card-header h2, .card-header h3 {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-header h2 i, .card-header h3 i { color: var(--primary); font-size: 0.85rem; }
.card-body { padding: 1.5rem; }

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--speed) var(--ease);
  overflow: hidden;
  position: relative;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card.blue::before   { background: var(--primary); }
.stat-card.green::before  { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #7c3aed; }
.stat-card.cyan::before   { background: #0891b2; }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-soft);          color: var(--primary); }
.stat-icon.green  { background: var(--success-light);         color: var(--success); }
.stat-icon.orange { background: var(--warning-light);         color: var(--warning); }
.stat-icon.purple { background: #f5f3ff;                      color: #7c3aed; }
.stat-icon.cyan   { background: #ecfeff;                      color: #0891b2; }

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* ── CHART CARDS ─────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.chart-grid.three { grid-template-columns: 2fr 1fr; }

.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}
.chart-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chart-title i { color: var(--primary); font-size: 0.8rem; }
.chart-card canvas { max-height: 280px; }

/* ════════════════════════════════════════════════════════════════
   FORM CARDS
   ════════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.form-card-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 0.9rem 1.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: space-between;
}
.form-card-header i { font-size: 0.85rem; opacity: 0.8; }
.form-card-body { padding: 1.5rem; }

/* ── Form Layout ─────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
.form-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.single { grid-template-columns: 1fr; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.form-group label .req { color: var(--danger); margin-left: 2px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
  font-family: inherit;
  line-height: 1.5;
}
.form-group input::placeholder { color: var(--text-disabled); font-weight: 400; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.form-group input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.form-group .field-error { font-size: 0.75rem; font-weight: 500; color: var(--danger); }
.form-group textarea { resize: vertical; min-height: 90px; }

/* ── Upload Zone ─────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
  background: var(--bg-subtle);
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone input[type="file"] { display: none; }
.upload-zone .upload-icon { font-size: 2rem; color: var(--text-disabled); margin-bottom: 0.5rem; }
.upload-zone p { font-size: 0.825rem; color: var(--text-muted); font-weight: 500; }
.upload-zone .file-name { font-size: 0.78rem; color: var(--primary); font-weight: 600; margin-top: 0.4rem; word-break: break-all; }

/* ── Webcam ───────────────────────────────────────────────────── */
.webcam-container { text-align: center; }
.webcam-video {
  width: 100%;
  max-width: 320px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: #0f172a;
  display: block;
  margin: 0 auto 0.75rem;
}
.webcam-canvas { display: none; }
.webcam-controls { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* ── Info Box ────────────────────────────────────────────────── */
.info-box {
  background: var(--info-light);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.9;
}
.info-box strong { color: var(--primary); font-weight: 700; }

/* ── Form Actions Bar ────────────────────────────────────────── */
.form-actions-bar {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 0 0.25rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 1.25rem;
}

/* ════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.575rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.845rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--speed) var(--ease);
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn i { font-size: 0.85rem; }

.btn-primary   { background: var(--primary);  color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(29,78,216,.3); }

.btn-success   { background: var(--success);  color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(1.08); box-shadow: 0 4px 12px rgba(5,150,105,.3); }

.btn-danger    { background: var(--danger);   color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,.3); }

.btn-warning   { background: var(--warning);  color: #fff; border-color: var(--warning); }
.btn-warning:hover { filter: brightness(1.08); }

.btn-secondary { background: #475569; color: #fff; border-color: #475569; }
.btn-secondary:hover { background: #334155; }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(29,78,216,.25); }

.btn-outline-danger  { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover  { background: var(--danger); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm  { padding: 0.375rem 0.8rem; font-size: 0.78rem; }
.btn-lg  { padding: 0.75rem 1.75rem; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ════════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════════ */
.alert {
  padding: 0.875rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  border-left: 4px solid transparent;
}
.alert-success { background: var(--success-light); color: #065f46;  border-left-color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: #991b1b;  border-left-color: var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400e;  border-left-color: var(--warning); }
.alert-info    { background: var(--info-light);    color: #075985;  border-left-color: var(--info); }

/* ════════════════════════════════════════════════════════════════
   CIVILIAN CARDS
   ════════════════════════════════════════════════════════════════ */
.civilian-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.civilian-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--speed) var(--ease);
}
.civilian-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.cc-top {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.25rem;
  position: relative;
}

.cc-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-soft);
  flex-shrink: 0;
}
.cc-avatar-placeholder {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 3px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--primary);
  flex-shrink: 0;
}

.cc-info { flex: 1; min-width: 0; }
.cc-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.cc-meta { font-size: 0.78rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 0.2rem; }
.cc-meta span { display: flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.cc-meta i { width: 13px; color: var(--primary); font-size: 0.72rem; }

.cc-divider { border: none; border-top: 1px solid var(--border); }

.cc-tags { padding: 0.7rem 1.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cc-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cc-tag i { font-size: 0.65rem; }
.cc-tag.occupation { background: var(--primary-soft);  color: var(--primary); }
.cc-tag.health     { background: var(--success-light); color: var(--success); }
.cc-tag.salary     { background: var(--warning-light); color: var(--warning); }
.cc-tag.area       { background: #f5f3ff;              color: #6d28d9; }

.cc-actions {
  padding: 0.9rem 1.25rem;
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--bg-subtle);
  flex-wrap: wrap;
}

/* H/No badge on cards */
.cc-hno {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-xs);
}

/* ════════════════════════════════════════════════════════════════
   SEARCH BAR
   ════════════════════════════════════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  min-width: 280px;
  max-width: 420px;
  transition: all var(--speed) var(--ease);
  box-shadow: var(--shadow-xs);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.search-bar i { color: var(--text-disabled); font-size: 0.85rem; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-disabled); }

/* ════════════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.625rem;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.page-title i { color: var(--primary); font-size: 1.4rem; }
.page-subtitle { font-size: 0.83rem; color: var(--text-muted); margin-top: 0.3rem; font-weight: 500; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ════════════════════════════════════════════════════════════════
   FULL REPORT
   ════════════════════════════════════════════════════════════════ */
.report-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.report-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
}

.report-photo-wrap { padding: 2rem 1.5rem 1rem; text-align: center; }
.report-photo-container { position: relative; display: inline-block; margin: 0 auto; }
.report-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-soft);
  display: block;
}
.report-photo-placeholder {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 4px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--primary);
}
.report-hno-badge {
  position: absolute;
  bottom: 4px;
  right: -4px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 0.72rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(29,78,216,.4);
}

.report-name { font-size: 1.15rem; font-weight: 800; margin: 0.75rem 0 0.2rem; letter-spacing: -0.02em; }
.report-sub  { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); padding: 0 1rem 1.25rem; }

.report-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.detail-item {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
}
.detail-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.detail-label i { color: var(--primary); font-size: 0.65rem; }
.detail-value { font-size: 0.925rem; font-weight: 700; color: var(--text); }

/* ════════════════════════════════════════════════════════════════
   FAMILY MEMBERS TABLE
   ════════════════════════════════════════════════════════════════ */
.family-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.family-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.7rem 0.85rem;
  text-align: left;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.family-table td { padding: 0.45rem 0.65rem; border: 1px solid var(--border); vertical-align: middle; }
.family-table tbody tr:nth-child(even) { background: var(--bg-subtle); }
.family-table tbody tr:hover { background: var(--primary-soft); }

.family-table td input,
.family-table td select {
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color var(--speed);
}
.family-table td input:focus,
.family-table td select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(29,78,216,.1);
}
.family-table .sr-cell { font-weight: 800; color: var(--text-muted); text-align: center; width: 40px; }

.btn-remove-row {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--speed);
  margin: 0 auto;
}
.btn-remove-row:hover { background: var(--danger); color: #fff; }

.family-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border-top: 1px solid var(--border);
}
.family-empty i { font-size: 1.1rem; opacity: 0.3; }

/* Read-only family table (report) */
.family-table-view { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.family-table-view th {
  background: var(--primary);
  color: rgba(255,255,255,.9);
  padding: 0.65rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--primary-hover);
}
.family-table-view td { padding: 0.65rem 0.9rem; border: 1px solid var(--border); vertical-align: middle; font-weight: 500; }
.family-table-view tbody tr:nth-child(even) { background: var(--bg-subtle); }
.family-table-view tbody tr:hover { background: var(--primary-soft); }
.family-table-view .sr { text-align: center; font-weight: 800; color: var(--text-muted); width: 44px; }
.family-table-view td:first-child + td { font-weight: 700; color: var(--text); }

/* ════════════════════════════════════════════════════════════════
   PHOTO OVERLAY
   ════════════════════════════════════════════════════════════════ */
.photo-overlay-wrap {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 320px;
  width: 100%;
  margin: 0.5rem auto;
}
.webcam-preview-img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 2px solid var(--primary);
}
.photo-hno-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15,23,42,.75);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.06em;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════════
   DOCUMENT TAB SWITCHER
   ════════════════════════════════════════════════════════════════ */
.tab-switcher {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  padding: 3px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--speed);
  font-family: inherit;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-xs); }

/* ════════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2.25rem 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  transform: scale(0.9) translateY(10px);
  transition: transform 0.2s var(--ease);
}
.modal-overlay.open .modal-box { transform: scale(1) translateY(0); }
.modal-icon { font-size: 2.75rem; margin-bottom: 0.875rem; color: var(--danger); }
.modal-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.5rem; }
.modal-text  { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: center; }

/* ════════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 0.75rem);
  right: 1rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  font-size: 0.86rem;
  font-weight: 600;
  animation: slideIn 0.3s var(--ease);
}
.toast.success { background: var(--success); color: #fff; }
.toast.error   { background: var(--danger);  color: #fff; }
.toast.info    { background: var(--info);    color: #fff; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ════════════════════════════════════════════════════════════════
   BADGE
   ════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2em 0.7em;
  font-size: 0.7em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}
.badge-primary { background: var(--primary-soft);  color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* ════════════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state i  { font-size: 3.5rem; margin-bottom: 1rem; opacity: 0.2; display: block; }
.empty-state h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p  { font-size: 0.875rem; font-weight: 500; }

/* ════════════════════════════════════════════════════════════════
   SPINNER / LOADING
   ════════════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════
   LOGOUT BUTTON
   ════════════════════════════════════════════════════════════════ */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1.1rem;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff !important;
  border: 2px solid rgba(255,255,255,.2);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(220,38,38,.4);
}
.btn-logout:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 4px 16px rgba(220,38,38,.5);
  transform: translateY(-1px);
  color: #fff !important;
}
.btn-logout i { font-size: 0.82rem; }

/* ════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ════════════════════════════════════════════════════════════════ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--nav-bg);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(29,78,216,.35) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(15,23,42,.6) 0%, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
}
.login-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 1;
}

.login-wrapper { width: 100%; max-width: 430px; position: relative; z-index: 1; }

.login-card {
  background: rgba(255,255,255,.97);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2.75rem 2.25rem;
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(20px);
}

.login-brand { text-align: center; margin-bottom: 2.25rem; }
.login-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  font-size: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.1rem;
  box-shadow: 0 8px 24px rgba(29,78,216,.4);
}
.login-brand h1 { font-size: 1.5rem; font-weight: 900; color: var(--text); letter-spacing: -0.03em; }
.login-brand p  { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.06em; }

.login-form .form-group { margin-bottom: 1.1rem; }
.login-form .form-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.input-icon-right { position: relative; }
.input-icon-right input { padding-right: 2.75rem; }
.toggle-pass {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-disabled);
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--speed);
}
.toggle-pass:hover { color: var(--primary); }

.login-divider { text-align: center; margin: 1.25rem 0 0; }
.login-footer  { text-align: center; margin-top: 1rem; color: var(--text-muted); font-size: 0.78rem; font-weight: 500; }
.login-footer code {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════════
   ABOUT PAGE
   ════════════════════════════════════════════════════════════════ */
.about-hero {
  background: linear-gradient(135deg, var(--nav-bg) 0%, #1e3a8a 60%, var(--primary) 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 4rem 2rem 3.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.about-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.about-hero-content { position: relative; z-index: 1; }
.about-hero-icon {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,.12);
  border: 2px solid rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  margin: 0 auto 1.5rem;
  backdrop-filter: blur(8px);
}
.about-hero h1 { font-size: 2.25rem; font-weight: 900; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.about-hero p  { font-size: 1.05rem; opacity: 0.8; max-width: 560px; margin: 0 auto 2rem; line-height: 1.7; font-weight: 400; }
.about-hero-badges { display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; }
.about-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}

/* About metrics */
.about-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.about-metric {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.about-metric-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.4rem;
}
.about-metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

/* Feature grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.feature-item {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1px solid var(--border);
  text-align: center;
  transition: all var(--speed);
}
.feature-item:hover { background: var(--primary-soft); border-color: var(--primary-border); transform: translateY(-2px); box-shadow: var(--shadow); }
.feature-item i { font-size: 1.75rem; color: var(--primary); margin-bottom: 0.75rem; display: block; }
.feature-item h4 { font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.feature-item p  { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; line-height: 1.5; }

/* Use case cards */
.usecase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.usecase-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.usecase-header {
  padding: 1.25rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.usecase-header.blue   { background: var(--primary); }
.usecase-header.green  { background: var(--success); }
.usecase-header.orange { background: var(--warning); }
.usecase-body { padding: 1.25rem 1.5rem; }
.usecase-body ul { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.usecase-body li {
  font-size: 0.845rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 500;
}
.usecase-body li i { color: var(--success); font-size: 0.75rem; margin-top: 0.22rem; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 900; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-muted   { color: var(--text-muted); }
.mt-1 { margin-top: .5rem;  } .mt-2 { margin-top: 1rem;  } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .stat-grid        { grid-template-columns: repeat(2, 1fr); }
  .chart-grid       { grid-template-columns: 1fr; }
  .chart-grid.three { grid-template-columns: 1fr; }
  .about-metrics    { grid-template-columns: repeat(2, 1fr); }
  .usecase-grid     { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .report-layout      { grid-template-columns: 1fr; }
  .report-sidebar     { position: static; }
  .form-grid          { grid-template-columns: 1fr; }
  .form-grid.three    { grid-template-columns: 1fr; }
  .report-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Mobile nav */
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    background: #1e293b;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-direction: column;
    padding: 0.75rem;
    gap: 2px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .nav-user { display: none; }
  .navbar { position: relative; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .civilian-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .about-hero h1 { font-size: 1.6rem; }
  .about-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: 2rem 1.25rem; }
  .card-body { padding: 1rem; }
  .form-card-body { padding: 1rem; }
  .about-metrics { grid-template-columns: 1fr 1fr; }
  .search-bar { min-width: 100%; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .navbar, .breadcrumb-bar, .page-actions, .site-footer,
  .cc-actions, .form-actions-bar, .btn-logout { display: none !important; }
  body { background: #fff; }
  .card, .civilian-card, .report-sidebar { box-shadow: none; border: 1px solid #ddd; }
}
