:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f2ec;
  color: #1f1a17;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, #fbf8f3 0%, #f0e9df 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 0.8rem; padding: 0.78rem 1rem; background: #1f6b55; color: white; font-weight: 700; }
button:hover { filter: brightness(0.95); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button.secondary { background: #ebe3d8; color: #322821; }
button.danger { background: #a53b32; }
input, select, textarea { width: 100%; margin-top: 0.38rem; border: 1px solid #d8cec0; border-radius: 0.7rem; padding: 0.72rem 0.78rem; background: white; color: inherit; }
textarea { min-height: 6rem; resize: vertical; }
label { font-weight: 650; font-size: 0.94rem; }
code { font-size: 0.9em; }

.shell { width: min(1020px, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.hero { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; margin-bottom: 1.2rem; }
.hero h1 { margin: 0.15rem 0 0.55rem; font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1; }
.hero p { max-width: 48rem; margin: 0; line-height: 1.55; }
.eyebrow { letter-spacing: 0.14em; font-size: 0.75rem; font-weight: 800; color: #9d5b25; }
.status-stack { display: grid; gap: 0.55rem; min-width: 12rem; }
.badge { display: inline-flex; justify-content: center; border-radius: 999px; padding: 0.48rem 0.72rem; background: #d7efe6; color: #15543f; font-size: 0.8rem; font-weight: 800; }
.badge.muted { background: #ece6de; color: #5d5148; }
.badge.error { background: #f7d9d4; color: #812d23; }
.warning { border-left: 5px solid #c77933; background: #fff7e9; padding: 1rem 1.1rem; border-radius: 0.75rem; margin-bottom: 1rem; line-height: 1.45; }
.panel { background: rgba(255,255,255,0.9); border: 1px solid #e5dcd1; border-radius: 1rem; padding: 1.2rem; margin: 1rem 0; box-shadow: 0 10px 35px rgba(67, 47, 33, 0.05); }
.panel h2 { margin: 0 0 0.9rem; font-size: 1.15rem; }
.stack { display: grid; gap: 0.9rem; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.grid-form .wide { grid-column: 1 / -1; }
.identity-bar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.identity-bar p { margin: 0; overflow-wrap: anywhere; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.compact-actions { margin-top: 0.85rem; }
.hint { margin: 0.75rem 0 0; color: #695c52; font-size: 0.86rem; line-height: 1.45; overflow-wrap: anywhere; }
.cards { display: grid; gap: 0.75rem; }
.cards.empty { color: #75685f; }
.profile-card { border: 1px solid #dfd4c8; border-radius: 0.8rem; padding: 0.9rem; display: grid; grid-template-columns: 1fr auto; gap: 0.8rem; align-items: center; }
.profile-card h3 { margin: 0 0 0.25rem; }
.profile-card p { margin: 0.15rem 0; color: #5e5148; }
.matched-portrait { display: block; width: min(280px, 100%); aspect-ratio: 1; object-fit: cover; border-radius: 1rem; margin: 1rem auto 0; border: 1px solid #dfd4c8; }
.message-list { display: grid; gap: 0.65rem; max-height: 24rem; overflow: auto; padding: 0.2rem; }
.message-list.empty { color: #75685f; }
.message-item { border: 1px solid #ded4c9; border-radius: 0.8rem; background: #faf7f2; padding: 0.75rem 0.85rem; }
.message-item small { color: #786a60; overflow-wrap: anywhere; }
.message-item p { margin: 0.35rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: 0.7rem; align-items: end; margin-top: 0.9rem; }
.separated-form { border-top: 1px solid #e5dcd1; margin-top: 1rem; padding-top: 1rem; }
.danger-zone { border-color: #e0b8b2; }
pre { margin: 0; padding: 1rem; border-radius: 0.8rem; background: #211d1a; color: #f6f1ea; overflow: auto; min-height: 7rem; white-space: pre-wrap; word-break: break-word; }
.log-panel ol { margin: 0; padding-left: 1.35rem; }
.log-panel li { margin: 0.4rem 0; line-height: 1.4; }
.log-panel li.error { color: #9a3024; font-weight: 700; }

@media (max-width: 760px) {
  .hero, .identity-bar { display: grid; }
  .status-stack { min-width: 0; }
  .grid-form, .action-grid, .message-form { grid-template-columns: 1fr; }
  .grid-form .wide { grid-column: auto; }
  .profile-card { grid-template-columns: 1fr; }
}
