:root {
  --tanne: #142420;
  --tanne-surface: #1d332c;
  --tanne-line: #2e463d;
  --ink: #20251f;
  --muted: #6e6f63;
  --faint: #73746b;
  --paper: #f5f4ee;
  --card: #ffffff;
  --hair: #e4e4da;
  --moos: #56714a;
  --moos-mid: #7e9a6c;
  --lind: #b9ccaa;
  --lind-soft: #e8eedf;
  --salbei: #8fa096;
  --salbei-dim: #a9b5ac;
  --on-dark: #f5f4ee;
  --on-dark-muted: #a9b5ac;
  --on-lind: #16241c;
  --on-tanne-soft: #dce5d2;
  --terra: #a3552f;
  --danger: #9b3730;
  --shadow: 0 14px 38px rgba(20, 36, 32, 0.1);
  --radius: 10px;
  --radius-lg: 14px;
  --topbar-height: 68px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-root {
  min-height: 100vh;
}

.noscript {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.serif,
.entry-panel h1,
.command-panel h1,
.page-header h1,
.greeting h1,
.empty-state h2,
.modal-panel h2 {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.entry-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(28px, 7vw, 88px);
  background: var(--tanne);
  color: var(--on-dark);
}

.entry-panel {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
  text-align: center;
}

.entry-panel .brand-lockup {
  flex-direction: column;
  gap: 6px;
  margin: 0 auto 8px;
}

.entry-panel h1,
.command-panel h1,
.page-header h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.18;
}

.entry-panel .lead,
.command-panel p,
.page-header p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--on-dark-muted);
  font-size: 15px;
  line-height: 1.6;
}

.page-header p {
  color: var(--muted);
}

.brand-lockup,
.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
}

.brand-word {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--salbei);
}

.entry-panel .brand-word {
  color: var(--lind);
}

.brand-button {
  border: 0;
  background: transparent;
  white-space: nowrap;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-block;
  object-fit: contain;
  flex-shrink: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: rgba(245, 244, 238, 0.96);
  color: var(--ink);
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(12px);
}

.desktop-nav,
.topbar-actions,
.bottom-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sign-out-action {
  min-height: 38px;
}

.nav-item,
.ghost-action {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.nav-item.active {
  color: var(--ink);
  background: var(--lind-soft);
}

.nav-item:hover,
.ghost-action:hover {
  color: var(--ink);
  background: rgba(126, 154, 108, 0.14);
}

.user-chip {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--on-tanne-soft);
  background: var(--tanne);
  font-size: 13px;
  font-weight: 600;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 104px;
}

.greeting {
  margin: 4px 0 22px;
}

.greeting .eyebrow {
  color: var(--faint);
}

.greeting h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.15;
}

.command-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--tanne);
  color: var(--on-dark);
}

.command-panel h1 {
  font-size: 24px;
}

.command-panel p {
  margin: 10px 0 0;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--moos);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.command-panel .eyebrow {
  color: var(--salbei);
}

.surface,
.summary-panel,
.empty-state,
.danger-zone {
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 22px 0 30px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 18px;
}

.metric-card:first-child {
  padding-left: 0;
}

.metric-card + .metric-card {
  border-left: 1px solid var(--hair);
}

.metric-card strong {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.metric-card span,
.session-main small,
.mode-card small,
.saved-feedback span {
  color: var(--faint);
  font-size: 13px;
}

.section-head,
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
}

.page-header {
  display: block;
  max-width: 760px;
}

.page-header h1 {
  font-size: 28px;
}

.page-header h1,
.section-head h2,
.feedback-panel h2,
.profile-summary h2,
.account-panel h2,
.notice-panel h2,
.danger-zone h2 {
  margin: 0;
}

.section-head h2,
.feedback-panel h2,
.profile-summary h2,
.account-panel h2,
.notice-panel h2,
.danger-zone h2 {
  font-size: 17px;
  font-weight: 600;
}

.page-header p {
  margin: 10px 0 0;
  font-size: 15px;
}

.session-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--hair);
}

.session-item {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--hair);
  background: transparent;
}

.session-main {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 8px;
}

.session-main:hover {
  background: rgba(126, 154, 108, 0.1);
}

.session-main > span:last-child {
  min-width: 0;
}

.session-main strong,
.session-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-main strong {
  font-weight: 500;
  font-size: 15px;
}

