* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Nunito", system-ui, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 24px; margin: 8px 0 2px; font-family: "Fredoka", sans-serif; font-weight: 600; color: var(--teal); }
h2 { font-size: 18px; margin: 0 0 12px; font-family: "Fredoka", sans-serif; font-weight: 600; color: var(--teal); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.hide { display: none !important; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.barright { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo { width: 48px; height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; }
.logo.sm { width: 36px; height: 36px; border-radius: 9px; font-size: 13px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat span { display: block; font-size: 13px; }
.stat b { font-size: 30px; font-weight: 600; font-family: "Fredoka", sans-serif; }
.stat small { color: var(--muted); margin-left: 4px; }

.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.pill.ok { background: var(--on-bg); color: var(--on-ink); }
.pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }

.btn { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger-ghost { color: var(--bad-ink); }
.btn.danger-ghost.active { background: var(--bad-ink); border-color: var(--bad-ink); color: #fff; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }

.modeline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.modebig { font-size: 24px; font-weight: 600; font-family: "Fredoka", sans-serif; color: var(--teal); }

.ctl { list-style: none; padding: 0; margin: 10px 0 14px; }
.ctl li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ctl li:last-child { border-bottom: 0; }
.sw { display: flex; gap: 6px; }
.state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--line); color: var(--muted); min-width: 72px; text-align: center; }
.state.on { background: var(--on-bg); color: var(--on-ink); }
.state.pause { background: var(--pause-bg); color: var(--pause-ink); }

.chead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cfg { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px 20px; }
.cfg fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; min-width: 0; }
.cfg legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.cfg label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; }
.cfg label > span { display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.cfg label > span .muted { width: 26px; font-size: 12px; }
.cfg input { width: 72px; }
.cfg input.dirty { border-color: var(--accent); box-shadow: 0 0 0 2px var(--on-bg); }
input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--input); color: var(--text); }

.evlist { list-style: none; padding: 0; margin: 0; max-height: 380px; overflow: auto; }
.evlist li { display: grid; grid-template-columns: 48px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.evlist li:last-child { border-bottom: 0; }
.evlist time { color: var(--muted); font-variant-numeric: tabular-nums; }
.evlist .sub { color: var(--muted); font-size: 12px; }

.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert.bad { background: var(--bad-bg); color: var(--bad-ink); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad-ink); color: #fff; }

/* Login */
.loginpage { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.logincard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 12px; }
.logincard label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.logincard .btn { width: 100%; padding: 10px; }
.logincard a { text-align: center; }

.statusbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.statusbar .who { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 700; }
.card, .stat { box-shadow: var(--shadow); }
.loginpage .logo-card { background: #fff; border-radius: 14px; padding: 8px; align-self: center; }
.loginpage .logo-card img { height: 120px; display: block; }
.logincard h1, .logincard > p { text-align: center; margin: 0; }

/* [KAMERA] live di panel */
.camlive { display: block; width: 100%; min-height: 200px; max-height: 480px; object-fit: contain; background: #000; border-radius: 12px; }
.login-inst { display: flex; justify-content: center; gap: 14px; }
.login-inst img { height: 52px; width: auto; }
.camlive:not([src]) { content: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); }
