:root {
  --bg: #08130f;
  --panel: #0f1e19;
  --panel-2: #142720;
  --line: #254139;
  --text: #edf7f1;
  --muted: #9cb6ab;
  --accent: #54d68a;
  --accent-2: #9fd8ff;
  --warn: #f4c95d;
  --danger: #ff8c7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

a {
  color: var(--accent-2);
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10000;
  width: auto;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--accent);
  color: #04100b;
  padding: 10px 12px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #0b1914;
  padding: 20px;
  position: relative;
  z-index: 30;
  min-width: 0;
}

.brand,
.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand { margin-bottom: 24px; }

.brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 8px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.drawer-close,
.drawer-overlay {
  display: none;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

select,
textarea,
input,
button {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #07120e;
  color: var(--text);
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.35;
}

textarea { resize: vertical; }

textarea { max-width: 100%; }

input::placeholder,
textarea::placeholder {
  color: #789389;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: #04100b;
  border: 0;
  font-weight: 800;
}

button.secondary,
.secondary {
  background: #18352b;
  color: var(--text);
  border: 1px solid var(--line);
}

select:focus-visible,
textarea:focus-visible,
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(159, 216, 255, 0.95);
  outline-offset: 2px;
}

button.compact {
  width: auto;
  min-width: 108px;
}

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

.admin-only-field,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.trust-box {
  margin-top: 22px;
  border: 1px solid var(--line);
  background: rgba(84, 214, 138, 0.07);
  padding: 14px;
  border-radius: 8px;
}

.account-box {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.account-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.account-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.account-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.account-signout {
  width: auto;
  min-width: 76px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.account-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.usage-status {
  display: none;
  margin-bottom: 8px;
  border: 1px solid rgba(84, 214, 138, 0.22);
  border-radius: 8px;
  background: rgba(84, 214, 138, 0.07);
  padding: 8px 9px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.usage-status.is-visible {
  display: block;
}

.signin-card {
  display: grid;
  gap: 9px;
}

.signin-card .field,
.signin-code-row .field {
  margin-bottom: 0;
}

.signin-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
  align-items: end;
}

.advanced-access {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 9px;
}

.advanced-access summary {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.advanced-access summary::-webkit-details-marker {
  display: none;
}

.advanced-access summary::before {
  content: "+";
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: rgba(159, 216, 255, 0.12);
  color: var(--accent-2);
  font-size: 12px;
  line-height: 1;
}

.advanced-access[open] summary::before {
  content: "-";
}

.advanced-access .field {
  margin: 10px 0 8px;
}

.billing-box {
  margin-top: 12px;
  border: 1px solid rgba(159, 216, 255, 0.16);
  border-radius: 8px;
  background: rgba(159, 216, 255, 0.045);
  overflow: hidden;
}

.store-billing-notice {
  margin-top: 12px;
  border: 1px solid rgba(159, 216, 255, 0.18);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: rgba(159, 216, 255, 0.07);
  font-size: 13px;
  line-height: 1.45;
}

.billing-title {
  font-weight: 800;
  margin-bottom: 8px;
}

.billing-summary {
  display: grid;
  gap: 2px;
  cursor: pointer;
  padding: 11px 12px;
  color: var(--text);
  font-weight: 850;
  list-style: none;
}

.billing-summary::-webkit-details-marker {
  display: none;
}

.billing-summary::after {
  content: "Open";
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  border: 1px solid rgba(159, 216, 255, 0.18);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent-2);
  font-size: 11px;
  line-height: 1;
}

.billing-box[open] .billing-summary::after {
  content: "Close";
}

.billing-summary span,
.billing-summary small {
  display: block;
  padding-right: 54px;
}

.billing-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
}

.billing-content {
  border-top: 1px solid rgba(159, 216, 255, 0.14);
  padding: 12px;
}

.billing-account-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.billing-account-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07120e;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.billing-account-toggle input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.billing-plan-field,
.billing-email-field,
.billing-name-field,
.billing-pack-field {
  margin-bottom: 10px;
}

.billing-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.usage-pack-actions {
  margin-top: 8px;
}

.auto-usage-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.auto-usage-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 10px;
}

.auto-usage-toggle input {
  width: auto;
  flex: 0 0 auto;
  margin-top: 2px;
}

.billing-status {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.seat-invite-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.invite-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 10px;
}

.invite-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invite-row button {
  width: auto;
  min-width: 78px;
}

.trust-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.trust-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-link {
  display: block;
  margin-top: 16px;
  color: var(--accent-2);
  text-decoration: none;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #0b1914;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 18px 0;
  border-bottom: 1px solid var(--line);
  background: #0b1914;
}

.tab-btn {
  width: auto;
  min-width: 112px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: 0;
  white-space: nowrap;
}

.tab-btn.is-active {
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
}

.tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.tab-panel.is-active {
  display: flex;
  flex-direction: column;
}

