/* Building Portal - base styles. Light/dark via [data-theme], text size via html font-size */
:root, [data-theme="light"] {
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #f0efea; --border: #dedcd4; --text: #1f1e1b; --muted: #66645d; --faint: #94918a;
  --primary: #0f6e6e; --primary-hover: #0b5858; --primary-soft: #dcefee; --on-primary: #ffffff;
  --danger: #b3261e; --danger-soft: #fbe4e2; --warn: #9a5b00; --warn-soft: #fdf0d6; --ok: #2e7d32; --ok-soft: #e3f3e4; --info: #2f5fa8; --info-soft: #e3ecfa;
  --shadow: 0 1px 2px rgba(20, 20, 15, .06), 0 2px 8px rgba(20, 20, 15, .05); --radius: 10px; --radius-sm: 6px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #151614; --surface: #1d1f1c; --surface-2: #262825; --border: #353833; --text: #e8e7e2; --muted: #a6a49c; --faint: #77756e;
  --primary: #4fb3b0; --primary-hover: #6cc6c3; --primary-soft: #1d3735; --on-primary: #0d1716;
  --danger: #f2827a; --danger-soft: #3c1f1c; --warn: #f0b75a; --warn-soft: #3a2d14; --ok: #7fcf86; --ok-soft: #1d3320; --info: #8db4f0; --info-soft: #1d2a40;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #151614; --surface: #1d1f1c; --surface-2: #262825; --border: #353833; --text: #e8e7e2; --muted: #a6a49c; --faint: #77756e;
    --primary: #4fb3b0; --primary-hover: #6cc6c3; --primary-soft: #1d3735; --on-primary: #0d1716;
    --danger: #f2827a; --danger-soft: #3c1f1c; --warn: #f0b75a; --warn-soft: #3a2d14; --ok: #7fcf86; --ok-soft: #1d3320; --info: #8db4f0; --info-soft: #1d2a40;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: none; text-size-adjust: none; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6rem; text-wrap: balance; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--text); padding: .25rem .5rem 1rem; }
.brand svg { flex: none; color: var(--primary); }
.nav-sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 1rem .6rem .3rem; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .95rem; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav .count { margin-left: auto; background: var(--primary); color: var(--on-primary); border-radius: 99px; font-size: .72rem; padding: 0 .45rem; min-width: 1.3rem; text-align: center; }
.nav .count.danger { background: var(--danger); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar form.search { flex: 1; max-width: 460px; }
.topbar .spacer { flex: 1; }
.content { padding: 1.25rem; max-width: 1280px; width: 100%; }
.content.wide { max-width: none; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .content { padding: 1rem; }
  .hide-sm { display: none !important; }
}

/* Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .6rem; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; } .tiny { font-size: .75rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; text-decoration: none !important; min-height: 2.5rem; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: .3rem .65rem; min-height: 2rem; font-size: .85rem; }
.btn.icon { padding: .45rem; min-width: 2.5rem; }
form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
label.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; cursor: pointer; }
label.check input { margin-top: .3rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; min-height: 2.6rem; }
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }
input[type=file] { font: inherit; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.badge.owner { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.renter { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.resident { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.role { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.danger, .badge.emergency { background: var(--danger); color: #fff; border-color: transparent; }
.badge.high { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.ok, .badge.approved, .badge.resolved, .badge.confirmed, .badge.done, .badge.paid, .badge.updated { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.pending, .badge.waiting, .badge.new, .badge.open, .badge.under_review { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.in_progress, .badge.scheduled, .badge.planned { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.denied, .badge.rejected, .badge.cancelled, .badge.void, .badge.failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.info { background: var(--info-soft); color: var(--info); }
.alert.urgent { background: var(--danger); color: #fff; font-weight: 600; } .alert.urgent a { color: #fff; text-decoration: underline; }

table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
table.t tr:hover td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap table.t tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .55rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.empty { color: var(--faint); font-size: .9rem; padding: .5rem 0; }

.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; object-fit: cover; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; font-size: .9rem; }
.avatar.lg { width: 5rem; height: 5rem; font-size: 1.6rem; }
.person { display: inline-flex; align-items: center; gap: .5rem; }
.person .who { display: flex; flex-direction: column; line-height: 1.25; }
.person .who .meta { font-size: .78rem; color: var(--muted); }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

.prose { max-width: 72ch; } .prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose blockquote { border-left: 3px solid var(--border); margin: 0 0 .8rem; padding-left: .8rem; color: var(--muted); }
.prose pre, .prose code { background: var(--surface-2); border-radius: 4px; padding: .1rem .3rem; }
.prose table { border-collapse: collapse; } .prose td, .prose th { border: 1px solid var(--border); padding: .3rem .5rem; }

.kpi { display: flex; flex-direction: column; gap: .15rem; }
.kpi .v { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; }
.kpis .kpi { background: var(--surface-2); border-radius: var(--radius-sm); padding: .7rem .8rem; }

.post { display: grid; grid-template-columns: auto 1fr; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.post:last-child { border-bottom: 0; }
.post.hidden { opacity: .55; }

/* Dashboard tiles */
.grid-stack { margin: 0 -5px; }
.grid-stack-item-content.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .8rem 1rem; overflow: auto !important; inset: 5px !important; }
.tile h3 { display: flex; align-items: center; gap: .4rem; font-size: 1rem; margin-bottom: .5rem; }
.tile h3 .tile-actions { margin-left: auto; display: flex; gap: .2rem; }
.tile-drag { cursor: move; color: var(--faint); }
.tile.emergency { border: 2px solid var(--danger); }
.tile-hidden-list { display: flex; gap: .4rem; flex-wrap: wrap; }
.dash-edit-off .tile-drag, .dash-edit-off .tile-hide { display: none; }
.dash-edit-off .grid-stack-item > .ui-resizable-handle { display: none !important; }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .5rem; background: var(--surface-2); border-radius: var(--radius); }
.msg { max-width: min(640px, 85%); background: var(--surface); border: 1px solid var(--border); padding: .5rem .75rem; border-radius: 12px; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--primary-soft); border-color: transparent; }
.msg .meta { font-size: .75rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .15rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg img { max-height: 260px; border-radius: 8px; margin-top: .3rem; }
.chat-form { display: flex; gap: .5rem; margin-top: .6rem; align-items: flex-end; flex-wrap: wrap; }
.chat-form textarea { min-height: 2.6rem; height: 2.6rem; flex: 1; min-width: 200px; }

/* Calendar */
.fc { --fc-border-color: var(--border); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: var(--primary-soft); --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--border); --fc-button-text-color: var(--text); --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--border); --fc-button-active-bg-color: var(--primary-soft); --fc-button-active-border-color: var(--primary); --fc-list-event-hover-bg-color: var(--surface-2); }
.fc .fc-toolbar-title { font-size: 1.2rem; }
.fc-event.pending { opacity: .65; border-style: dashed !important; }
.cal-filters { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: middle; }
.ical-box { display: flex; gap: .5rem; } .ical-box input { font-family: ui-monospace, monospace; font-size: .8rem; }

/* Sticker */
.sticker { width: 3.4in; border: 2px dashed var(--text); border-radius: 10px; padding: .25in; text-align: center; background: #fff; color: #000; }
.sticker .code { font: 700 30px/1.1 ui-monospace, Menlo, monospace; letter-spacing: 3px; margin: .3rem 0; }
@media print {
  .sidebar, .topbar, .no-print, .btn { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; } body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 0; padding: 0; }
}

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { justify-content: center; font-size: 1.2rem; }

