/* ─────────────────────────────────────────────────────────────────────────
 * FCT CSC HR — design system
 * Brand: https://www.fedcivilservice.gov.ng/
 * Primary: #139d23  Dark green: #006600  Purple-blue: #40407e  Pink-red: #f73859
 * Headings: Montserrat   Body: Lato
 * ───────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&family=Lato:wght@300;400;700&display=swap');

:root {
  /* Brand */
  --primary: #139d23;
  --primary-700: #0e7a1b;
  --primary-800: #006600;
  --primary-50: #e8f5e9;
  --primary-100: #c8e6c9;
  --secondary: #40407e;
  --secondary-50: #ecedf5;
  --accent: #f73859;
  --accent-50: #fde8ec;

  /* Neutrals */
  --gray-0: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --text-subtle: var(--gray-400);
  --bg: var(--gray-50);
  --bg-elevated: var(--gray-0);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);

  --danger: #dc2626;
  --danger-50: #fef2f2;
  --warning: #d97706;
  --warning-50: #fffbeb;
  --success: var(--primary);
  --success-50: var(--primary-50);
  --info: #2563eb;
  --info-50: #eff6ff;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

  --font-body: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--gray-900); }
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.375rem; line-height: 1.25; }
h3 { font-size: 1.125rem; line-height: 1.3; }
h4 { font-size: 1rem; line-height: 1.4; }
p { margin: 0 0 0.75rem 0; }
a { color: var(--primary-700); text-decoration: none; }
a:hover { color: var(--primary-800); text-decoration: underline; }
small { font-size: 0.8125rem; color: var(--text-muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, pre { font-family: var(--font-mono); }

/* ── App shell ─────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.app--no-sidebar { display: block; }

/* Sidebar */
.sidebar {
  background: var(--gray-0);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--gray-900);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { width: 32px; height: 32px; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar__brand-name { font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; color: var(--gray-900); }
.sidebar__brand-sub { font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar__nav { padding: 0.75rem 0.5rem; flex: 1; overflow-y: auto; }
.sidebar__heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  padding: 0.75rem 0.75rem 0.4rem;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  color: var(--gray-700);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}
.sidebar__link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}
.sidebar__link--active {
  background: var(--primary-50);
  color: var(--primary-800);
}
.sidebar__link--active:hover {
  background: var(--primary-100);
  color: var(--primary-800);
}
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar__user {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--secondary-50);
  color: var(--secondary);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem;
}
.sidebar__user-name { flex: 1; font-weight: 600; font-size: 0.85rem; line-height: 1.1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-role { font-size: 0.7rem; color: var(--text-muted); }

/* Sign-out row at the bottom of the sidebar — visually matches .sidebar__link
   so it's as obvious as any nav item. */
.sidebar__signout-form { padding: 0 0.5rem 0.75rem; margin: 0; }
.sidebar__link--signout {
  width: 100%;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  color: var(--gray-700);
}
.sidebar__link--signout:hover { background: var(--danger-50); color: var(--danger); }

/* Main area */
/* Fill the remaining width on any viewport. The 11-column employee list
   needs the room and shouldn't be constrained on wide monitors. */
.main { min-width: 0; padding: 1.5rem 2rem 3rem; }

/* ── Page header ───────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-head__title h1 { margin-bottom: 0.25rem; }
.page-head__sub { color: var(--text-muted); font-size: 0.9rem; }
.page-head__actions { margin-left: auto; display: flex; gap: 0.5rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: var(--font-body);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  line-height: 1.2;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }

.btn-secondary { background: var(--gray-0); color: var(--gray-800); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

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

.btn--sm { padding: 0.35rem 0.65rem; font-size: 0.8125rem; }
.btn--icon { padding: 0.5rem; }

/* ── Cards / panels ─────────────────────────────────────────────────────── */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.panel__head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.panel__head h2, .panel__head h3 { font-size: 0.95rem; }
.panel__head .actions { margin-left: auto; }
.panel__body { padding: 1.25rem; }
.panel__body--flush { padding: 0; }

/* ── Stat cards (dashboard) ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  position: relative;
  display: block;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; }
.stat::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 2px; background: var(--gray-300);
}
.stat--danger::before { background: var(--danger); }
.stat--warning::before { background: var(--warning); }
.stat--success::before { background: var(--primary); }
.stat--info::before { background: var(--info); }
.stat--secondary::before { background: var(--secondary); }
.stat__label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.stat__count { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 0.4rem; color: var(--gray-900); }
.stat__count--danger { color: var(--danger); }
.stat__count--warning { color: var(--warning); }

/* Featured headline metric — total workforce, made unmissable on the dashboard */
.stat--feature {
  background: linear-gradient(180deg, var(--primary-50) 0%, var(--bg-elevated) 75%);
  border-color: var(--primary-100);
}
.stat--feature::before { background: var(--primary); }
.stat--feature .stat__label { color: var(--primary-800); }
.stat__count--feature { font-size: 3.25rem; color: var(--primary-800); }
.stat__hint { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.78rem; }
.stat__hint svg { width: 14px; height: 14px; }

.stat-section-head { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0.75rem; }
.stat-section-head h3 { font-size: 0.95rem; font-weight: 600; color: var(--gray-700); }
.stat-section-head .rule { flex: 1; height: 1px; background: var(--border); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 0.875rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom-color: var(--border-strong);
  position: sticky; top: 0; z-index: 1;
}
.table tbody tr:hover { background: var(--gray-50); }
/* Constrain inline SVG icons inside table cells (without this they stretch
   to the row's full height when wrapped in a flex row). */
.table td svg, .table th svg { width: 16px; height: 16px; flex-shrink: 0; }
.table td .row-flex { gap: 0.4rem; align-items: center; }
.table th .th-sort {
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--gray-600); text-decoration: none;
}
.table th .th-sort:hover { color: var(--gray-900); text-decoration: none; }
.table th .th-sort--active { color: var(--primary-700); }
.table th .th-sort__arrow { font-size: 0.85em; line-height: 1; }
.table th .th-sort__arrow--idle { opacity: 0.35; }
.table th[aria-sort] { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table a { color: var(--gray-900); font-weight: 600; }
.table a:hover { color: var(--primary-700); }

.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty svg { width: 48px; height: 48px; color: var(--gray-300); margin-bottom: 0.75rem; }
.empty h3 { color: var(--gray-700); margin-bottom: 0.25rem; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.875rem; }
.field label, .field__label { font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); }
.input, .select, textarea.input {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--gray-0);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--gray-900);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 157, 35, 0.18);
}
.input--with-icon { padding-left: 2.25rem; }
.input-group { position: relative; }
.input-group__icon {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); pointer-events: none;
}
.input-group__icon svg { width: 16px; height: 16px; }

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

