/* Ensi AI v4 - styles. Deep green and gold, dark and light themes, mobile first. */

:root {
  --bg: #1F2A1C; --sf: #28351F; --sf2: #2F3D25; --rs: #354427; --ln: #44553A;
  --tx: #F3F1E7; --mu: #B9C4A9; --us: #3A4A2A;
  --ac: #E0B23C; --ac-ink: #22190A; --ac-tx: #E8C25C; --er: #E8816E; --ok: #8FCB7A;
  --code: #172014; --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --fs: 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F3E8; --sf: #FFFFFF; --sf2: #EFEBDD; --rs: #E8E3D2; --ln: #D9D2BC;
    --tx: #1F2A1C; --mu: #5B6650; --us: #E3EAD3;
    --ac: #E0B23C; --ac-ink: #22190A; --ac-tx: #8A6410; --er: #B4442F; --ok: #3D7A2B;
    --code: #F1EEE2; --shadow: 0 8px 30px rgba(40, 50, 30, .15);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #F6F3E8; --sf: #FFFFFF; --sf2: #EFEBDD; --rs: #E8E3D2; --ln: #D9D2BC;
  --tx: #1F2A1C; --mu: #5B6650; --us: #E3EAD3;
  --ac: #E0B23C; --ac-ink: #22190A; --ac-tx: #8A6410; --er: #B4442F; --ok: #3D7A2B;
  --code: #F1EEE2; --shadow: 0 8px 30px rgba(40, 50, 30, .15);
  color-scheme: light;
}

/* The folded-glass background (js/fx-fold.js) and the flock (js/fx-flock.js). Header and
   composer become see-through glass over it; without WebGL nothing changes. */
