/* ==========================================================================
   ns-feedback.css  ·  the Feedback tab and dialog (templates/feedback-widget.html)
   The widget is injected into every page by securityHeadersMiddleware, including
   pages that do not load ns-ui.css, so it carries its own sheet: every value reads
   the ns-* token with the light Coach value as fallback (dark comes from the tokens
   that ns-ui.css section 39 sets on body.ns-coach). Rules are anchored on the
   widget's ids so the legacy sheets' bare `button` / `textarea` rules cannot win.
   ========================================================================== */

/* ---- the tab: right edge, vertical, draggable along the edge -------------- */
#nsFbTab.ns-fb-tab {
  position: fixed; right: 0; top: var(--ns-fb-top, 64%); transform: translateY(-50%);
  z-index: 9990;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 32px; height: 112px; min-width: 0; margin: 0; padding: 10px 0;
  border: none; border-radius: 12px 0 0 12px;
  background: var(--ns-ink-panel, #2d3b52); color: var(--ns-text-on-dark, #ffffff);
  box-shadow: var(--ns-shadow-float, 0 10px 30px rgba(45, 59, 82, 0.14));
  font: 600 12px/1 var(--ns-font-body, 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif);
  letter-spacing: 0.04em; text-transform: none;
  opacity: 0.9; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
#nsFbTab.ns-fb-tab:hover, #nsFbTab.ns-fb-tab:focus-visible { opacity: 1; }
#nsFbTab.ns-fb-tab:focus-visible { outline: 3px solid var(--ns-primary, #3d6db3); outline-offset: 2px; }
#nsFbTab.ns-fb-tab svg { flex: 0 0 auto; }
#nsFbTab .ns-fb-tab__label { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
#nsFbTab.ns-fb-tab--dragging { opacity: 1; cursor: grabbing; }
html.ns-fb-open #nsFbTab { visibility: hidden; }
@media print { #nsFbTab, #nsFbScrim { display: none !important; } }

/* ---- the dialog ------------------------------------------------------------- */
#nsFbScrim.ns-fb-scrim {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--ns-scrim, rgba(45, 59, 82, 0.45));
}
#nsFbScrim.ns-fb-scrim[hidden] { display: none; }
#nsFbDialog.ns-fb {
  box-sizing: border-box; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 24px;
  border-radius: var(--ns-r-2xl, 22px); background: var(--ns-surface, #ffffff); color: var(--ns-text, #2d3b52);
  box-shadow: var(--ns-shadow-dialog, 0 30px 80px rgba(20, 30, 50, 0.35));
  font-family: var(--ns-font-body, 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif); font-size: 15px; text-align: left;
}
#nsFbDialog:focus { outline: none; }
#nsFbDialog .ns-fb__title { margin: 0; font-family: var(--ns-font-display, 'Bebas Neue', 'Oswald', 'Inter', sans-serif); font-size: 26px; font-weight: 400; letter-spacing: 0.02em; color: var(--ns-text, #2d3b52); background: none; -webkit-text-fill-color: currentColor; text-shadow: none; }
#nsFbDialog .ns-fb__fine { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ns-text-2, #43506a); }
#nsFbDialog .ns-fb__field { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--ns-text, #2d3b52); }
#nsFbDialog .ns-fb__optional { font-weight: 400; color: var(--ns-text-muted, #566176); }
#nsFbDialog .ns-fb__bugonly { display: flex; flex-direction: column; gap: 8px; }
#nsFbDialog .ns-fb__bugonly[hidden] { display: none; }

#nsFbDialog .ns-fb__chips { display: flex; flex-wrap: wrap; gap: 8px; }
#nsFbDialog .ns-fb__chip {
  width: auto; min-width: 0; min-height: var(--ns-hit, 44px); margin: 0; padding: 0 16px;
  border-radius: 22px; border: 1px solid var(--ns-border-strong, #c3cddd);
  background: var(--ns-surface, #ffffff); color: var(--ns-text, #2d3b52); box-shadow: none;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
#nsFbDialog .ns-fb__chip[aria-pressed="true"] { background: var(--ns-ink-panel, #2d3b52); border-color: var(--ns-ink-panel, #2d3b52); color: var(--ns-text-on-dark, #ffffff); }

#nsFbDialog .ns-fb__input {
  box-sizing: border-box; width: 100%; min-height: 104px; margin: 0; padding: 12px;
  border-radius: var(--ns-r-sm, 10px); border: 1px solid var(--ns-border-strong, #c3cddd);
  background: var(--ns-surface, #ffffff); color: var(--ns-text, #2d3b52); box-shadow: none;
  font: inherit; font-size: 15px; line-height: 1.45; resize: vertical;
}
#nsFbDialog .ns-fb__input--short { min-height: var(--ns-hit, 44px); }
#nsFbDialog .ns-fb__input::placeholder { color: var(--ns-text-muted, #566176); opacity: 1; }
#nsFbDialog :is(.ns-fb__input, .ns-fb__chip, .ns-fb__btn, .ns-fb__disclosure):focus-visible { outline: 3px solid var(--ns-primary, #3d6db3); outline-offset: 2px; }

#nsFbDialog .ns-fb__context { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--ns-r-md, 12px); background: var(--ns-surface-soft, #f4f6fa); }
#nsFbDialog .ns-fb__disclosure {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  width: auto; min-width: 0; min-height: var(--ns-hit, 44px); margin: 0; padding: 0 4px;
  border: none; background: none; box-shadow: none; color: var(--ns-link, #2f5c9e);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
#nsFbDialog .ns-fb__disclosure[aria-expanded="true"] svg { transform: rotate(180deg); }
#nsFbDialog .ns-fb__dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 4px 0 0; font-size: 13px; }
#nsFbDialog .ns-fb__dl[hidden] { display: none; }
#nsFbDialog .ns-fb__dl dt { color: var(--ns-text-2, #43506a); font-weight: 600; }
#nsFbDialog .ns-fb__dl dd { margin: 0; color: var(--ns-text, #2d3b52); overflow-wrap: anywhere; }

#nsFbDialog .ns-fb__status { flex: 1 1 100%; margin: 0; text-align: right; font-size: 14px; color: var(--ns-text-2, #43506a); }
#nsFbDialog .ns-fb__status--bad { color: var(--ns-bad-ink, #8a2a23); }
#nsFbDialog .ns-fb__status--ok { color: var(--ns-ok-ink, #1f5c46); }
#nsFbDialog .ns-fb__status:empty { display: none; }

/* The actions stay in reach when "What we attach" makes the dialog scroll. */
#nsFbDialog .ns-fb__actions {
  position: sticky; bottom: -24px; z-index: 1;
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  margin: 0 -24px -24px; padding: 12px 24px 24px;
  background: var(--ns-surface, #ffffff); border-top: 1px solid var(--ns-divider, #e3e8f0);
}
#nsFbDialog .ns-fb__btn {
  width: auto; min-width: 0; min-height: var(--ns-hit, 44px); margin: 0; padding: 0 20px;
  border-radius: var(--ns-r-md, 12px); border: 1px solid var(--ns-border-strong, #c3cddd);
  background: var(--ns-surface, #ffffff); color: var(--ns-text, #2d3b52); box-shadow: none;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
#nsFbDialog .ns-fb__btn--primary { background: var(--ns-primary, #3d6db3); border-color: var(--ns-primary, #3d6db3); color: var(--ns-text-on-dark, #ffffff); }
#nsFbDialog .ns-fb__btn:disabled { opacity: 0.6; cursor: progress; }

@media (max-width: 600px) {
  #nsFbScrim.ns-fb-scrim { align-items: flex-end; padding: 0; }
  #nsFbDialog.ns-fb { max-width: none; max-height: 92vh; border-radius: var(--ns-r-2xl, 22px) var(--ns-r-2xl, 22px) 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  #nsFbDialog .ns-fb__actions { bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); margin: 0 -16px calc(-16px - env(safe-area-inset-bottom, 0px)); padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  #nsFbDialog .ns-fb__actions .ns-fb__btn { flex: 1 1 0; }
}
@media (prefers-reduced-motion: no-preference) {
  #nsFbTab.ns-fb-tab { transition: opacity 0.15s ease; }
}
