/* Team Requests — UI v2
   Rules: no coloured bar on the left side of any box; elements with a shadow get extra space after them. */
:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #17171a;
  --ink-2: #5c5c63;
  --ink-3: #8c8c93;
  --line: #e8e7e2;
  --line-2: #d8d7d1;
  --brand: #1f4d45;
  --brand-hover: #276156;
  --brand-soft: #e7efec;
  --brand-ring: #a9cbc2;
  --claude: #5b44a0;
  --claude-soft: #f3f0fb;
  --claude-line: #e3dcf4;
  --warn: #8a5a0b;
  --warn-soft: #fcf3e1;
  --warn-line: #f1dfb6;
  --review: #8c4710;
  --review-soft: #fdeedd;
  --review-line: #f4d6b5;
  --ok: #22663a;
  --ok-soft: #e6f3ea;
  --ok-line: #c6e3cf;
  --info: #2a4c80;
  --info-soft: #e9eef8;
  --danger: #a3322a;
  --danger-soft: #fbecea;
  --danger-line: #eec7c2;
  --r-lg: 16px;
  --r-md: 11px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 26, .04), 0 6px 20px -8px rgba(20, 20, 26, .08);
  --gap: 24px;        /* space after shadowed panels */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.012em; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 680; }
h2 { font-size: 1rem; margin: 0; font-weight: 650; }
h3 { font-size: .92rem; margin: 1.25rem 0 .6rem; font-weight: 620; }
code { font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f0efea; padding: .12em .4em; border-radius: 6px; word-break: break-all; }
code.big { font-size: 1.15rem; padding: .3em .6em; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 72px; }
main.narrow { max-width: 460px; padding-top: 8vh; }

