/* InetMediaSiPrt — Sistem Informasi Rukun Tetangga
   Mobile-first. Warna hijau daun + kertas hangat. */
:root {
  --bg: #f4f2ec;
  --card: #ffffff;
  --ink: #1b2a21;
  --muted: #69736b;
  --line: #e4e0d5;
  --pri: #14532d;
  --pri-2: #1f7a43;
  --pri-soft: #e5f1e8;
  --ok: #15803d;   --ok-soft: #dcfce7;
  --warn: #b45309; --warn-soft: #fef3c7;
  --err: #b91c1c;  --err-soft: #fee2e2;
  --info: #1e5aa8; --info-soft: #e3edfa;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 40, 25, .06), 0 4px 14px rgba(20, 40, 25, .05);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1411; --card: #172019; --ink: #e6ece7; --muted: #95a198; --line: #26332b;
    --pri: #2f9a59; --pri-2: #3db56b; --pri-soft: #1a2e21;
    --ok: #4ade80; --ok-soft: #16301f; --warn: #fbbf24; --warn-soft: #362a0f;
    --err: #f87171; --err-soft: #3a1717; --info: #7fb0f0; --info-soft: #162538;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
}
body.login, body.install { padding-bottom: 24px; }
a { color: var(--pri-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.02rem; } h4 { font-size: .98rem; }
p { margin: 0 0 .6em; }
.ic { flex-shrink: 0; vertical-align: -.2em; }
code { background: var(--pri-soft); padding: 1px 5px; border-radius: 4px; }

.wrap { max-width: 680px; margin: 0 auto; padding: 14px 16px; }
.wrap.narrow { max-width: 420px; padding-top: 40px; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: var(--pri); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.appbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar-title strong { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-title small { font-size: .74rem; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-btn, .appbar-logo, .appbar-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
}
.appbar-btn:active { background: rgba(255,255,255,.15); }
.appbar-logo { background: rgba(255,255,255,.14); }
.appbar-avatar { background: #fff; color: var(--pri); font-weight: 700; border-radius: 50%; width: 36px; height: 36px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.bottomnav a {
  flex: 1; max-width: 136px; height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.bottomnav a .ic { width: 22px; height: 22px; padding: 0; }
.bottomnav a.on { color: var(--pri-2); }
.bottomnav a.on .ic { background: var(--pri-soft); border-radius: 999px; width: 52px; height: 28px; padding: 3px 15px; }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; border: 1px solid var(--line);
}
.card-link { display: block; color: inherit; }
.card-link:active { transform: scale(.995); }
.card-warn { border-left: 4px solid var(--warn); }
.card-ok { border-left: 4px solid var(--ok); }
.card.list, .list { padding: 4px 0; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: inherit;
  border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
}
.li:last-child { border-bottom: 0; }
.li > div, .li > a.grow { min-width: 0; }
.li b { display: block; overflow: hidden; text-overflow: ellipsis; }
.li small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.li small.inline { display: inline; }
.li .right { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li.danger b { color: var(--err); }
a.li:active, button.li:active { background: var(--pri-soft); }
.li > a.grow { color: inherit; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.avatar {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--pri-soft); color: var(--pri-2); font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; font-size: .95rem;
}
.avatar small { font-size: .7rem; color: var(--pri-2) !important; font-weight: 600; margin-top: 2px; }
.avatar.xl { width: 64px; height: 64px; border-radius: 50%; font-size: 1.6rem; }
.profile { display: flex; gap: 14px; align-items: center; }
.dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.dot.ok { background: var(--ok-soft); color: var(--ok); }
.dot.err { background: var(--err-soft); color: var(--err); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 8px; }
.section-head h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.section-head a { font-size: .85rem; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.big { font-size: 1.45rem; font-weight: 800; margin: 2px 0; }
.big small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); } .txt-err { color: var(--err); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 4px 0; }
ul.plain li.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 6px; font-weight: 700; }
.dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 12px 0; font-size: .92rem; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; word-break: break-word; }
.content { white-space: normal; word-wrap: break-word; margin: 10px 0 14px; }
.note { display: flex; gap: 10px; background: var(--info-soft); color: var(--info); border-color: transparent; font-size: .88rem; }
.reply { background: var(--pri-soft); border-color: transparent; }

/* ---------- Hero & dashboard ---------- */
.hero {
  margin: -14px -16px 14px; padding: 18px 20px 20px; color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.14) 0 60px, transparent 61px),
    radial-gradient(circle at 80% 105%, rgba(255,255,255,.08) 0 90px, transparent 91px),
    linear-gradient(160deg, var(--pri) 0%, #1d6b3c 100%);
  border-radius: 0 0 24px 24px;
}
.hero-hi { margin: 0; opacity: .85; font-size: .9rem; }
.hero-name { font-size: 1.35rem; margin: 0; }
.hero-role { font-size: .8rem; opacity: .75; margin: 2px 0 14px; }
.hero-kas {
  display: block; color: #fff; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(4px);
}
.hero-kas > span { font-size: .8rem; opacity: .85; display: block; }
.hero-kas strong { font-size: 1.6rem; display: block; letter-spacing: -.02em; }
.hero-kas small { font-size: .78rem; opacity: .9; }
.hero-kas .up { color: #bbf7d0; } .hero-kas .down { color: #fecaca; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.tile .ic { color: var(--pri-2); margin-bottom: 4px; }
.tile strong { font-size: 1.5rem; line-height: 1.1; }
.tile span { font-size: .78rem; color: var(--muted); }
.tile-alert { border-color: var(--warn); background: var(--warn-soft); }
.tile-alert .ic { color: var(--warn); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 12px; }
.quick a, .menu-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  color: var(--ink); font-size: .74rem; font-weight: 600; padding: 10px 2px;
}
.quick a .ic, .menu-grid a .ic {
  width: 48px; height: 48px; padding: 12px; border-radius: 16px; background: var(--card);
  color: var(--pri-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 4px; }
.menu-grid a .ic { background: var(--pri-soft); border: 0; box-shadow: none; }

.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; flex: 1; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--pri-2), #4cbf74); border-radius: 99px; transition: width .4s; }
.progress.p-err > span { background: linear-gradient(90deg, #dc6b5b, var(--err)); }
.hbar { display: grid; grid-template-columns: 112px 1fr auto; align-items: center; gap: 10px; font-size: .84rem; }
.hbar span:first-child { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .progress { margin: 6px 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.stats > div span { display: block; font-size: .78rem; color: var(--muted); }
.stats > div b { font-size: 1.08rem; }
.stats .full { grid-column: 1 / -1; }
details.card summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.card summary::after { content: "▾"; color: var(--muted); }
details[open].card summary { margin-bottom: 10px; }
details.card summary::-webkit-details-marker { display: none; }

.info-card h4 { margin: 8px 0 4px; }
.agenda { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.agenda-item {
  flex: 0 0 76%; max-width: 280px; display: flex; gap: 12px; align-items: center; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.agenda-item .date { background: var(--pri); color: #fff; border-radius: 12px; padding: 6px 10px; text-align: center; line-height: 1.1; }
.agenda-item .date b { font-size: 1.3rem; display: block; } .agenda-item .date span { font-size: .72rem; text-transform: uppercase; }
.agenda-item small { display: block; color: var(--muted); font-size: .8rem; }
.event { background: var(--pri-soft); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.event p { margin: 2px 0; }
.ronda-day { color: inherit; display: block; }
.ronda-day.today { border: 2px solid var(--warn); }
.ronda-day.mine { background: var(--pri-soft); }

/* ---------- Badges & chips ---------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-err { background: var(--err-soft); color: var(--err); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-muted { background: var(--line); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; white-space: nowrap; font: inherit; font-size: .82rem; font-weight: 600;
  padding: 6px 13px; border-radius: 99px; background: var(--card); color: var(--ink); border: 1px solid var(--line); cursor: pointer;
}
.chip.on { background: var(--pri); color: #fff; border-color: var(--pri); }
p.chips .chip { cursor: default; background: var(--pri-soft); border-color: transparent; color: var(--pri-2); }

/* ---------- Forms ---------- */
.form label { display: block; font-size: .84rem; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
.form h2, .form h3 { color: var(--ink); }
.form-sub { margin: 18px 0 10px !important; padding-top: 14px; border-top: 1px solid var(--line); font-size: .95rem; }
.form-sub:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px !important; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px;
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pri-2); background: var(--card); box-shadow: 0 0 0 3px var(--pri-soft); }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; padding: 0; border-radius: 6px; flex-shrink: 0; display: inline-grid; place-items: center; cursor: pointer; }
input[type=checkbox]:checked { background: var(--pri-2); border-color: var(--pri-2); }
input[type=checkbox]:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
label.check { display: flex !important; align-items: center; gap: 10px; color: var(--ink) !important; font-weight: 500 !important; }
.check-li { cursor: pointer; }
.big-input { font-size: 1.5rem !important; font-weight: 800; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; }
.inline-form label { flex: 1; margin: 0; }
form.inline { display: inline; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  background: var(--pri-2); color: #fff; border: 0; border-radius: 12px; padding: 12px 18px; text-align: center;
}
.btn:active { filter: brightness(.92); transform: translateY(1px); }
.btn-block { display: flex; width: 100%; margin-top: 6px; }
.btn-sm { padding: 7px 12px; font-size: .84rem; border-radius: 10px; }
.btn-ghost { background: var(--pri-soft); color: var(--pri-2); }
.btn-ok { background: var(--ok-soft); color: var(--ok); }
.btn-danger { background: var(--err); }
.btn-danger-ghost { background: var(--err-soft); color: var(--err); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-row .grow { flex: 1; }
.sticky-bottom { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); padding-top: 6px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg a { text-align: center; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 700; }
.seg a.on.ok { background: var(--ok-soft); color: var(--ok); }
.seg a.on.err { background: var(--err-soft); color: var(--err); }

.search { position: relative; display: block; margin-bottom: 8px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { margin: 0; padding-left: 40px; background: var(--card); border-radius: 99px; }

.period { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.period > a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.period form { flex: 1; }
.period input { margin: 0; text-align: center; font-weight: 700; background: var(--card); }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: max(16px, calc(50% - 324px)); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25;
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 16px;
  border-radius: 18px; background: var(--pri-2); color: #fff; font-weight: 700;
  box-shadow: 0 6px 20px rgba(20, 83, 45, .35);
}
.fab-group { position: fixed; right: max(16px, calc(50% - 324px)); bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25; display: flex; gap: 10px; }
.fab-group .fab { position: static; }
.fab-err { background: var(--err); box-shadow: 0 6px 20px rgba(185, 28, 28, .3); }

/* ---------- Flash, empty, brand ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
  background: var(--ok-soft); color: var(--ok); font-size: .9rem; animation: drop .3s ease-out;
}
.flash a { color: inherit; text-decoration: underline; }
.flash-err { background: var(--err-soft); color: var(--err); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { color: var(--pri-2); opacity: .55; margin-bottom: 6px; }
.empty .btn { margin-top: 8px; }
.brand { text-align: center; margin-bottom: 22px; }
.brand img { border-radius: 20px; box-shadow: var(--shadow); }
.brand h1 { font-size: 1.7rem; margin: 10px 0 2px; color: var(--pri-2); }
.brand p { color: var(--muted); margin: 0; }
.article h2 { margin-top: 8px; }

@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .menu-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 360px) {
  .row2 { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 90px 1fr auto; }
}

/* Pemilih bulan: label berbahasa Indonesia di atas input bawaan */
.period form { position: relative; }
.period .plabel {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; font-weight: 700; color: var(--ink);
}
.period .plabel .ic { color: var(--muted); }
.period form input[type=month] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }

/* Branding INETmedia */
.appbar-logo { background: #fff; border-radius: 12px; padding: 6px; }
.appbar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand .brand-logo { width: 150px; height: auto; border-radius: 0; box-shadow: none; }
.login .brand, .install .brand { background: #fff; border-radius: 24px; padding: 26px 20px 20px; border: 1px solid var(--line); }
.brand h1 { letter-spacing: -.02em; }
.powered { text-align: center; margin: 26px 0 8px; }
.powered img { width: 120px; height: auto; display: block; margin: 0 auto 8px; }
@media (prefers-color-scheme: dark) {
  .login .brand, .install .brand { background: #fff; }
  .login .brand p, .install .brand p { color: #5d6a61; }
  .powered img { background: #fff; padding: 10px 14px; border-radius: 14px; box-sizing: content-box; }
}
