:root {
  --black: #0B0B0C;
  --black-2: #17181A;
  --black-3: #232427;
  --green: #B5FF2E;
  --green-dim: #8FD11A;
  --green-soft: #EEFFD1;
  --bg: #F1F2EE;
  --card: #FFFFFF;
  --line: #E3E4DF;
  --text: #0B0B0C;
  --muted: #6E716B;
  --red: #E5484D; --red-soft: #FDECEC;
  --amber: #F5A524; --amber-soft: #FFF4DE;
  --blue: #3E7BFA; --blue-soft: #E8F0FF;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.4; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, .display { font-family: var(--display); letter-spacing: .01em; margin: 0; }
h1 { font-size: 30px; font-weight: 700; text-transform: uppercase; line-height: 1.05; }
h2 { font-size: 21px; font-weight: 700; text-transform: uppercase; }
h3 { font-size: 17px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(84px + var(--safe-b)); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--black); color: #fff;
  padding: calc(10px + var(--safe-t)) 16px 10px; display: flex; align-items: center; gap: 12px;
}
.topbar .logo { width: 36px; height: 36px; border-radius: 10px; }
.topbar .brand { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .06em; line-height: 1; }
.topbar .brand small { display: block; color: var(--green); font-size: 11px; letter-spacing: .18em; margin-top: 3px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--black-3); color: #fff; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--green); color: var(--black); font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.page { padding: 18px 16px 24px; max-width: 1100px; margin: 0 auto; animation: fade .18s ease-out; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head .kicker { font-family: var(--display); color: var(--muted); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--black);
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + var(--safe-b));
  border-top: 1px solid var(--black-3);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: #8C8F88; font-size: 11px; font-weight: 600; border-radius: 12px; }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.active { color: var(--green); }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.card.dark { background: var(--black); color: #fff; border-color: var(--black); }
