:root {
  --brand:    #E8412B;  /* Knoxed red */
  --brand-d:  #c9301c;
  --accent:   #F7941E;  /* Knoxed orange */
  --ink:      #1f2733;
  --muted:    #6b7785;
  --line:     #e6e9ee;
  --bg:       #f4f6f9;
  --card:     #ffffff;
  --ok:#1a8a4b; --okbg:#e7f6ed; --warn:#9a6200; --warnbg:#fff3df;
  --bad:#c0392b; --badbg:#fdecea; --pend:#9a6200; --pendbg:#fff3df;
  --radius:16px; --shadow:0 1px 3px rgba(20,30,45,.06), 0 6px 18px rgba(20,30,45,.05);
  --header-h:60px; --nav-h:64px;
}
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  font-family:"Open Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  font-size:16px; line-height:1.55; color:var(--ink); background:var(--bg);
  -webkit-text-size-adjust:100%; min-height:100dvh;
}
h1,h2,h3 { font-family:"Poppins",sans-serif; color:var(--ink); margin:0 0 14px; line-height:1.25; }
h1 { font-size:1.45rem; font-weight:600; }
.muted { color:var(--muted); }
a { color:var(--brand); }
svg { width:1.4em; height:1.4em; display:block; }

/* ---------- Header ---------- */
.topbar {
  position:sticky; top:0; z-index:40; height:var(--header-h);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:0 16px; background:#fff; border-bottom:1px solid var(--line);
  box-shadow:0 1px 2px rgba(20,30,45,.04);
}
.brand { display:flex; align-items:center; }
.logo { height:30px; width:auto; display:block; }
.portal-tag { font-family:"Poppins",sans-serif; font-weight:600; color:var(--brand); font-size:.95rem; }
.logout {
  display:inline-flex; align-items:center; gap:6px; text-decoration:none;
  color:var(--muted); font-weight:600; font-size:.85rem; padding:8px 10px;
  border-radius:10px; min-height:40px;
}
.logout svg { width:18px; height:18px; }
.logout:hover { color:var(--brand); background:#faf0ee; }

/* ---------- Layout ---------- */
.container { max-width:620px; margin:0 auto; padding:20px 16px; }
body.app .container { padding-bottom:calc(var(--nav-h) + 20px); }
body.auth .container { min-height:calc(100dvh - var(--header-h) - 120px); display:flex; flex-direction:column; justify-content:center; }

/* ---------- Footer ---------- */
.sitefooter { border-top:1px solid var(--line); background:#fff; color:var(--muted); }
body.app .sitefooter { margin-bottom:var(--nav-h); }
.foot-inner { max-width:620px; margin:0 auto; padding:18px 16px; display:flex; flex-direction:column; gap:3px; font-size:.78rem; }
.foot-inner strong { color:var(--ink); font-size:.85rem; }

/* ---------- Cards / lists ---------- */
.card, .cards li {
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.cards { list-style:none; padding:0; margin:16px 0 0; display:flex; flex-direction:column; gap:12px; }
.cards li { padding:14px 16px; }
.cards .row { display:flex; justify-content:space-between; align-items:center; gap:10px; }

/* balance hero */
.balance-card {
  padding:18px 18px; margin-bottom:18px;
  background:linear-gradient(135deg,var(--brand),var(--accent)); color:#fff;
  border:0; border-radius:var(--radius); box-shadow:var(--shadow);
}
.balance-card .label { font-size:.8rem; opacity:.9; text-transform:uppercase; letter-spacing:.04em; }
.balance-card .value { font-family:"Poppins",sans-serif; font-size:2rem; font-weight:700; line-height:1.1; }
.balance-card .value small { font-size:.9rem; font-weight:500; opacity:.9; }

/* per-category leave balance */
.balance-block { padding:14px 16px; margin-bottom:16px; }
.bb-head { display:flex; justify-content:space-between; align-items:baseline; font-family:"Poppins",sans-serif; font-weight:600; margin-bottom:8px; }
.bal-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; }
.bal-list li { display:flex; justify-content:space-between; align-items:baseline; gap:10px; padding:8px 0; border-top:1px solid var(--line); }
.bal-list li:first-child { border-top:0; }
.bl-name { font-weight:500; }
.bl-val { font-family:"Poppins",sans-serif; font-weight:700; white-space:nowrap; }

/* home tiles */
.tiles { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.tiles a {
  display:flex; flex-direction:column; gap:10px; text-decoration:none; color:var(--ink);
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:16px 14px; min-height:104px; font-weight:600;
  transition:transform .15s ease, box-shadow .15s ease;
}
.tiles a:hover { transform:translateY(-2px); box-shadow:0 8px 22px rgba(20,30,45,.10); }
.tiles a .ico {
  display:inline-flex; align-items:center; justify-content:center; width:42px; height:42px;
  border-radius:12px; background:#faf0ee; color:var(--brand);
}
.tiles a .ico svg { width:22px; height:22px; }
.tiles a.accent .ico { background:#fff3df; color:var(--accent); }

/* skill score bars */
.score { font-family:"Poppins",sans-serif; font-weight:700; color:var(--ink); }
.bar { height:8px; background:var(--line); border-radius:6px; margin-top:10px; overflow:hidden; }
.bar span { display:block; height:100%; background:linear-gradient(90deg,var(--accent),var(--brand)); border-radius:6px; }
.resolution { margin-top:10px; padding-top:10px; border-top:1px dashed var(--line); font-size:.92rem; }

/* status chips */
.chip { font-size:.72rem; font-weight:700; padding:4px 10px; border-radius:999px; text-transform:capitalize; white-space:nowrap; }
.chip.yes,.chip.resolved { background:var(--okbg); color:var(--ok); }
.chip.pending { background:var(--pendbg); color:var(--pend); }
.chip.no,.chip.cancelled { background:var(--badbg); color:var(--bad); }

/* ---------- Forms ---------- */
form { display:flex; flex-direction:column; gap:15px; margin-top:4px; }
.card form { margin:0; }
label { display:flex; flex-direction:column; gap:6px; font-weight:600; font-size:.92rem; }
label.check { flex-direction:row; align-items:center; gap:10px; font-weight:400; }
input,select,textarea {
  font:inherit; padding:13px 14px; border:1.5px solid var(--line); border-radius:12px;
  background:#fff; min-height:50px; width:100%; color:var(--ink); transition:border-color .15s ease, box-shadow .15s ease;
}
input:focus,select:focus,textarea:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 3px rgba(232,65,43,.15); }
textarea { min-height:120px; resize:vertical; }
input[type=checkbox] { width:auto; min-height:0; width:20px; height:20px; accent-color:var(--brand); }
button {
  font:inherit; font-family:"Poppins",sans-serif; font-weight:600; color:#fff;
  background:var(--brand); border:0; border-radius:12px; padding:14px; min-height:52px;
  cursor:pointer; transition:background .15s ease;
}
button:hover { background:var(--brand-d); }
button:focus-visible { outline:3px solid rgba(232,65,43,.4); outline-offset:2px; }

/* action button (link styled as button) */
.btn-primary {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:"Poppins",sans-serif; font-weight:600; text-decoration:none;
  background:var(--brand); color:#fff; border-radius:12px; padding:13px 18px; min-height:50px;
}
.btn-primary svg { width:18px; height:18px; }
.btn-primary:hover { background:var(--brand-d); }

/* messages */
.err,.warn { padding:11px 14px; border-radius:12px; font-size:.92rem; display:flex; gap:8px; }
.err  { background:var(--badbg);  color:var(--bad); }
.warn { background:var(--warnbg); color:var(--warn); }

/* auth pages */
body.auth .auth-card { text-align:center; }
body.auth .auth-icon {
  width:56px; height:56px; margin:0 auto 14px; border-radius:16px;
  display:flex; align-items:center; justify-content:center; background:#faf0ee; color:var(--brand);
}
body.auth .auth-icon svg { width:28px; height:28px; }
body.auth form { max-width:340px; margin:18px auto 0; text-align:left; }

/* empty state */
.empty { text-align:center; color:var(--muted); padding:34px 10px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position:fixed; left:0; right:0; bottom:0; z-index:50; height:var(--nav-h);
  display:flex; background:#fff; border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
  box-shadow:0 -1px 10px rgba(20,30,45,.05);
}
.bottomnav a {
  flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  text-decoration:none; color:var(--muted); font-size:.68rem; font-weight:600; min-height:48px;
}
.bottomnav a svg { width:22px; height:22px; }
.bottomnav a.active { color:var(--brand); }
.bottomnav a.active svg { stroke-width:2.4; }

@media (min-width:640px) {
  .bottomnav { max-width:620px; margin:0 auto; border-radius:16px 16px 0 0; right:0; left:0; }
}
@media (prefers-reduced-motion:reduce) { * { transition:none !important; } }