:root { --glass: rgba(16, 28, 18, .78); --flock: #E3B84B; --fx-calm: .5; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --glass: rgba(246, 243, 232, .84); --flock: #24563A; --fx-calm: .6; } }
:root[data-theme="light"] { --glass: rgba(246, 243, 232, .84); --flock: #24563A; --fx-calm: .6; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; transition: opacity .8s ease; }
body.chatting .fx, body.page .fx { opacity: var(--fx-calm); }
body.has-fx .top, body.has-fx .composer { background: var(--glass); }
body.has-fx .top { border-bottom-color: rgba(227, 184, 75, .18); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; height: 100dvh;
  background: var(--bg); color: var(--tx);
  font: var(--fs)/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 8px; }
.i { display: block; flex: none; }
[hidden] { display: none !important; }

/* Header */
.top { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--ln); background: var(--bg); }
.brand { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 4px; }
.brand img { border-radius: 7px; flex: none; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 0; background: none; border-radius: 12px; color: var(--mu); transition: background .15s, color .15s;
}
.ib:hover { background: var(--rs); color: var(--tx); }
.ib:active { transform: scale(.94); }
.pill {
  display: flex; align-items: center; gap: 5px; max-width: 34vw; height: 34px; padding: 0 11px 0 9px;
  border: 1px solid var(--ln); background: var(--sf); border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--tx); flex: none;
}
.pill .i { width: 16px; height: 16px; color: var(--ac-tx); }
.pill span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Messages */
main { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.log { max-width: 780px; margin: 0 auto; padding: 18px 14px 8px; }
.m { margin: 0 0 22px; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.u { display: flex; flex-direction: column; align-items: flex-end; }
.u .b {
  background: var(--us); padding: 9px 14px; border-radius: 18px 18px 5px 18px; max-width: 86%;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.u .imgs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; max-width: 86%; }
.u .imgs img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; }
.u .acts { opacity: .85; }
.edit-box { width: 100%; max-width: 86%; }
.edit-box textarea { width: 100%; min-height: 80px; }
.edit-box .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

.a .b { overflow-wrap: anywhere; }
.a .b.err { color: var(--er); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .75em; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 1.1em 0 .5em; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.07em; } .md h4 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 .75em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md a { color: var(--ac-tx); text-underline-offset: 2px; }
.md blockquote { margin: 0 0 .75em; padding: 2px 12px; border-left: 3px solid var(--ac); color: var(--mu); }
.md hr { border: 0; border-top: 1px solid var(--ln); margin: 1em 0; }
.md table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 .9em; max-width: 100%; font-size: .94em; }
.md th, .md td { border: 1px solid var(--ln); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--sf2); }
.md :not(pre) > code { background: var(--sf2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.code { margin: 0 0 .9em; border: 1px solid var(--ln); border-radius: 12px; overflow: hidden; background: var(--code); }
.code-h { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; font-size: 12px; color: var(--mu); background: var(--sf2); }
.code-copy { border: 0; background: none; color: var(--mu); font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.code-copy:hover { background: var(--rs); color: var(--tx); }
.code pre { margin: 0; padding: 12px; overflow-x: auto; font: 13.5px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; }
.streaming > :last-child::after { content: ""; display: inline-block; width: 8px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--ac); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Syntax colours (highlight.js classes) */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: #C58AE0; }
.hljs-string, .hljs-attr, .hljs-template-tag { color: #9CCB6B; }
.hljs-number, .hljs-literal, .hljs-symbol { color: #E8A85C; }
.hljs-comment, .hljs-quote { color: var(--mu); font-style: italic; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: #6FB7E8; }
.hljs-type, .hljs-class .hljs-title, .hljs-variable { color: var(--ac-tx); }
:root[data-theme="light"] .hljs-keyword, :root[data-theme="light"] .hljs-built_in { color: #7A3A9E; }
:root[data-theme="light"] .hljs-string, :root[data-theme="light"] .hljs-attr { color: #3D7A2B; }
:root[data-theme="light"] .hljs-number, :root[data-theme="light"] .hljs-literal { color: #A55A12; }
:root[data-theme="light"] .hljs-title { color: #1F639A; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .hljs-keyword, :root:not([data-theme="dark"]) .hljs-built_in { color: #7A3A9E; }
  :root:not([data-theme="dark"]) .hljs-string, :root:not([data-theme="dark"]) .hljs-attr { color: #3D7A2B; }
  :root:not([data-theme="dark"]) .hljs-number, :root:not([data-theme="dark"]) .hljs-literal { color: #A55A12; }
  :root:not([data-theme="dark"]) .hljs-title { color: #1F639A; }
}

/* Typing indicator */
.typing { display: inline-flex; gap: 5px; padding: 8px 2px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--mu); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* Actions under a message */
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 6px; }
.act {
  height: 34px; min-width: 34px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 0; background: none; border-radius: 9px; color: var(--mu); font-size: 13px;
}
.act .i { width: 18px; height: 18px; }
.act:hover { background: var(--rs); color: var(--tx); }
.act.on { color: var(--ac-tx); }
.act.busy { color: var(--ac-tx); }
.langrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--mu); }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--ln); border-radius: 99px; padding: 2px 10px; }
.chip.backup { border-color: var(--ac); color: var(--ac-tx); }
.link { border: 0; background: none; padding: 2px 4px; color: var(--ac-tx); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.errbox { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--er); border-radius: 12px; color: var(--er); }
.errbox .i { width: 18px; height: 18px; }
.errbox span { flex: 1; min-width: 160px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--ln); background: var(--sf); border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--tx);
}
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--ac); color: var(--ac-ink); border-color: var(--ac); }
.stopped { font-size: 12.5px; color: var(--mu); font-style: italic; }

/* Empty chat */
.hello { text-align: center; padding: 2vh 4px 0; color: var(--mu); }
.hello .flock { display: block; width: 100%; height: clamp(130px, 24vh, 210px); margin: 0 auto 4px; touch-action: pan-y; }
.hello h2 { color: var(--tx); font-size: 28px; margin: 0 0 6px; }
.hello p { margin: 0 0 22px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.card {
  border: 1px solid var(--ln); background: var(--sf); border-radius: 14px; padding: 12px; min-height: 84px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--ac); }
.card:active { transform: scale(.98); }
.card b { font-size: 14px; color: var(--tx); font-weight: 600; line-height: 1.35; }
.card small { font-size: 12px; color: var(--mu); }
@media (max-width: 380px) { .card { padding: 10px; } .card b { font-size: 13.5px; } }

/* Jump to latest */
.jump {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--ln); background: var(--sf); color: var(--tx);
  display: grid; place-items: center; box-shadow: var(--shadow); z-index: 5;
}

/* Composer */
.composer { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); }
.box {
  max-width: 780px; margin: 0 auto; background: var(--sf); border: 1px solid var(--ln); border-radius: 22px;
  padding: 6px 6px 6px; transition: border-color .15s;
}
.box:focus-within { border-color: var(--ac); }
textarea {
  display: block; width: 100%; background: transparent; color: var(--tx); border: 0; outline: 0; resize: none;
  font: inherit; padding: 8px 10px 4px; max-height: 35vh; min-height: 40px;
}
textarea::placeholder { color: var(--mu); }
.edit-box textarea { background: var(--sf); border: 1px solid var(--ac); border-radius: 14px; }
.bar { display: flex; align-items: center; gap: 4px; }
.grow { flex: 1; }
.send {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ac); color: var(--ac-ink);
  display: grid; place-items: center; flex: none; transition: opacity .15s, transform .1s;
}
.send:disabled { opacity: .4; cursor: default; }
.send:active { transform: scale(.94); }
.mic.rec { background: var(--er); color: #fff; }
.hint { max-width: 780px; margin: 4px auto 0; min-height: 18px; font-size: 12.5px; color: var(--mu); text-align: center; padding: 0 8px; }
.hint.err { color: var(--er); }
.thumbs { display: flex; gap: 8px; padding: 4px 6px 6px; flex-wrap: wrap; }
.thumb { position: relative; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; display: block; }
.thumb button {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--sf); background: var(--tx); color: var(--bg); display: grid; place-items: center; padding: 0;
}
.thumb button .i { width: 14px; height: 14px; }

