/* =========================================================================
   ft-v3.css — v3 additions on top of ft-core.css
   Tier badges, help overlay, feedback widget, KPI cards, chart grid,
   flagship hero. Matches v2 tokens and adds no new variables.
   ========================================================================= */

/* ---------- Tier badges ---------- */
.ft-tier-flagship {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  vertical-align: middle;
  margin-left: 8px;
  box-shadow: 0 1px 3px rgba(217, 119, 6, .3);
}
.ft-tier-standard {
  display: inline-block;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  vertical-align: middle;
  margin-left: 8px;
}

/* ---------- Flagship hero strip ---------- */
.ft-flagship-hero {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border-left: 4px solid #d97706;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 0 0 20px;
  font-size: 13px;
  color: #78350f;
}
.ft-flagship-hero::before {
  content: '★ FLAGSHIP TOOL';
  display: block;
  color: #b45309;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  margin-bottom: 3px;
}

/* ---------- Help button ---------- */
.ft-help-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid #c7d2e0;
  background: #fff;
  color: #1a3a5f;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
  margin-left: 12px;
  vertical-align: middle;
  transition: transform .15s, background .15s, color .15s;
}
.ft-help-btn:hover { background: #1a3a5f; color: #fff; transform: scale(1.08); }
.ft-help-btn:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }

