/**
 * Top navigation layout — replaces the left sidebar.
 * Brand + full menu taxonomy live in a horizontal top bar.
 */

/* Full-width main panel (no 260px sidebar offset) */
:root {
  --cb-top-nav-h: 56px;
}

.top-nav-layout {
  box-sizing: border-box;
  padding-top: var(--cb-top-nav-h);
}

.top-nav-layout .main-panel {
  width: 100% !important;
  float: none !important;
  max-height: none !important;
  height: auto !important;
  min-height: calc(100vh - var(--cb-top-nav-h));
  position: relative;
}

.top-nav-layout .main-panel > .content {
  padding-top: 12px;
  padding-left: 12px;
  padding-right: 12px;
  min-height: calc(100vh - 140px);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

/* Desktop app: fill the viewport — no phone-app column */
.top-nav-layout .main-panel > .content > .container-fluid,
.top-nav-layout .main-panel > .content > .occ-page,
.top-nav-layout .main-panel > .content > .rev-page,
.top-nav-layout .main-panel > .content > .bill-page {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
}

/* Page shells that previously capped at 720–1100px */
.top-nav-layout .clean-history-page,
.top-nav-layout .clean-due-page,
.top-nav-layout .occ-page,
.top-nav-layout .rev-page,
.top-nav-layout .bill-page,
.top-nav-layout .shelly-btn-page,
.top-nav-layout .unit-home-wrap,
.top-nav-layout .unit-detail-wrap,
.top-nav-layout .r2-chat-page,
.top-nav-layout .health-page,
.top-nav-layout .auto-reply-page,
.top-nav-layout .tennis-ops-page,
.top-nav-layout .todos-sheet {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Dashboard units: use near full viewport width */
.top-nav-layout .main-panel > .content:has(.shelly-btn-page) {
  padding-left: 10px;
  padding-right: 10px;
}

/* ── Top main nav ─────────────────────────────────────────────── */
.top-main-nav {
  background: #1f77d0;
  background-image: linear-gradient(to bottom, #1f77d0 0%, #1a5fb4 100%);
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0.35rem 0.75rem;
  min-height: 56px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  z-index: 1030;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

.top-main-nav .navbar-brand {
  color: #fff !important;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 1.25rem;
  padding: 0.4rem 0;
  white-space: nowrap;
}

.top-main-nav .navbar-brand:hover,
.top-main-nav .navbar-brand:focus {
  color: #fff !important;
  opacity: 0.92;
}

.top-main-nav .navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.55rem;
}

.top-main-nav .navbar-toggler-icon {
  /* Bootstrap 4 hamburger via bars (no SVG icon font here) */
  display: none;
}

.top-main-nav .navbar-toggler .navbar-toggler-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  margin: 4px 0;
  border-radius: 1px;
}

.top-main-nav .navbar-nav {
  align-items: center;
}

.top-main-nav .navbar-nav .nav-item {
  margin: 0 1px;
}

.top-main-nav .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.4rem !important;
  border-radius: 6px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  white-space: nowrap;
  opacity: 1;
  min-width: 2.6rem;
  line-height: 1.1;
  text-align: center;
}

.top-main-nav .navbar-nav .nav-link:hover,
.top-main-nav .navbar-nav .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14);
}

.top-main-nav .navbar-nav .nav-item.active > .nav-link,
.top-main-nav .navbar-nav .nav-item.active.nav-item > .nav-link {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.24);
}