/* ---------- Top bar ---------- */
.topbar { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 28px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 680; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; border-radius: 8px; background: var(--brand); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 4px; background: var(--brand-soft); }
.brand-lg { font-size: 1.05rem; margin-bottom: 1.4rem; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a:not(.btn) { color: var(--ink-2); padding: .4rem .75rem; border-radius: 999px; font-weight: 550; font-size: .93rem; }
.nav a:not(.btn):hover { background: #f0f0ec; color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--ink); color: #fff !important; }
.nav .btn { margin-left: 8px; }
.me { display: flex; align-items: center; gap: 12px; }
.me-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 550; font-size: .92rem; }
.me-link:hover { text-decoration: none; }
form.inline { display: inline; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: #fff;
  border: 1px solid var(--brand); border-radius: 10px;
  padding: .58rem 1.05rem; font: inherit; font-size: .93rem; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--brand-ring); outline-offset: 2px;
}
.btn-small { padding: .38rem .75rem; font-size: .86rem; border-radius: 9px; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: #f3f3ef; border-color: var(--line-2); }
.btn-dark { background: var(--ink); border-color: var(--ink); }
.btn-dark:hover { background: #2a2a30; border-color: #2a2a30; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.btn-block { width: 100%; }
button.link { background: none; border: 0; padding: 0; font: inherit; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
button.link:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Panels / cards ---------- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: var(--gap);
}
.panel-tight { padding: 18px 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card h2 { margin-bottom: .8rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head-pills { display: flex; gap: 8px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0 var(--gap); align-items: start; }
@media (max-width: 900px) { .layout-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 8px; }
.stack form { margin: 0; }
.auth-card { padding: 30px; }

/* ---------- Forms ---------- */
.form label, .auth-card label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=date], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; font-size: .95rem; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: .6rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none; }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type=file] { font-size: .88rem; margin-top: 6px; max-width: 100%; }
.hint { color: var(--ink-2); font-size: .86rem; margin: -8px 0 16px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
fieldset.choice { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; margin: 0 0 16px; }
fieldset.choice legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
label.radio, label.check { display: inline-flex !important; align-items: center; gap: 7px; font-weight: 450 !important; font-size: .9rem; margin: 0 18px 0 0 !important; color: var(--ink-2); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
.inline-actions { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-actions select { margin: 0; width: auto; padding: .36rem .55rem; font-size: .86rem; border-radius: 9px; }

/* ---------- Messages (full border, never a side bar) ---------- */
.flash, .banner, .notice {
  border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 20px; border: 1px solid transparent; font-size: .93rem;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.flash-info { background: var(--info-soft); color: var(--info); border-color: #d2ddef; }
.notice, .banner-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.banner-review { background: var(--review-soft); color: var(--review); border-color: var(--review-line); }
.banner-muted { background: #f0efeb; color: var(--ink-2); border-color: var(--line); margin-top: 18px; }
.secret { background: #fffdf6; border-color: var(--warn-line); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; padding: 4px; background: #ecebe6; border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a { color: var(--ink-2); padding: .38rem .85rem; border-radius: 9px; font-weight: 560; font-size: .9rem; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.count { display: inline-block; min-width: 1.5em; text-align: center; font-size: .75rem; font-weight: 600; background: rgba(0, 0, 0, .07); color: var(--ink-2); border-radius: 999px; padding: .05em .45em; margin-left: 4px; vertical-align: 1px; }

/* ---------- Lists ---------- */
.list.card { padding: 6px 0; }
.list .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 15px 24px; border-top: 1px solid var(--line); color: var(--ink); }
.list .row:first-child { border-top: 0; }
a.row:hover { background: var(--surface-2); text-decoration: none; }
a.row:hover .row-title { color: var(--brand); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-id { color: var(--ink-3); font-weight: 500; margin-right: 4px; }
.row-side { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
@media (max-width: 640px) { .list .row { flex-direction: column; align-items: flex-start; } }
.empty { text-align: center; padding: 44px 20px; }

/* ---------- Pills & tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: .22rem .65rem .22rem .55rem; border-radius: 999px; background: #efeee9; color: var(--ink-2); white-space: nowrap; line-height: 1.3; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-new { background: var(--info-soft); color: var(--info); }
.pill-in_progress { background: var(--claude-soft); color: var(--claude); }
.pill-needs_info { background: var(--warn-soft); color: var(--warn); }
.pill-review, .pill-changes_requested { background: var(--review-soft); color: var(--review); }
.pill-done { background: var(--ok-soft); color: var(--ok); }
.pill-cancelled { background: #efeee9; color: #7a7a72; }
.pill-high { background: var(--danger-soft); color: var(--danger); }
.pill-admin { background: var(--brand-soft); color: var(--brand); }
.pill-claude { background: var(--claude-soft); color: var(--claude); }
.pill-internal { background: #efeee9; color: var(--ink-2); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem; border-radius: 6px; background: #efeee9; color: var(--ink-2); white-space: nowrap; }
.tag-muted { background: #f0efeb; color: var(--ink-3); }
.tag-review { background: var(--review-soft); color: var(--review); }
.tag-done { background: var(--ok-soft); color: var(--ok); }

/* ---------- Avatars ---------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .76rem; font-weight: 700; letter-spacing: .02em; }
.avatar-sm { width: 24px; height: 24px; font-size: .64rem; }
.avatar-claude { background: var(--claude); color: #fff; }

/* =================================================================
   Request page
   ================================================================= */
.req-head { margin-bottom: 26px; }
.crumbs { display: flex; gap: 8px; font-size: .86rem; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--ink-2); }
.req-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.req-title { font-size: 1.75rem; margin: 0; overflow-wrap: anywhere; max-width: 820px; }
.req-chips { display: flex; gap: 8px; padding-top: 6px; }
.req-sub { display: flex; flex-wrap: wrap; gap: 6px; color: var(--ink-2); font-size: .9rem; margin: 8px 0 0; }
.req-sub .late { color: var(--danger); font-weight: 600; }

/* Stepper (connector lines are horizontal, between the dots) */
.stepper { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 22px 0 0; padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.step { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.step:not(:last-child)::after { content: ""; flex: 1; min-width: 16px; height: 2px; margin: 11px 14px 0 4px; border-radius: 2px; background: var(--line); }
.step-done:not(:last-child)::after { background: var(--brand); }
.step-dot { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-2); color: #fff; }
.step-done .step-dot { background: var(--brand); border-color: var(--brand); }
.step-current .step-dot { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.step-current .step-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.step-warn .step-dot { border-color: #c98a1a; box-shadow: 0 0 0 4px var(--warn-soft); }
.step-warn .step-dot::after { background: #c98a1a; }
.step-text { display: flex; flex-direction: column; min-width: 0; }
.step-label { font-size: .88rem; font-weight: 600; color: var(--ink); line-height: 24px; white-space: nowrap; }
.step-todo .step-label { color: var(--ink-3); font-weight: 500; }
.step-note { font-size: .78rem; color: var(--ink-2); }
.step-warn .step-note { color: var(--warn); font-weight: 600; }

.req-grid { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 0 var(--gap); align-items: start; }
.req-side { position: sticky; top: 84px; }
@media (max-width: 960px) { .req-grid { grid-template-columns: 1fr; } .req-side { position: static; } }
.sub-h { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-2); text-transform: none; margin: 20px 0 10px; }

/* File tiles */
.files { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.file { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); transition: border-color .15s, background .15s; flex-wrap: wrap; }
.file:hover { border-color: var(--line-2); background: #fff; }
.file-badge { width: 38px; height: 44px; flex: none; border-radius: 7px; display: grid; place-items: end center; padding-bottom: 6px; font-size: .62rem; font-weight: 800; letter-spacing: .03em; color: #fff; background: #8a8a90; }
.file-pdf .file-badge { background: #c2453a; }
.file-doc .file-badge { background: #2f62c0; }
.file-sheet .file-badge { background: #23804b; }
.file-slides .file-badge { background: #d0662a; }
.file-image .file-badge { background: #7b56c4; }
.file-web .file-badge { background: #3a3a40; }
.file-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 600; color: var(--ink); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-md); }   /* whole tile clickable */
.file-name:hover { text-decoration: none; }
.file-meta { font-size: .76rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-dl { color: var(--ink-3); flex: none; }
.file:hover .file-dl { color: var(--brand); }
.file .tag { position: relative; z-index: 1; order: 5; }

.panel-delivery { border-color: #cfe1da; }
.review-bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.review-bar form { margin: 0; }
.changes { flex: 1; min-width: 240px; }
.changes summary { list-style: none; display: inline-flex; }
.changes summary::-webkit-details-marker { display: none; }
.changes[open] summary { background: #f3f3ef; }
.changes-form { margin-top: 10px; display: grid; gap: 10px; justify-items: start; }
.changes-form textarea { margin: 0; }
.older { margin-top: 16px; }
.older summary { cursor: pointer; font-size: .86rem; color: var(--ink-2); margin-bottom: 10px; }

/* Activity feed */
.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.ev { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--ink-2); padding: 0 0 0 9px; }
.ev-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--surface); border: 3px solid var(--line-2); }
.ev-progress .ev-dot { border-color: var(--claude); }
.ev-warn .ev-dot { border-color: #c98a1a; }
.ev-review .ev-dot { border-color: #d07a2e; }
.ev-done .ev-dot { border-color: var(--ok); background: var(--ok); }
.ev-muted { color: var(--ink-3); }
.ev-text { flex: 1; min-width: 0; }
.ev-time, .msg-head time { font-size: .76rem; color: var(--ink-3); white-space: nowrap; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg-box { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 4px var(--r-lg) var(--r-lg) var(--r-lg); padding: 12px 16px; background: #fff; }
.msg-claude .msg-box { background: var(--claude-soft); border-color: var(--claude-line); }
.msg-internal .msg-box { background: #fbfbf9; border-style: dashed; border-color: var(--line-2); }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .9rem; }
.msg-head time { margin-left: auto; }
.prose { overflow-wrap: anywhere; }
.prose p { margin: 0 0 .65rem; }
.prose p:last-child, .prose ul:last-child, .prose ol:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 .65rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .15rem; }
.prose h3, .prose h4, .prose h5 { margin: 1rem 0 .4rem; font-size: 1rem; }

.composer { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.composer-box { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: #fff; transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.composer-box textarea { border: 0; margin: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; min-height: 80px; padding: 12px 14px; box-shadow: none; }
.composer-box textarea:focus { box-shadow: none; }
.composer-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.attach { position: relative; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: .86rem; font-weight: 550; cursor: pointer; padding: 4px 6px; border-radius: 7px; }
.attach:hover { background: #efeee9; color: var(--ink); }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; margin: 0; }
.composer-right { display: inline-flex; align-items: center; gap: 12px; }
.composer-right .check { margin: 0 !important; }

/* Details panel */
.details { display: grid; grid-template-columns: 96px 1fr; gap: 12px 10px; margin: 0; font-size: .9rem; align-items: center; }
.details dt { color: var(--ink-3); font-size: .84rem; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.person { display: flex; align-items: center; gap: 8px; }
.prio { display: inline-flex; align-items: center; gap: 6px; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--ink-3); }
.prio-high::before { background: var(--danger); }
.prio-normal::before { background: #c9a227; }
.prio-low::before { background: #9bb7ad; }
.reopen { display: grid; gap: 8px; }
.reopen textarea { margin: 0; min-height: 64px; }

/* ---------- Misc pages ---------- */
.steps { padding-left: 1.2rem; margin: 0 0 12px; }
.steps li { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 11px 16px; border-top: 1px solid var(--line); vertical-align: top; }
.table thead th { border-top: 0; color: var(--ink-2); font-weight: 600; background: var(--surface-2); font-size: .84rem; }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; gap: 8px 12px; padding: 10px 0; }
  .me { margin-left: auto; }
  .nav { order: 3; width: 100%; flex: 0 0 100%; overflow-x: auto; padding-bottom: 2px; }
  .nav a { white-space: nowrap; }
  .nav .btn { margin-left: auto; }
  .me-name { display: none; }
  main.wrap { padding-top: 20px; }
  .card, .panel { padding: 18px; }
  .req-title { font-size: 1.4rem; }
  .stepper { grid-auto-flow: row; gap: 12px; padding: 16px; }
  .step:not(:last-child)::after { display: none; }
  .details { grid-template-columns: 90px 1fr; }
}
.btn + .hint, button + .hint { margin: 12px 0 0; }

/* Server check page */
.section-title { font-size: 1rem; margin: 32px 0 12px; }
pre.log { margin: 0; white-space: pre-wrap; word-break: break-all; font-size: .8rem; max-height: 420px; overflow: auto; }
