/* Messaging Middleware — admin panel.
   Glassmorphic: frosted translucent surfaces over a soft colour field. Every panel
   shares one .glass recipe so the whole system reads as the same material.

   Tokens live on bare :root, so nothing depends on a media query having matched. */
:root{
  /* Colour field behind the glass */
  --bg:#080d16;
  --orb-1:#2f6bff;
  --orb-2:#7a3cff;
  --orb-3:#00c2a8;

  /* The glass itself */
  --glass:rgba(255,255,255,.07);
  --glass-2:rgba(255,255,255,.085);
  --glass-brd:rgba(255,255,255,.13);
  --glass-hi:rgba(255,255,255,.20);
  --shadow:0 10px 34px rgba(0,0,0,.34);
  /* Panels you read or type into need a near-solid surface. Frosted glass is for
     chrome, not for forms — at low opacity the page behind bleeds through and the
     text sits on a moving background. */
  --surface:rgba(19,28,42,.94);
  --field:rgba(255,255,255,.07);
  /* Veil over the colour field. Without it the orbs tint every panel and the
     tables read as purple cards rather than neutral frosted glass. */
  --scrim:rgba(8,13,22,.62);
  --blur:22px;

  --text:#eaf1fb;
  --muted:#93a6c0;
  --accent:#6aa6ff;
  --accent-2:#9d7bff;
  --ok:#3ad29f;
  --warn:#f0b34a;
  --danger:#ff6b63;

  --radius:14px;
  --radius-sm:10px;
}

@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]){
    --bg:#eef2f9;
    --orb-1:#7ea8ff;
    --orb-2:#c0a3ff;
    --orb-3:#7ce0d0;

    --glass:rgba(255,255,255,.60);
    --glass-2:rgba(255,255,255,.78);
    --glass-brd:rgba(255,255,255,.85);
    --glass-hi:rgba(255,255,255,.95);
    --shadow:0 10px 30px rgba(31,52,92,.12);
    --surface:rgba(255,255,255,.97);
    --field:#f4f7fb;
    --scrim:rgba(238,242,249,.50);

    --text:#16202f;
    --muted:#5b6c85;
    --accent:#1667d8;
    --accent-2:#7a4ddb;
    --ok:#0f9c6d;
    --warn:#b9791a;
    --danger:#d8443c;
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:var(--bg);color:var(--text);
  font:14px/1.5 "Segoe UI",system-ui,-apple-system,sans-serif;
  -webkit-font-smoothing:antialiased;
}

/* ── The colour field ─────────────────────────────────────────────────────
   Frosted glass needs something to refract. These blurred orbs are what the
   backdrop-filter actually picks up — without them every panel reads as flat grey. */
.aurora{position:fixed;inset:0;overflow:hidden;pointer-events:none;z-index:0}
.aurora::after{content:"";position:absolute;inset:0;background:var(--scrim)}
.orb{position:absolute;border-radius:50%;filter:blur(110px);opacity:.34}
.orb.o1{width:52vw;height:52vw;left:-12vw;top:-14vw;background:var(--orb-1)}
.orb.o2{width:44vw;height:44vw;right:-10vw;top:8vh;background:var(--orb-2);opacity:.26}
.orb.o3{width:40vw;height:40vw;left:22vw;bottom:-18vw;background:var(--orb-3);opacity:.20}

/* ── The one glass recipe ─────────────────────────────────────────────────
   The inset top highlight is what sells it: real glass catches light on its
   upper edge, and without that line the panels look like plain transparency. */
.glass{
  background:var(--glass);
  backdrop-filter:blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter:blur(var(--blur)) saturate(150%);
  border:1px solid var(--glass-brd);
  box-shadow:var(--shadow), inset 0 1px 0 var(--glass-hi);
  border-radius:var(--radius);
}

.sprite{display:none}
.hidden{display:none !important}
.muted{color:var(--muted)}
.small{font-size:12px}
.spacer{flex:1}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
a{color:var(--accent)}
code{
  background:var(--glass-2);border:1px solid var(--glass-brd);
  padding:1px 6px;border-radius:6px;font-size:12px;
}