.session-main small {
  margin-top: 2px;
}

.mode-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lind);
}

.mode-dot.sage,
.mode-card.sage input:checked + .mode-card-body {
  border-color: var(--moos);
}

.mode-dot.sage {
  background: var(--moos);
}

.mode-dot.clay,
.mode-card.clay input:checked + .mode-card-body {
  border-color: var(--salbei);
}

.mode-dot.clay {
  background: var(--salbei);
}

.mode-dot.gold,
.mode-card.gold input:checked + .mode-card-body {
  border-color: var(--moos-mid);
}

.mode-dot.gold {
  background: var(--moos-mid);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius);
  padding: 0 20px;
  font-weight: 600;
  text-decoration: none;
}

.primary-action {
  border: 1px solid var(--tanne);
  background: var(--tanne);
  color: var(--on-tanne-soft);
}

.primary-action:hover {
  background: #1d332c;
}

.entry-screen .primary-action,
.command-panel .primary-action {
  border-color: var(--lind);
  background: var(--lind);
  color: var(--on-lind);
}

.entry-screen .primary-action:hover,
.command-panel .primary-action:hover {
  background: #c8d9bb;
}

.primary-action:disabled,
.secondary-action:disabled,
.danger-action:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.secondary-action {
  border: 1px solid #c8d2c4;
  background: var(--card);
  color: #3e5c4d;
}

.secondary-action:hover {
  background: var(--lind-soft);
}

.danger-action {
  border: 1px solid rgba(155, 55, 48, 0.4);
  background: transparent;
  color: var(--danger);
}

.danger-action:hover {
  background: rgba(155, 55, 48, 0.08);
}

.compact {
  min-height: 38px;
  padding: 0 14px;
}

.button-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 36, 32, 0.14);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

.icon-button:hover {
  color: var(--ink);
  border-color: #c8d2c4;
}

.flow-layout {
  display: grid;
  gap: 18px;
}

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

.mode-card {
  display: block;
}

.mode-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.mode-card-body {
  min-height: 168px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1.5px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--card);
}

.mode-card input:checked + .mode-card-body {
  background: #f4f7ee;
}

.mode-card-body:hover {
  background: #faf9f4;
}

.mode-card strong {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: 20px;
}

.mode-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
  line-height: 1.5;
}

.form-stack,
.form-grid,
.feedback-form {
  display: grid;
  gap: 16px;
}

.form-grid,
.feedback-panel,
.profile-summary,
.account-panel,
.topic-card,
.notice-panel,
.danger-zone {
  padding: 24px;
}

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

.form-grid .form-section,
.form-grid .wide-field,
.form-grid .form-actions {
  grid-column: 1 / -1;
}

.form-section {
  padding-top: 14px;
  border-top: 1px solid var(--hair);
}

.form-section h2 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.form-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 500;
}

label > span:first-child,
legend {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode-card > span:first-child,
.check-row > span {
  text-transform: none;
  letter-spacing: 0;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.input-hint,
.form-error {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
}

.form-error {
  color: var(--danger);
  font-weight: 600;
}

.form-error[hidden] {
  display: none;
}

.auth-error {
  border-left: 3px solid var(--danger);
  padding-left: 12px;
  text-align: left;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  font-weight: 400;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--moos-mid);
  box-shadow: 0 0 0 3px rgba(126, 154, 108, 0.22);
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.entry-panel form {
  text-align: left;
}

.entry-panel input {
  background: var(--tanne-surface);
  color: var(--on-dark);
  border-color: var(--tanne-line);
}

.entry-panel label > span:first-child {
  color: var(--salbei);
}

.entry-panel input:focus {
  border-color: var(--lind);
  box-shadow: 0 0 0 3px rgba(185, 204, 170, 0.18);
}

.check-row {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  color: var(--salbei-dim);
  font-size: 13px;
}

.surface .check-row {
  color: var(--muted);
}

.check-row input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--moos);
}

.entry-panel .check-row input {
  accent-color: var(--lind);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions .form-error {
  flex-basis: 100%;
}

.chat-active .app-shell {
  padding-bottom: 28px;
}

.chat-layout {
  position: relative;
  height: calc(100vh - var(--topbar-height) - 56px);
  min-height: 420px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
}

.chat-header {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}

.chat-header .eyebrow {
  margin-bottom: 3px;
}

.chat-header h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 600;
}

