/* Quinn Reporter — chat-driven custom reports on the IQOS Reports page.
   Scoped hard under .qr-shell / #qr-panel so it cannot leak into the shell. */

.qr-shell,
.qr-shell * {
  box-sizing: border-box;
}

.qr-shell {
  --qr-ink: #111318;
  --qr-muted: #6f747c;
  --qr-line: #e6e8ec;
  --qr-soft: #f5f6f8;
  --qr-blue: #0a84ff;
  --qr-green: #30d158;
  --qr-amber: #ff9f0a;
  --qr-red: #ff453a;
  --qr-font: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-family: var(--qr-font);
  color: var(--qr-ink);
  margin: 0 0 24px;
  position: relative;
  z-index: 2;
}

.qr-panel {
  border: 1px solid var(--qr-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(17, 19, 24, 0.10), 0 2px 8px rgba(17, 19, 24, 0.04);
  overflow: hidden;
}

.qr-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 0%, rgba(10, 132, 255, 0.55), transparent 34%),
    radial-gradient(circle at 8% 100%, rgba(48, 209, 88, 0.22), transparent 32%),
    linear-gradient(120deg, #0b0d12 0%, #141923 56%, #0d1118 100%);
}

.qr-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

.qr-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.qr-avatar {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}

.qr-brand-copy {
  min-width: 0;
}

.qr-brand-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.qr-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.qr-online::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--qr-green);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.18);
}

.qr-brand-sub {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.qr-hero-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  border-radius: 11px;
  height: 34px;
  padding: 0 12px;
  font-family: var(--qr-font);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.qr-hero-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.28);
}

.qr-hero-btn:active {
  transform: translateY(1px);
}

.qr-hero-btn svg {
  width: 13px;
  height: 13px;
}

.qr-body {
  padding: 20px 22px 18px;
  background:
    radial-gradient(circle at 96% 0%, rgba(10, 132, 255, 0.045), transparent 30%),
    #fff;
}

.qr-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 520px;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: #d7dae0 transparent;
}

.qr-thread::-webkit-scrollbar {
  width: 5px;
}

.qr-thread::-webkit-scrollbar-thumb {
  background: #d7dae0;
  border-radius: 99px;
}

.qr-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: qr-in 0.22s ease both;
}

@keyframes qr-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.qr-msg-user {
  justify-content: flex-end;
}

.qr-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  margin-top: 2px;
  box-shadow: 0 3px 10px rgba(17, 19, 24, 0.10);
}

.qr-bubble {
  max-width: min(700px, 82%);
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  white-space: normal;
  word-break: break-word;
}

.qr-msg-assistant .qr-bubble {
  background: #f5f6f8;
  color: #2a2e34;
  border: 1px solid #eceef1;
  border-top-left-radius: 6px;
}

.qr-msg-user .qr-bubble {
  background: #111318;
  color: #fff;
  border-top-right-radius: 6px;
  box-shadow: 0 8px 20px rgba(17, 19, 24, 0.14);
}

.qr-bubble strong {
  font-weight: 600;
  color: #111318;
}

.qr-msg-user .qr-bubble strong {
  color: #fff;
}

.qr-bubble p {
  margin: 0 0 7px;
}

.qr-bubble p:last-child {
  margin-bottom: 0;
}

.qr-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 4px;
  border-radius: 4px;
}

.qr-msg-user .qr-bubble code {
  background: rgba(255, 255, 255, 0.14);
}

.qr-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 0;
  padding-left: 40px;
}

.qr-chip {
  appearance: none;
  border: 1px solid #e3e6ea;
  background: #fff;
  color: #4a4f57;
  border-radius: 99px;
  padding: 7px 11px;
  font-family: var(--qr-font);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.qr-chip:hover {
  border-color: #b9d7ff;
  background: #f4f9ff;
  color: #0a6bd8;
}

.qr-composer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.qr-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #dfe3e8;
  background: #fff;
  border-radius: 15px;
  padding: 8px 8px 8px 14px;
  box-shadow: 0 8px 22px rgba(17, 19, 24, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qr-input-wrap:focus-within {
  border-color: #a8ccff;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.10), 0 8px 22px rgba(17, 19, 24, 0.04);
}

.qr-input {
  flex: 1;
  min-height: 24px;
  max-height: 150px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--qr-font);
  font-size: 13px;
  line-height: 1.5;
  color: #1d2025;
  padding: 5px 0;
}

.qr-input::placeholder {
  color: #9aa0a8;
}

.qr-send {
  appearance: none;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #111318;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.qr-send:hover:not(:disabled) {
  background: #0a84ff;
}

.qr-send:active:not(:disabled) {
  transform: scale(0.96);
}

.qr-send:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.qr-send svg {
  width: 17px;
  height: 17px;
}

.qr-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  color: #9aa0a8;
  padding: 0 3px;
}

.qr-foot button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #7b8088;
  font-family: var(--qr-font);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.qr-foot button:hover {
  color: #0a84ff;
}

/* Progress card */
.qr-progress {
  width: min(700px, 82%);
  margin-left: 40px;
  border: 1px solid #e7eaf0;
  background: linear-gradient(180deg, #fbfcfe, #f7f9fc);
  border-radius: 16px;
  padding: 14px 15px;
  box-shadow: 0 10px 30px rgba(17, 19, 24, 0.05);
}

.qr-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1d2025;
  margin-bottom: 8px;
}

