:root {
	--bg: #0f0f10;
	--panel: #1a1a1c;
	--panel2: #232326;
	--bd: #2e2e32;
	--fg: #e8e8ea;
	--mut: #8a8a90;
	--acc: #5b8def;
	--ok: #4caf50;
	--err: #f44336;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
	font: 14px/1.5 -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
	background: var(--bg);
	color: var(--fg);
	overflow: hidden;
}

.app {
	display: grid;
	grid-template-columns: 280px 1fr;
	height: 100vh;
}
@media (max-width: 720px) {
	.app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
	aside { max-height: 35vh; border-right: none; border-bottom: 1px solid var(--bd); }
}

aside {
	background: var(--panel);
	border-right: 1px solid var(--bd);
	display: flex;
	flex-direction: column;
	padding: 14px;
	gap: 14px;
	overflow-y: auto;
}

.brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand h1 { font-size: 14px; font-weight: 700; color: var(--fg); text-transform: uppercase; letter-spacing: .06em; }
.brand small { display: block; color: var(--mut); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.brand button { background: none; border: 1px solid var(--bd); color: var(--mut); padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; }
.brand button:hover { color: var(--fg); border-color: var(--mut); }

aside h2 { font-size: 11px; font-weight: 600; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 4px; }

.panel { background: var(--panel2); border: 1px solid var(--bd); border-radius: 8px; padding: 10px; }
.item { font-size: 12px; padding: 7px; border-radius: 6px; background: var(--panel); margin-bottom: 5px; display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.item small { color: var(--mut); font-size: 10px; display: block; margin-top: 2px; }
.item button { background: none; border: none; color: var(--mut); cursor: pointer; font-size: 13px; padding: 0 4px; line-height: 1; }
.item button:hover { color: var(--err); }

main { display: flex; flex-direction: column; height: 100vh; min-width: 0; }
header { padding: 12px 22px; border-bottom: 1px solid var(--bd); display: flex; justify-content: space-between; align-items: center; }
header h2 { font-size: 15px; }

#chat { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; line-height: 1.55; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--acc); color: #fff; }
.msg.bot { align-self: flex-start; background: var(--panel); }
.msg pre { background: #000; padding: 10px; border-radius: 6px; overflow-x: auto; margin: 8px 0; font-size: 12px; }
.msg code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.msg pre code { background: none; padding: 0; }

footer { padding: 14px 22px; border-top: 1px solid var(--bd); display: flex; gap: 10px; }
textarea {
	flex: 1;
	background: var(--panel);
	border: 1px solid var(--bd);
	color: var(--fg);
	padding: 10px 14px;
	border-radius: 8px;
	resize: none;
	font: inherit;
	min-height: 40px;
	max-height: 160px;
}
textarea:focus { outline: none; border-color: var(--acc); }

button.send { background: var(--acc); color: #fff; border: none; padding: 0 20px; border-radius: 8px; cursor: pointer; font-weight: 600; }
button.send:disabled { opacity: .5; cursor: not-allowed; }

.typing { color: var(--mut); font-style: italic; font-size: 13px; }

#login {
	position: fixed;
	inset: 0;
	background: var(--bg);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 14px;
	z-index: 100;
	padding: 20px;
}
#login h1 { font-size: 28px; letter-spacing: .04em; }
#login p { color: var(--mut); font-size: 13px; text-align: center; max-width: 320px; }
#login input { background: var(--panel); border: 1px solid var(--bd); color: var(--fg); padding: 10px 14px; border-radius: 8px; width: 280px; font: inherit; }
#login button { background: var(--acc); color: #fff; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 600; }
#login .msg { font-size: 13px; height: 18px; text-align: center; }
#login .msg.ok { color: var(--ok); }
#login .msg.err { color: var(--err); }

.hidden { display: none !important; }
