/* ============================================================
   Office ERP — Premium UI v3  (light + dark theme)
   ============================================================ */
:root {
  --bg: #f3f6fd;
  --bg-grad: radial-gradient(1100px 520px at 90% -12%, rgba(37,99,235,.13) 0%, transparent 58%),
             radial-gradient(900px 480px at -8% 112%, rgba(14,165,233,.10) 0%, transparent 55%),
             radial-gradient(700px 400px at 50% 120%, rgba(59,130,246,.06) 0%, transparent 50%);
  --card: #ffffff;
  --card-glass: rgba(255,255,255,.8);
  --ink: #0f172a;
  --muted: #5b6b8c;
  --line: #e3e9f5;
  --brand: #2563eb;
  --brand-2: #0ea5e9;
  --brand-dark: #1d4ed8;
  --brand-soft: #e9f0fe;
  --brand-grad: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  --green: #0c9d68;  --green-soft: #e7f9f1;
  --red: #e5484d;    --red-soft: #fdeeee;
  --amber: #d98f00;  --amber-soft: #fff7e6;
  --sidebar-bg: linear-gradient(180deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 30px -12px rgba(15,23,42,.10);
  --shadow-lg: 0 18px 50px -14px rgba(15,23,42,.22);
  --ring: 0 0 0 3px rgba(37,99,235,.18);
  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg: #0b1220;
  --bg-grad: radial-gradient(1100px 520px at 90% -12%, rgba(37,99,235,.22) 0%, transparent 58%),
             radial-gradient(900px 480px at -8% 112%, rgba(14,165,233,.15) 0%, transparent 55%);
  --card: #101a30;
  --card-glass: rgba(16,26,48,.78);
  --ink: #e8eefb;
  --muted: #8b98b8;
  --line: rgba(255,255,255,.09);
  --brand-soft: rgba(37,99,235,.20);
  --sidebar-bg: linear-gradient(180deg, #0d1830 0%, #14244a 55%, #1a2f5c 100%);
  --green-soft: rgba(12,157,104,.16);
  --red-soft: rgba(229,72,77,.15);
  --amber-soft: rgba(217,143,0,.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 34px -12px rgba(0,0,0,.55);
  --shadow-lg: 0 20px 60px -14px rgba(0,0,0,.65);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
h1, h2, h3, .sv, .brand, .ct { font-family: var(--font-display); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(37,99,235,.25); }

/* custom scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120,130,170,.35); border-radius: 99px; border: 2.5px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,130,170,.6); border: 2.5px solid transparent; background-clip: content-box; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop  { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
@keyframes barGrow { from { height: 0; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.5);} 50% { box-shadow: 0 0 0 6px rgba(229,72,77,0);} }
@keyframes floaty { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }
@keyframes donutIn { from { stroke-dasharray: 0 100; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }

/* ================= Sidebar ================= */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; background: var(--sidebar-bg); color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20;
  border-right: 1px solid rgba(255,255,255,.055);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px; padding: 24px 20px 20px;
  font-weight: 800; font-size: 17.5px; letter-spacing: -.02em; color: #fff;
}
.sidebar .brand .bicon {
  width: 40px; height: 40px; border-radius: 13px; background: var(--brand-grad);
  display: grid; place-items: center; font-size: 19px;
  box-shadow: 0 8px 20px -5px rgba(37,99,235,.65), inset 0 1px 0 rgba(255,255,255,.25);
}
.nav { flex: 1; padding: 8px 13px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #4d5a83; padding: 14px 12px 7px; font-weight: 700; }
.nav a {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px;
  color: #8e9dc0; font-size: 14px; font-weight: 500; border-radius: 12px;
  position: relative; transition: all .18s;
}
.nav a::before {
  content: ''; position: absolute; left: -13px; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3.5px; height: 22px; border-radius: 0 4px 4px 0; background: var(--brand-grad); transition: transform .2s;
}
.nav a:hover { background: rgba(255,255,255,.055); color: #eaf0ff; text-decoration: none; }
.nav a.active {
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(56,189,248,.16));
  color: #fff; font-weight: 600; border: 1px solid rgba(120,120,255,.25);
}
.nav a.active::before { transform: translateY(-50%) scaleY(1); }
.nav .icon { width: 21px; text-align: center; font-size: 16.5px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 2px 7px; min-width: 20px; text-align: center;
  animation: pulse 2s infinite;
}
.sidebar .userbox {
  margin: 10px 13px 16px; padding: 12px; border-radius: 15px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px; backdrop-filter: blur(6px);
}
.avatar {
  width: 38px; height: 38px; border-radius: 12px; background: var(--brand-grad);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
  box-shadow: inset 0 -8px 14px rgba(0,0,0,.22), 0 4px 10px -3px rgba(37,99,235,.5);
}
.userbox .un { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.userbox .ur { font-size: 11px; color: #5f6f9c; text-transform: capitalize; margin-top: 1px; }
a.lo { margin-left: auto; color: #5f6f9c; font-size: 17px; transition: .2s; }
a.lo:hover { color: #ff7b7b; text-decoration: none; transform: rotate(90deg); }

/* ================= Main / topbar ================= */
.main { flex: 1 1 auto; min-width: 0; margin-left: 252px; padding: 0 36px 64px; max-width: 1320px; }
.topbar {
  position: sticky; top: 0; z-index: 15; margin: 0 -36px 28px; padding: 13px 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--card-glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.tb-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; font-family: var(--font-display); }
.tb-right { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.theme-toggle {
  width: 37px; height: 37px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 16px; display: grid; place-items: center;
  transition: .2s; color: var(--ink);
}
.theme-toggle:hover { transform: translateY(-2px) rotate(-12deg); box-shadow: var(--shadow); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; animation: rise .4s ease both; }
.page-head h2 { font-size: 25px; letter-spacing: -.03em; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ================= Cards & stats ================= */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; border: 1px solid var(--line);
  animation: rise .45s ease both;
  transition: box-shadow .25s, border-color .25s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 20px; display: flex; gap: 15px; align-items: center;
  transition: transform .22s, box-shadow .22s, border-color .22s; animation: pop .4s ease both;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: auto -34px -54px auto; width: 120px; height: 120px;
  border-radius: 50%; background: var(--brand-soft); opacity: .6; pointer-events: none; transition: transform .3s;
}
.stat:nth-child(2)::after { background: var(--green-soft); }
.stat:nth-child(3)::after { background: var(--amber-soft); }
.stat:nth-child(4)::after { background: var(--red-soft); }
.stat:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,.35); }
.stat:hover::after { transform: scale(1.3); }
.stat .si { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 23px; flex: none; }
.stat .sv { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .sl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.section-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.01em; font-family: var(--font-display); }

/* ================= Hero (check-in) ================= */
.checkin-hero {
  background: var(--brand-grad); color: #fff; border-radius: 20px;
  padding: 28px 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap; position: relative; overflow: hidden;
  box-shadow: 0 20px 50px -14px rgba(37,99,235,.6); animation: rise .4s ease both;
}
.checkin-hero::before, .checkin-hero::after {
  content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); pointer-events: none;
}
.checkin-hero::before { width: 240px; height: 240px; right: -70px; top: -120px; animation: floaty 7s ease-in-out infinite; }
.checkin-hero::after { width: 150px; height: 150px; right: 130px; bottom: -100px; animation: floaty 9s ease-in-out infinite reverse; }
.checkin-hero .ct { font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.checkin-hero .cs { opacity: .88; font-size: 13.5px; margin-top: 6px; }
.hero-clock {
  font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 800;
  font-size: 15px; background: rgba(255,255,255,.16); border-radius: 10px; padding: 4px 12px;
  display: inline-block; margin-top: 10px; backdrop-filter: blur(4px); letter-spacing: .04em;
}
.checkin-hero .btn { background: #fff; color: var(--brand-dark); box-shadow: 0 10px 24px -6px rgba(0,0,0,.4); }
.checkin-hero .btn:hover { background: #f3f4ff; transform: translateY(-2px) scale(1.02); }
.checkin-hero .badge { background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(4px); }

/* ================= Quick actions ================= */
.qa-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; animation: rise .45s ease both; }
.qa {
  flex: 1; min-width: 130px; display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); transition: all .2s;
}
.qa:hover { transform: translateY(-3px); border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow-lg); text-decoration: none; }
.qa i { font-style: normal; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--brand-soft); display: grid; place-items: center; font-size: 16px; }

/* ================= Charts / donut / progress ================= */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 150px; padding-top: 12px; }
.cb-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.cb {
  width: 100%; max-width: 46px; border-radius: 10px 10px 5px 5px; background: var(--brand-grad);
  position: relative; min-height: 4px; animation: barGrow .8s cubic-bezier(.2,.8,.3,1) both;
  opacity: .92; transition: .2s; box-shadow: 0 6px 14px -6px rgba(37,99,235,.5);
}
.cb:hover { opacity: 1; transform: scaleY(1.03); transform-origin: bottom; }
.cb.dim { background: var(--line); box-shadow: none; }
.cb-val { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.cb-lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 128px; height: 128px; flex: none; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 4.4; stroke-linecap: round; }
.donut .seg { animation: donutIn 1s cubic-bezier(.2,.8,.3,1) both; }
.donut-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  font-family: var(--font-display);
}
.donut-center b { font-size: 22px; font-weight: 800; letter-spacing: -.03em; display: block; }
.donut-center span { font-size: 10.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.donut-box { position: relative; width: 128px; height: 128px; flex: none; }
.dlegend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.dlegend .dl { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.dlegend .dl i { width: 10px; height: 10px; border-radius: 3.5px; flex: none; font-style: normal; }
.dlegend .dl b { margin-left: auto; font-variant-numeric: tabular-nums; }

.progress-row { margin-bottom: 14px; }
.progress-row .pr-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.progress-row .pr-top span:last-child { color: var(--muted); font-weight: 500; }
.progress { height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--brand-grad); transition: width 1.1s cubic-bezier(.2,.8,.3,1); }
.progress > i.p-green { background: linear-gradient(90deg, #0c9d68, #34d399); }
.progress > i.p-amber { background: linear-gradient(90deg, #d98f00, #fbbf24); }

/* ================= Tables ================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); padding: 11px 13px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
td { padding: 12.5px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--brand-soft); }

/* ================= Badges / buttons / forms ================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4.5px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 700; text-transform: capitalize; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue { background: var(--brand-soft); color: var(--brand); }
.b-gray { background: var(--line); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10.5px 19px; border-radius: 12px;
  border: 0; background: var(--brand-grad); color: #fff; font-size: 13.5px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .18s; letter-spacing: .01em;
  box-shadow: 0 8px 18px -7px rgba(37,99,235,.55), inset 0 1px 0 rgba(255,255,255,.18);
  position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -8px rgba(37,99,235,.65); text-decoration: none; filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.green { background: linear-gradient(135deg, #0c9d68, #12c883); box-shadow: 0 8px 18px -7px rgba(12,157,104,.55); }
.btn.red { background: linear-gradient(135deg, #e5484d, #f0666a); box-shadow: 0 8px 18px -7px rgba(229,72,77,.55); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow); filter: none; }
.btn.sm { padding: 6px 13px; font-size: 12.5px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { padding: 14px 24px; font-size: 15px; width: 100%; justify-content: center; border-radius: 14px; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font-size: 13px; font-family: inherit; font-weight: 600; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--red); }

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 13px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; font-family: inherit; background: var(--card); color: var(--ink); transition: .18s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(37,99,235,.4); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type="date"], input[type="month"], input[type="time"] { color-scheme: light; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { color-scheme: dark; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ================= Flash / misc ================= */
.flash {
  padding: 13px 17px; border-radius: 13px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600;
  animation: rise .3s ease both; display: flex; align-items: center; gap: 9px;
  transition: opacity .4s, transform .4s;
}
.flash::before { font-size: 15px; }
.f-ok { background: var(--green-soft); color: var(--green); border: 1px solid rgba(12,157,104,.25); }
.f-ok::before { content: '✅'; }
.f-err { background: var(--red-soft); color: var(--red); border: 1px solid rgba(229,72,77,.25); }
.f-err::before { content: '⚠️'; }

.ann { border-left: 3px solid var(--brand); padding: 12px 16px; margin-bottom: 12px; background: var(--brand-soft); border-radius: 5px 13px 13px 5px; transition: .2s; }
.ann:hover { transform: translateX(4px); }
.ann .at { font-weight: 700; }
.ann .am { color: var(--muted); font-size: 12px; margin-top: 3px; }
.ann .ab { margin-top: 6px; font-size: 13.5px; color: var(--ink); opacity: .85; line-height: 1.55; }

.bal-pills { display: flex; gap: 12px; flex-wrap: wrap; }
.bal-pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px 18px; font-size: 13px; color: var(--muted); font-weight: 600; transition: .2s;
}
.bal-pill:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(37,99,235,.35); }
.bal-pill b { font-size: 20px; display: block; color: var(--ink); letter-spacing: -.02em; font-family: var(--font-display); }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 14px; }
.empty::before { content: '🗂️'; display: block; font-size: 32px; margin-bottom: 8px; opacity: .55; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select { width: auto; }
.filters a.btn { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

details.card summary { cursor: pointer; font-weight: 700; font-size: 15px; user-select: none; list-style: none; letter-spacing: -.01em; font-family: var(--font-display); }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: '▾'; float: right; color: var(--muted); transition: .25s; }
details.card[open] summary::after { transform: rotate(180deg); }
details.card[open] summary { margin-bottom: 8px; }
details.card:hover { border-color: var(--brand); }

/* ================= Login ================= */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 600px at 18% -12%, rgba(56,189,248,.4) 0%, transparent 55%),
              radial-gradient(900px 600px at 112% 112%, rgba(37,99,235,.45) 0%, transparent 55%),
              linear-gradient(135deg, #090d20 0%, #121740 60%, #0d1130 100%);
  padding: 22px;
}
.login-split {
  display: grid; grid-template-columns: 1.05fr 1fr; width: 100%; max-width: 900px;
  border-radius: 26px; overflow: hidden; box-shadow: 0 50px 110px -24px rgba(0,0,0,.65);
  animation: pop .5s ease both;
}
.login-brand {
  background: var(--brand-grad); color: #fff; padding: 50px 44px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
}
.login-brand::before { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.09); top: -140px; right: -100px; animation: floaty 8s ease-in-out infinite; }
.login-brand::after { content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.07); bottom: -90px; left: -70px; animation: floaty 10s ease-in-out infinite reverse; }
.login-brand .logo { font-size: 46px; margin-bottom: 14px; }
.login-brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 8px; }
.login-brand p { opacity: .87; font-size: 14px; line-height: 1.65; margin-bottom: 28px; }
.lb-feats { display: flex; flex-direction: column; gap: 13px; position: relative; }
.lb-feat { display: flex; align-items: center; gap: 12px; font-size: 13.5px; font-weight: 600; }
.lb-feat i { font-style: normal; width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.17); display: grid; place-items: center; font-size: 15px; flex: none; }
.login-card { background: #fff; padding: 48px 42px; color: #101426; }
.login-card h2 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: #636e88; margin: 4px 0 20px; font-size: 13.5px; }
.login-card label { color: #636e88; }
.login-card input { background: #f6f8fd; border-color: #e5e8f2; color: #101426; }
.login-card input:focus { background: #fff; }
.demo-box {
  background: #eef0ff; border: 1px solid #dfe3ff; border-radius: 14px; padding: 13px 15px;
  margin-top: 20px; font-size: 12.8px; color: #1d4ed8; line-height: 1.85;
}
.demo-box b { cursor: pointer; }
.demo-box b:hover { text-decoration: underline; }

/* ================= Responsive ================= */
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > .card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .login-split { grid-template-columns: 1fr; max-width: 440px; }
  .login-brand { padding: 34px 32px; }
  .lb-feats { display: none; }
}
@media (max-width: 820px) and (min-width: 641px) {
  .sidebar { width: 68px; }
  .sidebar .brand { justify-content: center; padding: 18px 8px; }
  .sidebar .brand span.btxt, .sidebar .brand .btwrap, .nav a span.ntxt, .userbox .uinfo, .nav-label { display: none; }
  .nav a { justify-content: center; padding: 12px 0; }
  .nav a::before { display: none; }
  .nav .icon { width: auto; }
  .nav-badge { position: absolute; top: 4px; right: 8px; margin: 0; padding: 1px 5px; min-width: 16px; font-size: 9.5px; }
  .sidebar .userbox { justify-content: center; padding: 10px 6px; margin: 8px; }
  a.lo { margin-left: 0; }
  .main { margin-left: 68px; padding: 0 16px 40px; }
  .topbar { margin: 0 -16px 20px; padding: 12px 16px; }
}

/* ---- Phones: hamburger + slide-in sidebar drawer ---- */
.side-toggle { display: none; }
.side-bg {
  position: fixed; inset: 0; background: rgba(7,10,22,.55); z-index: 94;
  opacity: 0; visibility: hidden; transition: .25s;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.side-bg.open { opacity: 1; visibility: visible; }

@media (max-width: 640px) {
  body { font-size: 14px; }
  /* hamburger button in the top bar */
  .side-toggle {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none;
    border-radius: 12px; border: 1px solid var(--line); background: var(--card);
    color: var(--ink); font-size: 18px; cursor: pointer; position: relative;
    transition: .15s;
  }
  .side-toggle:active { transform: scale(.92); }
  /* sidebar becomes an off-canvas drawer sliding from the left */
  .sidebar {
    width: 284px; max-width: 84vw; z-index: 95;
    transform: translateX(-108%);
    transition: transform .32s cubic-bezier(.2,.85,.3,1);
    box-shadow: 30px 0 80px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 0 14px 40px; max-width: 100%; }
  .topbar { margin: 0 -14px 18px; padding: 10px 14px; gap: 10px; }
  .tb-title { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip.tb-date { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
  .page-head h2 { font-size: 20px; }
  .filters { width: 100%; }
  .filters input, .filters select { flex: 1; min-width: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; gap: 10px; }
  .stat .si { width: 40px; height: 40px; font-size: 18px; border-radius: 12px; }
  .stat .sv { font-size: 20px; }
  .stat .sl { font-size: 11.5px; }
  .card { padding: 16px; }
  .checkin-hero { padding: 18px 18px; flex-direction: column; align-items: flex-start; }
  .checkin-hero .ct { font-size: 17px; }
  .checkin-hero form, .checkin-hero .btn { width: 100%; justify-content: center; }
  .qa-row { gap: 8px; }
  .qa { min-width: calc(50% - 8px); padding: 11px 12px; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-3 > .card:first-child { grid-column: auto; }
  .donut-wrap { justify-content: center; }
  .frow { grid-template-columns: 1fr; }
  th, td { padding: 9px 9px; font-size: 13px; }
  .btn { padding: 9px 14px; }
  .chart { height: 120px; gap: 7px; }
  .bal-pills { gap: 8px; }
  .bal-pill { padding: 9px 13px; flex: 1; text-align: center; }
  .login-card { padding: 30px 22px; }
  .login-brand { padding: 26px 22px; }
}

/* ================= Print ================= */
@media print {
  .sidebar, .topbar, .page-head .filters, .flash, .btn, .qa-row { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; animation: none; }
}

/* ================= Loader & progress ================= */
.loader {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg-grad), var(--bg);
  transition: opacity .5s ease, visibility .5s ease;
}
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.ld-box { text-align: center; animation: pop .4s ease both; }
.ld-logo {
  width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 22px;
  background: var(--brand-grad); color: #fff; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 36px;
  box-shadow: 0 20px 50px -12px rgba(37,99,235,.65), inset 0 2px 0 rgba(255,255,255,.25);
  position: relative; animation: floaty 2.6s ease-in-out infinite;
}
.ld-logo::before {
  content: ''; position: absolute; inset: -11px; border-radius: 28px;
  border: 2.5px solid transparent;
  border-top-color: var(--brand); border-right-color: var(--brand-2);
  animation: ldspin 1.1s linear infinite;
}
@keyframes ldspin { to { transform: rotate(360deg); } }
.ld-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; margin-bottom: 14px; }
.ld-dots { display: flex; gap: 7px; justify-content: center; }
.ld-dots i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  animation: ldbounce 1s ease-in-out infinite;
}
.ld-dots i:nth-child(2) { animation-delay: .15s; background: #7c53f6; }
.ld-dots i:nth-child(3) { animation-delay: .3s; background: var(--brand-2); }
@keyframes ldbounce { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-8px); opacity: 1; } }

.topline {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 220;
  background: var(--brand-grad); border-radius: 0 99px 99px 0; pointer-events: none;
  box-shadow: 0 0 12px rgba(37,99,235,.7);
  transition: width 1.6s cubic-bezier(.08,.75,.15,1);
}
.topline.go { width: 86%; }

/* button loading spinner */
.btn-loading { pointer-events: none; opacity: .85; }
.btn-loading::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: ldspin .7s linear infinite; margin-left: 4px;
}
.btn-loading.ghost::after { border-color: rgba(37,99,235,.3); border-top-color: var(--brand); }

/* brand monogram */
.sidebar .brand .bicon, .lg-mono {
  font-family: var(--font-display); font-weight: 800; color: #fff;
}
.lg-mono {
  width: 62px; height: 62px; border-radius: 19px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 30px; margin-bottom: 16px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), 0 12px 30px -8px rgba(0,0,0,.35);
  backdrop-filter: blur(4px);
}

/* ================= Attendance calendar ================= */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head {
  text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); padding: 6px 0 8px;
}
.cal-head.sun { color: var(--red); }
.cal-cell {
  min-height: 72px; border-radius: 12px; padding: 8px 9px; border: 1px solid var(--line);
  background: var(--card); position: relative; transition: transform .15s, box-shadow .15s;
  animation: pop .35s ease both;
}
.cal-cell:not(.blank):hover { transform: translateY(-3px); box-shadow: var(--shadow); z-index: 1; }
.cal-cell.blank { border: 0; background: none; }
.cal-d { font-weight: 800; font-size: 13.5px; font-family: var(--font-display); }
.cal-s { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.cal-t { font-size: 10.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cal-present  { background: var(--green-soft); border-color: rgba(12,157,104,.3); }
.cal-present .cal-s { color: var(--green); }
.cal-half-day { background: var(--amber-soft); border-color: rgba(217,143,0,.35); }
.cal-half-day .cal-s { color: var(--amber); }
.cal-absent   { background: var(--red-soft); border-color: rgba(229,72,77,.25); }
.cal-absent .cal-s { color: var(--red); }
.cal-leave    { background: var(--brand-soft); border-color: rgba(37,99,235,.3); }
.cal-leave .cal-s { color: var(--brand); }
.cal-off      { background: transparent; opacity: .55; }
.cal-off .cal-s { color: var(--muted); }
.cal-future   { opacity: .45; }
.cal-cell.today { outline: 2.5px solid var(--brand); outline-offset: 1px; }
.cal-cell.today .cal-d::after { content: ' · today'; font-size: 9.5px; color: var(--brand); font-weight: 700; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3.5px; margin-right: 6px; font-style: normal; vertical-align: -1px; }

@media (max-width: 640px) {
  .cal { gap: 3px; }
  .cal-cell { min-height: 52px; padding: 5px 5px; border-radius: 9px; }
  .cal-d { font-size: 12px; }
  .cal-s { font-size: 8px; }
  .cal-t { display: none; }
  .cal-cell.today .cal-d::after { content: ''; }
}

/* holiday cells */
.cal-holiday { background: rgba(192,38,211,.1); border-color: rgba(192,38,211,.35); }
.cal-holiday .cal-s { color: #c026d3; }

/* ================= Responsive fixes ================= */
/* profile page layout - collapses properly on tablets/phones */
.grid-profile { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) {
  .grid-profile { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats-4 { grid-template-columns: 1fr 1fr; }
}

/* stop long numbers / titles from causing horizontal overflow */
.stat .sv { overflow-wrap: anywhere; }
.tb-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head h2 { overflow-wrap: anywhere; }
.card, .stat, .checkin-hero { min-width: 0; }
.grid-2 > *, .grid-3 > *, .grid-profile > * { min-width: 0; }

/* smooth touch scrolling for wide tables */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* filters & forms behave on small screens */
@media (max-width: 640px) {
  .page-head .filters { width: 100%; }
  .page-head .filters form { flex: 1; display: flex; gap: 8px; }
  .page-head .filters form input { width: 100%; min-width: 0 !important; }
  .filters .btn { flex: none; }
  .topbar .chip { padding: 6px 10px; font-size: 11.5px; }
  .checkin-hero > div { width: 100%; }
  #camPanel video { width: 100% !important; max-width: 280px; }
  .bal-pills { display: grid; grid-template-columns: 1fr 1fr; }
  .bal-pill { text-align: left; }
  .donut-wrap { flex-direction: column; text-align: center; }
  .dlegend { width: 100%; }
  .qa { min-width: calc(50% - 4px); }
  .frow .frow { grid-template-columns: 1fr; }
  details.card summary { font-size: 14px; }
  .login-brand h1 { font-size: 24px; }
  .page-head .sub { font-size: 12.5px; }
}

/* tablet: keep profile stats readable */
@media (max-width: 820px) and (min-width: 641px) {
  .stats-4 { grid-template-columns: 1fr 1fr; }
}

/* very small phones */
@media (max-width: 380px) {
  .stat-grid, .stats-4, .bal-pills { grid-template-columns: 1fr !important; }
  .main { padding: 0 10px 30px; }
  .topbar { padding: 8px 10px; margin: 0 -10px 14px; }
  th, td { padding: 8px 7px; font-size: 12px; }
}
@media (max-width: 640px) {
  .page-head .filters form select { min-width: 0; width: auto; flex: 1; }
}

/* ================= Team Chat drawer ================= */
.chat-drawer {
  position: fixed; right: 18px; bottom: 18px; width: 340px; height: 480px; max-height: calc(100vh - 40px);
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; z-index: 70; overflow: hidden;
  transform: translateY(24px) scale(.96); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .25s cubic-bezier(.2,.8,.3,1), opacity .25s, visibility .25s;
}
.chat-drawer.open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--brand-grad); color: #fff;
}
.chat-head b { font-family: var(--font-display); font-size: 14.5px; white-space: nowrap; }
.chat-head select {
  flex: 1; min-width: 0; padding: 6px 9px; font-size: 12.5px; border-radius: 9px; border: 0;
  background: rgba(255,255,255,.18); color: #fff;
}
.chat-head select option { color: #111; }
.chat-head button { background: none; border: 0; color: rgba(255,255,255,.85); font-size: 15px; cursor: pointer; }
.chat-head button:hover { color: #fff; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.chat-msg.own { align-self: flex-end; flex-direction: row-reverse; }
.cavatar { width: 28px; height: 28px; border-radius: 9px; object-fit: cover; flex: none; }
.cavatar.ci { background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; }
.cbubble {
  background: var(--brand-soft); border-radius: 13px 13px 13px 4px; padding: 8px 12px; min-width: 60px;
}
.chat-msg.own .cbubble { background: var(--brand-grad); color: #fff; border-radius: 13px 13px 4px 13px; }
.cname { font-size: 11px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.cname span { font-weight: 500; color: var(--muted); }
.cbody { font-size: 13.5px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.ctime { font-size: 10px; color: var(--muted); text-align: right; margin-top: 3px; }
.chat-msg.own .ctime { color: rgba(255,255,255,.75); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; border-radius: 11px; }
.chat-form .btn { flex: none; border-radius: 11px; padding: 8px 14px; }

@media (max-width: 640px) {
  .chat-drawer {
    right: 8px; left: 8px; width: auto; bottom: 14px; height: 62vh;
  }
}
@media print { .chat-drawer, #chatToggle { display: none !important; } }


/* chat new-message toast */
.chat-toast {
  position: fixed; right: 18px; bottom: 96px; z-index: 95;
  background: var(--brand-grad); color: #fff; font-weight: 600; font-size: 13.5px;
  padding: 12px 18px; border-radius: 13px; cursor: pointer;
  box-shadow: 0 14px 34px -8px rgba(37,99,235,.65);
  animation: rise .3s ease both; transition: opacity .4s;
}
.chat-toast:hover { filter: brightness(1.08); }
@media (max-width: 640px) { .chat-toast { right: 12px; left: 12px; bottom: 14px; text-align: center; } }

/* chat attachments: photos & voice messages */
.chat-att { background: none; border: 0; font-size: 18px; cursor: pointer; padding: 4px; flex: none; transition: .15s; }
.chat-att:hover { transform: scale(1.15); }
.chat-att.rec { animation: pulse 1s infinite; border-radius: 50%; background: var(--red-soft); }
.cimg { max-width: 190px; max-height: 190px; border-radius: 11px; display: block; margin-bottom: 4px; cursor: zoom-in; }
.caud { max-width: 215px; height: 38px; display: block; margin-bottom: 4px; }

/* ================= Chat message box UI v2 ================= */
.chat-form { padding: 9px 10px; gap: 6px; align-items: center; }
.chat-att {
  width: 36px; height: 36px; flex: none; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 16px; padding: 0;
  border: 0; cursor: pointer; transition: .15s;
}
.chat-att:hover { transform: scale(1.08); background: var(--brand); }
.chat-att.rec { background: var(--red); color: #fff; animation: pulse 1s infinite; border-radius: 50%; }
.chat-form input#chatInput { flex: 1; min-width: 0; }
.chat-form .btn { width: 40px; height: 36px; padding: 0; display: grid; place-items: center; flex: none; }

/* bubbles never explode: photos & audio stay compact */
.chat-msg { max-width: 88%; }
.cbubble { max-width: 235px; overflow: hidden; }
.cimg {
  display: block; width: 100%; max-width: 205px; max-height: 205px;
  object-fit: cover; border-radius: 10px; margin: 2px 0 4px; cursor: zoom-in;
  background: rgba(0,0,0,.08);
}
.caud { display: block; width: 205px; max-width: 100%; height: 36px; margin: 2px 0 4px; }
.chat-msg.own .caud { filter: none; }

@media (max-width: 640px) {
  .cbubble { max-width: 68vw; }
  .cimg { max-width: 62vw; max-height: 55vw; }
  .caud { width: 58vw; }
  .chat-att { width: 34px; height: 34px; }
}

/* ================= Chat UI v3 — professional ================= */
.chat-drawer {
  width: 384px; height: 580px; max-height: calc(100vh - 32px);
  border-radius: 20px; border: 1px solid var(--line);
}
.chat-head { padding: 13px 16px; gap: 12px; }
.chat-head b { font-size: 15px; }
.chat-head select { padding: 7px 10px; border-radius: 10px; font-weight: 600; }
.chat-msgs {
  padding: 16px 14px 12px; gap: 2px;
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(37,99,235,.05), transparent 60%),
    radial-gradient(400px 220px at 0% 100%, rgba(56,189,248,.05), transparent 60%);
  scroll-behavior: smooth;
}
.chat-msgs::-webkit-scrollbar { width: 6px; }
.chat-msgs::-webkit-scrollbar-thumb { background: rgba(120,130,170,.3); border-radius: 99px; }

/* date separators */
.cdate {
  align-self: center; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 4px 14px; border-radius: 99px;
  margin: 12px 0 8px; box-shadow: var(--shadow);
}

/* refined bubbles */
.chat-msg { margin-top: 8px; animation: rise .22s ease both; }
.cbubble {
  max-width: 260px; padding: 8px 12px 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px; box-shadow: 0 1px 2px rgba(16,20,40,.06);
}
.chat-msg.own .cbubble {
  background: var(--brand-grad); border: 0;
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 6px 16px -6px rgba(37,99,235,.5);
}
.cname { font-size: 11px; font-weight: 800; color: var(--brand); margin-bottom: 3px; }
.cbody { font-size: 13.5px; line-height: 1.5; }
.ctime { font-size: 9.5px; opacity: .65; margin-top: 3px; }

/* media in bubbles */
.cimg { max-width: 228px; max-height: 228px; border-radius: 10px; }
.cvid {
  display: block; width: 100%; max-width: 232px; max-height: 240px;
  border-radius: 10px; margin: 2px 0 4px; background: #000;
}
.caud { width: 210px; }

/* professional composer */
.chat-form {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 7px;
  background: var(--card); border-top: 1px solid var(--line); align-items: center;
}
.chat-form input#chatInput {
  border-radius: 99px; padding: 10px 16px; background: var(--bg);
  border: 1.5px solid transparent; font-size: 13.5px;
}
.chat-form input#chatInput:focus { background: var(--card); border-color: var(--brand); }
.chat-form .btn {
  width: 38px; height: 38px; border-radius: 50%; font-size: 15px;
}
.chat-att { border-radius: 50%; }

@media (max-width: 640px) {
  .chat-drawer { right: 8px; left: 8px; width: auto; bottom: 12px; height: 72vh; }
  .cbubble { max-width: 72vw; }
  .cimg { max-width: 62vw; max-height: 55vw; }
  .cvid { max-width: 64vw; max-height: 60vw; }
  .caud { width: 56vw; }
}

/* ================= Bootstrap Icons integration ================= */
.bi { line-height: 1; vertical-align: -0.12em; }
.nav .icon.bi { width: 21px; text-align: center; font-size: 16px; vertical-align: middle; }
.stat .si .bi { font-size: 22px; }
.qa .bi { font-size: 16px; color: var(--brand); }
.theme-toggle .bi, .side-toggle .bi { font-size: 16px; }
.chat-att .bi { font-size: 16px; }
.chat-head b .bi { margin-right: 2px; }
a.lo .bi { font-size: 16px; }
.chip .bi { font-size: 12px; }
.tb-title .bi { font-size: 15px; }

/* document attachments in chat */
.cfile {
  display: flex; align-items: center; gap: 9px; margin: 2px 0 4px;
  background: rgba(120,130,180,.12); border-radius: 10px; padding: 10px 12px;
  color: inherit; font-weight: 600; font-size: 12.5px; max-width: 210px;
}
.cfile:hover { text-decoration: none; filter: brightness(1.06); }
.cfile .bi { font-size: 20px; color: var(--brand); flex: none; }
.chat-msg.own .cfile .bi { color: #fff; }
.cfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= Kanban board ================= */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kcol { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 120px; }
.kcol-h { font-weight: 800; font-size: 13px; margin: 2px 4px 10px; font-family: var(--font-display); display: flex; justify-content: space-between; }
.kcol-h span { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; font-size: 11.5px; color: var(--muted); }
.klist { display: flex; flex-direction: column; gap: 8px; min-height: 60px; border-radius: 10px; transition: background .15s; }
.klist.kover { background: var(--brand-soft); outline: 2px dashed var(--brand); }
.kcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); font-size: 13px; transition: .15s;
}
.kcard:hover { border-color: var(--brand); transform: translateY(-2px); }
.kcard.kdrag { opacity: .5; transform: rotate(2deg); }
.kcard.locked { cursor: default; opacity: .75; }
.kmeta { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 11px; color: var(--muted); }
@media (max-width: 640px) { .kanban { grid-template-columns: 1fr; } }

/* ================= v6: smooth, instant dropdowns ================= */
html { scroll-behavior: smooth; }
select, input, textarea, .btn { transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease, transform .12s ease; }
select { cursor: pointer; }
select:hover { border-color: var(--brand); }
select:focus, input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.16); outline: none; }
select.sel-wait { opacity: .55; pointer-events: none; }
.btn:active { transform: scale(.97); }
option { font-size: 14px; }

/* ================= v7: speed pass ================= */
.warm .loader { display: none !important; }                    /* splash only once per session */
.page-head, .card, .checkin-hero { animation-duration: .26s; } /* snappier entrances */
.stat { animation-duration: .22s; }
.flash.bye { opacity: 0; transform: translateY(-8px); transition: opacity .35s, transform .35s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================= v8: sidebar polish + letterhead ================= */
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }
.nav-label { display: flex; align-items: center; gap: 8px; }
.nav-label::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.07); }
.nav a { font-size: 13.5px; padding-top: 8px; padding-bottom: 8px; }
.nav a .icon { opacity: .8; }
.nav a.active .icon { opacity: 1; }
.lh-doc { line-height: 1.9; }
.lh-doc p { margin: 0 0 12px; }

/* ================= v9: FULL responsive layer — phone / tablet / desktop ================= */

/* --- universal safety net: anything wider than the screen scrolls inside its card, never breaks the page --- */
@media (max-width: 900px) {
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card table { min-width: 560px; }             /* data tables stay readable & swipe sideways */
  .card .empty, .card form { min-width: 0; }
}
@media (max-width: 640px) {
  .card table { min-width: 480px; }
}

/* --- tablets 641–1000px: stats 2×2, filters wrap, comfortable paddings --- */
@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head .filters { flex-wrap: wrap; }
  .grid-profile { grid-template-columns: 1fr; }
}

/* --- phones ≤640px --- */
@media (max-width: 640px) {
  /* iOS: inputs under 16px trigger auto-zoom — never zoom again */
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 42px; }                     /* proper touch targets */
  .filters .btn { flex: 1; justify-content: center; }
  .filters form { width: 100%; display: flex; }

  /* documents (letters, payslips, invoices, F&F) shrink to phone width */
  .offer-letter { max-width: 100% !important; }
  .offer-letter > div[style*="padding:30px 44px"],
  .offer-letter > div[style*="padding:26px 44px"] { padding: 18px 16px !important; }
  .lh-doc div[style*="padding"] { padding-left: 16px !important; padding-right: 16px !important; }
  .offer-letter table { min-width: 0 !important; }

  /* inline action forms inside table cells wrap neatly */
  td form { flex-wrap: wrap; }
  td { white-space: normal; }
  td[style*="nowrap"] { white-space: normal !important; }

  /* kiosk video + face check-in full width */
  video { width: 100% !important; height: auto; }

  /* poll bars, progress bars, chips scale */
  .bal-pill { min-width: calc(50% - 8px); }

  /* details/summary cards easier to tap */
  details.card > summary { padding: 4px 0; min-height: 34px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

  /* chat drawer over full width */
  .chat-drawer { width: 100vw !important; max-width: 100vw !important; }

  /* login page breathing room */
  .login-page { padding: 14px; }

  /* modals/heatmap legend text smaller */
  .section-title { font-size: 14px; flex-wrap: wrap; }
}

/* --- small phones ≤380px --- */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat .sv { font-size: 17px; }
  .qa { min-width: 100%; }
  .page-head h2 { font-size: 18px; }
  th, td { font-size: 12px; padding: 8px 7px; }
}

/* --- big desktops ≥1600px: use the space --- */
@media (min-width: 1600px) {
  .main { max-width: 1480px; margin-left: auto; margin-right: auto; padding-left: 260px; }
}

/* --- landscape phones: keep topbar compact --- */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { position: static; }
  .checkin-hero { flex-direction: row; }
}