/* ── Icons ───────────────────────────────────────────────────────────────── */
.ic{
  width:18px;height:18px;flex:0 0 auto;
  fill:none;stroke:currentColor;stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round;
  vertical-align:-3px;
}
.ic.sm{width:15px;height:15px;stroke-width:2}
.ic.lg{width:26px;height:26px}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-wrap{
  position:relative;z-index:1;min-height:100vh;
  display:flex;align-items:center;justify-content:center;padding:22px;
}
.login-card{padding:32px;width:100%;max-width:396px;background:var(--surface)}
.login-mark{
  width:52px;height:52px;border-radius:15px;
  display:flex;align-items:center;justify-content:center;
  background:linear-gradient(140deg,var(--accent),var(--accent-2));
  color:#fff;box-shadow:0 8px 20px rgba(47,107,255,.34);margin-bottom:16px;
}
.login-card h1{margin:0;font-size:21px;letter-spacing:-.2px}
.login-card p{margin:4px 0 20px}
.err-text{color:var(--danger);min-height:18px;margin:10px 0 0;font-size:13px}

/* ── Shell ───────────────────────────────────────────────────────────────── */
#app{position:relative;z-index:1;display:flex;min-height:100vh;padding:12px;gap:12px}
.sidenav{
  width:216px;flex:0 0 216px;
  display:flex;flex-direction:column;padding:14px 10px;gap:4px;
  position:sticky;top:12px;height:calc(100vh - 24px);
}
.sidenav .brand{
  display:flex;align-items:center;gap:9px;
  font-size:16px;padding:6px 10px 16px;color:var(--text);
}
.sidenav .brand .ic{color:var(--accent)}
.sidenav nav{display:flex;flex-direction:column;gap:3px}
.sidenav-foot{
  margin-top:auto;display:flex;flex-direction:column;gap:3px;
  padding-top:12px;border-top:1px solid var(--glass-brd);
}
.nav-item{
  display:flex;align-items:center;gap:10px;
  text-align:left;text-decoration:none;
  background:none;border:1px solid transparent;color:var(--muted);font:inherit;
  padding:9px 11px;border-radius:var(--radius-sm);cursor:pointer;
  transition:background .16s, color .16s, border-color .16s;
}
.nav-item:hover{background:var(--glass-2);color:var(--text)}
.nav-item.active{
  background:linear-gradient(100deg,rgba(106,166,255,.20),rgba(157,123,255,.13));
  border-color:rgba(106,166,255,.34);color:var(--text);font-weight:600;
}
.nav-item.active .ic{color:var(--accent)}

.content{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px}
.topbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:4px 8px}
.topbar h2{margin:0;font-size:20px;letter-spacing:-.3px;flex:1 1 200px;min-width:0}
.screen{display:flex;flex-direction:column;gap:12px}

.banner{
  padding:11px 15px;border-radius:var(--radius);
  background:rgba(240,179,74,.13);border:1px solid rgba(240,179,74,.42);
  backdrop-filter:blur(var(--blur));-webkit-backdrop-filter:blur(var(--blur));
  display:flex;gap:10px;align-items:center;flex-wrap:wrap;
}
.banner .ic{color:var(--warn)}

/* ── Cards, toolbars ─────────────────────────────────────────────────────── */
.card{padding:16px}
.card h3{margin:0 0 12px;font-size:15px}
.scroll-x{overflow-x:auto}
.toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap;padding:11px 13px}
h3.sec{
  display:flex;align-items:center;gap:8px;
  margin:8px 0 0;font-size:15px;color:var(--muted);font-weight:600;
}

