/*
 * Feedback tab + sheet (from the feedback-tab skill), mapped to Kinly Quest's dark brass-and-paper tokens.
 * The app is dark-only, so there is a single palette. --fb-attention carries white text (#cc4e00 ≥ 4.5:1).
 */
:root {
  --fb-paper: #1a1512;
  --fb-card: #241d18;
  --fb-ink: var(--ink, #efe6d2);
  --fb-ink-2: var(--muted, #a89c86);
  --fb-line: rgba(239, 230, 210, 0.16);
  --fb-accent: var(--accent, #c9a24a);
  --fb-accent-ink: var(--accent-ink, #1a1307);
  --fb-accent-soft: color-mix(in srgb, var(--accent, #c9a24a) 16%, #1a1512);
  --fb-attention: #cc4e00;
  --fb-good: var(--ok, #6fcf8e);
  --fb-error: #ff8a78;
  --fb-radius: 12px;
}

.fb-tab {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 60;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  padding: 12px 7px;
  border: 1px solid var(--fb-line);
  border-right: 0;
  border-radius: 0 var(--fb-radius) var(--fb-radius) 0;
  background: var(--fb-card);
  color: var(--fb-ink-2);
  font: 600 12px/1 var(--font-ui, system-ui, sans-serif);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.6);
  margin-right: env(safe-area-inset-right, 0);
  opacity: 0.85;
}
.fb-tab:hover, .fb-tab:focus-visible { color: var(--fb-accent); opacity: 1; }
.fb-tab[hidden] { display: none; }

.fb-dialog {
  border: 1px solid var(--fb-line);
  border-radius: 20px;
  padding: 0;
  width: min(500px, calc(100vw - 32px));
  background: var(--fb-card);
  color: var(--fb-ink);
  font-family: var(--font-ui, system-ui, sans-serif);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
.fb-dialog::backdrop { background: rgba(5, 4, 3, 0.7); }
@media (max-width: 520px) {
  .fb-dialog {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
    max-height: 92dvh;
  }
}

.fb-form, .fb-sent { display: grid; gap: 14px; padding: 20px; }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fb-head h2, .fb-sent h2 { font-family: var(--font-display, Georgia, serif); font-size: 22px; margin: 0; }
.fb-sent p { margin: 0; color: var(--fb-ink-2); }
.fb-close {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  border: 1px solid var(--fb-line); background: transparent; color: var(--fb-ink-2);
  font-size: 22px; line-height: 1; cursor: pointer;
}

.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-chip {
  padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--fb-line); background: var(--fb-paper); color: var(--fb-ink);
}
.fb-chip[aria-checked="true"] { background: var(--fb-accent); border-color: var(--fb-accent); color: var(--fb-accent-ink); font-weight: 600; }

.fb-field { display: grid; gap: 6px; }
.fb-label { font-size: 13px; color: var(--fb-ink-2); font-weight: 600; }
.fb-field textarea, .fb-field input {
  font: inherit; font-size: 16px; color: var(--fb-ink); background: var(--fb-paper);
  border: 1px solid var(--fb-line); border-radius: 10px; padding: 10px 12px; width: 100%;
  resize: vertical; min-height: 0;
}
.fb-field textarea:focus, .fb-field input:focus, .fb-reply__input:focus { outline: none; border-color: var(--fb-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fb-accent) 25%, transparent); }
.fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.fb-error { margin: 0; color: var(--fb-error); font-size: 14px; }
.fb-error[hidden] { display: none; }
.fb-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fb-context { font-size: 12px; color: var(--fb-ink-2); flex: 1 1 200px; }
.fb-btn {
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--fb-line);
  background: var(--fb-paper); color: var(--fb-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.fb-btn--primary { background: var(--fb-accent); border-color: var(--fb-accent); color: var(--fb-accent-ink); }
.fb-btn:disabled { opacity: 0.5; cursor: default; }

/* The bright tab that appears above Feedback when there's a reply. */
.fb-tab--replied {
  transform: translateY(calc(-50% - 112px)) rotate(180deg);
  background: var(--fb-attention);
  border-color: var(--fb-attention);
  color: #fff;
  font-weight: 700;
  opacity: 1;
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--fb-attention) 70%, transparent);
}
.fb-tab--replied:hover { color: #fff; background: color-mix(in srgb, var(--fb-attention) 85%, black); }
@media (prefers-reduced-motion: no-preference) {
  .fb-tab--replied { animation: replied-in 0.5s ease-out both, replied-nudge 2.4s ease-in-out 0.6s 3; }
}
@keyframes replied-in { from { opacity: 0; transform: translate(12px, calc(-50% - 112px)) rotate(180deg); } }
@keyframes replied-nudge {
  0%, 100% { transform: translateY(calc(-50% - 112px)) rotate(180deg); }
  50% { transform: translate(-4px, calc(-50% - 112px)) rotate(180deg); }
}

.fb-sheet { display: grid; gap: 14px; padding: 20px; max-height: 88dvh; overflow-y: auto; }
.fb-sheet .fb-form, .fb-sheet .fb-sent { padding: 0; }
.fb-views { display: inline-flex; gap: 4px; background: var(--fb-paper); border: 1px solid var(--fb-line); border-radius: 999px; padding: 3px; }
.fb-view { border: 0; background: transparent; color: var(--fb-ink-2); font: inherit; font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.fb-view[aria-selected="true"] { background: var(--fb-accent); color: var(--fb-accent-ink); }
.fb-dot { min-width: 18px; height: 18px; border-radius: 999px; background: var(--fb-attention); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; }

.fb-empty { margin: 0; color: var(--fb-ink-2); }
.fb-threads { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fb-thread { display: grid; gap: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--fb-line); background: var(--fb-paper); }
.fb-thread--new { border-color: var(--fb-attention); box-shadow: 0 0 0 1px var(--fb-attention); }
.fb-thread__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fb-done { font-size: 12px; font-weight: 700; color: var(--fb-good); }
.fb-bubble { margin: 0; padding: 8px 12px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; font-size: 15px; overflow-wrap: anywhere; }
.fb-bubble--me { justify-self: end; background: var(--fb-accent); color: var(--fb-accent-ink); border-bottom-right-radius: 4px; }
.fb-bubble--them { justify-self: start; background: var(--fb-card); border: 1px solid var(--fb-line); border-bottom-left-radius: 4px; }
.fb-from { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fb-ink-2); margin-bottom: 2px; }
.fb-system { margin: 0; text-align: center; font-size: 12px; color: var(--fb-ink-2); }
.fb-reply { display: flex; gap: 8px; }
.fb-reply__input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 16px; color: var(--fb-ink); background: var(--fb-card); border: 1px solid var(--fb-line); border-radius: 999px; padding: 8px 14px; }
