/* 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: 144px; height: 216px; background: linear-gradient(#6db3ee, #cfe8fb); border-radius: 10px; border: 1px solid var(--line); flex: none; }
.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; }
}