/* ── Filters bar ────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.875rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 200px; }
.filter-bar .grow { flex: 1; min-width: 240px; }
.filter-bar__count {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Filter chips: Due for Promotion / Retirement */
.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8125rem;
  background: var(--gray-0);
  color: var(--gray-700);
  border: 1px solid var(--border-strong);
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.chip--active { background: var(--primary-50); border-color: var(--primary); color: var(--primary-800); }
.chip--danger.chip--active { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }
.chip--warning.chip--active { background: var(--warning-50); border-color: var(--warning); color: var(--warning); }
.chip svg { width: 14px; height: 14px; }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--success { background: var(--primary-50); color: var(--primary-800); }
.badge--danger { background: var(--danger-50); color: var(--danger); }
.badge--warning { background: var(--warning-50); color: var(--warning); }
.badge--info { background: var(--info-50); color: var(--info); }
.badge--secondary { background: var(--secondary-50); color: var(--secondary); }
.badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; gap: 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.pagination__pages { display: flex; gap: 0.25rem; align-items: center; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 0.5rem; border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--gray-700); font-weight: 500;
}
.page-link:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }
.page-link--active { background: var(--gray-0); border-color: var(--border-strong); color: var(--gray-900); font-weight: 700; }
.page-link--disabled { opacity: 0.5; pointer-events: none; }

