:root {
  --pink: #1B78B0; --coral: #2E9AD6; --orange: #3AA6E0; --amber: #F9A03F;
  --ink: #0F1A2E; --text: #4a5870; --muted: #8a90a6;
  --line: #dcebf5; --soft: #e8f4fb; --bg: #f3f9fd;
  --ok: #1fa971; --ok-soft: #e6f7ef; --warn: #F9A03F; --warn-soft: #fff4e2; --bad: #e0344f; --bad-soft: #fde9ec;
  --grad: linear-gradient(135deg, #1B78B0 0%, #2E9AD6 100%);
  --radius: 1.1rem;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', 'Segoe UI', sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--pink); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.hub { color: #2E9AD6; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60rem 30rem at 85% -10%, rgba(58,166,224,.20), transparent 60%),
              radial-gradient(50rem 28rem at -10% 10%, rgba(27,120,176,.16), transparent 60%),
              linear-gradient(180deg, #f3f9fd 0%, #ffffff 100%); }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 1.4rem; padding: 34px 30px; box-shadow: 0 18px 50px -18px rgba(27,120,176,.35); }
.login-card .logo { display: block; width: 120px; margin: 0 auto 6px; }
.login-card h1 { text-align: center; color: var(--ink); font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.login-card p.sub { text-align: center; font-size: .92rem; margin: 6px 0 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .inp { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: .85rem; padding: 0 14px; background: #fff; transition: .2s; }
.field .inp:focus-within { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(46,154,214,.12); }
.field .inp i { color: var(--muted); }
.field input { flex: 1; border: 0; outline: 0; padding: 13px 0; font: inherit; color: var(--ink); background: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.4rem; border-radius: 999px; font-weight: 600; border: 0; transition: all .25s ease; font-size: .95rem; }
.btn-primary { background-image: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(46,154,214,.8); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn-primary:disabled { opacity: .7; transform: none; cursor: wait; }
.btn-ghost { color: var(--pink); border: 2px solid #b9dcf0; background: #fff; padding: .55rem 1.1rem; }
.btn-ghost:hover { background: var(--soft); }
.btn.block { width: 100%; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: .8rem; padding: 10px 14px; font-size: .88rem; margin-bottom: 14px; }
.foot-note { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 18px; }

/* ===== Layout ===== */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 1.15rem; letter-spacing: -.01em; }
.brand img { height: 38px; }
.brand span b { color: #2E9AD6; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav a { color: var(--text); font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 999px; display: flex; align-items: center; gap: 8px; }
.nav a:hover { background: var(--soft); color: var(--pink); }
.nav a.on { background: var(--soft); color: var(--pink); }
.spacer { flex: 1; }
.site-sel { border: 1.5px solid #b9dcf0; background: #fff; color: var(--ink); font: 600 .88rem 'Inter', sans-serif; padding: 8px 14px; border-radius: 999px; outline: 0; max-width: 220px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background-image: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .95rem; border: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { color: var(--ink); font-size: 1.6rem; font-weight: 800; letter-spacing: -.015em; }
.page-head p { font-size: .92rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pink); background: var(--soft); padding: .3rem .75rem; border-radius: 999px; margin-bottom: 6px; }
.tabbar { display: none; }

/* ===== Cards ===== */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px -10px rgba(27,120,176,.18); padding: 22px; }
.card.hover { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.card.hover:hover { transform: translateY(-5px); box-shadow: 0 18px 38px -14px rgba(46,154,214,.35); border-color: #b9dcf0; }
.card h3 { color: var(--ink); font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1.1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.chip { width: 2.8rem; height: 2.8rem; border-radius: .9rem; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; box-shadow: 0 8px 18px -8px rgba(46,154,214,.7); background-image: var(--grad); flex: none; }

/* Hero */
.hero { background: radial-gradient(40rem 20rem at 90% -20%, rgba(58,166,224,.22), transparent 60%), radial-gradient(34rem 18rem at -10% 0%, rgba(27,120,176,.15), transparent 60%), #fff;
  border: 1px solid var(--line); border-radius: 1.4rem; padding: 26px; display: grid; grid-template-columns: 240px 1fr; gap: 26px; align-items: center; box-shadow: 0 14px 40px -18px rgba(27,120,176,.3); }
.ring { position: relative; width: 210px; height: 210px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .val b { font-size: 2.7rem; font-weight: 800; color: var(--ink); line-height: 1; }
.ring .val span { font-size: .8rem; color: var(--muted); margin-top: 4px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 700; padding: .35rem .85rem; border-radius: 999px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: #c97a10; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.off { background: #eef0f5; color: var(--muted); }
.pill.chg { background: var(--soft); color: var(--pink); }
.hero h3 { font-size: 1.35rem; margin: 10px 0 4px; }
.hero .upd { font-size: .83rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: .95rem; padding: 14px; }
.stat i { color: var(--coral); font-size: .95rem; }
.stat b { display: block; color: var(--ink); font-size: 1.25rem; font-weight: 800; margin-top: 6px; }
.stat span { font-size: .76rem; color: var(--muted); font-weight: 600; }

/* Banner */
.banner { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-radius: var(--radius); margin: 18px 0; font-size: .93rem; }
.banner i { font-size: 1.3rem; }
.banner.ok { background: var(--ok-soft); color: #137a52; }
.banner.warn { background: var(--warn-soft); color: #9a5c08; }
.banner.bad { background: var(--bad-soft); color: #a01f35; }
.banner b { color: inherit; }

/* Device / module cards */
.dev h3 { display: flex; align-items: center; gap: 10px; }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.kv div { background: #f6fafd; border: 1px solid var(--line); border-radius: .8rem; padding: 10px 12px; }
.kv span { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }
.kv b { color: var(--ink); font-size: 1.02rem; }
.bar { height: 8px; background: #e2eef7; border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; background-image: var(--grad); border-radius: 99px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-title { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.small { font-size: .82rem; color: var(--muted); }

/* Chart */
.seg { display: inline-flex; background: #fff; border: 1.5px solid #b9dcf0; border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: .83rem; padding: 7px 14px; border-radius: 999px; }
.seg button.on { background-image: var(--grad); color: #fff; box-shadow: 0 6px 14px -8px rgba(46,154,214,.8); }
.chart { width: 100%; height: 280px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: .6rem; padding: 6px 10px; font-size: .78rem; transform: translate(-50%, -120%); white-space: nowrap; z-index: 5; }
.minmax { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.minmax div { background: #f6fafd; border: 1px solid var(--line); border-radius: .85rem; padding: 12px 14px; }
.minmax span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.minmax b { display: block; color: var(--ink); font-size: 1.15rem; }

/* Alarm */
.al { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; }
.al + .al { border-top: 1px solid var(--line); }
.al .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.al .ic.critical { background: var(--bad-soft); color: var(--bad); }
.al .ic.warning { background: var(--warn-soft); color: #c97a10; }
.al .ic.info { background: var(--soft); color: var(--pink); }
.al h4 { color: var(--ink); font-size: .98rem; }
.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty i { font-size: 2.2rem; color: #8ec9ea; margin-bottom: 10px; display: block; }

/* Modal & misc */
.modal-bg { position: fixed; inset: 0; background: rgba(31,35,64,.45); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: #fff; border-radius: 1.3rem; width: min(520px, 100%); padding: 26px; max-height: 85vh; overflow: auto; }
.modal h3 { font-size: 1.15rem; margin-bottom: 12px; }
.ins { border-radius: .9rem; padding: 13px 15px; margin-bottom: 10px; font-size: .9rem; }
.ins.success { background: var(--ok-soft); color: #137a52; }
.ins.warning { background: var(--warn-soft); color: #9a5c08; }
.ins.danger, .ins.critical { background: var(--bad-soft); color: #a01f35; }
.ins.neutral, .ins.info { background: #f1f3f8; color: var(--text); }
.ins b { display: block; margin-bottom: 2px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spin { width: 34px; height: 34px; border: 4px solid #b9dcf0; border-top-color: var(--coral); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.profile .r { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); gap: 14px; }
.profile .r:last-child { border-bottom: 0; }
.profile .r span { color: var(--muted); font-size: .88rem; }
.profile .r b { color: var(--ink); word-break: break-all; text-align: right; }
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .85rem; z-index: 100; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .brand span { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 50; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); padding: 6px 2px; border-radius: .8rem; }
  .tabbar a i { font-size: 1.15rem; }
  .tabbar a.on { color: var(--pink); background: var(--soft); }
  main { padding-bottom: 100px; }
}
@media (max-width: 520px) {
  .minmax { grid-template-columns: 1fr; }
  .page-head h2 { font-size: 1.35rem; }
  .site-sel { max-width: 150px; }
}

/* ===== Perangkat ===== */
.field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: .85rem; padding: 12px 14px; font: inherit; color: var(--ink); background: #fff; outline: 0; }
.field select:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(46,154,214,.12); }
.modal.wide { width: min(640px, 100%); }
.mfoot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { padding: .5rem .9rem; font-size: .82rem; }
.btn-ghost.danger { color: var(--bad); border-color: #f5c6cd; }
.btn-ghost.danger:hover { background: var(--bad-soft); }
.sec { border: 1px solid var(--line); border-radius: .95rem; padding: 14px 16px; margin-bottom: 12px; background: #fbfdff; }
.sec h4 { color: var(--ink); font-size: .95rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sec h4 i { color: var(--coral); }
.cred { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.cred:last-of-type { border-bottom: 0; }
.cred > span { width: 118px; flex: none; color: var(--muted); font-weight: 600; font-size: .78rem; }
.cred code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: var(--ink); word-break: break-all; }
.cp { border: 0; background: var(--soft); color: var(--pink); width: 30px; height: 30px; border-radius: 8px; flex: none; }
.cp:hover { background: #d3e9f6; }
details { margin-top: 8px; font-size: .85rem; } summary { cursor: pointer; color: var(--pink); font-weight: 600; }
pre.code { background: #0F1A2E; color: #d6e6f5; border-radius: .8rem; padding: 12px 14px; overflow: auto; font-size: .76rem; margin-top: 8px; line-height: 1.5; }
.opt { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: .9rem; padding: 12px 14px; margin-bottom: 10px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--coral); background: var(--soft); }
@media (max-width: 520px) { .cred { flex-wrap: wrap; } .cred > span { width: 100%; } }

.pill { white-space: nowrap; }
.dev h3 { min-width: 0; }

/* ===== Per sel ===== */
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cell { border: 1px solid var(--line); border-radius: .75rem; padding: 8px 6px; text-align: center; background: #fff; }
.cell small { display: block; font-size: .64rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.cell b { display: block; font-size: .95rem; color: var(--ink); margin: 2px 0; }
.cell .tg { font-size: .6rem; font-weight: 700; color: var(--pink); }
.cell.warn { background: var(--warn-soft); border-color: #f3d39a; }
.cell.bad { background: var(--bad-soft); border-color: #f2b3bd; }
.modal.wide { max-height: 88vh; }
#md button i { margin-right: 6px; }
@media (max-width: 520px) { #mm[style] { grid-template-columns: 1fr 1fr !important; } }

/* ===== Analisis ===== */
.fnd { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--coral); border-radius: var(--radius); padding: 16px 18px; box-shadow: 0 6px 24px -14px rgba(46,154,214,.3); }
.fnd.critical { border-left-color: var(--bad); } .fnd.warning { border-left-color: var(--warn); } .fnd.info { border-left-color: var(--coral); }
.fnd h4 { color: var(--ink); font-size: .98rem; display: flex; align-items: center; gap: 8px; }
.fnd.critical h4 i { color: var(--bad); } .fnd.warning h4 i { color: #c97a10; } .fnd.info h4 i { color: var(--coral); }
.fnd p { font-size: .9rem; margin-top: 4px; }
.fnd p.act { background: var(--soft); border-radius: .7rem; padding: 8px 12px; color: var(--ink); margin-top: 10px; }
.fnd p.act i { color: var(--coral); margin-right: 6px; }
@media (max-width: 900px) { .stats[style] { grid-template-columns: 1fr 1fr !important; } .tabbar a[data-r="akun"] { display: none; } }
