/* =====================================================================
   HTS-HRMS — "Aurora" skin (1.6.1)
   Deep-space glass UI with the HTS orange→blue brand gradient.
   The class contract is unchanged: every selector the JS emits is here.
   ===================================================================== */
:root {
  --bg: #070a12;
  --bg-2: #0d1322;
  --panel: rgba(19, 26, 42, .62);
  --panel-2: rgba(28, 36, 58, .72);
  --panel-solid: #131a2a;
  --border: rgba(148, 168, 210, .14);
  --border-bright: rgba(148, 168, 210, .28);
  --text: #eaf0fa;
  --dim: #8b96ac;
  --accent: #4f8cff;
  --accent-2: #6ba3ff;
  --orange: #ff9438;
  --green: #3ecf8e;
  --amber: #f5b83d;
  --red: #ff6b6b;
  --grad: linear-gradient(120deg, #ff9438 0%, #ff6a3d 28%, #4f8cff 72%, #38c8ff 100%);
  --grad-soft: linear-gradient(120deg, rgba(255,148,56,.16), rgba(79,140,255,.16));
  --glow-blue: 0 0 24px rgba(79, 140, 255, .35);
  --shadow-1: 0 10px 30px rgba(2, 5, 14, .45);
  --shadow-2: 0 18px 50px rgba(2, 5, 14, .6);
  --r: 14px;
  --mono: "JetBrains Mono", Consolas, monospace;
  --display: "Sora", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, .9, .3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Ambient aurora — two drifting light fields behind everything. */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: .55; pointer-events: none;
}
body::before {
  width: 55vw; height: 55vw; top: -22vw; right: -12vw;
  background: radial-gradient(circle at 30% 30%, rgba(79,140,255,.32), transparent 65%);
  animation: drift1 26s ease-in-out infinite alternate;
}
body::after {
  width: 46vw; height: 46vw; bottom: -20vw; left: -14vw;
  background: radial-gradient(circle at 60% 60%, rgba(255,122,52,.2), transparent 65%);
  animation: drift2 32s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(-9vw, 7vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(8vw, -6vh) scale(1.1); } }

.hidden { display: none !important; }

::selection { background: rgba(79,140,255,.35); }
* { scrollbar-width: thin; scrollbar-color: rgba(120,140,180,.35) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(120,140,180,.28); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,140,180,.5); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
}
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; pointer-events: none; }
.orb.o1 { width: 420px; height: 420px; top: -120px; left: 8%; background: radial-gradient(circle, rgba(79,140,255,.5), transparent 70%); animation: float1 12s ease-in-out infinite alternate; }
.orb.o2 { width: 340px; height: 340px; bottom: -100px; right: 10%; background: radial-gradient(circle, rgba(255,122,52,.4), transparent 70%); animation: float2 14s ease-in-out infinite alternate; }
.orb.o3 { width: 200px; height: 200px; top: 40%; right: 26%; background: radial-gradient(circle, rgba(56,200,255,.35), transparent 70%); animation: float1 17s ease-in-out infinite alternate-reverse; }
@keyframes float1 { to { transform: translate(40px, 30px) scale(1.12); } }
@keyframes float2 { to { transform: translate(-34px, -24px) scale(1.08); } }

.login-card {
  width: 100%; max-width: 400px; position: relative;
  background: var(--panel); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-bright);
  border-radius: 20px; padding: 34px 30px;
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,.06);
  animation: cardIn .7s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.login-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: 21px; padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; pointer-events: none;
}
.brand-lg { font-family: var(--display); font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.brand-lg span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.login-sub { color: var(--dim); margin: 6px 0 22px; font-size: 13px; }
.login-card label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 15px 0 7px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  border: 1px solid var(--border); background: rgba(8, 12, 22, .6); color: var(--text); font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.18); }
.login-card button {
  width: 100%; margin-top: 24px; padding: 13px; border: none; border-radius: 11px;
  background: var(--grad); background-size: 160% 100%; background-position: 0% 0;
  color: #fff; font-size: 14.5px; font-weight: 700; font-family: var(--display); cursor: pointer;
  box-shadow: 0 8px 26px rgba(79,140,255,.35);
  transition: background-position .5s var(--ease), transform .15s, box-shadow .2s;
}
.login-card button:hover { background-position: 90% 0; transform: translateY(-1px); box-shadow: 0 12px 32px rgba(79,140,255,.45); }
.login-card button:active { transform: translateY(0) scale(.99); }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-error { color: var(--red); font-size: 12.5px; margin-top: 12px; min-height: 16px; }
.login-hint { margin-top: 14px; font-size: 11.5px; color: var(--dim); line-height: 1.5; text-align: center; }

