/* The panel: Pico.css (pico.min.css, MIT, vendored) gives the base: type, forms, buttons, tables, dark mode. Here only what is ours: the top bar, the tabs, badges, the
   dialog rows and the chat bubbles, all on Pico's variables so both themes follow. */
:root { --ok:#15803d; --warn:#b45309; --bad:#b42318; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok:#6ee7a0; --warn:#fbbf24; --bad:#ff8a80; } }
:root[data-theme="dark"] { --ok:#6ee7a0; --warn:#fbbf24; --bad:#ff8a80; }
/* Pico sets --pico-color to the link colour inside every <a>; our rows and tabs are links with plain text, so they keep the page text colour from the root */
:root { --text: var(--pico-color); }
html { -webkit-text-size-adjust: 100%; }
body { padding-bottom: env(safe-area-inset-bottom); }

.top { display:flex; align-items:center; gap:12px; padding:10px 16px; padding-top:calc(10px + env(safe-area-inset-top)); background:var(--pico-primary-background); color:var(--pico-primary-inverse); }
.brand { font-weight:700; flex:1; }
.who { font-size:.875rem; opacity:.9; }
.inline { display:inline; margin:0; }
button.link { background:none; border:0; padding:0 4px; margin:0; width:auto; text-decoration:underline; font-weight:400; color:inherit; --pico-box-shadow:none; }

.tabs { display:flex; gap:4px; overflow-x:auto; padding:8px 12px; background:var(--pico-card-background-color); border-bottom:1px solid var(--pico-muted-border-color); -webkit-overflow-scrolling:touch; }
.tab { white-space:nowrap; padding:10px 14px; border-radius:var(--pico-border-radius); color:var(--text); text-decoration:none; min-height:44px; display:flex; align-items:center; }
.tab.on { background:var(--pico-primary-background); color:var(--pico-primary-inverse); }

main { max-width:960px; padding-top:16px; }
main h1 { font-size:1.5rem; margin:.5rem 0 1rem; }
main h2 { font-size:1.2rem; margin:1.5rem 0 .5rem; }
main h3 { font-size:1.05rem; margin:1.25rem 0 .5rem; }
.card { background:var(--pico-card-background-color); border-radius:var(--pico-border-radius); box-shadow:var(--pico-card-box-shadow); padding:1rem; margin:0 0 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top:0; }
.muted, .help { color:var(--pico-muted-color); font-size:.875rem; }
.help { margin:.125rem 0 0; }
.flash { padding:.75rem 1rem; border-radius:var(--pico-border-radius); margin:0 0 1rem; border:1px solid var(--pico-muted-border-color); background:var(--pico-card-background-color); }
.flash.ok { border-color:var(--ok); } .flash.error { border-color:var(--bad); }

.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:10px; }
.row > *, .row > button, .row > .btn, .row > form { margin:0; width:auto; }
.btn, a.btn { display:inline-block; padding:var(--pico-form-element-spacing-vertical) var(--pico-form-element-spacing-horizontal); border-radius:var(--pico-border-radius); background:var(--pico-primary-background); color:var(--pico-primary-inverse); text-decoration:none; line-height:var(--pico-line-height); }
.btn.secondary { background:var(--pico-secondary-background); color:var(--pico-secondary-inverse); }
button.danger { --pico-background-color:var(--bad); --pico-border-color:var(--bad); --pico-color:#fff; }
form.inline button { width:auto; margin:0; }

table { display:block; max-width:100%; overflow-x:auto; }
th { font-size:.8125rem; color:var(--pico-muted-color); }
progress { min-width:60px; margin:0; }
.nowrap { white-space:nowrap; }
details summary { cursor:pointer; min-height:44px; }
details ol { padding-left:20px; margin:6px 0; }

.badge { display:inline-block; padding:1px 8px; border-radius:20px; font-size:.75rem; line-height:1.5; border:1px solid var(--pico-muted-border-color); color:var(--pico-muted-color); white-space:nowrap; }
.badge.on { border-color:var(--ok); color:var(--ok); } .badge.warn { border-color:var(--warn); color:var(--warn); } .badge.bad { border-color:var(--bad); color:var(--bad); }

.login { max-width:380px; margin:12vh auto 0; }
.offline { text-align:center; margin-top:20vh; }
.msg { white-space:pre-wrap; overflow-wrap:anywhere; }

.filters { margin:0 0 1rem; }
.filters .grid2 { display:grid; grid-template-columns:1fr 1fr; gap:0 12px; }
.check { display:flex; gap:8px; align-items:center; min-height:44px; }

.dialogs { display:grid; gap:8px; margin-bottom:1rem; }
.dialog { display:grid; gap:2px; background:var(--pico-card-background-color); border:1px solid var(--pico-muted-border-color); border-radius:var(--pico-border-radius); padding:10px 12px; color:var(--text); text-decoration:none; overflow-wrap:anywhere; }
.dialog:hover { border-color:var(--pico-primary-hover-background); }
.dialog-head { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.chat { display:grid; gap:8px; margin-bottom:1rem; }
.bubble { border:1px solid var(--pico-muted-border-color); border-radius:var(--pico-border-radius); padding:8px 12px; background:var(--pico-card-background-color); max-width:92%; }
.bubble .muted { font-size:.75rem; }
.bubble.client { justify-self:start; }
.bubble.agent { justify-self:end; border-color:var(--pico-primary-background); }
.bubble.owner { justify-self:end; border-style:dashed; }

.section { border:1px solid var(--pico-muted-border-color); border-radius:var(--pico-border-radius); padding:0 1rem; margin:0 0 .75rem; background:var(--pico-card-background-color); }
.section > summary { font-weight:600; font-size:1.05rem; padding:.75rem 0; min-height:44px; }
.section[open] > summary { border-bottom:1px solid var(--pico-muted-border-color); margin-bottom:.75rem; }
.section .card { background:transparent; box-shadow:none; padding:0 0 .5rem; border-bottom:1px solid var(--pico-muted-border-color); border-radius:0; }

.thumb { display: block; max-width: 220px; max-height: 220px; width: auto; height: auto; border-radius: 6px; margin: 0.5rem 0; }
.photos { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
.photos figure { margin:0; } .photos img { width:100%; height:auto; border-radius:var(--pico-border-radius); }
.statusline { font-size:.8rem; color:var(--pico-muted-color); padding:4px 16px; border-bottom:1px solid var(--pico-muted-border-color); }
