/* ============================================================
   Market Insights — Feedback tab + panel (Iter 25NS, MI-12). See mi-feedback.js.
   Same look as the Help panel: dark right-hand panel on desktop/iPad,
   a bottom sheet on phones. The edge tab shows on desktop/iPad only.
   ============================================================ */
.mi-fb-tab {
  position: fixed; right: 0; top: 50%; z-index: 9400;
  transform: translate(17px, -50%);
  writing-mode: vertical-rl; rotate: 180deg;
  border: 1px solid rgba(79, 152, 163, 0.55); border-right: 0; border-radius: 0 8px 8px 0;
  background: #151a20; color: #9fd3da;
  font: 600 12px/1 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; letter-spacing: .04em;
  padding: 12px 6px 12px 21px; cursor: pointer;
  box-shadow: 4px 0 14px rgba(0, 0, 0, 0.35); opacity: .82;
  transition: transform .18s ease, opacity .18s ease, background .15s;
}
.mi-fb-tab:hover, .mi-fb-tab:focus-visible, .mi-fb-tab[aria-expanded="true"] { transform: translate(0, -50%); opacity: 1; background: #1c232b; color: #e6edf3; }
.mi-fb-tab:focus-visible { outline: 2px solid #4F98A3; outline-offset: 2px; }
:root[data-theme="light"] .mi-fb-tab { background: #ffffff; color: #1f6f79; border-color: rgba(31, 111, 121, 0.45); box-shadow: 4px 0 14px rgba(0, 0, 0, 0.12); }
:root[data-theme="light"] .mi-fb-tab:hover { background: #f3f7f8; color: #0f4c54; }
/* Out of the way: phones (menu item instead), print, guided tours, other panels and full-screen charts */
@media (max-width: 640px) { .mi-fb-tab { display: none; } }
@media print { .mi-fb-tab { display: none; } }
html.mi-help-on .mi-fb-tab, html.mi-fb-on .mi-fb-tab,
body:has(.mi-tour) .mi-fb-tab, body:has(.wl-chart-expanded) .mi-fb-tab,
body:has(.mi-welcome-overlay) .mi-fb-tab { display: none; }

.mi-fb-ov { position: fixed; inset: 0; z-index: 9590; background: rgba(5, 8, 12, 0.45); }
.mi-fb-panel {
  --fb-bg: #151a20; --fb-raised: #1c232b; --fb-field: #0f1318; --fb-line: #2a313a; --fb-line-2: #2f3742;
  --fb-ink: #e6edf3; --fb-ink-2: #a9b4bf; --fb-ink-3: #8b949e; --fb-accent: #4F98A3; --fb-accent-ink: #9fd3da; --fb-bad: #f07067;
  --fb-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 9600;
  width: 420px; max-width: 100%; display: flex; flex-direction: column;
  background: var(--fb-bg); color: var(--fb-ink); border-left: 1px solid var(--fb-line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45);
  font: 14px/1.5 var(--fb-font);
}
.mi-fb-ov[hidden], .mi-fb-panel[hidden], .mi-fb-panel [hidden] { display: none !important; }
.mi-fb-panel *, .mi-fb-panel *::before, .mi-fb-panel *::after { box-sizing: border-box; }
.mi-fb-panel button, .mi-fb-panel input, .mi-fb-panel textarea { font: inherit; color: inherit; }
.mi-fb-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 4px; }
.mi-fb-head h2 { flex: 1; margin: 0; font: 800 19px/1.2 'Inter Tight', 'Inter', sans-serif; letter-spacing: -0.01em; color: var(--fb-ink); }
.mi-fb-x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--fb-ink-3) !important; font-size: 22px !important; line-height: 1; cursor: pointer; }
.mi-fb-x:hover { background: var(--fb-raised); color: var(--fb-ink) !important; }

.mi-fb-form { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; overscroll-behavior: contain; }
.mi-fb-lede { margin: 0; color: var(--fb-ink-2); font-size: 13px; }
.mi-fb-field { display: flex; flex-direction: column; gap: 7px; margin: 0; }
.mi-fb-label { font: 700 11px/1.2 var(--fb-font); letter-spacing: .07em; text-transform: uppercase; color: var(--fb-accent); }
.mi-fb-label em { font-style: normal; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--fb-ink-3); margin-left: 4px; }

