/* BabyCam design system: token dan komponen dari design/baby-cam.figcraft */
:root {
  --bg: #0b1020; --bg-alt: #0e1428; --surface: #131a2e; --surface2: #1a2340; --border: #26304d;
  --text: #f1f5f9; --muted: #9aa6c2; --amber: #fbbf24; --amber-dark: #1c1405; --mint: #5eead4; --rose: #fb7185;
  --lilac: #c4b5fd;
  --head: 'Poppins', system-ui, sans-serif; --body: 'Nunito Sans', system-ui, sans-serif;
  --r-sm: 12px; --r: 16px; --r-lg: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); min-height: 100vh; min-height: 100dvh; }
h1, h2, h3, h4, .head { font-family: var(--head); line-height: 1.2; }
a { color: var(--amber); text-decoration: none; font-family: var(--head); font-weight: 600; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
svg.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mint { color: var(--mint); } .amber { color: var(--amber); } .rose { color: var(--rose); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font: 600 12px var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eyebrow.amber { color: var(--amber); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 20px var(--head); color: var(--text); }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--amber); color: var(--amber-dark); display: grid; place-items: center; font-size: 20px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 22px; border-radius: 14px;
  font: 600 16px var(--head); border: 1px solid transparent; transition: filter .15s, opacity .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--amber); color: var(--amber-dark); }