.chat-stream {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  overflow-y: auto;
  background: var(--paper);
}

.chat-day {
  align-self: center;
  margin: 2px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.jump-to-latest {
  position: absolute;
  right: 18px;
  bottom: 92px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--hair);
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(20, 36, 32, 0.16);
}

.jump-to-latest[hidden] {
  display: none;
}

.jump-to-latest .jump-news {
  color: var(--moos);
}

.chat-message {
  width: min(720px, 94%);
}

.chat-message.user {
  align-self: flex-end;
  display: flex;
  justify-content: flex-end;
}

.chat-message.user .message-meta {
  display: none;
}

.message-meta {
  margin: 0 0 6px;
  color: var(--moos);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.message-content {
  border-radius: var(--radius);
  line-height: 1.6;
  font-size: 15px;
}

.message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 3px 0;
  line-height: 1.55;
}

.chat-message.user .message-content {
  max-width: 100%;
  background: #20382f;
  color: #edeae0;
  border-radius: 14px 14px 4px 14px;
  padding: 11px 14px;
}

.chat-message.assistant {
  border-left: 2px solid var(--moos-mid);
  padding-left: 14px;
}

.chat-message.assistant .message-content {
  background: transparent;
  padding: 0;
}

.typing .message-content {
  color: var(--muted);
}

.chat-composer,
.closed-notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--hair);
  background: var(--paper);
}

.chat-error {
  grid-column: 1 / -1;
  border-left: 3px solid var(--danger);
  padding: 8px 0 8px 12px;
}

.chat-composer textarea {
  min-height: 52px;
  max-height: 140px;
  border-radius: 22px;
  padding: 13px 16px;
  resize: none;
}

.closed-notice {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-panel {
  padding: 22px;
}

.summary-panel h2 {
  margin: 0 0 10px;
  color: var(--moos);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summary-panel ul {
  margin: 0;
  padding-left: 18px;
}

.summary-panel li,
.summary-panel p {
  line-height: 1.6;
  font-size: 14px;
}

.summary-panel li {
  margin: 4px 0;
}

.summary-panel li::marker {
  color: var(--moos);
  font-weight: 600;
}

.summary-panel p {
  margin: 0;
}

.feedback-panel {
  margin: 16px 0;
  display: grid;
  gap: 18px;
}

.rating-row {
  display: flex;
  gap: 8px;
}

.rating-row label {
  display: block;
}

.rating-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.rating-row span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
  letter-spacing: 0;
}

.rating-row input:checked + span {
  border-color: var(--moos);
  background: var(--lind-soft);
  color: var(--ink);
  font-weight: 600;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.saved-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.saved-feedback strong {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: 28px;
}

.saved-feedback p {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
}

.profile-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 16px 0;
}

.profile-summary dt {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profile-summary dd {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.account-panel,
.notice-panel,
.danger-zone {
  margin-top: 16px;
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.account-panel p,
.notice-panel p,
.danger-zone p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.danger-zone {
  border-color: rgba(155, 55, 48, 0.3);
}

.danger-zone .danger-action {
  margin-top: 14px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  gap: 12px;
  justify-items: center;
  place-items: center;
  text-align: center;
  padding: 28px;
}

.empty-state h2 {
  margin: 0;
  font-size: 22px;
}

.empty-state p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.bottom-nav {
  display: none;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--moos-mid);
  animation: typing-pulse 1.3s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-pulse {
  0%, 60%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  30% {
    transform: scale(1.3);
    opacity: 1;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 36, 32, 0.55);
  backdrop-filter: blur(4px);
}

.modal-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.modal-panel h2 {
  margin: 0;
  font-size: 21px;
}

.modal-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.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;
}

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

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 300;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 480px);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--tanne);
  color: var(--on-tanne-soft);
  font-size: 14px;
  box-shadow: var(--shadow);
}

.toast button {
  border: 1px solid var(--tanne-line);
  background: var(--tanne-surface);
  color: var(--lind);
  border-radius: var(--radius);
  min-height: 32px;
  padding: 0 12px;
  font-weight: 600;
  white-space: nowrap;
}

details.form-section summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

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

details.form-section summary::after {
  content: "+";
  margin-left: auto;
  font-size: 18px;
  color: var(--muted);
}