.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot.on { background: var(--ok); }
.copy-row { display: flex; gap: .5rem; } .copy-row input { font-family: ui-monospace, monospace; font-size: .85rem; }
.pill-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.pill-toggle button { border: 0; background: transparent; color: var(--text); padding: .3rem .7rem; font: inherit; font-size: .85rem; cursor: pointer; }
.pill-toggle button.on { background: var(--primary); color: var(--on-primary); }
.notif-grid td, .notif-grid th { text-align: center; } .notif-grid td:first-child, .notif-grid th:first-child { text-align: left; }
details > summary { cursor: pointer; font-weight: 600; }
.bar { height: .6rem; background: var(--surface-2); border-radius: 99px; overflow: hidden; } .bar > span { display: block; height: 100%; background: var(--primary); }
/* extra helpers */
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.text-danger { color: var(--danger); }
.stat .big { font-size: 1.8rem; font-weight: 700; line-height: 1.2; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }
.dir-card .row { align-items: center; }
.pay-method { border-bottom: 1px solid var(--border); padding: .5rem 0; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: middle; }
.cal-filters { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.sticker-sheet { display: flex; flex-wrap: wrap; gap: .3in; }
.sticker-head { font-weight: 700; font-size: 14px; } .sticker-foot { font-size: 12px; }
.reg-row { border-bottom: 1px solid var(--border); padding: .5rem 0; } .reg-row summary { cursor: pointer; list-style: none; }
.print-only { display: none; } @media print { .print-only { display: block; } }
/* "i" help tips */
.tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.15em; height: 1.15em; margin-left: .3em; border-radius: 50%;
  border: 1.5px solid var(--info); color: var(--info); font: italic 700 .75em/1 Georgia, serif; cursor: help; vertical-align: middle; user-select: none; flex: none; }
.tip:hover, .tip:focus { background: var(--info); color: #fff; outline: none; }
.tip-body { display: none; position: absolute; z-index: 60; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(300px, 80vw);
  padding: .55rem .7rem; border-radius: 8px; background: var(--text); color: var(--bg); font: 400 .85rem/1.4 system-ui, sans-serif; font-style: normal; text-align: left;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); white-space: normal; }
.tip-body::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--text); }
.tip:hover .tip-body, .tip:focus .tip-body, .tip.open .tip-body { display: block; }
.tip-right .tip-body { left: 0; transform: none; } .tip-right .tip-body::after { left: .6em; }
.tip-left .tip-body { left: auto; right: 0; transform: none; } .tip-left .tip-body::after { left: auto; right: .3em; }
@media print { .tip { display: none; } }

