:root {
  color-scheme: light;
  --paper: #f8f6f1;
  --surface: #fffdf9;
  --text: #28241f;
  --muted: #726b63;
  --line: #e9e3d9;
  --tint: #f0ebe1;
  --accent: #a24b34;
  --accent-light: #f7e6dd;
  --green: #377b5f;
  --blue: #366e87;
  --peach: #a45c35;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--paper);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
[hidden], .icons { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #bd694e; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.icon { display: inline-block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { max-width: 1200px; margin: auto; padding: 0 36px; height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.brand { display: flex; place-items: center; gap: 11px; width: max-content; font-size: 19px; font-weight: 760; letter-spacing: .05em; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; background: var(--accent-light); color: var(--accent); }
.brand-mark .icon { width: 24px; height: 24px; }
.nav { display: flex; align-items: center; gap: 5px; }
.nav a { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; color: var(--muted); font-size: 14px; font-weight: 620; white-space: nowrap; }
.nav a .icon { width: 18px; height: 18px; }
.nav a:hover { background: var(--paper); }
.nav a[aria-current] { background: var(--tint); color: var(--text); }
.top-end { display: flex; justify-content: flex-end; gap: 14px; align-items: center; }
.camera-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.camera-state i, .live-chip i, .record-badge i { width: 7px; height: 7px; border-radius: 50%; background: #9a9185; }
.camera-state.online i { background: var(--green); }
.camera-state.privacy i { background: #b17659; }
.icon-button, .video-button { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.icon-button:hover:not(:disabled), .soft-button:hover:not(:disabled), .pill:hover { background: var(--tint); }
.gear { border-color: transparent; background: transparent; }
.main { max-width: 1080px; padding: 35px 28px 64px; margin: auto; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 19px; }
h1 { font-size: clamp(27px, 4vw, 38px); font-weight: 760; letter-spacing: -.055em; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 730; }
h3 { font-size: 15px; font-weight: 720; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.65; }
.today-date { font-variant-numeric: tabular-nums; }
.viewer { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; background: #201d1a; overflow: hidden; border-radius: 20px; box-shadow: 0 12px 35px #46382915; isolation: isolate; }
.viewer:fullscreen { width: 100%; height: 100%; border-radius: 0; background: #171412; }
.viewer video, .live-poster { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.live-poster { pointer-events: none; }
.viewer-empty { position: relative; z-index: 2; display: grid; place-items: center; gap: 13px; font-size: 14px; color: #e8dfd4; padding: 18px 24px; border-radius: 16px; background: #29231e; }
.viewer-empty .icon { width: 28px; height: 28px; color: #d7a48e; }
.viewer-top, .viewer-controls { z-index: 3; display: flex; gap: 8px; position: absolute; }
.viewer-top { top: 16px; left: 16px; }
.viewer-controls { right: 14px; bottom: 14px; gap: 6px; }
.live-chip, .record-badge { background: #201a17c9; color: #fff9ee; border: 1px solid #ffffff28; padding: 6px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; line-height: 1; }
.live-chip i { background: #94d7aa; }
.record-badge i { background: #ed7464; }
.video-button { color: #fff8ec; background: #201a17c9; border-color: #ffffff25; }
.video-button:hover { background: #2e2824; }
.camera-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; margin: 14px 0 22px; }
.soft-button, .primary-button { min-height: 41px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 8px 13px; font-size: 13px; font-weight: 630; white-space: nowrap; }
.soft-button .icon { width: 17px; height: 17px; }
.soft-button.recording { color: var(--accent); background: var(--accent-light); border-color: #ecd0c3; }
.primary-button { background: #373027; color: #fffaf3; border-color: #373027; }
.primary-button:hover:not(:disabled) { background: #594b3b; }
.action-divider { width: 1px; height: 20px; background: #e3dcce; margin: 0 2px; }
.ptz-panel { margin: -10px 0 18px; text-align: center; }
.ptz-controls { display: flex; justify-content: center; gap: 7px; }
.ptz-controls .icon-button { min-width: 44px; height: 44px; touch-action: manipulation; }
.ptz-controls .is-turning { color: var(--accent); background: var(--accent-light); opacity: 1; }
#ptz-feedback { min-height: 18px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.today-card { padding: 17px 20px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; }
.today-head, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.text-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 13px; font-weight: 660; }
.text-link .icon { width: 15px; height: 15px; }
.today-metrics { display: grid; grid-template-columns: 1fr 1fr; margin-top: 13px; border-top: 1px solid var(--line); }
.metric { padding: 13px 12px 2px 0; display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.metric + .metric { border-left: 1px solid var(--line); padding-left: 16px; }
.metric-icon { width: 33px; height: 33px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; }
.metric-icon .icon { width: 18px; height: 18px; }
.blue { background: #e8f0f1; color: var(--blue); }
.peach { background: #f7e9dc; color: var(--peach); }
.blue-text { color: var(--blue); }
.peach-text { color: var(--peach); }
.metric strong { margin-left: auto; color: var(--text); font-size: 25px; font-weight: 730; font-variant-numeric: tabular-nums; line-height: 1; }
.metric small { color: var(--muted); font-size: 12px; }
.coverage-note { color: var(--muted); margin-top: 12px; font-size: 12px; line-height: 1.55; }
.inline-button { color: var(--accent); background: transparent; border: 0; padding: 2px 0 2px 6px; margin-left: 2px; font-weight: 680; }
.settings { margin-top: 18px; padding: 16px 20px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); scroll-margin: 12px; }
.settings .icon-button { border-color: transparent; }
.privacy-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 15px 0; margin-top: 2px; border-top: 1px solid var(--line); font-size: 14px; }
.privacy-row small { display: block; color: var(--muted); margin-top: 5px; font-size: 12px; }
.privacy-row input { appearance: none; width: 40px; height: 23px; cursor: pointer; border-radius: 999px; background: #dad1c4; margin: 0; flex: none; }
.privacy-row input::before { display: block; content: ""; margin: 3px; width: 17px; height: 17px; background: white; border-radius: 50%; }
.privacy-row input:checked { background: var(--accent); }
.privacy-row input:checked::before { margin-left: 20px; }
.zone-settings { border-top: 1px solid var(--line); padding: 15px 0; }
.zone-settings p { margin-top: 4px; }
.settings-foot { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.55; }
#calibrate { margin-top: 14px; }
.zone-canvas { position: relative; aspect-ratio: 16 / 9; margin-top: 10px; background: #302922; border-radius: 11px; overflow: hidden; touch-action: none; cursor: crosshair; }
.zone-canvas img { position: absolute; width: 100%; height: 100%; pointer-events: none; }
.zone { position: absolute; pointer-events: none; border: 2px solid #76d8ec; background: #23bfe020; }
.zone span { position: absolute; left: -2px; top: -2px; padding: 2px 6px; background: #76d8ec; color: #172628; font-size: 11px; white-space: nowrap; }
.food-zone { border-color: #ffbb91; background: #ffb38423; }
.food-zone span { background: #ffbb91; }
.calibrate-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.day-picker { display: flex; align-items: center; gap: 5px; }
.day-picker .icon-button { min-width: 34px; height: 33px; }
.day-picker input { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 33px; padding: 4px 7px; font-size: 13px; }
.day-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.day-summary p { margin-top: 5px; }
.day-totals { display: flex; gap: 16px; }
.day-totals span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.day-totals b { font-size: 22px; color: var(--text); font-variant-numeric: tabular-nums; }
.list-head { margin: 18px 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 12px; min-height: 33px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.pill[aria-pressed="true"] { background: var(--tint); color: var(--text); border-color: #e3dacb; font-weight: 650; }
.pill .icon { width: 15px; height: 15px; }
.ask-toggle { min-height: 34px; }
.ask-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ask-form input { flex: 1; min-width: 140px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.ask-answer { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.entries { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: 125px 1fr; align-items: center; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 10px; gap: 13px; }
.entry-media { display: block; position: relative; background: var(--tint); border-radius: 9px; overflow: hidden; border: 0; padding: 0; aspect-ratio: 16/10; }
.entry-media img, .asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-icon { display: grid; place-items: center; color: var(--muted); width: 100%; height: 100%; }
.media-icon .icon { width: 27px; height: 27px; }
.media-play { position: absolute; right: 7px; bottom: 7px; background: #211b16c9; border-radius: 8px; padding: 4px; color: white; }
.media-play .icon { width: 16px; height: 16px; }
.entry-main { min-width: 0; }
.entry-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; font-weight: 680; }
.entry-time { color: var(--muted); font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; }
.badge { padding: 2px 6px; background: var(--tint); border-radius: 5px; font-size: 11px; color: var(--muted); }
.badge.review { color: var(--accent); background: var(--accent-light); }
.entry-detail { margin: 5px 0; font-size: 12px; color: var(--muted); }
.entry-tools { display: flex; gap: 7px; flex-wrap: wrap; }
.entry-tools select, .entry-tools button { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 12px; min-height: 29px; padding: 3px 6px; }
.empty { grid-column: 1/-1; display: grid; place-items: center; text-align: center; min-height: 210px; padding: 24px; border: 1px dashed #e2d7c9; border-radius: 16px; background: #fbf8f2; color: var(--muted); gap: 8px; align-content: center; }
.empty .icon { width: 29px; height: 29px; margin: 0 0 4px; color: #997359; }
.empty strong { font-size: 15px; color: var(--text); }
.empty p { font-size: 13px; line-height: 1.6; }
.album-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-top: 15px; }
.asset { position: relative; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 13px; overflow: hidden; }
.asset-thumb { display: block; position: relative; width: 100%; padding: 0; border: 0; aspect-ratio: 4/3; background: var(--tint); overflow: hidden; }
.asset-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px; color: var(--muted); font-size: 12px; }
.asset-meta .icon-button { min-width: 33px; height: 33px; border-color: transparent; }
.favorite-on { color: var(--accent); }
.favorite-on .icon { fill: var(--accent-light); }
.asset-dialog { color: var(--text); border: 1px solid var(--line); border-radius: 17px; background: var(--surface); width: min(870px, calc(100% - 24px)); max-height: 88vh; padding: 13px; }
.asset-dialog::backdrop { background: #1c1713ba; }
.asset-head { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 9px 5px; }
#asset-body img, #asset-body video { display: block; width: 100%; max-height: 66vh; aspect-ratio: 16/9; object-fit: contain; background: #231e1a; border-radius: 9px; }
.asset-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 10px; }
.toast { position: fixed; z-index: 8; bottom: 22px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); width: max-content; background: #352c24; color: #fff9ed; padding: 10px 15px; border-radius: 12px; font-size: 13px; box-shadow: 0 4px 25px #0003; }
@media (max-width: 680px) {
  .top-inner { height: 58px; padding: 0 14px; grid-template-columns: 1fr auto; }
  .brand { font-size: 17px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark .icon { width: 21px; height: 21px; }
  .top-end { gap: 7px; }
  .nav { z-index: 6; position: fixed; inset: auto 0 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 5px 9px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
  .nav a { flex-direction: column; gap: 3px; min-height: 48px; padding: 4px; font-size: 11px; border-radius: 10px; }
  .nav a .icon { width: 19px; height: 19px; }
  .main { padding: 20px 13px calc(78px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 13px; }
  .viewer { border-radius: 14px; }
  .viewer-top { top: 9px; left: 9px; }
  .viewer-controls { right: 9px; bottom: 9px; }
  .video-button { min-width: 36px; height: 36px; }
  .camera-actions { gap: 5px; margin: 10px 0 15px; }
  .camera-actions .soft-button { gap: 5px; padding: 7px 8px; }
  .action-divider { margin: 0 1px; }
  .today-card, .settings, .day-summary { padding: 13px; border-radius: 14px; }
  .metric { gap: 5px; padding-right: 8px; }
  .metric + .metric { padding-left: 9px; }
  .metric-icon { width: 29px; height: 29px; }
  .day-totals { gap: 9px; }
  .list-head { flex-wrap: wrap; }
  .pill { padding-inline: 9px; }
  .album-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .entry { grid-template-columns: 92px minmax(0,1fr); gap: 9px; padding: 8px; }
  .toast { bottom: calc(66px + env(safe-area-inset-bottom)); }
}
@media (max-width: 370px) {
  .action-divider { display: none; }
  .camera-actions .soft-button { font-size: 12px; padding: 6px; }
  .camera-actions .soft-button .icon { width: 15px; height: 15px; }
}

.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 18px 48px;
  background: radial-gradient(ellipse at 50% 0, #fbefe5, var(--paper) 62%);
}
.login-wrap { width: min(100%, 390px); }
.login-brand { margin: 0 auto 20px; }
.login-card {
  padding: clamp(22px, 7vw, 33px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 16px 46px #4b37240e;
}
.login-card h1 { font-size: 26px; margin-bottom: 24px; }
.login-form { display: grid; gap: 8px; }
.login-label { font-size: 14px; font-weight: 650; }
.login-password { position: relative; }
.login-input {
  display: block;
  width: 100%;
  min-height: 46px;
  border: 1px solid #e0d8cc;
  border-radius: 10px;
  background: #fffcf6;
  padding: 9px 12px;
  font-size: 16px;
}
.login-input + .login-label { margin-top: 8px; }
.login-password .login-input { padding-right: 56px; }
.login-reveal {
  position: absolute;
  inset: 4px 4px 4px auto;
  border: 0;
  border-radius: 7px;
  padding: 4px 9px;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
}
.login-reveal:hover { background: var(--accent-light); }
.login-submit { margin-top: 12px; min-height: 46px; font-size: 15px; }
.login-error { color: var(--accent); font-size: 13px; line-height: 1.6; }
.settings-account { display: flex; justify-content: flex-end; margin-top: 12px; }
