/* Eufy Cams — neutral palette (clean grays / white / black), no ads.
   One restrained accent family only where functional: status colors. */
:root {
  --bg: #f3f3f5;
  --panel: #ffffff;
  --panel-2: #ececf0;
  --border: #d8d8de;
  --text: #16161a;
  --muted: #6f6f78;
  --accent: #26262c;
  --accent-2: #45454e;
  --silver: #3c3c44;
  --ok: #178a5c;
  --warn: #8a6400;
  --err: #cf3838;
  --radius: 16px;
}
* { box-sizing: border-box; }
/* The `hidden` attribute must always win over layout display rules below
   (e.g. .login-wrap is display:flex — without this rule the login view
   stayed visible on top of the app after sign-in). */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
}
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--err); font-size: 14px; margin: 10px 0 0; }

/* ---------- login ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: min(360px, 100%); text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 24px; padding: 32px 24px; box-shadow: 0 16px 44px rgba(20,20,25,.12); }
.logo-lg { width: 104px; height: 104px; border-radius: 22.5%; box-shadow: 0 8px 24px rgba(20,20,25,.18); }
.login-card h1 { margin: 16px 0 4px; font-size: 26px; }
.login-card form { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.login-card input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); padding: 13px 14px; font-size: 17px; text-align: center; letter-spacing: 3px;
}
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 12px; padding: 13px 16px; font-weight: 600; }
.btn-primary:active { transform: translateY(1px); }

/* ---------- app frame ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-sm { width: 34px; height: 34px; border-radius: 22.5%; }
.brand-name { font-weight: 700; font-size: 17px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn-ghost { background: var(--panel); color: var(--silver); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px; }
.pill { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.pill-ok { color: var(--ok); border-color: rgba(23,138,92,.45); }
.pill-off { color: var(--warn); border-color: rgba(138,100,0,.4); }
.content { max-width: 1100px; margin: 0 auto; padding: 18px 14px 30px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 26px; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 17px; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); background: var(--panel-2); padding: 3px 8px; border-radius: 999px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1 1 70px; background: var(--panel-2); color: var(--silver); border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px; }
.status-bar { background: #fdf6dd; border: 1px solid #e6d189; color: #7a5b00; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }

/* ---------- camera grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.cam { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-align: left; padding: 0; color: var(--text); width: 100%; }
.cam-pic { aspect-ratio: 16/9; background: linear-gradient(160deg, #e8e8ed, #d7d7de); display: flex; align-items: center; justify-content: center; }
.cam-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-pic .ph { width: 64px; height: 64px; border-radius: 22.5%; opacity: .5; }
.cam-body { padding: 12px 14px 14px; }
.cam-name { font-weight: 600; font-size: 15px; margin: 0 0 2px; }
.cam-model { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); color: var(--silver); border: 1px solid var(--border); }
.badge-motion { color: #8a6400; border-color: #e0cd8f; background: #fdf6dd; }
.badge-person { color: var(--accent-2); border-color: var(--border); }
.cam-toggles { display: flex; gap: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.switch-row input { display: none; }
.switch { width: 36px; height: 20px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); position: relative; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--silver); }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { left: 18px; background: #fff; }
.switch-row input:disabled + .switch { opacity: .45; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(18,18,22,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; width: min(560px, 100%); padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-pic { aspect-ratio: 16/9; border-radius: 12px; background: linear-gradient(160deg, #e8e8ed, #d7d7de); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 12px; }
.modal-pic img { width: 100%; height: 100%; object-fit: cover; }
.modal-pic .ph { width: 72px; height: 72px; border-radius: 22.5%; opacity: .5; }
.modal-controls { display: flex; gap: 18px; justify-content: center; border-top: 1px solid var(--border); padding-top: 12px; }
