/* OpenAI-inspired light UI (marketing / product shell). */

:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f8;
  --card: #ffffff;
  --border: #e8e8ea;
  --border-strong: #d1d1d6;
  --text: #0d0d0d;
  --muted: #5e5e5e;
  --muted-light: #8e8e93;
  --accent: #0d0d0d;
  --accent-hover: #2d2d2d;
  --focus: #0066cc;
  --danger: #c62828;
  --danger-soft: #fde8e8;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-pill: 9999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 24px rgba(0, 0, 0, 0.06);
  --header-h: 3.5rem;
  --max-content: 72rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > .wrap,
body > main.wrap {
  flex: 1 0 auto;
  width: 100%;
}

/* ——— Header (sticky, minimal) ——— */
.site-banner {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: var(--header-h);
  padding-top: env(safe-area-inset-top, 0);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hdr-left,
.hdr-right {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.hdr-left {
  gap: 0.5rem;
}

.hdr-brand-block {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo-link {
  display: flex;
  align-items: center;
  line-height: 0;
  border-radius: 8px;
  flex-shrink: 0;
}

.site-logo-link:hover {
  opacity: 0.85;
}

.site-logo-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.site-brand-logo {
  height: 1.75rem;
  width: auto;
  max-height: 2rem;
  display: block;
}

.hdr-right {
  justify-content: flex-end;
  gap: 0.5rem;
}

.site-brand {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.15rem;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0;
  max-width: 100%;
}

.site-brand-name {
  white-space: nowrap;
}

.site-brand-tagline {
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: -0.02em;
  color: var(--muted);
}

.site-brand:hover {
  opacity: 0.75;
}

.site-brand:hover .site-brand-tagline {
  color: var(--text);
}

.hdr-nav-pair {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hdr-nav-link,
.logout-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.hdr-nav-link:hover,
.logout-link:hover {
  background: var(--bg-subtle);
}

.hdr-nav-link:focus-visible,
.logout-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.logout-link {
  border-color: var(--border);
}

.hdr-nav-link--legal {
  font-weight: 600;
  border-color: var(--border-strong);
  background: var(--bg);
}

.hdr-nav-link--legal:hover {
  background: var(--bg-subtle);
  border-color: var(--text);
}

.hdr-user-label {
  font-size: 0.8125rem;
  color: var(--muted);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 0.35rem;
}

.hdr-donut-wrap {
  position: relative;
}

.hdr-donut-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1.1rem;
}

.hdr-donut-btn:hover,
.hdr-donut-btn[aria-expanded="true"] {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

.hdr-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 12rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 0.35rem;
  z-index: 200;
}

.hdr-dropdown a {
  display: block;
  padding: 0.55rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.hdr-dropdown a:hover {
  background: var(--bg-subtle);
}

.site-header-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.oa-hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
  max-width: 42rem;
  margin: 0 auto;
}

.oa-hero-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
}

.oa-hero-sub {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.5;
}

.oa-hero-cta {
  margin: 1.35rem 0 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.ipa-how-btn--hero {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
}

/* ——— Layout ——— */
.wrap {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.wrap--narrow {
  max-width: 32rem;
}

/* ——— Cards ——— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin-top: 1rem;
  box-shadow: var(--shadow-card);
}

.card-page-title {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card h2 {
  font-size: 1.125rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card h3 {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
}

.kb-files-card {
  margin-top: 1rem;
}

.kb-files-heading {
  font-size: 1.0625rem;
  margin: 0 0 0.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.kb-files-hint {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.55;
}

.kb-files-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.kb-files-list li {
  margin-bottom: 0.4rem;
}

.kb-files-list code {
  font-size: 0.86em;
  word-break: break-all;
  background: var(--bg-subtle);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.kb-files-list a.kb-file-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.kb-files-list a.kb-file-link:hover {
  opacity: 0.7;
}

.kb-files-list a.kb-file-link code {
  color: inherit;
  border: none;
  background: transparent;
  padding: 0;
}

.kb-files-list .kb-missing {
  color: var(--danger);
}

.kb-files-err {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

header p,
footer {
  color: var(--muted);
  font-size: 0.875rem;
}

code {
  font-size: 0.88em;
  background: var(--bg-subtle);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  max-width: 20rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.08);
}

.ipa-input-stretch {
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

.ipa-form-row {
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.ipa-form-row > div {
  flex: 1 1 auto;
  min-width: min(12rem, 100%);
}

textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 6rem;
}

textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.08);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.chat-answers-lang-row {
  margin-top: 0.35rem;
}

/* ——— Buttons (pill, high contrast) ——— */
button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

button.secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.status {
  margin: 0.65rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.status.err {
  color: var(--danger);
}

.status.ipa-pending {
  color: var(--muted);
  animation: ipa-status-pulse 1.1s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status.ipa-pending {
    animation: none;
  }
  button:active:not(:disabled) {
    transform: none;
  }
}

@keyframes ipa-status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

body.ipa-busy {
  cursor: wait;
}

body.ipa-busy textarea,
body.ipa-busy input[type="file"],
body.ipa-busy label {
  cursor: wait;
}

button.btn-loading {
  position: relative;
  padding-left: 2.25rem;
  cursor: wait;
}

button.btn-loading:disabled {
  opacity: 0.92;
}

button.btn-loading::before {
  content: "";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  width: 0.9rem;
  height: 0.9rem;
  margin-top: -0.45rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ipa-spin 0.65s linear infinite;
}

button.secondary.btn-loading::before {
  border: 2px solid rgba(13, 13, 13, 0.2);
  border-top-color: var(--text);
}

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

/* ——— Chat thread & saved conversations ——— */
.chat-scope-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.chat-scope-row .kb-files-heading {
  margin: 0;
}

.ipa-health-line {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.ipa-health-line--warn {
  color: var(--danger);
  font-weight: 500;
}

.chat-sessions-panel {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  overflow: hidden;
}

.chat-sessions-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.chat-sessions-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.chat-sessions-hint {
  font-size: 0.72rem;
  color: var(--muted-light);
}

.chat-sessions-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: min(38vh, 14rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-session-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.chat-session-item:last-child {
  border-bottom: none;
}

.chat-session-item.is-active {
  background: rgba(0, 102, 204, 0.06);
}

.chat-session-select {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.25rem 0;
  text-align: left;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
}

.chat-session-select:hover {
  text-decoration: underline;
}

.chat-session-time {
  font-size: 0.72rem;
  color: var(--muted-light);
  white-space: nowrap;
}

.chat-session-delete {
  flex-shrink: 0;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.chat-session-delete:hover {
  background: var(--danger-soft);
}

.chat-thread {
  margin-bottom: 1rem;
  max-height: min(48vh, 22rem);
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  -webkit-overflow-scrolling: touch;
}

.chat-bubble-wrap {
  margin-bottom: 0.75rem;
}

.chat-bubble-wrap:last-child {
  margin-bottom: 0;
}

.chat-bubble-wrap--user {
  display: flex;
  justify-content: flex-end;
}

.chat-bubble {
  max-width: min(100%, 34rem);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble--user {
  background: var(--card);
  border: 1px solid var(--border-strong);
}

.chat-bubble--assistant {
  margin-right: auto;
  width: 100%;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
}

.chat-source-cards {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.chat-source-cards-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.chat-source-cards .source {
  margin-bottom: 0.65rem;
}

.chat-source-cards .source:last-child {
  margin-bottom: 0;
}

.chat-gemini-interpret {
  margin-top: 0.65rem;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--bg-subtle);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-subtle));
}

.chat-gemini-interpret__label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
  line-height: 1.35;
}

.chat-gemini-interpret__body {
  font-size: 0.8125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.answer {
  white-space: pre-wrap;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.source {
  border-left: 2px solid var(--text);
  padding-left: 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.source pre {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  background: var(--bg-subtle);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.source a {
  color: var(--text);
  font-weight: 500;
}

.admin-title {
  font-size: 1.0625rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.admin-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-upload label {
  margin: 0;
  color: var(--text);
  display: inline;
  font-weight: 500;
}

input[type="file"] {
  font-size: 0.8125rem;
  max-width: 100%;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--card);
}

.file-table a.admin-file-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.file-table a.admin-file-link:hover {
  opacity: 0.7;
}

.file-table th,
.file-table td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-subtle);
}

.file-table-row--index td {
  background: var(--bg-subtle);
}

.file-table-index-label {
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.file-table-index-path {
  word-break: break-all;
}

button.linkish {
  background: none;
  border: none;
  color: var(--danger);
  padding: 0.35rem 0;
  min-height: 2.75rem;
  font-size: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

button.linkish:hover {
  color: #8b1c1c;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.log-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.admin-log {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 0.85rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  white-space: pre-wrap;
  color: var(--muted);
}

/* ——— Footer strip ——— */
.site-footer-oa {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 1.5rem 1.25rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0));
}

.site-footer-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  font-size: 0.8125rem;
  color: var(--muted-light);
  text-align: center;
}

.site-footer-inner p {
  margin: 0;
}

.site-footer-inner--split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}

/* “How it works” — pill button (header + footer) */
.ipa-how-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.15rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.ipa-how-btn:hover {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(239, 68, 68, 0.08);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12);
}

.ipa-how-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.ipa-how-btn--current {
  cursor: default;
  pointer-events: none;
  opacity: 0.9;
  border-color: var(--border-strong);
  box-shadow: none;
}

/* ——— Public “How it works” page ——— */
.readme-wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
  text-align: left;
}

.readme-page-title {
  margin: 0 0 0.75rem;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
}

.readme-lead {
  margin: 0 0 2rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--muted-light);
  text-align: center;
}

.readme-section {
  margin-bottom: 1.75rem;
}

.readme-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.readme-section p,
.readme-section ol,
.readme-section ul {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}

.readme-section p:last-child {
  margin-bottom: 0;
}

.readme-steps {
  padding-left: 1.2rem;
  margin: 0 0 0.5rem;
}

.readme-steps li {
  margin-bottom: 0.45rem;
  padding-left: 0.25rem;
}

.readme-callout {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(248, 113, 113, 0.65);
  background: var(--bg-subtle);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted-light);
}

.readme-back {
  margin-top: 2.5rem;
  text-align: center;
}

.readme-back-link {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.1rem;
}

.readme-back-link:hover {
  color: rgba(248, 113, 113, 0.95);
  border-color: rgba(248, 113, 113, 0.45);
}

/* ——— Legal notice panel ——— */
.impressum-line {
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.impressum-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.impressum-page-title {
  margin: 0 0 1.25rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-align: center;
  width: 100%;
  max-width: 28rem;
}

.impressum-window {
  width: 100%;
  max-width: 28rem;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.impressum-window-inner {
  border-radius: inherit;
  padding: 2rem 1.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.impressum-brand {
  margin: 0;
  width: 100%;
}

.impressum-brand-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.impressum-brand-img {
  display: block;
  max-width: min(100%, 220px);
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.impressum-brand-frame--empty {
  min-height: 6.5rem;
  min-width: min(100%, 220px);
  padding: 1.25rem 1.5rem;
}

.impressum-wordmark {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.impressum-body {
  width: 100%;
}

.impressum-heading {
  margin: 0 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.impressum-credit {
  margin: 0 0 1.15rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
}

.impressum-name {
  font-weight: 600;
}

.impressum-visit-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.impressum-site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  transition: background 0.15s ease, opacity 0.15s ease;
  word-break: break-all;
}

.impressum-site-link:hover {
  background: var(--accent-hover);
}

.impressum-site-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.impressum-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.35rem 0 1rem;
}

.impressum-heading--sub {
  margin-top: 0;
}

.impressum-gemini {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
  text-align: left;
}

.impressum-gemini a {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.impressum-gemini a:hover {
  opacity: 0.75;
}

.impressum-powered {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-light);
}

/* ——— Mobile & small screens ——— */
@media (max-width: 640px) {
  .site-header-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.4rem max(0.75rem, env(safe-area-inset-left, 0)) 0.55rem max(0.75rem, env(safe-area-inset-right, 0));
    flex-wrap: nowrap;
  }

  .site-banner {
    min-height: 0;
  }

  .site-header-spacer {
    display: none;
  }

  .hdr-left {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
  }

  .hdr-right {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-height: 2.65rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
    justify-content: flex-start;
    padding-bottom: 0.1rem;
  }

  .hdr-nav-pair {
    display: inline-flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    align-items: center;
    gap: 0.3rem;
    justify-content: flex-start;
  }

  .hdr-nav-link--legal {
    flex-shrink: 0;
  }

  .hdr-user-label {
    flex: 0 1 auto;
    max-width: min(11rem, 46vw);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 0.25rem;
    font-size: 0.75rem;
  }

  .hdr-nav-link,
  .logout-link {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.7rem;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hdr-right .ipa-how-btn {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: 2.5rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
  }

  .wrap {
    padding-left: max(0.75rem, env(safe-area-inset-left, 0));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom, 0));
  }

  .oa-hero {
    padding: 1.35rem 0 1rem;
  }

  .oa-hero-cta {
    margin-top: 1.1rem;
  }

  .ipa-how-btn--hero {
    width: 100%;
    max-width: 18rem;
    justify-content: center;
  }

  .oa-hero-sub {
    font-size: 1rem;
  }

  .card {
    padding: 1.1rem 1rem;
    margin-top: 0.85rem;
  }

  .card .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .card .row > button {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
  }

  .card .row .inline {
    width: 100%;
    margin: 0;
    padding: 0.25rem 0;
    align-items: flex-start;
    line-height: 1.45;
  }

  .ipa-form-row {
    align-items: stretch;
  }

  .ipa-form-row > div {
    min-width: 0;
    width: 100%;
  }

  .ipa-form-row > button {
    width: 100%;
    min-height: 2.75rem;
  }

  input[type="text"],
  input[type="password"],
  input[type="email"],
  textarea {
    max-width: 100%;
    font-size: 16px;
  }

  .admin-upload {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-upload button {
    width: 100%;
    min-height: 2.75rem;
  }

  .admin-actions button {
    width: 100%;
    min-height: 2.75rem;
  }

  .file-table th,
  .file-table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.8125rem;
  }

  .file-table th:nth-child(2),
  .file-table td:nth-child(2) {
    white-space: nowrap;
    width: 1%;
  }

  .admin-log {
    max-height: min(40vh, 220px);
    font-size: 0.72rem;
  }

  .chat-thread {
    max-height: min(40vh, 16rem);
  }

  .chat-sessions-list {
    max-height: min(28vh, 9rem);
  }

  .chat-scope-row #btn-chat-new {
    width: 100%;
  }

  .site-footer-inner {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }

  .impressum-window-inner {
    padding: 1.5rem 1.15rem;
  }

  .impressum-brand-img {
    max-width: min(100%, 180px);
  }
}

@media (max-width: 380px) {
  .site-brand {
    font-size: 0.9375rem;
  }

  .site-brand-tagline {
    font-size: 0.75rem;
  }

  .hdr-nav-link,
  .logout-link {
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
  }
}
