:root {
  --bg: #121513;
  --rail: #0b0d0c;
  --panel: #161a17;
  --card: #1c211d;
  --card2: #232925;
  --hover: #1f2621;
  --line: #252b26;
  --line2: #323a33;
  --text: #e6ebe4;
  --muted: #8e988d;
  --faint: #6f786e;
  --accent: #9bd35a;
  --accent-hi: #b0e070;
  --accent-ink: #0e1a0b;
  --accent-soft: #1f2a1f;
  --accent-line: #34502a;
  --gold: #f0c94a;
  --gold-soft: #3a3420;
  --danger: #ef6b5b;
  --danger-soft: #3a1d1a;
  --r: 12px;
  --r-sm: 8px;
  --rail-w: 64px;
  --list-w: 340px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
#app { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
::selection { background: var(--accent-line); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 13px; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.boot { height: 100%; display: grid; place-items: center; }
.boot-logo, .brand {
  width: 40px; height: 40px; border-radius: 11px; background: var(--accent); color: var(--rail);
  display: grid; place-items: center; font-weight: 700; font-size: 19px; letter-spacing: -.5px; text-decoration: none;
}
.boot-logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--card2); color: var(--text); font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--hover); border-color: #3d4740; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.danger { color: var(--danger); border-color: #4a2a26; background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.iconbtn {
  width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; flex: none; transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn.accent { color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); }
.field small { color: var(--faint); font-size: 12px; }
.input, .textarea, .select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--card); color: var(--text); outline: none; transition: border-color .15s, background .15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); background: #1a1f1b; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.seg { align-self: flex-start; display: inline-flex; background: var(--card); border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); height: 32px; padding: 0 14px; border-radius: 7px; font-weight: 500; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 12px; background: var(--line2); transition: background .15s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform .18s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--card2); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.count.dim { background: var(--line2); color: var(--muted); }

.av { position: relative; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; overflow: visible; user-select: none; }
.av > img, .av > b { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: grid; place-items: center; font-weight: 600; }
.av.group { border-radius: 30%; }
.av .dot { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 9px; min-height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }

