/* Evotic Edge — minimal mobile-first stylesheet. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f8f8f8;
  color: #1a1a1a;
  font-size: 16px;
  line-height: 1.45;
}
main { max-width: 540px; margin: 0 auto; }
h1 { margin: 8px 0 4px; font-size: 22px; }
h2 { font-size: 18px; margin: 12px 0 4px; }
.tagline { color: #888; margin: 0 0 18px; font-size: 14px; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
small { color: #888; font-size: 13px; }
code { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: 13px; background: #eee; padding: 1px 4px; border-radius: 3px; }
a { color: #1a1a1a; }

input, button {
  display: block; width: 100%; padding: 10px 12px;
  font: inherit; font-size: 16px;
  border-radius: 8px; border: 1px solid #ccc;
  margin-top: 6px; background: white;
}
button {
  background: #1a1a1a; color: white; border-color: #1a1a1a;
  cursor: pointer; font-weight: 600;
  transition: background 0.1s, opacity 0.1s;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:hover:not(:disabled) { background: #333; }
label { display: block; margin: 12px 0; font-size: 14px; color: #555; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
label.inline input { width: auto; display: inline-block; margin: 0; }

.tab-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.tab { background: #eee; color: #555; border-color: #ddd; font-weight: 500; flex: 1; }
.tab.active { background: #1a1a1a; color: white; border-color: #1a1a1a; }

#result { margin-top: 14px; min-height: 24px; font-size: 14px; }
.err { color: #c00; }

nav.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
nav.actions > * { flex: 1; min-width: 140px; margin: 0; }
nav.actions a {
  display: block; padding: 10px; text-align: center;
  background: #1a1a1a; color: white; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}

/* Chat-test page */
.chat-shell .row {
  display: flex; gap: 8px; margin: 12px 0; align-items: center; flex-wrap: wrap;
}
.chat-shell .row > input,
.chat-shell .row > button { margin: 0; width: auto; flex: 0 1 auto; }
.chat-shell .row > input { flex: 1 1 200px; }

.state-tag {
  display: inline-block; padding: 2px 8px;
  background: #eee; border-radius: 4px; font-size: 12px;
}
.state-tag.state-open { background: #cfc; color: #050; }
.state-tag.state-connecting { background: #ffd; color: #550; }
.state-tag.state-closed { background: #fcc; color: #500; }

#log {
  list-style: none; padding: 0; margin: 16px 0;
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 13px;
  max-height: 60vh; overflow-y: auto;
  background: white; border: 1px solid #e0e0e0; border-radius: 8px;
}
#log:empty { display: none; }
#log li { padding: 6px 10px; border-bottom: 1px solid #eee; }
#log li:last-child { border-bottom: none; }
#log li.ok { color: #060; }
#log li.recv { color: #006; }
#log li.send { color: #803; }
#log li.err { color: #c00; }

/* -------- Chats list (chats.html) -------- */
.chats-shell header { display: flex; align-items: center; gap: 12px; }
.back { font-size: 24px; text-decoration: none; padding: 4px 8px; }
.start-row { display: flex; gap: 8px; margin: 16px 0; }
.start-row > input { flex: 1; margin: 0; }
.start-row > button { width: auto; margin: 0; }
.conv-list { list-style: none; padding: 0; margin: 16px 0; }
.conv-item { background: white; border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.conv-item a { display: block; padding: 12px; text-decoration: none; color: inherit; }
.conv-item a:hover { background: #f0f0f0; }
.conv-row1 { display: flex; justify-content: space-between; align-items: baseline; }
.conv-pseudo { font-weight: 600; }
.conv-time { color: #888; font-size: 13px; }
.conv-row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.conv-preview { color: #555; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.conv-badge { background: #c00; color: white; border-radius: 10px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.empty-state { color: #888; text-align: center; padding: 24px; }

/* -------- Chat conv (chat.html) -------- */
.chat-conv-shell { max-width: 600px; padding-bottom: 80px; }
.chat-conv-shell header { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; background: #f8f8f8; padding: 8px 0; z-index: 10; }
.chat-conv-shell header h1 { flex: 1; font-size: 18px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messages { list-style: none; padding: 0; margin: 0; min-height: 60vh; max-height: 70vh; overflow-y: auto; }
.msg { margin: 6px 0; max-width: 75%; padding: 8px 12px; border-radius: 12px; word-wrap: break-word; }
.msg.mine { background: #1a1a1a; color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.msg.other { background: white; border: 1px solid #e0e0e0; margin-right: auto; border-bottom-left-radius: 4px; }
.msg-body { margin: 0; white-space: pre-wrap; }
.msg-img { max-width: 100%; border-radius: 8px; display: block; margin-top: 4px; }
.msg-time { display: block; margin-top: 4px; font-size: 11px; opacity: 0.7; }
.typing-indicator { color: #888; font-size: 13px; height: 18px; margin: 4px 0 0; padding-left: 8px; }
.composer { position: fixed; bottom: 0; left: 0; right: 0; background: #f8f8f8; padding: 8px; display: flex; gap: 8px; border-top: 1px solid #ddd; }
.composer > input { flex: 1; margin: 0; }
.composer > button { width: auto; padding: 10px 16px; margin: 0; font-size: 18px; }
@media (min-width: 640px) {
  .composer { left: 50%; transform: translateX(-50%); max-width: 600px; }
}