/* Sheets (language picker, chat list) */
.sheet { position: fixed; inset: 0; background: rgba(10, 14, 6, .55); display: none; z-index: 20; }
.sheet.open { display: block; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.panel { position: absolute; background: var(--sf); overflow-y: auto; box-shadow: var(--shadow); }
.panel.bottom {
  left: 0; right: 0; bottom: 0; max-height: 78vh; border-radius: 20px 20px 0 0;
  padding: 8px 12px calc(14px + env(safe-area-inset-bottom)); animation: up .2s ease-out;
}
@media (min-width: 700px) { .panel.bottom { left: 50%; right: auto; width: 520px; transform: translateX(-50%); bottom: 10vh; border-radius: 20px; animation: none; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
.panel.side { top: 0; bottom: 0; left: 0; width: min(84vw, 320px); padding: 14px 10px; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: .5; } }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--ln); margin: 2px auto 8px; }
h3 { margin: 4px 6px 10px; font-size: 16px; }
.li {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 8px; border-radius: 10px; min-height: 46px;
}
.li:hover { background: var(--sf2); }
.li.on { background: var(--rs); }
.li > span:first-child { flex: 1; min-width: 0; }
.li .open { flex: 1; min-width: 0; display: flex; border: 0; background: none; text-align: left; padding: 4px 0; }
.li .open .t { flex: 1; min-width: 0; }
.li .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caps { display: flex; gap: 4px; flex: none; }
.cap { font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--ln); color: var(--mu); white-space: nowrap; }
.cap.y { border-color: var(--ac); color: var(--ac-tx); }
.newchat {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--ac); color: var(--ac-ink); border: 0; border-radius: 12px; padding: 11px; font-weight: 700; margin-bottom: 12px;
}
.del { border: 0; background: none; color: var(--mu); width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.del:hover { background: var(--rs); color: var(--er); }
.empty-note { color: var(--mu); font-size: 13px; padding: 4px 8px; }

/* Beta label, no-JS note, screen-reader-only text */
.beta { flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ac-tx); border: 1px solid var(--ac); border-radius: 99px; padding: 1px 7px; }
@media (max-width: 380px) { .beta { display: none; } }
.noscript { margin: 20px; padding: 14px; border: 1px solid var(--er); border-radius: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Recording bar */
.recbar { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--er); flex: none; animation: blink 1s steps(2) infinite; }
.meter { flex: 1; min-width: 0; height: 36px; }
.timer { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--mu); min-width: 38px; text-align: right; }
.mic { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.mic.held { background: var(--er); color: #fff; }

/* Side panel layout and settings */
.panel.side { display: flex; flex-direction: column; }
.hist-list { flex: 1; overflow-y: auto; min-height: 80px; }
.side-foot { border-top: 1px solid var(--ln); padding-top: 10px; margin-top: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 6px; font-size: 14px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--ac); flex: none; }
.btn.wide { width: 100%; justify-content: center; margin-top: 6px; height: 42px; }

/* Language picker and app-language selector */
.search {
  width: 100%; height: 44px; margin: 0 0 8px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--ln);
  background: var(--bg); color: var(--tx); font: inherit;
}
.search:focus { outline: none; border-color: var(--ac); }
.sec { margin: 12px 6px 2px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mu); }
.li .t small { display: block; font-size: 12px; color: var(--mu); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap.warn { border-color: var(--er); color: var(--er); }
.caps { flex-wrap: wrap; justify-content: flex-end; max-width: 52%; }
.field { display: flex; flex-direction: column; gap: 4px; padding: 6px 6px 2px; font-size: 13px; color: var(--mu); }
.field select {
  height: 42px; border-radius: 10px; border: 1px solid var(--ln); background: var(--bg); color: var(--tx);
  font: inherit; padding: 0 10px;
}
.chip.exp { border-color: var(--er); color: var(--er); }
.chip.live { border-color: var(--ok); color: var(--ok); }

/* Full-screen photo */
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(5, 8, 4, .92); display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer .close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; background: rgba(0, 0, 0, .5); color: #fff; }
.u .imgs img { cursor: zoom-in; }

/* Sign-in */
.login { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.login-card { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.login-card img { margin: 0 auto 4px; border-radius: 14px; }
.login-card h2 { margin: 0; font-size: 26px; }
.login-card p { margin: 0; color: var(--mu); }
.login-card input {
  height: 48px; border-radius: 12px; border: 1px solid var(--ln); background: var(--sf); color: var(--tx);
  font: inherit; font-size: 18px; text-align: center; letter-spacing: .15em; padding: 0 12px;
}
.login-card input:focus { outline: none; border-color: var(--ac); }
.login-card .btn { height: 48px; font-size: 16px; }
.login-err { color: var(--er) !important; min-height: 20px; font-size: 14px; }
.fine { font-size: 12.5px; }

/* Account area in the menu, guest note on the welcome screen */
.account { margin-top: 8px; }
.who { padding: 6px; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--mu); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.note { font-size: 13px; color: var(--mu); margin: 6px; }
.links { display: flex; flex-direction: column; gap: 6px; }
a.btn { text-decoration: none; justify-content: center; }
.legal { font-size: 12.5px; color: var(--mu); text-align: center; margin: 12px 0 0; }
.legal a { color: var(--mu); }
.guest-note { font-size: 13.5px; margin: -10px 0 18px !important; }
.guest-note a { color: var(--ac-tx); font-weight: 600; }

/* Separate pages: sign-in, sign-up, settings, admin, privacy, terms */
body.page { display: block; height: auto; min-height: 100dvh; }
.page-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--ln); }
.page-top .home { display: flex; align-items: center; gap: 8px; color: var(--tx); text-decoration: none; font-weight: 700; font-size: 17px; }
.page-top .home img { border-radius: 7px; }
.page-top .grow { flex: 1; }
.page-top a.back { color: var(--ac-tx); font-size: 14px; }
.page-main { max-width: 440px; margin: 0 auto; padding: 28px 16px 56px; }
.page-main.wide { max-width: 1000px; }
.page-main h1 { font-size: 26px; margin: 0 0 6px; line-height: 1.25; }
.page-main .lead { color: var(--mu); margin: 0 0 20px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--mu); }
.form input[type=email], .form input[type=password], .form input[type=text], .form select {
  height: 48px; border-radius: 12px; border: 1px solid var(--ln); background: var(--sf); color: var(--tx); font: inherit; padding: 0 14px; width: 100%;
}
.form input:focus, .form select:focus { outline: none; border-color: var(--ac); }
.form .check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--tx); font-size: 14px; }
.form .check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ac); flex: none; }
.form .check a, .alt a, .page-main a { color: var(--ac-tx); }
.form .btn { height: 48px; font-size: 16px; justify-content: center; }
.form small { color: var(--mu); font-size: 12.5px; }
.pw { position: relative; }
.pw input { padding-right: 70px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ac-tx); font-size: 13px; font-weight: 600; padding: 8px; }
.msg { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--ln); background: var(--sf); margin: 0 0 14px; }
.msg.err { border-color: var(--er); color: var(--er); }
.msg.ok { border-color: var(--ok); }
.alt { font-size: 14px; color: var(--mu); text-align: center; margin: 18px 0 0; }
.linkbtn { border: 0; background: none; color: var(--ac-tx); font-size: 14px; text-decoration: underline; text-underline-offset: 2px; padding: 4px; }
.section { border: 1px solid var(--ln); border-radius: 16px; padding: 16px; margin: 0 0 16px; background: var(--sf); }
.section h2 { font-size: 17px; margin: 0 0 12px; }
.section.danger { border-color: var(--er); }
.btn.danger { color: var(--er); border-color: var(--er); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.prose h2 { font-size: 19px; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--tx); }
.prose li { margin: 4px 0; }