/* High contrast theme: black on white, bold outlines (accent forced dark for maximum legibility) */
html[data-theme="contrast"] {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f2f2f2; --border: #000000; --text: #000000; --muted: #1a1a1a; --faint: #333333;
  --primary: #0035a0; --primary-hover: #00226b; --primary-soft: #dfe7ff; --on-primary: #ffffff;
  --danger: #a00000; --danger-soft: #ffe5e5; --warn: #6b3e00; --warn-soft: #fff1d6; --ok: #0a5a0a; --ok-soft: #e1f5e1; --info: #0035a0; --info-soft: #e3ebff;
  --shadow: none; color-scheme: light;
}
html[data-theme="contrast"] a { text-decoration: underline; }
html[data-theme="contrast"] .card, html[data-theme="contrast"] .btn, html[data-theme="contrast"] input, html[data-theme="contrast"] select, html[data-theme="contrast"] textarea { border-width: 2px; border-color: #000; }
html[data-theme="contrast"] .badge { border: 1.5px solid currentColor; }

/* Branding */
.brand-logo { max-height: 36px; max-width: 170px; width: auto; display: block; object-fit: contain; }
.brand-auth { justify-content: center; } .brand-auth .brand-logo { max-height: 56px; max-width: 240px; }
.logo-preview { width: 220px; height: 100px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; padding: .5rem; background: var(--surface-2); }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.auth-wrap { position: relative; } .auth-theme { position: absolute; top: 1rem; right: 1rem; }

/* Color swatches */
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin: .25rem 0 .5rem; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 84px; padding: .45rem .25rem; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); text-align: center; }
.swatch input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.swatch .sw { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); }
.swatch input[type="color"] { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.swatch .sw-l { font-size: .78rem; line-height: 1.2; color: var(--muted); }
.swatch:has(input[type="radio"]:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.swatch:has(input[type="radio"]:checked) .sw-l { color: var(--text); font-weight: 600; }
.swatch:has(input[type="radio"]:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.preview-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: .3rem 0; border-bottom: 1px solid var(--border); } ul.plain li:last-child { border: 0; }
.badge.info { background: var(--info-soft); color: var(--info); }
/* "View as" banner */
.imp-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .6rem .9rem; margin-bottom: 1rem; border-radius: var(--radius); background: #5b2a86; color: #fff; font-size: .92rem; position: sticky; top: .5rem; z-index: 40; box-shadow: var(--shadow); }
.imp-bar span { flex: 1; min-width: 200px; } .imp-bar form { margin: 0; }
.imp-bar .btn { background: #fff; color: #3b1a59; border-color: #fff; font-weight: 600; }
/* Emoji + GIF picker */
.emo-bar { display: flex; gap: .35rem; margin: .3rem 0 0; flex-wrap: wrap; }
.chat-form .emo-bar { width: 100%; order: 5; margin: 0; }
.emo-pop { position: fixed; z-index: 80; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: .55rem; display: flex; flex-direction: column; gap: .45rem; max-height: min(380px, 70vh); }
.emo-pop input[type="search"] { width: 100%; }
.emo-tabs { display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: thin; }
.emo-tab { flex: none; font-size: .78rem; padding: .2rem .55rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; }
.emo-tab.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.emo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.3em, 1fr)); gap: .1rem; overflow-y: auto; min-height: 120px; }
.emo { font-size: 1.45em; line-height: 1; padding: .2em; border: 0; background: none; border-radius: 8px; cursor: pointer; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.emo:hover, .emo:focus-visible { background: var(--surface-2); }
.gif-pop { max-height: min(460px, 75vh); }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; overflow-y: auto; min-height: 160px; }
.gif-item { padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--surface-2); cursor: pointer; aspect-ratio: 1; }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-item.busy { opacity: .5; }
.gif-foot { text-align: right; }
.gif-chip { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; width: 100%; }
.gif-chip img { max-height: 90px; border-radius: 6px; }
.msg .body, .post-body { font-family: inherit; }
/* Mentions + clickable names */
.mention-box { position: fixed; z-index: 85; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.2); max-height: 240px; overflow-y: auto; }
.mention-opt { padding: .45rem .65rem; cursor: pointer; display: flex; gap: .3rem; align-items: baseline; flex-wrap: wrap; }
.mention-opt.on, .mention-opt:hover { background: var(--primary-soft); }
a.mention { font-weight: 600; background: var(--primary-soft); color: var(--primary); padding: 0 .25em; border-radius: 4px; text-decoration: none; }
a.mention.me { background: var(--warn-soft); color: var(--warn); }
.mentions-me { box-shadow: inset 3px 0 0 var(--warn); }
.prose.mentions-me { padding-left: .6rem; }
a.who { color: inherit; } a.who:hover { color: var(--primary); text-decoration: underline; }
.msg-del { display: inline; margin: 0 0 0 .25rem; } .btn.xs { font-size: .72rem; padding: .05rem .4rem; min-height: 0; }
.msg .meta .msg-del, .msg .meta a.tiny { opacity: .55; } .msg:hover .meta .msg-del, .msg:hover .meta a.tiny, .msg .meta .msg-del:focus-within { opacity: 1; }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
/* Rich text editor (Word-style toolbar + Visual / Markdown / HTML modes) */
.rich { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.rich:focus-within { outline: 2px solid var(--primary); border-color: var(--primary); }
.rich.busy { opacity: .6; pointer-events: none; }
.rich-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2, var(--bg)); position: sticky; top: 0; z-index: 2; }
.rb { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: 1rem; line-height: 1; }
.rb:hover { background: var(--primary-soft); } .rb.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.rb:focus-visible { outline: 2px solid var(--primary); }
.rb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.rb-sel { height: 32px; padding: 0 6px; font-size: .88rem; width: auto; min-width: 0; border-radius: 6px; }
.rb-color { position: relative; flex-direction: column; } .rb-color span { font-weight: 700; display: flex; flex-direction: column; align-items: center; }
.rb-color i { display: block; width: 16px; height: 4px; border-radius: 2px; margin-top: 1px; }
.rb-color input[type=color] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.rb-modes { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.rb-mode { border: 0; background: none; color: var(--muted); padding: 0 .7rem; height: 30px; cursor: pointer; font: inherit; font-size: .85rem; }
.rb-mode + .rb-mode { border-left: 1px solid var(--border); } .rb-mode.on { background: var(--primary); color: var(--on-primary, #fff); }
.rich-ed { padding: .75rem .9rem; outline: none; overflow-y: auto; max-height: 70vh; cursor: text; }
.rich-ed:empty::before { content: attr(data-placeholder); color: var(--faint, var(--muted)); }
.rich textarea.rich-src { border: 0; border-radius: 0; width: 100%; outline: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; min-height: 10rem; }
.rich textarea.rich-src:focus { outline: none; }
.prose table { border-collapse: collapse; margin: .5rem 0; } .prose th, .prose td { border: 1px solid var(--border); padding: .35rem .55rem; text-align: left; vertical-align: top; }
.prose th { background: var(--primary-soft); } .prose blockquote { border-left: 3px solid var(--border); margin: .5rem 0; padding-left: .8rem; color: var(--muted); }
.prose pre { background: var(--surface-2, var(--bg)); padding: .6rem .8rem; border-radius: 6px; overflow-x: auto; } .prose img { max-width: 100%; height: auto; }
@media (max-width: 640px) { .rb-sel { max-width: 92px; } .rb-modes { margin-left: 0; width: 100%; } .rb-mode { flex: 1; } }
.sub-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem; }
.danger-text { color: var(--danger); }

/* ===== Collapsible main menu ===== */
.brand-row { display: flex; align-items: center; gap: .25rem; } .brand-row .brand { flex: 1; min-width: 0; }
.nav-collapse { flex: none; }
@media (min-width: 901px) {
  html.nav-collapsed .app { grid-template-columns: 64px 1fr; }
  html.nav-collapsed .sidebar { padding: 1rem .4rem; overflow-x: hidden; }
  html.nav-collapsed .brand-row { flex-direction: column; } html.nav-collapsed .brand { padding: .25rem 0 .4rem; justify-content: center; }
  html.nav-collapsed .brand > :not(svg):not(img), html.nav-collapsed .brand-logo { display: none; }
  html.nav-collapsed .nav-collapse svg { transform: scaleX(-1); }
  html.nav-collapsed .nav-sec { font-size: 0; margin: .5rem .4rem; border-top: 1px solid var(--border); height: 0; }
  html.nav-collapsed .nav a { justify-content: center; padding: .55rem 0; position: relative; }
  html.nav-collapsed .nav a > span:not(.count) { display: none; }
  html.nav-collapsed .nav .count { position: absolute; top: 2px; right: 4px; font-size: .6rem; padding: 0 .3rem; min-width: 0; }
}
@media (max-width: 900px) { .nav-collapse { display: none; } }

/* ===== Slack-style chat ===== */
.slack { display: grid; grid-template-columns: 270px 1fr; height: calc(100vh - 62px - 2.5rem); min-height: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.slack.side-hidden { grid-template-columns: 0 1fr; } .slack.side-hidden .sl-side { visibility: hidden; }
.sl-side { background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sl-side-head { display: flex; align-items: center; justify-content: space-between; padding: .7rem .8rem .4rem; font-size: 1.05rem; }
.sl-find { padding: 0 .7rem .5rem; } .sl-find input { width: 100%; padding: .35rem .6rem; font-size: .88rem; }
.sl-newdm { padding: 0 .7rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; } .sl-newdm input { width: 100%; }
.sl-sections { flex: 1; overflow-y: auto; padding-bottom: .5rem; }
.sl-sec summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; padding: .45rem .8rem .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); user-select: none; }
.sl-sec summary::-webkit-details-marker { display: none; }
.sl-sec summary svg { transition: transform .15s; } .sl-sec:not([open]) summary svg { transform: rotate(-90deg); }
.sl-sec summary .sl-count { margin-left: auto; }
.sl-sec ul { list-style: none; margin: 0; padding: 0 .4rem; }
.sl-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 6px; color: var(--text); font-size: .92rem; min-width: 0; }
.sl-item:hover { background: var(--surface); text-decoration: none; }
.sl-item.on { background: var(--primary); color: var(--on-primary); } .sl-item.on .sl-ico { color: inherit; }
.sl-item.unread .sl-name { font-weight: 700; }
.sl-item .avatar { width: 1.4rem; height: 1.4rem; font-size: .6rem; flex: none; }
.sl-ico { width: 1.4rem; text-align: center; color: var(--muted); flex: none; font-weight: 700; display: inline-flex; justify-content: center; }
.sl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-count { background: var(--danger); color: #fff; border-radius: 99px; font-size: .7rem; font-weight: 700; padding: 0 .42rem; line-height: 1.25rem; min-width: 1.25rem; text-align: center; }
.sl-side-foot { border-top: 1px solid var(--border); padding: .4rem .5rem; display: flex; flex-direction: column; }
.sl-side-foot a { display: flex; align-items: center; gap: .45rem; padding: .3rem .4rem; font-size: .85rem; color: var(--muted); border-radius: 6px; }
.sl-side-foot a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.sl-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.sl-empty { align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.sl-welcome { max-width: 380px; } .sl-welcome-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .6rem; }
.sl-head { display: flex; align-items: center; gap: .4rem; padding: .55rem .8rem; border-bottom: 1px solid var(--border); min-height: 56px; }
.sl-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sl-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.02rem; }
.sl-actions { display: flex; gap: .25rem; align-items: center; } .sl-actions form { margin: 0; }
.sl-back { display: none; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline dotted; }
.sl-desc { margin: 0; padding: .35rem .9rem; border-bottom: 1px solid var(--border); }
.sl-members { position: absolute; right: .8rem; top: 58px; z-index: 5; width: 300px; max-height: 360px; overflow-y: auto; box-shadow: var(--shadow); }
.slack .chat-log.sl-log { flex: 1; overflow-y: auto; display: block; padding: .5rem 0 1rem; background: var(--surface); border-radius: 0; gap: 0; }
.sl-start { padding: 1.5rem 1.2rem .5rem; } .sl-start h2 { margin: 0 0 .2rem; }
.sl-day { display: flex; align-items: center; margin: .9rem 0 .3rem; } .sl-day::before, .sl-day::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.sl-day span { font-size: .75rem; font-weight: 600; border: 1px solid var(--border); border-radius: 99px; padding: .1rem .7rem; color: var(--muted); background: var(--surface); }
.slack .msg { max-width: none; align-self: auto; background: transparent; border: 0; border-radius: 0; display: grid; grid-template-columns: 52px 1fr auto; gap: 0 .4rem; padding: .35rem 1rem .2rem .7rem; position: relative; }
.slack .msg.mine { background: transparent; }
.slack .msg.cont { padding-top: .05rem; }
.slack .msg:hover { background: var(--surface-2); }
.slack .msg.mentions-me { background: color-mix(in srgb, var(--warning, #d97706) 12%, transparent); box-shadow: inset 3px 0 0 var(--warning, #d97706); }
.msg-av { display: flex; justify-content: center; padding-top: .15rem; } .msg-av .avatar { width: 2.25rem; height: 2.25rem; font-size: .8rem; border-radius: 8px; }
.msg-t { font-size: .68rem; color: var(--faint); visibility: hidden; padding-top: .2rem; white-space: nowrap; } .msg:hover .msg-t { visibility: visible; }
.msg-main { min-width: 0; }
.slack .msg .meta { font-size: .8rem; margin-bottom: .05rem; gap: .45rem; }
.slack .msg .meta .who { font-weight: 700; color: var(--text); font-size: .95rem; }
.slack .msg .body { line-height: 1.45; }
.msg-file { display: inline-block; margin-top: .25rem; } .msg-file img { max-height: 280px; max-width: min(100%, 420px); border-radius: 8px; border: 1px solid var(--border); }
.msg-tools { position: absolute; right: .8rem; top: -.6rem; display: none; gap: .1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: .1rem; }
.msg-tools:empty { display: none !important; }
.msg:hover .msg-tools, .msg-tools:focus-within { display: flex; }
@media (hover: none) { .msg-tools { position: static; display: flex; box-shadow: none; border: 0; background: none; align-self: start; } }
.sl-compose { padding: 0 .9rem .9rem; margin: 0; display: block; }
.sl-compose .chat-err { margin-bottom: .4rem; }
.sl-box { border: 1px solid var(--border-strong, var(--border)); border-radius: 10px; background: var(--surface); }
.sl-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.sl-box textarea { border: 0; width: 100%; resize: none; min-height: 2.6rem; height: 2.6rem; max-height: 180px; background: transparent; padding: .65rem .8rem .2rem; box-shadow: none; outline: none; }
.sl-box textarea:focus { box-shadow: none; outline: none; }
.sl-box-bar { display: flex; align-items: center; gap: .35rem; padding: .25rem .4rem .35rem; flex-wrap: wrap; } .sl-box-bar .spacer { flex: 1; }
.sl-box .emo-bar { order: 0; width: auto; }
.sl-send { border-radius: 8px; }
.sl-note { margin: 0 .9rem .9rem; }
@media (max-width: 900px) {
  .slack { grid-template-columns: 1fr; height: calc(100vh - 62px - 2rem); }
  .slack:not(.no-conv) .sl-side { display: none; } .slack.no-conv .sl-main { display: none; }
  .slack .sl-back { display: inline-flex; } .slack .sl-collapse { display: none; }
}
.slack.narrow { grid-template-columns: 1fr; border: 0; border-radius: 0; height: 100vh; min-height: 0; }
.slack.narrow:not(.no-conv) .sl-side { display: none; } .slack.narrow.no-conv .sl-main { display: none; }
.slack.narrow .sl-back { display: inline-flex; } .slack.narrow .sl-collapse { display: none; }
.slack.narrow .sl-members { width: auto; left: .5rem; right: .5rem; }
.slack.narrow .msg { grid-template-columns: 40px 1fr auto; padding-left: .4rem; } .slack.narrow .msg-av .avatar { width: 1.9rem; height: 1.9rem; }
body.embed { background: var(--surface); } .embed-main.content { padding: 0; max-width: none; } body.embed .alert { margin: .5rem; }


/* full-height chat page: fill the space under the top bar, never scroll the page */
@media (min-width: 0px) {
  .main:has(.slack:not(.narrow)) { height: 100vh; height: 100dvh; overflow: hidden; }
  .content:has(> .slack:not(.narrow)), .content:has(.slack:not(.narrow)) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .slack:not(.narrow) { flex: 1; height: auto; min-height: 0; }
}
.sl-box { display: flex; flex-wrap: wrap; align-items: center; }
.sl-box textarea { flex: 1 0 100%; }
.sl-box .emo-bar { flex: none; margin: 0 0 .1rem .4rem; order: 1; display: flex; gap: .25rem; }
.sl-box .sl-box-bar { flex: 1; order: 2; padding-left: .2rem; }
.sl-box .gif-chip { order: 3; flex-basis: 100%; margin: 0 .6rem .4rem; }

/* ===== Themed sidebar + collapsible sections ===== */
.sidebar { background: var(--side-bg, var(--surface)); border-right: 1px solid var(--side-border, var(--border)); color: var(--side-text, var(--text)); padding: .85rem .6rem; scrollbar-width: thin; }
.sidebar .brand { color: var(--side-text, var(--text)); padding: .2rem .45rem .2rem; }
.sidebar .brand svg { color: var(--side-active-text, var(--primary)); }
.brand-row { margin-bottom: .6rem; min-height: 40px; }
.nav-collapse { color: var(--side-muted, var(--muted)); border-color: transparent; background: transparent; width: 30px; height: 30px; }
.nav-collapse:hover { background: var(--side-hover, var(--surface-2)); color: var(--side-text, var(--text)); }
.nav a { color: var(--side-text, var(--text)); padding: .44rem .6rem; font-size: .93rem; text-decoration: none; margin: 1px 0; }
.nav a svg { color: var(--side-muted, var(--muted)); flex: none; } .nav a.active svg { color: inherit; }
.nav a:hover { background: var(--side-hover, var(--surface-2)); }
.nav a.active { background: var(--side-active, var(--primary-soft)); color: var(--side-active-text, var(--primary)); }
.nav hr { border: 0; border-top: 1px solid var(--side-border, var(--border)); margin: .8rem .4rem; opacity: .7; }
.nav form .btn.ghost { color: var(--side-muted, var(--muted)); border-color: transparent; }
.nav-group { margin-top: .55rem; }
button.nav-sec { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: pointer; padding: .35rem .6rem; margin: 0; border-radius: 6px;
  font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--side-muted, var(--faint)); }
button.nav-sec:hover { background: var(--side-hover, var(--surface-2)); color: var(--side-text, var(--text)); }
button.nav-sec:focus-visible { outline: 2px solid var(--primary); }
button.nav-sec svg { transition: transform .15s; opacity: .8; }
button.nav-sec[aria-expanded="false"] svg { transform: rotate(-90deg); }
html.ng-closed-building [data-group="building"] .nav-items, html.ng-closed-community [data-group="community"] .nav-items,
html.ng-closed-unit [data-group="unit"] .nav-items, html.ng-closed-mgmt [data-group="mgmt"] .nav-items { display: none; }
@media (min-width: 901px) {
  html.nav-collapsed button.nav-sec { display: none; }
  html.nav-collapsed .nav-group { border-top: 1px solid var(--side-border, var(--border)); padding-top: .4rem; }
  html.nav-collapsed .nav-group .nav-items { display: block !important; }
  html.nav-collapsed .brand-row { flex-direction: column; gap: .4rem; }
  html.nav-collapsed .brand .brand-name, html.nav-collapsed .brand span { display: none; }
}

/* ===== Theme picker cards ===== */
.tpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .75rem; margin: .4rem 0 .5rem; }
.tcard { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: .5rem .5rem .6rem; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.tcard:hover { border-color: var(--primary); transform: translateY(-1px); }
.tcard > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.tcard:has(> input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tcard:has(> input:checked)::after { content: "✓"; position: absolute; top: .45rem; right: .45rem; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: .75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tcard:has(> input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.tc-prev { display: grid; grid-template-columns: 1fr 1fr; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); margin-bottom: .35rem; }
.tc-prev > span { display: flex; } .tc-prev i { display: block; font-style: normal; }
.tc-l { background: var(--tc-bg); } .tc-d { background: var(--tc-dbg); }
.tc-l .tc-side { width: 26%; background: var(--tc-sb); } .tc-d .tc-side { width: 26%; background: var(--tc-dsb); }
.tc-main { flex: 1; padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.tc-main b { display: block; height: 6px; width: 70%; border-radius: 3px; background: currentColor; opacity: .22; }
.tc-l .tc-main { color: #1f2328; } .tc-d .tc-main { color: #e6e8eb; }
.tc-main em { display: block; height: 12px; width: 55%; border-radius: 4px; margin-top: auto; }
.tc-l em { background: var(--tc-a); } .tc-d em { background: var(--tc-da); }
.tc-name { font-weight: 650; font-size: .92rem; } .tc-desc { font-size: .76rem; color: var(--muted); line-height: 1.3; }
.tc-make { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: .35rem; padding: .4rem; background: var(--surface-2); grid-template-columns: none; }
.tc-make input[type="color"] { width: 100%; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.tc-make select { font-size: .78rem; padding: .15rem .3rem; min-height: 0; height: 26px; }
.preview-strip { margin-top: .5rem; }

/* ===== Branding page ===== */
.stack-lg > * + * { margin-top: 1rem; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.sec-head h2 { margin: 0; font-size: 1.1rem; }
.logo-row { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.logo-preview { flex-direction: column; gap: .3rem; color: var(--muted); }
.logo-actions { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: .5rem; }
.file-drop { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; cursor: pointer; }
.file-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop:focus-within .btn { outline: 3px solid var(--primary-soft); }
.file-drop .small { flex: 1; min-width: 200px; }
.save-bar { position: sticky; bottom: 0; display: flex; gap: .5rem; padding: .75rem 0; background: linear-gradient(transparent, var(--bg) 35%); z-index: 3; }

/* ===== Chat page polish ===== */
.slack { border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05); grid-template-columns: 290px 1fr; }
.sl-side { background: var(--surface-2); }
.sl-side-head { padding: .9rem .9rem .5rem; } .sl-side-head strong { font-size: 1.15rem; letter-spacing: -.01em; }
.sl-side-head .btn { border-color: transparent; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sl-find input { border-radius: 10px; background: var(--surface); border: 1px solid var(--border); height: 36px; }
.sl-sec summary { padding: .7rem .9rem .3rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.sl-sec ul { padding: 0 .5rem; }
.sl-item { gap: .65rem; padding: .45rem .55rem; border-radius: 10px; margin: 1px 0; text-decoration: none; }
.sl-item:hover { background: var(--surface); }
.sl-item.on { background: var(--primary-soft); color: var(--text); } .sl-item.on .sl-name { color: var(--primary); }
.sl-av .avatar, .sl-ico { width: 34px; height: 34px; flex: none; }
.sl-av .avatar { font-size: .72rem; }
.sl-ico { border-radius: 10px; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; font-size: 1rem; color: var(--muted); }
.sl-item.on .sl-ico { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.sl-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sl-name { font-size: .92rem; font-weight: 550; }
.sl-last { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-item.unread .sl-last { color: var(--text); font-weight: 600; }
.sl-count { background: var(--primary); color: var(--on-primary); }
.sl-side-foot { flex-direction: row; flex-wrap: wrap; gap: .2rem; padding: .5rem; }
.sl-side-foot a { font-size: .78rem; padding: .3rem .5rem; text-decoration: none; }
.sl-head { min-height: 62px; padding: .6rem 1rem; gap: .6rem; background: var(--surface); }
.sl-title strong { font-size: 1.05rem; }
.sl-title .linklike { text-decoration: none; color: var(--muted); } .sl-title .linklike:hover { color: var(--primary); text-decoration: underline; }
.sl-head .btn.sm.ghost { border-color: var(--border); }
.slack .chat-log.sl-log { padding: .5rem 0 1.25rem; }
.slack .msg { padding: .45rem 1.25rem .25rem 1rem; grid-template-columns: 48px 1fr auto; }
.slack .msg.cont { padding-top: .1rem; padding-bottom: .1rem; }
.msg-av .avatar { width: 38px; height: 38px; border-radius: 10px; }
.slack .msg .meta { gap: .5rem; align-items: baseline; }
.slack .msg .meta time { color: var(--faint); }
.slack .msg .body { font-size: .95rem; }
.slack .msg:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.sl-day span { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.sl-compose { padding: .25rem 1.1rem 1.1rem; }
.sl-box { border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.sl-box textarea { padding: .75rem 1rem .25rem; font-size: .95rem; min-height: 44px; }
.sl-box .emo-bar { margin: 0 0 .25rem .45rem; } .sl-box .emo-btn { border: 0; padding: .25rem .5rem; font-size: 0; min-height: 32px; } .sl-box .emo-btn span { font-size: 1.1rem; } .sl-box .emo-btn:not(:has(span)) { font-size: .75rem; font-weight: 700; }
.sl-box-bar { padding: .2rem .5rem .45rem .2rem; }
.sl-box-bar .btn.icon { border: 0; color: var(--muted); }
.sl-fname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--muted); padding: .25rem .55rem; border-radius: 99px; border: 1px solid var(--border); cursor: pointer; user-select: none; }
.sl-chip input { position: absolute; opacity: 0; pointer-events: none; }
.sl-chip:has(input:checked) { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.sl-send { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; margin-left: .25rem; }
.sl-send:hover { background: var(--primary-hover); } .sl-send:disabled { opacity: .5; }
.sl-welcome h1 { font-size: 1.5rem; margin: .4rem 0; }

/* ===== WordPress-style article editor ===== */
.wp { max-width: 1240px; }
.wp-top { position: sticky; top: 62px; z-index: 6; display: flex; align-items: center; gap: .6rem; padding: .55rem .2rem; margin: -.4rem 0 .8rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.wp-top .spacer { flex: 1; }
.wp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.wp-main { min-width: 0; }
.wp input.wp-title, .wp-title { width: 100%; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: .3rem 0 .6rem !important; font-size: 2.1rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; color: var(--text); }
.wp input.wp-title:focus, .wp-title:focus { outline: none; } .wp-title::placeholder { color: var(--faint); }
.wp-editor .rich-wrap, .wp-editor .rb { border-radius: 12px; }
.wp-editor textarea:not([data-rich]) { width: 100%; border-radius: 12px; }
.wp-side { display: flex; flex-direction: column; gap: .8rem; position: sticky; top: 120px; }
.wp-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .85rem 1rem; }
.wp-box h3 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.wp-box select { width: 100%; } .wp-box .check { margin: .25rem 0; }
.wp-meta { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0 0 .75rem; font-size: .88rem; } .wp-meta dt { color: var(--muted); } .wp-meta dd { margin: 0; font-weight: 600; }
.wp-acts { display: flex; gap: .5rem; justify-content: space-between; border-top: 1px solid var(--border); padding-top: .7rem; }
.wp-panel { margin-bottom: .8rem; padding: .8rem 1rem; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); }
.file-drop.col { flex-direction: column; align-items: flex-start; gap: .4rem; }
.file-drop { font-weight: 400; }
@media (max-width: 1000px) { .wp-grid { grid-template-columns: 1fr; } .wp-side { position: static; } .wp-top { top: 56px; } }
.wp-editor .rich { border-radius: 12px; overflow: visible; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.wp-editor .rich:focus-within { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.wp-editor .rich-bar { top: 112px; border-radius: 12px 12px 0 0; padding: 6px 8px; gap: 3px; }
.wp-editor .rich-ed { min-height: 58vh; padding: 1.4rem 1.75rem; font-size: 1.05rem; line-height: 1.75; max-width: none; }
.wp-editor .rich textarea { min-height: 58vh; padding: 1.2rem 1.5rem; }
@media (max-width: 1000px) { .wp-editor .rich-bar { top: 104px; } }
/* email templates + placeholders */
.tpl-gallery summary { cursor: pointer; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; list-style: none; } .tpl-gallery summary::-webkit-details-marker { display: none; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin-top: .8rem; }
.tpl { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .12s, transform .12s; }
.tpl:hover { border-color: var(--primary); transform: translateY(-1px); text-decoration: none; }
.tpl-meta { font-size: .72rem; color: var(--primary); margin-top: .15rem; }
.ph-bar { margin: .2rem 0 .5rem; } .ph-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.ph-chip { font: 500 .76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: .32rem .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.ph-chip:hover { border-color: var(--primary); color: var(--primary); }
.ph-preview { margin-top: .6rem; } .ph-preview strong { display: block; margin: .2rem 0 .5rem; font-size: 1.05rem; }
.tpl-gallery summary::after { content: "Show"; margin-left: auto; font-size: .8rem; color: var(--primary); font-weight: 600; } .tpl-gallery[open] summary::after { content: "Hide"; }
@media (max-width: 600px) { .wp-state, .wp-back-t { display: none; } .wp-top { gap: .4rem; } .wp input.wp-title { font-size: 1.6rem; } }

/* ===== Chat bubble + pop-up window (v3: draggable, presence, modern) ===== */
.cw { position: fixed; right: 22px; bottom: 22px; z-index: 900; width: 58px; height: 58px; }
.cw.cw-off { display: none; }
.cw [hidden] { display: none !important; }
.cw.dragging { transition: none; } .cw.dragging .cw-bubble { cursor: grabbing; transform: scale(1.08); box-shadow: 0 16px 36px rgba(0,0,0,.3); }
.cw-bubble { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; touch-action: none; user-select: none;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover, var(--primary))); color: var(--on-primary);
  box-shadow: 0 10px 26px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.18); display: grid; place-items: center; transition: transform .18s ease, box-shadow .18s ease; }
.cw-bubble:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 30px rgba(0,0,0,.26); }
.cw-bubble:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 3px; }
.cw-bubble > span:not(.cw-badge) { grid-area: 1 / 1; display: grid; place-items: center; transition: transform .2s ease, opacity .2s ease; }
.cw-ico-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.cw.open .cw-ico-open { opacity: 0; transform: rotate(90deg) scale(.6); } .cw.open .cw-ico-close { opacity: 1; transform: none; }
.cw-badge { position: absolute; top: -3px; right: -3px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 21px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.cw-bubble > .cw-dot { right: 3px; bottom: 3px; width: 13px; height: 13px; box-shadow: 0 0 0 2.5px var(--primary); }
.cw.open .cw-bubble > .cw-dot { opacity: 0; }

/* presence dots */
.cw-dot, .cw-dot-s { display: inline-block; border-radius: 50%; background: #9aa3ad; flex: none; }
.cw-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; box-shadow: 0 0 0 2px var(--surface); }
.cw-dot-s { width: 8px; height: 8px; vertical-align: 1px; }
.p-online { background: #22c55e; } .p-away { background: #f5b301; } .p-offline, .p-invisible { background: #9aa3ad; }
.p-dnd { background: #ef4444; } .cw-dot.p-dnd::after, .cw-dot-s.p-dnd::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; margin-top: -1px; background: #fff; border-radius: 1px; }
.cw-dot-s.p-dnd { position: relative; } .cw-dot.p-invisible, .cw-dot-s.p-invisible { background: transparent; box-shadow: inset 0 0 0 2px #9aa3ad, 0 0 0 2px var(--surface); }
.cw-dot-s.p-invisible { box-shadow: inset 0 0 0 1.5px #9aa3ad; }

/* window */
.cw-win { position: absolute; right: 0; bottom: 72px; width: 380px; height: 600px; max-height: calc(100vh - 110px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.24), 0 6px 16px rgba(0,0,0,.08); transform-origin: bottom right; animation: cw-in .2s cubic-bezier(.2,.9,.3,1.2); }
.cw.cw-left .cw-win { right: auto; left: 0; transform-origin: bottom left; }
.cw.cw-down .cw-win { bottom: auto; top: 72px; transform-origin: top right; } .cw.cw-down.cw-left .cw-win { transform-origin: top left; }
@keyframes cw-in { from { opacity: 0; transform: translateY(12px) scale(.95); } to { opacity: 1; transform: none; } }
.cw-head { position: relative; display: flex; align-items: center; gap: .55rem; padding: .75rem .6rem .75rem .8rem; flex: none;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000)); color: var(--on-primary); }
.cw-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cw-ttl strong { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.cw-ttl small { font-size: .74rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .3rem; }
.cw-head .cw-dot-s { box-shadow: 0 0 0 1.5px rgba(255,255,255,.75); }
.cw-ib { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: inherit; cursor: pointer; flex: none; text-decoration: none; }
.cw-ib:hover { background: rgba(255,255,255,.18); text-decoration: none; } .cw-ib.sm { width: 30px; height: 30px; color: var(--muted); } .cw-ib.sm:hover { background: var(--surface-2); color: var(--text); }
.cw-me { all: unset; cursor: pointer; border-radius: 50%; display: grid; } .cw-me:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.cw-av { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .82rem; }
.cw-av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; } .cw-av.cw-av-sq { border-radius: 12px; }
.cw-av.sm { width: 30px; height: 30px; font-size: .68rem; align-self: flex-start; margin-top: 1.25rem; } .cw-av.sm .cw-dot { width: 9px; height: 9px; }
.cw-msg.cont .cw-av.sm { margin-top: 0; }
.cw-av.md { width: 46px; height: 46px; font-size: .85rem; } .cw-av.md .cw-dot { width: 12px; height: 12px; }
.cw-head .cw-av { width: 34px; height: 34px; background: rgba(255,255,255,.22); color: inherit; } .cw-head .cw-dot { box-shadow: 0 0 0 2px var(--primary); }

/* status menu */
.cw-menu { position: absolute; top: 58px; left: 10px; right: 10px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .4rem; box-shadow: 0 16px 40px rgba(0,0,0,.22); animation: cw-in .14s ease-out; }
.cw-menu-h { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .35rem .55rem .25rem; }
.cw-mi { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: .65rem; padding: .5rem .55rem; border-radius: 9px; cursor: pointer; color: var(--text); text-decoration: none; }
.cw-mi:hover, .cw-mi:focus-visible { background: var(--surface-2); text-decoration: none; }
.cw-mi > span { flex: 1; min-width: 0; display: flex; flex-direction: column; } .cw-mi b { font-size: .88rem; font-weight: 600; } .cw-mi small { font-size: .74rem; color: var(--muted); }
.cw-mi > svg:last-child { color: var(--primary); opacity: 0; } .cw-mi[aria-checked="true"] > svg:last-child { opacity: 1; } .cw-mi .cw-dot-s { width: 10px; height: 10px; }
.cw-menu-sep { height: 1px; background: var(--border); margin: .3rem .2rem; }
.cw-sw input { position: absolute; opacity: 0; pointer-events: none; }
.cw-switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border); flex: none; transition: background .15s; }
.cw-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.cw-sw input:checked + .cw-switch { background: var(--primary); } .cw-sw input:checked + .cw-switch::after { transform: translateX(16px); }
.cw-sw input:focus-visible + .cw-switch { outline: 2px solid var(--primary); outline-offset: 2px; }

/* list view */
.cw-view { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
.cw-search { display: flex; align-items: center; gap: .45rem; margin: .75rem .8rem .4rem; padding: 0 .75rem; height: 38px; border-radius: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid transparent; flex: none; }
.cw-search:focus-within { border-color: var(--primary); background: var(--surface); }
.cw-search input { border: 0 !important; background: transparent !important; flex: 1; min-width: 0; padding: 0 !important; height: 100%; box-shadow: none !important; color: var(--text); font-size: .9rem; } .cw-search input:focus { outline: none; }
.cw-sub-h { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 .95rem; }
.cw-active { padding: .35rem 0 .2rem; flex: none; }
.cw-active-row { display: flex; gap: .35rem; overflow-x: auto; padding: .45rem .7rem .3rem; scrollbar-width: none; } .cw-active-row::-webkit-scrollbar { display: none; }
.cw-act { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .25rem; width: 56px; flex: none; border-radius: 10px; padding: .2rem 0; }
.cw-act:hover { background: var(--surface-2); } .cw-act > span:last-child { font-size: .72rem; color: var(--muted); max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-chips { display: flex; gap: .35rem; padding: .3rem .8rem .5rem; flex: none; }
.cw-chips button { all: unset; cursor: pointer; font-size: .78rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; color: var(--muted); background: var(--surface-2); }
.cw-chips button:hover { color: var(--text); } .cw-chips button.on { background: var(--primary-soft); color: var(--primary); }
.cw-chips button:focus-visible { outline: 2px solid var(--primary); }
.cw-list { list-style: none; margin: 0; padding: .1rem .45rem .6rem; overflow-y: auto; flex: 1; }
.cw-item { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: .75rem; padding: .6rem .55rem; border-radius: 12px; cursor: pointer; transition: background .1s; }
.cw-item:hover, .cw-item:focus-visible { background: var(--surface-2); }
.cw-it-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.cw-it-top, .cw-it-bot { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.cw-it-top strong { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-it-top time { font-size: .72rem; color: var(--faint); flex: none; }
.cw-it-last { flex: 1; min-width: 0; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-item.unread .cw-it-top strong { font-weight: 800; } .cw-item.unread .cw-it-last { color: var(--text); font-weight: 500; } .cw-item.unread .cw-it-top time { color: var(--primary); font-weight: 700; }
.cw-pill { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--on-primary); font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.cw-unit { font-style: normal; font-weight: 500; font-size: .74rem; color: var(--muted); margin-left: .4rem; }
.cw-skel { height: 52px; margin: .3rem .3rem; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: cw-sh 1.2s infinite linear; }
@keyframes cw-sh { to { background-position: -200% 0; } }
.cw-emptybox { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 2.2rem 1.4rem; color: var(--muted); font-size: .86rem; }
.cw-emptybox strong { color: var(--text); font-size: .98rem; }
.cw-empty-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: .3rem; }
.cw-cta { all: unset; cursor: pointer; margin-top: .6rem; padding: .55rem 1rem; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: .86rem; }
.cw-cta:hover { filter: brightness(1.06); } .cw-cta:focus-visible { outline: 3px solid var(--primary-soft); }
.cw-hint { font-size: .74rem; color: var(--faint); padding: .2rem 1rem .8rem; margin: 0; flex: none; }

/* conversation */
.cw-log { flex: 1; min-height: 0; overflow-y: auto; padding: .7rem .8rem .5rem; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
.cw-day { align-self: center; margin: .7rem 0 .35rem; font-size: .7rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: .18rem .65rem; border-radius: 999px; }
.cw-msg { display: flex; gap: .5rem; align-items: flex-start; max-width: 100%; margin-top: .55rem; }
.cw-msg.cont { margin-top: 2px; }
.cw-msg.mine { justify-content: flex-end; }
.cw-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; min-width: 0; }
.cw-msg.mine .cw-col { align-items: flex-end; }
.cw-who { display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; margin: 0 .2rem .2rem; font-size: .75rem; line-height: 1.2; }
.cw-name { font-weight: 700; color: var(--text); text-decoration: none; font-size: .78rem; } a.cw-name:hover { text-decoration: underline; } .cw-name.me { color: var(--muted); font-weight: 600; }
.cw-who .cw-unit { margin: 0; font-size: .72rem; } .cw-who .cw-unit::before { content: '·'; margin-right: .3rem; color: var(--faint); }
.cw-tag { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .08rem .35rem; border-radius: 5px; background: var(--primary-soft); color: var(--primary); }
.cw-time { font-size: .68rem; color: var(--faint); }
.cw-bub { padding: .5rem .75rem; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-size: .9rem; line-height: 1.42; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.cw-msg:not(.mine) .cw-bub { border-top-left-radius: 6px; } .cw-msg.cont:not(.mine) .cw-bub { border-top-left-radius: 16px; }
.cw-msg.mine .cw-bub { background: var(--primary); color: var(--on-primary); border-color: transparent; border-top-right-radius: 6px; } .cw-msg.mine.cont .cw-bub { border-top-right-radius: 16px; }
.cw-msg.mine .cw-bub a { color: inherit; text-decoration: underline; }
.cw-msg.ping .cw-bub { box-shadow: inset 3px 0 0 var(--warn, #f5b301); }
.cw-text { white-space: pre-wrap; }
.cw-filelink { display: block; margin-top: .3rem; } .cw-filelink img { max-width: 220px; max-height: 200px; border-radius: 10px; display: block; }
.cw-convempty { margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 1.5rem; color: var(--muted); font-size: .84rem; }
.cw-convempty .cw-av { width: 64px; height: 64px; font-size: 1.2rem; margin-bottom: .3rem; } .cw-convempty .cw-av .cw-dot { width: 14px; height: 14px; } .cw-convempty strong { color: var(--text); font-size: 1rem; }
.cw-note { margin: 0; padding: .45rem .9rem; font-size: .8rem; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--border); }
.cw-compose { padding: .55rem .65rem .65rem; background: var(--surface); border-top: 1px solid var(--border); flex: none; }
.cw-box { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.cw-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cw-box textarea { display: block; width: 100%; border: 0 !important; box-shadow: none !important; background: transparent !important; resize: none; padding: .6rem .8rem .2rem !important; min-height: 0; max-height: 120px; font-size: .92rem; line-height: 1.4; color: var(--text); }
.cw-box textarea:focus { outline: none; }
.cw-tools { display: flex; align-items: center; gap: .15rem; padding: .15rem .3rem .3rem; }
.cw-tools .emoji-btn, .cw-tools [data-emoji-btn] { margin: 0; }
.cw-file { flex: 1; min-width: 0; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-send { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform .1s; }
.cw-send:hover { transform: scale(1.06); } .cw-send:disabled { opacity: .5; }

@media (max-width: 600px) {
  .cw-win { position: fixed; inset: 0 !important; width: auto; height: auto; max-height: none !important; border-radius: 0; border: 0; animation: cw-up .2s ease-out; }
  @keyframes cw-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
  .cw.open .cw-bubble { display: none; }
  .cw-col { max-width: 84%; }
}
@media (prefers-reduced-motion: reduce) { .cw-win, .cw-menu, .cw-skel { animation: none; } .cw-bubble { transition: none; } }
html[data-theme="contrast"] .cw-bub { border: 2px solid currentColor; }
.sl-av { position: relative; } .sl-av .cw-dot { width: 10px; height: 10px; box-shadow: 0 0 0 2px var(--side-bg, var(--surface)); }
.sl-head .cw-dot-s { margin-right: .1rem; }
.cw-head .cw-dot-s { box-shadow: none; outline: 1.5px solid rgba(255,255,255,.7); outline-offset: 0; }
.cw-win.is-list, .cw-win:has([data-cw-newview]:not([hidden])) { height: auto; min-height: 400px; }
.cw-win.is-list .cw-list { flex: 1 1 auto; min-height: 120px; }
.cw-foot { display: flex; gap: .5rem; padding: .6rem .8rem .75rem; border-top: 1px solid var(--border); flex: none; background: var(--surface); }
.cw-fbtn { all: unset; box-sizing: border-box; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 38px; border-radius: 11px; cursor: pointer; font-size: .84rem; font-weight: 600; background: var(--surface-2); color: var(--text); text-decoration: none; }
.cw-fbtn:first-child { background: var(--primary); color: var(--on-primary); }
.cw-fbtn:hover { filter: brightness(1.05); text-decoration: none; } .cw-fbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cw-tools .emo-btn { margin: 0; padding: 0; min-width: 0; }
.mp-grid { align-items: start; } .mp-prev iframe { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mp-grid h2 { font-size: 1.02rem; margin: 1.1rem 0 .5rem; } .mp-grid form h2:first-of-type { margin-top: 0; }
.report-card.open { border-left: 4px solid var(--warn, #f5b301); } .report-card.dismissed { opacity: .7; }
.sound-pick { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .55rem; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: .88rem; }
.sound-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
/* ---- ChatKit: groups, drag and drop, menus, people sections ---- */
.ck-box { list-style: none; padding: 0; margin: 0; }
.ck-sec { margin: 0 0 .25rem; }
.ck-sh { display: flex; align-items: center; gap: .25rem; padding: .35rem .5rem .15rem; position: sticky; top: 0; background: var(--card, var(--bg)); z-index: 1; }
.ck-st { flex: 1; display: flex; align-items: center; gap: .4rem; background: none; border: 0; color: var(--muted); font: 600 .74rem/1 inherit; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; padding: .3rem .2rem; text-align: left; }
.ck-st svg { transition: transform .15s; } .ck-sec.col .ck-st svg { transform: rotate(-90deg); } .ck-sec.col .ck-ul { display: none; }
.ck-ul { list-style: none; margin: 0; padding: 0 0 .2rem; min-height: 8px; border-radius: 10px; }
.ck-ul.ck-drop { outline: 2px dashed var(--primary); outline-offset: -2px; }
.ck-li { position: relative; display: flex; align-items: center; }
.ck-li > .cw-item { flex: 1; min-width: 0; padding-right: 2.2rem; }
.ck-li.dragging { opacity: .45; }
.ck-li[draggable="true"] > .cw-item { cursor: grab; }
.ck-more { background: none; border: 0; color: var(--muted); border-radius: 8px; width: 30px; height: 30px; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.ck-more:hover, .ck-more:focus-visible { background: var(--hover, rgba(127,127,127,.14)); color: var(--text); }
.ck-li > .ck-more { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); opacity: 0; }
.ck-li:hover > .ck-more, .ck-li:focus-within > .ck-more, .ck-more:focus-visible { opacity: 1; }
@media (hover: none) { .ck-li > .ck-more { opacity: .8; } }
.cw-item.muted .cw-it-last, .cw-item.muted strong { opacity: .6; } .cw-pill.dim { background: var(--muted); } .cw-pill.sm { font-size: .68rem; padding: 0 .4rem; }
.ck-muted { color: var(--muted); display: inline-flex; margin-left: .25rem; }
.ck-hint { color: var(--muted); font-size: .82rem; padding: .35rem .9rem; list-style: none; }
.cw-av .ck-mini { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; font-size: .55rem; border: 2px solid var(--card, #fff); border-radius: 50%; }
.cw-item.on { background: var(--primary-soft); }
.ck-menu { position: fixed; z-index: 10050; min-width: 220px; max-width: 300px; max-height: 70vh; overflow: auto; background: var(--card, #fff); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.22); padding: .3rem; }
.ck-mi { display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: none; border: 0; color: inherit; text-align: left; padding: .5rem .7rem; border-radius: 8px; cursor: pointer; font: inherit; }
.ck-mi small { color: var(--muted); font-size: .76rem; } .ck-mi:hover, .ck-mi:focus-visible { background: var(--hover, rgba(127,127,127,.14)); outline: none; }
.ck-mi.on span::before { content: "✓ "; color: var(--primary); } .ck-mi.danger { color: var(--danger, #c62828); }
.ck-mh { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .45rem .7rem .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-sep { height: 1px; background: var(--border); margin: .3rem 0; }
.ck-dlg { border: 1px solid var(--border); border-radius: 16px; padding: 1.2rem 1.3rem; max-width: 480px; width: calc(100% - 2rem); background: var(--card, #fff); color: var(--text); }
.ck-dlg::backdrop { background: rgba(0,0,0,.45); } .ck-dlg h2 { margin: 0 0 .4rem; font-size: 1.15rem; } .ck-dlg label { display: block; margin: .6rem 0 .3rem; font-weight: 600; }
.ck-dlg select, .ck-dlg textarea { width: 100%; margin-top: .3rem; }
.cw-heads { position: absolute; right: 54px; bottom: 6px; display: flex; flex-direction: row-reverse; pointer-events: none; }
.cw-heads .cw-av { width: 30px; height: 30px; margin-left: -10px; border: 2px solid var(--card, #fff); box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: .7rem; animation: ck-pop .25s ease-out; }
.cw.open .cw-heads { display: none; }
@keyframes ck-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.sl-ck { overflow: auto; flex: 1; padding: .2rem .3rem; }
.tr-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 10040; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; max-width: min(680px, calc(100% - 24px)); padding: .7rem .9rem; background: var(--card, #fff); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); font-size: .92rem; }
.tr-float { position: fixed; top: 10px; right: 10px; z-index: 10030; background: var(--card, #fff); border: 1px solid var(--border); }
