/* A dark console like the other dashboards, built for a phone first: one column that becomes two on a wide screen. */
:root {
  color-scheme: dark;
  --bg: #070a12; --surface: #0f1524; --surface-2: #151d30; --line: rgba(148, 170, 214, .14); --line-2: rgba(148, 170, 214, .28);
  --ink: #eef3fb; --muted: #93a1bd; --accent: #1dbf73; --accent-2: #22d3ee;
  --good: #35d07f; --warn: #fbb315; --bad: #ff7a7a; --info: #62a8ff;
  --grad: linear-gradient(135deg, #1dbf73 0%, #22d3ee 100%);
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg);
  background-image: radial-gradient(900px 480px at 88% -8%, rgba(34, 211, 238, .12), transparent 62%), radial-gradient(800px 520px at -6% 8%, rgba(29, 191, 115, .1), transparent 60%);
  background-attachment: fixed;
}
h1, h2, h3, p { margin: 0; }
h2 { font-size: 19px; }
h3 { font-size: 16.5px; }
small, .meta, .hint, .note { color: var(--muted); font-size: 13px; }
b { font-weight: 600; }
.grow { flex: 1; min-width: 0; }

/* controls */
button { font: inherit; font-size: 14px; font-weight: 600; border-radius: 10px; border: 1px solid transparent; padding: 9px 16px; cursor: pointer; color: var(--ink); background: transparent; }
button.small { padding: 6px 12px; font-size: 13px; }
button.primary { background: var(--grad); color: #03150d; }
button.primary:hover { filter: brightness(1.1); }
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost, .ghost-link { border-color: var(--line-2); background: rgba(255, 255, 255, .02); }
button.ghost:hover, .ghost-link:hover { border-color: var(--accent); }
button.danger { border-color: rgba(255, 122, 122, .35); color: var(--bad); }
.ghost-link { display: inline-block; font-size: 13px; font-weight: 600; border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 12px; color: var(--ink); text-decoration: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
input, select, textarea { font: inherit; color: var(--ink); background: #0a0f1c; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
label input, label select { display: block; width: 100%; margin-top: 6px; }
textarea { width: 100%; resize: vertical; min-height: 76px; }

.panel { background: linear-gradient(180deg, var(--surface-2), var(--surface) 70%); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel > h3 { margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-2); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.good { color: var(--good); background: rgba(53, 208, 127, .1); border-color: rgba(53, 208, 127, .32); }
.pill.warn { color: var(--warn); background: rgba(251, 179, 21, .1); border-color: rgba(251, 179, 21, .32); }
.pill.bad { color: var(--bad); background: rgba(255, 122, 122, .1); border-color: rgba(255, 122, 122, .32); }
.pill.info { color: var(--info); background: rgba(98, 168, 255, .1); border-color: rgba(98, 168, 255, .32); }
.pill.muted { color: var(--muted); }

/* the frame */
.app { min-height: 100%; display: flex; flex-direction: column; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px clamp(12px, 2.4vw, 32px); border-bottom: 1px solid var(--line); background: rgba(10, 14, 26, .82); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15.5px; line-height: 1.2; }
.brand small { display: block; line-height: 1.2; }
.logo { width: 34px; height: 34px; border-radius: 11px; flex: none; box-shadow: 0 0 22px rgba(29, 191, 115, .4);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 10h18v11H14l-5 4v-4H7z' fill='none' stroke='%23051b12' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E") center / cover, var(--grad); }
nav { display: flex; gap: 4px; margin-right: auto; }
nav button { color: var(--muted); padding: 8px 12px; }
nav button:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
nav button.on { color: var(--ink); background: linear-gradient(90deg, rgba(29, 191, 115, .2), rgba(34, 211, 238, .05)); border-color: rgba(29, 191, 115, .35); }
nav em { font-style: normal; font-size: 11.5px; padding: 1px 7px; margin-left: 6px; border-radius: 99px; background: var(--accent); color: #03150d; }
.account-pick { margin: 0; display: flex; align-items: center; gap: 8px; }
.account-pick select { margin: 0; padding: 6px 10px; width: auto; }
main { flex: 1; min-height: 0; padding: 16px clamp(12px, 2.4vw, 32px) 24px; width: 100%; max-width: 1500px; margin: 0 auto; }

/* inbox */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; height: calc(100vh - 110px); height: calc(100dvh - 110px); min-height: 420px; }
@media (min-width: 900px) { .split { grid-template-columns: 360px minmax(0, 1fr); } }
.split .panel { margin: 0; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
@media (max-width: 899px) {
  .split.opened .list-pane { display: none; }
  .split:not(.opened) .thread-pane { display: none; }
}
@media (min-width: 900px) { .back { display: none; } }
.list-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.list-head input { flex: 1; min-width: 0; padding: 8px 12px; }
.convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.convs li { padding: 0; border-bottom: 1px solid var(--line); }
.convs button { display: block; width: 100%; text-align: left; border-radius: 0; padding: 12px 14px; font-weight: 400; }
.convs button:hover, .convs li.on button { background: rgba(255, 255, 255, .04); }
.convs li.on button { box-shadow: inset 3px 0 0 var(--accent); }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top small { white-space: nowrap; }
.conv-text { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convs li.unread .conv-text { color: var(--ink); }
.convs .dot { display: inline-block; min-width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 99px; background: var(--accent); color: #03150d; font-size: 12px; font-weight: 700; padding: 0 6px; }
.convs .flag { font-size: 12px; font-weight: 600; margin-left: 6px; }
.flag.sending { color: var(--info); } .flag.bad { color: var(--bad); }
.empty-note { padding: 28px 18px; color: var(--muted); text-align: center; }
.thread-empty { margin: auto; text-align: center; padding: 30px; max-width: 420px; }
.thread-empty p { color: var(--muted); margin-top: 8px; }
#thread { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.thread-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(251, 179, 21, .06); color: var(--warn); }
.note.info { background: rgba(98, 168, 255, .06); color: var(--info); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.day { align-self: center; color: var(--muted); font-size: 12px; margin: 6px 0 2px; }
.msg { max-width: min(78%, 620px); padding: 9px 13px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.out { align-self: flex-end; background: rgba(29, 191, 115, .13); border-color: rgba(29, 191, 115, .32); }
.msg.in { align-self: flex-start; }
.msg .when { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); white-space: normal; }
.msg.partial .when::after { content: " (the start of it; load the full conversation for the rest)"; }
.msg.job { border-style: dashed; }
.msg.job.failed, .msg.job.unconfirmed { border-color: rgba(255, 122, 122, .5); background: rgba(255, 122, 122, .08); }
.msg .job-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; white-space: normal; font-size: 12.5px; }
.msg .job-line button { padding: 3px 10px; font-size: 12px; }
.reply { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.reply-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.reply-row .hint { margin-left: auto; }
.reply-row small.over { color: var(--bad); }
@media (max-width: 560px) { .reply-row .hint { display: none; } .reply-row button { margin-left: auto; } }

/* connections */
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.columns .panel { padding: 18px; }
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 13.5px; }
.steps li { margin-bottom: 6px; } .steps b { color: var(--ink); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .grow { min-width: 160px; } .list b, .list small { display: block; overflow-wrap: anywhere; }

/* sign in */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, 400px); gap: 48px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 28px 20px; }
.auth-intro h2 { font-size: clamp(28px, 4vw, 42px); line-height: 1.15; margin: 26px 0 12px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-intro p { color: var(--muted); font-size: 16px; max-width: 460px; }
.auth form { padding: 26px; margin: 0; }
.auth form .primary { width: 100%; }
@media (max-width: 800px) { .auth { grid-template-columns: minmax(0, 1fr); gap: 24px; } }

#message { position: fixed; z-index: 20; right: 16px; bottom: 16px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 12px; background: #13261f; border: 1px solid var(--accent); box-shadow: 0 14px 34px rgba(0, 0, 0, .45); }
#message:empty { display: none; }
#message.bad { background: #2a161b; border-color: var(--bad); }
@media (max-width: 640px) {
  .bar { gap: 8px 10px; }
  .bar nav { order: 3; width: 100%; }
  #vps { margin-left: auto; }
  .msg { max-width: 90%; }
}

.bad-text { color: var(--bad); }