/* --- print never shows nav junk, on any page --- */
@media print {
  .sidebar, .topbar, .side-toggle, .chat-drawer, .flash, .topline, .loader { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ================= v11: GLASSMORPHISM ✨ ================= */
/* richer aurora background so the glass has something to blur */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(37,99,235,.22) 0%, transparent 55%),
    radial-gradient(800px 460px at -10% 30%, rgba(56,189,248,.16) 0%, transparent 52%),
    radial-gradient(700px 420px at 55% 115%, rgba(27,158,120,.13) 0%, transparent 50%),
    radial-gradient(500px 300px at 30% -5%, rgba(255,120,180,.10) 0%, transparent 55%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(37,99,235,.28) 0%, transparent 55%),
    radial-gradient(800px 460px at -10% 30%, rgba(56,189,248,.20) 0%, transparent 52%),
    radial-gradient(700px 420px at 55% 115%, rgba(20,120,95,.16) 0%, transparent 50%);
}

/* frosted glass surfaces */
.card, .stat, .qa, .checkin-hero ~ .card, details.card {
  background: var(--card-glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 8px 32px -12px rgba(31,38,135,.18), inset 0 1px 0 rgba(255,255,255,.6);
}
[data-theme="dark"] .card, [data-theme="dark"] .stat, [data-theme="dark"] .qa, [data-theme="dark"] details.card {
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 8px 32px -12px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
}
.topbar {
  background: var(--card-glass);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid rgba(255,255,255,.4);
}
[data-theme="dark"] .topbar { border-bottom: 1px solid rgba(255,255,255,.08); }
.glass-strong {
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,255,255,.62)) !important;
  backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6);
}
[data-theme="dark"] .glass-strong {
  background: linear-gradient(135deg, rgba(20,26,52,.86), rgba(14,19,40,.72)) !important;
}
/* glass chips, flash, chat drawer */
.chip, .flash { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.chat-drawer { backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5); }
/* inputs get a subtle glass tint */
input, select, textarea { background: rgba(255,255,255,.6); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: rgba(255,255,255,.05); color: var(--ink); }
/* timesheet grid cells */
.ts-cell { border-radius: 9px; }
.ts-cell:focus { background: var(--brand-soft); }
/* keep documents printable: solid white on print */
@media print { .card, .stat, .topbar { background: #fff !important; backdrop-filter: none !important; } body::before { display: none; } }
/* performance: phones get lighter blur */
@media (max-width: 640px) {
  .card, .stat, .qa, details.card, .topbar { backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3); }
}

/* ================= v12: extra responsive polish ================= */
/* invoice / quote line items: on small phones stack the qty & rate under the description
   instead of squeezing them into a 3-column grid that truncates the item name. */
@media (max-width: 480px) {
  .inv-row { grid-template-columns: 1fr !important; gap: 6px !important; }
  .inv-row > div, .inv-row > input { min-width: 0; }
  .inv-row input { width: 100% !important; }
}
/* never let long numbers / names burst out of their card */
.stat .sv, .stat .lb, .sub, h2, .section-title { overflow-wrap: anywhere; }
/* dashboard leave-balance bars: keep the bar inside its track on the smallest phones */
.bal-track { min-width: 0; }
/* data tables: let text wrap inside the swipe-card so nothing is forced to a huge min-width */
@media (max-width: 900px) {
  .card table th, .card table td { white-space: normal; }
  /* keep action-buttons columns from wrapping awkwardly, they are narrow already */
  .card table td form, .card table td .btn, .card table td.actions { white-space: nowrap; }
}
/* the topbar date chip is nice-to-have; on the smallest phones drop it to free space */
@media (max-width: 380px) {
  .tb-date { display: none !important; }
}
/* kiosk / check-in hero adjusts to very small screens */
@media (max-width: 380px) {
  .checkin-hero, .kiosk-hero { flex-direction: column; align-items: stretch; }
  .checkin-hero > *, .kiosk-hero > * { width: 100%; }
}
/* chat & toasts sit comfortably on tiny phones */
@media (max-width: 380px) {
  .chat-toast { font-size: 12.5px; }
}

/* ============================================================
   v14: Collapsible sidebar groups + profile & notification dropdowns
   ============================================================ */

/* ---- collapsible nav groups (dropdown accordion) ---- */
.nav { padding: 6px 12px 12px; gap: 2px; }
.ng { overflow: hidden; }
.ng-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit;
  padding: 12px 12px 6px; color: #8290b8; font-size: 10.5px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; transition: color .15s;
}
.ng-head:hover { color: #eaf0ff; }
.ng-head .ng-ar { font-size: 12px; color: #6b7aa6; transition: transform .25s; flex: none; }
.ng.open .ng-head .ng-ar { transform: rotate(180deg); color: #fff; }
.ng-body { max-height: 0; overflow: hidden; transition: max-height .32s ease, opacity .25s ease; opacity: 0; }
.ng.open .ng-body { max-height: 640px; opacity: 1; }

/* ---- profile dropdown (sidebar bottom) ---- */
.userbox { background: none !important; border: 0 !important; margin: 0 !important; padding: 6px 12px 14px !important; }
.u-drop { position: relative; width: 100%; }
.u-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 15px; color: #fff; font-family: inherit;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09);
  transition: background .18s, border-color .18s;
}
.u-btn:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.18); }
.u-btn .u-ar { margin-left: auto; font-size: 12px; color: #5f6f9c; transition: transform .25s; }
.u-open .u-btn .u-ar { transform: rotate(180deg); color: #fff; }
.u-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(6px); transition: .2s;
}
.u-open .u-menu { opacity: 1; visibility: visible; transform: none; }
.u-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.u-menu a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.u-menu a.u-out { color: var(--red); }
.u-menu a.u-out:hover { background: var(--red-soft); color: var(--red); }
.u-menu a .nav-badge { margin-left: auto; }
.u-sep { height: 1px; background: var(--line); margin: 6px 8px; }

/* ---- topbar dropdown menus (notifications) ---- */
.dd { position: relative; }
.dd-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 320px; max-width: 88vw; opacity: 0; visibility: hidden; transform: translateY(8px); transition: .2s;
}
.dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13.5px; }
.dd-all { color: var(--brand); font-size: 12px; font-weight: 600; text-decoration: none; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; align-items: flex-start; color: var(--ink);
  font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--line); }
