/* The team inbox: a familiar messaging layout. No external fonts or images: everything is local, the CSP allows nothing else. */
:root {
  --bg: #e9efec; --panel: #ffffff; --header: #ffffff; --hover: #f4f7f5; --selected: #eaf0ed; --line: #e6ece8; --sep: #f0f3f1;
  --text: #111b21; --muted: #667a72; --accent: #12b76a; --accent-dark: #0e9f5c; --accent-text: #ffffff;
  --bubble-out: #d3f4c9; --bubble-in: #ffffff; --wallpaper: var(--wp-base); --tick: #53bdeb; --danger: #ea0038; --warn: #fff3cd; --warn-text: #5c4400;
  --shadow: 0 1px 0.5px rgba(11, 20, 26, .13); --input: #f0f3f1; --chip: #f0f3f1; --chip-on: #12b76a; --chip-on-text: #ffffff;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #060d0b; --panel: #0a1210; --header: #0a1210; --hover: #101b18; --selected: #1b2724; --line: #1d2b27; --sep: #0f1a17; --text: #e9efec; --muted: #8da19b; --accent: #1fcb67; --accent-dark: #1fcb67; --bubble-out: #0c5a45; --bubble-in: #1b2724; --wallpaper: var(--wp-base); --tick: #53bdeb; --warn: #3a3320; --warn-text: #f5d97a; --shadow: 0 1px 0.5px rgba(11, 20, 26, .5); --input: #1b2724; --chip: #1b2724; --chip-on: #1fcb67; --chip-on-text: #04210f; } }
:root[data-theme="dark"] { --bg: #060d0b; --panel: #0a1210; --header: #0a1210; --hover: #101b18; --selected: #1b2724; --line: #1d2b27; --sep: #0f1a17; --text: #e9efec; --muted: #8da19b; --accent: #1fcb67; --accent-dark: #1fcb67; --bubble-out: #0c5a45; --bubble-in: #1b2724; --wallpaper: var(--wp-base); --tick: #53bdeb; --warn: #3a3320; --warn-text: #f5d97a; --shadow: 0 1px 0.5px rgba(11, 20, 26, .5); --input: #1b2724; --chip: #1b2724; --chip-on: #1fcb67; --chip-on-text: #04210f; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
[hidden] { display: none !important; }
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }
svg.i.sm { width: 18px; height: 18px; } svg.i.xs { width: 15px; height: 15px; }

/* ---------- sign-in ---------- */
.login-body { display: grid; place-items: center; min-height: 100%; background: var(--bg); padding: 16px; }
.login-card { background: var(--panel); width: 100%; max-width: 420px; padding: 34px 32px 28px; border-radius: 10px; box-shadow: 0 17px 50px rgba(11, 20, 26, .2); }
.login-logo { width: 62px; height: 62px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin: 0 auto 14px; }
.login-card h1 { font-size: 22px; font-weight: 500; margin: 0 0 6px; text-align: center; }
.login-card .muted { text-align: center; margin: 0 0 18px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 168, 132, .18); }
.login-card button { width: 100%; margin-top: 22px; padding: 12px; border: 0; border-radius: 24px; background: var(--accent); color: #fff; font-weight: 600; }
.login-card button:hover { background: var(--accent-dark); }
.login-error { background: #fdecef; color: #b00020; padding: 10px 12px; border-radius: 8px; margin: 0 0 6px; text-align: left !important; }
@media (prefers-color-scheme: dark) { .login-error { background: #3b1a21; color: #ff8a9b; } }

/* ---------- shell ---------- */
#app { height: 100%; display: flex; max-width: 1700px; margin: 0 auto; background: var(--panel); box-shadow: 0 6px 18px rgba(11, 20, 26, .05); }
@media (min-width: 1500px) { body { padding: 19px 0; } #app { height: calc(100% - 0px); } }
.rail { width: 64px; background: var(--header); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; flex: none; }
.rail button { position: relative; width: 46px; height: 46px; border: 0; background: none; color: var(--muted); border-radius: 50%; display: grid; place-items: center; }
.rail button:hover { background: var(--selected); }
.rail button.on { background: var(--selected); color: var(--text); }
.rail .spacer { flex: 1; }
.rail .badge-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.avatar { position: relative; overflow: hidden; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 16px; flex: none; text-transform: uppercase; user-select: none; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; } .avatar.sm { width: 32px; height: 32px; font-size: 13px; }

.view { flex: 1; min-width: 0; display: flex; }
.col-list { width: 410px; max-width: 42%; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 300px; background: var(--panel); }
.col-head { height: 66px; background: var(--header); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; flex: none; }
.col-head h2 { margin: 0; font-size: 28px; font-weight: 700; }
.fab { border: 0; background: var(--accent); color: #fff; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.fab:hover { background: var(--accent-dark); }
.icon-btn { border: 0; background: none; color: var(--muted); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover { background: var(--selected); color: var(--text); }
.search { padding: 8px 12px 6px; background: var(--panel); flex: none; }
.search label { display: flex; align-items: center; gap: 14px; background: var(--chip); border-radius: 8px; padding: 0 12px; height: 35px; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; min-width: 0; }
.chips { display: flex; gap: 6px; padding: 4px 12px 8px; overflow-x: auto; flex: none; scrollbar-width: none; }
.chip { border: 0; background: var(--chip); color: var(--muted); border-radius: 16px; padding: 5px 12px; white-space: nowrap; font-size: 13.5px; }
.chip.on { background: var(--chip-on); color: var(--chip-on-text); font-weight: 600; }
.chip .n { margin-left: 6px; font-weight: 700; font-size: 12px; background: rgba(18, 183, 106, .18); color: var(--accent); border-radius: 9px; padding: 0 6px; display: inline-block; min-width: 18px; text-align: center; }
.chip.on .n { background: rgba(255, 255, 255, .28); color: inherit; }
.list { flex: 1; overflow-y: auto; }
.row { display: flex; gap: 13px; padding: 0 15px; align-items: center; height: 72px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.row:hover { background: var(--hover); } .row.on { background: var(--selected); }
.row .mid { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.row:last-child .mid { border-bottom: 0; }
.row .top, .row .bot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row .name { font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { font-size: 12px; color: var(--muted); flex: none; } .row.unread .time { color: var(--accent); font-weight: 600; }
.row .prev { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 3px; min-width: 0; }
.row .prev span { overflow: hidden; text-overflow: ellipsis; }
.row .tags { display: flex; gap: 6px; align-items: center; flex: none; }
.pill { background: var(--accent); color: #fff; border-radius: 12px; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.pill.warn { background: #f59f00; } .pill.grey { background: var(--muted); }
.tick { color: var(--muted); display: inline-flex; } .tick.read { color: var(--tick); } .tick.failed { color: var(--danger); }
.empty { padding: 36px 24px; text-align: center; color: var(--muted); }
.more { padding: 14px; text-align: center; }
.more button { border: 0; background: none; color: var(--accent-dark); }

/* ---------- conversation ---------- */
.col-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--wp-base); position: relative; border-bottom: 6px solid var(--accent); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); max-width: 420px; padding: 24px; }
.chat-empty h3 { font-weight: 300; font-size: 30px; color: var(--text); margin: 18px 0 10px; }
.chat-empty .logo { width: 88px; height: 88px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin: 0 auto; color: #fff; }
.chat-head { height: 59px; background: var(--header); display: flex; align-items: center; gap: 13px; padding: 0 12px 0 16px; flex: none; cursor: pointer; }
.chat-head .who { flex: 1; min-width: 0; } .chat-head .t { font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 6% 8px; display: flex; flex-direction: column; gap: 2px; background-color: var(--wp-base); background-image: var(--wp-image); background-size: var(--wp-size) var(--wp-size); }
.day { align-self: center; background: var(--panel); color: var(--muted); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); margin: 10px 0; }
.sys { align-self: center; background: var(--warn); color: var(--warn-text); font-size: 12.5px; padding: 5px 12px; border-radius: 8px; margin: 6px 0; max-width: 80%; text-align: center; }
.msg { display: flow-root; max-width: 65%; padding: 6px 7px 7px 9px; border-radius: 7.5px; box-shadow: var(--shadow); position: relative; word-wrap: break-word; overflow-wrap: anywhere; margin-top: 2px; min-width: 70px; }
.msg.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 0; }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 0; }
.msg.first-in::before, .msg.first-out::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.first-in::before { left: -8px; background: var(--bubble-in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg.first-out::before { right: -8px; background: var(--bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg .by { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); margin-bottom: 1px; }
.msg .by.auto { color: #7e57c2; } .msg .by.bot { color: #1976d2; }
.msg .txt { white-space: pre-wrap; font-size: 14.2px; line-height: 19px; }
.msg .meta { float: right; margin: 5px 0 -3px 12px; font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; line-height: 15px; }
.msg.err .meta { color: var(--danger); }
.msg .errline { color: var(--danger); font-size: 12px; margin-top: 3px; }
.msg img.pic { display: block; max-width: 320px; width: 100%; max-height: 340px; object-fit: cover; border-radius: 6px; margin-bottom: 4px; cursor: zoom-in; background: var(--line); min-height: 60px; }
.msg audio { display: block; width: 260px; max-width: 100%; margin-bottom: 4px; }
.file { display: flex; gap: 10px; align-items: center; padding: 10px; background: rgba(0, 0, 0, .05); border-radius: 6px; margin-bottom: 4px; color: inherit; text-decoration: none; }
.file .nm { font-size: 14px; word-break: break-all; } .file .sz { font-size: 12px; color: var(--muted); }
.tpl { font-style: italic; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.closed-bar { background: var(--header); padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex: none; font-size: 13.5px; }
.closed-bar .grow { flex: 1; }
.composer { background: var(--header); padding: 8px 14px; display: flex; gap: 10px; align-items: flex-end; flex: none; }
.composer textarea { flex: 1; resize: none; border: 0; outline: 0; border-radius: 8px; background: var(--input); padding: 10px 12px; max-height: 140px; min-height: 42px; line-height: 20px; font-size: 15px; }
.send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { opacity: .45; cursor: default; }
.btn { border: 0; background: var(--accent); color: #fff; border-radius: 20px; padding: 8px 18px; font-weight: 600; }
.btn:hover { background: var(--accent-dark); } .btn.ghost { background: var(--chip); color: var(--text); } .btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #111b21; color: #fff; padding: 11px 18px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); z-index: 90; max-width: 90vw; }
.toast.bad { background: #b00020; }

/* ---------- side panel and menus ---------- */
.col-info { width: 360px; max-width: 100%; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; flex: none; overflow-y: auto; }
.col-info .col-head { justify-content: flex-start; gap: 14px; }
.card { background: var(--panel); padding: 14px 20px; border-bottom: 8px solid var(--sep); }
.card h4 { margin: 0 0 8px; font-weight: 400; color: var(--muted); font-size: 14px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 20px 18px; border-bottom: 8px solid var(--sep); }
.hero .nm { font-size: 22px; text-align: center; } 
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; } .kv span:first-child { color: var(--muted); }
.history { list-style: none; margin: 0; padding: 0; font-size: 13px; } .history li { padding: 4px 0; color: var(--muted); }
.menu { position: fixed; background: var(--panel); border-radius: 8px; box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16); padding: 8px 0; z-index: 80; min-width: 190px; }
.menu button { display: flex; width: 100%; gap: 12px; align-items: center; padding: 10px 22px; border: 0; background: none; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.modal-back { position: fixed; inset: 0; background: rgba(11, 20, 26, .55); z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 10px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 17px 50px rgba(11, 20, 26, .3); }
.modal.wide { max-width: 760px; }
.modal h3 { margin: 0; padding: 18px 22px 6px; font-weight: 500; font-size: 19px; }
.modal .body { padding: 8px 22px 6px; } .modal .foot { padding: 14px 22px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 95; display: grid; place-items: center; }
.viewer img { max-width: 94vw; max-height: 92vh; }
.field { margin: 10px 0; } .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.check input { margin-top: 3px; }
.tplbox { background: var(--wallpaper); padding: 12px; border-radius: 8px; margin: 8px 0; }
.tplbox .msg { max-width: 100%; align-self: auto; }

/* ---------- manager screens ---------- */
.page { flex: 1; min-width: 0; overflow-y: auto; background: var(--sep); }
.page-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 600; flex: 1; }
.page-body { padding: 18px 24px 40px; max-width: 1100px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 4px; font-size: 16px; } .panel p.muted { margin: 0 0 10px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.stat { background: var(--panel); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-size: 26px; font-weight: 600; } .stat .l { color: var(--muted); font-size: 13px; }
.bar { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 8px 0; } .bar i { display: block; height: 100%; background: var(--accent); }
.bar.warn i { background: #f59f00; } .bar.bad i { background: var(--danger); }
table.t { width: 100%; border-collapse: collapse; } table.t th { text-align: left; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; } table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--hover); }
.tag { display: inline-block; background: var(--chip); border-radius: 10px; padding: 1px 9px; font-size: 12px; margin: 1px 3px 1px 0; }
.status { display: inline-block; border-radius: 10px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--chip); }
.status.running { background: var(--chip-on); color: var(--chip-on-text); } .status.paused { background: var(--warn); color: var(--warn-text); } .status.done { background: var(--chip); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
.days { display: grid; grid-template-columns: 70px 1fr 1fr 40px; gap: 8px; align-items: center; margin: 4px 0; }
.rule { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.chart { width: 100%; height: 170px; } .chart rect.in { fill: #8696a0; } .chart rect.out { fill: var(--accent); } .chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* ---------- small screens: one pane at a time ---------- */
@media (max-width: 900px) {
  #app { flex-direction: column-reverse; }
  .rail { width: 100%; height: 56px; flex-direction: row; justify-content: space-around; padding: 0 6px; border-right: 0; border-top: 1px solid var(--line); }
  .rail .spacer { display: none; }
  .view { flex-direction: column; min-height: 0; }
  .col-list { width: 100%; max-width: 100%; border-right: 0; flex: 1; min-height: 0; }
  .col-chat { position: absolute; inset: 0 0 56px 0; z-index: 20; border-bottom: 0; }
  body.no-chat .col-chat { display: none; } body:not(.no-chat) .col-list { display: none; }
  .back { display: grid; }
  .col-info { position: absolute; inset: 0 0 56px 0; width: 100%; z-index: 30; border-left: 0; }
  .msgs { padding: 10px 10px 6px; } .msg { max-width: 86%; }
  .page-body { padding: 12px 12px 30px; }
  .days { grid-template-columns: 56px 1fr 1fr 34px; }
}

.page-head select, .page-head input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
.chat-head .t bdi, .row .name bdi { unicode-bidi: isolate; }
.closed-bar .why { color: var(--muted); }
.btn.sm { padding: 4px 10px; font-size: 13px; } td.acts { text-align: right; } td.acts .btn { margin-left: 6px; margin-top: 2px; margin-bottom: 2px; }
.pill.on { background: #1fa855; padding: 0 9px; white-space: nowrap; } .warn-text { color: var(--danger); }
.pill.clock { background: #f59f00; gap: 3px; padding: 0 7px; white-space: nowrap; }
.composer { position: relative; }
.quick-suggest { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 4px); background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.18); max-height: 260px; overflow: auto; z-index: 5; padding: 4px; }
.quick-suggest button, .quick-list .qrow { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: none; color: inherit; border-radius: 8px; cursor: pointer; }
.quick-suggest button:hover, .quick-list .qrow:hover { background: var(--hover); }
.quick-suggest span, .quick-list .qrow span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.quick-list { max-height: 340px; overflow: auto; margin: 8px 0; }
.note-card { align-self: center; max-width: min(560px, 88%); background: #fff7cc; color: #3d3200; border: 1px solid #f0dc82; border-radius: 10px; padding: 8px 12px; margin: 6px auto; font-size: 14px; }
[data-theme="dark"] .note-card { background: #4a4119; color: #fdf3c4; border-color: #6e6027; }
.note-card .nh { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .8; margin-bottom: 4px; }
.note-card .nh span { flex: 1; } .note-card .nt { white-space: pre-wrap; word-break: break-word; }
.icon-btn.xs { width: 22px; height: 22px; padding: 0; }
.list .sect { padding: 10px 16px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.list mark { background: #ffe58a; color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] .list mark { background: #6e6027; }
.keybox { font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: .08em; background: var(--chip); padding: 10px 12px; border-radius: 8px; user-select: all; word-break: break-all; }
.chips { flex-wrap: wrap; overflow-x: visible; }
.pill.clock { display: inline-flex; align-items: center; }

.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- voice, photo, choices, links ---------- */
.voice { display: flex; align-items: center; gap: 8px; min-width: 250px; padding: 2px 0; }
.voice audio { display: none; }
.vplay { border: 0; background: none; color: var(--muted); width: 34px; height: 36px; display: grid; place-items: center; padding: 0; }
.vplay svg { width: 28px; height: 28px; }
.vmid { flex: 1; min-width: 0; }
.bars { display: flex; align-items: center; gap: 2px; height: 24px; cursor: pointer; }
.bars i { display: block; width: 3px; border-radius: 2px; background: var(--muted); opacity: .45; }
.bars i.on { background: var(--accent); opacity: 1; }
.vt { font-size: 11.5px; color: var(--muted); }
.vwho { position: relative; width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.vwho.out { border-radius: 50%; background: rgba(18, 183, 106, .18); color: var(--accent); }
.vwho .avatar { width: 38px; height: 38px; }
.vmic { position: absolute; left: -2px; bottom: -2px; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.vmic svg { width: 11px; height: 11px; }
.msg.has-img { padding: 3px; }
.msg.has-img .by, .msg.has-img .txt, .msg.has-img .errline { padding-left: 6px; padding-right: 6px; }
.msg.has-img .meta { margin-right: 6px; margin-bottom: 1px; }
.picwrap { position: relative; display: block; line-height: 0; }
.picwrap img.pic { margin: 0; border-radius: 6px; max-width: 330px; }
.msg.has-img .picwrap + .txt { margin-top: 4px; }
.meta.onimg { position: absolute; right: 6px; bottom: 6px; float: none; margin: 0; padding: 2px 8px; background: rgba(0, 0, 0, .4); color: #fff; border-radius: 10px; line-height: 15px; }
.meta.onimg .tick { color: rgba(255, 255, 255, .85); } .meta.onimg .tick.read { color: var(--tick); }
.choices .opts { display: flex; flex-direction: column; gap: 5px; margin: 7px 0 2px; }
.choices .opt { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, .55); color: var(--accent-dark); font-weight: 600; font-size: 13.5px; }
[data-theme="dark"] .choices .opt { background: rgba(0, 0, 0, .25); color: var(--accent); }
.msg .txt a { color: #027eb5; text-decoration: underline; word-break: break-all; }
[data-theme="dark"] .msg .txt a { color: #53bdeb; }
.meta .starmark { display: inline-flex; color: var(--muted); }
.msg .chev { position: absolute; top: 2px; right: 3px; width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; display: none; place-items: center; background: var(--bubble-in); color: var(--muted); }
.msg.out .chev { background: var(--bubble-out); }
.msg:hover .chev, .msg .chev:focus-visible { display: grid; }
@media (hover: none) { .msg .chev { display: grid; opacity: .7; } }
.row { position: relative; }
.row .rchev { position: absolute; right: 12px; bottom: 8px; width: 22px; height: 22px; border: 0; padding: 0; border-radius: 50%; display: none; place-items: center; background: var(--selected); color: var(--muted); }
.row:hover .rchev { display: grid; } .row:hover .tags .pill:not(.clock) { visibility: hidden; }

/* ---------- composer extras, dialogs, panels ---------- */
.composer.recording { align-items: center; }
.composer.recording .rtime { font-variant-numeric: tabular-nums; min-width: 38px; }
.composer.recording .rnote { flex: 1; }
.rdot { width: 11px; height: 11px; border-radius: 50%; background: #ea0038; animation: rdot 1s infinite; flex: none; }
.rdot.done { animation: none; background: var(--muted); }
@keyframes rdot { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .rdot { animation: none; } }
.preview-pic { display: block; max-width: 100%; max-height: 52vh; margin: 0 auto 8px; border-radius: 8px; }
.optlist { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.optrow { display: flex; gap: 6px; align-items: center; width: 100%; } .optrow input { flex: 1; }
.keybox-like { word-break: break-all; margin-top: 6px; }
.stabs { display: flex; gap: 4px; padding: 8px 12px; flex: none; }
.stab { flex: 1; border: 0; background: var(--chip); color: var(--muted); border-radius: 16px; padding: 6px 4px; font-size: 13px; white-space: nowrap; }
.stab.on { background: var(--accent); color: #fff; font-weight: 600; }
.sbody { padding: 4px 14px 24px; overflow-y: auto; flex: 1; }
.sbucket { margin: 14px 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.shead { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 6px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; }
.sgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.sgrid .thumb { aspect-ratio: 1; border: 0; padding: 0; background: var(--chip); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.sgrid .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.linkrow { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; align-items: flex-start; }
.linkrow .lk { color: #027eb5; word-break: break-all; font-size: 14px; } [data-theme="dark"] .linkrow .lk { color: #53bdeb; }
.linkrow .sz { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sbody .file { margin: 0 0 6px; }
.starrow { padding: 10px 0; border-bottom: 1px solid var(--line); } .starrow .when { font-size: 12px; color: var(--muted); } .starrow .txt.mine { color: var(--accent-dark); }
.navs { padding: 4px 8px; }
.navrow { display: flex; gap: 14px; align-items: center; width: 100%; border: 0; background: none; padding: 12px; text-align: left; border-radius: 8px; color: inherit; }
.navrow:hover { background: var(--hover); } .navrow svg { color: var(--accent); }
.warn-text { color: var(--danger); }
.card .btn + .btn { margin-left: 8px; }

.login-logo-img { display: block; width: 240px; max-width: 72%; height: auto; margin: 4px auto 10px; }
.login-card h1.login-tag { font-size: 16px; font-weight: 500; color: var(--muted); margin: 0 0 16px; }
.chat-empty .brand-logo { display: block; width: 260px; max-width: 70%; height: auto; margin: 0 auto; }
.chat-empty h3 { font-size: 20px; }
.rail-logo { width: 36px; height: 36px; border-radius: 9px; margin: 2px 0 10px; flex: none; }
@media (max-width: 900px) { .rail-logo { display: none; } }
.pill.bad { background: var(--danger); padding: 0 9px; white-space: nowrap; } .pill.warn, .pill.grey { padding: 0 9px; white-space: nowrap; }
.tpl-prev { background: var(--chip); border-radius: 12px; padding: 10px 12px; max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; display: grid; gap: 6px; }
.tpl-prev .tpl-h { font-weight: 700; } .tpl-prev .tpl-f { font-size: 12px; color: var(--muted); }
.tpl-prev .tpl-b { border-top: 1px solid var(--muted); padding-top: 6px; text-align: center; color: var(--accent); font-weight: 600; }
