/* Base */
:root { --bg:#0f141a; --panel:#141b22; --muted:#8b9bb1; --text:#e6edf3; --accent:#2f81f7; --border:#26323d; }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; background: var(--bg); color: var(--text); }
#app { display: grid; grid-template-columns: 300px 1fr; grid-template-rows: 100vh; }

.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 16px; overflow: auto; }
.brand { margin-bottom: 12px; }
.brand .logo { font-size: 26px; }
.brand .title { font-weight: 700; font-size: 18px; }
.brand .subtitle { color: var(--muted); font-size: 12px; }
.panel { margin: 14px 0; }
.panel-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
textarea, select, input[type="text"], input[type="password"] { width: 100%; background: #0c1116; border: 1px solid var(--border); color: var(--text); padding: 8px; border-radius: 8px; }
select, input[type="range"] { width: 100%; }
.muted { color: var(--muted); }
.rowflex { display: flex; gap: 8px; }
.row.gap { display: flex; gap: 8px; align-items: center; }
.keyrow { display: grid; grid-template-columns: 1fr; gap: 6px; }

.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #2a3440; transition: .3s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); }

.main { display: flex; flex-direction: column; height: 100vh; }
.chat { flex: 1; overflow: auto; padding: 16px 20px; }
.msg { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: #0c1116; }
.msg.assistant { background: #0d1117; }
.msg .role { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg .content { font-size: 14px; }
pre code { display: block; padding: 12px; background: #0b0f14; border-radius: 8px; border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; }

.composer { border-top: 1px solid var(--border); padding: 12px; background: var(--panel); }
.composer .row { display: flex; gap: 10px; }
.composer textarea { flex: 1; min-height: 64px; resize: vertical; }
.composer-actions { display: flex; flex-direction: column; gap: 8px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.status { color: var(--muted); font-size: 12px; }

.btn { background: var(--accent); color: white; padding: 10px 14px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--accent); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn.small { padding: 6px 10px; font-size: 12px; }

.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); cursor: pointer; }
.modal-window { position: relative; width: min(560px, 92vw); background: #0d131a; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--panel); border-top-left-radius: 12px; border-top-right-radius: 12px; font-weight: 600; }
.modal-body { padding: 14px; display: grid; gap: 10px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #243041; color: #cfe3ff; border: 1px solid var(--border); }
