:root { --appbar-h: 56px; }

/* ═══════════════════════════════════════════════════════════════
   Backdrop
════════════════════════════════════════════════════════════════ */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0,0,0,.15);
  display: none;
}
.menu-overlay.show { display: block; }

/* ═══════════════════════════════════════════════════════════════
   Frame — same centering as cards/app-bar
════════════════════════════════════════════════════════════════ */
.menu-frame {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 600px;
  pointer-events: none;
}
@media (min-width: 1024px) { .menu-frame { max-width: 800px; } }

/* ═══════════════════════════════════════════════════════════════
   Panel — drops from the right edge of the app-bar
════════════════════════════════════════════════════════════════ */
.menu-panel {
  position: absolute;
  top: var(--appbar-h);
  right: 0;
  width: min(92%, 360px);
  min-width: 240px;
  max-height: calc(100dvh - var(--appbar-h) - 20px);
  display: flex;
  flex-direction: column;
  background: var(--c-surface, #eeebe5);
  color: var(--c-text, #2a2723);
  border: 1px solid var(--md-outline, #d9d4cc);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}
.menu-overlay.show .menu-panel {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   Header
════════════════════════════════════════════════════════════════ */
.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px 10px;
  border-bottom: 1px solid var(--md-outline, #d9d4cc);
  position: sticky;
  top: 0;
  background: var(--c-surface, #eeebe5);
  z-index: 1;
}

.menu-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1px;
}

.menu-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 6px;
  color: var(--c-text, #2a2723);
  opacity: .55;
  border-radius: 6px;
  line-height: 1;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-close:hover { opacity: 1; background: var(--c-surface-2, #e6e2da); }

/* ═══════════════════════════════════════════════════════════════
   Content + Sections
════════════════════════════════════════════════════════════════ */
.menu-content {
  padding: 10px 0 4px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.menu-section {
  padding: 10px 15px;
  border-bottom: 1px solid var(--md-outline, #d9d4cc);
}
.menu-section:last-child { border-bottom: none; }

.menu-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--c-text-2, rgba(42,39,35,.52));
  margin-bottom: 8px;
}

/* Row: label on left, control on right */
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   Default chart view — radio grid
════════════════════════════════════════════════════════════════ */
.chart-view-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 2px;
}

.chart-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .12s;
}
.chart-radio-label:hover { background: var(--c-surface-2, #e6e2da); }
.chart-radio-label:has(input:checked) {
  color: var(--c-primary, #4f8a69);
  font-weight: 500;
}

.chart-radio-label input[type="radio"] {
  accent-color: var(--c-primary, #4f8a69);
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Card open preferences — checkboxes
════════════════════════════════════════════════════════════════ */
.menu-check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 5px 0;
  cursor: pointer;
}

.menu-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--c-primary, #4f8a69);
  cursor: pointer;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Theme toggle button inside menu
════════════════════════════════════════════════════════════════ */
.theme-toggle-btn {
  background: var(--c-surface-2, #e6e2da);
  border: 1px solid var(--md-outline, #d9d4cc);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--c-text, #2a2723);
  line-height: 1;
}
.theme-toggle-btn:hover { background: var(--c-border, #d9d4cc); }

/* ═══════════════════════════════════════════════════════════════
   Footer / logout
════════════════════════════════════════════════════════════════ */
.menu-footer {
  padding: 12px 16px;
  flex-shrink: 0;
}

.menu-action-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid var(--md-outline, #d9d4cc);
  color: var(--c-text, #2a2723);
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  transition: background .12s;
}
.menu-action-btn:hover { background: var(--c-surface-2, #e6e2da); }

/* ═══════════════════════════════════════════════════════════════
   Dark mode overrides
════════════════════════════════════════════════════════════════ */
.dark .menu-panel {
  background: var(--c-surface, #1f2420);
  color: var(--c-text, #d4d8d2);
  border-color: var(--c-border, #2e3530);
}
.dark .menu-header { background: var(--c-surface, #1f2420); }
.dark .theme-toggle-btn { background: var(--c-surface-2, #252c27); }