.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:12px}
.stat{
  padding:16px;background:var(--glass);
  backdrop-filter:blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter:blur(var(--blur)) saturate(150%);
  border:1px solid var(--glass-brd);border-radius:var(--radius);
  box-shadow:var(--shadow), inset 0 1px 0 var(--glass-hi);
  position:relative;overflow:hidden;
}
/* A thin lit edge along the top, tinted per tile. */
.stat::after{
  content:"";position:absolute;left:0;right:0;top:0;height:2px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));opacity:.8;
}
.stat.bad::after{background:var(--danger)}
.stat .n{font-size:29px;font-weight:700;line-height:1.05;letter-spacing:-.5px}
.stat.bad .n{color:var(--danger)}
.stat .k{color:var(--muted);font-size:12px;margin-top:5px}
.steps{margin:0;padding-left:20px;color:var(--muted)}
.steps li{margin:6px 0}

/* ── Inputs ──────────────────────────────────────────────────────────────── */
.input,
input:not([type="checkbox"]):not([type="radio"]),
select,textarea{
  background:var(--field);color:var(--text);
  border:1px solid var(--glass-brd);border-radius:var(--radius-sm);
  padding:9px 11px;font:inherit;outline:none;max-width:100%;
  min-height:38px;line-height:1.3;
  transition:border-color .16s, box-shadow .16s;
}
.input::placeholder,input::placeholder,textarea::placeholder{color:var(--muted);opacity:.7}
input:read-only,textarea:read-only{opacity:.75;cursor:default}
.input:focus,input:focus,select:focus,textarea:focus{
  border-color:var(--accent);box-shadow:0 0 0 3px rgba(106,166,255,.18);
}
textarea{width:100%;resize:vertical;font-family:inherit}
select{cursor:pointer}
option{background:var(--bg);color:var(--text)}

.search-wrap{position:relative;display:inline-flex;align-items:center}
.search-wrap .ic{position:absolute;left:10px;color:var(--muted);pointer-events:none}
.search-wrap .input{padding-left:31px;min-width:210px}

.field{display:flex;flex-direction:column;gap:6px;margin-bottom:13px}
/* Labels mix a bold name with plain descriptive text and <small> hints, so the span
   itself stays inline and muted — the emphasis comes from <b>, not the container.
   (Making the span a flexbox turns its text nodes into flex items and wrecks wrapping.) */
.field > span{font-size:12px;color:var(--muted);line-height:1.45}
.field > span b{color:var(--text);font-weight:650}
.field > span small{color:var(--muted);opacity:.85;font-size:11.5px}
.field input,.field select,.field textarea{width:100%}
.check{
  display:inline-flex;gap:7px;align-items:center;
  color:var(--muted);font-size:13px;cursor:pointer;user-select:none;
}
.check input{width:auto;accent-color:var(--accent)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px;align-items:start}
.grid2 > .field{min-width:0}
@media (max-width:680px){ .grid2{grid-template-columns:1fr} }

.btn{
  display:inline-flex;align-items:center;gap:7px;
  background:var(--glass-2);color:var(--text);
  border:1px solid var(--glass-brd);border-radius:var(--radius-sm);
  padding:8px 14px;font:inherit;cursor:pointer;white-space:nowrap;
  backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  transition:transform .12s, border-color .16s, background .16s, box-shadow .16s;
}
.btn:hover{border-color:var(--accent);transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  border-color:transparent;color:#fff;font-weight:600;
  box-shadow:0 6px 16px rgba(47,107,255,.30);
}
.btn.primary:hover{box-shadow:0 9px 22px rgba(47,107,255,.40)}
.btn.ghost{background:transparent}
/* A ghost button that becomes active — the log tabs — must still get the primary
   fill. Without this the later .btn.ghost rule wins on equal specificity, leaving
   white text on a transparent background: invisible in the light theme. */
