* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif; background: #f4f6f8; color: #1f2933; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

header { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: #0f172a; color: #fff; flex-wrap: wrap; }
header .brand { font-weight: 700; }
header nav { display: flex; gap: 14px; flex-wrap: wrap; }
header nav a { color: #cbd5e1; }
header nav a:hover { color: #fff; }
header .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
header .right a { color: #cbd5e1; }
.who { color: #94a3b8; }
.badge { padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.badge.on { background: #16a34a; }
.badge.off { background: #64748b; }

main { max-width: 1000px; margin: 24px auto; padding: 0 20px; }
h1 { margin-top: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; }
.card h3 { margin: 0 0 8px; }
.big { font-size: 26px; font-weight: 700; margin: 4px 0; }
.big.ok { color: #16a34a; } .big.muted { color: #64748b; }
.stats { list-style: none; padding: 0; margin: 0; }
.stats li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #e2e8f0; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.chk { display: inline-flex; gap: 6px; align-items: center; }

button { cursor: pointer; padding: 8px 14px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font-size: 14px; }
button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
button.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
button.small { padding: 4px 8px; font-size: 12px; }

input, textarea, select { font: inherit; padding: 8px; border: 1px solid #cbd5e1; border-radius: 8px; width: 100%; background: #fff; }
textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; background: #fff; padding: 18px; border: 1px solid #e2e8f0; border-radius: 10px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef2f6; font-size: 14px; vertical-align: top; }
td.detail { color: #475569; font-size: 13px; word-break: break-word; white-space: pre-line; }

.tag { padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #e2e8f0; }
.tag.send { background: #dcfce7; color: #166534; }
.tag.transfer { background: #dbeafe; color: #1e40af; }
.tag.close { background: #f1f5f9; color: #334155; }
.tag.rejected { background: #fee2e2; color: #991b1b; }
.tag.noop { background: #f3f4f6; color: #6b7280; }

.muted { color: #64748b; }
.err { color: #b91c1c; }
.ok { color: #15803d; }
.ok-banner { background: #dcfce7; color: #166534; padding: 8px 12px; border-radius: 8px; }

.logbox { background: #0f172a; color: #d1fae5; padding: 12px; border-radius: 8px; height: 460px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
.cols { display: grid; grid-template-columns: 1fr; gap: 20px; }
.cols section { min-width: 0; }

.chat { max-width: 720px; display: flex; flex-direction: column; gap: 10px; background: #eef2f6; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; }
.chat .msg { display: flex; flex-direction: column; max-width: 78%; }
.chat .msg.left { align-self: flex-start; align-items: flex-start; }
.chat .msg.right { align-self: flex-end; align-items: flex-end; }
.chat .bubble { padding: 9px 13px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.35; }
.chat .bubble.client { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.chat .bubble.agent { background: #e2e8f0; color: #334155; border-bottom-right-radius: 4px; }
.chat .bubble.bot { background: #2563eb; color: #fff; border-bottom-right-radius: 4px; }
.chat .bubble.bot.sim { background: #1e40af; border: 1px dashed #93c5fd; }
.chat .bubble.bot.action { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.chat .meta { font-size: 11px; color: #64748b; margin-top: 3px; }

.login { max-width: 340px; margin: 8vh auto; background: #fff; padding: 28px; border: 1px solid #e2e8f0; border-radius: 12px; }
.login h1 { font-size: 20px; text-align: center; }
.login label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.login button { width: 100%; margin-top: 16px; }