/* ── Login screen ──────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, var(--primary-50), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, var(--secondary-50), transparent 60%),
    var(--bg);
  padding: 1.5rem;
}
.auth__card {
  width: 100%; max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.auth__brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.auth__brand img { width: 40px; height: 40px; }
.auth__brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.auth__brand-sub { color: var(--text-muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.auth__title { margin-bottom: 0.25rem; }
.auth__subtitle { color: var(--text-muted); margin-bottom: 1.5rem; }
.auth__footer { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: 0.8rem; }

/* ── Detail page ──────────────────────────────────────────────────────── */
.detail-hero {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, var(--primary-50) 0%, transparent 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}
.detail-hero__avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--gray-0);
  border: 2px solid var(--primary);
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.4rem;
  color: var(--primary-800);
  flex-shrink: 0;
}
.detail-hero__meta h1 { margin-bottom: 0.25rem; }
.detail-hero__id { color: var(--text-muted); font-size: 0.875rem; font-family: var(--font-mono); }
.detail-hero__badges { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.detail-hero__actions { margin-left: auto; display: flex; gap: 0.5rem; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
/* min-width: 0 lets grid children shrink below their content size,
   so long unbroken strings (URLs, NINs) don't push the panel wider. */
.detail-grid > * { min-width: 0; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 0.55rem 1rem; font-size: 0.875rem; min-width: 0; }
.kv dt { color: var(--text-muted); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kv dd {
  margin: 0;
  color: var(--gray-900);
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.kv dd .muted { color: var(--text-subtle); font-weight: 400; }
/* Catch-all so any panel body wraps long text rather than overflowing. */
.panel__body { overflow-wrap: anywhere; word-break: break-word; }

/* ── Messages / alerts ─────────────────────────────────────────────────── */
.messages { list-style: none; padding: 0; margin: 0 0 1rem 0; }
.alert { padding: 0.7rem 0.95rem; border-radius: var(--radius); margin-bottom: 0.5rem; border: 1px solid; font-size: 0.875rem; }
.alert--success { background: var(--success-50); color: var(--primary-800); border-color: var(--primary-100); }
.alert--error, .alert--danger { background: var(--danger-50); color: var(--danger); border-color: #fecaca; }
.alert--warning { background: var(--warning-50); color: var(--warning); border-color: #fde68a; }
.alert--info { background: var(--info-50); color: var(--info); border-color: #bfdbfe; }

/* ── Progress bar ──────────────────────────────────────────────────────── */
.progress { height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); transition: width 0.3s ease; }
.progress--sm { height: 6px; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.text-mono { font-family: var(--font-mono); }
.text-num { font-variant-numeric: tabular-nums; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.row-flex { display: flex; gap: 0.75rem; align-items: center; }
.row-flex--between { justify-content: space-between; }
.stack > * + * { margin-top: 0.75rem; }
.stack--lg > * + * { margin-top: 1.5rem; }
.hidden { display: none !important; }

/* ── Filter summary banner ─────────────────────────────────────────────── */
.filter-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-800);
}
.filter-banner > strong { color: var(--primary-800); }
.filter-banner__chips { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-banner .chip { background: var(--gray-0); border-color: var(--border-strong); padding: 0.25rem 0.4rem 0.25rem 0.65rem; }
.filter-banner .chip__label { color: var(--text-muted); font-weight: 500; margin-right: 0.25rem; }
.filter-banner .chip__value { color: var(--gray-900); font-weight: 600; }
.filter-banner .chip__x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin-left: 0.4rem;
  border-radius: 50%; color: var(--text-muted);
}
.filter-banner .chip__x:hover { background: var(--gray-200); color: var(--gray-900); text-decoration: none; }
.filter-banner .chip__x svg { width: 12px; height: 12px; }
.filter-banner__clear-all {
  margin-left: auto; font-weight: 600; font-size: 0.8125rem;
  color: var(--primary-700);
}
.filter-banner__clear-all:hover { color: var(--primary-800); }

/* ── Native <dialog> modal ─────────────────────────────────────────────── */
.dialog {
  border: 0; padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  background: var(--bg-elevated);
  color: var(--text);
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  overflow: hidden;
}
.dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

/* Large viewer modal: full-document preview + rename + delete on one screen.
   Open by clicking any attachment card. */
.dialog--viewer {
  width: min(95vw, 1200px);
  max-height: 92vh;
  padding: 0;
}
.dialog--viewer .dialog__head { padding: 0.85rem 1.25rem; gap: 0.75rem; }
.dialog--viewer .dialog__head h3 { font-size: 0.95rem; }
.attach-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  padding: 1rem 1.25rem;
}
@media (max-width: 800px) {
  .attach-view { grid-template-columns: 1fr; }
}
.attach-view__preview {
  background: var(--gray-100);
  border-radius: var(--radius);
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.attach-view__preview iframe {
  width: 100%;
  height: 70vh;
  border: 0;
  background: #fff;
}
.attach-view__preview img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
}
.attach-view__meta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.875rem;
  min-width: 0;
}
.attach-view__meta hr { border: 0; border-top: 1px solid var(--border); }
.attach-view__meta .field { margin: 0; }
.attach-view__meta input.input { width: 100%; }

/* The card "click target" used to be an <a>; it's now a <button>.
   Reset button defaults so it visually behaves the same as the old link. */
button.attach-card__link {
  border: 0;
  background: transparent;
  font: inherit;
  width: 100%;
  cursor: pointer;
  text-align: center;
}
.dialog__form {
  display: flex; flex-direction: column;
  max-height: inherit;
}
.dialog__head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.dialog__head h3 { font-size: 1rem; flex: 1; }
.dialog__close {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted); padding: 0.3rem; border-radius: var(--radius-sm);
  display: inline-flex;
}
.dialog__close:hover { background: var(--gray-100); color: var(--gray-900); }
.dialog__close svg { width: 18px; height: 18px; }
.dialog__body { padding: 1.25rem; overflow-y: auto; }
.dialog__foot {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--gray-50);
}

/* ── Attachment grid (employee detail) ───────────────────────────────── */
.attachments .panel__head .input-group { max-width: 280px; }
.attach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.attach-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.attach-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.attach-card__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 0.9rem 0.75rem 0.7rem;
  text-decoration: none;
  color: var(--gray-900);
}
.attach-card__link:hover { text-decoration: none; color: var(--gray-900); }
.attach-card__icon {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-600);
}
.attach-card__icon svg { width: 28px; height: 28px; }
.attach-card__ext {
  position: absolute;
  bottom: -4px; right: -6px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: var(--gray-700); color: #fff;
}
/* Per-extension accent colours */
.attach-card__icon--pdf  { background: var(--danger-50);  color: var(--danger);  }
.attach-card__icon--pdf  + .attach-card__ext, .attach-card__icon--pdf .attach-card__ext { background: var(--danger); }
.attach-card__icon--jpg, .attach-card__icon--jpeg, .attach-card__icon--png,
.attach-card__icon--gif, .attach-card__icon--webp, .attach-card__icon--heic,
.attach-card__icon--tif, .attach-card__icon--tiff, .attach-card__icon--bmp {
  background: var(--info-50); color: var(--info);
}
.attach-card__icon--jpg  .attach-card__ext, .attach-card__icon--jpeg .attach-card__ext,
.attach-card__icon--png  .attach-card__ext, .attach-card__icon--gif  .attach-card__ext,
.attach-card__icon--webp .attach-card__ext, .attach-card__icon--heic .attach-card__ext,
.attach-card__icon--tif  .attach-card__ext, .attach-card__icon--tiff .attach-card__ext,
.attach-card__icon--bmp  .attach-card__ext {
  background: var(--info);
}
.attach-card__icon--doc, .attach-card__icon--docx, .attach-card__icon--rtf,
.attach-card__icon--odt, .attach-card__icon--txt {
  background: var(--info-50); color: var(--info);
}
.attach-card__icon--xls, .attach-card__icon--xlsx, .attach-card__icon--csv, .attach-card__icon--ods {
  background: var(--success-50); color: var(--primary-700);
}
.attach-card__icon--xls .attach-card__ext, .attach-card__icon--xlsx .attach-card__ext,
.attach-card__icon--csv .attach-card__ext, .attach-card__icon--ods .attach-card__ext {
  background: var(--primary-700);
}