.notif-item:hover { background: var(--brand-soft); text-decoration: none; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: rgba(37,99,235,.06); }
.notif-item.unread::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
  flex: none; margin-top: 6px; }
.notif-item .ni-ico { font-size: 17px; }
.notif-item .ni-msg { line-height: 1.35; }
.notif-item .ni-t { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.dd-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- tablet icon rail: hide group headers, show all icons ---- */
@media (max-width: 820px) and (min-width: 641px) {
  .ng-head { display: none; }
  .ng-body { max-height: none; overflow: visible; opacity: 1; }
  .ng { margin-bottom: 2px; }
  .nav a { margin: 2px 10px; padding: 9px 0; justify-content: center; }
  .nav a .icon, .nav a .icon.bi { width: auto; height: auto; background: none; font-size: 18px; padding: 0; }
  .nav a.active { background: rgba(255,255,255,.18); box-shadow: none; }
  .nav a.active .icon { background: none; box-shadow: none; }
  .u-btn { justify-content: center; padding: 8px 0; }
  .u-btn .uinfo, .u-btn .u-ar { display: none; }
  .u-menu { display: none; }
}

/* ---- mobile drawer: dropdown menus full-width friendly ---- */
@media (max-width: 640px) {
  .dd-menu { right: -12px; }
}

/* ============================================================
   v15: Premium dropdown & select theme (all dropdowns consistent)
   ============================================================ */

/* ---------- popup menus (profile, notifications) — frosted glass, not plain white ---------- */
.u-menu, .dd-menu {
  background: linear-gradient(160deg, rgba(255,255,255,.96) 0%, rgba(244,247,255,.92) 100%);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 24px 60px -18px rgba(15,23,42,.35), 0 4px 16px -6px rgba(37,99,235,.14);
  outline: 1px solid rgba(37,99,235,.08);
}
[data-theme="dark"] .u-menu, [data-theme="dark"] .dd-menu {
  background: linear-gradient(160deg, rgba(20,30,58,.92) 0%, rgba(13,21,42,.96) 100%);
  border: 1px solid rgba(120,150,220,.18);
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.7), 0 4px 16px -6px rgba(37,99,235,.20);
}
.u-menu a, .notif-item { color: var(--ink); }
.u-menu a { border-radius: 11px; }
.u-menu a:hover, .notif-item:hover {
  background: linear-gradient(90deg, rgba(37,99,235,.12), rgba(14,165,233,.10));
  color: var(--brand); }
