* { box-sizing: border-box; }
:root { color-scheme: light dark; --ground:#f2f4f8; --paper:#fff; --ink:#15243b; --muted:#475977; --border:#d8dfea; --accent:#185c87; --soft:#ecf5fc; --btn:#185c87; --error:#8d2929; }
@media (prefers-color-scheme: dark) {
  :root { --ground:#101721; --paper:#172333; --ink:#eaf0fa; --muted:#adbed6; --border:#334862; --accent:#8fcef9; --soft:#21344a; --error:#ffb2ad; }
}
body { margin:0; background:var(--ground); color:var(--ink); font: 1rem/1.55 system-ui,sans-serif; }
.bar { min-height:4.5rem; background:var(--paper); border-bottom:1px solid var(--border); padding:.9rem max(1rem,calc((100% - 72rem)/2)); display:flex; justify-content:space-between; align-items:center; gap:1rem; }
nav { display:flex; align-items:center; flex-wrap:wrap; gap:.9rem; }
.brand { display:flex; align-items:center; gap:.65rem; color:var(--ink); text-decoration:none; font-weight:750; white-space:nowrap; }
.mark { background:var(--btn); color:#fff; padding:.2rem .45rem; border-radius:.4rem; font-size:.8rem; letter-spacing:.04em; }
a { color:var(--accent); }
.layout { width:min(calc(100% - 2rem),72rem); margin:1.5rem auto; display:grid; grid-template-columns:minmax(16rem, .75fr) minmax(0, 1.7fr); gap:1rem; align-items:start; }
.panel { background:var(--paper); border:1px solid var(--border); border-radius:.85rem; padding:1.25rem; min-width:0; }
.login,.diagnostics { width:min(calc(100% - 2rem),72rem); margin:1.5rem auto; }
.login { max-width:30rem; }
h1,h2,p { margin:0 0 .5rem; }
h1,h2 { font-size:1.3rem; line-height:1.25; }
small { color:var(--muted); font-weight:400; }
.mode,.muted,.status,.ref,time { color:var(--muted); font-size:.86rem; }
.mode,.notice { padding:.55rem .7rem; background:var(--soft); border-radius:.5rem; }
.section-head,.message-heading { display:flex; gap:.75rem; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; margin-bottom:.8rem; }
.thread { display:block; padding:.75rem; margin-top:.4rem; border-radius:.45rem; color:var(--ink); text-decoration:none; overflow-wrap:anywhere; }
.thread span { display:block; color:var(--muted); font-size:.85rem; }
.thread.active,.thread:hover,.message.out { background:var(--soft); }
.messages { display:grid; gap:.65rem; }
.message { border:1px solid var(--border); border-radius:.65rem; padding:.7rem .85rem; overflow-wrap:anywhere; }
.message .body { white-space:pre-wrap; }
.message img { max-width:min(14rem,100%); max-height:14rem; object-fit:contain; border-radius:.5rem; }
.message:target { outline:2px solid var(--accent); }
.deliveries { margin:.25rem 0 0; padding-left:1.2rem; color:var(--muted); font-size:.8rem; }
.composer { border-top:1px solid var(--border); padding-top:1rem; margin-top:1rem; }
.stack { display:grid; gap:.55rem; }
label,legend { font-weight:650; }
fieldset { border:1px solid var(--border); border-radius:.45rem; margin:0; }
.option { display:inline-flex; align-items:center; gap:.3rem; margin:.1rem .65rem .1rem 0; font-weight:400; }
select,textarea,input[type=password],input[type=file] { width:100%; border:1px solid var(--border); border-radius:.45rem; padding:.55rem; background:var(--paper); color:var(--ink); font:inherit; }
button,.button { font:inherit; cursor:pointer; color:#fff; background:var(--btn); border:1px solid transparent; border-radius:.45rem; padding:.45rem .75rem; text-decoration:none; justify-self:start; }
.quiet { color:var(--accent); background:var(--paper); border-color:var(--border); }
.error { color:var(--error); font-weight:650; }
.table-scroll { overflow:auto; margin-top:1rem; }
table { width:100%; border-collapse:collapse; text-align:left; }
td,th { border-bottom:1px solid var(--border); padding:.6rem; }
@media(max-width:700px) { .layout { grid-template-columns:1fr; } .bar { flex-wrap:wrap; } }