/* Real preview: first PDF page or full image, JPEG-compressed sidecar.
   Sized to match the icon block's visual weight (~48 px height became
   ~140 px). object-fit: cover crops thumbnails that aren't 4:5 to keep
   the grid uniform. */
.attach-card__thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--gray-50);
  display: block;
}
.attach-card__thumb-badge {
  position: absolute;
  top: 6px; left: 6px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.72); color: #fff;
  pointer-events: none;
}

.attach-card__name {
  font-size: 0.825rem;
  font-weight: 500;
  line-height: 1.3;
  word-break: break-word;
  max-width: 100%;
}
.attach-card__meta { line-height: 1; }

/* Hover-revealed delete button — positioned over the card top-right */
.attach-card__delete {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
  margin: 0;
  opacity: 0;
  transition: opacity 0.12s;
}
.attach-card:hover .attach-card__delete,
.attach-card:focus-within .attach-card__delete { opacity: 1; }
.attach-card__delete button {
  background: var(--gray-0);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 50%;
  display: grid; place-items: center;
  width: 24px; height: 24px;
}
.attach-card__delete button:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-50); }
.attach-card__delete button svg { width: 12px; height: 12px; }

/* ── Upload dropzone ───────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--gray-50);
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-50); }
.dropzone svg { width: 40px; height: 40px; color: var(--gray-400); margin-bottom: 0.75rem; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -100%; top: 0; width: var(--sidebar-w); z-index: 50; transition: left 0.2s; }
  .sidebar--open { left: 0; }
  .main { padding: 1rem; }
  .topbar-mobile { display: flex; }
}
.topbar-mobile { display: none; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); background: var(--gray-0); }
.topbar-mobile__menu { background: transparent; border: 0; cursor: pointer; padding: 0.4rem; }
