/* app.lake.love shell — M0. Light, lake-blue palette; no external fonts. */
:root {
  --ink: #16323f;
  --ink-soft: #52707d;
  --line: #dce7ec;
  --bg: #f4f8fa;
  --card: #ffffff;
  --blue: #0e7490;
  --blue-deep: #155e75;
  --accent: #06b6d4;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--blue); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.brand-dot { color: var(--accent); }

.btn {
  display: inline-block; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.5rem 1.1rem; font-size: 0.95rem; cursor: pointer;
  background: var(--card); color: var(--ink); text-decoration: none;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-deep); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-google { width: 100%; }

.shell { display: flex; min-height: calc(100vh - 53px); }
.sidenav {
  width: 230px; flex-shrink: 0; padding: 1rem 0.75rem;
  background: var(--card); border-right: 1px solid var(--line);
}
.nav-section { margin-bottom: 1.5rem; }
.nav-heading {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft);
  padding: 0 0.5rem 0.4rem;
}
.nav-plus {
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  width: 22px; height: 22px; line-height: 1; font-size: 0.95rem;
  color: var(--ink-soft); cursor: pointer;
}
.nav-plus:disabled { opacity: 0.5; cursor: not-allowed; }
.nav-item {
  display: block; padding: 0.45rem 0.55rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 0.95rem;
}
.nav-item:hover { background: var(--bg); }
.nav-disabled { color: var(--ink-soft); }
.nav-empty { padding: 0 0.55rem; font-size: 0.85rem; color: var(--ink-soft); }