.u-menu a.u-out:hover { background: var(--red-soft); color: var(--red); }
.dd-menu { border-top: 2.5px solid var(--brand-grad); border-top-color: var(--brand); }
.u-menu { border-bottom: 2.5px solid var(--brand-grad); }
[data-theme="dark"] .dd-menu { border-top-color: var(--brand); }

/* ---------- native <select> boxes — clean, readable, no repeating-text artifact ---------- */
select {
  /* We deliberately keep the NATIVE arrow (do NOT set appearance:none or a custom
     background-image). In Chromium, a background-image + appearance:none on a
     <select> causes the option text to repeat/overflow across the whole field.
     Keeping the native arrow is 100% reliable on every browser and still looks
     clean with our radius, border, padding and focus ring below. */
  padding-right: 14px;
}
select:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
select[multiple] { overflow: auto; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }

/* read the native <option> list clearly in both themes */
select option { background: var(--card); color: var(--ink); }
[data-theme="dark"] select option { background: #101a30; color: #e8eefb; }

/* ---------- general dropdown (details/summary) cards keep the glassy card look ---------- */
details.card > summary { transition: color .15s; }
details.card > summary:hover { color: var(--brand); }

/* ============================================================
   v17: Premium professional sidebar (polished)
   ============================================================ */

/* ---- richer gradient + subtle depth ---- */
.sidebar {
  background: linear-gradient(180deg, #123a86 0%, #1e50c8 46%, #2b6ae0 78%, #3b82f6 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08), inset 0 1px 0 rgba(255,255,255,.14);
}
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #0b1530 0%, #101f45 55%, #152a5c 100%);
}

/* ---- brand: logo mark + name + tagline ---- */
.sidebar .brand { padding: 26px 20px 22px; }
.sidebar .brand .bicon {
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 10px 24px -8px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.28);
}
.sidebar .brand .btwrap { display: flex; flex-direction: column; min-width: 0; }
.sidebar .brand .btxt { font-size: 18px; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.sidebar .brand .bsub {
  font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255,255,255,.55); font-weight: 600; margin-top: 4px; white-space: nowrap;
}

