/* Ottsy client styles */
:root {
  --bg: #12141a; --panel: #1c1f27; --panel-2: #252935; --line: #2f3442;
  --text: #e8eaf0; --muted: #9aa3b5; --accent: #5d8be0; --ok: #4ade80; --danger: #e05d5d;
  --sidebar-w: 300px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }

.screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(720px, 100%); display: flex; flex-direction: column; gap: 14px; max-height: 96vh; overflow: auto; }
.card h1 { margin: 0; font-size: 26px; }
.card h2 { margin: 0; font-size: 20px; }
.card p { margin: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], input:not([type]) { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; }
select { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
.editor { display: flex; gap: 16px; align-items: flex-start; }
.editor-fields { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.preview { width: 220px; height: 280px; background: #f3e4c4; border-radius: 14px; border: 2px solid #c9935a; flex: none; box-shadow: inset 0 0 0 3px #fff8ec, 0 6px 18px rgba(90,60,30,.18); }
.preview-col { display: flex; flex-direction: column; gap: 10px; flex: none; width: 220px; }
.opt-group { display: flex; flex-direction: column; gap: 6px; }
.opt-row { display: flex; align-items: center; gap: 10px; }
.opt-label { width: 88px; flex: none; font-size: 12px; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 5px; }
.opt { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 12px; cursor: pointer; text-transform: capitalize; }
.opt.emoji { font-size: 18px; padding: 3px 7px; line-height: 1; }
.opt.sel, .swatch.sel { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.4); cursor: pointer; padding: 0; }
.initials { width: 4em; }
.editor-fields { gap: 8px; }
input[type=color] { width: 48px; height: 36px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 2px; }
.row { display: flex; gap: 14px; align-items: flex-end; }
.row.end { justify-content: flex-end; }
.pill { background: #24344f; border: 1px solid #365688; padding: 8px 12px; border-radius: 999px; font-size: 13px; }

.btn { display: inline-block; text-align: center; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small-btn { padding: 7px 12px; font-size: 13px; }
.btn:hover { filter: brightness(1.1); }

#app { display: grid; grid-template-columns: 1fr var(--sidebar-w); grid-template-rows: 46px 1fr; height: 100vh; }
#topnav { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
#topnav .brand { font-size: 15px; }
#topnav .tabs { display: flex; gap: 4px; background: var(--panel-2); border-radius: 10px; padding: 3px; }
#topnav .tab { background: none; border: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
#topnav .tab.on { background: var(--panel); color: var(--text); }
#c-search { width: min(420px, 36vw); font-size: 13px; padding: 7px 10px; }
#app[data-view=office] #c-search { display: none; }
#app[data-view=chat] #stage, #app[data-view=chat] #sidebar { display: none; }
#chatview { display: none; grid-column: 1 / -1; grid-template-columns: 260px 1fr auto; min-height: 0; }
#app[data-view=chat] #chatview { display: grid; }
#c-side { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; padding: 8px 0; }
#c-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#c-panel { width: 380px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#c-panel.hidden { display: none; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; min-width: 18px; text-align: center; }
.csec { padding: 6px 8px; }
.csec-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cplus { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 6px; width: 22px; height: 22px; cursor: pointer; font-size: 13px; line-height: 1; }
.citem { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; color: var(--muted); font: inherit; font-size: 14px; padding: 5px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.citem:hover { background: var(--panel-2); }
.citem.sel { background: var(--accent); color: #fff; }
.citem.unread { color: var(--text); font-weight: 700; }
.citem.archived { opacity: .5; }
.citem .cn { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citem .cic, .cic { width: 14px; text-align: center; opacity: .8; font-weight: 700; }
.citem.nav { font-weight: 600; }
.pres { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; opacity: .5; }
.pres.on { background: var(--ok); opacity: 1; }
#c-head { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); min-height: 52px; }
.chtitle { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.chtopic { color: var(--muted); font-size: 13px; flex: 1; cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chtools { display: flex; gap: 6px; }
#c-msgs { flex: 1; overflow: auto; padding: 8px 0 12px; display: flex; flex-direction: column; }
#c-typing { min-height: 18px; padding: 0 20px; color: var(--muted); font-style: italic; }
.cmore, .cstart { align-self: center; margin: 8px; color: var(--muted); font-size: 12px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.cstart { border: none; }
.cday { display: flex; align-items: center; gap: 10px; margin: 10px 20px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.cday::before, .cday::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.cm { position: relative; display: flex; gap: 10px; padding: 5px 20px; }
.cm:hover { background: rgba(255,255,255,.035); }
.cm.pinned { background: rgba(240,180,41,.08); }
.cm.grouped { padding-top: 1px; padding-bottom: 1px; }
.cm.grouped .t.hover { width: 32px; flex: none; font-size: 10px; color: var(--muted); visibility: hidden; text-align: right; padding-top: 3px; }
.cm.grouped:hover .t.hover { visibility: visible; }
.cav { width: 34px; height: 34px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.cav.hook { background: var(--panel-2); font-size: 18px; }
.cmain { flex: 1; min-width: 0; }
.chead { display: flex; align-items: baseline; gap: 8px; }
.cname { cursor: pointer; }
.cname:hover { text-decoration: underline; }
.chead .t, .cm.sys .t { color: var(--muted); font-size: 11px; }
.app { background: var(--panel-2); color: var(--muted); font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.cbody { font-size: 14px; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.cbody code, .cbody .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.cbody .code { display: block; padding: 8px 10px; white-space: pre; overflow: auto; margin: 4px 0; }
.cbody blockquote { border-left: 3px solid var(--line); margin: 2px 0; padding: 2px 10px; color: var(--muted); }
.cbody .li { padding-left: 6px; }
.cbody a { color: #8ab4ff; }
.mention { background: rgba(93,139,224,.22); color: #b6ccff; border-radius: 4px; padding: 0 3px; font-weight: 600; cursor: pointer; }
.mention.me, .mention.all { background: rgba(240,180,41,.25); color: #ffd76a; }
.edited, .deleted { color: var(--muted); font-size: 12px; font-style: italic; }
.ctools { position: absolute; right: 16px; top: -12px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.cm:hover .ctools { display: flex; }
.ctools button { background: none; border: none; cursor: pointer; font-size: 14px; padding: 3px 5px; border-radius: 6px; }
.ctools button:hover { background: var(--panel-2); }
.creacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.creact { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.creact.on { border-color: var(--accent); background: rgba(93,139,224,.2); }
.creact.add { opacity: .6; }
.cthread { display: block; margin-top: 4px; background: none; border: none; color: #8ab4ff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.cm.sys { color: var(--muted); font-size: 12px; font-style: italic; gap: 8px; padding-left: 64px; }
.cfile { display: inline-block; margin-top: 6px; color: var(--text); text-decoration: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.cfile.img { padding: 0; overflow: hidden; }
.cfile.img img { display: block; max-width: 360px; max-height: 280px; }
.cempty { color: var(--muted); padding: 24px; text-align: center; }
.cedit textarea { width: 100%; min-height: 60px; }
.ccomp { display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 12px; }
.ccomp.main { padding: 8px 20px 16px; }
.ccomp textarea { flex: 1; resize: none; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; line-height: 1.4; max-height: 200px; }
.ccomp textarea:focus { outline: none; border-color: var(--accent); }
#c-ac { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.ac-item { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ac-item.sel, .ac-item:hover { background: var(--panel-2); }
#c-emoji { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-wrap: wrap; gap: 2px; width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
#c-emoji button { background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; border-radius: 6px; }
#c-emoji button:hover { background: var(--panel-2); }
#c-emoji input { width: 80px; font-size: 12px; padding: 4px 6px; }
.cp-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cp-h .cplus { margin-left: auto; }
.cp-body { flex: 1; overflow: auto; }
.cp-sec { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cp-sec.row { flex-direction: row; flex-wrap: wrap; }
.cp-l { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cmember { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.cm-users { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; margin: 6px 0; }
.cm-user { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.cm-user:hover { background: var(--panel-2); }
.cm-user.col { flex-direction: column; align-items: stretch; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.muted { color: var(--muted); }
.mini-sel { flex: 1; font-size: 12px; padding: 3px 6px; text-transform: none; letter-spacing: 0; }
#mini-msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; margin: 0 -14px; }
#mini-msgs .cm { padding: 4px 12px; gap: 8px; }
#mini-msgs .cav { width: 26px; height: 26px; font-size: 11px; }
#mini-msgs .cbody { font-size: 13px; }
#mini-msgs .cday { margin: 6px 12px 2px; }
#mini-msgs .cm.sys { padding-left: 12px; }
#sidebar .ccomp { padding: 8px 0 0; }
/* v1.2.0: attachments, switcher, permalinks */
.cattach { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 20px 0; }
#sidebar .cattach { padding: 6px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 12px; max-width: 100%; }
.chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; }
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; }
.cplus.big { width: 34px; height: 38px; font-size: 16px; flex: none; }
.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; }
#c-switch .card { width: min(92vw, 520px); padding: 12px; gap: 8px; }
#c-switch input { font-size: 15px; padding: 10px 12px; }
.cm.flash { animation: flash 2.5s ease-out; }
@keyframes flash { 0% { background: rgba(240,180,41,.35); } 100% { background: transparent; } }
.cjump { position: sticky; bottom: 8px; align-self: center; background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.fthumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
a.cm-user { color: var(--text); text-decoration: none; }
#chat-badge.mention { background: var(--danger); }
/* v1.3.0: status + DND */
#btn-status { font-size: 12px; padding: 5px 10px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.emoji-in { width: 56px; text-align: center; }
.ustatus { margin-left: 4px; font-size: 12px; }
.ustatus.big { font-size: 13px; font-weight: 400; color: var(--muted); }
.cday.new { color: var(--danger); }
.cday.new::before, .cday.new::after { border-color: var(--danger); }
#chat-badge { background: var(--accent); }
#stage { position: relative; overflow: hidden; background: var(--bg); }
#canvas { width: 100%; height: 100%; display: block; }

#sidebar { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#sidebar header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#status[data-state=open] { color: var(--ok); }
#status[data-state=closed], #status[data-state=replaced] { color: var(--danger); }
.icon { background: none; border: none; color: var(--text); font-size: 16px; cursor: pointer; padding: 4px; }
.panel { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.panel h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.count { background: var(--panel-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--text); }
.users { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow: auto; }
.user { display: flex; align-items: center; gap: 10px; padding: 4px 2px; opacity: .55; }
.user.online { opacity: 1; }
.avatar { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.utext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.uname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usub { font-size: 11px; color: var(--muted); }
.knock { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 4px 8px; font-size: 11px; cursor: pointer; }
.knock:disabled { opacity: .5; }
#invite-out { margin-top: 8px; width: 100%; font-size: 11px; }

.panel.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; border-bottom: none; }
#chat-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.msg .meta { font-size: 11px; color: var(--muted); }
.msg .body { font-size: 13px; white-space: pre-wrap; word-break: break-word; background: var(--panel-2); padding: 6px 9px; border-radius: 8px; margin-top: 2px; }
.msg.mine .body { background: #2c4470; }
#chat-form { display: flex; gap: 6px; margin-top: 8px; }
#chat-form input { flex: 1; }

#controls { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: rgba(28,31,39,.9); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; backdrop-filter: blur(6px); max-width: calc(100% - 32px); flex-wrap: wrap; justify-content: center; }
.ctl { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.ctl.on { background: #1f6b3a; border-color: #2e9e56; }
.ctl:disabled { opacity: .4; cursor: not-allowed; }
.ctl svg { vertical-align: -5px; margin-right: 0; }
#btn-mic, #btn-cam, #btn-screen { padding: 7px 9px; }
.ctl.emote { padding: 6px 8px; font-size: 16px; line-height: 1; }
.ctl.emote kbd { font-size: 9px; color: var(--muted); margin-left: 3px; font-family: inherit; }
.emotes { display: inline-flex; gap: 4px; border-left: 1px solid var(--line); padding-left: 8px; }
/* v0.18.0: build mode palette */
#build-panel { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: rgba(28,31,39,.94); border: 1px solid var(--line); border-radius: 12px; padding: 10px; backdrop-filter: blur(6px); z-index: 4; display: flex; flex-direction: column; gap: 8px; }
#build-panel.hidden { display: none; }
#build-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
#build-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-height: 232px; overflow: auto; }
#build-grid .thumb { width: 100%; aspect-ratio: 1; background: linear-gradient(#e9f2fa, #cfe8fb); border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
#build-grid .thumb.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
#build-hint { color: var(--muted); font-size: 12px; }
#zoom { position: absolute; right: 12px; bottom: 14px; display: flex; gap: 4px; background: rgba(28,31,39,.9); border: 1px solid var(--line); border-radius: 10px; padding: 4px; z-index: 3; }
#zoom .ctl { padding: 5px 9px; min-width: 34px; }
#zoom-level { font-size: 12px; color: var(--muted); }
.hint { color: var(--muted); flex-basis: 100%; text-align: center; }

/* v0.19.0: controls cheat-sheet in settings */
.keys { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.keys kbd { display: inline-block; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font: inherit; font-size: 12px; color: var(--text); margin: 0 1px; }
#toast { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(28,31,39,.95); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 5; max-width: 80%; text-align: center; }
#audio-banner { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; z-index: 6; }

#videos { position: absolute; top: 12px; right: 12px; bottom: 90px; display: flex; flex-direction: column; gap: 8px; z-index: 6; overflow: auto; }
.vtile { position: relative; width: 160px; height: 120px; background: var(--c, #333); border-radius: 10px; overflow: hidden; border: 2px solid rgba(255,255,255,.15); cursor: pointer; }
.vtile.mic-on { border-color: var(--ok); }
.vtile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vtile.cam-off video { display: none; }
.vtile.cam-off::before { content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 28px; color: #fff; }
.vtile .vlabel { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 6px; font-size: 11px; }
.vtile.cam-off .vlabel::before { content: attr(data-initials); display: none; }
.vtile.big { width: 480px; height: 360px; }
.vtile.self video { transform: scaleX(-1); }
.vtile.self { border-color: rgba(93,139,224,.7); cursor: default; }
#stage.presenting #screen-overlay { right: 190px; }
.ctl.danger { background: #7a2e2e; border-color: #a94040; }

#screen-overlay { position: absolute; inset: 12px 12px 90px 12px; background: #000; border: 1px solid var(--line); border-radius: 12px; z-index: 4; display: flex; flex-direction: column; overflow: hidden; }
#screen-overlay .bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); font-size: 13px; }
#screen-video { flex: 1; width: 100%; min-height: 0; object-fit: contain; background: #000; }

dialog { background: transparent; border: none; padding: 0; }
.card.compact { width: min(92vw, 360px); }
.card.compact .hint { margin: 4px 0 12px; opacity: .7; font-size: 12px; }
dialog::backdrop { background: rgba(0,0,0,.6); }

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr 40vh; }
  #sidebar { border-left: none; border-top: 1px solid var(--line); }
  .hint { display: none; }
}

/* ---------- v1.8.0: warm "office" skin for the sign-in / avatar screens (matches the drawn tileset) ---------- */
.screen.warm { background: radial-gradient(circle at 25% 15%, #f8ead4 0%, #ecd3ad 55%, #d9b485 100%); color: #4a3626; }
.card.warm { width: min(1000px, 100%); background: #fff8ec; border: 2px solid #c9935a; border-radius: 20px; color: #4a3626; box-shadow: 0 18px 50px rgba(90,60,30,.28), inset 0 0 0 6px #f6e8d0; padding: 26px 28px; gap: 16px; }
.card.warm h1 { font-size: 28px; color: #6b4426; letter-spacing: -0.01em; }
.card.warm h2 { color: #6b4426; }
.card.warm .head { display: flex; flex-direction: column; gap: 4px; }
.card.warm .muted, .card.warm label, .card.warm .opt-label { color: #8a6a4e; }
.card.warm input:not([type=checkbox]) { background: #fff; border: 1.5px solid #d9b98c; color: #4a3626; border-radius: 10px; }
.card.warm input:focus { outline: 2px solid #c9935a; outline-offset: 1px; }
.card.warm .btn { background: #f6e8d0; border: 1.5px solid #d9b98c; color: #6b4426; border-radius: 12px; }
.card.warm .btn.primary { background: #b5753f; border-color: #8f5a2e; color: #fff8ec; font-size: 16px; padding: 13px 18px; }
.card.warm .btn.primary:hover { background: #c4834a; filter: none; }
.card.warm .editor { gap: 28px; }
.card.warm .preview { width: 260px; height: 330px; }
.card.warm .preview-col { width: 260px; }
.card.warm .editor-fields { gap: 16px; }
.card.warm .opts { gap: 6px; }
/* v1.9.0: avatar picker = segmented tabs over one panel; tiles and colours share a 64px grid so rows line up */
.card.warm .seg { display: flex; gap: 6px; background: #f6e8d0; border: 1.5px solid #e2c9a4; border-radius: 14px; padding: 4px; }
.card.warm .seg-btn { flex: 1; padding: 9px 6px; border: none; border-radius: 10px; background: transparent; color: #8a6a4e; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.card.warm .seg-btn:hover { color: #6b4426; background: #fff3df; }
.card.warm .seg-btn.on { background: #b5753f; color: #fff8ec; box-shadow: 0 2px 6px rgba(90,60,30,.2); }
.card.warm .opt-panel { display: flex; flex-direction: column; gap: 10px; min-height: 296px; padding-top: 6px; }
.card.warm .opts { display: grid; grid-template-columns: repeat(auto-fill, 88px); gap: 8px; justify-items: center; }
.card.warm .names { display: flex; gap: 10px; }
.card.warm .names label:first-child { flex: 1; min-width: 0; }
.card.warm .swatch { width: 32px; height: 32px; }
.card.warm .opts:has(.swatch) { grid-template-columns: repeat(auto-fill, 44px); }
.card.warm .opt-label { width: auto; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.card.warm .initials { width: 5em; text-transform: uppercase; }
.card.warm .opt { background: #fff; border: 1.5px solid #e2c9a4; color: #4a3626; }
.card.warm .opt.sel { outline: none; border-color: #b5753f; box-shadow: 0 0 0 3px rgba(181,117,63,.35); }
.card.warm .swatch { width: 28px; height: 28px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(60,40,20,.35); }
.card.warm .swatch.sel { outline: none; box-shadow: 0 0 0 3px #b5753f; }
.art-opt { width: 88px; height: 88px; padding: 3px; background: #fff; border: 1.5px solid #e2c9a4; border-radius: 14px; cursor: pointer; display: grid; place-items: center; color: #8a6a4e; font: inherit; font-size: 11px; }
.art-opt canvas { width: 100%; height: 100%; display: block; border-radius: 9px; }
.art-opt.tall { height: 116px; }
.art-opt .none { font-size: 11px; }
.art-opt:hover { border-color: #c9935a; }
.art-opt.sel { border-color: #b5753f; box-shadow: 0 0 0 3px rgba(181,117,63,.35); background: #fff3df; }
.card.warm .keys { color: #6b4426; }
.card.warm kbd { background: #f6e8d0; border-color: #d9b98c; color: #4a3626; }
.card.warm .pill { background: #f6e8d0; border-color: #d9b98c; color: #6b4426; }
@media (max-width: 640px) {
  .card.warm { padding: 18px 16px; }
  .editor { flex-direction: column; align-items: stretch; }
  .preview-col { width: 100%; display: grid; grid-template-columns: 120px 1fr; grid-template-rows: auto auto; gap: 8px 12px; }
  .preview-col .preview { grid-row: 1 / span 2; }
  .preview { width: 120px; height: 160px; }
  .preview-col label { flex: 1; }
  .preview-col { align-items: stretch; }
  .preview-col label { flex: 1; min-width: 0; }
  .card.warm .preview { width: 120px; height: 160px; }
  .card.warm .preview-col { width: 100%; }
  .card.warm .names { flex-direction: column; }
  .art-opt { width: 48px; height: 48px; border-radius: 11px; }
  .card.warm .opts { grid-template-columns: repeat(auto-fill, 48px); gap: 6px; }
  .card.warm .swatch { width: 28px; height: 28px; }
  .card.warm .opts:has(.swatch) { grid-template-columns: repeat(auto-fill, 36px); }
  .art-opt canvas { border-radius: 8px; }
  .art-opt.tall { height: 63px; }
  .card.warm .seg-btn { font-size: 12px; padding: 8px 2px; }
  .card.warm .opt-panel { min-height: 0; }
}

/* v1.8.8: build badge */
#ver { position: fixed; right: 10px; bottom: 8px; z-index: 50; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); opacity: .7; pointer-events: none; user-select: none; }
body:has(.screen.warm:not(.hidden)) #ver { color: #8a6a4e; }
#ver.stale { opacity: 1; pointer-events: auto; cursor: pointer; background: #e04848; color: #fff; padding: 4px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* v1.19.0: workspace settings — a capped column: header and tabs fixed, body scrolls, footer always visible */
#topnav .ws-name { font-size: 12px; opacity: .75; margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22vw; }
#admin .row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.card.warm.ws-card { width: min(760px, 94vw); max-height: min(88vh, 900px); padding: 18px 20px; gap: 12px; overflow: hidden; }
.ws-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ws-card > .ws-head, .ws-card > .seg, .ws-card > .ws-foot { flex: 0 0 auto; } /* only the body scrolls / shrinks */
.ws-foot .btn[hidden] { display: none; }
.ws-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.ws-body section { display: flex; flex-direction: column; gap: 10px; }
.ws-body section[hidden] { display: none; }
.ws-body label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ws-body label.row { flex-direction: row; align-items: center; gap: 8px; }
.ws-body input:not([type=radio]):not([type=checkbox]), .ws-body textarea, .ws-body select { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid #d9b98f; background: #fffdf8; color: #4a3626; }
.ws-access { border: 1px solid #e5cfae; border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; margin: 0; }
.ws-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ws-inline label { flex: 0 1 180px; }
.ws-list { display: flex; flex-direction: column; gap: 6px; }
.ws-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid #ecd9bc; border-radius: 10px; background: #fffaf1; }
.ws-row .who { flex: 1 1 200px; min-width: 0; }
.ws-row .who b, .ws-row .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row .who span { font-size: 12px; opacity: .7; }
.ws-row select { width: auto !important; flex: 0 0 auto; padding: 5px 8px !important; }
.ws-row .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #f1e1c6; color: #6b4426; white-space: nowrap; }
.ws-tag.pending { background: #e3f0ff; color: #24527a; } .ws-tag.joined { background: #e2f5e4; color: #2c6b33; }
.ws-tag.removed, .ws-tag.cancelled, .ws-tag.expired { background: #f6e1df; color: #8a3b33; }
.ws-h { margin: 8px 0 0; font-size: 14px; color: #6b4426; }
.ws-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ws-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid #ecd9bc; padding-top: 10px; }
.ws-foot #ws-msg { flex: 1 1 140px; }
#ws-dlg { max-width: 100vw; max-height: 100dvh; }
@media (max-width: 640px) {
  /* full screen on a phone: the dialog's own centring margins pushed it past the right edge */
  #ws-dlg { margin: 0; width: 100vw; height: 100dvh; inset: 0; }
  .card.warm.ws-card { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; border-width: 0; box-shadow: none; padding: 14px 16px; box-sizing: border-box; }
  .ws-head h2 { font-size: 18px; }
  .card.warm.ws-card .seg { overflow-x: auto; }
  #topnav .ws-name { display: none; }
  /* the top bar was 465px wide on a 360px phone: logo, tabs, status and buttons now fit on one line */
  #topnav { gap: 6px; padding: 0 8px; min-width: 0; }
  #topnav .brand-t { display: none; }
  #topnav .tab { padding: 5px 8px; }
  #btn-status { max-width: 34px; overflow: hidden; white-space: nowrap; padding-left: 8px; padding-right: 0; flex: 0 0 auto; }
  #status { font-size: 0; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
  #topnav .icon { flex: 0 0 auto; }
}
