/* ==========================================================
   Production-MM HR Portal — Design System v2
   A control-room palette (deep petrol teal, safety amber) with
   a contemporary execution: a floating glass sidebar, warm
   geometric type, tinted depth shadows, and quiet motion.
   ========================================================== */

:root {
  /* ---- Color: canvas & surfaces ---- */
  --bg: #F6F3FB;
  --bg-mesh-a: rgba(109, 40, 217, 0.07);
  --bg-mesh-b: rgba(217, 70, 239, 0.05);
  --surface: #FFFFFF;
  --surface-alt: #F9F7FD;
  --ink: #121A22;
  --ink-soft: #3C4750;
  --muted: #6B7680;
  --border: #E3E7EB;
  --border-soft: #EDF0F2;

  /* ---- Color: brand ---- */
  --primary: #3B0F75;
  --primary-dark: #1E0B3E;
  --primary-mid: #5B21B6;
  --primary-light: #F1EAFE;
  --primary-tint: #E4D6FB;

  --accent: #A855F7;
  --accent-dark: #7E22CE;
  --accent-mid: #C084FC;
  --accent-light: #F5EDFF;

  --success: #29855A;
  --success-light: #E1F3E9;
  --danger: #C24B3B;
  --danger-light: #FBEAE7;
  --info: #3D6FA8;
  --info-light: #E6EFF8;
  --violet: #6C5AA8;
  --violet-light: #ECE7F6;
  --rose: #B33A5B;
  --rose-light: #F7E3E9;
  --slate: #4A6178;
  --slate-light: #E6EBEF;
  --neutral-light: #EEF0F2;

  /* ---- Type ---- */
  --font-display: 'Bricolage Grotesque', 'Space Grotesk', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* ---- Shape / depth ---- */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(59, 15, 117, 0.07), 0 1px 1px rgba(59, 15, 117, 0.04);
  --shadow: 0 8px 24px -6px rgba(59, 15, 117, 0.14), 0 2px 8px -2px rgba(59, 15, 117, 0.08);
  --shadow-lg: 0 24px 64px -16px rgba(30, 11, 62, 0.35), 0 4px 16px -4px rgba(30, 11, 62, 0.15);
  --shadow-glow: 0 8px 28px -6px rgba(168, 85, 247, 0.35);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 8% -8%, var(--bg-mesh-a), transparent 55%),
    radial-gradient(ellipse 700px 500px at 100% 12%, var(--bg-mesh-b), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" 1, "cv01" 1;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.015em;
}
a { color: var(--primary); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent-dark); }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--font-mono); }

