/* Paleta EXACTA de la app Dahua DMSS 2.6.22 (Alonso, 2026-11-11), leída de sus recursos (aapt2 dump resources del
   APK de la tablet) y del logo. Cada valor cita su recurso; el modo oscuro usa la variante `night` de DMSS. Detalle
   en docs/paleta-dmss.md. */
:root {
  --bg: #f3f3f3;            /* color_common_all_page_list_bg */
  --surface: #ffffff;       /* color_common_all_page_bg */
  --surface-2: #f0f0f0;     /* color_common_all_list_bg_h */
  --text: #22262d;          /* color_common_text_title_black */
  --muted: #515151;         /* HDUIColorT2 / color_common_text_title_light_black */
  --border: #e7e7e7;        /* color_common_all_list_line_bg */
  --accent: #2590ff;        /* HDUIColorT1 / color_common_default_main_bg */
  --accent-press: #006ee0;  /* color_common_btn_main_bg_h */
  --accent-soft: #e4f2ff;   /* color_common_btn_login_bg_n_16 */
  --accent-text: #ffffff;   /* color_common_button_text */
  --danger: #ff5c47;        /* color_common_btn_delete_bg_h */
  --ok: #10aa6e;            /* color_common_control_normal_video_bg */
  --motion: #ffcc00;        /* color_common_control_motion_detect_video_bg */
  --brand-top: #3699fe;     /* logo DMSS, arriba del degradado */
  --brand-bottom: #1287ff;  /* logo DMSS, abajo del degradado */
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 2px 8px rgb(0 0 0 / .05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181e26;          /* color_common_all_page_list_bg (night) */
    --surface: #212833;     /* color_common_all_page_bg (night) */
    --surface-2: #1c232d;   /* account_bind_area_code_input (night) */
    --text: #ffffff;        /* color_common_text_title_light_black (night) */
    --muted: #babbbe;       /* color_common_vth_status_text_color (night) */
    --border: #344052;      /* color_common_all_list_line_bg (night) */
    --accent: #2590ff;      /* HDUIColorT1 (sin variante night) */
    --accent-press: #006ee0;
    --accent-soft: #1d2d46; /* area_code_item_press_color (night) */
    --accent-text: #ffffff;
    --danger: #ff4d4f;      /* HDUIColorMR (night) */
    --ok: #29cf74;          /* HDUIColorMG (night) */
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
p { margin: .4rem 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.screen.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.narrow { width: 100%; max-width: 440px; }
.logo { display: block; margin: 0 auto 12px; border-radius: 18px; }
#install-gate h1, #install-gate > .narrow > p { text-align: center; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 12px 0;
}
.card ol { padding-left: 1.25rem; margin: .4rem 0 0; }
.card li { margin: .3rem 0; }
.note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.bar h1 { flex: 1; font-size: 1.1rem; margin: 0; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

.view { padding: 12px 16px calc(env(safe-area-inset-bottom) + 24px); max-width: 720px; margin: 0 auto; }

label { display: block; font-weight: 600; font-size: .92rem; margin: 12px 0 6px; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-height: 48px;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; }

.btn {
  font: inherit; font-weight: 600; border-radius: 12px; min-height: 48px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:active { background: var(--accent-press); border-color: var(--accent-press); }
.btn:not(.primary):active, .chip:active { background: var(--accent-soft); }
.btn.danger { color: var(--danger); }
.btn.block { display: block; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .55; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.error { color: var(--danger); font-size: .92rem; min-height: 1.2em; margin-top: 8px; }

.cams { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cam {
  display: block; width: 100%; text-align: left; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.thumb { aspect-ratio: 16 / 9; width: 100%; background: var(--surface-2); object-fit: cover; display: block; }
.thumb.empty { display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.cam .meta { padding: 10px 12px 12px; }
.cam .name { font-weight: 650; }

.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .92rem; cursor: pointer; min-height: 40px;
}
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.events { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.event { padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.event img { border-radius: 10px; }
.event span { display: block; font-size: .88rem; padding: 4px 2px 0; font-variant-numeric: tabular-nums; }

.player { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.player .bar { background: rgb(0 0 0 / .6); border: 0; color: #fff; }
.player .bar .icon-btn { color: #fff; }
.player video { flex: 1; width: 100%; min-height: 0; background: #000; }
.player .actions { display: flex; gap: 8px; padding: 10px 16px calc(env(safe-area-inset-bottom) + 12px); justify-content: center; }
.player .status { color: #ddd; text-align: center; padding: 6px; font-size: .9rem; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pill { font-size: .78rem; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; color: var(--muted); }
.secret { font-family: ui-monospace, monospace; font-size: 1.1rem; background: var(--surface-2); padding: 10px; border-radius: 10px; user-select: all; overflow-wrap: anywhere; }

.menu { position: fixed; z-index: 15; right: 10px; top: calc(env(safe-area-inset-top) + 54px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgb(0 0 0 / .2); padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: 12px; border-radius: 8px; cursor: pointer; }
.menu button:active { background: var(--surface-2); }
.scrim { position: fixed; inset: 0; z-index: 14; }

.privacy { font-size: .95rem; }
.privacy h2 { margin-top: 1rem; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .92rem; max-width: calc(100% - 32px);
}
.empty-state { text-align: center; color: var(--muted); padding: 40px 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
