/**
 * TAHR7 Admin.
 *
 * Same visual language as the hub, tuned for a tool rather than a gallery:
 * denser rows, monospace for anything that is an identifier, and colour used
 * only to mean something (red destroys, yellow warns, cyan is informational).
 */

:root {
  --yellow:      #f9ec31;
  --yellow-dim:  #c9be26;
  --yellow-glow: rgba(249, 236, 49, 0.16);

  --bg:          #0c0c0e;
  --surface:     #17171a;
  --surface-2:   #1e1e21;
  --surface-3:   #26262a;

  --ink:         #f2f2f3;
  --ink-dim:     #a0a0a8;
  --ink-faint:   #6a6a74;

  --edge:        rgba(255, 255, 255, 0.09);
  --edge-hi:     rgba(255, 255, 255, 0.2);

  --red:         #ff5a5a;
  --green:       #7ee787;
  --cyan:        #59d5e0;
  --violet:      #b191ff;

  --radius:      4px;
  --radius-lg:   8px;

  --sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --bar-h: 56px;
}

* { box-sizing: border-box; }

/* Author `display` rules beat the UA stylesheet's rule for [hidden], so a
   `.gate { display: grid }` keeps rendering an element the JS believes it has
   hidden. Here that put an invisible full-screen overlay on top of the page.
   One line, and every `hidden` in the markup means what it says. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* The faint hex lattice behind everything. Fixed and pointer-transparent, so it
   never intercepts a click or scrolls out from under the content. */
.hexfield {
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(115deg, transparent 49.6%, var(--edge) 49.6%, var(--edge) 50.4%, transparent 50.4%),
    linear-gradient(65deg, transparent 49.6%, var(--edge) 49.6%, var(--edge) 50.4%, transparent 50.4%);
  background-size: 46px 80px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 0%, transparent 75%);
}

a { color: inherit; }
.muted { color: var(--ink-dim); font-size: 13.5px; margin: 0 0 14px; line-height: 1.55; }
.err { min-height: 18px; margin: 8px 0 0; font-family: var(--mono); font-size: 12px; color: var(--red); }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── boot ───────────────────────────────────────────────────────────────── */

.boot {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg); color: var(--yellow);
  transition: opacity 0.4s var(--ease);
}
.boot.fading { opacity: 0; pointer-events: none; }
.boot-mark { animation: pulse 1.6s ease-in-out infinite; }
.boot-text { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint); }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ── gates ──────────────────────────────────────────────────────────────── */

.gate { position: relative; z-index: 1; display: grid; place-items: center; min-height: 100vh; padding: 40px 20px; }
.gate-inner { width: 100%; max-width: 460px; text-align: center; }
.gate-mark { color: var(--yellow); filter: drop-shadow(0 0 26px var(--yellow-glow)); }

.wordmark { margin: 18px 0 0; font-size: clamp(38px, 9vw, 58px); font-weight: 850; letter-spacing: -0.03em; line-height: 1; }
.wordmark span { color: var(--yellow); }
.wordmark-sub { margin: 4px 0 0; font-family: var(--mono); font-size: 12px; letter-spacing: 0.42em; color: var(--ink-faint); }
.tagline { margin: 18px auto 24px; max-width: 380px; color: var(--ink-dim); font-size: 14px; }

.discord-btn {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 13px 26px; border: 1px solid var(--edge-hi); border-radius: var(--radius);
  background: #5865f2; color: #fff; text-decoration: none; font-weight: 650;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s;
}
.discord-btn:hover { background: #6b76f5; transform: translateY(-2px); box-shadow: 0 14px 34px -12px rgba(88,101,242,0.9); }

.gate-note { min-height: 20px; margin: 16px 0 0; font-family: var(--mono); font-size: 12px; color: var(--red); }
.gate-facts { list-style: none; margin: 40px 0 0; padding: 0; text-align: left; display: grid; gap: 12px; }
.gate-facts li { display: grid; gap: 2px; padding: 11px 14px; border: 1px solid var(--edge); border-left: 2px solid var(--yellow); border-radius: var(--radius); background: var(--surface); }
.gate-facts b { font-size: 12.5px; }
.gate-facts span { font-size: 12.5px; color: var(--ink-dim); }

.mfagate-title { margin: 0; font-size: 26px; font-weight: 800; }
.mfagate-form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.mfagate-hint { margin: 14px 0 20px; font-size: 12.5px; color: var(--ink-faint); }
#enroll .btn { margin: 0 5px; }

.code-input {
  width: 190px; padding: 12px 14px;
  border: 1px solid var(--edge-hi); border-radius: var(--radius);
  background: #000; color: var(--yellow);
  font-family: var(--mono); font-size: 21px; letter-spacing: 0.22em; text-align: center;
}
.code-input:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-glow); }