/* ---- collapsible section headers: refined ---- */
.ng-head {
  padding: 16px 12px 8px; color: rgba(255,255,255,.55);
  font-size: 10px; letter-spacing: .18em; position: relative;
}
.ng-head::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,0));
}
.ng-head:hover { color: rgba(255,255,255,.92); }
.ng-head .ng-ar { font-size: 11px; opacity: .7; }

/* ---- nav links: hover + active pill with icon chip ---- */
.nav a {
  margin: 2px 8px; padding: 10px 12px; border-radius: 12px;
  color: rgba(255,255,255,.78); font-size: 13.5px; font-weight: 500;
  gap: 11px; transition: all .18s;
}
.nav a .icon, .nav a .icon.bi {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 9px; font-size: 16px; transition: all .2s;
  background: rgba(255,255,255,.06);
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.nav a:hover .icon { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.nav a.active {
  background: linear-gradient(135deg, #ffffff, #eaf2ff);
  color: #1d4ed8; font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.45);
}
.nav a.active .icon { background: var(--brand-grad); color: #fff; box-shadow: 0 4px 10px -3px rgba(37,99,235,.6); }
.nav a.active::before { display: none; }
.nav a.active .ntxt { color: #1d4ed8; }
[data-theme="dark"] .nav a.active {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff;
}
[data-theme="dark"] .nav a.active .ntxt { color: #fff; }

/* ---- user profile box ---- */
.userbox { padding: 4px 12px 16px !important; }
.u-btn {
  padding: 11px 13px; border-radius: 15px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.16);
}
.u-btn:hover { background: linear-gradient(135deg, rgba(255,255,255,.20), rgba(255,255,255,.10)); border-color: rgba(255,255,255,.28); }
.u-btn .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }
.u-btn .uinfo .un { font-size: 13.5px; }
.u-btn .uinfo .ur { color: rgba(255,255,255,.6); }
a.lo { color: rgba(255,255,255,.6); }
a.lo:hover { color: #ff7b7b; }

/* active nav bell badge sits cleanly */
.nav a.active .nav-badge { background: #fff; color: #1d4ed8; }

/* ============================================================
   v18: Sidebar — guaranteed independent scroll + polish
   ============================================================ */

/* Sidebar is fixed and full-height; only the nav area scrolls when the menu
   overflows. height:100dvh keeps it correct on phones (browser toolbars). */
.sidebar { height: 100vh; height: 100dvh; overflow: hidden; }

/* Nav scrolls on its own; hidden-ish scrollbar keeps it clean but usable. */
.nav { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: 99px; }

/* Brand: tighter, more balanced header. */
.sidebar .brand { padding: 24px 18px 20px; gap: 11px; }
.sidebar .brand .btxt { font-size: 16.5px; font-weight: 800; }

/* Section headers: consistent rhythm, clear hierarchy. */
.ng-head { padding: 15px 11px 7px; }
.ng-head .ng-ar { opacity: .55; }
.ng.open .ng-head .ng-ar { opacity: 1; }

/* Nav links: comfortable spacing, crisp states. */
.nav a { margin: 2px 9px; padding: 9.5px 12px; border-radius: 11px; }
.nav a .icon, .nav a .icon.bi { width: 29px; height: 29px; border-radius: 8px; font-size: 15.5px; }
.nav a.active { box-shadow: 0 6px 14px -6px rgba(0,0,0,.4); }
.nav a.active .ntxt { letter-spacing: -.01em; }

/* User box: subtle top border to separate from nav, keep at the very bottom. */
.userbox { border-top: 1px solid rgba(255,255,255,.10); }

/* Mobile drawer: full height, independent scroll preserved. */
@media (max-width: 640px) {
  .sidebar { height: 100vh; height: 100dvh; }
}

/* ============================================================
   v19: Leave Overview dashboard card
   ============================================================ */
.lv-card { }
.lv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.lv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.lv-stat {
  background: var(--card-glass); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 15px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.lv-stat span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.lv-stat b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-family: var(--font-display); }
.lv-stat small { font-size: 10.5px; color: var(--muted); }
.lv-stat.lv-rem b { color: var(--green); }
.lv-stat.lv-ok b { color: var(--brand); }
.lv-progress { margin: 16px 0 4px; }
.lv-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
.lv-type .progress > i { width: var(--lvw); }
.lv-team { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.lv-team-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; margin-bottom: 12px; }
.lv-dep-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; color: var(--muted); margin-top: 14px; margin-bottom: 10px; }
.lv-deps { display: flex; gap: 8px; flex-wrap: wrap; }
.lv-deps .bal-pill b { font-size: 14px; }
@media (max-width: 900px) { .lv-grid { grid-template-columns: repeat(3, 1fr); } .lv-types { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .lv-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   v19: Password fields (show/hide, generate)
   ============================================================ */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 9px; border: 0; background: none;
  color: var(--muted); cursor: pointer; font-size: 16px; display: grid; place-items: center;
  transition: .15s;
}
.pw-eye:hover { color: var(--brand); background: var(--brand-soft); }

/* ============================================================
   v20: Live Status panel + dashboard polish
   ============================================================ */
.live-card { }
.live-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  display: inline-block; margin-left: 6px; vertical-align: middle;
  animation: lvpulse 1.6s ease-in-out infinite;
}
@keyframes lvpulse { 0%,100% { opacity: .4; box-shadow: 0 0 0 0 rgba(12,157,104,.5);} 50% { opacity: 1; box-shadow: 0 0 0 5px rgba(12,157,104,0);} }
.live-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.live-card .live-stat {
  background: var(--card-glass); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 15px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.live-stat span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.live-stat b { font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-family: var(--font-display); }
.live-stat small { font-size: 10.5px; color: var(--muted); }
.live-alerts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.live-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card-glass);
}
.live-chip.c-amber { color: var(--amber); background: var(--amber-soft); border-color: rgba(217,143,0,.25); }
.live-chip.c-red { color: var(--red); background: var(--red-soft); border-color: rgba(229,72,77,.25); }
.live-chip.c-blue { color: var(--brand); background: var(--brand-soft); border-color: rgba(37,99,235,.25); }
.live-chip.c-green { color: var(--green); background: var(--green-soft); border-color: rgba(12,157,104,.25); }
@media (max-width: 900px) { .live-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px) { .live-grid { grid-template-columns: repeat(2, 1fr); } }

/* ============================================================
   v21: Hard no-horizontal-overflow guard + robust sidebar scroll
   ============================================================ */

/* Never let anything create a horizontal page scrollbar. The sidebar is
   fixed (out of flow) so the main content alone must fit the viewport. */
html, body { max-width: 100%; overflow-x: hidden; }
body { overflow-x: hidden; }
.main { min-width: 0; }

/* Wide tables / grids stay contained: clip at the card edge and let their
   own .table-wrap scroll, instead of pushing the page wider. */
.card, .stat, .table-wrap { max-width: 100%; }
.table-wrap { overflow-x: auto; }

/* Sidebar: guarantee the nav is independently scrollable and never
   pushes the page. The brand stays fixed at top, user box at bottom. */
.sidebar { height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: contain; }
.sidebar .brand { flex: none; }
.sidebar .userbox { flex: none; }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* Mobile drawer: keep it inside the viewport, full height. */
@media (max-width: 640px) {
  .sidebar { height: 100vh; height: 100dvh; }
  .sidebar.open { max-width: 84vw; }
}

/* ============================================================
   v22: Sidebar interaction polish (workin/professional)
   ============================================================ */

/* Section headers feel clickable: pointer + subtle lift on hover. */
.ng-head { cursor: pointer; user-select: none; }
.ng-head:hover { color: #fff; }
.ng-head:hover .ng-ar { transform: translateY(1px); opacity: 1; }

/* Smoother accordion via max-height easings; add a gentle fade/slide to items. */
.ng-body { transition: max-height .38s cubic-bezier(.2,.8,.3,1), opacity .3s ease; }
.ng.open .ng-body { transition: max-height .42s cubic-bezier(.2,.8,.3,1), opacity .35s ease; }
.ng.open .ng-body a { animation: ngIn .28s ease both; }
@keyframes ngIn { from { opacity: 0; transform: translateX(-6px);} to { opacity: 1; transform: none; } }

/* Active section label becomes bright + underlined with a small pill glow. */
.ng.open > .ng-head .ng-label { color: rgba(255,255,255,.95); }

/* Add a subtle "count" pill to each section header showing how many items are in it,
   so headers read as grouped menus at a glance. */
.ng-head .ng-count {
  margin-left: auto; min-width: 18px; text-align: center; font-size: 9.5px; font-weight: 700;
  background: rgba(255,255,255,.10); color: rgba(255,255,255,.75);
  border-radius: 99px; padding: 2px 6px; line-height: 1.2;
}
.ng-head .ng-ar { margin-left: 6px; }

/* Nav items: consistent hover lift + press feedback. */
.nav a:active { transform: scale(.985); }

/* Collapsed sections: give a faint bottom hairline so the rail reads clean. */
.ng { border-bottom: 1px solid rgba(255,255,255,.05); }
.ng:last-child { border-bottom: 0; }
