@font-face {
  font-family: Pretendard;
  src: url("./fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --navy: #1f2a44; --navy-2: #2a3758; --navy-3: #364569;
  --accent: #3b6cf6; --accent-weak: #e8eefe;
  --ink: #1d2433; --ink-2: #5b6478; --line: #e4e7ee; --bg: #f6f7fa;
  --unread: #e8a317; --danger: #d64545; --ok: #2f9e64; --mention: #fff4d6;
  --radius: 10px;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); background: var(--bg); font-size: 14px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--mid); background: #fff; color: var(--mid); border-radius: 8px; padding: 7px 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; }
button.small, .small { font-size: 12px; }
input, textarea, select { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--mid-weak); border-color: var(--mid); }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.icon-btn { border: none; background: transparent; padding: 4px 8px; border-radius: 6px; font-size: 16px; line-height: 1; }

/* 로그인·근무자 선택 */
.screen { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #1f2a44, #2f4170); }
.card { background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); padding: 32px; }
.center-card { width: 380px; text-align: center; }
.center-card h1 { margin: 8px 0 4px; font-size: 22px; }
.logo { width: 56px; height: 56px; }
.code-form { display: flex; gap: 8px; margin: 18px 0 6px; }
.code-form input { flex: 1; min-width: 0; font-size: 22px; letter-spacing: 4px; text-align: center; padding: 10px; }
.code-form input::placeholder { letter-spacing: 0; font-size: 15px; }
.code-form button { flex: none; white-space: nowrap; padding: 0 18px; }
.big-code { font-size: 40px; font-weight: 800; letter-spacing: 10px; text-align: center; background: var(--bg); border-radius: 12px; padding: 18px 8px; margin: 12px 0; font-variant-numeric: tabular-nums; }
#gsi-button { display: flex; justify-content: center; margin: 20px 0 8px; }
.select-card { width: min(720px, 100%); }
.select-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.select-head h2 { margin: 2px 0 0; font-size: 20px; }
.select-card h3 { font-size: 15px; margin: 20px 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px; }
.tile.fav { border-color: #c8d6fd; background: #f6f8ff; }
.tile.current { border: 2px solid var(--accent); }
.tile .t-name { font-weight: 600; }
.tile .t-sub { font-size: 12px; color: var(--ink-2); }
.tiles-sep { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex: none; font-size: 14px; }
.avatar.two { font-size: 12px; letter-spacing: -0.5px; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }
.avatar.sm.two { font-size: 8.5px; }
.avatar.lg.two { font-size: 15px; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.pin-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; text-align: center; }
.pin-title { font-weight: 600; margin-bottom: 10px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin-bottom: 14px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots i.on { background: var(--accent); }
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; justify-content: center; }
.pinpad button { height: 52px; font-size: 20px; }

/* 메신저 레이아웃 */
#app { display: flex; height: 100vh; }
#sidebar { width: 260px; flex: none; background: var(--navy); color: #dfe5f3; display: flex; flex-direction: column; }
.side-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--navy-3); }
.seat-name { font-size: 12px; color: #9aa6c4; margin-bottom: 6px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 8px; background: var(--navy-2); border: none; color: #fff; padding: 8px; text-align: left; }
.me-btn .sub { font-size: 11px; color: #9aa6c4; margin-left: auto; }
.side-scroll { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.side-section { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 4px; font-size: 12px; color: #9aa6c4; }
.side-section .icon-btn { color: #9aa6c4; }
.room-list { list-style: none; margin: 0; padding: 0 8px; }
.room-list li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; color: #c7d0e6; }
.room-list li.active { background: var(--accent); color: #fff; }
.room-list li.unread { color: #fff; font-weight: 700; }
.room-list .r-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-list .r-icon { width: 16px; text-align: center; opacity: .7; font-size: 12px; }
.badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.badge.quiet { background: #59678a; }
.badge.at { background: var(--unread); }
.side-foot { padding: 10px; border-top: 1px solid var(--navy-3); display: flex; justify-content: space-between; }
.side-foot button { color: #c7d0e6; }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fff; }
#room-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.room-title { flex: 1; min-width: 0; }
#room-name { font-weight: 700; font-size: 16px; }
#room-topic { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; gap: 2px; }
.banner { background: #fff7e0; color: #7a5a00; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid #f1e2b0; }

.messages { flex: 1; overflow-y: auto; padding: 8px 0 12px; }
.day-sep { text-align: center; margin: 14px 0 6px; font-size: 12px; color: var(--ink-2); }
.day-sep span { background: var(--bg); border-radius: 12px; padding: 3px 12px; }
.new-sep { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: 12px; margin: 8px 16px; }
.new-sep::before, .new-sep::after { content: ''; flex: 1; border-top: 1px solid var(--danger); }
.msg { display: flex; align-items: flex-start; gap: 6px; padding: 3px 14px; position: relative; }
.msg.outgoing { flex-direction: row-reverse; }
.msg.outgoing .gutter { display: none; }
.msg.mentioned { background: var(--mention); }
.msg.flash { animation: flash 1.6s; }
@keyframes flash { 0% { background: #ffe58a; } 100% { background: transparent; } }
.msg .gutter { width: 36px; flex: none; }
.msg .content { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 44rem); min-width: 0; }
.msg.outgoing .content { align-items: flex-end; }
.msg .bubble { max-width: 100%; min-width: 0; box-sizing: border-box; padding: 8px 12px; overflow-wrap: anywhere; border-radius: 3px 14px 14px 14px; background: #edf0f4; color: #202733; }
.msg.outgoing .bubble { border-radius: 14px 3px 14px 14px; background: #ffeb86; }
.msg .bubble .file-card { max-width: 100%; box-sizing: border-box; }
.msg .delivery { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-start; padding-bottom: 2px; white-space: nowrap; }
.msg.outgoing .delivery { align-items: flex-end; }
.msg .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-bottom: 3px; }
.msg .who { font-weight: 700; }
.msg .seat { font-size: 11px; color: var(--ink-2); }
.msg .time { font-size: 11px; color: var(--ink-2); }
.msg .text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg .text.deleted { color: var(--ink-2); font-style: italic; }
.msg .edited { font-size: 11px; color: var(--ink-2); }
.msg .side-info { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end; }
.unread-n { border: 0; padding: 0; background: transparent; color: var(--mid); font-weight: 700; font-size: 12px; cursor: pointer; }
.hover-time { font-size: 10px; color: var(--ink-2); visibility: hidden; display: block; text-align: right; padding-top: 3px; }
.mention { background: var(--accent-weak); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention.me { background: #ffe1a1; color: #7a4d00; }
.reply-quote { border-left: 3px solid #c9d3ea; padding: 2px 8px; margin: 2px 0 4px; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.file-card { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-top: 4px; color: var(--ink); text-decoration: none; }
.img-wrap img { max-width: min(360px, 100%); max-height: 280px; border-radius: 8px; border: 1px solid var(--line); margin-top: 4px; cursor: zoom-in; display: block; }
.reactions { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.reaction { border: 1px solid var(--line); border-radius: 12px; padding: 1px 8px; font-size: 13px; background: #fff; }
.reaction.mine { border-color: var(--accent); background: var(--accent-weak); }
.pin-mark { font-size: 11px; color: #b07400; }
.actions { position: absolute; right: 16px; top: -12px; display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.08); padding: 2px; z-index: 2; }
.actions button { border: none; padding: 4px 7px; font-size: 14px; background: transparent; }
.emoji-pick { display: flex; gap: 2px; }
.load-more { text-align: center; padding: 8px; }

.typing { height: 18px; padding: 0 16px; }
#composer { border-top: 1px solid var(--line); padding: 10px 16px 14px; position: relative; }
.compose-ctx { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; font-size: 13px; }
.compose-ctx .x { margin-left: auto; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
#input::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#input { flex: 1; resize: none; max-height: 180px; min-height: 40px; line-height: 1.45; }
.attach { position: relative; font-size: 18px; padding: 8px; }
.attach input { position: absolute; width: 1px; height: 1px; padding: 0; clip-path: inset(50%); }
#composer.disabled textarea { background: var(--bg); }
.mention-pop { position: absolute; bottom: 64px; left: 56px; list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 200px; z-index: 5; }
.mention-pop li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.mention-pop li.sel { background: var(--accent-weak); }

#panel { width: 340px; flex: none; border-left: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 58px; }
.panel-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.panel-body h4 { margin: 16px 0 8px; font-size: 13px; color: var(--ink-2); }
.panel-body h4:first-child { margin-top: 0; }
.opt { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.person { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.search-hit { border-bottom: 1px solid var(--line); padding: 8px 0; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--ink-2); }
.check-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

.modal { position: fixed; inset: 0; background: rgba(15,20,35,.5); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; width: min(460px, 92vw); max-height: 88vh; overflow-y: auto; }
.modal-card h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.img-modal { background: transparent; padding: 0; width: auto; }
.img-modal img { max-width: 90vw; max-height: 88vh; border-radius: 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* 관리자 */
.admin { position: fixed; inset: 0; background: var(--bg); z-index: 40; display: flex; flex-direction: column; }
.admin-head { display: flex; align-items: center; gap: 16px; background: #fff; border-bottom: 1px solid var(--line); padding: 12px 20px; }
.admin-head h2 { margin: 0; font-size: 18px; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; }
.tabs button.on { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.admin-body { flex: 1; overflow-y: auto; padding: 20px; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.admin-card h3 { margin: 0 0 12px; font-size: 15px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: middle; }
table.grid th { background: #f2f4f8; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
table.grid tr.off td { color: #9aa1b1; background: #fafbfc; }
table.grid input, table.grid select { padding: 4px 6px; font-size: 13px; }
.pill { display: inline-block; border-radius: 10px; padding: 1px 8px; font-size: 11px; background: var(--bg); color: var(--ink-2); }
.pill.ok { background: #e2f5eb; color: var(--ok); }
.pill.warn { background: #fff1d6; color: #9a6400; }
.pill.bad { background: #fde6e6; color: var(--danger); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c5cbd6; }
.dot.on { background: var(--ok); }

.mobile-only { display: none; }
@media (max-width: 820px) {
  #sidebar { width: 100%; }
  #app.in-room #sidebar { display: none; }
  #app:not(.in-room) #main { display: none; }
  #panel { position: fixed; inset: 0; width: auto; z-index: 30; }
  .mobile-only { display: inline-block; }
}

/* Hospital identity and workspace surfaces */
:root {
  --navy:#214e78; --navy-2:#304458; --navy-3:#3e556d;
  --mid:#4F7BA6; --mid-weak:#DCE6F0;
  --accent:#214e78; --accent-weak:var(--mid-weak); --ink:#1e2a36; --ink-2:#46617d;
  --line:#d3dce6; --bg:#f0f3f6; --unread:#805b13;
}
.screen {background:radial-gradient(ellipse at 15% 10%,#dde4ec,transparent 52%),#eaeef3}
.card {border:1px solid #d0dae4;border-radius:22px;box-shadow:0 14px 48px #23364915}
.center-card {width:min(410px,100%)}
.center-card h1 {font-size:25px;letter-spacing:-.05em;margin:15px 0 10px}
.clinic-brand {display:flex;align-items:center;gap:12px}
.clinic-brand img {width:40px;height:40px}
.clinic-brand strong {font-family:inherit;font-size:18px;letter-spacing:-.05em}
.clinic-brand small {display:block;font-size:11px;letter-spacing:.1em;margin-top:3px;color:#cfd9e4}
.select-card .clinic-brand {margin-bottom:20px}
.tile.fav {border-color:#bbc9d8;background:#f1f4f7}
#app {height:100dvh}
#sidebar {width:272px;color:#eef2f6}
#sidebar .clinic-brand {padding:21px 18px 17px;color:#fff}
#sidebar .clinic-brand img {background:#edf1f6;border-radius:13px;padding:6px}
.side-head {margin:0 12px;padding:10px 12px;background:var(--navy-2);border:1px solid #425b75;border-radius:12px}
.seat-name,.me-btn .sub,.side-section,.side-section .icon-btn,.side-foot button {color:#d2dbe5}
.me-btn {padding:2px 0;background:transparent}
#room-filter {margin:12px 12px 0;border:1px solid #47627f;background:#213244;color:white;padding:9px 12px}
#room-filter::placeholder {color:#c6d2df}
.side-section {font-weight:700;padding:16px 18px 5px}
.room-list li {min-height:36px;color:#e0e7ee;padding:7px 12px}
.room-list li.active {background:var(--mid-weak);color:#202f3e;box-shadow:inset 3px 0 var(--mid)}
.room-list li.active.unread {color:#202f3e}
.room-list .muted {color:inherit}
.room-list .list-empty {color:#beccda;font-size:12px;cursor:default}
.badge,.badge.quiet {background:#a63c41;color:#fff}
.badge.at {background:#f1cd81;color:#433309}
#room-head {padding:12px 18px;min-height:66px}
.room-brand {width:36px;height:36px;background:#ebeff4;padding:6px;border-radius:11px}
#room-name {font-size:18px;letter-spacing:-.035em}
.head-actions .icon-btn {min-width:32px;min-height:34px}
.messages,.typing {background:#f0f3f6}
.messages {padding:12px 0}
.msg {padding:4px clamp(10px,2vw,30px)}
.msg.mentioned {background:var(--mention)}
.msg .bubble {background:#fff;border:1px solid #d6dfe8;box-shadow:0 1px 2px #2939490a;padding:8px 13px}
.msg.outgoing .bubble {background:#ffeb94;border-color:#eedb89}
.msg .meta {margin-bottom:4px}
.day-sep span {display:inline-block;background:#dfe6ed;color:#374d63;font-weight:600;padding:4px 12px}
#composer {background:#fff;padding:12px 16px}
.compose-row {align-items:center;border:1px solid var(--line);background:#f7f8fa;border-radius:15px;padding:5px}
.compose-row:focus-within {border-color:var(--mid);box-shadow:0 0 0 2px var(--mid-weak)}
#input {min-width:0;border:0;background:transparent;outline:none}
#send-btn {border-radius:10px;padding:9px 15px}
.admin-card {border-color:#d0dae5;border-radius:15px;box-shadow:0 1px 4px #25354608;overflow-x:auto}
@media(max-width:820px){#sidebar{width:100%}#room-head{padding:8px;gap:4px}#room-name{font-size:16px}.head-actions{gap:0}.room-brand{width:28px;height:28px}.head-actions .icon-btn{min-width:29px;padding:4px}#composer{padding:8px}.admin-head{flex-wrap:wrap}.tabs{overflow-x:auto;max-width:100%}}
@media(max-height:650px){.screen{align-items:flex-start}#sidebar .clinic-brand{padding-block:10px}}

.room-grip { display:inline-block; cursor:grab; user-select:none; color:var(--accent); padding:4px 8px; margin-right:4px; font-size:18px; }
.room-grip:active { cursor:grabbing; }
table.grid .drop-before td { box-shadow:inset 0 3px var(--accent); }
table.grid .drop-after td { box-shadow:inset 0 -3px var(--accent); }
#room-order-lock[aria-pressed="true"] { color:var(--accent); background:var(--accent-weak); border-color:var(--accent); }

button, .badge, .pill { white-space: nowrap; }
.badge, .pill, .head-actions, #composer { flex-shrink: 0; }
#sidebar { position: relative; }
#sidebar .clinic-brand { height: 66px; flex: none; padding: 10px 17px; gap: 9px; }
.brand-badge { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: white; color: var(--navy); }
.brand-badge svg { width: calc(100% - 4px); height: calc(100% - 4px); }
.card .clinic-brand { justify-content: center; color: var(--navy); }
.card .brand-badge { border: 1px solid var(--mid-weak); }
.clinic-brand small { letter-spacing: normal; font-size: 12px; margin: 0; }
#menu-toggle { margin-left: auto; color: white; font-size: 20px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #0002; border-color: #ffffff36; font-size: 13px; }
#room-filter { background: #0002; border-color: #ffffff48; }
#side-seat, #worker-name, #room-name, .tile .t-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#staff-menu { position: absolute; z-index: 32; left: 12px; top: 52px; width: min(328px, calc(100vw - 24px)); max-height: calc(100% - 62px); overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); box-shadow: 0 10px 30px #0003; font-size: 13px; }
#staff-menu section { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#staff-menu h3 { margin: 0 0 6px; font-size: 14px; }
#staff-menu small { font-size: 12px; color: var(--ink-2); font-weight: normal; }
#staff-menu > section > label, .menu-line { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 4px 0; }
#staff-menu select { max-width: 65%; }
#device-volume { width: 90px; margin-left: auto; }
#volume-value { width: 34px; text-align: right; }
summary { cursor: pointer; }
#staff-menu details { margin-top: 6px; }
#seat-sound-settings { margin-top: 10px; }
.room-list { padding: 0 12px; }
.room-list li { min-height: 42px; padding: 9px 12px; font-weight: 600; }
.badge { min-width: 18px; line-height: 18px; text-align: center; }
#room-head { height: 66px; flex: none; background: var(--navy); color: white; border-bottom: 2px solid #a5b7ca; }
#room-head .icon-btn { color: white; }
.head-actions .icon-btn span { display: inline-block; filter: brightness(0) invert(1); }
#room-topic { color: rgb(255 255 255 / 70%); }
.messages { padding: 14px 0; }
.msg { padding: 6px 22px; gap: 8px; }
.msg .meta { font-size: 12px; }
.msg.outgoing .bubble { border-color: transparent; }
.panel-body { overflow-wrap: anywhere; padding: 17px; }
input, select, textarea, .field, .admin-field { max-width: 100%; min-width: 0; }
.admin-field, #code-form, #setup-form { display: grid; gap: 5px; }
#code-form, #setup-form { gap: 8px; text-align: left; }
.code-form { flex-direction: column; margin: 0; }
.code-form input { text-align: left; font-size: inherit; letter-spacing: normal; }
.code-form button { min-height: 40px; }
.center-card, .select-card { width: min(355px, 100%); padding: 25px; }
.tiles { grid-template-columns: repeat(2,minmax(0,1fr)); }
.tile .t-name { max-width: 100%; }
.pinpad { grid-template-columns: repeat(3,minmax(0,1fr)); }
.screen { background: var(--bg); }
@media (820px < width < 1100px) {
  #panel { position: absolute; inset: 0 0 0 auto; z-index: 30; box-shadow: -10px 0 26px #12282028; }
}
@media (max-width: 820px) {
  .tabs { flex-wrap: wrap; }
  .admin-body { padding: 10px; }
  table.grid, table.grid tbody, table.grid tr, table.grid td { display: block; }
  table.grid tr:has(th) { display: none; }
  table.grid tr { border: 1px solid var(--line); margin-bottom: 10px; padding: 6px; border-radius: 8px; }
  table.grid td { border: 0; overflow-wrap: anywhere; }
  table.grid td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
}
@media (max-width: 480px) {
  .brand-badge { width: 32px; height: 32px; }
  button, summary, select, input:not([type=checkbox],[type=radio]), .opt, .attach, .room-list li { min-height: 44px; }
  .icon-btn, .head-actions .icon-btn, .attach, .actions button { min-width: 44px; min-height: 44px; }
  .attach, summary { align-content: center; }
  .typing:empty { height: 0; }
  .actions .emoji-pick { flex-wrap: wrap; }
  .room-list li, .msg { padding-inline: 12px; }
  #room-head { gap: 2px; padding-inline: 4px; }
  #back-btn { font-size: 30px; }
  #staff-menu { right: 12px; left: auto; }
  .msg .actions { max-width: calc(100% - 16px); flex-wrap: wrap; right: 8px; }
  .screen { padding: 12px; }
  .tabs button { padding-inline: 8px; }
}

#room-filter:focus { border-color: var(--mid); }
.msg-menu { border: 0; background: transparent; padding: 0 4px; line-height: 1; }
.msg.menu-open .actions { display: flex; }
.msg .unread-n, .msg-menu { min-height: 0; }
button, summary, .attach, .room-list li[data-id], .search-hit, .mention-pop li {
  transition: background-color 140ms, border-color 140ms, color 140ms, filter 140ms, transform 140ms;
}
:where(button, summary, [role=button], .file-card):focus-visible, .attach:focus-within {
  outline: 2px solid var(--mid);
  outline-offset: 2px;
}
@media (hover: hover) {
  button:not(:disabled, .primary, .unread-n):hover, summary:hover, .attach:hover,
  .room-list li[data-id]:hover, .mention-pop li:hover, .search-hit:hover {
    background-color: var(--mid-weak);
    color: var(--accent);
  }
  #sidebar .icon-btn:hover, #room-head .icon-btn:hover { background: var(--mid-weak); color: var(--accent); }
  .head-actions .icon-btn:hover span { filter: grayscale(1) brightness(.35); }
  button.primary:not(:disabled):hover, .unread-n:hover { filter: brightness(1.08); }
  .msg:not(.mentioned):hover { background: #e7ecf2; }
  .msg:hover .hover-time { visibility: visible; }
  .msg:hover .actions, .msg .actions:focus-within { display: flex; }
  .file-card:hover { border-color: var(--mid); }
}
button:not(:disabled):active, summary:active, .attach:active { transform: scale(.97); filter: brightness(.92); }
.room-list li[data-id]:active, .search-hit:active, .mention-pop li:active {
  background: color-mix(in srgb, var(--mid-weak) 75%, var(--mid));
  color: var(--accent);
}

#list-splitter { display: none; }
@media (min-width: 821px) {
  #sidebar { width: min(var(--list-width, 272px), 50%); min-width: 240px; flex-shrink: 1; }
  #main { min-width: 360px; }
  #list-splitter { display: block; flex: 0 0 6px; cursor: col-resize; touch-action: none; }
  #list-splitter:is(:hover, :focus-visible), #app.resizing-list #list-splitter {
    background: linear-gradient(var(--mid), var(--mid)) center / 2px 100% no-repeat;
  }
  #app.resizing-list, #app.resizing-list * { user-select: none; cursor: col-resize; }
}