.qr-progress-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.qr-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid #d8dde5;
  border-top-color: #0a84ff;
  border-radius: 50%;
  animation: qr-spin 0.8s linear infinite;
}

@keyframes qr-spin {
  to { transform: rotate(360deg); }
}

.qr-progress-pct {
  font-size: 11px;
  color: #7b8088;
  font-variant-numeric: tabular-nums;
}

.qr-progress-track {
  height: 5px;
  border-radius: 99px;
  background: #e9edf2;
  overflow: hidden;
}

.qr-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a84ff, #30d158);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.qr-steps {
  list-style: none;
  margin: 11px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.qr-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #8a8f98;
}

.qr-step-icon {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid #d3d8df;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 9px;
  font-weight: 700;
  color: transparent;
  background: #fff;
}

.qr-step-running {
  color: #1d2025;
  font-weight: 500;
}

.qr-step-running .qr-step-icon {
  border-color: #0a84ff;
  border-top-color: transparent;
  animation: qr-spin 0.8s linear infinite;
}

.qr-step-done {
  color: #4a4f57;
}

.qr-step-done .qr-step-icon {
  border-color: #30d158;
  background: #30d158;
  color: #fff;
}

.qr-step-error {
  color: #b42318;
}

.qr-step-error .qr-step-icon {
  border-color: #ff453a;
  background: #ff453a;
  color: #fff;
}

.qr-step-detail {
  color: #9aa0a8;
  font-weight: 400;
}

.qr-progress-error {
  border-color: #ffd5d1;
  background: #fff7f6;
}

/* Report result card */
.qr-report {
  width: min(700px, 82%);
  margin-left: 40px;
  border: 1px solid #e2e6eb;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 45px rgba(17, 19, 24, 0.10);
}

.qr-report-cover {
  position: relative;
  overflow: hidden;
  padding: 18px 19px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 0%, rgba(10, 132, 255, 0.56), transparent 36%),
    radial-gradient(circle at 4% 100%, rgba(48, 209, 88, 0.24), transparent 40%),
    #0c0f15;
}

.qr-report-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.qr-report-kicker {
  position: relative;
  z-index: 1;
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9dcbff;
  font-weight: 600;
  margin-bottom: 7px;
}

.qr-report-title {
  position: relative;
  z-index: 1;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 540px;
}

.qr-report-period {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
}

.qr-report-body {
  padding: 13px 16px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.qr-report-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #7b8088;
  min-width: 0;
}

.qr-report-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 99px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #eaf8ef;
  color: #197a3d;
  border: 1px solid #cdeed8;
  flex: 0 0 auto;
}

.qr-report-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.qr-btn {
  appearance: none;
  border: 1px solid #dfe3e8;
  background: #fff;
  color: #1d2025;
  border-radius: 10px;
  height: 34px;
  padding: 0 12px;
  font-family: var(--qr-font);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.qr-btn:hover {
  background: #f7f8fa;
  border-color: #cfd5dd;
}

.qr-btn:active {
  transform: translateY(1px);
}

.qr-btn-primary {
  background: #111318;
  border-color: #111318;
  color: #fff;
}

.qr-btn-primary:hover {
  background: #0a84ff;
  border-color: #0a84ff;
}

.qr-btn svg {
  width: 13px;
  height: 13px;
}

/* History drawer */
.qr-history {
  display: none;
  margin-top: 16px;
  border-top: 1px solid #eceef1;
  padding-top: 14px;
}

.qr-history.qr-open {
  display: block;
}

.qr-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.qr-history-title {
  font-size: 12px;
  font-weight: 600;
  color: #1d2025;
}

.qr-history-count {
  font-size: 10px;
  color: #9aa0a8;
}

.qr-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.qr-history-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid #e7eaf0;
  background: #fbfcfd;
  border-radius: 12px;
  padding: 10px 11px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.qr-history-item:hover {
  border-color: #b9d7ff;
  background: #f5faff;
}

.qr-history-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #111318;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.qr-history-icon svg {
  width: 13px;
  height: 13px;
}

.qr-history-copy {
  min-width: 0;
}

.qr-history-name {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  color: #1d2025;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.qr-history-meta {
  margin-top: 4px;
  font-size: 10px;
  color: #8a8f98;
}

.qr-history-empty {
  font-size: 11.5px;
  color: #9aa0a8;
  padding: 6px 0;
}

/* Legacy report tile grid is moved behind the library toggle. */
.qr-legacy-grid.qr-hidden {
  display: none !important;
}

.qr-shell.qr-dark {
  color-scheme: dark;
}

@media (max-width: 860px) {
  .qr-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 18px;
  }

  .qr-hero-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .qr-body {
    padding: 16px;
  }

  .qr-bubble {
    max-width: calc(100% - 40px);
  }

  .qr-progress,
  .qr-report {
    width: calc(100% - 40px);
  }

  .qr-suggestions {
    padding-left: 0;
  }

  .qr-suggestions .qr-chip {
    white-space: normal;
    text-align: left;
  }

  .qr-report-body {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .qr-hero {
    padding: 16px;
  }

  .qr-brand-sub {
    white-space: normal;
  }

  .qr-hero-btn {
    padding: 0 10px;
    font-size: 10.5px;
  }

  .qr-thread {
    max-height: 440px;
  }

  .qr-progress,
  .qr-report {
    width: 100%;
    margin-left: 0;
  }

  .qr-msg-avatar {
    display: none;
  }

  .qr-bubble {
    max-width: 100%;
  }

  .qr-suggestions {
    gap: 6px;
  }
}