.mobile-cta {
  display: block; margin-top: 18px; padding: 12px; border-radius: 11px; text-align: center;
  background: rgba(79,140,255,.1); border: 1px solid rgba(79,140,255,.4);
  color: var(--accent-2); text-decoration: none; font-size: 13.5px; font-weight: 600;
  transition: background .2s, transform .15s, box-shadow .2s;
}
.mobile-cta:hover { background: rgba(79,140,255,.18); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,140,255,.2); }
.mobile-cta:active { transform: none; }
.mobile-cta.apk { margin-top: 8px; background: rgba(62,207,142,.09); border-color: rgba(62,207,142,.38); color: var(--green); }
.mobile-cta.apk:hover { background: rgba(62,207,142,.16); box-shadow: 0 6px 18px rgba(62,207,142,.18); }

.logo-chip { background: #fff; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; box-shadow: 0 6px 22px rgba(0,0,0,.35); }
.logo-chip img { display: block; height: 26px; width: auto; }
.logo-chip.lg { padding: 12px 16px; margin-bottom: 14px; animation: chipFloat 5s ease-in-out infinite alternate; }
.logo-chip.lg img { height: 44px; }
@keyframes chipFloat { to { transform: translateY(-5px); } }
.logo-chip.sm { padding: 4px 7px; }
.logo-chip.sm img { height: 20px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 236px; flex: none; display: flex; flex-direction: column; overflow-y: auto;
  background: rgba(10, 14, 25, .78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
}
.brand { font-family: var(--display); padding: 20px 18px 14px; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-wrap { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.brand-wrap .brand { padding: 0; }
.brand-lg span, .brand span { margin-left: 0; }

.nav-group {
  padding: 18px 18px 7px; font-size: 10px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--dim); font-weight: 700;
}
.nav-item {
  display: block; margin: 1px 10px; padding: 8px 12px; color: #c3cddf; text-decoration: none;
  font-size: 13.5px; cursor: pointer; border-radius: 9px; position: relative;
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); transform: translateX(3px); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(79,140,255,.16), rgba(79,140,255,.03));
  color: #fff; font-weight: 600;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 3px; background: var(--grad); box-shadow: var(--glow-blue);
}
.side-foot { margin-top: auto; padding: 14px 18px; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.side-link { display: block; margin-top: 8px; font-size: 12px; color: var(--accent); text-decoration: none; }
.side-link:hover { text-decoration: underline; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 24px; flex: none; position: relative; z-index: 5;
  background: rgba(10, 14, 25, .55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
#search {
  background: rgba(8, 12, 22, .6); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; width: 200px;
  transition: width .3s var(--ease), border-color .2s, box-shadow .2s;
}
#search:focus { outline: none; border-color: var(--accent); width: 260px; box-shadow: 0 0 0 3px rgba(79,140,255,.15); }
.user { text-align: right; line-height: 1.3; }
.user .role { display: block; font-size: 11px; color: var(--dim); text-transform: capitalize; }
.btn-ghost {
  background: none; border: 1px solid var(--border); color: var(--dim);
  border-radius: 9px; padding: 7px 13px; font-size: 13px; cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); background: rgba(79,140,255,.08); }

.content { flex: 1; overflow-y: auto; padding: 24px; scroll-behavior: smooth; }
.content.anim > * { animation: riseIn .45s var(--ease) both; }
.content.anim > *:nth-child(2) { animation-delay: .06s; }
.content.anim > *:nth-child(3) { animation-delay: .12s; }
.content.anim > *:nth-child(4) { animation-delay: .18s; }
.content.anim > *:nth-child(5) { animation-delay: .24s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }

.loading {
  color: var(--dim); padding: 34px 0; display: flex; align-items: center; gap: 12px; justify-content: center;
}
.loading::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid rgba(79,140,255,.25); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Dashboard hero ---------- */
.dash-hero {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.dash-hero h2 {
  margin: 0; font-family: var(--display); font-size: clamp(22px, 3vw, 30px); font-weight: 800; letter-spacing: -.02em;
}
.dash-hero h2 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dash-hero .sub { color: var(--dim); font-size: 13px; margin-top: 5px; }
.dash-hero .clock { font-family: var(--display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.dash-hero .clock small { display: block; font-size: 11.5px; color: var(--dim); font-weight: 400; letter-spacing: .04em; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.quick .btn { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- Cards / stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--shadow-1);
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.5px;
  background: var(--grad); opacity: .9;
}
.stat:hover { transform: translateY(-4px); border-color: var(--border-bright); box-shadow: var(--shadow-2), 0 0 0 1px rgba(79,140,255,.12); }
.stat .label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat .value { font-family: var(--display); font-size: 30px; font-weight: 700; margin-top: 7px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--dim); margin-top: 3px; }
.stat .value.green { color: var(--green); text-shadow: 0 0 22px rgba(62,207,142,.4); }
.stat .value.red { color: var(--red); text-shadow: 0 0 22px rgba(255,107,107,.35); }
.stat .value.amber { color: var(--amber); text-shadow: 0 0 22px rgba(245,184,61,.35); }
.stat.clickable { cursor: pointer; }
.att-stats { margin-top: -8px; }

/* Department bar chart (dashboard) */
.bars { padding: 8px 18px 16px; display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 42px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-family: var(--display); font-size: 13.5px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c3cddf; }
.bar-track { height: 10px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 6px; background: var(--grad); background-size: 300px 100%;
  transform-origin: left; animation: growBar 1s var(--ease) both; box-shadow: 0 0 12px rgba(79,140,255,.35);
}
@keyframes growBar { from { transform: scaleX(0); } }

.panel {
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); position: relative;
}
.panel-head::after {
  content: ""; position: absolute; left: 18px; bottom: -1px; width: 44px; height: 2px;
  background: var(--grad); border-radius: 2px;
}
.panel-head h2 { margin: 0; font-family: var(--display); font-size: 14.5px; font-weight: 700; }

.btn {
  background: var(--grad); background-size: 160% 100%; background-position: 0% 0;
  color: #fff; border: none; border-radius: 9px;
  padding: 8px 15px; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: 0 5px 16px rgba(79,140,255,.28);
  transition: background-position .45s var(--ease), transform .15s, box-shadow .2s;
}
.btn:hover { background-position: 90% 0; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(79,140,255,.4); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-sm { padding: 5px 10px; font-size: 12px; box-shadow: none; }
.btn-danger { background: transparent; border: 1px solid var(--border); color: var(--red); box-shadow: none; }
.btn-danger:hover { border-color: var(--red); background: rgba(255,107,107,.1); box-shadow: 0 4px 14px rgba(255,107,107,.18); }
.btn-sm.btn-ok { background: var(--green); color: #0b2b1d; }

/* ---------- Table ---------- */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); padding: 11px 18px; border-bottom: 1px solid var(--border); font-weight: 700;
  background: rgba(8, 12, 22, .35);
}
td { padding: 12px 18px; border-bottom: 1px solid rgba(148,168,210,.08); font-size: 13.5px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(79,140,255,.05); }
tbody tr:last-child td { border-bottom: none; }
.muted { color: var(--dim); }
.empty { color: var(--dim); padding: 26px 18px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.green { color: var(--green); background: rgba(62,207,142,.1); border-color: rgba(62,207,142,.32); }
.pill.amber { color: var(--amber); background: rgba(245,184,61,.1); border-color: rgba(245,184,61,.32); }
.pill.red   { color: var(--red);   background: rgba(255,107,107,.1); border-color: rgba(255,107,107,.32); }
.pill.grey  { color: var(--dim);   background: rgba(139,150,172,.1); border-color: var(--border); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-right: 10px; flex: none;
  box-shadow: 0 3px 10px rgba(79,140,255,.3);
}
.person { display: flex; align-items: center; }
.person .nm { font-weight: 600; }
.person .em { font-size: 12px; color: var(--dim); }
.em { font-size: 12px; color: var(--dim); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 14, .66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 20px;
}
.modal-card {
  background: var(--panel-solid); border: 1px solid var(--border-bright); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-2);
  animation: modalIn .3s var(--ease) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-card.wide { max-width: 860px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--panel-solid); z-index: 2;
}
.modal-head h3 { margin: 0; font-family: var(--display); font-size: 15px; font-weight: 700; }
#modalForm { padding: 18px 20px 22px; }
#modalForm label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 13px 0 6px; font-weight: 600; }
#modalForm input, #modalForm select, #modalForm textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: rgba(8, 12, 22, .6); color: var(--text); font-size: 13.5px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
#modalForm input:focus, #modalForm select:focus, #modalForm textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.15); }
#modalForm textarea { min-height: 70px; resize: vertical; }
#modalForm .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
#modalForm .check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text); }
#modalForm .check input { width: auto; }
#modalForm h4 {
  margin: 18px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--dim); font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }
.modal-actions .btn { flex: 1; }
.form-error { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 15px; }

/* ---------- Detail card ---------- */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(79,140,255,.06); }
.avatar.lg { width: 50px; height: 50px; font-size: 17px; margin-right: 14px; }
.detail-top { display: flex; align-items: center; margin-bottom: 6px; }
.detail-top .nm { font-weight: 700; font-size: 15px; font-family: var(--display); }
.detail-grid { display: grid; grid-template-columns: 130px 1fr; gap: 7px 14px; font-size: 13.5px; }
.detail-grid .k { color: var(--dim); }
.detail-grid .v { word-break: break-word; }