.top-main-nav .navbar-nav .nav-link i {
  font-size: 18px;
  width: auto;
  height: 18px;
  margin: 0;
  float: none;
  line-height: 1;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Nucleo + FA icons share the same box so Live matches Home/Msgs/Rev */
.top-main-nav .navbar-nav .nav-link i.nc-icon,
.top-main-nav .navbar-nav .nav-link i.fa {
  width: 20px;
  height: 20px;
  font-size: 18px;
}

.top-main-nav .navbar-nav .nav-link p,
.top-main-nav .navbar-nav .nav-link .nav-label {
  margin: 0;
  line-height: 1.1;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  max-width: 3.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tennis/Swim is the one primary label longer than the 3.2rem clip. */
.top-main-nav .navbar-nav .nav-link .nav-label.nav-label-wide {
  max-width: none;
  letter-spacing: 0.02em;
}

/* Compact primary nav: denser packing */
.top-main-nav .navbar-nav.nav-compact .nav-item {
  margin: 0;
}

.top-main-nav .navbar-nav.nav-compact .nav-link {
  padding: 0.28rem 0.32rem !important;
}

.top-main-nav .navbar-nav .nav-link .no-icon {
  font-size: inherit;
  font-weight: inherit;
}

/* Account / logout cluster on the right */
.top-main-nav .nav-account .nav-link {
  opacity: 0.9;
}

.top-main-nav .nav-account {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

/* Hide the old secondary account navbar if present */
.top-nav-layout .main-panel > .navbar:not(.top-main-nav) {
  display: none;
}

/* Mobile: stacked menu */
@media (max-width: 991.98px) {
  .top-main-nav .navbar-collapse {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
  }

  .top-main-nav .navbar-nav {
    align-items: stretch;
    width: 100%;
  }

  .top-main-nav .navbar-nav .nav-link {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem !important;
    min-width: 0;
    text-align: left;
  }

  .top-main-nav .navbar-nav .nav-link .nav-label {
    font-size: 12px;
    max-width: none;
  }

  .top-main-nav .nav-account {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    margin-top: 0.35rem;
    padding-top: 0.35rem;
  }

  .top-main-nav .navbar-nav.nav-account {
    width: 100%;
  }
}

/* Medium widths: slightly tighter */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .top-main-nav .navbar-nav .nav-link {
    padding: 0.25rem 0.28rem !important;
    font-size: 9px;
    min-width: 2.35rem;
  }

  .top-main-nav .navbar-nav .nav-link i {
    font-size: 14px;
  }

  .top-main-nav .navbar-brand {
    font-size: 0.8rem;
    margin-right: 0.5rem;
  }
}

/* ── Portland ME weather strip (below top nav, full width) ───── */
.wx-strip {
  width: 100%;
  box-sizing: border-box;
  background: linear-gradient(90deg, #eef6ff 0%, #f8fbff 45%, #fff7ed 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  z-index: 1020;
  position: sticky;
  top: var(--cb-top-nav-h);
}

.wx-strip.is-sun {
  background: linear-gradient(90deg, #fff7ed 0%, #fefce8 40%, #eff6ff 100%);
}
.wx-strip.is-rain {
  background: linear-gradient(90deg, #e0f2fe 0%, #f0f9ff 50%, #eef2ff 100%);
}
.wx-strip.is-snow {
  background: linear-gradient(90deg, #f0f9ff 0%, #f8fafc 50%, #eff6ff 100%);
}
.wx-strip.is-night {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 55%, #1e1b4b 100%);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.wx-strip-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.45rem 1rem;
  max-width: 100%;
  min-height: 52px;
  box-sizing: border-box;
}

/* Live EST/EDT day + time */
.wx-strip-clock {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  flex: 0 0 auto;
  min-width: 5.5rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  padding-right: 0.65rem;
  border-right: 1px solid rgba(15, 23, 42, 0.1);
}
.wx-strip.is-night .wx-strip-clock {
  border-right-color: rgba(255, 255, 255, 0.12);
}
.wx-clock-day {
  font-size: 0.68rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}
.wx-strip.is-night .wx-clock-day { color: #e2e8f0; }
.wx-clock-time {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  white-space: nowrap;
}
.wx-strip.is-night .wx-clock-time { color: #f8fafc; }
.wx-clock-tz {
  font-size: 0.58rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.04em;
}
.wx-strip.is-night .wx-clock-tz { color: #94a3b8; }

.wx-strip-now {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

/* Shared height for hub / lock / AQI status chips (locks are 3 lines) */
.wx-strip-hub,
.wx-strip-lock,
.wx-strip-aqi {
  min-height: 3.05rem;
  box-sizing: border-box;
  align-self: stretch;
}

/* Shelly button-hub smart plug (critical infrastructure) */
.wx-strip-hub {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.6rem 0.35rem 0.45rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.04);
}
.wx-hub-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #94a3b8;
}
.wx-hub-icon {
  font-size: 0.85rem;
  width: 0.95rem;
  text-align: center;
  color: #64748b;
}
.wx-hub-meta {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  min-width: 0;
}
.wx-hub-caption {
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
  color: #64748b;
  white-space: nowrap;
}
.wx-hub-state {
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  color: #334155;
}
.wx-hub-power {
  font-weight: 700;
  opacity: 0.85;
}
.wx-strip-hub.hub-online {
  color: #166534;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
}
.wx-strip-hub.hub-online .wx-hub-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
  animation: wx-hub-pulse 2s ease-in-out infinite;
}
.wx-strip-hub.hub-online .wx-hub-icon,
.wx-strip-hub.hub-online .wx-hub-state { color: #15803d; }
.wx-strip-hub.hub-online .wx-hub-caption { color: #16a34a; }
.wx-strip-hub.hub-offline {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(220, 38, 38, 0.35);
}
.wx-strip-hub.hub-offline .wx-hub-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22);
}
.wx-strip-hub.hub-offline .wx-hub-icon,
.wx-strip-hub.hub-offline .wx-hub-state { color: #b91c1c; }
.wx-strip-hub.hub-offline .wx-hub-caption { color: #dc2626; }
.wx-strip-hub.hub-unknown {
  color: #92400e;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(217, 119, 6, 0.3);
}
.wx-strip-hub.hub-unknown .wx-hub-dot { background: #f59e0b; }
.wx-strip-hub.hub-unknown .wx-hub-icon,
.wx-strip-hub.hub-unknown .wx-hub-state { color: #b45309; }
.wx-strip-hub.hub-unknown .wx-hub-caption { color: #d97706; }

@keyframes wx-hub-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.08); }
}

.wx-strip.is-night .wx-strip-hub.hub-online {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.3);
}
.wx-strip.is-night .wx-strip-hub.hub-online .wx-hub-icon,
.wx-strip.is-night .wx-strip-hub.hub-online .wx-hub-state { color: #86efac; }
.wx-strip.is-night .wx-strip-hub.hub-online .wx-hub-caption { color: #4ade80; }
.wx-strip.is-night .wx-strip-hub.hub-offline {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
}
.wx-strip.is-night .wx-strip-hub.hub-offline .wx-hub-icon,
.wx-strip.is-night .wx-strip-hub.hub-offline .wx-hub-state { color: #fca5a5; }
.wx-strip.is-night .wx-strip-hub.hub-offline .wx-hub-caption { color: #f87171; }
.wx-strip.is-night .wx-strip-hub.hub-unknown {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(251, 191, 36, 0.3);
}
.wx-strip.is-night .wx-strip-hub.hub-unknown .wx-hub-icon,
.wx-strip.is-night .wx-strip-hub.hub-unknown .wx-hub-state { color: #fde047; }
.wx-strip.is-night .wx-strip-hub.hub-unknown .wx-hub-caption { color: #fbbf24; }

/* Schlage lock badges on weather strip (Backdoor, Basement) */
.wx-strip-lock {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem 0.35rem 0.45rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.1);
  line-height: 1.1;
  /* Wider so Unlock/Lock + last-unlock name (e.g. Richard …) are less truncated */
  max-width: 13.5rem;
}
.wx-lock-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #94a3b8;
}
.wx-lock-icon {
  font-size: 0.85rem;
  width: 0.95rem;
  text-align: center;
  color: #64748b;
  flex: 0 0 auto;
}
.wx-lock-meta {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  min-width: 0;
}
.wx-lock-caption {
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
  color: #64748b;
  white-space: nowrap;
}
.wx-lock-state {
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  color: #334155;
}
.wx-lock-who {
  font-size: 0.58rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9.5rem;
  cursor: help; /* full name in title tooltip when truncated */
}
.wx-strip-lock.lock-online.lock-closed {
  color: #166534;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(22, 163, 74, 0.28);
}
.wx-strip-lock.lock-online.lock-closed .wx-lock-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.wx-strip-lock.lock-online.lock-closed .wx-lock-icon,
.wx-strip-lock.lock-online.lock-closed .wx-lock-state { color: #15803d; }
.wx-strip-lock.lock-online.lock-closed .wx-lock-caption { color: #16a34a; }

.wx-strip-lock.lock-online.lock-open {
  color: #78350f;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(217, 119, 6, 0.5);
}
.wx-strip-lock.lock-online.lock-open .wx-lock-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}
.wx-strip-lock.lock-online.lock-open .wx-lock-icon,
.wx-strip-lock.lock-online.lock-open .wx-lock-state { color: #92400e; font-weight: 800; }
.wx-strip-lock.lock-online.lock-open .wx-lock-caption { color: #b45309; font-weight: 800; }
.wx-strip-lock.lock-online.lock-open .wx-lock-who { color: #a16207; }

/* Compact Unlock / Lock controls on header lock chips (actions ≠ status) */
.wx-lock-actions {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
  margin-left: 0.15rem;
}
.wx-lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
}
.wx-lock-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.35);
}
.wx-lock-btn-unlock {
  color: #92400e;
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.55);
}
.wx-lock-btn-unlock:hover:not(:disabled) {
  background: #fde68a;
}
.wx-lock-btn-lock {
  color: #14532d;
  background: #f0fdf4;
  border-color: rgba(34, 197, 94, 0.5);
}
.wx-lock-btn-lock:hover:not(:disabled) {
  background: #bbf7d0;
}
.wx-lock-btn-hist {
  min-width: 1.6rem;
  padding: 0.12rem 0.28rem;
  color: #334155;
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.35);
}
.wx-lock-btn-hist:hover:not(:disabled) {
  background: #e2e8f0;
  color: #1f77d0;
}
.wx-lock-btn-hist i {
  font-size: 0.62rem;
}

/* ── Android-parity primary tabs + ⋯ More dropdown ── */
.top-main-nav .nav-link-r2 {
  gap: 0.2rem;
}
.top-main-nav .nav-r2-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
  background: rgba(255, 255, 255, 0.95);
  padding: 1px;
  box-sizing: border-box;
}
.top-main-nav .nav-more-wrap {
  position: relative;
}
.top-main-nav .nav-more-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 13.5rem;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  padding: 0.4rem 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
  z-index: 1100;
}
.top-main-nav .nav-more-dropdown.is-open,
.top-main-nav .nav-more-wrap.is-open .nav-more-dropdown {
  display: block;
}
.top-main-nav .nav-more-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.top-main-nav .nav-more-item:hover,
.top-main-nav .nav-more-item:focus {
  background: rgba(31, 119, 208, 0.1);
  color: #1a5fb4;
  text-decoration: none;
}
.top-main-nav .nav-more-item.is-active {
  background: rgba(31, 119, 208, 0.14);
  color: #1a5fb4;
}
.top-main-nav .nav-more-item i {
  font-size: 1rem;
  width: 1.15rem;
  text-align: center;
  color: #64748b;
  flex-shrink: 0;
}
.top-main-nav .nav-more-item.is-active i,
.top-main-nav .nav-more-item:hover i {
  color: #1f77d0;
}
.top-main-nav .nav-more-sep {
  height: 1px;
  margin: 0.3rem 0.65rem;
  background: rgba(15, 23, 42, 0.08);
}

html[data-color-mode="dark"] .top-main-nav .nav-more-dropdown {
  background: #1e293b;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
html[data-color-mode="dark"] .top-main-nav .nav-more-item {
  color: #e2e8f0;
}
html[data-color-mode="dark"] .top-main-nav .nav-more-item:hover,
html[data-color-mode="dark"] .top-main-nav .nav-more-item:focus,
html[data-color-mode="dark"] .top-main-nav .nav-more-item.is-active {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
}
html[data-color-mode="dark"] .top-main-nav .nav-more-item i {
  color: #94a3b8;
}
html[data-color-mode="dark"] .top-main-nav .nav-more-item.is-active i,
html[data-color-mode="dark"] .top-main-nav .nav-more-item:hover i {
  color: #93c5fd;
}
html[data-color-mode="dark"] .top-main-nav .nav-more-sep {
  background: rgba(255, 255, 255, 0.1);
}

/* History modals (climate + lock) — shared site chrome */
.hist-dlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.hist-dlg {
  width: min(32rem, 100%);
  max-height: min(86vh, 40rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}
.hist-dlg.hist-dlg-climate {
  width: min(40rem, 100%);
  max-height: min(90vh, 44rem);
}
.hist-dlg.hist-dlg-trace {
  width: min(56rem, 100%);
  max-height: min(90vh, 52rem);
}
.hist-dlg-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.45rem 1rem 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}
.hist-dlg-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 0.4rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #64748b;
  cursor: pointer;
}
.hist-dlg-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}
.hist-dlg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.65rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.hist-dlg-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}
.hist-dlg-sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}
.hist-dlg-meta {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}
.hist-dlg-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0.2rem;
}
.hist-dlg-close:hover { color: #0f172a; }
.hist-dlg-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 1rem;
  min-height: 8rem;
}
.hist-dlg-loading,
.hist-dlg-empty {
  margin: 1.5rem 0;
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
}
.hist-dlg-error {
  margin: 1rem 0;
  text-align: center;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.9rem;
}
.hist-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.hist-event {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f1f5f9;
}
.hist-event-ico {
  width: 1.6rem;
  text-align: center;
  flex-shrink: 0;
  color: #1f77d0;
  font-size: 1rem;
}
.hist-event.is-unlock .hist-event-ico { color: #d97706; }
.hist-event.is-lock .hist-event-ico { color: #1f77d0; }
.hist-event-climate.is-off .hist-event-ico { color: #64748b; }
.hist-event-climate.is-heat .hist-event-ico { color: #f87171; }
.hist-event-climate.is-cool .hist-event-ico { color: #60a5fa; }
.hist-event-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.hist-event-action {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}
.hist-event-who {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-event-when {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.hist-dlg-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.hist-dlg-done {
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  background: #1f77d0;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.hist-dlg-done:hover { background: #1a5fb4; }

html[data-color-mode="dark"] .hist-dlg {
  background: #1e293b;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
html[data-color-mode="dark"] .hist-dlg-header,
html[data-color-mode="dark"] .hist-dlg-footer,
html[data-color-mode="dark"] .hist-dlg-tabs {
  border-color: rgba(255, 255, 255, 0.08);
}
html[data-color-mode="dark"] .hist-dlg-tabs {
  background: rgba(15, 23, 42, 0.45);
}
html[data-color-mode="dark"] .hist-dlg-tab { color: #94a3b8; }
html[data-color-mode="dark"] .hist-dlg-tab.is-active {
  background: #334155;
  color: #f1f5f9;
}
html[data-color-mode="dark"] .hist-dlg-title { color: #f1f5f9; }
html[data-color-mode="dark"] .hist-dlg-sub,
html[data-color-mode="dark"] .hist-dlg-meta,
html[data-color-mode="dark"] .hist-dlg-loading,
html[data-color-mode="dark"] .hist-dlg-empty { color: #94a3b8; }
html[data-color-mode="dark"] .hist-dlg-close { color: #94a3b8; }
html[data-color-mode="dark"] .hist-dlg-close:hover { color: #f1f5f9; }
html[data-color-mode="dark"] .hist-event { background: rgba(255, 255, 255, 0.06); }
html[data-color-mode="dark"] .hist-event-action { color: #f1f5f9; }
html[data-color-mode="dark"] .hist-event-who,
html[data-color-mode="dark"] .hist-event-when { color: #94a3b8; }

@media (max-width: 991.98px) {
  .top-main-nav .nav-more-dropdown {
    position: static;
    box-shadow: none;
    border-radius: 8px;
    margin: 0.25rem 0 0.5rem;
    max-height: none;
    background: rgba(255, 255, 255, 0.1);
  }
  .top-main-nav .nav-more-item {
    color: rgba(255, 255, 255, 0.92);
  }
  .top-main-nav .nav-more-item i {
    color: rgba(255, 255, 255, 0.75);
  }
  .top-main-nav .nav-more-item:hover,
  .top-main-nav .nav-more-item.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
  }
  .top-main-nav .nav-more-sep {
    background: rgba(255, 255, 255, 0.18);
  }
  html[data-color-mode="dark"] .top-main-nav .nav-more-dropdown {
    background: rgba(0, 0, 0, 0.25);
  }
}

.wx-strip-lock.lock-offline {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(220, 38, 38, 0.35);
}
.wx-strip-lock.lock-offline .wx-lock-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.22);
}
.wx-strip-lock.lock-offline .wx-lock-icon,
.wx-strip-lock.lock-offline .wx-lock-state { color: #b91c1c; }
.wx-strip-lock.lock-offline .wx-lock-caption { color: #dc2626; }

.wx-strip.is-night .wx-strip-lock.lock-online.lock-closed {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.3);
}
.wx-strip.is-night .wx-strip-lock.lock-online.lock-closed .wx-lock-icon,
.wx-strip.is-night .wx-strip-lock.lock-online.lock-closed .wx-lock-state { color: #86efac; }
.wx-strip.is-night .wx-strip-lock.lock-online.lock-closed .wx-lock-caption { color: #4ade80; }
.wx-strip.is-night .wx-strip-lock.lock-online.lock-open {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.65) 0%, rgba(69, 26, 3, 0.5) 100%);
  border-color: rgba(251, 191, 36, 0.55);
}
.wx-strip.is-night .wx-strip-lock.lock-online.lock-open .wx-lock-icon,
.wx-strip.is-night .wx-strip-lock.lock-online.lock-open .wx-lock-state {
  color: #fef3c7;
  font-weight: 800;
}
.wx-strip.is-night .wx-strip-lock.lock-online.lock-open .wx-lock-caption {
  color: #fde68a;
  font-weight: 800;
}
.wx-strip.is-night .wx-strip-lock.lock-online.lock-open .wx-lock-who { color: #fcd34d; }
.wx-strip.is-night .wx-strip-lock.lock-offline {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
}
.wx-strip.is-night .wx-strip-lock.lock-offline .wx-lock-icon,
.wx-strip.is-night .wx-strip-lock.lock-offline .wx-lock-state { color: #fca5a5; }
.wx-strip.is-night .wx-strip-lock.lock-offline .wx-lock-caption { color: #f87171; }
.wx-strip.is-night .wx-lock-who { color: #94a3b8; }
.wx-strip.is-night .wx-lock-btn-hist {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}
.wx-strip.is-night .wx-lock-btn-hist:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.wx-strip.is-night .wx-lock-btn-unlock {
  color: #1c1917;
  background: #fbbf24;
  border-color: #f59e0b;
}
.wx-strip.is-night .wx-lock-btn-lock {
  color: #052e16;
  background: #4ade80;
  border-color: #22c55e;
}

/* US AQI badge */
.wx-strip-aqi {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem 0.35rem 0.4rem;
  border-radius: 0.45rem;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.wx-aqi-value {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  min-width: 1.5rem;
  text-align: center;
}
.wx-aqi-meta {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
}
.wx-aqi-caption {
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}
.wx-aqi-label {
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}
.wx-strip-aqi.aqi-good {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.35);
  color: #15803d;
}
.wx-strip-aqi.aqi-moderate {
  background: rgba(234, 179, 8, 0.16);
  border-color: rgba(202, 138, 4, 0.4);
  color: #a16207;
}
.wx-strip-aqi.aqi-usg {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.4);
  color: #c2410c;
}
.wx-strip-aqi.aqi-unhealthy {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: #b91c1c;
}
.wx-strip-aqi.aqi-very {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.4);
  color: #7e22ce;
}
.wx-strip-aqi.aqi-hazardous {
  background: rgba(127, 29, 29, 0.18);
  border-color: rgba(127, 29, 29, 0.45);
  color: #7f1d1d;
}
.wx-strip.is-night .wx-strip-aqi.aqi-good { color: #86efac; background: rgba(34, 197, 94, 0.18); }
.wx-strip.is-night .wx-strip-aqi.aqi-moderate { color: #fde047; background: rgba(234, 179, 8, 0.18); }
.wx-strip.is-night .wx-strip-aqi.aqi-usg { color: #fdba74; background: rgba(249, 115, 22, 0.2); }
.wx-strip.is-night .wx-strip-aqi.aqi-unhealthy { color: #fca5a5; background: rgba(239, 68, 68, 0.2); }
.wx-strip.is-night .wx-strip-aqi.aqi-very { color: #d8b4fe; background: rgba(168, 85, 247, 0.22); }
.wx-strip.is-night .wx-strip-aqi.aqi-hazardous { color: #fecaca; background: rgba(127, 29, 29, 0.3); }

.wx-strip-icon {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  color: #64748b;
}
.wx-strip.is-sun .wx-strip-icon { color: #f59e0b; }
.wx-strip.is-cloud .wx-strip-icon { color: #64748b; }
.wx-strip.is-rain .wx-strip-icon { color: #0ea5e9; }
.wx-strip.is-snow .wx-strip-icon { color: #38bdf8; }
.wx-strip.is-night .wx-strip-icon { color: #fbbf24; }

.wx-strip-temp {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1;
}
.wx-strip.is-night .wx-strip-temp { color: #f8fafc; }

.wx-strip-deg {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748b;
  margin-left: 0.05rem;
  vertical-align: super;
}
.wx-strip.is-night .wx-strip-deg { color: #94a3b8; }

/* Relative humidity next to temp */
.wx-strip-humidity {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #0369a1;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid rgba(15, 23, 42, 0.1);
  margin-left: 0.05rem;
  padding-left: 0.4rem;
}
.wx-strip-humidity .fa {
  font-size: 0.62rem;
  color: #0ea5e9;
  margin-right: 0.05rem;
  position: relative;
  top: -0.05rem;
}
.wx-strip.is-night .wx-strip-humidity {
  color: #7dd3fc;
  border-left-color: rgba(255, 255, 255, 0.12);
}
.wx-strip.is-night .wx-strip-humidity .fa { color: #38bdf8; }
.wx-strip-pct {
  font-size: 0.58rem;
  font-weight: 700;
  color: #64748b;
  margin-left: 0.02rem;
  vertical-align: super;
}
.wx-strip.is-night .wx-strip-pct { color: #94a3b8; }

.wx-strip-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.15;
  min-width: 0;
}

.wx-strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}
.wx-strip.is-night .wx-strip-label { color: #e2e8f0; }

.wx-strip-city {
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.wx-strip.is-night .wx-strip-city { color: #94a3b8; }

.wx-strip-hl {
  font-size: 0.62rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}
.wx-strip.is-night .wx-strip-hl { color: #cbd5e1; }

/* Day arc: sunrise ──●── sunset across remaining width */
.wx-strip-day {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
}

.wx-sun-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  flex: 0 0 auto;
  min-width: 3.2rem;
  color: #475569;
  font-variant-numeric: tabular-nums;
}
.wx-strip.is-night .wx-sun-end { color: #cbd5e1; }

.wx-sun-end i {
  font-size: 0.65rem;
  opacity: 0.85;
}
.wx-sun-rise i { color: #f59e0b; }
.wx-sun-set i { color: #f97316; }
.wx-strip.is-night .wx-sun-rise i { color: #fbbf24; }
.wx-strip.is-night .wx-sun-set i { color: #fb923c; }

.wx-sun-time {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0f172a;
  line-height: 1.1;
}
.wx-strip.is-night .wx-sun-time { color: #f1f5f9; }

.wx-sun-caption {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}
.wx-strip.is-night .wx-sun-caption { color: #64748b; }

.wx-sun-track {
  position: relative;
  flex: 1 1 auto;
  height: 22px;
  min-width: 80px;
  display: flex;
  align-items: center;
}

.wx-sun-sky {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(251, 191, 36, 0.25) 0%,
    rgba(56, 189, 248, 0.18) 45%,
    rgba(249, 115, 22, 0.28) 100%);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.wx-strip.is-night .wx-sun-sky {
  background: linear-gradient(90deg,
    rgba(251, 191, 36, 0.15) 0%,
    rgba(99, 102, 241, 0.2) 50%,
    rgba(249, 115, 22, 0.18) 100%);
}

.wx-sun-arc-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.35);
  z-index: 1;
}
.wx-strip.is-night .wx-sun-arc-line {
  background: rgba(148, 163, 184, 0.25);
}

.wx-sun-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
  z-index: 2;
  max-width: 100%;
  transition: width 0.6s ease;
}

.wx-sun-now-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde68a, #f59e0b 55%, #d97706);
  box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(15, 23, 42, 0.25);
  z-index: 3;
  transition: left 0.6s ease;
}
.wx-strip.is-night .wx-sun-now-dot {
  background: radial-gradient(circle at 35% 35%, #e2e8f0, #94a3b8 60%, #64748b);
  box-shadow: 0 0 0 2px #1e293b, 0 1px 4px rgba(0, 0, 0, 0.4);
}

@media (max-width: 767.98px) {
  .wx-strip {
    top: auto;
    position: relative;
  }
  .wx-strip-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem 0.5rem;
  }
  .wx-strip-clock {
    flex-direction: row;
    align-items: baseline;
    gap: 0.45rem;
    min-width: 0;
    padding-right: 0;
    border-right: none;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  }
  .wx-strip.is-night .wx-strip-clock {
    border-right: none;
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  .wx-strip-now {
    justify-content: flex-start;
  }
  .wx-strip-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
  }
  .wx-strip-aqi,
  .wx-strip-hub,
  .wx-strip-lock {
    align-self: stretch;
    width: 100%;
    max-width: none;
  }
  .wx-sun-end {
    min-width: 2.6rem;
  }
  .wx-sun-caption {
    display: none;
  }
  html[data-color-mode="dark"] .wx-strip-clock {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
}

/*
 * App dark mode — weather strip (clock / weather / hub / locks / AQI).
 * Daytime palettes are pastel/near-white; dark-mode global span/p inherit
 * light text → light-on-white and unreadable. Force the night palette
 * whenever the user chose Dark (independent of real-world is-night).
 */
html[data-color-mode="dark"] .wx-strip,
html[data-color-mode="dark"] .wx-strip.is-sun,
html[data-color-mode="dark"] .wx-strip.is-cloud,
html[data-color-mode="dark"] .wx-strip.is-rain,
html[data-color-mode="dark"] .wx-strip.is-snow,
html[data-color-mode="dark"] .wx-strip.is-night {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 55%, #1e1b4b 100%) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
  color: #e2e8f0 !important;
}

html[data-color-mode="dark"] .wx-strip-clock {
  border-right-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-color-mode="dark"] .wx-clock-day {
  color: #e2e8f0 !important;
}
html[data-color-mode="dark"] .wx-clock-time {
  color: #f8fafc !important;
}
html[data-color-mode="dark"] .wx-clock-tz {
  color: #94a3b8 !important;
}

html[data-color-mode="dark"] .wx-strip-icon {
  color: #fbbf24 !important;
}
html[data-color-mode="dark"] .wx-strip.is-sun .wx-strip-icon {
  color: #fbbf24 !important;
}
html[data-color-mode="dark"] .wx-strip.is-cloud .wx-strip-icon {
  color: #cbd5e1 !important;
}
html[data-color-mode="dark"] .wx-strip.is-rain .wx-strip-icon {
  color: #38bdf8 !important;
}
html[data-color-mode="dark"] .wx-strip.is-snow .wx-strip-icon {
  color: #7dd3fc !important;
}

html[data-color-mode="dark"] .wx-strip-temp {
  color: #f8fafc !important;
}
html[data-color-mode="dark"] .wx-strip-deg,
html[data-color-mode="dark"] .wx-strip-pct {
  color: #94a3b8 !important;
}

html[data-color-mode="dark"] .wx-strip-humidity {
  color: #7dd3fc !important;
  border-left-color: rgba(255, 255, 255, 0.12) !important;
}
html[data-color-mode="dark"] .wx-strip-humidity .fa {
  color: #38bdf8 !important;
}

html[data-color-mode="dark"] .wx-strip-label {
  color: #e2e8f0 !important;
}
html[data-color-mode="dark"] .wx-strip-city {
  color: #94a3b8 !important;
}
html[data-color-mode="dark"] .wx-strip-hl {
  color: #cbd5e1 !important;
}

/* Hub chips */
html[data-color-mode="dark"] .wx-strip-hub {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
html[data-color-mode="dark"] .wx-hub-caption {
  color: #94a3b8 !important;
}
html[data-color-mode="dark"] .wx-hub-state,
html[data-color-mode="dark"] .wx-hub-icon {
  color: #e2e8f0 !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-online {
  background: rgba(34, 197, 94, 0.16) !important;
  border-color: rgba(74, 222, 128, 0.3) !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-online .wx-hub-icon,
html[data-color-mode="dark"] .wx-strip-hub.hub-online .wx-hub-state {
  color: #86efac !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-online .wx-hub-caption {
  color: #4ade80 !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-offline {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-offline .wx-hub-icon,
html[data-color-mode="dark"] .wx-strip-hub.hub-offline .wx-hub-state {
  color: #fca5a5 !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-offline .wx-hub-caption {
  color: #f87171 !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-unknown {
  background: rgba(245, 158, 11, 0.16) !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-unknown .wx-hub-icon,
html[data-color-mode="dark"] .wx-strip-hub.hub-unknown .wx-hub-state {
  color: #fde047 !important;
}
html[data-color-mode="dark"] .wx-strip-hub.hub-unknown .wx-hub-caption {
  color: #fbbf24 !important;
}

/* Lock chips */
html[data-color-mode="dark"] .wx-strip-lock {
  background: rgba(148, 163, 184, 0.12) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}
html[data-color-mode="dark"] .wx-lock-caption,
html[data-color-mode="dark"] .wx-lock-who {
  color: #94a3b8 !important;
}
html[data-color-mode="dark"] .wx-lock-state,
html[data-color-mode="dark"] .wx-lock-icon {
  color: #e2e8f0 !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-closed {
  background: rgba(34, 197, 94, 0.16) !important;
  border-color: rgba(74, 222, 128, 0.3) !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-closed .wx-lock-icon,
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-closed .wx-lock-state {
  color: #86efac !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-closed .wx-lock-caption {
  color: #4ade80 !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-open {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.65) 0%, rgba(69, 26, 3, 0.5) 100%) !important;
  border-color: rgba(251, 191, 36, 0.55) !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-open .wx-lock-icon,
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-open .wx-lock-state {
  color: #fef3c7 !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-open .wx-lock-caption {
  color: #fde68a !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-online.lock-open .wx-lock-who {
  color: #fcd34d !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-offline {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-offline .wx-lock-icon,
html[data-color-mode="dark"] .wx-strip-lock.lock-offline .wx-lock-state {
  color: #fca5a5 !important;
}
html[data-color-mode="dark"] .wx-strip-lock.lock-offline .wx-lock-caption {
  color: #f87171 !important;
}

html[data-color-mode="dark"] .wx-lock-btn-hist {
  color: #e2e8f0 !important;
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}
html[data-color-mode="dark"] .wx-lock-btn-hist:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}
html[data-color-mode="dark"] .wx-lock-btn-unlock {
  color: #1c1917 !important;
  background: #fbbf24 !important;
  border-color: #f59e0b !important;
}
html[data-color-mode="dark"] .wx-lock-btn-lock {
  color: #052e16 !important;
  background: #4ade80 !important;
  border-color: #22c55e !important;
}

/* AQI chips — lighter text for dark strip */
html[data-color-mode="dark"] .wx-strip-aqi.aqi-good {
  color: #86efac !important;
  background: rgba(34, 197, 94, 0.18) !important;
}
html[data-color-mode="dark"] .wx-strip-aqi.aqi-moderate {
  color: #fde047 !important;
  background: rgba(234, 179, 8, 0.18) !important;
}
html[data-color-mode="dark"] .wx-strip-aqi.aqi-usg {
  color: #fdba74 !important;
  background: rgba(249, 115, 22, 0.2) !important;
}
html[data-color-mode="dark"] .wx-strip-aqi.aqi-unhealthy {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.2) !important;
}
html[data-color-mode="dark"] .wx-strip-aqi.aqi-very {
  color: #d8b4fe !important;
  background: rgba(168, 85, 247, 0.22) !important;
}
html[data-color-mode="dark"] .wx-strip-aqi.aqi-hazardous {
  color: #fecaca !important;
  background: rgba(127, 29, 29, 0.3) !important;
}

/* Sunrise / sunset track */
html[data-color-mode="dark"] .wx-sun-end {
  color: #cbd5e1 !important;
}
html[data-color-mode="dark"] .wx-sun-rise i {
  color: #fbbf24 !important;
}
html[data-color-mode="dark"] .wx-sun-set i {
  color: #fb923c !important;
}
html[data-color-mode="dark"] .wx-sun-time {
  color: #f1f5f9 !important;
}
html[data-color-mode="dark"] .wx-sun-caption {
  color: #64748b !important;
}
html[data-color-mode="dark"] .wx-sun-sky {
  background: linear-gradient(
    90deg,
    rgba(251, 191, 36, 0.15) 0%,
    rgba(99, 102, 241, 0.2) 50%,
    rgba(249, 115, 22, 0.18) 100%
  ) !important;
}
html[data-color-mode="dark"] .wx-sun-arc-line {
  background: rgba(148, 163, 184, 0.25) !important;
}
html[data-color-mode="dark"] .wx-sun-now-dot {
  background: radial-gradient(circle at 35% 35%, #e2e8f0, #94a3b8 60%, #64748b) !important;
  box-shadow: 0 0 0 2px #1e293b, 0 1px 4px rgba(0, 0, 0, 0.4) !important;
}

/* ── R2 chat: pin site chrome; only the conversation thread scrolls ─ */
html:has(.r2-chat-page),
html.r2-chat-open {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body:has(.r2-chat-page),
html.r2-chat-open body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
  width: 100%;
}

.top-nav-layout:has(.r2-chat-page),
.top-nav-layout.r2-chat-open {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

.top-nav-layout:has(.r2-chat-page) > .top-main-nav,
.top-nav-layout.r2-chat-open > .top-main-nav {
  flex: 0 0 auto;
  position: fixed;
}

.top-nav-layout:has(.r2-chat-page) > .wx-strip,
.top-nav-layout.r2-chat-open > .wx-strip {
  flex: 0 0 auto;
  position: relative;
  top: auto;
}

.top-nav-layout:has(.r2-chat-page) .main-panel,
.top-nav-layout.r2-chat-open .main-panel {
  flex: 1 1 auto;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.top-nav-layout .main-panel > .content:has(.r2-chat-page),
.top-nav-layout.r2-chat-open .main-panel > .content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  padding-bottom: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.r2-chat-page {
  --r2-user-bg: linear-gradient(135deg, #2bb8c0 0%, #1a9aa8 100%);
  --r2-user-fg: #ffffff;
  --r2-assistant-bg: #f1f5f9;
  --r2-assistant-fg: #0f172a;
  --r2-assistant-border: rgba(15, 23, 42, 0.06);
  --r2-thread-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  --r2-composer-bg: rgba(255, 255, 255, 0.92);
  --r2-composer-border: rgba(15, 23, 42, 0.08);
  --r2-chip-bg: rgba(15, 23, 42, 0.05);
  --r2-chip-fg: #475569;
  --r2-chip-border: rgba(15, 23, 42, 0.08);
  --r2-input-bg: #ffffff;
  --r2-input-border: rgba(15, 23, 42, 0.12);
  --r2-input-fg: #0f172a;
  --r2-muted: #64748b;
  --r2-send-bg: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --r2-send-fg: #ffffff;
  --r2-attach-bg: #f1f5f9;
  --r2-attach-fg: #334155;
  --r2-thinking-bg: #e2e8f0;
  --r2-header-border: rgba(15, 23, 42, 0.08);
  --r2-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html[data-color-mode="dark"] .r2-chat-page {
  --r2-user-bg: linear-gradient(135deg, #1a9fb0 0%, #0d7a8a 100%);
  --r2-user-fg: #f0fdfa;
  --r2-assistant-bg: #1e293b;
  --r2-assistant-fg: #e2e8f0;
  --r2-assistant-border: rgba(148, 163, 184, 0.12);
  --r2-thread-bg: linear-gradient(180deg, #0f172a 0%, #0b1220 55%, #0a1018 100%);
  --r2-composer-bg: rgba(15, 23, 42, 0.94);
  --r2-composer-border: rgba(148, 163, 184, 0.12);
  --r2-chip-bg: rgba(62, 207, 255, 0.08);
  --r2-chip-fg: #94a3b8;
  --r2-chip-border: rgba(62, 207, 255, 0.14);
  --r2-input-bg: #1a2332;
  --r2-input-border: rgba(148, 163, 184, 0.18);
  --r2-input-fg: #e8eef4;
  --r2-muted: #94a3b8;
  --r2-send-bg: linear-gradient(135deg, #22d3ee 0%, #0ea5e9 100%);
  --r2-send-fg: #0b1220;
  --r2-attach-bg: #1e293b;
  --r2-attach-fg: #cbd5e1;
  --r2-thinking-bg: #243044;
  --r2-header-border: rgba(148, 163, 184, 0.12);
  --r2-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.r2-chat-page .r2-chat-shell {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.r2-chat-page .r2-topic-sidebar {
  flex: 0 0 268px;
  width: 268px;
  max-width: 100%;
  background: var(--r2-composer-bg);
  border: 1px solid var(--r2-header-border);
  border-radius: 16px;
  box-shadow: var(--r2-shadow);
  padding: 10px 8px 12px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  position: relative;
  top: auto;
  align-self: stretch;
}

.r2-chat-page .r2-topic-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 10px;
}

.r2-chat-page .r2-topic-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--r2-muted);
}

.r2-chat-page .r2-topic-new-btn {
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px !important;
  border: 1px solid var(--r2-chip-border) !important;
  background: var(--r2-chip-bg) !important;
  color: var(--r2-input-fg) !important;
  font-weight: 600;
  font-size: 12px;
  box-shadow: none !important;
}

.r2-chat-page .r2-topic-new-btn:hover,
.r2-chat-page .r2-topic-new-btn:focus {
  filter: brightness(1.08);
}

.r2-chat-page .r2-topic-loading,
.r2-chat-page .r2-topic-empty {
  padding: 12px 10px;
  font-size: 12px;
  color: var(--r2-muted);
}

.r2-chat-page .r2-topic-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 8px 10px;
  margin: 0 0 4px;
  cursor: pointer;
  color: inherit;
}

.r2-chat-page .r2-topic-row:hover,
.r2-chat-page .r2-topic-row:focus {
  background: var(--r2-chip-bg);
}

.r2-chat-page .r2-topic-row.is-active {
  background: var(--r2-chip-bg);
  border-color: var(--r2-chip-border);
}

.r2-chat-page .r2-topic-row-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--r2-input-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r2-chat-page .r2-topic-thinking {
  font-weight: 500;
  color: #d97706;
}

.r2-chat-page .r2-topic-row-preview {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--r2-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r2-chat-page .r2-topic-row-meta {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--r2-muted);
}

.r2-chat-page .r2-topic-shared {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--r2-chip-border);
  background: var(--r2-chip-bg);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.r2-chat-page .r2-topic-backdrop {
  display: none;
}

.r2-chat-page .r2-chat-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.r2-chat-page .r2-topics-toggle {
  display: none;
  flex-shrink: 0;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px !important;
  border: 1px solid var(--r2-chip-border) !important;
  background: var(--r2-chip-bg) !important;
  color: var(--r2-chip-fg) !important;
  font-weight: 600;
  box-shadow: none !important;
}

.r2-chat-page .r2-chat-card {
  margin-bottom: 0 !important;
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: var(--r2-shadow) !important;
  border: 1px solid var(--r2-header-border) !important;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.r2-chat-page .r2-chat-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 12px !important;
  border-bottom: 1px solid var(--r2-header-border) !important;
  background: transparent !important;
  flex: 0 0 auto;
}

.r2-chat-page .r2-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.r2-chat-page .r2-back-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px !important;
  border: 1px solid var(--r2-chip-border) !important;
  background: var(--r2-chip-bg) !important;
  color: var(--r2-chip-fg) !important;
  font-weight: 600;
  box-shadow: none !important;
}

.r2-chat-page .r2-back-btn:hover,
.r2-chat-page .r2-back-btn:focus {
  filter: brightness(1.08);
  color: var(--r2-input-fg) !important;
}

.r2-chat-page .r2-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.r2-chat-page .r2-logo {
  flex-shrink: 0;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.r2-chat-page .r2-brand-text {
  min-width: 0;
}

.r2-chat-page .r2-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.r2-chat-page .r2-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--r2-input-fg);
  line-height: 1.2;
}

.r2-chat-page .r2-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  flex-shrink: 0;
}

.r2-chat-page .r2-status-dot.is-thinking {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
  animation: r2-pulse 1.2s ease-in-out infinite;
}

@keyframes r2-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.9); }
}

.r2-chat-page .r2-subtitle {
  font-size: 12px;
  color: var(--r2-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r2-chat-page .r2-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.r2-chat-page .r2-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--r2-chip-fg);
  background: var(--r2-chip-bg);
  border: 1px solid var(--r2-chip-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r2-chat-page .r2-chip i {
  opacity: 0.75;
  font-size: 10px;
}

.r2-chat-page .r2-chat-body {
  padding: 0 !important;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Only the conversation scrolls — top menu / header / composer stay put */
.r2-chat-page .chat-thread {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 16px 16px;
  margin: 0;
  background: var(--r2-thread-bg);
  border-radius: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: none;
  width: 100%;
  box-sizing: border-box;
}

.r2-chat-page .r2-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 20px 40px;
  color: var(--r2-muted);
}

.r2-chat-page .r2-state-loading {
  font-size: 14px;
  min-height: 30vh;
}

.r2-chat-page .r2-empty-logo-wrap {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--r2-chip-bg);
  border: 1px solid var(--r2-chip-border);
  margin-bottom: 4px;
  box-shadow: var(--r2-shadow);
}

.r2-chat-page .r2-empty-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--r2-input-fg);
  letter-spacing: -0.02em;
}

.r2-chat-page .r2-empty-copy {
  max-width: 420px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--r2-muted);
}

.r2-chat-page .r2-empty-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  max-width: 520px;
}

.r2-chat-page .r2-hint {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--r2-chip-fg);
  background: var(--r2-chip-bg);
  border: 1px solid var(--r2-chip-border);
}

.r2-chat-page .r2-history-hint {
  text-align: center;
  font-size: 11px;
  color: var(--r2-muted);
  opacity: 0.85;
  padding: 0 0 6px;
}

.r2-chat-page .r2-load-older-wrap {
  display: flex;
  justify-content: center;
  padding: 0 0 8px;
}

.r2-chat-page .r2-load-older-btn {
  border-radius: 999px !important;
  border: 1px solid var(--r2-chip-border) !important;
  background: var(--r2-chip-bg) !important;
  color: var(--r2-chip-fg) !important;
  font-size: 12px !important;
  padding: 4px 12px !important;
  box-shadow: none !important;
}

.r2-chat-page .r2-load-older-btn:hover,
.r2-chat-page .r2-load-older-btn:focus {
  filter: brightness(1.06);
}

.r2-chat-page .r2-chat-msg {
  margin: 0 0 6px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  justify-content: flex-start;
  width: 100%;
}

/* All roles left-aligned (user + assistant) */
.r2-chat-page .r2-chat-msg.is-user,
.r2-chat-page .r2-chat-msg.is-assistant {
  justify-content: flex-start;
}

.r2-chat-page .r2-chat-bubble {
  /* Use the full thread width — short lines still shrink to content */
  max-width: 100%;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Long assistant answers (tables, lists) should stretch across the page */
.r2-chat-page .r2-chat-msg.is-assistant .r2-chat-bubble {
  width: 100%;
  max-width: 100%;
}

.r2-chat-page .r2-chat-bubble--user {
  background: var(--r2-user-bg);
  color: var(--r2-user-fg);
  border-bottom-left-radius: 5px;
}

.r2-chat-page .r2-chat-bubble--assistant {
  background: var(--r2-assistant-bg);
  color: var(--r2-assistant-fg);
  border: 1px solid var(--r2-assistant-border);
  border-bottom-left-radius: 5px;
}

.r2-chat-page .r2-photo-badge {
  font-size: 11px;
  opacity: 0.9;
  margin-bottom: 4px;
  font-weight: 600;
}

.r2-chat-page .r2-chat-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.r2-chat-page .r2-chat-text strong {
  font-weight: 700;
}

.r2-chat-page .r2-chat-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.18);
}

html[data-color-mode="dark"] .r2-chat-page .r2-chat-text code {
  background: rgba(255, 255, 255, 0.1);
}

.r2-chat-page .r2-chat-thinking {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 2px 0 4px;
  justify-content: flex-start;
}

.r2-chat-page .r2-thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: var(--r2-thinking-bg);
  color: var(--r2-muted);
  font-size: 13px;
  border: 1px solid var(--r2-assistant-border);
}

.r2-chat-page .r2-thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.r2-chat-page .r2-thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: r2-dot 1.2s ease-in-out infinite;
}

.r2-chat-page .r2-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.r2-chat-page .r2-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes r2-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Composer stays visible while you scroll history */
.r2-chat-page .r2-chat-composer {
  position: relative;
  bottom: auto;
  z-index: 20;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 14px 14px;
  background: var(--r2-composer-bg);
  border-top: 1px solid var(--r2-composer-border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-color-mode="dark"] .r2-chat-page .r2-chat-composer {
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.4);
}

.r2-chat-page .r2-chat-error {
  font-size: 13px;
  margin-bottom: 10px;
  border-radius: 10px;
}

.r2-chat-page .r2-chat-attachments {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.r2-chat-page .r2-attach-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--r2-chip-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.r2-chat-page .r2-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.r2-chat-page .r2-attach-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  padding: 0;
  line-height: 18px;
  border: none;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.r2-chat-page .r2-composer-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.r2-chat-page .r2-attach-btn {
  flex-shrink: 0;
  width: 44px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
  border: 1px solid var(--r2-input-border) !important;
  background: var(--r2-attach-bg) !important;
  color: var(--r2-attach-fg) !important;
  cursor: pointer;
  font-size: 16px;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.r2-chat-page .r2-attach-btn:hover:not(.disabled) {
  filter: brightness(1.08);
}

.r2-chat-page .r2-attach-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.r2-chat-page .r2-attach-btn input {
  display: none;
}

.r2-chat-page .r2-chat-input.form-control {
  flex: 1;
  min-width: 0;
  height: 44px !important;
  border-radius: 12px !important;
  border: 1px solid var(--r2-input-border) !important;
  background: var(--r2-input-bg) !important;
  color: var(--r2-input-fg) !important;
  box-shadow: none !important;
  padding: 10px 14px !important;
  font-size: 14.5px !important;
}

.r2-chat-page .r2-chat-input.form-control:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
}

.r2-chat-page .r2-chat-input.form-control::placeholder {
  color: var(--r2-muted) !important;
  opacity: 0.85;
}

.r2-chat-page .r2-send-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  height: 44px;
  margin: 0 !important;
  padding: 0 16px !important;
  border: none !important;
  border-radius: 12px !important;
  background: var(--r2-send-bg) !important;
  color: var(--r2-send-fg) !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35) !important;
  transition: filter 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.r2-chat-page .r2-send-btn:hover:not(:disabled),
.r2-chat-page .r2-send-btn:focus:not(:disabled) {
  filter: brightness(1.06);
  color: var(--r2-send-fg) !important;
}

.r2-chat-page .r2-send-btn:disabled {
  opacity: 0.45;
  box-shadow: none !important;
  cursor: not-allowed;
}

.r2-chat-page .r2-composer-foot {
  display: block;
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--r2-muted);
  line-height: 1.4;
}

@media (max-width: 991.98px) {
  .r2-chat-page .r2-topics-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .r2-chat-page .r2-topic-sidebar {
    position: fixed;
    z-index: 1080;
    left: 10px;
    top: 70px;
    bottom: 12px;
    width: min(320px, calc(100vw - 20px));
    height: auto;
    max-height: none;
    min-height: 0;
    align-self: auto;
    transform: translateX(-120%);
    transition: transform 0.2s ease;
  }
  .r2-chat-page .r2-topic-sidebar.is-open {
    transform: translateX(0);
  }
  .r2-chat-page .r2-topic-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1075;
    background: rgba(15, 23, 42, 0.45);
  }
}

@media (max-width: 575.98px) {
  .r2-chat-page .r2-send-label {
    display: none;
  }
  .r2-chat-page .r2-send-btn {
    width: 44px;
    padding: 0 !important;
  }
  .r2-chat-page .chat-thread {
    min-height: 0;
    padding: 10px 10px 14px;
  }
  .r2-chat-page .r2-chat-bubble {
    max-width: 100%;
  }
  .r2-chat-page .r2-chat-msg {
    margin: 0 0 5px;
  }
}

.top-nav-layout:has(.r2-chat-page) .main-panel > .footer,
.top-nav-layout.r2-chat-open .main-panel > .footer {
  display: none;
}
