/* e-Raport — tampilan mobile-first */
:root {
  --bg: #f3f6f4; --card: #fff; --ink: #1c2421; --muted: #66746d; --line: #dfe6e2;
  --pri: #166534; --pri-ink: #fff; --pri-soft: #e3f1e7; --warn: #b45309; --warn-soft: #fef3c7;
  --err: #b91c1c; --err-soft: #fee2e2; --ok-soft: #dcfce7; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--pri); }
h1 { font-size: 1.35rem; margin: .2rem 0; }
h2 { font-size: 1.05rem; margin: 1rem 0 .6rem; }
.card > h2:first-child, .form > h2:first-of-type { margin-top: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
code { background: #eef2f0; padding: 1px 5px; border-radius: 4px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--pri); color: var(--pri-ink); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.topbar .tb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar small { opacity: .85; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back, .topbar .menu-btn { color: inherit; background: none; border: 0; font-size: 1.7rem; line-height: 1; padding: 0 .35rem; text-decoration: none; cursor: pointer; min-width: 40px; min-height: 40px; display: grid; place-items: center; }

/* side nav */
.sidenav { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sn-inner { position: absolute; right: 0; top: 0; bottom: 0; width: min(80vw, 300px); background: var(--card); padding: 1rem 0; overflow-y: auto; transform: translateX(100%); transition: transform .2s; }
.nav-open .sidenav { opacity: 1; pointer-events: auto; }
.nav-open .sn-inner { transform: none; }
.sn-user { padding: .4rem 1.2rem 1rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; display: flex; flex-direction: column; }
.sn-user small { color: var(--muted); }
.sidenav a { display: flex; gap: .8rem; align-items: center; padding: .8rem 1.2rem; color: var(--ink); text-decoration: none; }
.sidenav a.on { background: var(--pri-soft); color: var(--pri); font-weight: 600; }
.sidenav a span { width: 1.4rem; text-align: center; }

/* layout */
.wrap { max-width: 760px; margin: 0 auto; padding: 1rem .9rem 3rem; }
.wrap.narrow { max-width: 480px; }
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--line); }
.card.highlight { border-color: var(--pri); }
.active-card { border: 2px solid var(--pri); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.hello { margin: .3rem 0 1rem; }

/* forms */
.form label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .8rem; }
.form label > input, .form label > select, .form label > textarea, .searchbar input, .searchbar select {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .8rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #cdd8d2; border-radius: 10px; min-height: 46px; }
.form textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri); outline-offset: 0; border-color: var(--pri); }
.form label.check, label.check { display: flex; align-items: center; gap: .6rem; color: var(--ink); font-size: .95rem; padding: .35rem 0; }
label.check input { width: 22px; height: 22px; accent-color: var(--pri); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 .8rem; }
legend { font-size: .88rem; color: var(--muted); margin-bottom: .35rem; }
.row2, .row3 { display: grid; gap: 0 .7rem; grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; border: 1px solid #cdd8d2; color: var(--muted); font-weight: 600; cursor: pointer; }
.chip input:checked + span { background: var(--pri); border-color: var(--pri); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: 2px; }
.checklist { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: .3rem .7rem; margin-bottom: .8rem; }
.searchbar { display: flex; gap: .5rem; margin-bottom: .8rem; }
.searchbar input { flex: 2; margin: 0; } .searchbar select { flex: 1; margin: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.1rem; min-height: 46px; border-radius: 10px; border: 1px solid var(--pri); background: var(--pri); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: #fff; color: var(--pri); }
.btn.danger { background: #fff; color: var(--err); border-color: #f3b4b4; }
.btn.small { min-height: 36px; padding: .35rem .7rem; font-size: .85rem; }
.btn:active { transform: translateY(1px); }
.btns { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.btns form { display: contents; }
form + form, .card + form { margin-top: 0; }

/* lists */
.list { padding: .3rem 0; }
.list > h2, .list > p { padding: 0 1rem; }
.item { display: flex; flex-direction: column; padding: .75rem 1rem; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.list .item:first-child, .list h2 + .item, .list p + .item { border-top: 0; }
a.item:active { background: var(--pri-soft); }
.item span { color: var(--muted); font-size: .85rem; }
.item.off { opacity: .55; }
.item.row { flex-direction: row; align-items: center; gap: .6rem; }
.item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item .no { width: 2rem; text-align: center; color: var(--muted); font-weight: 600; }
.item form { margin: 0; }
details.item summary { cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; }
details.item ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.group { padding: .5rem 1rem; background: #f6f9f7; font-size: .8rem; font-weight: 700; color: var(--pri); letter-spacing: .02em; border-top: 1px solid var(--line); }
.form .group { margin: .4rem -1rem .7rem; }
a.group.link { display: block; text-decoration: none; }
s { opacity: .35; }

/* misc */
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--ok-soft); color: #14532d; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.warn-t { color: var(--warn); font-style: normal; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: #eef2f0; color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--pri); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.stat b { font-size: 1.6rem; color: var(--pri); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn b { color: var(--warn); }
.steps { margin: 0; padding-left: 1.3rem; }
.steps li { padding: .35rem 0; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }
.steps li.done::marker { content: "✓  "; color: var(--pri); }
.tabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.tabs a { flex: none; padding: .55rem 1rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .9rem; }
.tabs a.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.table-wrap { overflow-x: auto; margin: 0 -1rem .8rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl th, .tbl td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { background: #f6f9f7; font-weight: 600; }
.inline-note { font-size: .85rem; color: var(--muted); padding: .4rem 0; }
textarea[readonly] { width: 100%; font: .85rem/1.4 ui-monospace, monospace; padding: .6rem; border-radius: 10px; border: 1px solid var(--line); }

/* login */
.login { max-width: 420px; margin: 2rem auto 0; }
.brand { text-align: center; margin-bottom: 1.2rem; }
.brand .logo { font-size: 2.6rem; }
.brand p { color: var(--muted); margin: .2rem 0 0; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .wrap { padding-top: 1.5rem; }
}

/* input nilai */
.nilai-form .head { font-size: .8rem; color: var(--muted); font-weight: 600; }
.nilai-h { width: 5.2rem; text-align: center; }
.nilai-row { cursor: text; }
.nilai-row b { font-weight: 500; font-size: .95rem; }
.nilai-in { width: 4.6rem; min-height: 44px; font: inherit; font-size: 1.15rem; font-weight: 600; text-align: center; border: 1px solid #cdd8d2; border-radius: 10px; padding: .3rem; background: #fff; color: var(--ink); }
.nilai-in.low { color: var(--err); border-color: #f3b4b4; background: var(--err-soft); }
.nilai-in[readonly] { background: #f3f6f4; }
.st { width: 1.1rem; text-align: center; font-weight: 700; flex: none; }
.st.ok { color: var(--pri); } .st.wait { color: var(--muted); } .st.err { color: var(--err); }
details.card summary { cursor: pointer; }
details.item summary .grow { flex: 1; }

/* presensi & jurnal */
.sesi .card-head { align-items: flex-start; }
.sesi-tepat { border-left: 4px solid var(--pri); }
.sesi-telat, .sesi-susulan { border-left: 4px solid var(--warn); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.presensi .nm { font-size: .92rem; }
.seg { display: flex; gap: 3px; flex: none; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.seg span { display: grid; place-items: center; width: 34px; height: 36px; border-radius: 8px; border: 1px solid #cdd8d2; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; background: #fff; }
.seg input:checked + span { color: #fff; }
.seg-H input:checked + span { background: var(--pri); border-color: var(--pri); }
.seg-S input:checked + span { background: #2563eb; border-color: #2563eb; }
.seg-I input:checked + span { background: #ca8a04; border-color: #ca8a04; }
.seg-A input:checked + span { background: var(--err); border-color: var(--err); }
.seg input:focus-visible + span { outline: 2px solid var(--pri); outline-offset: 1px; }
.gps-msg { margin: .5rem 0 0; }
input[type=month], input[type=date] { min-height: 46px; }
.searchbar input[type=month], .searchbar input[type=date] { flex: 1; padding: .6rem .8rem; border: 1px solid #cdd8d2; border-radius: 10px; font: inherit; background: #fff; }
.tbl-wrap-card { overflow-x: auto; }
.status-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; background: #cbd5d1; }
.status-dot.tepat { background: var(--pri); } .status-dot.telat, .status-dot.susulan { background: #ca8a04; } .status-dot.belum { background: var(--err); }

.sn-sep { padding: .9rem 1.2rem .3rem; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--line); margin-top: .4rem; }