.mi-fb-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mi-fb-seg button { border: 1px solid var(--fb-line-2); background: var(--fb-field); border-radius: 8px; padding: 8px 6px; font-size: 13px; font-weight: 600; color: var(--fb-ink-2) !important; cursor: pointer; }
.mi-fb-seg button:hover { border-color: var(--fb-accent); color: var(--fb-ink) !important; }
.mi-fb-seg button.is-on { border-color: var(--fb-accent); background: rgba(79, 152, 163, 0.18); color: var(--fb-ink) !important; }

.mi-fb-moods { display: flex; gap: 8px; }
.mi-fb-moods button { width: 48px; height: 42px; border: 1px solid var(--fb-line-2); background: var(--fb-field); border-radius: 10px; font-size: 22px; line-height: 1; cursor: pointer; filter: grayscale(.85); opacity: .75; transition: filter .12s, opacity .12s, border-color .12s; }
.mi-fb-moods button:hover { filter: none; opacity: 1; }
.mi-fb-moods button.is-on { filter: none; opacity: 1; border-color: var(--fb-accent); background: rgba(79, 152, 163, 0.18); }

.mi-fb-panel textarea, .mi-fb-panel input[type="email"] {
  width: 100%; border: 1px solid var(--fb-line-2); border-radius: 8px; background: var(--fb-field); color: var(--fb-ink);
  padding: 9px 11px; font-size: 14px; line-height: 1.45; outline: 0;
}
.mi-fb-panel textarea { resize: vertical; min-height: 120px; }
.mi-fb-panel textarea:focus, .mi-fb-panel input[type="email"]:focus { border-color: var(--fb-accent); }
.mi-fb-panel textarea::placeholder, .mi-fb-panel input::placeholder { color: #6e7681; }
.mi-fb-count { font-size: 11.5px; color: var(--fb-ink-3); text-align: right; min-height: 0; }
.mi-fb-count:empty { display: none; }
.mi-fb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.mi-fb-check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--fb-ink); cursor: pointer; }
.mi-fb-check input { width: 16px; height: 16px; accent-color: var(--fb-accent); margin: 0; }
.mi-fb-ctx { margin: 0; font-size: 12px; color: var(--fb-ink-3); overflow-wrap: anywhere; }
.mi-fb-err { margin: 0; font-size: 13px; color: var(--fb-bad); }
.mi-fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 4px; }
.mi-fb-btn { border: 1px solid var(--fb-line-2); background: transparent; border-radius: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--fb-ink-2) !important; cursor: pointer; }
.mi-fb-btn:hover { border-color: var(--fb-accent); color: var(--fb-ink) !important; }
.mi-fb-btn.is-primary { background: var(--fb-accent); border-color: var(--fb-accent); color: #06201d !important; }
.mi-fb-btn.is-primary:hover { filter: brightness(1.08); }
.mi-fb-btn:disabled { opacity: .6; cursor: default; }
.mi-fb-panel :focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.mi-fb-panel textarea:focus-visible, .mi-fb-panel input[type="email"]:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(79, 152, 163, 0.22); }

.mi-fb-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.mi-fb-done h3 { margin: 6px 0 0; font: 800 19px/1.2 'Inter Tight', 'Inter', sans-serif; }
.mi-fb-done p { margin: 0 0 12px; color: var(--fb-ink-2); }
.mi-fb-tick { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #4cc278; background: rgba(76, 194, 120, 0.14); }

/* Phones: a bottom sheet */
@media (max-width: 640px) {
  .mi-fb-panel { top: auto; height: 88%; height: 88dvh; width: 100%; border-left: 0; border-top: 1px solid var(--fb-line); border-radius: 16px 16px 0 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.5); }
  .mi-fb-panel textarea, .mi-fb-panel input[type="email"] { font-size: 16px; }   /* no iOS zoom on focus */
  html.mi-fb-on { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .mi-fb-tab { transition: none; } }
