/* Boomerang shell and server pages. Needs tokens.css first. */
:root { --shell-w: 1440px; --gutter: 28px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--backdrop); color: var(--fg);
  font-family: var(--font); font-weight: 400; font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); }
b, strong, th { font-weight: 500; }
h1 { font-weight: 300; font-size: 40px; letter-spacing: -0.018em; line-height: 1.15; margin: 0 0 12px; }
h1 em { font-style: normal; font-weight: 500; color: var(--accent); }
.muted { color: var(--muted); }
code { background: var(--surface-strong); padding: 1px 6px; border-radius: 4px; font-family: var(--font); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); }
.logo img { height: 20px; width: auto; }
.logo .on-dark { display: var(--logo-on-dark); }
.logo .on-light { display: var(--logo-on-light); }
.logo .product { font-weight: 300; font-size: 20px; letter-spacing: -0.01em; padding-left: 12px; border-left: 1px solid var(--line); }
.logo .product em { font-style: normal; font-weight: 500; color: var(--accent); }

.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 11px 20px; cursor: pointer; white-space: nowrap;
  background: var(--mx-capital-blue); color: var(--mx-white); font: 500 15px/1.2 var(--font); text-decoration: none;
}
.btn:hover { opacity: 0.9; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.ghost.on { border-color: var(--accent); color: var(--accent); }
.link { background: none; border: 0; padding: 6px 8px; margin: -6px -8px; min-height: 28px; font: 400 12px var(--font); color: var(--muted); cursor: pointer; }
.link:hover, .link.on { color: var(--accent); }
.err { color: var(--accent-2); font-size: 12px; margin: 4px 0 0; }

/* Shared top bar: logo left, who you are and links right */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.topbar .who { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
.topbar .who a { color: var(--muted); text-decoration: none; }
.topbar .who a:hover { color: var(--accent); }
.sep { margin: 0 10px; opacity: 0.5; }

/* Server pages (setup, login, errors) and the dashboard */
.page::before, .shell-head::before { content: ""; position: absolute; top: 0; left: var(--gutter); width: 14%; height: 4px; background: var(--accent); }
.page { position: relative; max-width: 720px; margin: 0 auto; padding: 72px var(--gutter); }
.page > .logo { margin-bottom: 56px; }
.page > .topbar { margin-bottom: 40px; }
.page > form, .page p { margin: 0 0 20px; }
pre { white-space: pre-wrap; font-family: var(--font); font-size: 13px; }

/* Decision shell: header, page and discussion side by side, answer dock */
body.shell { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
.shell-head { position: relative; width: 100%; max-width: var(--shell-w); margin: 0 auto; padding: 22px var(--gutter) 0; }
.meta { margin: 0; padding: 16px 0 18px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.meta b { color: var(--fg); }
.status { font-weight: 500; color: var(--accent); margin-right: 14px; }
.status.preview { background: var(--mx-gold); color: var(--mx-black); padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.shell-main {
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px;
  width: 100%; max-width: var(--shell-w); margin: 0 auto; padding: 0 var(--gutter) 16px;
}
iframe.inner { width: 100%; height: 100%; min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.answer-dock { background: var(--bg); border-top: 1px solid var(--line); }
.answer-dock > div { width: 100%; max-width: var(--shell-w); margin: 0 auto; padding: 12px var(--gutter); }
.dock-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.dock-row .preview { min-width: 0; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dock-row .btn { flex: none; }
.dock-row .row { display: flex; gap: 8px; align-items: center; flex: none; }
.exact { font-size: 13px; color: var(--muted); }
.exact summary { cursor: pointer; }
.reply-preview {
  margin: 8px 0 0; max-height: 20vh; overflow: auto; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--fg); font-size: 14px;
}
.reply-preview p { margin: 0 0 6px; }
.reply-preview p:last-child { margin: 0; }
.reply-preview blockquote { margin: 0 0 6px; padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); }

/* Discussion panel */
.discussion { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.disc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.disc-head h2 { font-weight: 500; font-size: 15px; margin: 0; }
.disc-head a { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.disc-head a:hover { color: var(--accent); }
.count { font-size: 12px; font-weight: 400; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-left: 6px; }
.discussion .empty { padding: 16px; margin: 0; }
.msgs { flex: 1; overflow: auto; padding: 4px 16px; }
.msg { padding: 12px 0; border-top: 1px solid var(--line); }
.msgs > .msg:first-child { border-top: 0; }
.msg header { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.msg header b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.av { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-strong); flex: none; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.badge.answer { color: var(--accent); border-color: var(--accent); }
.msg.is-answer > .md { border-left: 2px solid var(--accent); padding-left: 10px; }
.md { margin-top: 6px; line-height: 1.5; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: 15px; font-weight: 500; margin: 8px 0 4px; }
.md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 2px solid var(--line); color: var(--muted); }
.md pre, .md code { font-size: 12px; background: var(--surface-strong); border-radius: 4px; }
.md pre { padding: 8px; overflow: auto; }
.md img { max-width: 100%; }
.md details { color: var(--muted); }
.msg footer { display: flex; gap: 18px; margin-top: 6px; }
.replies { margin: 6px 0 0 4px; padding-left: 12px; border-left: 1px solid var(--line); }
.replies .msg { padding: 8px 0; }
.replies .msg:first-child { border-top: 0; }
.more { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
.reply-box { margin: 8px 0 0 12px; }
.ask-row { padding: 12px 16px; border-top: 1px solid var(--line); }
.compose { display: flex; gap: 8px; align-items: flex-end; }
.compose textarea {
  flex: 1; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--bg); color: var(--fg); font: 400 14px/1.5 var(--font); resize: vertical;
}

/* Dashboard: one list, tabs, filters, compact rows */
.page.list { max-width: 1000px; }
.page.list h1 { font-size: 32px; margin-bottom: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 24px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 0; margin-bottom: -1px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); border-bottom-color: var(--accent); font-weight: 500; }
.tab .n { margin-left: 8px; font-size: 12px; color: var(--muted); font-weight: 400; }
.find { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.find select {
  max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  background: var(--surface); color: var(--fg); font: 400 13px var(--font);
}
.find .clear { font-size: 13px; color: var(--muted); text-decoration: none; }
.find .clear:hover { color: var(--accent); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows a {
  display: grid; grid-template-columns: minmax(0, 1fr) 160px 150px 110px; gap: 16px; align-items: baseline;
  padding: 13px 4px; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; font-size: 14px;
}
.rows a:hover { background: var(--surface); }
.rows a:hover .t { color: var(--accent); }
.rows .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .repo, .rows .who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .when { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.rows .when.late { color: var(--mx-black); background: var(--mx-gold); border-radius: 999px; padding: 1px 9px; justify-self: end; }
.none { color: var(--muted); padding: 24px 4px; }

@media (max-width: 1000px) {
  body.shell { height: auto; }
  .shell-main { grid-template-columns: 1fr; }
  iframe.inner { height: 70vh; }
  .discussion { max-height: 70vh; }
  .answer-dock { position: sticky; bottom: 0; z-index: 1; }
}
@media (max-width: 720px) {
  :root { --gutter: 20px; }
  .page { padding-top: 32px; padding-bottom: 32px; }
  .tabs { gap: 16px; }
  .find, .find select { width: 100%; max-width: none; }
  .rows a { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t when" "who when"; row-gap: 2px; }
  .rows .t { grid-area: t; }
  .rows .who { grid-area: who; }
  .rows .when { grid-area: when; align-self: center; }
  .rows .repo { display: none; }
}