.btn.ghost.primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  border-color:transparent;color:#fff;
}
.btn.danger{color:var(--danger);border-color:rgba(255,107,99,.45)}
.btn.danger:hover{border-color:var(--danger);background:rgba(255,107,99,.10)}
.btn.small{padding:5px 10px;font-size:12px;border-radius:8px;gap:5px}
.btn.wide{width:100%;margin-top:8px;justify-content:center}
.btn:disabled{opacity:.45;cursor:not-allowed;transform:none}
.x{
  background:none;border:0;color:var(--muted);cursor:pointer;
  padding:5px;border-radius:8px;display:inline-flex;line-height:0;
}
.x:hover{color:var(--danger);background:rgba(255,107,99,.12)}

/* ── Tables ──────────────────────────────────────────────────────────────── */
.grid{width:100%;border-collapse:collapse;font-size:13px}
.grid th,.grid td{
  padding:10px 11px;text-align:left;
  border-bottom:1px solid var(--glass-brd);vertical-align:middle;
}
.grid thead th{
  color:var(--muted);font-size:10.5px;text-transform:uppercase;
  letter-spacing:.6px;white-space:nowrap;font-weight:700;
}
.grid tbody tr{transition:background .14s}
.grid tbody tr:hover{background:var(--glass-2)}
.grid tbody tr:last-child td{border-bottom:0}
.grid td.actions{white-space:nowrap;text-align:right}
.grid td.actions .btn{margin-left:5px}
.grid .empty{color:var(--muted);text-align:center;padding:26px}
.mono{font-family:ui-monospace,"Cascadia Mono",Consolas,monospace;font-size:12px}
.wrap-body{max-width:340px;white-space:pre-wrap;word-break:break-word;color:var(--muted)}

.pill{
  display:inline-flex;align-items:center;gap:5px;
  font-size:11px;padding:3px 9px;border-radius:99px;
  border:1px solid var(--glass-brd);background:var(--glass-2);
  color:var(--muted);white-space:nowrap;font-weight:600;
}
.pill.ok{color:var(--ok);border-color:rgba(58,210,159,.42);background:rgba(58,210,159,.11)}
.pill.bad{color:var(--danger);border-color:rgba(255,107,99,.42);background:rgba(255,107,99,.11)}
.pill.warn{color:var(--warn);border-color:rgba(240,179,74,.42);background:rgba(240,179,74,.11)}
.pill.info{color:var(--accent);border-color:rgba(106,166,255,.42);background:rgba(106,166,255,.11)}

.pager{
  display:flex;gap:10px;align-items:center;justify-content:center;
  color:var(--muted);font-size:13px;padding:4px;
}

/* ── Drawer ──────────────────────────────────────────────────────────────── */
.drawer-back{
  position:fixed;inset:0;background:rgba(4,8,16,.62);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  display:flex;justify-content:flex-end;align-items:stretch;z-index:50;padding:12px;
}
.drawer{
  width:min(660px,100%);display:flex;flex-direction:column;
  height:100%;max-height:100%;overflow:hidden;
  background:var(--surface);
  animation:slide-in .2s ease-out;
}
/* The head and foot must never shrink, or a long form squeezes the Save button
   out of view instead of scrolling the middle. */
.drawer-head,.drawer-foot{flex:0 0 auto}
@keyframes slide-in{from{transform:translateX(22px);opacity:.4}to{transform:none;opacity:1}}
@media (prefers-reduced-motion: reduce){
  .drawer{animation:none}
  .btn:hover{transform:none}
}
.drawer-head{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:15px 19px;border-bottom:1px solid var(--glass-brd);
}
.drawer-head h3{margin:0;font-size:16px}
/* min-height:0 is what actually makes this scroll. A flex item defaults to
   min-height:auto, which refuses to shrink below its content — so the body grew
   instead of scrolling and pushed the footer off the bottom of the screen. */
