:root {
  --bg: #ffffff; --text: #0f0f0f; --hint: #8a8a8e; --secondary-bg: #f1f1f4;
  --button: #2ea6ff; --button-text: #ffffff; --accent: #2ea6ff; --danger: #e0564b;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--secondary-bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.4; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.hint { color: var(--hint); }
.grow { flex: 1; min-width: 0; }
.screen-center { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }

.appbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg);
  border-bottom: 0.5px solid var(--secondary-bg); flex: none; }
.appbar .title { font-weight: 600; font-size: 17px; }
.appbar .sub { color: var(--hint); font-size: 13px; }
.newbtn { border: none; background: var(--button); color: var(--button-text); font: inherit; font-weight: 600;
  font-size: 14px; padding: 8px 14px; border-radius: 20px; cursor: pointer; white-space: nowrap; }
.newbtn:active { opacity: .8; }

.list { flex: 1; overflow-y: auto; padding: 8px; }
.session { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; margin-bottom: 8px;
  background: var(--bg); border-radius: var(--radius); cursor: pointer; }
.session:active { opacity: .7; }
.session .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session .preview { color: var(--hint); font-size: 13px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session .meta { color: var(--hint); font-size: 12px; white-space: nowrap; display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px; }
.session .del { color: var(--hint); font-size: 15px; padding: 2px 6px; border-radius: 8px; }
.session .del:active { color: var(--danger); background: var(--secondary-bg); }
.empty { color: var(--hint); text-align: center; padding: 26px; font-size: 14px; }

.thread { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 9px 12px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.user { align-self: flex-end; background: var(--button); color: var(--button-text); border-bottom-right-radius: 5px; }
.bubble.agent { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 5px; }
.bubble.error { align-self: flex-start; background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.steps { align-self: flex-start; max-width: 92%; background: var(--bg); border-radius: 14px;
  border-bottom-left-radius: 5px; padding: 9px 11px; font-size: 12px; }
.steps .head { color: var(--accent); font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.steps .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.steps .step { color: var(--hint); padding: 2px 0; word-break: break-word; }

.composer { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg);
  border-top: 0.5px solid var(--secondary-bg); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.composer textarea { flex: 1; resize: none; border: none; outline: none; background: var(--secondary-bg);
  border-radius: 18px; padding: 9px 14px; font: inherit; color: var(--text); max-height: 140px; }
.composer .send { font-size: 22px; color: var(--accent); cursor: pointer; background: none; border: none; padding: 0 2px; }
