:root {
  color-scheme: dark;
  color: #f5f5f5;
  background: #0e1117;
}
* { box-sizing: border-box; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(40, 45, 58, 0.8), transparent 35%),
    linear-gradient(180deg, #121827 0%, #0b1020 100%);
}
header { margin-bottom: 24px; }
header h1 { margin: 0 0 8px; font-size: 2rem; }
header p { margin: 0; color: #9ca3af; }
.card { background: rgba(18, 24, 38, 0.96); border: 1px solid rgba(148, 163, 184, 0.12); border-radius: 16px; padding: 20px; margin-bottom: 20px; box-shadow: 0 18px 60px rgba(0,0,0,0.18); }
.card h2 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.metric { padding: 16px; border-radius: 14px; background: rgba(30, 41, 59, 0.8); }
.metric span { display: block; font-size: 2rem; font-weight: 700; }
.metric small { color: #94a3b8; }
button { border: none; border-radius: 14px; padding: 10px 16px; background: #2563eb; color: white; cursor: pointer; transition: transform .12s ease, background-color .12s ease; }
button:hover { transform: translateY(-1px); background: #1d4ed8; }
button:active { transform: translateY(0); }
.template-block { margin-bottom: 16px; }
.template-text { margin: 10px 0; padding: 14px; border-radius: 12px; background: rgba(30, 41, 59, 0.9); color: #e2e8f0; white-space: pre-wrap; }
.list { display: grid; gap: 10px; }
.list-item { padding: 14px; border-radius: 14px; background: rgba(31, 41, 55, 0.9); border: 1px solid rgba(148, 163, 184, 0.12); cursor: pointer; transition: transform .12s ease; }
.list-item:hover { transform: translateY(-2px); }
.list-item h4 { margin: 0 0 8px; }
.list-item p { margin: 4px 0; color: #94a3b8; }
footer { color: #94a3af; font-size: 0.9rem; margin-top: 24px; }
@media (max-width: 680px) { body { padding: 12px; } }

/* Tabs */
.tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
.tab-button { background: none; border: none; padding: 12px 24px; color: #94a3b8; cursor: pointer; border-bottom: 2px solid transparent; }
.tab-button.active { color: #2563eb; border-bottom-color: #2563eb; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Tier badges */
.tier { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.8rem; margin-right: 6px; }
.tier-intro { background: #475569; color: #fff; }
.tier-probing { background: #7c3aed; color: #fff; }
.tier-casual { background: #2563eb; color: #fff; }
.tier-professional { background: #059669; color: #fff; }
.tier-identity_confirm { background: #d97706; color: #fff; }
.tier-handoff { background: #dc2626; color: #fff; }

/* Modal */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); }
.modal-content { background: rgba(18, 24, 38, 0.96); margin: 5% auto; padding: 20px; border: 1px solid rgba(148, 163, 184, 0.12); border-radius: 16px; width: 90%; max-width: 800px; max-height: 80vh; overflow-y: auto; }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: white; }
.conv-meta { padding: 12px; border-radius: 10px; background: rgba(30, 41, 59, 0.7); margin: 14px 0; }
.conv-messages { display: grid; gap: 8px; }
.msg { padding: 10px 14px; border-radius: 10px; line-height: 1.5; white-space: pre-wrap; }
.msg-user { background: rgba(30, 41, 59, 0.9); border-left: 3px solid #2563eb; }
.msg-assistant { background: rgba(15, 36, 26, 0.6); border-left: 3px solid #059669; }
.msg-role { font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
.empty { text-align: center; color: #94a3b8; padding: 40px; }
.error { text-align: center; color: #ef4444; padding: 40px; }

/* Bind tab */
.bind-form { display: grid; gap: 14px; max-width: 720px; }
.bind-help { color: #94a3b8; margin: 0 0 4px; line-height: 1.5; }
.bind-form label { display: grid; gap: 6px; color: #cbd5e1; font-size: 0.95rem; }
.bind-form select, .bind-form input { padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.25); background: rgba(15, 23, 42, 0.9); color: #f5f5f5; font-size: 0.95rem; }
.bind-form select:focus, .bind-form input:focus { outline: none; border-color: #2563eb; }
.bind-detail { padding: 10px 14px; border-radius: 10px; background: rgba(30, 41, 59, 0.6); color: #94a3b8; font-size: 0.9rem; min-height: 22px; }
.bind-result { padding: 10px 14px; border-radius: 10px; min-height: 22px; font-size: 0.95rem; }
.bind-result.ok { background: rgba(5, 150, 105, 0.18); color: #6ee7b7; border: 1px solid rgba(5, 150, 105, 0.4); }
.bind-result.err { background: rgba(220, 38, 38, 0.18); color: #fca5a5; border: 1px solid rgba(220, 38, 38, 0.4); }