.ft-help-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 26, 43, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  animation: ft-fade .15s ease-out;
}
.ft-help-panel {
  background: #fff; border-radius: 12px;
  max-width: 720px; width: 100%; max-height: 85vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(11, 26, 43, .3);
}
.ft-help-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e1e8f0;
}
.ft-help-head strong { flex: 1; font-size: 15px; }
.ft-help-link { font-size: 13px; color: #1a3a5f; text-decoration: none; }
.ft-help-link:hover { text-decoration: underline; }
.ft-help-close {
  background: none; border: 0; font-size: 26px;
  cursor: pointer; color: #6b7c94; line-height: 1;
  padding: 0 4px;
}
.ft-help-close:hover { color: #0b1a2b; }
.ft-help-body {
  padding: 18px; overflow-y: auto;
  font-size: 14px; line-height: 1.6;
  color: #0b1a2b;
}
.ft-help-body h1 { font-size: 20px; margin: 0 0 10px; }
.ft-help-body h2 { font-size: 17px; margin: 18px 0 8px; }
.ft-help-body h3 { font-size: 15px; margin: 14px 0 6px; }
.ft-help-body p  { margin: 6px 0; }
.ft-help-body ul { margin: 8px 0; padding-left: 22px; }
.ft-help-body li { margin: 3px 0; }
.ft-help-body code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.ft-help-body pre { background: #f7f9fc; padding: 10px 12px; border-radius: 6px; overflow-x: auto; font-size: 12px; border: 1px solid #e1e8f0; }
.ft-help-body pre code { background: transparent; padding: 0; }

/* ---------- AI insight thumbs ---------- */
.ft-ai-thumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  background: #f7f9fc;
  border-radius: 8px;
  border: 1px solid #e1e8f0;
  font-size: 12px;
}
.ft-ai-thumbs-label { color: #4a5b72; margin-right: 4px; }
.ft-ai-thumbs button {
  background: #fff; border: 1px solid #c7d2e0; border-radius: 6px;
  padding: 4px 10px; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.ft-ai-thumbs button:hover { background: #e0f2fe; border-color: #0ea5e9; transform: scale(1.08); }
.ft-ai-thumbs button:disabled { opacity: 0.4; cursor: default; transform: none; }
.ft-ai-thumbs-ack { color: #16a34a; font-weight: 600; margin-left: 6px; }
.ft-ai-thumbs-reason {
  display: flex; gap: 6px; margin-top: 6px; width: 100%;
}
.ft-ai-thumbs-reason input {
  flex: 1; padding: 5px 8px; font-size: 12px;
  border: 1px solid #c7d2e0; border-radius: 4px;
}
.ft-ai-thumbs-reason button { padding: 4px 12px; font-size: 12px; }

/* ---------- Feedback tab + modal ---------- */
.ft-feedback-tab {
  position: fixed;
  right: 0; bottom: 80px;
  background: #1a3a5f;
  color: #fff;
  border: 0;
  border-radius: 8px 0 0 8px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  z-index: 50;
  box-shadow: -2px 2px 8px rgba(11, 26, 43, .15);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, transform .15s;
}
.ft-feedback-tab:hover { background: #0b1a2b; transform: translateX(-2px); }
.ft-feedback-tab:focus-visible { outline: 2px solid #0ea5e9; outline-offset: 2px; }

.ft-feedback-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 26, 43, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; padding: 20px;
  animation: ft-fade .15s ease-out;
}
.ft-feedback-modal {
  background: #fff; border-radius: 12px;
  padding: 22px;
  max-width: 520px; width: 100%;
  box-shadow: 0 20px 60px rgba(11, 26, 43, .3);
}
.ft-feedback-modal h3 { margin: 0 0 14px; font-size: 17px; }
.ft-feedback-modal label {
  display: block; font-size: 13px; font-weight: 600;
  color: #0b1a2b; margin: 10px 0 4px;
}
.ft-feedback-modal label .req { color: #dc2626; }
.ft-feedback-kind {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 6px 0 10px;
}
.ft-feedback-kind label {
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0;
}
.ft-feedback-modal textarea,
.ft-feedback-modal input[type="email"] {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #c7d2e0; border-radius: 6px;
  font-family: inherit; font-size: 14px;
  resize: vertical;
}
.ft-feedback-modal textarea:focus,
.ft-feedback-modal input[type="email"]:focus {
  outline: 0; border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.ft-feedback-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 14px;
}
.ft-feedback-privacy {
  font-size: 11px; color: #6b7c94;
  margin-top: 10px; line-height: 1.5;
}

/* ---------- KPI cards (v3 flagship dashboards) ---------- */
.ft-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.ft-kpi-card {
  background: #fff; border: 1px solid #e1e8f0; border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(11, 26, 43, .04);
}
.ft-kpi-label {
  font-size: 11px; color: #4a5b72;
  text-transform: uppercase; letter-spacing: .06em;
}
.ft-kpi-value {
  font-size: 26px; font-weight: 800;
  color: #0b1a2b; margin-top: 4px; line-height: 1.1;
}
.ft-kpi-sub { font-size: 12px; color: #6b7c94; margin-top: 3px; }
.ft-kpi-delta.up    { color: #16a34a; font-weight: 600; font-size: 12px; margin-top: 3px; }
.ft-kpi-delta.down  { color: #dc2626; font-weight: 600; font-size: 12px; margin-top: 3px; }
.ft-kpi-delta.flat  { color: #6b7c94; font-weight: 600; font-size: 12px; margin-top: 3px; }

.ft-kpi-card.alert  { border-color: #fca5a5; background: linear-gradient(180deg, #fff, #fef2f2); }
.ft-kpi-card.warn   { border-color: #fcd34d; background: linear-gradient(180deg, #fff, #fffbeb); }
.ft-kpi-card.good   { border-color: #86efac; background: linear-gradient(180deg, #fff, #f0fdf4); }

/* ---------- Chart grid ---------- */
.ft-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; margin: 20px 0;
}
.ft-chart-card {
  background: #fff; border: 1px solid #e1e8f0; border-radius: 10px;
  padding: 14px;
}
.ft-chart-card h4 { margin: 0 0 8px; font-size: 14px; }
.ft-chart-card canvas { max-width: 100%; height: 260px !important; }

/* ---------- Flow container ---------- */
.ft-flow-container {
  position: relative;
  border: 1px solid #e1e8f0; border-radius: 10px;
  overflow: hidden;
  background: #f7f9fc;
}
.ft-flow-legend {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid #e1e8f0; border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  display: flex; flex-direction: column; gap: 4px;
}
.ft-flow-legend .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 6px;
  vertical-align: middle;
}

/* ---------- AI insight card ---------- */
.ft-ai-insight {
  background: linear-gradient(135deg, #e0f2fe, #ede9fe);
  border: 1px solid #c7d2fe;
  padding: 16px 18px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #312e81;
}
.ft-ai-insight h4 { margin: 0 0 8px; font-size: 14px; color: #1e1b4b; }
.ft-ai-insight ul { margin: 6px 0 6px 18px; }
.ft-ai-insight .ft-ai-section + .ft-ai-section { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(99, 102, 241, .18); }

/* ---------- Animations ---------- */
@keyframes ft-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ft-help-backdrop, .ft-feedback-backdrop { animation: none; }
  .ft-help-btn, .ft-feedback-tab, .ft-ai-thumbs button { transition: none; }
}