/* ---------- Tabs / toolbar ---------- */
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 15px; font-size: 13px; color: var(--dim); cursor: pointer; position: relative;
  border: none; background: none; border-radius: 8px 8px 0 0;
  transition: color .2s, background .2s;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab.active { color: #fff; font-weight: 700; }
.tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px;
  background: var(--grad); border-radius: 3px; box-shadow: 0 0 10px rgba(79,140,255,.5);
  animation: tabIn .3s var(--ease) both;
}
@keyframes tabIn { from { transform: scaleX(.4); opacity: 0; } }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.toolbar label { font-size: 12px; color: var(--dim); }
.toolbar input, .toolbar select, .toolbar button.btn-sm { font-size: 13px; }
.toolbar input, .toolbar select {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(8,12,22,.6); color: var(--text);
}
.toolbar .spacer { flex: 1; }

.flag { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 6px; background: rgba(139,150,172,.12); color: var(--dim); margin-left: 4px; }
.flag.warn { color: var(--amber); background: rgba(245,184,61,.1); }
.flag.bad { color: var(--red); background: rgba(255,107,107,.1); }
.muted-sm { font-size: 11.5px; color: var(--dim); }

/* ---------- Attendance register ---------- */
.reg-wrap { overflow-x: auto; }
.reg { border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.reg th, .reg td { padding: 4px 5px; border-bottom: 1px solid rgba(148,168,210,.08); text-align: center; }
.reg th.name, .reg td.name { text-align: left; position: sticky; left: 0; background: var(--panel-solid); min-width: 180px; z-index: 1; }
.reg td.c { width: 30px; font-weight: 700; border-radius: 4px; }
.reg .c-P { color: var(--green); } .reg .c-HD { color: var(--amber); } .reg .c-A { color: var(--red); }
.reg .c-L { color: #b57bff; } .reg .c-H, .reg .c-WO { color: var(--dim); } .reg .c-MP { color: var(--amber); }
.reg td.c.late { text-decoration: underline dotted; }
.reg th.wo, .reg td.wo { background: rgba(139,150,172,.06); }
.reg td.tot { font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 18px; font-size: 12px; color: var(--dim); }

/* ---------- Selfies / calendar / misc ---------- */
.selfie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.selfie-card { background: rgba(8,12,22,.5); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 12px; transition: transform .2s var(--ease), box-shadow .2s; }
.selfie-card:hover { transform: translateY(-3px) scale(1.02); box-shadow: var(--shadow-1); }
.selfie-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #000; }
.selfie-card .cap { padding: 8px 10px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 14px 18px; }
.cal .dow { font-size: 10.5px; color: var(--dim); text-transform: uppercase; text-align: center; letter-spacing: .06em; }
.cal .day { min-height: 78px; background: rgba(8,12,22,.45); border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 11.5px; transition: border-color .2s, transform .2s; }
.cal .day:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.cal .day.off { opacity: .5; } .cal .day.today { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(79,140,255,.3), var(--glow-blue); }
.cal .day .n { font-weight: 700; margin-bottom: 4px; font-family: var(--display); }
.cal .day .hol { color: var(--amber); }
.cal .who { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bal-cell { cursor: pointer; transition: background .15s; } .bal-cell:hover { background: rgba(79,140,255,.08); }
.bal-cell .u { color: var(--dim); font-size: 11px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 24px);
  background: var(--panel-solid); color: var(--text); border: 1px solid var(--border-bright);
  border-radius: 12px; padding: 11px 18px; font-size: 13px; opacity: 0;
  transition: all .3s var(--ease); z-index: 50; pointer-events: none;
  box-shadow: var(--shadow-2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: rgba(62,207,142,.5); box-shadow: 0 8px 30px rgba(62,207,142,.15); }
.toast.err { border-color: var(--red); box-shadow: 0 8px 30px rgba(255,107,107,.18); }

.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 14px; padding: 14px 18px; font-size: 13px; }
.kv code { background: rgba(8,12,22,.6); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border); }
pre.code { background: rgba(8,12,22,.6); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12px; overflow-x: auto; margin: 0 18px 16px; }
.inline-input { padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border); background: rgba(8,12,22,.6); color: var(--text); font-size: 12.5px; width: 110px; }
.inline-input:focus { outline: none; border-color: var(--accent); }
.rowmiss td { opacity: .72; }