.shell { height: 100%; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: calc(14px + var(--safe-t)) 0 calc(14px + var(--safe-b)); border-right: 1px solid #151816;
}
.rail .brand { margin-bottom: 14px; }
.rail-btn {
  position: relative; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: #7d877c;
  display: grid; place-items: center; transition: background .15s, color .15s; text-decoration: none;
}
.rail-btn .ico { width: 22px; height: 22px; }
.rail-btn:hover { background: #161b17; color: var(--text); }
.rail-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail-btn[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-btn .count { position: absolute; top: 2px; right: 0; transform: scale(.85); }
.rail-sep { flex: 1; }
.rail-me { border: 0; background: transparent; padding: 3px; border-radius: 50%; }
.rail-me[aria-current="page"] { box-shadow: 0 0 0 2px var(--accent); }
.rail-ver { font-size: 10px; color: #4f574e; margin-top: 4px; }
.tip { position: relative; }
.tip::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-4px);
  background: #222823; color: var(--text); border: 1px solid var(--line2); font-size: 12.5px; font-weight: 500; padding: 5px 9px; border-radius: 7px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 50;
}
.tip:hover::after { opacity: 1; transform: translateY(-50%); }

.main { min-width: 0; height: 100%; overflow: hidden; position: relative; }
.tabbar { display: none; }

.page { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page-in { max-width: 920px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 28px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -.3px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 4px; }
.card > p.muted { margin: 0 0 16px; font-size: 14px; }
.card-row { display: flex; align-items: center; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat span { display: block; font-size: 12.5px; color: var(--muted); }
.stat b { font-size: 22px; font-weight: 650; letter-spacing: -.3px; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row.click { cursor: pointer; border-radius: 10px; padding: 12px 10px; }
.row.click:hover { background: var(--hover); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .ico { width: 44px; height: 44px; color: var(--line2); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 auto; max-width: 320px; font-size: 14px; }

.auth { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { width: 92px; height: 92px; border-radius: 22px; background: #fbfaf4; display: grid; place-items: center; margin: 0 auto 18px; padding: 8px; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth h1 { text-align: center; font-size: 24px; margin: 0 0 4px; letter-spacing: -.3px; }
.auth .sub { text-align: center; color: var(--muted); margin: 0 0 26px; font-size: 14px; }
.auth form { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.auth .foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 18px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; background: var(--danger-soft); color: #f4a196; border: 1px solid #4a2a26; }
.alert.ok { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.alert:empty { display: none; }

.chat { height: 100%; display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); }
.clist { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.clist-head { display: flex; align-items: center; gap: 8px; padding: calc(16px + var(--safe-t)) 14px 10px 18px; }
.clist-head h1 { font-size: 20px; margin: 0; flex: 1; letter-spacing: -.3px; }
.conn { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--gold); }
.conn .ico { width: 15px; height: 15px; }
.search { position: relative; margin: 0 12px 8px; }
.search .ico { position: absolute; left: 11px; top: 11px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid transparent; background: var(--card); padding: 0 12px 0 36px; outline: none; color: var(--text); }
.search input:focus { border-color: var(--accent-line); }
.clist-scroll { flex: 1; overflow-y: auto; padding: 2px 8px calc(12px + var(--safe-b)); min-height: 0; }
.clabel { font-size: 11.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.citem {
  display: flex; gap: 11px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 11px; border: 0; background: transparent;
  text-align: left; color: var(--text); transition: background .12s;
}
.citem:hover { background: var(--hover); }
.citem[aria-current="true"] { background: var(--accent-soft); }
.citem .top { display: flex; align-items: baseline; gap: 8px; }
.citem .name { font-weight: 600; flex: 1; min-width: 0; }
.citem .time { font-size: 12px; color: var(--faint); flex: none; }
.citem .bot { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.citem .prev { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); }
.citem.unread .name { color: #fff; }
.citem.unread .prev { color: var(--text); }
.citem.unread .time { color: var(--accent); }
.citem .typing { color: var(--accent); font-style: italic; }
.citem .mute { width: 15px; height: 15px; color: var(--faint); }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); position: relative; }
.thread-empty { flex: 1; display: grid; place-items: center; }
.thead { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 12px 10px 16px; border-bottom: 1px solid var(--line); background: rgba(18, 21, 19, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 2; }
.thead .back { display: none; }
.thead .who { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; display: flex; align-items: center; gap: 10px; padding: 4px; margin: -4px; border-radius: 10px; }
.thead .who:hover { background: var(--hover); }
.thead .t1 { font-weight: 600; }
.thead .t2 { font-size: 12.5px; color: var(--muted); }
.thead .t2.on { color: var(--accent); }
.tscroll { flex: 1; overflow-y: auto; overflow-anchor: none; padding: 12px 18px 8px; min-height: 0; overscroll-behavior: contain; }
.tlist { display: flex; flex-direction: column; max-width: 860px; margin: 0 auto; }
.older { align-self: center; margin: 4px 0 12px; }
.day { align-self: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 3px 10px; border-radius: 10px; margin: 14px 0 8px; position: sticky; top: 4px; z-index: 1; }
.newline { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 12px; font-weight: 600; margin: 10px 0; }
.newline::before, .newline::after { content: ""; height: 1px; background: #5a4c22; flex: 1; }
.sys { align-self: center; text-align: center; font-size: 12.5px; color: var(--muted); padding: 3px 12px; margin: 8px 0; max-width: 90%; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 2px; position: relative; }
.msg.first { margin-top: 10px; }
.msg.mine { flex-direction: row-reverse; }
.msg .avslot { width: 30px; flex: none; }
.msg.mine .avslot { display: none; }
.bwrap { max-width: min(72%, 620px); display: flex; flex-direction: column; min-width: 0; }
.msg.mine .bwrap { align-items: flex-end; }
.bname { font-size: 12.5px; font-weight: 600; margin: 0 0 3px 12px; }
.bubble {
  position: relative; padding: 7px 11px 6px; border-radius: 16px; background: var(--card); line-height: 1.42;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; max-width: 100%;
}
.msg:not(.mine) .bubble { border-top-left-radius: 6px; }
.msg:not(.mine):not(.first) .bubble { border-top-left-radius: 6px; }
.msg.mine .bubble { background: var(--accent); color: var(--accent-ink); border-top-right-radius: 6px; }
.msg.mine .bubble a { color: #1d3a10; font-weight: 600; }
.bubble.deleted { background: transparent !important; border: 1px dashed var(--line2); color: var(--faint) !important; font-style: italic; }
.bubble.deleted > .ico { width: 15px; height: 15px; vertical-align: -3px; }
.bubble .meta { float: right; font-size: 11px; margin: 7px 0 -3px 10px; color: var(--faint); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; user-select: none; }
.msg.mine .bubble .meta { color: #3d5a2a; }
.bubble .meta .ico { width: 15px; height: 15px; }
.bubble .meta .read { color: #134d8a; }
.quote { display: block; border: 0; text-align: left; width: 100%; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, .05); border-radius: 6px; padding: 4px 8px; margin: 2px 0 5px; font-size: 13px; cursor: pointer; white-space: normal; color: inherit; }
.msg.mine .quote { background: rgba(0, 0, 0, .1); border-left-color: #2e5a18; }
.quote b { display: block; font-size: 12px; }
.quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; opacity: .85; }
.mtools { position: absolute; top: -14px; display: none; gap: 2px; background: var(--card2); border: 1px solid var(--line2); border-radius: 9px; padding: 2px; z-index: 3; }
.msg:not(.mine) .mtools { left: 44px; }
.msg.mine .mtools { right: 6px; }
.mtools button { width: 30px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; display: grid; place-items: center; }
.mtools button:hover { background: var(--hover); color: var(--text); }
.mtools .ico { width: 17px; height: 17px; }
@media (hover: hover) { .msg:hover .mtools { display: flex; } }
.seen { font-size: 11.5px; color: var(--faint); margin: 3px 4px 0; border: 0; background: transparent; padding: 0; }
.flash .bubble { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
.typingline { height: 20px; padding: 0 22px; font-size: 12.5px; color: var(--accent); font-style: italic; }
.jump { position: absolute; right: 20px; bottom: 96px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line2); background: var(--card2); color: var(--text); display: grid; place-items: center; z-index: 4; }
.jump .count { position: absolute; top: -6px; right: -4px; }
.composer { padding: 6px 14px calc(12px + var(--safe-b)); }
.composer-in { max-width: 860px; margin: 0 auto; }
.cbar { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; padding: 8px 8px 8px 12px; font-size: 13px; }
.cbar .ico { color: var(--accent); }
.cbar + .crow { border-top-left-radius: 0; border-top-right-radius: 0; }
.crow { display: flex; align-items: flex-end; gap: 8px; background: var(--card); border: 1px solid var(--line2); border-radius: 22px; padding: 5px 5px 5px 16px; transition: border-color .15s; }
.crow:focus-within { border-color: var(--accent-line); }
.crow textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; color: var(--text); max-height: 160px; padding: 7px 0; line-height: 1.4; min-height: 34px; }
.send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; transition: transform .1s, opacity .15s; }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):active { transform: scale(.92); }
.send .ico { width: 19px; height: 19px; }
.draft-hint { text-align: center; padding: 40px 20px; color: var(--muted); }

.overlay { position: fixed; inset: 0; background: rgba(4, 6, 5, .62); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 460px; max-height: min(86vh, 760px); background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; display: flex; flex-direction: column; animation: rise .2s cubic-bezier(.2, .9, .3, 1.1); overflow: hidden; }
.sheet.wide { max-width: 560px; }
.sheet.xwide { max-width: 900px; }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 10px 20px; }
.sheet-head h2 { margin: 0; font-size: 17px; flex: 1; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); }
.menu { display: flex; flex-direction: column; padding: 6px; }
.menu button { display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; background: transparent; border-radius: 10px; text-align: left; font-weight: 500; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu .ico { color: var(--muted); }
.menu button.danger .ico { color: var(--danger); }
.pick { max-height: 340px; overflow-y: auto; margin: 0 -8px; }
.pick label { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; cursor: pointer; }
.pick label:hover { background: var(--hover); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.profile-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 6px 0 14px; }
.profile-hero h3 { margin: 6px 0 0; font-size: 20px; }
.qr { display: block; width: 196px; height: 196px; margin: 4px auto 12px; border-radius: 12px; background: #fff; padding: 8px; image-rendering: pixelated; }
.secret { display: block; text-align: center; font-family: var(--mono); background: var(--card); border: 1px dashed var(--line2); border-radius: 10px; padding: 10px; margin-bottom: 14px; letter-spacing: 1px; user-select: all; word-break: break-all; }
.temp-pw { font-family: var(--mono); font-size: 22px; text-align: center; padding: 16px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); letter-spacing: 1px; user-select: all; margin: 10px 0 14px; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #252c27; color: var(--text); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; animation: rise .2s ease; max-width: 90vw; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.toast.err { background: #3a1d1a; border-color: #5a2c26; color: #ffb4a8; }
.toast.ok { border-color: var(--accent-line); }
.ava-edit { position: relative; }
.ava-edit .cam { position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); border: 3px solid var(--panel); display: grid; place-items: center; }
.ava-edit .cam .ico { width: 17px; height: 17px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.log-row { display: grid; grid-template-columns: 130px 150px minmax(0, 1fr); gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); font-size: 13.5px; }
.log-row:first-child { border-top: 0; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

@media (max-width: 1100px) { :root { --list-w: 300px; } }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rail { display: none; }
  .tabbar {
    display: flex; background: rgba(11, 13, 12, .96); border-top: 1px solid #1c201d; padding: 6px 6px calc(6px + var(--safe-b));
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; color: #7d877c; text-decoration: none; font-size: 11px; font-weight: 600; position: relative; border-radius: 10px; }
  .tab .ico { width: 24px; height: 24px; }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab .count { position: absolute; top: 0; left: 50%; margin-left: 6px; transform: scale(.85); }
  .tab .av { width: 24px; height: 24px; font-size: 10px; }
  body.in-thread .tabbar { display: none; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat .thread { display: none; }
  .chat.open .clist { display: none; }
  .chat.open .thread { display: flex; }
  .clist { border-right: 0; background: var(--bg); }
  .thead .back { display: grid; margin-left: -8px; }
  .tscroll { padding: 10px 10px 6px; }
  .bwrap { max-width: 82%; }
  .msg .avslot { width: 26px; }
  .composer { padding: 6px 8px calc(8px + var(--safe-b)); }
  .jump { bottom: 84px; right: 12px; }
  .page-in { padding: calc(18px + var(--safe-t)) 16px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  .overlay { align-items: flex-end; padding: 0; }
  .sheet, .sheet.wide, .sheet.xwide { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; border-bottom: 0; animation: up .24s cubic-bezier(.2, .9, .3, 1); }
  @keyframes up { from { transform: translateY(40%); } }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .input, .textarea, .crow textarea, .search input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.npops { position: fixed; top: calc(14px + var(--safe-t)); right: 16px; z-index: 150; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 24px)); pointer-events: none; }
.npop {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 12px; border-radius: 16px; cursor: pointer;
  background: #1f2621; border: 1px solid var(--accent-line); box-shadow: 0 14px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(155, 211, 90, .08);
  animation: popin .32s cubic-bezier(.2, 1.2, .3, 1);
}
.npop:hover { background: #232b25; }
.npop-t { font-weight: 650; font-size: 14px; }
.npop-b { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.npop-x { width: 30px; height: 30px; align-self: flex-start; }
.npop-x .ico { width: 16px; height: 16px; }
.npop.out { opacity: 0; transform: translateX(16px); transition: opacity .18s, transform .18s; }
@keyframes popin { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
.count.pop { animation: countpop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes countpop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(.85); } }
.tab .count.pop { animation-name: countpop; }
.rail-btn.ping { animation: ping 1.4s ease 2; }
@keyframes ping { 0%, 100% { box-shadow: 0 0 0 0 rgba(155, 211, 90, 0); } 30% { box-shadow: 0 0 0 6px rgba(155, 211, 90, .28); background: var(--accent-soft); color: var(--accent); } }
.citem.flash { animation: rowflash 1.6s ease; }
@keyframes rowflash { 0%, 35% { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); } 100% { background: transparent; box-shadow: none; } }
.nbanner { margin: 4px 12px 8px; padding: 12px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.nbanner .ico { color: var(--accent); margin-top: 1px; }
.nbanner b { display: block; margin-bottom: 2px; }
.nbanner .acts { display: flex; gap: 6px; margin-top: 8px; }
@media (max-width: 760px) {
  .npops { left: 12px; right: 12px; width: auto; top: calc(10px + var(--safe-t)); }
}

.page-in.wide { max-width: 1180px; }
.hide-sm { display: inline; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input.bad { border-color: var(--danger); }
.stat.click { text-align: left; cursor: pointer; color: inherit; font: inherit; transition: border-color .15s, background .15s; }
.stat.click:hover { border-color: var(--line2); background: var(--hover); }
.stat small { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.stat.good b { color: var(--accent); }
.stat.mid b { color: var(--gold); }
.stat.bad b { color: var(--danger); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.mtool { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.mt-search { margin: 0; flex: 1 1 260px; }
.mt-search input { height: 40px; background: var(--panel); border-color: var(--line); }
.mtool-sel { display: flex; gap: 8px; }
.mtool-sel .select { height: 40px; width: auto; max-width: 220px; background: var(--panel); }
.mcard { padding: 6px 0; overflow: hidden; }
.mrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 96px 96px 104px 190px; gap: 10px; align-items: center; padding: 9px 16px 9px 14px; cursor: pointer; border-top: 1px solid var(--line); }
.mrow:hover { background: var(--hover); }
.mrow.gone { opacity: .55; }
.mhead { cursor: default; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .3px; border-top: 0; padding-top: 8px; padding-bottom: 8px; }
.mhead:hover { background: transparent; }
.mprod { display: flex; align-items: center; gap: 10px; padding: 14px 10px 8px 14px; border-top: 1px solid var(--line2); background: rgba(255, 255, 255, .015); }
.mhead + .mprod { border-top: 1px solid var(--line); }
.mptitle { font-weight: 650; }
.mimg { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: #fff; flex: none; }
.mimg.ph { display: grid; place-items: center; background: var(--card2); color: var(--faint); }
.mimg-big { display: block; width: 120px; height: 120px; object-fit: cover; border-radius: 14px; background: #fff; margin: 0 auto 14px; }
.mcb { display: grid; place-items: center; width: 34px; height: 30px; cursor: pointer; flex: none; }
.mcb input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; cursor: pointer; }
.mname { min-width: 0; }
.mname .faint { font-size: 12.5px; }
.mnum { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mnum.strong { font-weight: 650; }
.mhead .mnum { text-align: right; }
.mbar { display: flex; align-items: center; gap: 10px; }
.mbar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.mbar-track i { display: block; height: 100%; border-radius: 3px; background: var(--faint); }
.mbar b { width: 70px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.mbar.good i { background: var(--accent); } .mbar.good b { color: var(--accent); }
.mbar.mid i { background: var(--gold); } .mbar.mid b { color: var(--gold); }
.mbar.bad i { background: var(--danger); } .mbar.bad b { color: var(--danger); }
.mbar.none b { color: var(--faint); font-weight: 500; font-size: 12.5px; }
.bulkbar { position: sticky; bottom: calc(14px + var(--safe-b)); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; margin-top: 12px; border-radius: 14px; background: #222a24; border: 1px solid var(--accent-line); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
.medit { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.ekrow { display: flex; gap: 8px; align-items: center; }
.ekrow .input { flex: 1; min-width: 0; }
.ekrow .seg button { padding: 0 10px; font-size: 13px; }
.field > small:empty { display: none; }
.wf { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-variant-numeric: tabular-nums; }
.wf-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.wf-row span { color: var(--muted); }
.wf-row span small { display: block; font-size: 11.5px; color: var(--faint); }
.wf-row b { font-weight: 500; white-space: nowrap; }
.wf-row.top b { font-weight: 650; }
.wf-row.sum { border-top: 1px solid var(--line2); margin-top: 3px; padding-top: 7px; }
.wf-row.sum span { color: var(--text); font-weight: 600; }
.wf-row.sum b { font-weight: 650; }
.wf-row.db span small { display: inline; margin-left: 6px; }
.wf-row.warn b { color: var(--gold); }
.wf-row.final { font-size: 16px; border-top: 2px solid var(--line2); }
.wf-row.final.good b, .wf-row.final.good small { color: var(--accent); }
.wf-row.final.mid b, .wf-row.final.mid small { color: var(--gold); }
.wf-row.final.bad b, .wf-row.final.bad small { color: var(--danger); }
.wf-row.final span small { display: inline; margin-left: 8px; font-size: 13px; font-weight: 650; }
.simbox { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.sim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sim-grid span { display: block; font-size: 12px; color: var(--muted); }
.sim-grid b { font-size: 17px; font-variant-numeric: tabular-nums; }
.sim-res { margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; background: var(--card2); }
.sim-res.good { color: var(--accent); } .sim-res.mid { color: var(--gold); } .sim-res.bad { color: var(--danger); }
.hist { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.hist summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; padding: 4px 0; }
.hist .row { font-size: 13.5px; padding: 8px 2px; }
.bulkrow { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.bulkrow:first-of-type { border-top: 0; }
.shiprow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.shiprow .input { width: 110px; }
.msec h3 { margin: 18px 0 2px; font-size: 15px; }
.msec p { margin: 0 0 10px; font-size: 13px; }
.msec:first-child h3 { margin-top: 0; }
@media (max-width: 1000px) {
  .mrow { grid-template-columns: 34px minmax(0, 1fr) 84px 84px 150px; }
  .mrow > .mnum:nth-child(4) { display: none; }
}
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .medit { grid-template-columns: 1fr; gap: 6px; }
  .mtool-sel { width: 100%; }
  .mtool-sel .select { flex: 1 1 0; min-width: 0; max-width: none; }
  .mtool .seg { width: 100%; overflow-x: auto; }
  .mtool .seg button { flex: 1; padding: 0 8px; white-space: nowrap; }
  .mhead { display: none; }
  .mrow { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "cb name price" "cb bar bar"; row-gap: 6px; padding: 10px 12px 10px 8px; }
  .mrow > .mcb { grid-area: cb; }
  .mrow > .mname { grid-area: name; }
  .mrow > .mnum { display: none; }
  .mrow > .mnum:nth-child(3) { display: block; grid-area: price; }
  .mrow > .mbarcell { grid-area: bar; }
  .mprod { padding: 14px 8px 6px; }
  .bulkrow { grid-template-columns: 1fr 120px; }
  .bulkrow .seg { grid-column: 1 / -1; }
  .shiprow .input { width: 80px; }
}