.content { flex: 1; padding: 2rem; }
.hero-card {
  max-width: 620px; margin: 8vh auto 0; padding: 2rem 2.25rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.hero-card h1 { margin-top: 0; letter-spacing: -0.02em; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

.auth-wrap { display: flex; justify-content: center; padding: 10vh 1rem 4rem; }
.auth-card {
  width: 100%; max-width: 380px; padding: 2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.auth-card h1 { margin: 0 0 0.25rem; }
.auth-divider {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--ink-soft); font-size: 0.85rem; margin: 1rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.auth-input {
  width: 100%; padding: 0.55rem 0.75rem; margin-bottom: 0.6rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem;
}
.auth-error {
  background: #fff5f5; border: 1px solid #ffc9c9; color: #c92a2a;
  border-radius: 8px; padding: 0.55rem 0.75rem; margin-bottom: 0.8rem;
  font-size: 0.9rem;
}
.btn-google { margin-bottom: 0.6rem; }
.user-menu { position: relative; display: inline-block; }
.user-chip {
  display: inline-block; padding: 0.35rem 0.7rem; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.88rem; color: var(--ink-soft); max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.chip-caret { font-size: 0.7rem; }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 190px; padding: 0.4rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(22, 50, 63, 0.16);
}
.user-plan {
  padding: 0.35rem 0.6rem 0.5rem; font-size: 0.78rem; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); margin-bottom: 0.3rem;
  text-transform: capitalize;
}
.user-dd-item {
  display: block; width: 100%; text-align: left; padding: 0.45rem 0.6rem;
  border: none; background: none; border-radius: 7px; cursor: pointer;
  font-size: 0.9rem; color: var(--ink); text-decoration: none;
}
.user-dd-item:hover { background: var(--bg); }

/* ---- admin console ---- */
.admin-search { max-width: 320px; margin: 0; }
.admin-table-card { padding: 0.4rem 0; }
.admin-row { cursor: pointer; }
.admin-row:hover td { background: var(--bg); }
.admin-cols { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.admin-main { flex: 2; min-width: 420px; }
.admin-side { flex: 1; min-width: 280px; }
.admin-card { margin-bottom: 1rem; }
.admin-card-body { padding: 0.4rem 0.9rem 0.9rem; font-size: 0.92rem; }
.astats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}
.astat-v { font-weight: 700; font-size: 1.02rem; }
.astat-l {
  font-size: 0.7rem; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: 0.06em; margin-top: 0.15rem;
}
.astat .ok { color: #2f9e44; }

.ovw-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1rem;
}
.ovw-chart { height: 240px; padding: 0 0.5rem 0.5rem; }

/* ---- sharing ---- */
.shared-tag {
  margin-right: 0.7rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 0.8rem; color: var(--ink-soft);
}
.shared-content { max-width: 1250px; margin: 0 auto; }
.share-msg {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem 0.6rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem;
  font-family: inherit; font-weight: 400; resize: vertical;
}

/* ---- alerts + membership ---- */
.alert-event { padding: 0.35rem 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.alert-event:last-child { border-bottom: none; }
.member-list { margin: 0.3rem 0 0.8rem; padding-left: 1.2rem; }
.member-list li { margin-bottom: 0.35rem; }
.member-card { border: 2px solid var(--blue); }
#al-threshold { width: 110px; margin-left: 0.4rem; }

/* ---- impersonation banner ---- */
.imp-banner {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0.5rem 1rem; font-size: 0.9rem;
  background: #fff3bf; border-bottom: 2px solid #f59f00; color: #5c4400;
}
.imp-exit { border-color: #f59f00; background: #fff9e6; font-size: 0.85rem; }
.imp-chip { background: #fff3bf; border-color: #f59f00; color: #5c4400; }

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidenav { width: 100%; border-right: none; border-bottom: 1px solid var(--line); }
  .toolbox, .props {
    width: 100%; max-height: 40vh; position: static;
    border-right: none; border-left: none; border-bottom: 1px solid var(--line);
  }
  .content, .page-content { padding: 0.9rem; }
  .page-head { flex-wrap: wrap; gap: 0.5rem; }
  .page-title { font-size: 1.15rem; }
  .topbar { padding: 0.5rem 0.8rem; }
  .user-chip { max-width: 140px; }
  .admin-main, .admin-side { min-width: 0; }
  .ovw-grid { grid-template-columns: 1fr; }
}

/* ---- widget pages (M3) ---- */
.nav-active { background: var(--bg); font-weight: 600; }
.page-content { padding: 1.25rem 1.5rem; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.9rem;
}
.page-title { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.lake-select {
  padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-size: 0.95rem; color: var(--ink);
}
.widget-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
}
.widget-head {
  padding: 0.5rem 0.8rem 0.25rem; flex-shrink: 0;
  display: flex; align-items: baseline; gap: 0.4rem; min-height: 1.6rem;
}
.widget-title { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.widget-where { font-size: 0.78rem; color: var(--ink-soft); }
.widget-body { flex: 1; min-height: 0; position: relative; padding: 0 0.4rem 0.4rem; }
.widget-body .js-plotly-plot { height: 100%; width: 100%; }
.widget-loading, .widget-err {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: var(--ink-soft); font-size: 0.85rem; text-align: center; padding: 0 1rem;
}
.stat-widget {
  height: 100%; display: flex; align-items: center; padding-left: 0.9rem;
  border-radius: 6px;
}
.stat-value { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-units { font-size: 1rem; font-weight: 500; color: var(--ink-soft); }
.table-scroll { height: 100%; overflow: auto; }
.widget-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.widget-table th {
  text-align: left; position: sticky; top: 0; background: var(--card);
  color: var(--ink-soft); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--line);
}
.widget-table td { padding: 0.35rem 0.6rem; border-bottom: 1px solid var(--line); }

/* ---- custom pages (M4) ---- */
.page-tools { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.widget-remove {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  width: 22px; height: 22px; line-height: 1; font-size: 0.8rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  color: var(--ink-soft); cursor: pointer; opacity: 0;
  transition: opacity 0.15s;
}
.widget-card:hover .widget-remove { opacity: 1; }
.widget-remove:hover { color: #c92a2a; border-color: #ffc9c9; }
.widget-head { cursor: grab; }
.grid-stack-static .widget-head { cursor: default; }
.wizard {
  border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem;
  width: min(420px, 92vw); box-shadow: 0 12px 40px rgba(22, 50, 63, 0.18);
}
.wizard::backdrop { background: rgba(22, 50, 63, 0.35); }
.wizard h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.wiz-label { display: block; margin-bottom: 0.9rem; font-size: 0.88rem; font-weight: 600; }
.wiz-label select, .wiz-label input[type="text"] {
  display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem 0.6rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.92rem;
  font-weight: 400; background: var(--card);
}
.wiz-kinds { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.3rem; }
.wiz-kind { font-weight: 400; font-size: 0.9rem; }
.wiz-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.4rem; }
.wiz-check { font-weight: 400; }
.wiz-check input { margin-right: 0.35rem; }

/* ---- editor: toolbox (left) + properties (right) ---- */
.toolbox, .props {
  width: 250px; flex-shrink: 0; padding: 0.9rem 0.75rem;
  background: var(--card); overflow-y: auto;
  max-height: calc(100vh - 53px); position: sticky; top: 53px;
}
.toolbox { border-right: 1px solid var(--line); }
.props { border-left: 1px solid var(--line); }
.toolbox-back {
  display: block; font-size: 0.85rem; color: var(--ink-soft);
  text-decoration: none; margin-bottom: 0.7rem;
}
.toolbox-search {
  width: 100%; padding: 0.45rem 0.6rem; margin-bottom: 0.7rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: 0.9rem;
}
.toolbox-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.55rem; margin-bottom: 0.35rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  cursor: grab; user-select: none;
}
.toolbox-item:hover { border-color: var(--blue); }
.toolbox-icon { font-size: 1.15rem; }
.toolbox-text { display: flex; flex-direction: column; min-width: 0; }
.toolbox-label { font-size: 0.85rem; font-weight: 600; }
.toolbox-cat { font-size: 0.72rem; color: var(--ink-soft); }
.props-title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 0.7rem;
}
.props .wiz-label { margin-bottom: 0.75rem; }
.props-series-title {
  font-size: 0.88rem; font-weight: 600; margin-bottom: 0.35rem;
}
.props-series {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.35rem; font-size: 0.88rem;
}
.series-color {
  width: 26px; height: 22px; padding: 0; border: 1px solid var(--line);
  border-radius: 5px; background: none; cursor: pointer;
}
.range-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
.range-row input[type="range"] { flex: 1; }
.range-val { font-size: 0.82rem; color: var(--ink-soft); min-width: 42px; }
.btn-danger { color: #c92a2a; border-color: #ffc9c9; }
.widget-selected { outline: 2px solid var(--blue); outline-offset: -2px; }

/* ---- view / design modes ---- */
.mode-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; flex-shrink: 0;
}
.mode-btn {
  padding: 0.42rem 0.9rem; border: none; background: var(--card);
  font-size: 0.85rem; color: var(--ink-soft); cursor: pointer;
}
.mode-btn.mode-active { background: var(--blue); color: #fff; }
.mode-view .toolbox, .mode-view .props,
.mode-view #btn-rename-page, .mode-view #btn-delete-page,
.mode-view #page-hint, .mode-view .widget-remove { display: none !important; }

/* ---- map widgets ---- */
.map-widget { height: 100%; width: 100%; border-radius: 8px; position: relative; z-index: 0; }
.map-legend {
  position: absolute; bottom: 8px; left: 8px; z-index: 500;
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(255,255,255,0.9); border-radius: 8px;
  padding: 0.25rem 0.55rem; font-size: 0.75rem; color: var(--ink);
}
.map-ramp {
  width: 70px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #1a56db, #0e7490, #f4c430, #e8590c, #e03131);
}
.map-when { color: var(--ink-soft); margin-left: 0.3rem; }

/* ---- image + weather widgets ---- */
.image-widget { height: 100%; display: flex; flex-direction: column; }
.image-frame {
  flex: 1; min-height: 0; overflow: hidden; border-radius: 8px;
  background: #0b1518; position: relative;
}
.image-frame img {
  width: 100%; height: 100%; object-fit: contain;  /* scale 1 = fit */
  transform-origin: center; user-select: none;
  transition: transform 0.1s ease-out;
}
.img-edit-btn {
  position: absolute; top: 6px; left: 6px; z-index: 6;
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.88); cursor: pointer; font-size: 0.9rem;
  display: none;  /* pan/zoom editing is a Design-mode feature */
}
.mode-design .img-edit-btn { display: block; }
.img-edit-btn.active { background: var(--blue); border-color: var(--blue); }
.img-editing { cursor: grab; touch-action: none; }
.img-editing:active { cursor: grabbing; }
.img-editing img { transition: none; }
.image-hint { color: var(--ink-soft); }
.image-cap { font-size: 0.78rem; color: var(--ink-soft); padding-top: 0.3rem; }
.weather-widget { height: 100%; display: flex; flex-direction: column; padding: 0.2rem 0.5rem 0.4rem; }
.weather-main { display: flex; align-items: baseline; gap: 0.6rem; }
.weather-temp { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; color: var(--blue-deep); }
.weather-desc { color: var(--ink-soft); font-size: 0.85rem; }
.weather-cells { display: flex; gap: 1rem; margin: 0.5rem 0; flex-wrap: wrap; }
.weather-cell .weather-v { font-weight: 700; font-size: 1rem; }
.weather-cell .weather-l { font-size: 0.72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; }
.weather-sub { font-weight: 400; font-size: 0.8rem; color: var(--ink-soft); }
.weather-strip-label {
  font-size: 0.7rem; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: 0.06em; margin: auto 0 0.25rem;
}
.weather-strip { display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.2rem; }
.weather-hr {
  display: flex; flex-direction: column; align-items: center;
  font-size: 0.72rem; color: var(--ink-soft);
  padding: 0.25rem 0.3rem; border-radius: 7px; min-width: 34px;
}
.weather-hr b { font-size: 0.85rem; color: var(--ink); }
.weather-hr-icon { font-size: 0.95rem; line-height: 1.2; }
.weather-night { background: #dfe8f2; }
.weather-night b { color: #3b5368; }
.weather-icon { font-size: 2.1rem; line-height: 1; }
.chart-badge {
  position: absolute; top: 4px; right: 10px; z-index: 5;
  padding: 0.15rem 0.55rem; border-radius: 7px;
  background: rgba(255,255,255,0.9); border: 1px solid var(--line);
  font-weight: 700; font-size: 0.95rem; color: var(--blue-deep);
}

/* Lake switcher in the left nav: click a lake to stay on the current
   feature page with that lake; ⧉ opens it in a new tab for comparison. */
.lake-search {
  width: 100%; box-sizing: border-box; margin: 0 0 0.4rem;
  padding: 0.4rem 0.55rem; font-size: 0.9rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
.lake-search:focus { border-color: var(--ink-soft); }
.lake-nav-list { max-height: 38vh; overflow-y: auto; }
.lake-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.55rem; border-radius: 8px; cursor: pointer;
  color: var(--ink); font-size: 0.95rem; user-select: none;
}
.lake-row:hover { background: var(--bg); }
.lake-row.nav-active { background: var(--bg); font-weight: 600; }
.lake-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lake-pop {
  flex-shrink: 0; margin-left: 0.4rem; padding: 0 0.25rem;
  color: var(--ink-soft); text-decoration: none; font-size: 0.9rem;
  opacity: 0; transition: opacity 0.12s;
}
.lake-row:hover .lake-pop { opacity: 0.75; }
.lake-pop:hover { opacity: 1; color: var(--ink); }
