* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; color: #222; background: #f5f5f7; }
a { color: #06c; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .5rem 1rem; background: #222; color: #fff; }
.topbar a { color: #9cf; }
.warn { background: #fee; color: #800; padding: .5rem 1rem; border-bottom: 1px solid #f99; }
.ok { background: #efe; color: #060; padding: .5rem 1rem; }
.error { background: #fee; color: #800; padding: .5rem 1rem; }
.hint { color: #888; font-size: .85em; }
.center { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.card { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 16px rgba(0,0,0,.1); min-width: 320px; display: flex; flex-direction: column; gap: .75rem; }
.card h1 { margin: 0 0 .5rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9em; }
label.inline { flex-direction: row; align-items: center; gap: .5rem; }
input, select, textarea, button { font: inherit; padding: .4rem .6rem; border: 1px solid #bbb; border-radius: 4px; background: #fff; }
textarea { resize: vertical; font-family: inherit; }
button { cursor: pointer; background: #06c; color: #fff; border-color: #06c; }
button:hover { background: #05a; }
button.danger { background: #c33; border-color: #c33; }
button.danger:hover { background: #a22; }

.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; padding: 1rem; height: calc(100vh - 48px); }
.settings { background: #fff; padding: 1rem; border-radius: 8px; overflow-y: auto; }
.settings h2 { margin-top: 0; }
.settings form { display: flex; flex-direction: column; gap: .6rem; }
.chat { display: flex; flex-direction: column; background: #fff; border-radius: 8px; padding: 1rem; overflow: hidden; }
.messages { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .75rem; }
.msg { padding: .6rem .8rem; border-radius: 8px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { background: #e6f0ff; align-self: flex-end; }
.msg.assistant { background: #f0f0f0; align-self: flex-start; }
.msg.system { background: #fff4d6; align-self: center; font-style: italic; font-size: .85em; }
.msg .meta { font-size: .7em; color: #888; margin-bottom: .25rem; }
#send-form { display: flex; gap: .5rem; margin-top: .5rem; }
#send-form textarea { flex: 1; }
.status { min-height: 1.2em; color: #888; font-size: .85em; padding: .25rem 0; }

.admin { max-width: 1000px; margin: 1rem auto; padding: 0 1rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
table { width: 100%; border-collapse: collapse; background: #fff; margin-top: .5rem; }
th, td { padding: .5rem; border-bottom: 1px solid #eee; text-align: left; vertical-align: middle; }
th { background: #f5f5f5; }
