/* Single-pane layout for Portal; future 3-pane expansion should follow docs/ux-layout.md */
:root {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hint {
  color: #475569;
  font-size: 0.9rem;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: #0f172a;
  color: #f8fafc;
}

.portal-brand {
  min-width: 0;
}

.portal-brand-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
}

.portal-brand h1 {
  margin: 0.2rem 0 0;
}

.portal-logo {
  display: block;
  height: 44px;
  width: 44px;
  object-fit: contain;
}

.tagline {
  margin: 0.25rem 0 0;
  color: rgba(248, 250, 252, 0.8);
}

.lang-switcher {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lang-select {
  border: 1px solid rgba(248, 250, 252, 0.45);
  background: rgba(248, 250, 252, 0.12);
  color: #f8fafc;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font: inherit;
}

.portal-nav {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
  background: #e2e8f0;
}

.portal-nav button {
  border: none;
  background: #fff;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.portal-nav button.active {
  background: #2563eb;
  color: #fff;
}

.portal-content {
  flex: 1;
  min-height: 0;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.public-mode {
  background:
    radial-gradient(circle at top, rgba(226, 232, 240, 0.75), transparent 30%),
    linear-gradient(180deg, #f7f4ec 0%, #f8fafc 45%, #eef2f7 100%);
}

.public-mode .portal-header {
  background: transparent;
  color: #0f172a;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.public-mode .tagline {
  color: #475569;
}

.public-mode .lang-select {
  border-color: rgba(15, 23, 42, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
}

.public-mode .portal-nav {
  background: transparent;
  justify-content: center;
  padding-top: 0;
}

.public-mode .portal-nav button {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.public-mode .portal-nav button.active {
  background: #0f172a;
  color: #f8fafc;
}

.public-mode .portal-content {
  padding-top: 1rem;
}

.public-page,
.public-hero,
.public-section {
  width: min(720px, 100%);
  margin-inline: auto;
}

.public-page {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  padding: 1.5rem;
}

.public-page-header {
  margin-bottom: 1.25rem;
}

.public-page-header h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.public-page-subtitle {
  margin: 0.5rem 0 0;
  color: #475569;
  font-size: 1.05rem;
}

.public-page-paragraph,
.public-page-section p,
.public-page-group-label,
.public-page-footer {
  line-height: 1.7;
}

.public-page-section + .public-page-section {
  margin-top: 1.5rem;
}

.public-page-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.public-page-list {
  margin: 0.5rem 0 0;
  padding-left: 1.3rem;
  display: grid;
  gap: 0.45rem;
}

.public-page-group + .public-page-group {
  margin-top: 1rem;
}

.public-page-group-label {
  margin: 0.35rem 0;
  font-weight: 600;
}

.public-page-footer {
  margin-top: 1.5rem;
  color: #475569;
}

[dir='rtl'] .portal-header,
[dir='rtl'] .portal-nav,
[dir='rtl'] .portal-content,
[dir='rtl'] .public-page {
  text-align: right;
}

[dir='rtl'] .public-page-list,
[dir='rtl'] .public-list,
[dir='rtl'] .match-status-list {
  padding-left: 0;
  padding-right: 1.3rem;
}

.feedback-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #10b981;
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  box-shadow: 0 12px 25px rgba(16, 185, 129, 0.3);
  cursor: pointer;
}

.quest-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 4.8rem;
  background: #f97316;
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  box-shadow: 0 12px 25px rgba(249, 115, 22, 0.3);
  cursor: pointer;
}

.feedback-chip {
  background: rgba(248, 250, 252, 0.2);
  color: #f8fafc;
  border: 1px solid rgba(248, 250, 252, 0.6);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

#feedback-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(420px, 90vw);
}

#feedback-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(320px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
}

#quest-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(400px, 90vw);
}

#quest-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quest-task {
  min-height: 4rem;
}

.quest-word {
  font-size: 0.9rem;
  color: #475569;
  margin-top: -0.5rem;
}

