/* ChatDiario — warm, minimal, mobile-friendly */

:root {
  --bg: #faf8f5;
  --surface: #fffefb;
  --text: #2c2420;
  --text-muted: #5c534d;
  --accent: #b85c38;
  --accent-soft: #d4a574;
  --border: #e8e2db;
  --user-msg-bg: #e8dfd4;
  --assistant-msg-bg: #f5f0e8;
  --category-badge: #8b6914;
  --shadow: rgba(44, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
}

.site-header {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
}

.site-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.site-header-brand {
  flex: 1 1 auto;
  min-width: 0;
}

.site-header-brand .tagline {
  margin-bottom: 0.5rem;
}

/* Account menu (user icon — same asset pattern as kofiyatechapps-flask) */
.header-account-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 0.1rem;
}

.header-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.header-profile-btn:hover {
  box-shadow: 0 4px 16px rgba(44, 36, 32, 0.14);
  transform: translateY(-1px);
}

.header-profile-btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.header-profile-btn[aria-expanded="true"] {
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.header-profile-icon img {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.header-profile-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 15rem;
  max-width: min(18rem, calc(100vw - 2rem));
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(44, 36, 32, 0.18);
  z-index: 200;
}

.header-profile-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.header-profile-popover-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-profile-close {
  border: none;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 0.2rem;
  border-radius: 4px;
}

.header-profile-close:hover {
  color: var(--text);
  background: var(--user-msg-bg);
}

.header-profile-popover-body {
  padding: 0.65rem 0.85rem 0.85rem;
}

.header-profile-text {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  color: var(--text);
}

.header-profile-email {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.header-profile-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.25rem 0;
}

.header-profile-link:hover {
  text-decoration: underline;
}

.header-profile-link-primary {
  display: block;
  margin-top: 0.15rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
}

.logo:hover {
  color: var(--text);
}

.tagline {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.main-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.main-nav a:hover {
  text-decoration: underline;
}

.site-header-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  flex-shrink: 0;
}

.nav-toggle-btn {
  display: none;
}

.nav-backdrop {
  display: none;
}

.main-nav-panel {
  margin-top: 0.65rem;
}

body.nav-drawer-open {
  overflow: hidden;
}

body.chat-sidebar-open {
  overflow: hidden;
}

@media (max-width: 47.9375rem) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .site-header-top {
    flex-wrap: nowrap;
    align-items: flex-start;
    position: relative;
    z-index: 165;
  }

  .site-header-brand .tagline {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(14rem, 52vw);
  }

  .logo {
    font-size: 1.25rem;
  }

  .nav-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: var(--user-msg-bg);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-toggle-btn:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
  }

  .site-header.nav-open .nav-toggle-btn {
    background: var(--accent-soft);
  }

  .nav-toggle-bars {
    display: block;
    width: 1.1rem;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 140;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(44, 36, 32, 0.38);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-backdrop[hidden] {
    display: none !important;
  }

  .main-nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18.5rem, 88vw);
    z-index: 155;
    margin: 0;
    padding: 4.75rem 0.75rem 1.25rem 1rem;
    background: var(--surface);
    box-shadow: 4px 0 24px rgba(44, 36, 32, 0.2);
    border-right: 1px solid var(--border);
    border-radius: 0 12px 12px 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-header.nav-open .main-nav-panel {
    transform: translateX(0);
  }

  .main-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    align-items: stretch;
  }

  .main-nav a {
    display: block;
    padding: 0.8rem 0.65rem;
    font-size: 1rem;
    border-radius: 8px;
    margin-bottom: 2px;
    -webkit-tap-highlight-color: transparent;
  }

  .main-nav a:active {
    background: var(--user-msg-bg);
  }

  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero {
    padding: 1.25rem 0 1.75rem;
  }

  .hero h1,
  .hero .tagline-hero {
    display: none;
  }

  .hero .description {
    margin-top: 0;
    font-size: 0.98rem;
  }

  .site-footer {
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
  }

  .stato-list {
    grid-template-columns: 1fr;
  }

  .evaluation-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 0.35rem;
    -webkit-tap-highlight-color: transparent;
  }

  .chat-sidebar-toggle:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 2px;
  }

  .chat-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 130;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(44, 36, 32, 0.35);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .chat-sidebar-backdrop[hidden] {
    display: none !important;
  }

  .chat-section.layout-with-sidebar {
    flex-direction: column;
    min-height: auto;
    gap: 0.75rem;
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18.5rem, 88vw);
    max-height: none;
    z-index: 135;
    margin: 0;
    border-radius: 0 12px 12px 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-top: 4.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .chat-section.sidebar-open .chat-sidebar {
    transform: translateX(0);
  }

  .chat-page-header-top {
    flex-wrap: nowrap;
    align-items: center;
  }

  .chat-page-title-block {
    min-width: 0;
    flex: 1 1 auto;
  }

  .chat-title-tagline {
    font-size: 0.78rem;
    line-height: 1.35;
  }
}