.card.dark .muted { color: #9EA19A; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title h2, .card-title h3 { font-size: 16px; text-transform: uppercase; font-family: var(--display); letter-spacing: .06em; }
.section { margin-top: 22px; }
.section > h2 { font-size: 15px; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px; }

.hero { background: var(--black); color: #fff; border-radius: 22px; padding: 18px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 180px; height: 180px; border-radius: 50%; border: 26px solid rgba(181,255,46,.12); }
.hero .big { font-family: var(--display); font-size: 40px; font-weight: 700; color: var(--green); line-height: 1; }
.hero .label { font-family: var(--display); letter-spacing: .14em; font-size: 12px; text-transform: uppercase; color: #9EA19A; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.kpi .v { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1.05; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi.accent { background: var(--green); border-color: var(--green); }
.kpi.accent .l { color: #2D3A12; }
.kpi.dark { background: var(--black); border-color: var(--black); color: #fff; }
.kpi.dark .l { color: #9EA19A; }
.kpi.dark .v { color: var(--green); }

/* ---------- Lists ---------- */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item:active { background: #F7F8F5; }
.item .t { font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); }
.chev { color: #B9BBB5; width: 18px; height: 18px; flex: none; }
.avatar { width: 42px; height: 42px; border-radius: 13px; background: var(--black); color: var(--green); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 16px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 76px; height: 76px; border-radius: 22px; font-size: 28px; }
.time-pill { font-family: var(--display); font-weight: 700; font-size: 17px; background: var(--black); color: var(--green); border-radius: 12px; padding: 8px 10px; text-align: center; min-width: 64px; line-height: 1; }
.time-pill small { display: block; font-size: 11px; color: #9EA19A; margin-top: 3px; font-weight: 600; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: #C6C8C1; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 4px 8px; border-radius: 8px; text-transform: uppercase; white-space: nowrap; background: #ECEDE8; color: #44473F; }
.badge.green { background: var(--green-soft); color: #3D6A00; }
.badge.red { background: var(--red-soft); color: #B42318; }
.badge.amber { background: var(--amber-soft); color: #9A5B00; }
.badge.blue { background: var(--blue-soft); color: #1F4FC2; }
.badge.dark { background: var(--black); color: var(--green); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 700; cursor: pointer; background: var(--black); color: #fff; min-height: 46px; transition: transform .08s; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn.green { background: var(--green); color: var(--black); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--text); }
.btn.light { background: #ECEDE8; color: var(--text); }
.btn.danger { background: var(--red-soft); color: #B42318; }
.btn.sm { min-height: 36px; padding: 8px 12px; border-radius: 11px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.fab { position: fixed; right: 18px; bottom: calc(92px + var(--safe-b)); z-index: 25; width: 58px; height: 58px; border-radius: 19px; background: var(--green); color: var(--black); border: 0; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; }
.fab svg { width: 26px; height: 26px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); padding: 8px 13px; border-radius: 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
.chip.active { background: var(--black); color: var(--green); border-color: var(--black); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #E5E6E1; border-radius: 13px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg button.active { background: var(--black); color: var(--green); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: #FAFAF8; border-radius: 13px; padding: 12px 13px; font-size: 16px; outline: none; min-height: 46px; }
.input:focus { border-color: var(--black); background: #fff; }
textarea.input { min-height: 90px; resize: vertical; }
.input.err { border-color: var(--red); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--black); flex: none; margin: 0; }
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; left: 13px; top: 13px; width: 20px; height: 20px; color: var(--muted); }
.search .input { padding-left: 42px; background: var(--card); }
.multi { max-height: 260px; overflow: auto; border: 1.5px solid var(--line); border-radius: 13px; padding: 4px 12px; background: #FAFAF8; }
.form-error { background: var(--red-soft); color: #B42318; border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* ---------- Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(11,11,12,.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s; }
.sheet { background: var(--bg); width: 100%; max-width: 620px; max-height: 92vh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column; animation: up .22s cubic-bezier(.2,.9,.3,1); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.sheet-head h2 { font-size: 20px; }
.sheet-body { overflow: auto; padding: 4px 18px calc(18px + var(--safe-b)); }
.sheet .grabber { width: 40px; height: 5px; background: #CFD0CB; border-radius: 3px; margin: 8px auto 0; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fadein { from { opacity: 0; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b)); background: var(--black); color: #fff; padding: 12px 16px; border-radius: 14px; z-index: 80; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 92vw; display: flex; gap: 8px; align-items: center; animation: up .2s; }
.toast.err { background: #B42318; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.toast.err::before { background: #fff; }

/* ---------- Progress ---------- */
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1; }
.ring .c small { display: block; font-size: 11px; color: var(--muted); font-family: var(--font); font-weight: 600; margin-top: 2px; }
.bar { height: 8px; background: #E5E6E1; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green-dim); border-radius: 6px; }

/* ---------- Attendance ---------- */
.att { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.att button { border: 1.5px solid var(--line); background: #FAFAF8; border-radius: 12px; padding: 10px 4px; font-weight: 700; font-size: 13px; cursor: pointer; }
.att button.on[data-s="PRESENT"] { background: var(--green); border-color: var(--green); }
.att button.on[data-s="ABSENT"] { background: var(--red); border-color: var(--red); color: #fff; }
.att button.on[data-s="JUSTIFIED"] { background: var(--amber); border-color: var(--amber); color: #fff; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .day { aspect-ratio: 1 / 1.05; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 5px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; }
.cal .day.out { opacity: .35; }
.cal .day.today { border: 2px solid var(--black); }
.cal .day .n { font-size: 10px; background: var(--black); color: var(--green); border-radius: 6px; padding: 1px 5px; align-self: flex-start; font-weight: 700; }
.daybar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.daybar .lbl { font-family: var(--display); font-weight: 700; font-size: 18px; text-transform: uppercase; text-align: center; flex: 1; }
.day-group { margin-bottom: 14px; }
.day-group > .h { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 14px; color: var(--muted); margin: 0 4px 6px; }
.day-group > .h.today { color: var(--text); }
.cancelled { opacity: .55; }
.cancelled .t { text-decoration: line-through; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: auto; display: block; }
.card.dark .avatar { background: var(--green); color: var(--black); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.table tr.total td { font-family: var(--display); font-size: 20px; font-weight: 700; padding-top: 14px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 16px 0 14px; scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: none; padding: 10px 12px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; }
.tabs button.active { color: var(--text); border-color: var(--green-dim); }

.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 8px; text-align: center; font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.menu-grid a svg { width: 26px; height: 26px; }
.menu-grid a .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--black); color: var(--green); display: grid; place-items: center; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; background: var(--black); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b)); position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 50px solid rgba(181,255,46,.08); right: -200px; top: -140px; }
.auth::after { content: ''; position: absolute; left: -40px; right: -40px; bottom: 90px; height: 2px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 14px, transparent 14px 26px); }
.auth-inner { width: 100%; max-width: 400px; margin: 0 auto; position: relative; z-index: 1; }
.auth .logo { width: 76px; height: 76px; border-radius: 22px; margin-bottom: 18px; }
.auth h1 { font-size: 42px; line-height: .95; }
.auth h1 em { font-style: normal; color: var(--green); }
.auth .sub { color: #9EA19A; margin: 10px 0 26px; }
.auth .field > span { color: #9EA19A; }
.auth .input { background: var(--black-2); border-color: var(--black-3); color: #fff; }
.auth .input:focus { border-color: var(--green); background: var(--black-2); }

.spinner { width: 28px; height: 28px; border: 3px solid #D9DAD5; border-top-color: var(--black); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .bottomnav, .fab-mobile-only { display: none; }
  .main { padding-bottom: 30px; }
  .sidebar { display: flex; flex-direction: column; width: 250px; flex: none; background: var(--black); color: #fff; position: sticky; top: 0; height: 100vh; padding: 20px 14px; overflow-y: auto; }
  .sidebar .brandbox { display: flex; gap: 10px; align-items: center; padding: 0 6px 18px; }
  .sidebar .brandbox img { width: 40px; height: 40px; border-radius: 11px; }
  .sidebar a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: #A9ACA5; font-weight: 600; font-size: 15px; }
  .sidebar a svg { width: 19px; height: 19px; }
  .sidebar a:hover { background: var(--black-2); color: #fff; }
  .sidebar a.active { background: var(--black-3); color: var(--green); }
  .topbar .brandwrap { display: none; }
  .topbar { background: var(--bg); color: var(--text); padding: 14px 28px; justify-content: flex-end; position: static; }
  .topbar .icon-btn { background: var(--card); color: var(--text); border: 1px solid var(--line); }
  .page { padding: 8px 28px 30px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .fab { bottom: 30px; right: 30px; }
  .backdrop { align-items: center; }
  .sheet { border-radius: 24px; }
  .toast { bottom: 30px; }
  .cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
  .menu-grid { grid-template-columns: repeat(5, 1fr); }
}
.item > svg { width: 20px; height: 20px; flex: none; color: #9A9C97; }