.chat-intro,
.panel-heading {
  padding: 22px 24px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 { font-size: 24px; }

.chat-intro p,
.panel-heading p {
  margin: 8px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(244, 201, 93, 0.35);
  background: rgba(244, 201, 93, 0.1);
  color: var(--warn);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.chat {
  flex: 1;
  min-height: 260px;
  overflow-y: auto;
  padding: 10px 24px 18px;
  scroll-padding-bottom: 180px;
}

.msg {
  max-width: 920px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border-radius: 8px;
  line-height: 1.5;
}

.msg.user {
  margin-left: auto;
  background: #17382d;
}

.msg.assistant {
  background: var(--panel);
  border: 1px solid var(--line);
}

.msg-role {
  color: var(--accent-2);
  font-size: 12px;
  margin-bottom: 6px;
  font-weight: 800;
}

.msg-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta,
.inline-status {
  color: var(--muted);
  font-size: 13px;
}

.meta {
  min-height: 38px;
  padding: 8px 24px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.mode-suggestion,
.answer-feedback {
  margin: 0 24px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hidden { display: none !important; }

.legal-footer {
  position: fixed;
  right: 16px;
  bottom: 12px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  color: var(--muted);
  font-size: 12px;
}

.legal-footer a {
  color: var(--muted);
  text-decoration: none;
}

.legal-footer a:focus,
.legal-footer a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.mode-suggestion-text {
  font-weight: 800;
}

.mode-suggestion-reason,
.answer-feedback span {
  color: var(--muted);
  font-size: 13px;
}

.mode-suggestion-actions,
.feedback-actions,
.composer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-suggestion-actions button,
.feedback-actions button {
  width: auto;
  min-width: 90px;
}

.sources-panel {
  border-top: 1px solid var(--line);
  padding: 14px 24px;
  background: #0b1914;
}

.sources-toggle {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  align-items: center;
}

.sources-toggle-icon {
  color: var(--muted);
}

.sources-panel.is-collapsed .sources-toggle-icon {
  transform: rotate(-90deg);
}

.sources-content {
  margin-top: 12px;
}

.sources-panel.is-collapsed .sources-content {
  display: none;
}

.sources-panel.is-hidden {
  display: none;
}

.sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sources-title {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.source-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.source-name {
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

.source-name.link {
  color: var(--accent-2);
  text-decoration: none;
}

.source-name.link:hover {
  text-decoration: underline;
}

.source-preview {
  color: #c8d8d0;
  font-size: 13px;
  margin-top: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.drop-zone {
  padding: 9px 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.drop-zone.is-active {
  color: var(--accent);
}

.composer {
  padding: 14px 24px 22px;
  border-top: 1px solid var(--line);
  background: #08130f;
}

.composer textarea {
  min-height: 96px;
  max-height: 34vh;
}

.composer-actions {
  margin-top: 10px;
  align-items: center;
}

.composer-actions #sendBtn {
  width: auto;
  min-width: 128px;
}

.submit-card,
.feedback-form {
  width: min(720px, calc(100% - 48px));
  margin: 10px 24px 24px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.submit-card button,
.feedback-form button {
  margin-top: 4px;
}

.inline-status {
  margin-top: 12px;
}

.install-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  width: auto;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: none;
}

.legal-page {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
  line-height: 1.6;
}

.legal-page h2 {
  margin: 28px 0 8px;
  font-size: 20px;
}

.legal-page ul {
  padding-left: 22px;
}

.legal-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.legal-form button {
  width: fit-content;
  min-width: 180px;
}

@media (min-width: 901px) {
  .sidebar {
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
  }

  .main {
    max-height: 100vh;
    overflow: hidden;
  }

  .tab-panel.is-active {
    min-height: 0;
  }
}

.login-shell,
.admin-shell {
  min-height: 100vh;
  background: var(--bg);
}

.login-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 18px;
}

.login-error {
  color: var(--danger);
  background: rgba(255, 140, 122, 0.08);
  border: 1px solid rgba(255, 140, 122, 0.3);
  border-radius: 8px;
  padding: 10px;
}

.login-note {
  color: var(--muted);
  line-height: 1.45;
}

.admin-shell {
  padding: 22px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header .brand {
  margin-bottom: 0;
}

.admin-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-header-actions form {
  margin: 0;
}

.admin-button {
  display: inline-flex;
  width: auto;
  min-width: 112px;
  justify-content: center;
  align-items: center;
  padding: 11px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 24px;
}

.kpi-card,
.review-card,
.empty-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.kpi-label,
.kpi-hint,
.review-meta {
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  font-size: 30px;
  font-weight: 900;
  margin: 6px 0 4px;
}

.admin-section {
  margin-top: 20px;
}

.admin-panel-heading {
  padding: 0;
  display: block;
}

.admin-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.admin-form {
  display: grid;
  grid-template-columns: 150px 220px minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.admin-form button {
  min-width: 96px;
}

.email-test-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.email-test-form button {
  width: auto;
  min-width: 112px;
}

.review-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.status {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #20352f;
  color: var(--muted);
}

.status-pending { color: var(--warn); }
.status-approved { color: var(--accent); }
.status-rejected { color: var(--danger); }

.review-preview {
  color: #d3e3dc;
  white-space: pre-wrap;
  line-height: 1.45;
}

.upload-safety {
  margin-top: 6px;
}

.upload-warning {
  margin-top: 6px;
  border: 1px solid rgba(244, 201, 93, 0.28);
  border-radius: 6px;
  background: rgba(244, 201, 93, 0.08);
  color: var(--warn);
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1.35;
}

.upload-warning-error {
  border-color: rgba(255, 140, 122, 0.3);
  background: rgba(255, 140, 122, 0.08);
  color: var(--danger);
}

.review-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.review-actions button {
  width: auto;
  min-width: 92px;
}

.seat-actions {
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 120px 120px auto;
  margin-top: 12px;
}

.seat-email-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.seat-email-toggle input {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.seat-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.seat-row {
  color: #d3e3dc;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

.billing-id-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.billing-id-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #d3e3dc;
  font-size: 13px;
}

.billing-id-label {
  color: var(--muted);
}

.billing-id-row code {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(159, 216, 255, 0.18);
  border-radius: 6px;
  background: rgba(159, 216, 255, 0.07);
  color: var(--accent-2);
  padding: 6px 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: nowrap;
}

.seat-meter {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.seat-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

@media (max-width: 900px) {
  body.settings-open { overflow: hidden; }

  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 340px);
    height: 100dvh;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  body.settings-open .sidebar {
    transform: translateX(0);
  }

  .drawer-close {
    display: block;
    margin-bottom: 14px;
  }

  .drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 20;
  }

  body.settings-open .drawer-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-header {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    gap: 10px;
  }

  .mobile-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-gear {
    width: auto;
    flex: 0 0 auto;
    min-width: 80px;
  }

  .main {
    min-height: 0;
    flex: 1;
    width: 100%;
    max-width: 100vw;
  }

  .tabs {
    overflow-x: auto;
    padding: 10px 10px 0;
    scrollbar-width: thin;
    width: 100%;
  }

  .tab-btn {
    min-width: 104px;
  }

  .chat-intro,
  .panel-heading {
    padding: 16px 14px 8px;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .chat-intro > div,
  .panel-heading > div,
  .chat-intro p,
  .panel-heading p {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  h1,
  h2 {
    font-size: 22px;
  }

  .status-pill {
    display: inline-block;
    margin-top: 12px;
  }

  .chat {
    padding: 8px 12px 12px;
    min-height: 180px;
  }

  .msg {
    max-width: 100%;
  }

  .meta {
    padding: 7px 12px;
  }

  .mode-suggestion,
  .answer-feedback {
    margin: 0 12px 10px;
    display: block;
  }

  .mode-suggestion-actions,
  .feedback-actions {
    margin-top: 10px;
  }

  .mode-suggestion-actions button,
  .feedback-actions button {
    flex: 1 1 120px;
  }

  .sources-panel {
    padding: 10px 12px;
    max-height: 210px;
    overflow-y: auto;
  }

  .sources-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .drop-zone {
    display: none;
  }

  .composer {
    position: sticky;
    bottom: 0;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    width: 100%;
  }

  .composer textarea {
    min-height: 86px;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composer-actions button.compact {
    min-width: 0;
    width: 100%;
  }

  .composer-actions #sendBtn {
    min-width: 0;
    width: 100%;
  }

  .submit-card,
  .feedback-form {
    width: calc(100% - 24px);
    margin: 10px 12px 18px;
  }

  .admin-shell {
    padding: 14px;
  }

  .admin-header {
    display: block;
  }

  .admin-header-actions {
    margin-top: 12px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .admin-form,
  .email-test-form,
  .seat-actions {
    grid-template-columns: 1fr;
  }

  .review-card-top,
  .review-actions,
  .invite-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .install-btn {
    top: auto;
    right: 10px;
    bottom: 10px;
    max-width: 140px;
    padding: 10px 12px;
  }

  .legal-footer {
    position: static;
    justify-content: center;
    padding: 12px 16px 18px;
    background: #08130f;
  }
}

@media (max-width: 520px) {
  .sidebar {
    width: min(94vw, 340px);
    padding: 16px;
  }

  .mobile-brand span,
  .brand-name {
    font-size: 14px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  h1,
  h2 {
    font-size: 20px;
  }

  .chat-intro p,
  .panel-heading p {
    font-size: 14px;
  }

  .account-actions {
    grid-template-columns: 1fr;
  }

  .billing-account-toggle,
  .billing-actions {
    grid-template-columns: 1fr;
  }

  .composer-actions {
    grid-template-columns: 1fr 1fr;
  }

  .composer-actions #refreshModelsBtn {
    grid-column: 1 / -1;
  }

  .billing-id-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
