:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #0b0f1a;
  --muted: #5b6472;
  --border: #e6e8ee;
  --accent: #0a84ff; /* Apple-like blue */
  --accent-2: #34c759; /* Apple green */
  --shadow: 0 8px 30px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; background:var(--bg); color:var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Segoe UI, Roboto, Helvetica, Arial;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

.header {
  display:flex; align-items:center; justify-content:space-between; margin-bottom: 16px;
}
.brand { display:flex; align-items:center; gap:12px; }
.brand .logo {
  width:36px; height:36px; border-radius:12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: var(--shadow);
}
.brand h1 { font-size: 22px; margin:0; letter-spacing:-0.02em; }
.header .actions { display:flex; gap:10px; align-items:center; }
.button {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background: var(--card); border:1px solid var(--border); padding:10px 14px; border-radius:12px; cursor:pointer;
  box-shadow: var(--shadow);
}
.button.primary {
  background: var(--accent); border-color: var(--accent); color:white; font-weight:600;
}
.button:disabled { opacity: .6; cursor: not-allowed; }

.shell {
  display:grid; grid-template-columns: 1.4fr 0.9fr; gap: 24px;
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
}

.card {
  background: var(--card); border:1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}

.chat {
  display:flex; flex-direction:column; min-height: 60vh;
}
.messages { flex:1; overflow:auto; padding: 8px; scroll-behavior: smooth; }
.msg-row { display:flex; gap:12px; margin: 10px 0; }
.msg { max-width: 80%; padding: 12px 14px; border-radius: 14px; border:1px solid var(--border); box-shadow: var(--shadow); }
.user .msg { margin-left:auto; background:#eef5ff; border-color:#d9e8ff; }
.bot .msg { background:#fff; }
.meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.cites { margin-top:8px; padding-top:8px; border-top:1px dashed var(--border); }
.cites ol { margin: 8px 0 0 18px; }
.disclaimer { color: var(--muted); }

.input-row { display:flex; gap:10px; margin-top: 10px; }
.input {
  flex:1; border:1px solid var(--border); border-radius: 12px; padding: 12px 14px; background:#fff; outline:none;
}
.spinner {
  width:16px; height:16px; border:2px solid rgba(255,255,255,0.6); border-top-color: white; border-radius:50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.sidebar h2 { font-size: 16px; margin: 0 0 12px; }
.control { margin-bottom: 12px; }
label { font-weight:600; font-size: 13px; display:block; margin-bottom:6px; }
select, textarea {
  width: 100%; border:1px solid var(--border); border-radius:12px; padding: 10px 12px; background:#fff;
}
.badge {
  background:#f0f1f5; color:#2b2f36; padding:4px 10px; border-radius: 999px; border:1px solid var(--border); font-size: 12px;
}
.hero {
  display:flex; align-items:center; justify-content:space-between; padding: 16px; background:linear-gradient(180deg, #fdfdff 0%, #f6f8fb 100%); border:1px solid var(--border); border-radius:16px; margin-bottom: 12px;
}
.hero h2 { margin:0; font-size: 18px; }
.notes { color:var(--muted); font-size:13px; }
.footer {
  margin-top:12px; color:var(--muted); font-size: 12px;
}
.copy-toast {
  position: fixed; right: 16px; bottom: 16px; background: #0b0f1a; color: white; padding: 10px 14px; border-radius: 10px; opacity: 0; transition: opacity .3s, transform .3s; transform: translateY(8px);
}
.copy-toast.show { opacity: 1; transform: translateY(0); }
code.kv { background:#f0f3f8; padding:2px 6px; border-radius:6px; font-size:12px; }