.drawer-body{padding:19px;overflow-y:auto;flex:1 1 auto;min-height:0}
.drawer-foot{
  padding:13px 19px;border-top:1px solid var(--glass-brd);
  display:flex;gap:9px;justify-content:flex-end;flex-wrap:wrap;
}
.hint{color:var(--muted);font-size:12px;margin:-5px 0 13px;line-height:1.55}
.check + .hint{margin-top:8px}
/* The last element in a form should not sit flush against the footer. */
.drawer-body > :last-child{margin-bottom:4px}
/* Section heading inside a drawer or card. */
.sec-head{
  margin:16px 0 8px;font-size:12px;text-transform:uppercase;
  letter-spacing:.6px;color:var(--muted);font-weight:700;
}
/* The log tables carry more columns than the others, so they get tighter cells. */
#lgTable th,#lgTable td{padding:8px 9px}
.secret-box{
  background:var(--glass-2);border:1px dashed var(--warn);
  border-radius:var(--radius-sm);padding:13px;margin:11px 0;word-break:break-all;
}

/* Nested tables inside a drawer sit on the drawer's own glass, so they get a
   plain surface rather than a second frosted layer stacked on the first. */
.drawer-body .grid th,.drawer-body .grid td{padding:8px 9px}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast{
  position:fixed;bottom:24px;left:50%;transform:translateX(-50%);
  padding:12px 20px;z-index:100;max-width:90vw;
}
.toast.ok{border-color:rgba(58,210,159,.55)}
.toast.err{border-color:rgba(255,107,99,.55)}

/* ── Fallback where backdrop-filter is unsupported ───────────────────────
   Without this the panels would be near-transparent and the text unreadable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  .glass,.stat{background:#141d2c}
  :root:not([data-theme="dark"]) .glass,
  :root:not([data-theme="dark"]) .stat{background:#fff}
}

/* ── Inbox ──────────────────────────────────────────────────────────────────
   Two columns: conversation list and the open thread. Both scroll on their own
   so the page itself never does — the composer must stay put while the thread
   moves under it. */
.inbox{
  display:grid;grid-template-columns:340px 1fr;gap:12px;
  height:calc(100vh - 130px);min-height:420px;
}
@media (max-width:900px){ .inbox{grid-template-columns:1fr;height:auto} }