/* ---------- Hamburger + backdrop ---------- */
.menu-btn { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 9px; font-size: 17px; padding: 4px 10px; cursor: pointer; flex: none; }
.backdrop { position: fixed; inset: 0; background: rgba(3, 6, 12, .6); backdrop-filter: blur(4px); z-index: 39; }

/* =====================================================================
   Phones & small tablets — off-canvas nav, scrollable tables, bottom sheets
   ===================================================================== */
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(78vw, 274px); z-index: 40;
    transform: translateX(-105%); transition: transform .28s var(--ease);
    box-shadow: 16px 0 50px rgba(0,0,0,.55);
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(10, 14, 25, .96);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 10px 12px; gap: 10px; flex-wrap: nowrap; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .topbar h1 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 8px; }
  #search { width: 110px; }
  #search:focus { width: 150px; }
  .user { display: none; }
  .content { padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stat { padding: 12px 14px; border-radius: 12px; }
  .stat .value { font-size: 23px; }
  .dash-hero .clock { display: none; }
  .panel { border-radius: 12px; margin-bottom: 14px; }
  .panel-head { padding: 11px 12px; flex-wrap: wrap; gap: 8px; }
  th, td { padding: 9px 10px; }
  td { font-size: 13px; }
  .reg th.name, .reg td.name { min-width: 130px; }
  .bar-row { grid-template-columns: 110px 1fr 36px; }
  .btn, .btn-ghost { min-height: 38px; }
  .nav-item { padding: 12px 14px; font-size: 15px; }
  input, select, textarea, #search,
  #modalForm input, #modalForm select, #modalForm textarea { font-size: 16px !important; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card, .modal-card.wide {
    max-width: 100%; width: 100%; max-height: 90vh; margin: 0;
    border-radius: 18px 18px 0 0; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #modalForm .row2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 106px 1fr; font-size: 13px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv code { word-break: break-all; }
  .cal { gap: 3px; padding: 10px; }
  .cal .day { min-height: 52px; padding: 4px; font-size: 10.5px; }
  .selfie-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .legend { padding: 8px 12px; gap: 10px; }
  .login-card { padding: 26px 20px; }
  .login-card input { font-size: 16px; }
  body::before, body::after { opacity: .4; }
}
@media (max-width: 400px) {
  #search { width: 84px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* Motion off for those who ask. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .content.anim > * { animation: none !important; }
}