.btn-secondary { border-color: var(--border); color: var(--text); }
.btn-danger { background: #fb71851a; border-color: var(--rose); color: var(--rose); }
.btn-danger-solid { background: var(--rose); color: #2a0710; }
.btn-white { background: #fff; color: #4a0f22; font-weight: 700; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 16px; font-size: 14px; border-radius: 999px; }
.btn-pill { border-radius: 999px; }
.link-btn { font: 600 14px var(--head); color: var(--amber); }
.link-btn.rose { color: var(--rose); }

/* form */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field-label { font: 500 14px var(--head); display: flex; justify-content: space-between; }
.input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--r-sm); background: var(--surface2);
  border: 1px solid var(--border); color: var(--muted); font-size: 18px; }
.input:focus-within { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber); }
.input input, .input select { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 15px var(--body); padding: 13px 0; }
.input select { appearance: none; cursor: pointer; }
.input select option { background: var(--surface2); }
.input input::placeholder { color: var(--muted); }
.input .toggle-pass { color: var(--muted); display: grid; font-size: 18px; }
.hint { font-size: 13px; color: var(--muted); }
.error-box { padding: 12px 14px; border-radius: var(--r-sm); background: #fb718514; border: 1px solid #fb71854d; color: #fecdd3; font-size: 14px; }
.ok-box { padding: 12px 14px; border-radius: var(--r-sm); background: #5eead414; border: 1px solid #5eead44d; color: var(--muted); font-size: 14px; display: flex; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { appearance: none; width: 20px; height: 20px; flex: none; border-radius: 6px; border: 1.5px solid var(--border); display: grid; place-items: center; cursor: pointer; margin-top: 1px; }
.check input:checked { background: var(--amber); border-color: var(--amber); }
.check input:checked::after { content: ''; width: 10px; height: 6px; border: 2px solid var(--amber-dark); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { appearance: none; position: absolute; inset: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: background .15s; }
.switch input:checked { background: var(--mint); }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked::after { transform: translateX(18px); }
.setting { display: flex; align-items: center; gap: 16px; }
.setting .title { font: 500 15px var(--head); }

/* range */
input[type=range] { width: 100%; accent-color: var(--amber); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
.card.tight { padding: 14px; border-radius: var(--r); }
.card-title { font: 600 16px var(--head); }
.icon-tile { width: 44px; height: 44px; border-radius: 14px; background: var(--surface2); display: grid; place-items: center; font-size: 22px; flex: none; }
.icon-tile.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
.tag { display: inline-flex; padding: 4px 10px; border-radius: 999px; font: 600 12px var(--head); white-space: nowrap; }
.tag-mint { background: #5eead41f; color: var(--mint); }
.tag-amber { background: #fbbf241f; color: var(--amber); }
.tag-rose { background: #fb71851f; color: var(--rose); }
.tag-muted { background: #9aa6c21f; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 700 15px var(--head); color: var(--bg); flex: none; }
.avatars { display: flex; } .avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); } .avatars .avatar:first-child { margin-left: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-banner { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); }
.status-banner.ok { background: #5eead414; border: 1px solid #5eead44d; }
.status-banner.alert { background: #fb718514; border: 1px solid #fb71854d; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: #0b1020cc; font: 600 13px var(--head); }
.live-pill .dot { background: var(--rose); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* audio meter */
.meter { display: flex; align-items: center; gap: 4px; height: 32px; }
.meter i { flex: 1; border-radius: 3px; background: var(--border); min-height: 6px; transition: background .08s; }
.meter i.on-mint { background: var(--mint); } .meter i.on-amber { background: var(--amber); } .meter i.on-rose { background: var(--rose); }

/* video */
.feed { position: relative; border-radius: var(--r-lg); overflow: hidden; background: linear-gradient(#1b2547, #0d1226); aspect-ratio: 16 / 9; }
.feed video, .feed img { width: 100%; height: 100%; object-fit: cover; }
.feed .overlay-tl { position: absolute; top: 14px; left: 14px; }
.feed .placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }
.feed .placeholder svg { font-size: 32px; display: block; margin: 0 auto 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: 14px; z-index: 100; box-shadow: 0 10px 30px #0008; font-size: 14px; max-width: calc(100% - 32px); }

/* sheet / modal */
.scrim { position: fixed; inset: 0; background: #000a; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 24px 24px 0 0; padding: 12px 20px calc(28px + var(--safe-b)); width: 100%; max-width: 480px;
  display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.sheet::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--border); }
@media (min-width: 900px) { .scrim { align-items: center; } .sheet { border-radius: 24px; } .sheet::before { display: none; } }

/* auth pages */
.auth { display: grid; grid-template-columns: 620px 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-brand { background: linear-gradient(160deg, #1d1a45, #0e1a38); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand h2 { font-size: 40px; margin-bottom: 20px; }
.auth-main { display: grid; place-items: center; padding: 48px; }
.auth-form { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 20px; }
.auth-form h1 { font-size: 30px; }
.auth-mobile-logo { display: none; }
@media (max-width: 1100px) { .auth { grid-template-columns: 1fr; } .auth-brand { display: none; } .auth-main { place-items: start center; padding: 24px 20px 40px; }
  .auth-mobile-logo { display: flex; margin-bottom: 8px; } .auth-form h1 { font-size: 26px; } }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role { text-align: left; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.role[aria-checked=true] { background: #fbbf2414; border: 1.5px solid var(--amber); }
.role .title { font: 600 15px var(--head); }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-boxes input { height: 56px; text-align: center; font: 600 24px var(--head); color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-sm); outline: 0; width: 100%; }
.code-boxes input:focus { border-color: var(--amber); }
.code-boxes.ok input { border-color: #5eead480; }

.center-page { display: grid; place-items: center; padding: 24px; }
.narrow { max-width: 440px; display: flex; flex-direction: column; gap: 16px; text-align: center; align-items: center; }

/* ---------- app shell: sidebar (laptop) / tab bar (HP) ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; min-height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; }
.sidebar .logo { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); font: 400 15px var(--head); font-size: 15px; }
.nav a svg { font-size: 18px; }
.nav a.active { background: var(--surface2); color: var(--text); font-weight: 500; }
.nav a.active svg { color: var(--amber); }
.account { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface2); }
.main { padding: 28px 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; }
.page-head h1 { font-size: 28px; }
.mobile-head, .tabbar { display: none; }
.cols { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat .value { font: 700 28px var(--head); }
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cam-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; color: var(--text); font: inherit; }
.cam-card .feed { border-radius: 0; }
.cam-card .info { padding: 14px 16px; display: flex; align-items: center; gap: 8px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit; text-align: left; width: 100%; }
.thumb { width: 64px; height: 44px; border-radius: 8px; overflow: hidden; flex: none; background: linear-gradient(#1b2547, #0d1226); display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.group > * { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; color: var(--text); font: 500 15px var(--head); text-align: left; }
.group > * + * { border-top: 1px solid var(--border); }
.group svg { font-size: 18px; color: var(--muted); }
.group .value { margin-left: auto; font: 400 13px var(--body); color: var(--muted); }
.group .rose, .group .rose svg { color: var(--rose); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font: 500 13px var(--head); }
.chip.on { background: var(--amber); border-color: var(--amber); color: var(--amber-dark); }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.control { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font: 500 12px var(--head); }
.control svg { font-size: 22px; }
.control.on { background: #fbbf2414; border-color: var(--amber); color: var(--text); }
.control.on svg { color: var(--amber); }
.big-code { font: 700 32px var(--head); letter-spacing: .12em; color: var(--amber); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }

@media (max-width: 899px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .mobile-head { display: flex; align-items: center; gap: 12px; padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 8px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .mobile-head .title { flex: 1; min-width: 0; }
  .mobile-head h1 { font-size: 22px; }
  .main { padding: 8px 20px calc(110px + var(--safe-b)); gap: 16px; }
  .main .page-head { display: none; }
  .cols, .grid-4 { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat { padding: 14px; } .stat .value { font-size: 22px; }
  .tabbar { display: flex; flex-direction: column; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    background: var(--surface); border-top: 1px solid var(--border); padding: 8px 12px calc(8px + var(--safe-b)); }
  .tabbar .tabs { display: grid; grid-template-columns: repeat(4, 1fr); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font: 500 11px var(--head); }
  .tabbar a .pill { width: 56px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-size: 22px; }
  .tabbar a.active { color: var(--amber); font-weight: 600; }
  .tabbar a.active .pill { background: #fbbf241f; }
}
.desktop-only { } .mobile-only { display: none; }
@media (max-width: 899px) { .desktop-only { display: none !important; } .mobile-only { display: revert; } }

/* alarm aktif: layar penuh */
.alarm { position: fixed; inset: 0; z-index: 60; background: linear-gradient(#4a0f22, #12060c); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 24px; padding: 48px 24px calc(32px + var(--safe-b)); text-align: center; overflow-y: auto; }
.alarm .pulse { width: 150px; height: 150px; border-radius: 50%; background: #fb718514; display: grid; place-items: center; animation: pulse 1.2s infinite; flex: none; }
.alarm .pulse span { width: 84px; height: 84px; border-radius: 50%; background: var(--rose); display: grid; place-items: center; color: #2a0710; font-size: 38px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 26px #fb718526; } }
.alarm h1 { font-size: 30px; }
.alarm .snap { width: 100%; max-width: 420px; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: linear-gradient(#1b2547, #0d1226); }
.alarm .snap img { width: 100%; height: 100%; object-fit: cover; }
.alarm .actions { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }

/* live preview, banner dibagikan, mode LAN */
.feed .feed-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feed video { position: relative; }
.feed .overlay-tl.stack-sm { gap: 8px; align-items: flex-start; }
.live-card .feed { aspect-ratio: 16 / 9; }
.shared-banner { border-color: var(--amber); background: #fbbf2410; }
.lan-blocked { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 320px; }
.lan-blocked .icon-tile { color: var(--amber); }