::selection { background: var(--accent-light); color: var(--primary-dark); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

/* Base icon sizing (safety net — every icon() call gets a sane default
   size even if no more specific rule matches its context) */
svg.ico { width: 18px; height: 18px; flex-shrink: 0; }
svg.ico-sm { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------------- Layout ---------------- */
.app-shell { display: flex; min-height: calc(100vh - 60px); align-items: flex-start; }
.app-shell.no-sidebar .main { width: 100%; }

/* ---------------- Top navigation (primary nav) ---------------- */
.topnav {
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.08), transparent 45%),
    linear-gradient(100deg, #3B0F75 0%, #4C1D95 55%, #3B0F75 100%);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 40;
}
.topnav-inner { display: flex; align-items: center; gap: 6px; padding: 0 22px; height: 60px; max-width: 1600px; margin: 0 auto; }
.topnav-brand { display: flex; align-items: center; gap: 10px; margin-right: 18px; flex-shrink: 0; }
.topnav-brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(150deg, var(--accent-mid), var(--accent) 60%, var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 750; color: #FFFFFF; font-size: 15.5px;
  box-shadow: var(--shadow-glow);
}
.topnav-brand-text { line-height: 1.25; display: flex; flex-direction: column; }
.topnav-brand-text strong { font-family: var(--font-display); font-weight: 650; font-size: 16px; color: #fff; letter-spacing: -0.01em; }
.topnav-brand-text small { font-size: 12.5px; color: #BFA9EE; }

.topnav-links { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.topnav-link {
  padding: 8px 13px; border-radius: 9px; color: #E6DAFB; font-size: 15.3px; font-weight: 550;
  white-space: nowrap; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.topnav-link:hover { background: rgba(255,255,255,0.10); color: #fff; }
.topnav-link.active { background: rgba(255,255,255,0.16); color: #fff; font-weight: 650; }

.topnav-dropdown { position: relative; }
.topnav-drop-btn {
  display: flex; align-items: center; gap: 5px; padding: 8px 13px; border-radius: 9px;
  background: none; border: none; color: #E6DAFB; font-family: var(--font-body);
  font-size: 15.3px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.topnav-drop-btn svg { width: 13px; height: 13px; transition: transform 0.15s var(--ease); }
.topnav-dropdown:hover .topnav-drop-btn, .topnav-dropdown.open .topnav-drop-btn { background: rgba(255,255,255,0.10); color: #fff; }
.topnav-dropdown.active .topnav-drop-btn { background: rgba(255,255,255,0.16); color: #fff; font-weight: 650; }
.topnav-dropdown.open .topnav-drop-btn svg { transform: rotate(180deg); }

.topnav-drop-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 232px;
  background: var(--surface); border-radius: 13px; box-shadow: var(--shadow-lg);
  padding: 7px; z-index: 50; border: 1px solid var(--border-soft);
}
.topnav-dropdown:hover .topnav-drop-menu, .topnav-dropdown.open .topnav-drop-menu { display: block; }
.topnav-drop-link {
  display: flex; align-items: center; gap: 10px; padding: 8.5px 11px; border-radius: 9px;
  color: var(--ink-soft); font-size: 15.2px; font-weight: 500;
  transition: background 0.13s var(--ease), color 0.13s var(--ease);
}
.topnav-drop-link .ico-sm { opacity: 0.65; }
.topnav-drop-link:hover { background: var(--primary-light); color: var(--primary-dark); }
.topnav-drop-link.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 650; }

.topnav-unit-chip {
  display: flex; align-items: center; gap: 7px; margin-left: 6px; padding: 6px 13px;
  border-radius: 999px; background: rgba(255,255,255,0.10); color: #fff; font-size: 14.5px; font-weight: 650;
}
.topnav-unit-back { color: #D5C5F6; font-weight: 700; }
.topnav-unit-back:hover { color: #fff; }

.topnav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: 14px; }
.topnav-toggle {
  display: none; background: none; border: none; color: #fff; cursor: pointer; padding: 6px;
  border-radius: 8px; margin-right: 4px;
}
.topnav-toggle:hover { background: rgba(255,255,255,0.10); }

/* ---------------- Slim contextual sidebar (Reports / Organization / Setup only) ---------------- */
.sidebar.sidebar-slim {
  width: 224px; flex-shrink: 0;
  margin: 18px 0 18px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 14px 10px;
  position: sticky; top: 78px;
  height: fit-content;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.sidebar-slim .nav-group-label { color: var(--muted); margin: 4px 8px 8px; }
.sidebar-slim .nav-link { color: var(--ink-soft); }
.sidebar-slim .nav-link .ico { opacity: 0.55; }
.sidebar-slim .nav-link:hover { background: var(--surface-alt); color: var(--ink); transform: none; }
.sidebar-slim .nav-link:hover .ico { opacity: 0.85; }
.sidebar-slim .nav-link.active {
  background: var(--primary-light); color: var(--primary-dark); box-shadow: none;
}
.sidebar-slim .nav-link.active .ico { opacity: 1; color: var(--primary-dark); }

.nav-group-label {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7DACAA;
  margin: 18px 11px 7px;
  font-weight: 650;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9.5px 12px;
  border-radius: 12px;
  color: #E6DAFB;
  font-size: 15.5px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
}
.nav-link .ico { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.8; transition: opacity 0.15s var(--ease); }
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(1px); }
.nav-link:hover .ico { opacity: 1; }
.nav-link.active {
  background: linear-gradient(135deg, var(--accent-mid), var(--accent) 75%);
  color: #FFFFFF;
  font-weight: 650;
  box-shadow: 0 4px 14px -2px rgba(168, 85, 247, 0.5);
}
.nav-link.active .ico { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(247, 248, 250, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border-soft);
  padding: 16px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 60px;
  z-index: 20;
}
.topbar h1 { font-size: 23px; font-weight: 680; }
.topbar-sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.mobile-toggle { display: none; }

.content { padding: 26px 30px 64px; max-width: 100%; width: 100%; animation: fadeUp 0.35s var(--ease); }
.content-full { max-width: 100%; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; color: #fff; font-weight: 500;
  padding: 6px 13px 6px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
}
.user-chip .dot {
  width: 25px; height: 25px; border-radius: 50%;
  background: linear-gradient(150deg, var(--accent-mid), var(--accent));
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; font-family: var(--font-display);
}

@media (max-width: 1180px) {
  .topnav-links { position: fixed; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--primary-dark); padding: 10px; gap: 2px; max-height: calc(100vh - 60px); overflow-y: auto;
    display: none; box-shadow: var(--shadow-lg); }
  .topnav-links.open { display: flex; }
  .topnav-dropdown, .topnav-drop-menu { position: static; width: 100%; }
  .topnav-drop-menu { box-shadow: none; border: none; background: rgba(0,0,0,0.15); margin-top: 2px; display: none; }
  .topnav-dropdown.open .topnav-drop-menu, .topnav-dropdown.active .topnav-drop-menu { display: block; }
  .topnav-drop-link { color: #E6DAFB; }
  .topnav-drop-link:hover, .topnav-drop-link.active { background: rgba(255,255,255,0.10); color: #fff; }
  .topnav-toggle { display: block; }
  .topnav-unit-chip { margin: 8px; }
  .topnav-right { margin-left: auto; }
  .sidebar.sidebar-slim { display: none; }
}

@media (max-width: 560px) {
  .topnav-inner { padding: 0 12px; gap: 4px; }
  .topnav-brand-text { display: none; }
  .user-chip span:not(.dot) { display: none; }
  .user-chip { padding: 6px; }
  .topnav-right .btn-sm { padding: 6.5px 9px; font-size: 13.5px; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-body);
  font-size: 15.5px; font-weight: 650;
  padding: 10px 17px;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
  line-height: 1.2;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary { background: linear-gradient(150deg, var(--primary-mid), var(--primary-dark)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: 0 6px 18px -4px rgba(59, 15, 117, 0.45); color: #fff; transform: translateY(-1px); }
.btn-accent { background: linear-gradient(150deg, var(--accent-mid), var(--accent) 80%); color: #FFFFFF; box-shadow: var(--shadow-glow); }
.btn-accent:hover { box-shadow: 0 10px 26px -4px rgba(168, 85, 247, 0.55); color: #FFFFFF; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--primary-light); border-color: var(--primary-tint); transform: translateY(-1px); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: #F0CFC9; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6.5px 12px; font-size: 14.4px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease);
}
.card-pad { padding: 22px 24px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
  gap: 12px; flex-wrap: wrap;
}
.card-header h2, .card-header h3 { font-size: 18px; }
.card-header-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 15px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card::after {
  content: ""; position: absolute; right: -20px; bottom: -20px; width: 78px; height: 78px;
  border-radius: 50%; background: var(--primary-light); opacity: 0.65;
}
.stat-card .stat-value { font-family: var(--font-display); font-weight: 700; font-size: 32px; color: var(--primary-dark); position: relative; letter-spacing: -0.02em; }
.stat-card .stat-label { font-size: 14px; color: var(--muted); margin-top: 3px; position: relative; }
.stat-card.accent::after { background: var(--accent-light); }
.stat-card.accent .stat-value { color: var(--accent-dark); }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: 15.3px; }
table.grid th {
  text-align: left; font-size: 12.8px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 650; padding: 11px 15px; border-bottom: 1px solid var(--border);
  background: var(--surface-alt); white-space: nowrap;
}
table.grid td { padding: 12px 15px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.grid tbody tr { transition: background 0.14s var(--ease); }
table.grid tbody tr:hover { background: var(--surface-alt); }
table.grid tbody tr:last-child td { border-bottom: none; }
.td-muted { color: var(--muted); }
.td-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.row-link { cursor: pointer; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 17px 19px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field label { font-size: 14.3px; font-weight: 650; color: var(--ink-soft); }
.field .hint { font-size: 13.5px; color: var(--muted); margin-top: -2px; }

input[type=text], input[type=date], input[type=number], input[type=password],
input[type=email], input[type=tel], select, textarea {
  font-family: var(--font-body);
  font-size: 15.7px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea { resize: vertical; min-height: 80px; font-family: var(--font-body); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary-mid);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-soft); }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 11px;
  padding: 9px 13px; min-width: 220px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.search-box:focus-within { border-color: var(--primary-mid); box-shadow: 0 0 0 4px var(--primary-light); }
.search-box input { border: none; padding: 2px 0; box-shadow: none !important; }
.search-box svg { flex-shrink: 0; opacity: 0.5; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: center; }
.filter-bar select { width: auto; padding: 9px 32px 9px 13px; }

/* ---------------- Pills / badges ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13.5px; font-weight: 650; padding: 4px 11px;
  border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-working    { background: var(--success-light); color: var(--success); }
.pill-resigned   { background: var(--neutral-light); color: var(--muted); }
.pill-retired    { background: var(--danger-light); color: var(--danger); }
.pill-transferred{ background: var(--info-light); color: var(--info); }
.pill-unknown    { background: var(--neutral-light); color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 700;
  padding: 2.5px 9px; border-radius: 7px; background: var(--primary-light); color: var(--primary-dark);
  font-family: var(--font-mono);
}
.badge-accent { background: var(--accent-light); color: var(--accent-dark); }

/* ---------------- Avatar ---------------- */
.avatar {
  border-radius: 50%; object-fit: cover; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-dark); font-family: var(--font-display); font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: 14px; }
.avatar-md { width: 54px; height: 54px; font-size: 18px; }
.avatar-lg { width: 100px; height: 100px; font-size: 29px; border: 3px solid var(--surface); box-shadow: var(--shadow); }

/* ---------------- Employee grid ---------------- */
.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 15px; }
.emp-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 17px; display: flex; gap: 13px; align-items: flex-start;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.18s var(--ease);
}
.emp-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--primary-tint); }
.emp-card-body { min-width: 0; flex: 1; }
.emp-card-name { font-family: var(--font-display); font-size: 17px; font-weight: 650; color: var(--ink); margin-bottom: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emp-card-role { font-size: 14px; color: var(--muted); margin-bottom: 9px; }
.emp-card-meta { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.emp-card-pno { font-family: var(--font-mono); font-size: 13px; color: var(--primary-mid); }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab {
  padding: 11px 17px; font-size: 15.4px; font-weight: 650; color: var(--muted);
  border-bottom: 2.5px solid transparent; white-space: nowrap; cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tab:hover { color: var(--primary-mid); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.22s var(--ease); }

/* ---------------- Qualification matrix ---------------- */
.qual-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 17px; font-size: 14px; color: var(--ink-soft); }
.qual-legend .item { display: flex; align-items: center; gap: 6px; }
.qual-legend .swatch { width: 12px; height: 12px; border-radius: 4px; }
.qual-table-wrap { overflow-x: auto; }
table.qual { border-collapse: separate; border-spacing: 4px; font-size: 14.4px; }
table.qual th {
  font-size: 12.6px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  padding: 6px 8px; text-align: center; font-weight: 650; white-space: nowrap;
}
table.qual th:first-child { text-align: left; }
table.qual td { padding: 0; }
table.qual td.emp-name-cell {
  text-align: left; padding: 6px 10px; font-weight: 650; white-space: nowrap;
  font-size: 14.6px; color: var(--ink);
}
.qual-cell {
  width: 74px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 12.3px; font-weight: 700; text-transform: capitalize; text-align: center; line-height: 1.15; padding: 2px 4px;
}
.ts-completed { background: var(--success-light); color: var(--success); }
.ts-working   { background: var(--primary-light); color: var(--primary-dark); }
.ts-training  { background: var(--accent-light); color: var(--accent-dark); }
.ts-none      { background: var(--neutral-light); color: #A9B2B8; }
.ts-other     { background: var(--info-light); color: var(--info); }

/* ---------------- Detail rows ---------------- */
.dl { display: grid; grid-template-columns: 155px 1fr; row-gap: 12px; column-gap: 14px; font-size: 15.5px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--ink); }

/* ---------------- Alerts / flash ---------------- */
.alert { padding: 13px 17px; border-radius: 12px; font-size: 15.3px; margin-bottom: 20px; display: flex; align-items: center; gap: 9px; }
.alert-success { background: var(--success-light); color: #1D6B44; }
.alert-error   { background: var(--danger-light); color: #93382B; }
.alert-info    { background: var(--info-light); color: #2A5480; }

.empty-state { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty-state svg { opacity: 0.5; margin-bottom: 10px; }
.empty-state h3 { color: var(--ink-soft); font-size: 17.5px; margin-bottom: 4px; }
.empty-state p { font-size: 15px; max-width: 340px; margin: 0 auto; }

/* ---------------- Login page ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(192, 132, 252, 0.16), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(91, 33, 182, 0.55), transparent 45%),
    linear-gradient(160deg, var(--primary-dark), var(--primary) 65%);
  padding: 24px;
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 390px; padding: 38px 34px;
  animation: fadeUp 0.4s var(--ease);
}
.login-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(150deg, var(--accent-mid), var(--accent) 70%);
  display: flex; align-items: center; justify-content: center; color: #FFFFFF;
  font-family: var(--font-display); font-weight: 750; font-size: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow-glow);
}
.login-card h1 { font-size: 24px; margin-bottom: 3px; }
.login-card p.sub { color: var(--muted); font-size: 15px; margin-bottom: 24px; }

/* ---------------- Hero banner (dashboard) ---------------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.32), transparent 42%),
    radial-gradient(circle at 8% 120%, rgba(255, 255, 255, 0.10), transparent 45%),
    linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 55%, var(--primary-mid) 100%);
  border-radius: var(--radius-lg);
  padding: 30px 34px;
  margin-bottom: 24px;
  color: #F3ECFF;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.3;
  pointer-events: none;
}
.hero-row { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero-eyebrow { font-size: 13.5px; text-transform: uppercase; letter-spacing: 0.11em; color: #CDB9F4; font-weight: 650; margin-bottom: 9px; }
.hero-title { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: #fff; margin-bottom: 7px; letter-spacing: -0.02em; }
.hero-sub { font-size: 15.8px; color: #E4D8F9; max-width: 580px; line-height: 1.6; }
.hero-sub strong { color: #fff; font-family: var(--font-mono); font-weight: 650; }
.hero-date { text-align: right; }
.hero-date .day { font-family: var(--font-display); font-size: 22px; color: #fff; font-weight: 650; }
.hero-date .full { font-size: 14px; color: #C9B5F2; margin-top: 2px; }
.hero-stats { position: relative; display: flex; gap: 30px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat .n { font-family: var(--font-display); font-size: 27px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.hero-stat .l { font-size: 13.4px; color: #C9B5F2; margin-top: 1px; }
.hero-stat.accent .n { color: #E9D5FF; }

.hero-illustration { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); opacity: 0.9; pointer-events: none; }
.hero-illustration svg { display: block; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.15)); }
@media (max-width: 900px) { .hero-illustration { display: none; } }

.hero.tone-success { background: radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.28), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #1D6B44 0%, #29855A 58%, #3CA968 100%); }
.hero.tone-info    { background: radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.28), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #20405E 0%, #3D6FA8 58%, #4D89C2 100%); }
.hero.tone-accent  { background: radial-gradient(circle at 88% -10%, rgba(255, 255, 255, 0.22), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #6B21A8 0%, #A855F7 58%, #C084FC 100%); }
.hero.tone-violet  { background: radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.26), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #402F68 0%, #6C5AA8 58%, #8474C2 100%); }
.hero.tone-rose    { background: radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.26), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #742840 0%, #B33A5B 58%, #C85D7B 100%); }
.hero.tone-slate   { background: radial-gradient(circle at 88% -10%, rgba(192, 132, 252, 0.26), transparent 42%), radial-gradient(circle at 8% 120%, rgba(255,255,255,0.10), transparent 45%), linear-gradient(120deg, #2C3A47 0%, #4A6178 58%, #63819C 100%); }

/* ---------------- Unit switch strip ---------------- */
.unit-switch-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.unit-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; font-size: 14.5px; font-weight: 650;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--ink-soft);
  transition: border-color 0.18s var(--ease), transform 0.15s var(--ease), box-shadow 0.18s var(--ease);
}
.unit-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.unit-chip .ico-sm { width: 14px; height: 14px; }
.unit-chip.tone-primary { border-color: var(--primary-tint); color: var(--primary-dark); }
.unit-chip.tone-success { border-color: #BEE3CC; color: var(--success); }
.unit-chip.tone-info    { border-color: #C3D8EA; color: var(--info); }
.unit-chip.tone-accent  { border-color: #F0D2A6; color: var(--accent-dark); }
.unit-chip.tone-violet  { border-color: #D4CCE9; color: var(--violet); }
.unit-chip.tone-rose    { border-color: #EBC1CE; color: var(--rose); }
.unit-chip.tone-slate   { border-color: #C7D2DB; color: var(--slate); }

/* ---------------- Management & Staff category cards ---------------- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 24px; }
.category-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px; text-align: center; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.18s var(--ease);
}
.category-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--primary-tint); }
.category-card-icon {
  width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 13px;
  display: flex; align-items: center; justify-content: center;
}
.category-card-icon svg { width: 22px; height: 22px; }
.category-card-count { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.category-card-label { font-size: 14.5px; color: var(--muted); margin-top: 3px; }

/* ---------------- Chart cards (dashboard) ---------------- */
.chart-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-card-body { padding: 6px 20px 20px; display: flex; align-items: center; gap: 24px; }
.chart-canvas-wrap { flex-shrink: 0; width: 150px; height: 150px; position: relative; }
.chart-center-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.chart-center-label .n { font-family: var(--font-display); font-size: 25px; font-weight: 700; color: var(--ink); }
.chart-center-label .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.chart-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chart-legend-row { display: flex; align-items: center; gap: 9px; font-size: 14.6px; }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-label { flex: 1; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend-value { font-family: var(--font-mono); font-weight: 650; color: var(--ink); font-size: 14px; }

/* ---------------- Unit grid / cards (admin summary) ---------------- */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 15px; margin-bottom: 24px; }
.unit-card {
  display: block; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); color: inherit;
  transition: box-shadow 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.18s var(--ease);
}
.unit-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--primary-tint); color: inherit; }
.unit-card-icon {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary-dark);
}
.unit-card-icon svg { width: 21px; height: 21px; }
.unit-card.tone-success .unit-card-icon { background: var(--success-light); color: var(--success); }
.unit-card.tone-info    .unit-card-icon { background: var(--info-light); color: var(--info); }
.unit-card.tone-accent  .unit-card-icon { background: var(--accent-light); color: var(--accent-dark); }
.unit-card.tone-violet  .unit-card-icon { background: var(--violet-light); color: var(--violet); }
.unit-card.tone-rose    .unit-card-icon { background: var(--rose-light); color: var(--rose); }
.unit-card.tone-slate   .unit-card-icon { background: var(--slate-light); color: var(--slate); }
.unit-card-name { font-family: var(--font-display); font-size: 18.5px; font-weight: 650; margin-bottom: 2px; }
.unit-card-count { font-size: 14.5px; color: var(--muted); }
.unit-card-count strong { font-family: var(--font-mono); color: var(--ink); font-weight: 650; }
.unit-card-stats { display: flex; gap: 18px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--border-soft); }
.unit-card-stat { font-size: 13.3px; color: var(--muted); }
.unit-card-stat strong { display: block; font-family: var(--font-display); font-size: 18px; color: var(--ink); font-weight: 650; }
.unit-card-empty { font-size: 14px; color: var(--muted); margin-top: 13px; padding-top: 13px; border-top: 1px dashed var(--border); }

/* ---------------- Unit indicator dot (used in topnav unit chip) ---------------- */
.unit-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--accent); }
.unit-dot-success { background: #4FCE87; }
.unit-dot-info { background: #6FA8DE; }
.unit-dot-accent { background: var(--accent); }
.unit-dot-violet { background: #A493D9; }
.unit-dot-primary { background: #A78BFA; }
.unit-dot-rose { background: #D97C93; }
.unit-dot-slate { background: #8CA2B3; }

/* ---------------- Misc ---------------- */
.divider { height: 1px; background: var(--border-soft); margin: 20px 0; border: none; }
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 13px 16px; top: 60px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: span 1; }
  .dl { grid-template-columns: 120px 1fr; }
  .hero-title { font-size: 27px; }
}

/* ---------------- Excel-style inline-editable grid ---------------- */
table.xgrid td { padding: 3px; }
table.xgrid input[type=text] {
  border: 1.5px solid transparent; border-radius: 7px; padding: 7px 9px;
  font-size: 15px; background: transparent;
}
table.xgrid input[type=text]:hover { background: var(--surface-alt); }
table.xgrid input[type=text]:focus {
  background: var(--surface); border-color: var(--primary-mid); box-shadow: 0 0 0 3px var(--primary-light);
}
table.xgrid tr.xgrid-new-row input[type=text] { color: var(--ink-soft); }
table.xgrid tr.xgrid-new-row input[type=text]::placeholder { color: #B9C1C7; font-style: italic; }
table.xgrid tr.xgrid-new-row td:first-child { position: relative; }
.xgrid-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.xgrid-del:hover { background: var(--danger-light); color: var(--danger); }
.xgrid-del input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.xgrid-del:has(input:checked) { background: var(--danger); color: #fff; }
table.xgrid tr:has(.xgrid-del input:checked) td input { text-decoration: line-through; opacity: 0.45; }

/* ---------------- Organization chart (organogram style) ---------------- */
.og-chart-wrap { overflow-x: auto; padding: 20px 6px 30px; }
.og-tree { display: flex; justify-content: center; min-width: max-content; }
.og-node { display: flex; flex-direction: column; align-items: center; }
.og-children { display: flex; flex-direction: row; justify-content: center; position: relative; padding-top: 30px; }
.og-children::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 30px;
  background: var(--border); transform: translateX(-1px); z-index: 0;
}
.og-child { position: relative; padding: 0 16px; display: flex; flex-direction: column; align-items: center; }
.og-child::before {
  content: ""; position: absolute; top: -30px; left: 0; right: 0; height: 2px; background: var(--border); z-index: 0;
}
.og-child::after {
  content: ""; position: absolute; top: -30px; left: 50%; width: 2px; height: 30px;
  background: var(--border); transform: translateX(-1px); z-index: 0;
}
.og-children-single > .og-child::before { display: none; }
.og-child:only-child::before { display: none; }
.og-child:first-child:not(:only-child)::before { left: 50%; }
.og-child:last-child:not(:only-child)::before { right: 50%; }

.og-box {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  border-radius: 10px; padding: 8px 30px 8px 8px;
  width: 232px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  transition: box-shadow 0.15s var(--ease), transform 0.12s var(--ease);
}
.og-box:hover { box-shadow: var(--shadow); }
.og-draggable { cursor: grab; }
.og-draggable:active { cursor: grabbing; }
.og-drop-target { outline: 3px solid var(--accent); outline-offset: 2px; transform: scale(1.03); }

.og-photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.85); flex-shrink: 0; }
.og-photo-fallback { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.35); color: inherit; font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.og-box-body { min-width: 0; flex: 1; }
.og-box-name { display: block; font-family: var(--font-display); font-weight: 650; font-size: 14.6px; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.og-box-name sup { font-size: 11px; }
.og-box-role { font-size: 12.6px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }
.og-box-area { font-size: 12.3px; font-weight: 650; opacity: 0.95; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 168px; }

.og-box.tone-primary { background: linear-gradient(155deg, #5B21B6, var(--primary-dark)); color: #F3ECFF; }
.og-box.tone-success { background: linear-gradient(155deg, #3CA968, #1D6B44); color: #EAF9EF; }
.og-box.tone-info    { background: linear-gradient(155deg, #4D89C2, #22405E); color: #EAF2FB; }
.og-box.tone-accent  { background: linear-gradient(155deg, #C084FC, #6B21A8); color: #FFF6EA; }
.og-box.tone-violet  { background: linear-gradient(155deg, #8474C2, #402F68); color: #F4F1FB; }
.og-box.tone-rose    { background: linear-gradient(155deg, #C85D7B, #742840); color: #FBEEF1; }
.og-box.tone-slate   { background: linear-gradient(155deg, #63819C, #2C3A47); color: #EDF2F5; }

.og-edit-btn {
  position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.18); border: none; color: inherit; cursor: pointer;
  opacity: 0; transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}
.og-box:hover .og-edit-btn { opacity: 0.85; }
.og-edit-btn:hover { background: rgba(255,255,255,0.32); opacity: 1; }
.og-edit-btn svg { width: 12px; height: 12px; }

.og-reorder-wrap { display: flex; gap: 3px; position: absolute; bottom: 5px; right: 5px; opacity: 0; transition: opacity 0.15s var(--ease); }
.og-box:hover .og-reorder-wrap { opacity: 0.85; }
.og-reorder-btn {
  width: 17px; height: 17px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.18); border: none; color: inherit; cursor: pointer;
}
.og-reorder-btn:hover { background: rgba(255,255,255,0.32); }
.og-reorder-btn svg { width: 10px; height: 10px; }
.og-reorder-btn[disabled] { opacity: 0.25; cursor: default; pointer-events: none; }

/* ---------------- Staff Employees strip ---------------- */
.og-staff-strip { margin-top: 20px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.og-staff-strip-label { background: var(--surface-alt); padding: 9px 18px; font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
.og-staff-strip-people { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px; }
.og-strip-box { display: flex; align-items: center; gap: 8px; background: var(--surface-alt); border: 1px solid var(--border-soft); border-radius: 9px; padding: 6px 12px 6px 6px; }
.og-strip-box .og-box-name { color: var(--ink); max-width: 130px; }
.og-strip-box .og-box-role { color: var(--muted); max-width: 130px; }
.og-strip-box .og-photo-fallback { background: var(--primary-light); color: var(--primary-dark); }

/* ---------------- Legend ---------------- */
.og-legend { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; font-size: 14px; color: var(--ink-soft); }
.og-legend-row { display: flex; align-items: center; gap: 7px; }
.og-legend-form { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; width: 100%; justify-content: flex-end; }
.og-legend-form .og-legend-row input[type=text] { width: 220px; padding: 5px 9px; font-size: 14px; }

/* ---------------- Edit modal ---------------- */
.og-modal { position: fixed; inset: 0; background: rgba(8,47,56,0.45); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.og-modal-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 26px; width: 100%; max-width: 360px; }

@media (max-width: 900px) {
  .og-box { min-width: 150px; }
}

/* ---------------- Unit pill (employee cards) ---------------- */
.pill-unit { font-weight: 650; }
.pill-working-area { background: var(--slate-light); color: var(--slate); font-weight: 600; }
.pill-working-area::before { display: none; }
.pill-on-training { background: var(--accent-light); color: var(--accent-dark); font-weight: 650; }
.pill-on-training::before { display: none; }
.pill-unit.tone-primary::before { display: none; }
.pill-unit.tone-primary { background: var(--primary-light); color: var(--primary-dark); }
.pill-unit.tone-success { background: var(--success-light); color: var(--success); }
.pill-unit.tone-info    { background: var(--info-light); color: var(--info); }
.pill-unit.tone-accent  { background: var(--accent-light); color: var(--accent-dark); }
.pill-unit.tone-violet  { background: var(--violet-light); color: var(--violet); }
.pill-unit.tone-rose    { background: var(--rose-light); color: var(--rose); }
.pill-unit.tone-slate   { background: var(--slate-light); color: var(--slate); }
.pill-unit::before { display: none; }

/* =====================================================================
   PURPLE EDITION — premium layer (added on top of the base theme)
   Palette: aubergine #1E0B3E · royal #3B0F75 · violet #6D28D9 ·
            orchid #D946EF · lilac #F1EAFE · paper #F6F3FB
   ===================================================================== */
:root {
  --grad-cta: linear-gradient(135deg, #7C3AED 0%, #A855F7 55%, #D946EF 100%);
  --grad-deep: linear-gradient(120deg, #1E0B3E 0%, #3B0F75 55%, #5B21B6 100%);
  --ring: 0 0 0 3px rgba(168, 85, 247, 0.28);
}
body {
  background:
    radial-gradient(1100px 520px at 100% -10%, rgba(217, 70, 239, 0.08), transparent 60%),
    radial-gradient(900px 480px at -10% 0%, rgba(109, 40, 217, 0.09), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: rgba(168, 85, 247, 0.25); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: #C9B5F2 transparent; }

/* nav: deep aubergine with a single orchid glow at the brand end */
.topnav {
  background:
    radial-gradient(600px 120px at 8% 0%, rgba(217, 70, 239, 0.28), transparent 70%),
    var(--grad-deep);
  box-shadow: 0 8px 30px -12px rgba(30, 11, 62, 0.65);
}
.topnav-brand-mark { background: var(--grad-cta); color: #fff; box-shadow: 0 6px 16px -6px rgba(217, 70, 239, 0.8); }
.topnav-link.active, .topnav-drop-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.14); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  margin-left: 6px; border-radius: 10px; background: #F0ABFC; color: #3B0F75; font-size: 12px; font-weight: 800;
}
.user-menu { position: relative; }
.user-chip { cursor: pointer; background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px; font-family: var(--font-body); }
.user-chip .dot { background: var(--grad-cta); color: #fff; }
.user-drop { right: 0; left: auto; min-width: 250px; }
.user-drop-head { padding: 10px 14px 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.user-drop-head strong { display: block; font-size: 15px; color: var(--ink); }
.user-drop-head small { color: var(--muted); font-size: 13px; }

/* buttons */
.btn-accent { background: var(--grad-cta); color: #fff; border: none; box-shadow: 0 8px 22px -10px rgba(168, 85, 247, 0.9); }
.btn-accent:hover { color: #fff; box-shadow: 0 12px 28px -10px rgba(217, 70, 239, 0.9); transform: translateY(-1px); }
.btn-primary { background: var(--grad-deep); }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 12px; }

/* dashboard hero: aubergine field, one orchid glow, fine grid */
.hero {
  background:
    radial-gradient(520px 260px at 92% 0%, rgba(217, 70, 239, 0.45), transparent 70%),
    radial-gradient(420px 300px at 0% 100%, rgba(124, 58, 237, 0.35), transparent 70%),
    var(--grad-deep) !important;
}
.hero::before { background-image: linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px) !important; background-size: 28px 28px !important; }

.card { border: 1px solid rgba(91, 33, 182, 0.08); }
.tabs .tab.active, .tab.active { color: var(--primary); }

/* ------------------------------------------------ sign-in family */
.auth-body { margin: 0; min-height: 100vh; background: #F6F3FB; }
.auth-split { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; color: #EDE4FF; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(640px 360px at 85% 10%, rgba(217, 70, 239, 0.40), transparent 70%),
    radial-gradient(520px 420px at 0% 100%, rgba(124, 58, 237, 0.45), transparent 70%),
    var(--grad-deep);
}
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 19px; color: #fff; position: relative; z-index: 1; }
.auth-brand small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 13px; color: #CDB9F4; }
.auth-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--grad-cta); color: #fff; font-weight: 800; box-shadow: 0 10px 24px -8px rgba(217, 70, 239, 0.9); }
.plant-line { width: 100%; max-width: 620px; align-self: center; position: relative; z-index: 1; }
.plant-line .pl { stroke: #E9D5FF; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 900; stroke-dashoffset: 900; animation: pl-draw 2.6s cubic-bezier(.6,.05,.2,1) forwards; }
.plant-line .pl-ground { stroke: rgba(233, 213, 255, 0.35); stroke-width: 1.5; }
.plant-line .flow { stroke: #F0ABFC; animation-delay: .5s; }
.plant-line .pl-dot { fill: #F0ABFC; opacity: 0; animation: pl-dot .6s 2.4s forwards; }
@keyframes pl-draw { to { stroke-dashoffset: 0; } }
@keyframes pl-dot { to { opacity: 1; } }
.auth-art-copy { position: relative; z-index: 1; max-width: 460px; }
.auth-art-copy h2 { font-family: var(--font-display); font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; color: #fff; margin: 0 0 12px; font-weight: 800; }
.auth-art-copy p { color: #D8C8F7; font-size: 16px; line-height: 1.55; margin: 0; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-family: var(--font-display); font-size: 32px; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--primary-dark); }
.auth-sub { color: var(--muted); margin: 0 0 24px; font-size: 15.5px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form input { height: 48px; border-radius: 12px; font-size: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 13px; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.auth-link { display: block; text-align: center; margin-top: 16px; font-weight: 600; color: var(--primary-mid); }
.auth-foot { max-width: 400px; color: var(--muted); font-size: 13px; text-align: center; margin-top: 28px; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-art { padding: 28px; min-height: 260px; } .auth-art-copy h2 { font-size: 28px; } }
@media (prefers-reduced-motion: reduce) { .plant-line .pl { animation: none; stroke-dashoffset: 0; } .plant-line .pl-dot { opacity: 1; animation: none; } }

/* ------------------------------------------------ users page */
.users-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.users-form .field { margin-bottom: 14px; }
@media (max-width: 1100px) { .users-layout { grid-template-columns: 1fr; } }

/* ------------------------------------------------ evaluation forms */
.eval-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.eval-status { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.eval-status-draft { background: #EEEAF5; color: #5B5470; }
.eval-status-in_review { background: #F5EDFF; color: #7E22CE; }
.eval-status-returned { background: #FDECEC; color: #B42318; }
.eval-status-approved { background: #E7F6EE; color: #1E7A4C; }
.eval-route { display: flex; align-items: center; gap: 0; margin-left: auto; }
.route-step { position: relative; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 12px 6px 22px; }
.route-step::before { content: ""; position: absolute; left: 6px; top: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translateY(-50%); background: #D9D2E6; }
.route-step + .route-step { margin-left: 4px; }
.route-step.done { color: #1E7A4C; } .route-step.done::before { background: #22A06B; }
.route-step.now { color: #7E22CE; } .route-step.now::before { background: #D946EF; box-shadow: 0 0 0 4px rgba(217, 70, 239, 0.2); }

.eval-paper { background: var(--surface); border: 1px solid rgba(91, 33, 182, 0.12); border-radius: 18px; padding: 28px 32px; box-shadow: 0 20px 50px -30px rgba(59, 15, 117, 0.45); max-width: 1180px; }
.eval-paper fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--primary-dark); padding-bottom: 14px; margin-bottom: 18px; }
.paper-head h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 24px; color: var(--primary-dark); letter-spacing: -0.01em; }
.paper-code { color: var(--muted); font-size: 13.5px; }
.paper-logo { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: 0.08em; color: var(--primary-mid); }
.paper-ids { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 20px; margin-bottom: 22px; }
.paper-ids > div { display: flex; flex-direction: column; gap: 4px; }
.paper-ids .span-all { grid-column: 1 / -1; }
.paper-ids label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.paper-ids span { font-weight: 650; font-size: 15.5px; padding: 8px 0; border-bottom: 1px dashed #D9D2E6; }
.paper-section { border-top: 1px solid var(--border-soft); padding-top: 18px; margin-top: 18px; }
.section-tag { display: inline-block; font-weight: 800; font-size: 13px; color: #fff; background: var(--primary-mid); border-radius: 6px; padding: 4px 10px; margin-bottom: 12px; }
.score-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.score-table th, .score-table td { border: 1px solid #DDD5EA; padding: 6px 10px; font-size: 14px; text-align: left; vertical-align: middle; }
.score-table thead th { background: #F5F0FC; font-weight: 700; color: var(--primary-dark); }
.score-table td:first-child { width: 36px; text-align: center; color: var(--muted); }
.score-table td input:not([type=radio]), .score-table td select { width: 100%; }
.score-row { display: flex; gap: 4px; flex-wrap: nowrap; }
.score-pill input { position: absolute; opacity: 0; pointer-events: none; }
.score-pill span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid #DDD5EA; font-weight: 700; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; background: #fff; transition: all .12s; }
.score-pill:hover span { border-color: #A855F7; color: #7E22CE; }
.score-pill input:checked + span { background: var(--grad-cta); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px rgba(168, 85, 247, 0.9); }
.score-pill input:focus-visible + span { box-shadow: var(--ring); }
.group-table .grp-cell { text-align: center; max-width: 90px; }
.score-total { text-align: right; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.score-total strong { color: var(--primary-dark); }
.choice-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 12px 0; }
.choice-line > span:first-child { font-weight: 600; min-width: 260px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid #DDD5EA; font-size: 14px; cursor: pointer; background: #fff; }
.choice input:checked + span { background: var(--primary-light); border-color: #A855F7; color: #6B21A8; font-weight: 700; }
.choice input:focus-visible + span { box-shadow: var(--ring); }
.inline-input { max-width: 160px; }
.sig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.sig-box { border: 1px dashed #CDBFE4; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 74px; }
.sig-box.signed { border-style: solid; border-color: #9FD9BC; background: #F3FBF7; }
.sig-role { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sig-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #14532D; }
.sig-date { font-size: 12.5px; color: #3F6B55; }
.sig-pending { font-size: 13.5px; color: #A79CBD; font-style: italic; margin-top: 6px; }
fieldset[disabled] .score-pill span, fieldset[disabled] .choice span { cursor: default; }
fieldset[disabled] input, fieldset[disabled] textarea, fieldset[disabled] select { background: transparent; }
.eval-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border-soft); padding-top: 18px; margin-top: 22px; }
.eval-history { margin-top: 20px; max-width: 1180px; }
.timeline { list-style: none; margin: 0; padding: 8px 24px 20px; }
.timeline li { position: relative; padding: 8px 0 8px 22px; border-left: 2px solid #E4D8F9; font-size: 14.5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #A855F7; }
.timeline li.tl-approved::before { background: #22A06B; }
.timeline li.tl-returned::before { background: #D92D20; }
.tl-comment { margin-top: 4px; padding: 8px 12px; background: #F9F7FD; border-radius: 8px; color: var(--ink-soft); }
@media (max-width: 900px) { .paper-ids { grid-template-columns: 1fr; } .eval-paper { padding: 18px; } .score-row { flex-wrap: wrap; } .eval-route { margin-left: 0; } }
@media print {
  .topnav, .sidebar, .no-print, .topbar, .flash { display: none !important; }
  body { background: #fff !important; }
  .content { padding: 0 !important; }
  .eval-paper { box-shadow: none; border: none; padding: 0; max-width: none; }
  .score-pill span { width: 22px; height: 22px; font-size: 11px; }
  .score-pill input:checked + span { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .choice input:not(:checked) + span { opacity: .45; }
  @page { size: A4; margin: 10mm; }
}
/* evaluation paper: every free-text box gets the same field treatment */
.eval-paper input:not([type=radio]):not([type=checkbox]):not([type=hidden]), .eval-paper textarea, .eval-paper select {
  width: 100%; box-sizing: border-box; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  border: 1px solid #DDD5EA; border-radius: 10px; padding: 9px 12px; background: #fff; min-height: 42px;
}
.eval-paper textarea { min-height: 64px; resize: vertical; }
.eval-paper .score-table input, .eval-paper .score-table select { min-height: 34px; padding: 5px 8px; border-radius: 8px; }
.eval-paper .inline-input { width: 170px; }
.eval-paper input:focus, .eval-paper textarea:focus, .eval-paper select:focus { outline: none; border-color: #A855F7; box-shadow: var(--ring); }
.eval-paper fieldset[disabled] input, .eval-paper fieldset[disabled] textarea, .eval-paper fieldset[disabled] select { background: #FBFAFE; color: var(--ink); border-style: dashed; }
.users-layout > * { min-width: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions form { margin: 0; }
.users-list .badge { font-family: var(--font-body); }

/* ---------------- Main List card v2: every card has the same three rows ---------------- */
.emp-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.emp-card.mc { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 18px 18px 16px;
  text-decoration: none; color: inherit; border-radius: 16px; position: relative; overflow: hidden; }
.emp-card.mc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.emp-card.mc.mc-is-training::before { background: linear-gradient(180deg, #A855F7, #D946EF); }
.mc-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; }
.mc-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--primary-light);
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--primary-tint); }
.mc-initials { display: grid; place-items: center; font-weight: 700; color: var(--primary-mid); font-size: 18px; }
.mc-id { min-width: 0; }
.mc-name { font-family: var(--font-display); font-size: 17.5px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-role { font-size: 14px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-pno { align-self: start; font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--primary-mid);
  background: var(--primary-light); border-radius: 8px; padding: 4px 8px; white-space: nowrap; }
.mc-rows { margin: 0; border-top: 1px solid var(--border-soft); padding-top: 4px; }
.mc-row { display: grid; grid-template-columns: 104px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed #ECE6F5; }
.mc-row:last-child { border-bottom: none; }
.mc-row dt { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mc-row dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.mc-area { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); background: #F3F1F7; border-radius: 8px; padding: 4px 9px; }
.mc-train { font-size: 13.5px; font-weight: 700; color: #7E22CE; background: #F5EDFF; border: 1px solid #E9D5FF; border-radius: 8px; padding: 3px 9px;
  display: inline-flex; align-items: center; gap: 6px; }
.mc-train::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #D946EF; box-shadow: 0 0 0 3px rgba(217, 70, 239, 0.18); }
.mc-none { color: #C4BCD3; font-weight: 600; }
.mc-is-training .mc-row-training { background: linear-gradient(90deg, rgba(245, 237, 255, 0.9), rgba(245, 237, 255, 0)); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }

/* ---------------- Experience Profile cards (xc-) ---------------- */
.xc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 18px; }
.xc { background: var(--surface); border: 1px solid rgba(91, 33, 182, 0.12); border-radius: 18px; padding: 18px 20px 16px; scroll-margin-top: 90px;
  box-shadow: 0 14px 34px -26px rgba(59, 15, 117, 0.5); }
.xc fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.xc-head { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.xc-photo { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: var(--primary-light); box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--primary-tint); }
.xc-ini { display: grid; place-items: center; font-weight: 700; color: var(--primary-mid); }
.xc-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--primary-dark); text-decoration: none; }
.xc-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.xc-total { text-align: right; background: var(--grad-deep); color: #fff; border-radius: 12px; padding: 7px 12px; }
.xc-total span { display: block; font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .05em; }
.xc-total strong { font-family: var(--font-mono); font-size: 20px; }
.xc-label { font-size: 12px; font-weight: 800; color: var(--primary-mid); text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 8px; }
.xc-label small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.xc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.xc-cell { border: 1px solid #E6E0F0; border-radius: 10px; padding: 7px 9px; background: #FCFBFE; }
.xc-cell.has { border-color: #C9B5F2; background: #F7F1FF; }
.xc-sec { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; }
.xc-ym { display: flex; align-items: center; gap: 3px; }
.xc-ym input { width: 44px; min-height: 30px !important; height: 30px; padding: 2px 4px !important; text-align: center; font-size: 14px; border-radius: 7px !important; }
.xc-ym em { font-style: normal; font-size: 12px; color: var(--muted); margin-right: 4px; }
.xc-other { font-size: 13px; color: var(--muted); margin-top: 8px; }
.xc-other label { margin-left: 8px; font-size: 12.5px; }
.xc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.xc-two .field { margin: 0; }
.xc-plan { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.xc-year { border: 1px solid #E6E0F0; border-radius: 10px; padding: 6px 8px; text-align: center; }
.xc-year.has { border-color: #E9A8F5; background: #FDF4FF; }
.xc-year span { display: block; font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--primary-mid); margin-bottom: 4px; }
.xc-year select { width: 100%; min-height: 30px !important; height: 30px; padding: 2px 4px !important; font-size: 13px; }
.xc-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 14px; }
.xc-dirty { font-size: 12.5px; font-weight: 700; color: #B45309; background: #FEF3C7; border-radius: 6px; padding: 3px 8px; }
@media (max-width: 700px) { .xc-list { grid-template-columns: 1fr; } .xc-grid { grid-template-columns: repeat(2, 1fr); } .xc-plan { grid-template-columns: repeat(3, 1fr); } }

/* ---------------- Experience summary sheet (xs-) ---------------- */
.xs-title { text-align: center; margin-bottom: 12px; }
.xs-title h2 { margin: 0; font-family: var(--font-display); color: var(--primary-dark); }
.xs-title div { font-weight: 700; color: var(--ink-soft); }
.xs-wrap { max-height: calc(100vh - 270px); overflow: auto; }
.xs { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.xs th, .xs td { border: 1px solid #555; padding: 4px 6px; white-space: nowrap; }
.xs thead th { background: #D8C8F5; color: #1E0B3E; font-weight: 700; text-align: center; position: sticky; top: 0; z-index: 2; }
.xs thead tr:nth-child(2) th { top: 29px; }
.xs .xs-sub { font-size: 12px; }
.xs .xs-c { text-align: center; }
.xs .xs-name { text-align: left; }
.xs .xs-name a { color: var(--ink); text-decoration: none; font-weight: 600; }
.xs .xs-num { font-family: var(--font-mono); font-weight: 700; }
.xs .xs-has { background: #F7F1FF; }
.xs .xs-total { background: #EDE3FC; }
.xs .xs-plan { font-weight: 700; color: #7E22CE; }
.xs-band td { background: #E8DDFA; font-weight: 700; color: #3B0F75; }
.xs-band-top td { background: #D8C8F5; }
.xs tbody tr:not(.xs-band):hover td { background: #FBF8FF; }
@media print {
  .xs-wrap { max-height: none; overflow: visible; }
  .xs { font-size: 8px; } .xs th, .xs td { padding: 2px 3px; border-color: #000; }
  .xs-card { box-shadow: none !important; border: none !important; padding: 0 !important; }
  @page { size: A3 landscape; margin: 8mm; }
}

/* ---------------- Org chart: fit-to-screen + wrapped rows ---------------- */
.og-chart-wrap { overflow: visible; position: relative; }
.og-viewport { position: relative; overflow: hidden; width: 100%; }
.og-viewport .og-tree { transform-origin: top left; display: inline-flex; min-width: 0; }
.og-zoom { position: absolute; top: 12px; right: 14px; z-index: 5; display: flex; gap: 4px; }
.og-zoom button { border: 1px solid #DDD5EA; background: #fff; color: var(--primary-dark); font-weight: 800; border-radius: 8px; min-width: 34px; height: 30px; cursor: pointer; }
.og-zoom button:hover { background: var(--primary-light); }
.og-rows { display: flex; flex-direction: column; align-items: center; }
.og-children.og-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
/* the manager's line keeps running down through the middle gap to the next row */
.og-children.og-pass::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--border); transform: translateX(-1px); z-index: 0; }
@media print { .og-viewport { overflow: visible !important; } }

/* ---------------- Org chart v2: grows downward ---------------- */
.og-children.og-grid { grid-auto-columns: auto; }
.og-stack { display: flex; flex-direction: column; padding-top: 22px; }
.og-srow { display: grid; grid-template-columns: 1fr 30px 1fr; align-items: center; }
.og-srow + .og-srow { margin-top: 10px; }
.og-sl { justify-self: end; } .og-sr { justify-self: start; }
.og-sl .og-box, .og-sr .og-box { margin-bottom: 0; }
.og-sp { position: relative; align-self: stretch; }
.og-sp::before { content: ""; position: absolute; left: 14px; width: 2px; top: -10px; bottom: 0; background: var(--border); }
.og-srow:last-child .og-sp::before { bottom: 50%; }
.og-first .og-sp::before { top: -22px; }
.og-sp::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--border); transform: translateY(-1px); }
.og-one .og-sp::after { right: 50%; }
.og-areas-card { margin-top: 16px; }
.og-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 14px; padding: 16px 20px 20px; }
.og-area { border: 1px solid #E6E0F0; border-radius: 14px; background: #FCFBFE; padding: 10px; }
.og-area.og-drop-target { outline: 3px dashed #A855F7; outline-offset: 2px; }
.og-area-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--primary-dark); padding: 2px 4px 10px; }
.og-area-head b { background: var(--primary-light); color: var(--primary-mid); border-radius: 999px; padding: 2px 9px; font-size: 12.5px; }
.og-area-list { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.og-area-list .og-box { margin-bottom: 0; }

/* ---------------- Department organogram sheet (All units) ---------------- */
.os-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.os-frame { position: relative; overflow: hidden; width: 100%; }
.os-sheet { transform-origin: top left; width: max-content; min-width: 1700px; background: #fff; padding: 20px 26px 18px; color: #1c1c28; }
.os-hd { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid #1E0B3E; padding-bottom: 10px; margin-bottom: 16px; gap: 30px; }
.os-hd h1 { font-family: var(--font-display); font-size: 38px; margin: 0; color: #1E0B3E; letter-spacing: -.01em; }
.os-ffc { font-family: var(--font-display); font-weight: 800; font-size: 30px; color: #3B0F75; letter-spacing: .08em; }
.os-rev { font-weight: 700; color: #6B21A8; background: #F3ECFF; border-radius: 10px; padding: 6px 12px; }
.os-top { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.os-row { display: flex; gap: 110px; justify-content: center; position: relative; }
.os-top .os-row + .os-row::before { content: ""; position: absolute; top: -18px; left: 50%; width: 2px; height: 18px; background: #555; }
.os-t { display: flex; align-items: center; gap: 6px; }
.os-ph { display: flex; flex-direction: column; gap: 3px; }
.os-ph img, .os-ini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 0 0 2px #cfd3da; }
.os-ini { display: grid; place-items: center; background: #EDE6F8; color: #5B21B6; font-weight: 800; font-size: 13px; }
.os-big .os-ph img, .os-big .os-ini { width: 54px; height: 54px; }
.os-bx { width: 158px; border: 1px solid #9aa3ad; box-shadow: 2px 3px 0 #c9ced6; }
.os-big .os-bx { width: 190px; }
.os-nm { color: #fff; font-weight: 700; font-size: 13.5px; padding: 5px 8px; text-align: center; line-height: 1.25; }
.os-nm a { color: inherit; text-decoration: none; }
.os-nm sup { font-size: 10px; margin-left: 1px; }
.os-sb { font-size: 12.5px; padding: 4px 8px; text-align: center; font-weight: 600; }
.os-lead .os-nm { background: #6AA84F; } .os-lead .os-sb { background: #E6F2DD; }
.os-coord .os-nm { background: #E3B341; color: #2b2100; } .os-coord .os-sb { background: #FFF4CC; }
.os-urea .os-nm { background: #D2691E; } .os-urea .os-sb { background: #FBE3CF; }
.os-amm .os-nm { background: #2F6DB5; } .os-amm .os-sb { background: #DCE8F7; }
.os-uty .os-nm { background: #B5651D; } .os-uty .os-sb { background: #F6E2CC; }
.os-gcf .os-nm { background: #5A6F8C; } .os-gcf .os-sb { background: #DDE3EC; }
.os-bs .os-nm { background: #7A7F88; } .os-bs .os-sb { background: #E3E5E8; }
.os-pp .os-nm { background: #8E3B6E; } .os-pp .os-sb { background: #F4E0EC; }
.os-ps .os-nm { background: #3E7C74; } .os-ps .os-sb { background: #DCEEEB; }
.os-co .os-nm { background: #6B4FA0; } .os-co .os-sb { background: #EAE3F6; }
.os-plain .os-nm { background: #fff; color: #1c1c28; border-bottom: 1px solid #9aa3ad; }
.os-units { display: flex; justify-content: space-between; gap: 22px; margin-top: 34px; position: relative; padding-top: 24px; border-top: 2px solid #555; }
.os-unit { display: flex; flex-direction: column; align-items: center; position: relative; }
.os-unit::before { content: ""; position: absolute; top: -24px; left: 50%; width: 2px; height: 24px; background: #555; }
.os-subs { display: flex; gap: 10px; margin-top: 18px; position: relative; padding-top: 18px; }
.os-subs::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: #555; }
.os-subs::after { content: ""; position: absolute; top: -18px; left: 50%; width: 2px; height: 18px; background: #555; }
.os-subs.os-one::before { display: none; }
.os-col { display: flex; flex-direction: column; gap: 12px; position: relative; }
.os-col::before { content: ""; position: absolute; top: -18px; left: calc(50% + 23px); width: 2px; height: 18px; background: #555; }
.os-subs.os-one .os-col::before { display: none; }
.os-staff { margin-top: 26px; border-top: 2px solid #1E0B3E; padding-top: 10px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.os-lbl { font-family: var(--font-display); font-weight: 700; font-size: 20px; background: #E5E7EB; padding: 8px 14px; border-radius: 8px; }
@media print {
  body.os-printing * { visibility: hidden !important; }
  body.os-printing .os-sheet, body.os-printing .os-sheet * { visibility: visible !important; }
  body.os-printing .os-frame { overflow: visible; height: auto !important; }
  body.os-printing .os-sheet { position: fixed; left: 0; top: 0; transform: none !important; zoom: var(--os-print-zoom, 0.8); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A3 landscape; margin: 8mm; }
}
.os-un { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; text-align: center; padding: 2px 6px; background: #fff; color: #5B5470; border-top: 1px solid #d9dde3; }

/* ---------------- Department dashboard (db-) ---------------- */
.db-hero { position: relative; border-radius: 22px; overflow: hidden; min-height: 300px; color: #fff; display: grid; grid-template-columns: 1fr 1.1fr;
  background: linear-gradient(120deg, #1E0B3E, #3B0F75 60%, #5B21B6); box-shadow: 0 24px 50px -30px rgba(30, 11, 62, .8); }
.db-hero-l { padding: 30px 34px; position: relative; z-index: 2; }
.db-eyebrow { font-size: 12.5px; letter-spacing: .14em; font-weight: 800; color: #D8C8F7; }
.db-hero h1 { font-family: var(--font-display); font-size: 40px; margin: 10px 0 8px; letter-spacing: -.02em; color: #fff; }
.db-hero p { color: #E3D8FA; margin: 0 0 22px; max-width: 540px; line-height: 1.5; }
.db-hk { display: flex; gap: 28px; flex-wrap: wrap; }
.db-hk b { display: block; font-family: var(--font-display); font-size: 34px; }
.db-hk span { font-size: 13px; color: #D8C8F7; }
.db-hk .hi b { color: #F0ABFC; }
.db-hero-r { position: relative; background-size: cover; background-position: center; min-height: 300px; }
.db-hero-r svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-hero-r[style]::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #3B0F75 0%, rgba(59, 15, 117, 0) 35%); }
.db-date { position: absolute; right: 26px; top: 22px; text-align: right; z-index: 3; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }
.db-date b { font-family: var(--font-display); font-size: 22px; display: block; }
.db-date span { font-size: 13px; color: #F3ECFF; }
.db-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin: 18px 0; }
.db-kpi { background: #fff; border: 1px solid #ECE6F5; border-radius: 16px; padding: 16px 18px; position: relative; overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.db-kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -20px rgba(91, 33, 182, .6); }
.db-kpi .v { font-family: var(--font-display); font-size: 32px; font-weight: 800; color: #1E0B3E; position: relative; z-index: 1; }
.db-kpi .t { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.db-kpi .s { font-size: 12.5px; margin-top: 8px; font-weight: 700; color: #7E22CE; }
.db-kpi::after { content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: #F3ECFF; }
.db-kpi .ic { position: absolute; right: 14px; top: 14px; z-index: 1; font-size: 20px; }
.db-units { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.db-unit { background: #fff; border: 1px solid #ECE6F5; border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.db-unit:hover { transform: translateY(-3px); box-shadow: 0 16px 34px -22px rgba(59, 15, 117, .6); }
.db-unit-top { height: 92px; position: relative; background-size: cover; background-position: center; overflow: hidden; }
.db-unit-top svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-unit-b { padding: 12px 16px 16px; }
.db-unit h4 { margin: 0; font-family: var(--font-display); font-size: 19px; color: var(--ink); }
.db-unit .n { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.db-bar { display: flex; height: 9px; border-radius: 6px; overflow: hidden; background: #F1EDF7; margin-bottom: 6px; }
.db-bar i { display: block; }
.db-lg { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.db-lg i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.db-tc { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 10px; font-weight: 700; }
.db-tc em { font-style: normal; color: #7E22CE; }
.db-row { display: grid; gap: 16px; margin-bottom: 16px; }
.db-r3 { grid-template-columns: 1.25fr 1fr 1fr; }
.db-r2 { grid-template-columns: 1.6fr 1fr; }
.db-card { display: block; background: #fff; border: 1px solid #ECE6F5; border-radius: 18px; padding: 18px 20px; box-shadow: 0 14px 34px -28px rgba(59, 15, 117, .5); text-decoration: none; color: inherit; }
.db-card h3 { margin: 0 0 3px; font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.db-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.db-bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.db-bars a { flex: 1; text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; text-decoration: none; }
.db-bars .col { background: linear-gradient(180deg, #A855F7, #6D28D9); border-radius: 8px 8px 3px 3px; margin: 0 auto 6px; width: 70%; position: relative; }
.db-bars .col b { position: absolute; top: -19px; left: 0; right: 0; color: #3B0F75; font-size: 13px; }
.db-donut { display: flex; align-items: center; gap: 18px; }
.db-lgl { font-size: 13.5px; line-height: 2; }
.db-lgl i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
.db-pipe .step { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin: 10px 0 5px; }
.db-pipe .track { height: 12px; border-radius: 8px; background: #F1EDF7; overflow: hidden; }
.db-pipe .track i { display: block; height: 100%; border-radius: 8px; }
.db-pipe .note { font-size: 12.5px; color: #7E22CE; font-weight: 700; margin-top: 12px; }
.db-gal { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.db-gal .ph { border-radius: 14px; overflow: hidden; position: relative; height: 200px; background-size: cover; background-position: center; }
.db-gal .ph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-gal .cap { position: absolute; left: 10px; bottom: 10px; background: rgba(20, 8, 40, .55); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; z-index: 1; }
.db-list > * { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #ECE6F5; font-size: 14px; color: inherit; text-decoration: none; }
.db-list > *:last-child { border: none; }
.db-list .av { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg, #E9D5FF, #F5D0FE); display: grid; place-items: center; font-weight: 800; color: #6B21A8; font-size: 13px; }
.db-list em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: 12.5px; color: #7E22CE; background: #F3ECFF; padding: 3px 8px; border-radius: 7px; white-space: nowrap; }
.db-qa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.db-qa a { display: block; padding: 13px 14px; border-radius: 12px; background: #F3ECFF; color: #3B0F75; font-weight: 800; text-decoration: none; font-size: 14px; }
.db-qa a.cta { background: var(--grad-cta); color: #fff; }
@media (max-width: 1200px) { .db-kpis { grid-template-columns: repeat(3, 1fr); } .db-r3, .db-r2 { grid-template-columns: 1fr; } .db-hero { grid-template-columns: 1fr; } .db-hero-r { min-height: 200px; } }
/* plant photos page */
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.pp-item { margin: 0; background: #fff; border: 1px solid #ECE6F5; border-radius: 14px; overflow: hidden; }
.pp-item img { width: 100%; height: 170px; object-fit: cover; display: block; }
.pp-item figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; }
.pp-item form { margin: 0; }
.os-units-one { justify-content: center; border-top: none; padding-top: 0; margin-top: 10px; }
.os-units-one .os-unit::before { display: none; }
.os-areas-hd { margin-top: 26px; border-top: 2px solid #1E0B3E; padding-top: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.os-areas { display: grid; grid-template-columns: repeat(5, 230px); gap: 16px 18px; margin-top: 12px; justify-content: center; }
.os-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.os-area-bx { width: 206px !important; }
.os-area-list { display: flex; flex-direction: column; gap: 10px; }