@media (min-width: 48rem) {
  .chat-sidebar-toggle {
    display: none !important;
  }

  .chat-sidebar-backdrop {
    display: none !important;
  }
}

.content {
  max-width: 70rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.hero {
  text-align: center;
  padding: 2rem 0;
}

.hero h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.tagline-hero {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.description {
  margin: 0 0 1.5rem;
  color: var(--text);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--surface);
}

.btn-primary:hover {
  background: #9a4d2e;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.login-shell {
  width: 100%;
  max-width: 22rem;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 4px 20px var(--shadow);
}

.login-title {
  margin: 0;
  font-size: 1.65rem;
  color: var(--accent);
  text-align: center;
}

.login-subtitle {
  margin: 0.35rem 0 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-login {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  text-align: center;
}

.btn-google:hover {
  background: var(--bg);
  color: var(--accent);
}

.pin-account {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  text-align: center;
}

.pin-attempts {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  text-align: center;
}

.pin-input {
  letter-spacing: 0.15em;
  font-size: 1.1rem;
  text-align: center;
}

.pin-back {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  text-align: center;
}

.pin-back a {
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-actions-cell {
  vertical-align: top;
}

.admin-actions-cell .inline-form,
.admin-reset-pin-form {
  display: block;
  margin-bottom: 0.5rem;
}

.admin-reset-pin-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.form-input-inline {
  width: 6.5rem;
  min-width: 0;
}

.login-footnote {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}

/* Flashes */
.flash-list {
  margin-bottom: 1rem;
}

.flash {
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.flash-success {
  background: #e8f2e4;
  color: #2d4a22;
  border: 1px solid #c5d9bc;
}

.flash-error {
  background: #fce8e6;
  color: #5c2a26;
  border: 1px solid #e8c4bf;
}

/* Admin users */
.admin-lead {
  color: var(--text-muted);
  max-width: 40rem;
}

.admin-section {
  margin: 2rem 0;
}

.admin-section h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.admin-form {
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.admin-checkbox-row label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-nav-links {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.admin-path-code {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  background: var(--assistant-msg-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.admin-ingest-log {
  margin: 0;
  padding: 0.75rem 1rem;
  max-height: 28rem;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  background: var(--assistant-msg-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-ingest-note {
  margin-top: 0.75rem;
  color: var(--accent);
  font-weight: 500;
}

/* Admin ingest — studio layout */
.ingest-page {
  max-width: 72rem;
}

.ingest-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.ingest-hero h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.ingest-tagline {
  margin: 0;
  color: var(--text-muted);
  max-width: 32rem;
  font-size: 0.95rem;
}

.ingest-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.ingest-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--text-muted);
}

.ingest-status-idle .ingest-status-dot {
  background: #9a9088;
}

.ingest-status-running {
  border-color: var(--accent-soft);
  background: #fff8f0;
  color: var(--accent);
}

.ingest-status-running .ingest-status-dot {
  background: var(--accent);
  animation: ingest-pulse 1.2s ease-in-out infinite;
}

.ingest-status-done {
  border-color: #b8d4bc;
  background: #eef6ef;
  color: #2d5a36;
}

.ingest-status-done .ingest-status-dot {
  background: #2d8a54;
}

.ingest-status-error {
  border-color: #e8c4bf;
  background: #fdf3f2;
  color: #8b3a32;
}

.ingest-status-error .ingest-status-dot {
  background: #c45c4a;
}

@keyframes ingest-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.ingest-paths-details {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.65rem 1rem;
}

.ingest-paths-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  list-style: none;
}

.ingest-paths-details summary::-webkit-details-marker {
  display: none;
}

.ingest-paths-details summary::before {
  content: "▸ ";
  color: var(--accent);
}

.ingest-paths-details[open] summary::before {
  content: "▾ ";
}

.ingest-paths-body {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.ingest-paths-link {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.ingest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.25rem;
  align-items: start;
}

.ingest-controls {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 1.15rem 1.25rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.ingest-model-bar {
  margin-bottom: 1rem;
}

.ingest-model-bar .form-input {
  width: 100%;
}

.ingest-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ingest-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text-muted);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ingest-tab:hover {
  border-color: var(--accent-soft);
}

.ingest-tab-active {
  border-color: var(--accent);
  background: #fff8f3;
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(184, 92, 56, 0.12);
}

.ingest-tab-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.ingest-tab-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.ingest-panel-lead {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.ingest-action-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ingest-run-btn {
  width: 100%;
}

.ingest-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ingest-dropzone:hover,
.ingest-dropzone-drag {
  border-color: var(--accent-soft);
  background: #fffaf6;
}

.ingest-dropzone-has-file {
  border-style: solid;
  border-color: var(--accent);
  background: #fff8f3;
}

.ingest-dropzone-missing {
  border-color: #c45c4a;
  background: #fdf2f0;
}

.ingest-dropzone-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.ingest-dropzone-file {
  font-size: 0.82rem;
  color: var(--text-muted);
  word-break: break-all;
}

.ingest-dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.ingest-form-error {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: #8b3a32;
}

.ingest-form-error[hidden] {
  display: none;
}

.ingest-running-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
}

.ingest-running-note[hidden] {
  display: none;
}

.ingest-running-pulse {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  animation: ingest-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}

.ingest-console {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #2a2420;
  box-shadow: 0 4px 20px rgba(44, 36, 32, 0.12);
  position: sticky;
  top: 1rem;
}

.ingest-console-chrome {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: #3d3530;
  border-bottom: 1px solid #4a403a;
}

.ingest-console-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.ingest-console-dot-red { background: #c45c4a; }
.ingest-console-dot-amber { background: #d4a574; }
.ingest-console-dot-green { background: #6a9e72; }

.ingest-console-title {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c9bfb5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ingest-console-log {
  margin: 0;
  max-height: min(32rem, 55vh);
  border: none;
  border-radius: 0;
  background: #2a2420;
  color: #e8dfd4;
  padding: 1rem 1.1rem;
}

.ingest-summary {
  margin: 0;
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #d4e8d6;
  background: #324532;
  border-top: 1px solid #3d4f3d;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .ingest-layout {
    grid-template-columns: 1fr;
  }

  .ingest-console {
    position: static;
  }
}

.usage-online-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #2d8a54;
  box-shadow: 0 0 0 2px rgba(45, 138, 84, 0.25);
  vertical-align: middle;
}

.usage-online-heading {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-usage-table code.admin-path-code {
  font-size: 0.8rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Chat */
.chat-section h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

/* Chat page redesign: compact transcript, prominent composer */
.chat-main-redesign {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: min(78vh, 38rem);
  gap: 0.65rem;
}

.chat-page-header {
  flex-shrink: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, transparent 100%);
}

.chat-page-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.chat-page-title-block {
  flex: 1 1 12rem;
}

.chat-title-display {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.chat-title-tagline {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 32rem;
  line-height: 1.45;
}

.chat-category-toolbar,
.chat-collections-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  flex-shrink: 0;
}

.chat-category-label,
.chat-collections-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.chat-collections-picker {
  position: relative;
}

.chat-collections-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
  min-width: 10rem;
  box-shadow: 0 1px 2px var(--shadow);
}

.chat-collections-summary::-webkit-details-marker {
  display: none;
}

.chat-collections-summary:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.chat-collections-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
  min-width: 16rem;
  max-width: 22rem;
  max-height: 16rem;
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px var(--shadow);
}

.chat-collections-hint,
.chat-collections-empty {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chat-collection-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.15rem;
  font-size: 0.92rem;
  cursor: pointer;
}

.chat-collection-count {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.collection-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #5a4a8a;
  color: #fff;
  margin-right: 0.25rem;
}

.ingest-text-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  margin-bottom: 0.35rem;
}

.ingest-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.ingest-collection-hint {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.ingest-collections {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.ingest-collections-title {
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.ingest-collections-lead {
  margin: 0 0 0.85rem;
}

.ingest-collections-empty {
  margin: 0;
}

.ingest-collections-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ingest-collection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.ingest-collection-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.ingest-collection-name {
  font-weight: 600;
  word-break: break-word;
}

.ingest-collection-detail {
  font-size: 0.85rem;
  color: var(--muted, #666);
  word-break: break-word;
}

.ingest-collection-delete-form {
  flex-shrink: 0;
}

.btn-delete-collection {
  border: 1px solid var(--border);
  background: var(--surface);
  color: #8b3a32;
}

.btn-delete-collection:hover {
  border-color: #c45c4a;
  background: #fdf2f0;
}

.chat-category-select {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
  min-width: 10rem;
  cursor: pointer;
  box-shadow: 0 1px 2px var(--shadow);
}

.chat-category-select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.chat-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.85rem;
}

.chat-composer-shelf {
  flex: 0 0 auto;
  border-radius: 18px;
  padding: 0.15rem;
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.35) 0%, rgba(184, 92, 56, 0.18) 50%, rgba(232, 223, 212, 0.6) 100%);
  box-shadow: 0 6px 28px var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-composer-shelf:focus-within {
  box-shadow: 0 10px 36px rgba(184, 92, 56, 0.15);
}

.chat-composer-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  padding: 1rem 1.1rem 0.85rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(232, 226, 219, 0.9);
}

.chat-composer-form textarea {
  width: 100%;
  min-height: 7.5rem;
  max-height: 40vh;
  padding: 0.85rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.55;
  resize: vertical;
  background: linear-gradient(180deg, #fffdf9 0%, #faf6f0 100%);
  color: var(--text);
  box-shadow: inset 0 1px 3px rgba(44, 36, 32, 0.06);
}

.chat-composer-form textarea::placeholder {
  color: #8a8078;
}

.chat-composer-form textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: inset 0 1px 3px rgba(44, 36, 32, 0.06), 0 0 0 3px rgba(184, 92, 56, 0.12);
}

.chat-composer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-composer-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex: 1 1 8rem;
}

.btn-send-chat {
  border-radius: 999px;
  padding: 0.55rem 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(184, 92, 56, 0.25);
}

.btn-send-chat:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(184, 92, 56, 0.3);
}

.chat-actions {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.link-clear {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  background: #c0392b;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-filename {
  margin-left: auto;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #f0f8ff;
  color: #1f4e79;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.chat-filename:hover {
  background: #e0f0ff;
}

.link-clear:hover {
  background: #a93226;
  color: #fff;
  text-decoration: none;
}

.filter-form {
  margin-bottom: 1rem;
}

.filter-form label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.filter-form select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 1rem;
  min-width: 12rem;
}

.chat-window {
  flex: 0 1 auto;
  max-height: min(44vh, 22rem);
  min-height: 2.5rem;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin: 0;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.chat-window:empty {
  min-height: 3rem;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 1.65rem,
    rgba(232, 226, 219, 0.55) 1.65rem,
    rgba(232, 226, 219, 0.55) calc(1.65rem + 1px)
  );
}

.chat-window:empty::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(184, 92, 56, 0.06), transparent 70%);
}

.message {
  margin-bottom: 1rem;
}

.message:last-child {
  margin-bottom: 0;
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.message-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
}

.btn-icon:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-copy {
  padding: 0.35rem;
}

.btn-copy .icon-copy {
  display: block;
}

.btn-copy.copied,
.btn-copy.copied:hover {
  color: #2d6a2d;
  border-color: #2d6a2d;
}

.btn-translate {
  font-family: inherit;
}

.translation-block {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--user-msg-bg);
  border-radius: 8px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.translation-block .translation-text {
  display: block;
  margin-top: 0.35rem;
}

.user-message .message-body {
  text-align: right;
  background: var(--user-msg-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-left: 2rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.response-time {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.assistant-message .message-body {
  background: var(--assistant-msg-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-right: 2rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Typing indicator (ChatGPT-style) */
.typing-indicator {
  min-height: 2.5rem;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  margin-right: 2rem;
  background: var(--assistant-msg-bg);
  border-radius: 8px;
  width: fit-content;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.6; }
  40% { transform: scale(1); opacity: 1; }
}

.sources {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.sources summary {
  cursor: pointer;
  color: var(--accent);
}

.source-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  list-style: none;
}

.source-list li {
  margin-bottom: 0.35rem;
}

.source-index {
  font-weight: 600;
  margin-right: 0.25rem;
}

.citation-ref {
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
}

.source-highlight {
  background: rgba(255, 223, 186, 0.5);
  transition: background 0.3s ease;
}

.doc-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.doc-modal[hidden] {
  display: none;
}

.doc-modal-dialog {
  background: var(--surface);
  max-width: 40rem;
  max-height: 70vh;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
}

.doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.doc-modal-header h4 {
  margin: 0;
  font-size: 1.05rem;
}

.doc-modal-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.doc-search-input {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.doc-search-btn {
  border: none;
  background: var(--surface);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
}

.doc-search-btn:hover {
  background: var(--assistant-msg-bg);
}

.doc-modal-body {
  font-size: 0.9rem;
  white-space: pre-wrap;
  margin-bottom: 0.35rem;
}

.doc-search-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.category-badge {
  display: inline-block;
  background: var(--category-badge);
  color: var(--surface);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

/* Legacy chat form row (unused on chat page; kept if referenced elsewhere) */
.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.chat-form textarea {
  flex: 1;
  min-width: 12rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
}

.chat-form .btn {
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Settings */
.settings-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.settings-section .intro {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.settings-form {
  max-width: 42rem;
  margin: 0 0 1rem;
}

.settings-form .form-group {
  margin-bottom: 1.25rem;
}

.settings-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.settings-form select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 1rem;
  min-width: 14rem;
}

.settings-form input[type="range"] {
  width: 12rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.settings-form .temperature-value {
  font-weight: 500;
  color: var(--accent);
}

.settings-form .form-hint,
.settings-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

.settings-note {
  margin-top: 1rem;
}

.settings-form .btn {
  margin-top: 0.5rem;
}

.settings-form h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text-muted);
}

.settings-form h3:first-of-type {
  margin-top: 0;
}

.settings-form .locations-note {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--assistant-msg-bg, #f5f5f5);
  border-radius: 6px;
  border-left: 3px solid var(--accent, #c45c26);
}

.settings-form .database-docker-note {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #e3f2fd;
  border-radius: 6px;
  border-left: 3px solid #1976d2;
}

.settings-form .input-with-browse {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.settings-form .input-with-browse input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.settings-form .btn-browse {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.settings-form .btn-browse:hover {
  border-color: var(--accent-soft);
  color: var(--accent);
}

.flash-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash-messages .flash {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.35rem;
}

.flash-messages .flash.success {
  background: #e8f5e9;
  color: #2e7d32;
}

.flash-messages .flash.warning {
  background: #fff3e0;
  color: #e65100;
}

.flash-messages .flash.error {
  background: #ffebee;
  color: #c62828;
}

/* Chat sidebar */
.chat-section.layout-with-sidebar {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 9.5rem);
}
.chat-sidebar {
  flex-shrink: 0;
  width: 12rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 2px 12px var(--shadow);
}

.chat-main { flex: 1; min-width: 0; }

.btn-new-chat {
  width: 100%;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: var(--surface);
  border: none;
  border-radius: 999px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(184, 92, 56, 0.25);
}

.btn-new-chat:hover {
  background: #9a4d2e;
}
.chat-list { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.chat-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.15rem; cursor: pointer; }
.chat-list li.active { background: var(--user-msg-bg); margin: 0 -0.25rem; padding-left: 0.25rem; padding-right: 0.25rem; border-radius: 4px; border-left: 3px solid var(--accent); }
.chat-list li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; font-weight: 500; }
.chat-list li.active a { color: var(--accent); }
.chat-list .chat-meta { font-size: 0.75rem; color: var(--text-muted); }
.chat-list li a:hover { text-decoration: underline; }
.chat-list .chat-item-actions { display: flex; gap: 0.2rem; margin-left: auto; }
.chat-list .chat-item-actions button { padding: 0.2rem; border: none; background: none; cursor: pointer; font-size: 0.9rem; }
.chat-list .chat-item-actions button:hover { color: var(--accent); }
.chat-list .chat-badge { font-size: 0.7rem; color: var(--text-muted); display: block; margin-top: 0.15rem; }
.chat-model-info { font-size: 0.85rem; color: var(--text-muted); margin: 0 0 0.5rem; }

/* Test Question panel */
.btn-test-question { margin-left: 0.5rem; padding: 0.4rem 0.75rem; font-size: 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.btn-test-question:hover { border-color: var(--accent-soft); color: var(--accent); }
.test-question-panel { margin: 1rem 0; padding: 1rem; background: var(--assistant-msg-bg); border-radius: 8px; border: 1px solid var(--border); }
.test-question-panel h3 { margin: 0 0 0.75rem; font-size: 1.1rem; }
.test-question-panel strong { display: block; margin-top: 0.75rem; }
.test-chunk-box { max-height: 12rem; overflow-y: auto; padding: 0.5rem; background: var(--surface); border-radius: 6px; margin: 0.35rem 0; font-size: 0.9rem; white-space: pre-wrap; }
.btn-eval { margin-right: 0.5rem; margin-top: 0.5rem; padding: 0.35rem 0.6rem; font-size: 0.9rem; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); }
.btn-eval-good:hover { background: #e8f5e9; border-color: #2e7d32; }
.btn-eval-partial:hover { background: #fff3e0; border-color: #e65100; }
.btn-eval-poor:hover { background: #ffebee; border-color: #c62828; }

/* Evaluation history */
.evaluation-section h2 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.evaluation-section .intro { color: var(--text-muted); margin: 0 0 1rem; }
.evaluation-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem; }
.evaluation-table th, .evaluation-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
.evaluation-table th { font-weight: 600; color: var(--text-muted); }
.evaluation-table .btn-delete-eval { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.evaluation-table-actions { text-align: right; margin-bottom: 0.35rem; }
.btn-link { border: none; background: none; padding: 0; margin-left: 0.35rem; font-size: 0.8rem; color: var(--accent); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.gt-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.gt-modal[hidden] { display: none; }
.gt-modal-dialog { background: var(--surface); max-width: 40rem; max-height: 70vh; padding: 1rem 1.25rem; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); overflow-y: auto; }
.gt-modal-dialog h4 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.gt-modal-body { font-size: 0.9rem; white-space: pre-wrap; margin-bottom: 0.75rem; }

/* Categorie */
.categorie-section h2,
.stato-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.intro {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.categorie-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.categorie-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.category-name {
  font-weight: 500;
}

.doc-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Stato */
.stato-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.5rem;
  margin: 0 0 1.5rem;
}

.stato-list dt {
  margin: 0;
  font-weight: 500;
}

.stato-list dd {
  margin: 0;
  color: var(--text-muted);
}

.stato-list dd.ok {
  color: #2d6a2d;
}

.stato-list dd.error {
  color: #a52a2a;
}

.stato-section h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.stato-categorie {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.stato-categorie li {
  margin-bottom: 0.25rem;
}

.site-footer {
  text-align: center;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.site-footer .footer-version {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.site-footer .footer-kofiya {
  margin: 0.75rem 0 0;
}

.site-footer .kofiya-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer .kofiya-link:hover {
  color: var(--accent);
}

.site-footer .kofiya-logo {
  vertical-align: middle;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .user-message .message-body { margin-left: 0; }
  .assistant-message .message-body { margin-right: 0; }
  .chat-form { flex-direction: column; align-items: stretch; }
  .chat-form textarea { min-width: 0; }
  .chat-main-redesign { min-height: 0; }
  .chat-page-header-top { flex-direction: column; align-items: stretch; }
  .chat-category-toolbar { justify-content: space-between; }
  .chat-window { max-height: min(36vh, 14rem); }
  .chat-composer-form textarea { min-height: 5.5rem; font-size: 1rem; }
}