.quest-context {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.quest-history {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.85rem;
  max-height: 140px;
  overflow-y: auto;
}

.quest-history p {
  margin: 0.25rem 0;
}

.quest-answer-label,
.quest-rating-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.quest-answer {
  min-height: 80px;
  resize: vertical;
}


.ticket-history {
  margin-top: 1rem;
  border: 1px solid rgba(248, 250, 252, 0.25);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(30, 41, 59, 0.95);
}

.history-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ticket-list details {
  border: 1px solid rgba(248, 250, 252, 0.35);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: rgba(248, 250, 252, 0.08);
  color: #f8fafc;
}

.ticket-meta {
  font-size: 0.85rem;
  color: #dbeafe;
}

.ticket-message {
  white-space: pre-wrap;
  background: #f8fafc;
  color: #0f172a;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.2);
}

#feedback-form textarea {
  min-height: 120px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.status {
  min-height: 1.5rem;
  color: #2563eb;
}

.linkish {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.drafts {
  margin-top: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.draft {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.5rem 0;
}

.draft:last-child {
  border-bottom: none;
}

.draft-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.draft-actions button {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  border-radius: 4px;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.weights-section {
  margin-top: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.weights-section.compact {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.control-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.control-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.control-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-card input,
.control-card select,
.control-card textarea {
  width: 100%;
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: #fff;
}

.match-status-card {
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.match-status-card code {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.match-status-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
}

.match-metrics-table {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
}

.match-metric-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.match-metric-row:last-child {
  border-bottom: none;
}

.match-metric-row small {
  color: #64748b;
}

.weights-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.weight-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.weight-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.weight-slider {
  width: 100%;
}

.public-hero {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.public-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.95fr);
  gap: 1.5rem;
  align-items: start;
}

.public-hero-copy {
  min-width: 0;
}

.public-qr-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.92);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.public-qr-card h3,
.public-qr-card p {
  margin: 0;
}

.public-qr-card p {
  color: #475569;
  line-height: 1.55;
}

.public-qr-image {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  object-fit: contain;
  align-self: center;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.public-qr-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.public-qr-link:hover {
  text-decoration: underline;
}

.public-badge {
  display: inline-block;
  border: 1px solid #f59e0b;
  color: #92400e;
  background: #fffbeb;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.public-cta {
  display: inline-block;
  margin-top: 0.5rem;
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  text-decoration: none;
}

.public-cta-disabled {
  background: #e2e8f0;
  color: #64748b;
  cursor: default;
}

.public-section {
  margin-top: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}

.public-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.channel-intro,
.channel-summary,
.channel-card-detail {
  color: #475569;
}

.channel-intro {
  margin: 0.35rem 0 0.85rem;
  line-height: 1.6;
}

.entry-explainer {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.95), rgba(248, 250, 252, 0.95));
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}

.entry-explainer-locked {
  border-color: rgba(245, 158, 11, 0.65);
  background: #fffbeb;
}

.entry-explainer-eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.entry-explainer-locked .entry-explainer-eyebrow {
  color: #92400e;
}

.entry-lockdown-body {
  margin: 0.5rem 0 0;
  line-height: 1.65;
  color: #334155;
}

.entry-flow-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  line-height: 1.55;
}

.channel-summary {
  margin: 0.35rem 0;
  font-size: 0.92rem;
}

.channel-summary-muted {
  color: #64748b;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.channel-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.channel-card-head h4,
.channel-card-head p {
  margin: 0;
}

.channel-card-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.channel-card-detail {
  font-size: 0.9rem;
  line-height: 1.45;
}

.channel-logo {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
}

.channel-logo-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.channel-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
}

.channel-disclaimer {
  margin: 0.85rem 0 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
  max-width: 52rem;
}

.chip-live,
.chip-soon,
.chip-early,
.chip-experimental {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  margin: 0.4rem 0;
  width: fit-content;
}

.chip-live {
  background: #dcfce7;
  color: #166534;
}

.chip-soon {
  background: #e2e8f0;
  color: #334155;
}

.chip-early {
  background: #fef3c7;
  color: #92400e;
}

.chip-experimental {
  background: #ede9fe;
  color: #6d28d9;
}

.channel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.65rem 1rem;
  background: #0f172a;
  color: #f8fafc;
  text-decoration: none;
  font-weight: 600;
}

.channel-action:hover {
  background: #1e293b;
}

.channel-action-locked {
  background: #d97706;
  color: #fff;
  border: none;
  cursor: pointer;
}

.channel-action-locked:hover {
  background: #b45309;
}

.channel-action-disabled {
  background: #e2e8f0;
  color: #64748b;
  cursor: default;
}

.entry-lockdown-pulse {
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
  transition: box-shadow 0.2s ease;
}

.nav-divider {
  font-size: 0.85rem;
  color: #334155;
  align-self: center;
}

@media (max-width: 1024px) {
  .portal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .public-hero-layout {
    grid-template-columns: 1fr;
  }

  .portal-content {
    padding: 1.5rem;
  }

  .feedback-fab {
    bottom: 1rem;
    right: 1rem;
  }
}

@media (max-width: 600px) {
  .portal-header {
    padding: 1rem;
  }

  .portal-header h1 {
    font-size: 1.5rem;
  }

  .portal-nav {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .portal-nav button {
    flex: 1 1 45%;
    min-width: 120px;
  }

  .portal-content {
    padding: 1rem;
  }

  .public-page {
    padding: 1.1rem;
    border-radius: 18px;
  }

  #feedback-form {
    padding: 1rem;
  }
}