/* 404, 500 and shared chat pages */
.page-main.center { text-align: center; padding-top: 12vh; }
.big-mark { border-radius: 22px; margin: 0 auto 18px; display: block; }
.page-main.shared { max-width: 780px; }
.shared-log { padding: 6px 0 0; margin: 0; max-width: none; }
.page-top a.btn { height: 36px; font-size: 14px; }

/* Share dialog and chat-list actions */
.panel.dialog { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 420px); border-radius: 18px; padding: 18px; animation: none; }
.dialog p { margin: 0 0 12px; color: var(--mu); font-size: 14px; }
.dialog .linkbox { display: flex; gap: 8px; margin: 0 0 12px; }
.dialog .linkbox input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--ln); background: var(--bg); color: var(--tx); font: inherit; font-size: 14px; padding: 0 10px; }
.dialog .row-btns { margin-top: 6px; }
.act-icon { border: 0; background: none; color: var(--mu); width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.act-icon:hover { background: var(--rs); color: var(--tx); }
.act-icon.on { color: var(--ac-tx); }

/* Admin */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { border: 1px solid var(--ln); border-radius: 14px; padding: 12px 14px; background: var(--sf); }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--mu); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: 6px; }
.bars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars i { display: block; background: var(--ac); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars i.e { background: var(--er); }
.bars-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--mu); margin-top: 4px; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px; border-bottom: 1px solid var(--ln); text-align: left; white-space: nowrap; }
.tbl th { color: var(--mu); font-weight: 600; font-size: 12.5px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--ln); }
.tag.bad { color: var(--er); border-color: var(--er); }
.tag.good { color: var(--ac-tx); border-color: var(--ac); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.toolbar input, .toolbar select { height: 40px; border-radius: 10px; border: 1px solid var(--ln); background: var(--bg); color: var(--tx); font: inherit; padding: 0 12px; }
.toolbar input { flex: 1; min-width: 160px; }
.tool-title { margin: 0 !important; flex: 1; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