details[open].form-section summary::after {
  content: "\2212";
}

details.form-section > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.optional-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.optional-fields {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 860px) {
  .entry-screen {
    align-items: center;
  }

  .entry-panel h1,
  .command-panel h1 {
    font-size: 28px;
  }

  .page-header h1 {
    font-size: 26px;
  }

  .greeting h1 {
    font-size: 26px;
  }

  .topbar {
    padding: 0 16px;
  }

  .desktop-nav {
    display: none;
  }

  .app-shell {
    width: min(100% - 28px, 720px);
    padding-top: 16px;
    padding-bottom: 96px;
  }

  .command-panel,
  .mode-grid,
  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .command-panel {
    align-items: stretch;
    padding: 22px;
  }

  .form-grid .form-section,
  .form-grid .wide-field,
  .form-grid .form-actions {
    grid-column: auto;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--hair);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
  }

  .bottom-nav .nav-item {
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    border-radius: var(--radius);
    color: var(--faint);
  }

  .bottom-nav .nav-item.active {
    color: var(--ink);
    background: var(--lind-soft);
    font-weight: 600;
  }

  .bottom-nav .nav-item:hover {
    color: var(--ink);
  }

  .app-root.chat-active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--paper);
  }

  .chat-active > .topbar,
  .chat-active > .bottom-nav {
    display: none;
  }

  .chat-active > .app-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .chat-active .chat-layout {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 0;
    border-radius: 0;
  }

  .chat-active .chat-header {
    min-height: 62px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    background: var(--paper);
    border-bottom: 1px solid var(--hair);
  }

  .chat-active .chat-header > div {
    min-width: 0;
  }

  .chat-active .chat-header .eyebrow {
    margin-bottom: 2px;
  }

  .chat-active .chat-header h1 {
    font-size: 15px;
    line-height: 1.25;
  }

  .chat-active .chat-stream {
    min-height: 0;
    gap: 16px;
    padding: 16px 14px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    background: var(--paper);
  }

  .chat-active .chat-message {
    width: min(92%, 680px);
  }

  .chat-active .message-meta {
    margin-bottom: 4px;
  }

  .chat-active .message-content {
    font-size: 15px;
    line-height: 1.5;
  }

  .chat-active .chat-message.user .message-content {
    border-radius: 14px 14px 4px 14px;
    background: #20382f;
  }

  .chat-active .chat-composer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    background: var(--paper);
  }

  .chat-active .chat-composer textarea {
    min-height: 44px;
    max-height: 112px;
    border-radius: 22px;
    padding: 11px 15px;
    resize: none;
  }

  .chat-active .chat-composer .primary-action {
    width: auto;
    min-width: 72px;
    min-height: 44px;
    border-radius: 22px;
    padding: 0 18px;
  }

  .chat-active .closed-notice {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .jump-to-latest {
    bottom: max(84px, calc(74px + env(safe-area-inset-bottom)));
  }

  .toast {
    bottom: 86px;
  }
}

@media (max-width: 560px) {
  .entry-screen {
    padding: 28px 20px;
  }

  .profile-summary dl {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-card {
    padding: 2px 12px;
  }

  .metric-card strong {
    font-size: 19px;
  }

  .metric-card span {
    font-size: 12px;
  }

  .entry-panel h1,
  .command-panel h1 {
    font-size: 25px;
  }

  .greeting h1,
  .page-header h1 {
    font-size: 24px;
  }

  .topbar-actions .ghost-action {
    display: none;
  }

  .brand-button span:last-child {
    max-width: 165px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .session-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .empty-state {
    min-height: 190px;
    padding: 22px;
  }

  .session-actions {
    justify-content: flex-end;
  }

  .closed-notice,
  .account-panel {
    grid-template-columns: 1fr;
  }

  .account-panel {
    display: grid;
    align-items: stretch;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions > *,
  .primary-action,
  .secondary-action,
  .danger-action {
    width: 100%;
  }

  .chat-active .chat-header .secondary-action,
  .chat-active .chat-composer .primary-action {
    width: auto;
  }

  .chat-active .chat-header .secondary-action {
    grid-column: auto;
    min-height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }

  .chat-active .chat-message {
    width: 94%;
  }

  .chat-active .chat-message.user {
    width: 86%;
  }
}
