:root {
  --bg: #0b1220;
  --card: #131c2e;
  --border: #223047;
  --text: #e7edf5;
  --muted: #8ea0b8;
  --accent: #3aa0ff;
  --on: #2ecc71;
  --off: #495a72;
  --bad: #e05c5c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 24px;
}
h1 { font-size: 20px; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
button {
  background: var(--off);
  color: var(--text);
  border: none;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { opacity: 0.85; }
section.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-top: 20px;
}
section.panel h2 { font-size: 15px; margin: 0 0 12px; }
section.panel .hint { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
form.inline input, form.inline select {
  background: #0e1626;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
form.inline .field { display: flex; flex-direction: column; gap: 4px; }
form.inline .field label { font-size: 11px; color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--card); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
  display: none; max-width: 360px;
}
#login-screen { display: none; max-width: 320px; margin: 80px auto; text-align: center; }
#login-screen input {
  display: block; width: 100%; margin: 8px 0; padding: 8px 10px;
  background: #0e1626; border: 1px solid var(--border); color: var(--text); border-radius: 6px;
}
#login-screen button { width: 100%; margin-top: 8px; background: var(--accent); padding: 8px; }
#app { display: none; }

/* portal nav, shared by every page */
#portal-nav {
  display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
#portal-nav a {
  color: var(--muted); text-decoration: none; font-size: 13px;
  padding: 6px 12px; border-radius: 7px;
}
#portal-nav a:hover { background: var(--card); color: var(--text); }
#portal-nav a.active { background: var(--accent); color: var(--text); }
#portal-nav a.signout { margin-left: auto; }

.placeholder-note {
  color: var(--muted); font-size: 13px; line-height: 1.6;
}

/* finances / metric grids */
.metric-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.metric { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.metric .label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.metric .value { font-size: 20px; font-weight: 600; }
.metric .value.negative { color: var(--bad); }
.metric .value.positive { color: var(--on); }

/* clickable account-balance widgets (portal home) */
.account-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: var(--text); display: block;
}
.account-card:hover { border-color: var(--accent); }
.account-card .label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.account-card .value { font-size: 20px; font-weight: 600; }
.account-card .value.negative { color: var(--bad); }
.account-card .value.positive { color: var(--on); }

/* highlights the account section on finances.html when linked to via
   #acct-<id> from a home-page widget -- no JS needed, :target reacts to
   the URL fragment matching this element's id */
section.panel:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* photo grids: Cameras page (Game Cams, Ring Cameras) and the home page's
   Ring Cameras widget -- shared here since both use it */
.photo-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.photo-card { background: #0e1626; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.photo-card img { display: block; width: 100%; height: 220px; object-fit: cover; background: #000; }
.photo-card .meta { padding: 10px 12px; }
.photo-card .camera-name { font-weight: 600; font-size: 14px; }
.photo-card .captured-at { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* notifications filter/pager row -- shared by the home page's Alerts panel
   and the Pools page's Recent notifications table, see shell.js's
   createNotificationsController() */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.filters select, .filters input[type="date"] {
  background: #0e1626; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 8px; font-size: 13px;
}
.filters .filter-date { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.pager button:disabled { opacity: 0.4; cursor: default; }

/* pinned graph widgets (home page) -- see shell.js/index.html */
.pinned-graphs-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); margin-top: 16px; }
.pinned-graph-card .pinned-graph-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.pinned-graph-card h3 { margin: 0; font-size: 14px; }

/* home page dashboard drag-and-drop reordering, see shell.js's
   enableDragReorder()/applyDashboardOrder() */
#dashboard-panels section.panel { position: relative; padding-right: 40px; }
.panel-drag-handle {
  position: absolute; top: 14px; right: 14px; cursor: grab;
  color: var(--muted); font-size: 16px; line-height: 1; user-select: none;
}
.panel-drag-handle:active { cursor: grabbing; }
#dashboard-panels section.panel.dragging { opacity: 0.4; }