.inbox-list{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.inbox-filters{display:flex;gap:8px;padding:10px 10px 0;flex-wrap:wrap}
.inbox-filters .input{flex:1;min-width:0}
.inbox-filters .search-wrap .input{min-width:0}
.convo-list{flex:1 1 auto;min-height:0;overflow-y:auto;padding:8px}

.convo{
  width:100%;display:flex;gap:10px;align-items:flex-start;text-align:left;
  background:none;border:1px solid transparent;border-radius:var(--radius-sm);
  padding:9px 10px;cursor:pointer;color:var(--text);font:inherit;margin-bottom:2px;
}
.convo:hover{background:var(--glass-2)}
.convo.active{background:rgba(106,166,255,.16);border-color:rgba(106,166,255,.34)}
.convo-avatar{
  width:34px;height:34px;flex:0 0 auto;border-radius:50%;
  display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;
  background:linear-gradient(140deg,var(--accent),var(--accent-2));color:#fff;
}
.convo-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.convo-top{display:flex;align-items:center;gap:6px}
.convo-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
.convo-time{color:var(--muted);font-size:11px;flex:0 0 auto}
.convo-sub{display:flex;align-items:center;gap:6px}
.convo-snip{
  flex:1;min-width:0;color:var(--muted);font-size:12px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.convo-meta{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.unread{
  background:var(--accent);color:#fff;border-radius:99px;
  font-size:10px;font-weight:700;padding:1px 6px;flex:0 0 auto;
}
.nav-badge{
  margin-left:auto;background:var(--accent);color:#fff;
  border-radius:99px;font-size:10px;font-weight:700;padding:1px 6px;
}

.inbox-thread{display:flex;flex-direction:column;min-height:0;overflow:hidden}
.thread-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  padding:13px 16px;border-bottom:1px solid var(--glass-brd);flex:0 0 auto;
}
.thread-name{font-weight:650}
.thread-body{
  flex:1 1 auto;min-height:0;overflow-y:auto;
  padding:16px;display:flex;flex-direction:column;gap:8px;
}
.thread-empty{margin:auto;color:var(--muted);font-size:13px}

.msg{
  max-width:min(560px,78%);padding:9px 12px;border-radius:12px;
  border:1px solid var(--glass-brd);background:var(--glass-2);
  word-break:break-word;white-space:pre-wrap;
}
.msg.in{align-self:flex-start;border-bottom-left-radius:4px}
.msg.out{
  align-self:flex-end;border-bottom-right-radius:4px;
  background:linear-gradient(135deg,rgba(106,166,255,.22),rgba(157,123,255,.16));
  border-color:rgba(106,166,255,.34);
}
.msg.failed{border-color:var(--danger);background:rgba(255,107,99,.12)}
.msg-text{font-size:13.5px;line-height:1.45}
.msg-meta{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  margin-top:5px;font-size:10.5px;color:var(--muted);
}
.msg-meta .tag{
  background:var(--glass-2);border:1px solid var(--glass-brd);
  border-radius:4px;padding:0 5px;
}
.tick{font-weight:600}
.tick.bad{color:var(--danger)}

.thread-composer{
  display:flex;gap:9px;align-items:flex-end;
  padding:11px 14px;border-top:1px solid var(--glass-brd);flex:0 0 auto;
}
.thread-composer textarea{flex:1;resize:none;max-height:140px;min-height:38px}
.thread-note{
  padding:0 16px 10px;color:var(--warn);font-size:11.5px;flex:0 0 auto;
}
.thread-note:empty{display:none}

/* Per-number unread chips above the conversation list. Only numbers with something
   waiting appear, so this stays a signal rather than a second navigation bar. */
.inbox-summary{display:flex;gap:6px;flex-wrap:wrap;padding:8px 10px 0}
.inbox-summary:empty{display:none}
.chip{
  display:inline-flex;align-items:center;gap:6px;
  background:var(--glass-2);border:1px solid var(--glass-brd);
  border-radius:99px;padding:3px 10px;font:inherit;font-size:11.5px;
  color:var(--text);cursor:pointer;
}
.chip:hover{border-color:var(--accent)}
.chip-n{
  background:var(--accent);color:#fff;border-radius:99px;
  font-size:10px;font-weight:700;padding:0 5px;
}
/* Which of our numbers the conversation came in on — the thing you scan for when
   several businesses share one inbox. */
.convo-meta .via{
  color:var(--accent);font-weight:600;
}

/* ── Attachments ────────────────────────────────────────────────────────────
   A photo someone sent should look like a photo, not like a link to one. */
.msg-media { margin-bottom: 6px; }
.msg-media img, .msg-media video {
  max-width: min(320px, 68vw); max-height: 320px; width: auto; height: auto;
  border-radius: 10px; display: block; cursor: zoom-in; background: rgba(0,0,0,.04);
}
.msg-media audio { width: min(320px, 68vw); display: block; }
.file-chip {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  padding: 9px 11px; border-radius: 10px; background: rgba(0,0,0,.05);
  color: inherit; max-width: min(320px, 68vw);
}
.msg.out .file-chip { background: rgba(255,255,255,.35); }
.file-chip:hover { background: rgba(0,0,0,.09); }
.file-chip .fc-icon { font-size: 19px; line-height: 1; flex: 0 0 auto; }
.file-chip .fc-name {
  font-weight: 600; font-size: 13px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.file-chip .fc-sub { font-size: 11px; opacity: .65; }
.media-bad { font-size: 12px; opacity: .7; font-style: italic; }

.attach-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 9px 12px 0 12px; }
.attach-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  padding: 5px 9px; border-radius: 999px; background: rgba(0,0,0,.06);
}
.attach-pill img { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; }
.attach-pill button {
  border: 0; background: none; cursor: pointer; font-size: 15px;
  line-height: 1; opacity: .55; padding: 0;
}
.attach-pill button:hover { opacity: 1; }

/* Full-size view of a thumbnail, without leaving the thread. */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: flex; cursor: zoom-out;
  align-items: center; justify-content: center; background: rgba(0,0,0,.82);
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