/* ── layout ─────────────────────────────────────────────────────────────────
 * Two columns on a desktop: channels on the left, one channel on the right.
 * On a phone the sidebar slides over instead, because 390px cannot usefully
 * hold both and a squeezed-in channel list helps nobody.
 */

.app { position: relative; z-index: 1; display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100vh; height: 100dvh; }

.side {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--edge); background: rgba(12,12,14,0.88); min-height: 0;
}
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px; border-bottom: 1px solid var(--edge); }
.side-head .icon-btn { display: none; }
.guild-chip {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
  font-weight: 700; font-size: 14px;
}
.guild-chip img { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.guild-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.channels { overflow-y: auto; padding: 8px 8px 14px; min-height: 0; }
.cat {
  margin: 12px 6px 4px; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint);
}
.chan {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 6px 9px; margin-bottom: 1px; border: none; border-radius: var(--radius);
  background: none; color: var(--ink-dim);
  font-family: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chan:hover { background: var(--surface-2); color: var(--ink); }
.chan[aria-current="true"] { background: var(--surface-3); color: var(--yellow); }
.chan-hash { color: var(--ink-faint); font-weight: 700; flex-shrink: 0; }
.chan-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan.thread .chan-hash { font-size: 11px; }

.side-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--edge); }
.side-foot .btn { flex: 1; }
.avatar-btn { padding: 0; border: 1px solid var(--edge-hi); border-radius: 50%; background: none; cursor: pointer; line-height: 0; flex-shrink: 0; }
.avatar-btn img { width: 26px; height: 26px; border-radius: 50%; display: block; background: var(--surface-2); }

/* Flex, not grid rows.
 *
 * With `grid-template-rows: auto auto 1fr auto` the tracks are handed out by
 * CHILD ORDER, so hiding the warning bar removed an item, shifted everything up
 * a track, and gave the composer a 0px row off the bottom of the screen. A flex
 * column assigns space by what is actually there. */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main > .stream { flex: 1 1 auto; min-height: 0; }
.main > .chanbar, .main > .warnbar, .main > .composer { flex: 0 0 auto; }

.chanbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(12px, 2vw, 20px); border-bottom: 1px solid var(--edge);
  background: rgba(12,12,14,0.9); backdrop-filter: blur(12px);
}
.side-toggle { display: none; }
.chanbar-main { min-width: 0; flex: 1; }
.chan-name { margin: 0; font-size: 15px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-topic { margin: 1px 0 0; font-size: 12px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  padding: 4px 10px; border-radius: 100px; flex-shrink: 0;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  border: 1px solid var(--edge); background: var(--surface-2); color: var(--ink-dim);
}
.fresh-pill { border-color: rgba(126,231,135,0.3); color: var(--green); }
.fresh-pill.stale { border-color: rgba(249,236,49,0.3); color: var(--yellow); }

.warnbar {
  padding: 8px clamp(12px, 2vw, 20px);
  border-bottom: 1px solid rgba(249,236,49,0.24);
  background: rgba(249,236,49,0.07); color: var(--yellow); font-size: 12.5px;
}

/* ── the stream ─────────────────────────────────────────────────────────── */

.stream { overflow-y: auto; padding: 14px clamp(12px, 2vw, 20px) 6px; min-height: 0; overflow-anchor: none; }
.empty { padding: 40px 14px; text-align: center; color: var(--ink-faint); font-size: 13px; }
.loading { padding: 20px 14px; text-align: center; color: var(--ink-faint); font-family: var(--mono); font-size: 11.5px; }

.msg-group { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; padding: 5px 0; }
.msg-group.tight { padding-top: 0; }
.msg-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--surface-3); }
.msg-body { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-author { font-weight: 700; font-size: 14px; }
.msg-when { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.msg-tag {
  padding: 1px 6px; border-radius: 3px;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.05em;
  background: #5865f2; color: #fff;
}
.msg-tag.here { background: var(--yellow); color: #14140b; }
.msg-text { font-size: 14.5px; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-row { display: flex; align-items: flex-start; gap: 8px; }
.msg-row .msg-body { flex: 1; min-width: 0; }
.msg-del {
  opacity: 0; flex-shrink: 0; padding: 2px 7px;
  border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink-faint);
  font-family: var(--mono); font-size: 10px; cursor: pointer;
}
.msg-row:hover .msg-del, .msg-del:focus { opacity: 1; }
.msg-del:hover { color: var(--red); border-color: var(--red); }
.msg-reply { font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-system { font-size: 12.5px; color: var(--ink-faint); font-style: italic; padding: 4px 0; }

/* Content tokens, each built as a DOM node -- no message text ever becomes markup. */
.mention, .chanref, .roleref {
  padding: 0 3px; border-radius: 3px;
  background: rgba(88,101,242,0.18); color: #a5adf9; font-weight: 550;
}
.roleref { background: rgba(177,145,255,0.16); color: var(--violet); }
.chanref { background: rgba(89,213,224,0.14); color: var(--cyan); }
.msg-text a { color: var(--cyan); }
.icode { padding: 1px 5px; border-radius: 3px; background: #000; font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.cblock {
  display: block; margin: 5px 0; padding: 10px 12px;
  border: 1px solid var(--edge); border-radius: var(--radius);
  background: #000; font-family: var(--mono); font-size: 12.5px;
  white-space: pre; overflow-x: auto;
}

.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.att-img { max-width: min(400px, 100%); max-height: 300px; border-radius: var(--radius); border: 1px solid var(--edge); display: block; }
.att-vid { max-width: min(400px, 100%); border-radius: var(--radius); border: 1px solid var(--edge); }
.att-file {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--surface); color: var(--cyan); text-decoration: none; font-size: 13px;
}
.att-file:hover { border-color: var(--edge-hi); }
.att-size { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }

.embed {
  margin-top: 6px; padding: 11px 13px;
  border-left: 3px solid var(--edge-hi); border-radius: var(--radius);
  background: var(--surface); max-width: 480px;
}
.embed-author { font-size: 12.5px; font-weight: 650; margin-bottom: 3px; }
.embed-title { font-size: 14.5px; font-weight: 700; color: var(--cyan); margin-bottom: 3px; }
.embed-desc { font-size: 13.5px; color: var(--ink-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.embed-fields { display: grid; gap: 7px; margin-top: 8px; }
.embed-fields.inline { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.embed-field-name { font-size: 12.5px; font-weight: 700; }
.embed-field-value { font-size: 12.5px; color: var(--ink-dim); white-space: pre-wrap; overflow-wrap: anywhere; }
.embed-img { max-width: 100%; margin-top: 8px; border-radius: var(--radius); display: block; }
.embed-foot { margin-top: 7px; font-size: 11px; color: var(--ink-faint); }

/* ── the composer ───────────────────────────────────────────────────────── */

.composer { border-top: 1px solid var(--edge); padding: 10px clamp(12px, 2vw, 20px) 12px; background: rgba(12,12,14,0.94); }
.composer-row { display: flex; gap: 7px; align-items: flex-end; }
.msg { flex: 1; min-width: 0; resize: none; max-height: 180px; font-size: 14px; line-height: 1.45; }
.composer-foot { display: flex; align-items: center; gap: 14px; margin-top: 7px; }
.count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.count.over { color: var(--red); }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-dim); cursor: pointer; }
.switch input { accent-color: var(--yellow); }

.reply-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 8px;
  border: 1px solid var(--edge); border-left: 2px solid var(--cyan); border-radius: var(--radius);
  background: var(--surface); font-size: 12.5px; color: var(--ink-dim);
}
.reply-strip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.embed-editor { padding: 12px; margin-bottom: 9px; border: 1px solid var(--edge); border-radius: var(--radius-lg); background: var(--surface); }
.embed-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.embed-editor-head .card-label { margin: 0; flex: 1; }
.embed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 7px; }
.embed-grid textarea { grid-column: 1 / -1; }
.swatch-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-dim); }
.swatch-row input[type="color"] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--edge); border-radius: var(--radius); background: none; cursor: pointer; }
.field-row { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.field-row .field { flex: 1; min-width: 0; }

.files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 11px; border: 1px solid var(--edge); border-radius: 100px;
  background: var(--surface-2); font-size: 12px;
}
.file-chip button { border: none; background: none; color: var(--ink-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.file-chip button:hover { color: var(--red); }
.file-chip.too-big { border-color: var(--red); color: var(--red); }

/* ── buttons and fields ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 620;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--edge-hi); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: #14140b; font-weight: 720; }
.btn.primary:hover:not(:disabled) { background: #fff36b; border-color: #fff36b; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255,90,90,0.4); color: var(--red); }
.btn.danger:hover:not(:disabled) { background: rgba(255,90,90,0.12); border-color: var(--red); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--surface-2); color: var(--ink-dim);
  font-size: 17px; line-height: 1; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--edge-hi); }

.field {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--edge); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 13.5px;
}
.field:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-glow); }
select.field { cursor: pointer; }
textarea.field { resize: vertical; min-height: 62px; }
.field-label { display: grid; gap: 5px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }

/* ── cards ──────────────────────────────────────────────────────────────── */

.card {
  padding: 15px 16px; margin-bottom: 12px;
  border: 1px solid var(--edge); border-radius: var(--radius-lg);
  background: var(--surface);
}
.card-label {
  margin: 0 0 10px; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint);
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat { padding: 11px 12px; border: 1px solid var(--edge); border-radius: var(--radius); background: var(--surface-2); }
.stat b { display: block; font-size: 20px; font-weight: 800; color: var(--yellow); line-height: 1.15; }
.stat span { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

/* ── dialogs ────────────────────────────────────────────────────────────── */

.sheet {
  width: min(660px, calc(100vw - 24px));
  max-height: min(86vh, 900px);
  padding: 18px 20px 20px;
  border: 1px solid var(--edge-hi); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
  overflow-y: auto; overscroll-behavior: contain;
}
.sheet.small { width: min(420px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(3px); }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.sheet-title { flex: 1; margin: 0; font-size: 17px; font-weight: 750; min-width: 0; }
.mfa-form { display: flex; gap: 8px; align-items: center; }
.mfa-form .code-input { flex: 1; min-width: 0; }

/* the member sheet */
.who { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; min-width: 0; }
.who img { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-3); flex-shrink: 0; }
.who-main { min-width: 0; flex: 1; }
.who-name { margin: 0; font-size: 18px; font-weight: 750; word-break: break-word; }
.who-id { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.who-tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 10px 0 14px; }

.blocked-note {
  padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid rgba(249,236,49,0.28); border-radius: var(--radius);
  background: rgba(249,236,49,0.06); color: var(--yellow); font-size: 12.5px;
}
.act-grid { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.facts { display: grid; gap: 6px; margin-bottom: 16px; }
.fact { display: flex; gap: 12px; font-size: 12.5px; }
.fact-key { width: 108px; flex-shrink: 0; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); padding-top: 1px; }
.fact-val { min-width: 0; word-break: break-word; }

.role-picker { display: flex; gap: 5px; flex-wrap: wrap; }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border: 1px solid var(--edge); border-radius: 100px;
  background: var(--surface-2); font-size: 12px; cursor: pointer;
  font-family: inherit; color: var(--ink-dim); transition: border-color 0.18s, color 0.18s;
}
.role-chip:hover:not(:disabled) { border-color: var(--edge-hi); color: var(--ink); }
.role-chip:disabled { opacity: 0.35; cursor: not-allowed; }
.role-chip[aria-pressed="true"] { border-color: currentColor; }
.role-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.role-chip.admin::after { content: "ADMIN"; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; color: var(--red); }

.note { padding: 9px 11px; border: 1px solid var(--edge); border-left: 2px solid var(--cyan); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 6px; }
.note-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.note-meta { margin-top: 4px; font-family: var(--mono); font-size: 10px; color: var(--ink-faint); display: flex; gap: 8px; align-items: center; }
.note-meta button { margin-left: auto; background: none; border: none; color: var(--ink-faint); cursor: pointer; font-family: inherit; font-size: 10px; }
.note-meta button:hover { color: var(--red); }

/* ── toasts ─────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; inset: auto 0 20px 0; z-index: 90;
  display: grid; gap: 8px; justify-items: center;
  border: none; background: none; padding: 0; margin: 0; overflow: visible; width: 100%;
}
.toasts:not(:popover-open) { display: none; }
.toast {
  padding: 10px 16px; border: 1px solid var(--edge-hi); border-radius: var(--radius);
  background: var(--surface-3); color: var(--ink);
  font-size: 13px; box-shadow: 0 14px 34px -14px #000;
  max-width: min(520px, calc(100vw - 32px));
  animation: rise 0.25s var(--ease);
}
.toast.good { border-color: rgba(126,231,135,0.4); }
.toast.bad { border-color: rgba(255,90,90,0.5); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── narrow screens ─────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(280px, 84vw);
    transform: translateX(-102%); transition: transform 0.22s var(--ease);
    background: var(--bg);
  }
  .app.side-open .side { transform: none; box-shadow: 0 0 60px #000; }
  .side-head .icon-btn { display: grid; }
  .side-toggle { display: grid; }
  .msg-group { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
  .msg-avatar { width: 30px; height: 30px; }
  .msg-del { opacity: 1; }
  .embed-grid { grid-template-columns: minmax(0, 1fr); }
  .sheet { width: 100vw; max-width: 100vw; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
}

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