/* Layout: two-pane inbox (message list | detail) under a toolbar; stacks to one column on phones */
:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --line: #dde2e8;
  --fg: #17202b;
  --muted: #5c6877;
  --accent: #1f6feb;
  --accent-soft: #e5efff;
  --bubble: #e9edf2;
  --ok: #1a7f4b;   --ok-soft: #e3f4ea;
  --warn: #9a6200; --warn-soft: #fff3d6;
  --bad: #c0362c;  --bad-soft: #fde8e6;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0f141a; --panel: #161c24; --line: #29323d; --fg: #e4e9ef; --muted: #93a0b0;
  --accent: #5b9bff; --accent-soft: #1a2a44; --bubble: #232c37;
  --ok: #4fc98a; --ok-soft: #14301f; --warn: #e8b04a; --warn-soft: #33280f; --bad: #ff7b70; --bad-soft: #3a1a18;
  color-scheme: dark;
}}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 14px; }
.wrap { padding-inline: 16px; padding-block: 16px 32px; max-width: 1280px; margin: 0 auto; display: grid; gap: 12px; }

header.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-right: auto; }
.brand h1 { font-size: 18px; font-weight: 600; margin: 0; }
.env { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; background: var(--warn-soft); color: var(--warn); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.live.down i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
input[type=search], select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
input[type=search] { width: 260px; max-width: 100%; }
button { font: inherit; cursor: pointer; border-radius: 6px; padding: 7px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 12px; }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.banner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-weight: 500; }
.banner code { font-family: var(--mono); font-weight: 400; }

.panes { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 560px; }
.list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 720px; }
.list-head { display: flex; justify-content: space-between; padding: 10px 14px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:hover { background: var(--bg); }
.row[aria-selected=true] { background: var(--accent-soft); }
.row .to { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.row .time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.row .snip { grid-column: 1 / -1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.row.unread .to::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: middle; }

.pill { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--bubble); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.src { background: var(--accent-soft); color: var(--accent); }

.detail { padding: 20px 24px; display: grid; gap: 18px; align-content: start; min-width: 0; }
.dhead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dhead h2 { font-family: var(--mono); font-size: 17px; font-weight: 500; margin: 0 auto 0 0; }
.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.meta div { display: grid; gap: 2px; }
.meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.meta dd { margin: 0; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--muted); }
.tabs button[aria-selected=true] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 500; }
.tab-body { display: grid; gap: 12px; min-width: 0; }

.phone { max-width: 360px; border: 1px solid var(--line); border-radius: 22px; padding: 18px 14px 22px; background: var(--bg); display: grid; gap: 10px; }
.phone .sid { text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; }
.bubble { background: var(--bubble); border-radius: 16px 16px 16px 4px; padding: 10px 13px; line-height: 1.45; overflow-wrap: anywhere; justify-self: start; max-width: 92%; white-space: pre-wrap; }
.bubble a { color: var(--accent); }
.otp { font-family: var(--mono); font-weight: 500; background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 3px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick a { text-decoration: none; }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

pre { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-x: auto; }
.attempts { display: grid; gap: 8px; }
.attempt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.attempt span:nth-child(2) { font-family: var(--mono); overflow-wrap: anywhere; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-size: 13px; }
.note { font-size: 12px; color: var(--muted); margin: 0; }

@media (max-width: 760px) {
  .panes { grid-template-columns: 1fr; }
  .list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 340px; }
  .detail { padding: 16px; }
  input[type=search] { width: 100%; }
}