/* Suggestion box (web/suggest.js). sg-* only; brand tokens from theme.css,
   so light and dark both follow. The drawer is two columns on desktop
   (conversation | the request as it forms) and one full-screen column on
   phones, with the request folded into a bar above the chat. */

/* ---------- top bar ---------- */
.sg-topbtn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; position: relative; }
.sg-topicon { display: inline-flex; }
/* The Suggest button stands out (owner, 10/07: "sparkly and gradient"): the
   brand gradient, a light sweep every few seconds and three twinkling
   sparkles. Navy ink on the gradient keeps it readable; all motion stops for
   prefers-reduced-motion. */
.topbar #sgBtn {
  color: var(--navy); border: 0; font-weight: 700; overflow: hidden; isolation: isolate;
  background: linear-gradient(110deg, #13B3CF 0%, #23C2B7 45%, #43E285 100%);
  background-size: 160% 100%; animation: sg-drift 6s ease-in-out infinite alternate;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18) inset, 0 2px 12px -2px rgba(35, 194, 183, .55);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.topbar #sgBtn:hover { transform: translateY(-1px); filter: saturate(1.15) brightness(1.05); box-shadow: 0 0 0 1px rgba(255, 255, 255, .3) inset, 0 4px 18px -2px rgba(67, 226, 133, .65); }
.topbar #sgBtn:active { transform: translateY(0); }
.topbar #sgBtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.topbar #sgBtn .sg-topicon svg { stroke-width: 2.4; }
/* the light sweep */
.topbar #sgBtn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .7) 48%, transparent 66%);
  transform: translateX(-120%); animation: sg-sweep 4.2s ease-in-out infinite;
}
/* sparkles */
.sg-sparks { position: absolute; inset: 0; pointer-events: none; }
.sg-sparks i { position: absolute; width: 7px; height: 7px; background: #fff; opacity: 0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: sg-twinkle 2.8s ease-in-out infinite; }
.sg-sparks i:nth-child(1) { top: 3px; right: 7px; }
.sg-sparks i:nth-child(2) { bottom: 4px; left: 30%; width: 5px; height: 5px; animation-delay: .9s; }
.sg-sparks i:nth-child(3) { top: 6px; left: 8px; width: 4px; height: 4px; animation-delay: 1.8s; }
@keyframes sg-sweep { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes sg-twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 45% { opacity: 1; transform: scale(1) rotate(45deg); } 70% { opacity: 0; transform: scale(.5) rotate(90deg); } }
@keyframes sg-drift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) {
  .topbar #sgBtn, .topbar #sgBtn::before, .sg-sparks i { animation: none; }
  .sg-sparks i:nth-child(1) { opacity: .9; transform: none; }
}
.sg-inbox { font-weight: 600; }
.sg-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--green); color: var(--navy); font-size: .68rem; font-weight: 800; display: inline-grid; place-items: center; }
.sg-count[hidden] { display: none; }
body.sg-lock { overflow: hidden; }

/* ---------- drawer ---------- */
.sg-scrim { position: fixed; inset: 0; background: rgba(6, 33, 65, .38); z-index: 39; backdrop-filter: blur(1.5px); }
.sg-scrim[hidden], .sg-drawer[hidden] { display: none; }
.sg-drawer { width: min(1040px, 100%); display: flex; flex-direction: column; }
.sg-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 12px; }
.sg-headicon { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--navy), #0d4a7a 60%, var(--accent-2)); }
.sg-headt { flex: 1; min-width: 0; }
.sg-headt h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.01em; }
.sg-headt p { margin: 3px 0 0; font-size: .8rem; color: var(--muted); }
.sg-headt p b { color: var(--accent-2); }
.sg-headt a { color: var(--accent); }
.sg-x { flex: none; }
.sg-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.sg-tab { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; font-size: .84rem; color: var(--muted); padding: 9px 10px 11px; position: relative; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.sg-tab:hover, .sg-tab[aria-selected="true"] { color: var(--ink); }
.sg-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--gradient); }
.sg-tabn { background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-size: .68rem; }
.sg-body { flex: 1; min-height: 0; overflow: auto; }
.sg-soft { color: var(--muted); font-size: .78rem; }
.sg-pad { padding: 20px; }
.sg-warnt { color: var(--warn); font-weight: 600; }
.sg-link { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 600; }
.sg-link:hover { text-decoration: underline; }
.sg-right { margin-left: auto; }
.sg-note { font-size: .8rem; line-height: 1.45; background: var(--accent-soft); color: var(--ink-2); border-radius: 9px; padding: 9px 11px; }
.sg-note.good { background: var(--good-soft); }
.sg-kind { font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--surface-3); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }

/* ---------- chat | request ---------- */
.sg-split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100%; min-height: 0; }
.sg-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 14px 18px 12px; gap: 10px; }
.sg-scope { display: inline-flex; align-self: flex-start; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; flex: none; }
.sg-scope button { border: 0; border-left: 1px solid var(--line); background: var(--surface); padding: 7px 12px; font: inherit; font-size: .78rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.sg-scope button:first-child { border-left: 0; }
.sg-scope button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.sg-msgs { flex: 1; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px; }
.sg-msg { display: flex; gap: 9px; align-items: flex-end; max-width: 88%; }
.sg-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.sg-ava { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--cyan), var(--teal)); }
.sg-ava svg { width: 15px; height: 15px; }
.sg-bubble { font-size: .88rem; line-height: 1.5; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.sg-bubble p { margin: 0; }
.sg-bubble p + p { margin-top: 7px; }
.sg-msg.me .sg-bubble { background: var(--navy); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
:root[data-theme="dark"] .sg-msg.me .sg-bubble { background: #0d4a7a; }
.sg-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.sg-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: sg-dot 1.1s infinite ease-in-out; }
.sg-typing i:nth-child(2) { animation-delay: .15s; }
.sg-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sg-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .sg-typing i { animation: none; opacity: .6; } }
.sg-starters { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-starter { border: 1px dashed var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 11px; font: inherit; font-size: .76rem; cursor: pointer; }
.sg-starter:hover { border-color: var(--teal); color: var(--ink); }
.sg-composer { display: flex; gap: 8px; align-items: flex-end; border: 1px solid var(--line-strong); border-radius: 13px; padding: 6px 6px 6px 12px; background: var(--surface); flex: none; }
.sg-composer:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.sg-composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: .9rem; line-height: 1.45; color: var(--ink); padding: 6px 0; max-height: 180px; }
.sg-sendmsg { width: 38px; height: 38px; padding: 0; border-radius: 10px; font-size: 1.1rem; flex: none; }
.sg-chatfoot { display: flex; justify-content: space-between; gap: 10px; font-size: .72rem; color: var(--muted); flex: none; }

/* the request as it forms */
.sg-req { border-left: 1px solid var(--line); background: var(--surface-2); min-height: 0; display: flex; flex-direction: column; }
.sg-req.is-ready { background: color-mix(in srgb, var(--good-soft) 45%, var(--surface-2)); }
.sg-req-h { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 8px; padding: 14px 16px 6px; cursor: default; }
.sg-req-k { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sg-req-caret { display: none; margin-left: auto; color: var(--muted); }
.sg-req-b { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 11px; flex: 1; min-height: 0; overflow: auto; }
.sg-meter { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.sg-meter span { display: block; height: 100%; background: var(--gradient); transition: width .4s; }
.sg-req-title { font-weight: 700; font-size: .95rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sg-r { display: flex; flex-direction: column; gap: 2px; }
.sg-r-k { font-size: .68rem; font-weight: 700; color: var(--muted); }
.sg-r-k em { font-style: normal; color: var(--warn); }
.sg-r-v { font-size: .84rem; line-height: 1.45; color: var(--ink); }
ul.sg-r-v { margin: 0; padding-left: 18px; }
.sg-r.is-q .sg-r-v { font-size: .98rem; font-weight: 600; }
.sg-r.is-empty .sg-r-v { color: var(--muted); font-style: italic; border: 1px dashed var(--line-strong); border-radius: 7px; padding: 5px 8px; font-size: .78rem; }
.sg-r.is-thin .sg-r-v { border-left: 2px solid var(--warn); padding-left: 7px; }
.sg-howto { margin: 0; padding-left: 18px; font-size: .8rem; color: var(--ink-2); line-height: 1.6; }
.sg-f { display: flex; flex-direction: column; gap: 4px; }
.sg-f > span { font-size: .7rem; font-weight: 700; color: var(--ink-2); }
.sg-f > span small, .sg-f > span b { font-weight: 500; color: var(--muted); }
.sg-f textarea, .sg-f select { font: inherit; font-size: .84rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; resize: vertical; min-width: 0; }
.sg-f.is-q textarea { font-weight: 600; font-size: .92rem; }
.sg-f textarea:focus, .sg-f select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.sg-sendbar { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.sg-manual .sg-sendbar { border: 0; padding: 4px 0 0; background: none; }
.sg-send { width: 100%; padding: 11px 14px; font-size: .92rem; }
.sg-send[disabled] { opacity: .45; cursor: not-allowed; }

/* thank-you, your suggestions, plain form */
.sg-sent { max-width: 520px; margin: 0 auto; padding: 46px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sg-sent-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: var(--navy); background: linear-gradient(135deg, var(--cyan), var(--green)); }
.sg-sent h3 { margin: 6px 0 0; font-size: 1.3rem; }
.sg-sent p { margin: 0; color: var(--ink-2); line-height: 1.5; font-size: .9rem; }
.sg-sent blockquote { margin: 8px 0; padding: 12px 14px; border-left: 3px solid var(--teal); background: var(--surface-2); border-radius: 8px; text-align: left; font-weight: 600; width: 100%; box-sizing: border-box; }
.sg-sent-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.sg-empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sg-mine { padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.sg-mcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 5px; }
.sg-mcard.st-done { border-left: 3px solid var(--good); }
.sg-mcard.st-declined { border-left: 3px solid var(--crit); }
.sg-mcard.st-draft { border-style: dashed; }
.sg-mcard-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sg-mcard h4 { margin: 2px 0 0; font-size: .95rem; }
.sg-mq { margin: 0; font-size: .84rem; color: var(--ink-2); }
.sg-mcard p.sg-soft { margin: 0; }
.sg-mcard-acts { display: flex; gap: 8px; }
.sg-mcard-acts a { text-decoration: none; }
.sg-manual { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 12px; max-width: 680px; }

/* ================================================================ owner review page */
.sg-page { display: flex; flex-direction: column; gap: 16px; }
.sg-phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sg-phead h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; position: relative; padding-bottom: 9px; }
.sg-phead h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 72px; height: 3px; border-radius: 3px; background: var(--gradient); }
.sg-phead p { margin: 8px 0 0; color: var(--muted); font-size: .84rem; max-width: 760px; line-height: 1.45; }
.sg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.sg-kpi { position: relative; overflow: hidden; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 15px 16px 12px; transition: box-shadow .15s, border-color .15s, transform .15s; }
.sg-kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient); }
.sg-kpi.t-warn::before { background: var(--warn); }
.sg-kpi.t-good::before { background: var(--good); }
.sg-kpi:hover { box-shadow: var(--shadow-hover); border-color: var(--teal); transform: translateY(-1px); }
.sg-kpi.on { border-color: var(--teal); box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 35%, transparent); }
.sg-kpi .k { font-size: .63rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sg-kpi .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.sg-kpi.t-warn .v { color: var(--warn); }
.sg-kpi .s { font-size: .72rem; color: var(--muted); }
.sg-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.sg-search { flex: 1 1 280px; max-width: 460px; }
.sg-search input, .sg-toolbar select { width: 100%; box-sizing: border-box; font: inherit; font-size: .84rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px; }
.sg-toolbar select { width: auto; max-width: 240px; }
.sg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.sg-item { text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 13px 15px; display: flex; flex-direction: column; gap: 7px; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.sg-item:hover, .sg-item:focus-visible { border-color: var(--teal); box-shadow: var(--shadow-hover); outline: none; }
.sg-item.u-high { border-left-color: var(--warn); }
.sg-item.u-blocking { border-left-color: var(--crit); }
.sg-item-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sg-dash { font-size: .72rem; font-weight: 700; color: var(--accent); }
.sg-item h3 { margin: 0; font-size: .96rem; line-height: 1.4; }
.sg-item-d { margin: 0; font-size: .8rem; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sg-item-foot { display: flex; justify-content: space-between; gap: 8px; font-size: .72rem; color: var(--muted); margin-top: auto; flex-wrap: wrap; }
.sg-who { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); font-weight: 600; }
.sg-ini { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .58rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--navy), var(--accent-2)); }
.sg-effort { font-size: .66rem; font-weight: 800; border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }
.sg-effort.big { font-size: .9rem; padding: 3px 9px; }
.sg-effort.e-S { color: var(--good); border-color: var(--good); }
.sg-effort.e-L { color: var(--warn); border-color: var(--warn); }

/* review drawer */
.sg-rev { width: min(720px, 100%); }
.sg-rbody { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.sg-rchips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sg-rq { margin: 0; padding: 14px 16px; border-left: 3px solid var(--teal); background: var(--surface-2); border-radius: 9px; font-size: 1.05rem; font-weight: 600; line-height: 1.45; }
.sg-rkv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; margin: 0; font-size: .85rem; }
.sg-rkv dt { color: var(--muted); font-weight: 600; font-size: .76rem; }
.sg-rkv dd { margin: 0; line-height: 1.45; }
.sg-rsec h4 { margin: 0 0 8px; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sg-rsec h4 .sg-soft { text-transform: none; letter-spacing: 0; font-weight: 500; }
.sg-needs { margin: 0; padding-left: 18px; font-size: .85rem; line-height: 1.55; }
.sg-plan { display: flex; flex-direction: column; gap: 8px; font-size: .85rem; line-height: 1.5; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; background: var(--surface); }
.sg-plan p { margin: 0; }
.sg-plan-sum { font-weight: 600; }
.sg-plan-row { display: flex; gap: 10px; align-items: center; }
.sg-vis { display: flex; flex-direction: column; gap: 6px; }
.sg-vis > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2); border-radius: 7px; }
.sg-vis > div > span:last-child { color: var(--ink-2); flex-basis: 100%; }
.sg-racts-inline { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sg-notes { width: 100%; box-sizing: border-box; font: inherit; font-size: .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; resize: vertical; }
.sg-convo summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--accent); }
.sg-convo .sg-msgs { margin-top: 10px; max-height: none; overflow: visible; }
.sg-convo .sg-bubble { font-size: .8rem; }
.sg-racts { border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface); }
.sg-actform { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.sg-actform label { display: flex; flex-direction: column; gap: 4px; font-size: .74rem; font-weight: 600; color: var(--ink-2); }
.sg-actform textarea { font: inherit; font-size: .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.sg-actform > div { display: flex; gap: 8px; }
.sg-actform .sg-chk { flex-direction: row; align-items: center; font-weight: 500; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .sg-drawer { width: 100%; }
  .sg-split { display: flex; flex-direction: column-reverse; height: 100%; }
  .sg-req { border-left: 0; border-bottom: 1px solid var(--line); flex: none; max-height: 62vh; }
  .sg-req:not(.is-open) .sg-req-b { display: none; }
  .sg-req:not(.is-open):not(.is-ready) .sg-sendbar { display: none; }
  .sg-sendbar { padding: 10px 14px; }
  .sg-req-h { cursor: pointer; padding: 11px 16px; }
  .sg-req-caret { display: inline; transition: transform .2s; }
  .sg-req.is-open .sg-req-caret { transform: rotate(180deg); }
  .sg-chat { flex: 1; padding: 10px 12px 10px; }
  .sg-msg { max-width: 94%; }
  .sg-head { padding: 14px 14px 10px; }
  .sg-tabs { padding: 0 8px; }
  .sg-list { grid-template-columns: minmax(0, 1fr); }
  .sg-rkv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .sg-rkv dd { margin-bottom: 8px; }
  .sg-rbody { padding: 4px 14px 16px; }
  .sg-racts { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .sg-toplabel { display: none; }
  .sg-topbtn { width: 40px; height: 40px; padding: 0 !important; justify-content: center; }
  .sg-inbox .sg-toplabel { display: none; }
  .sg-inbox::before { content: "✉"; font-size: 1rem; }
  .sg-count { position: absolute; top: -4px; right: -4px; }
  .sg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sg-kpi .v { font-size: 1.35rem; }
  .sg-composer textarea { font-size: 16px; }
}
.sg-drawer { height: 100vh; height: 100dvh; }

/* ---------- owner: tabs, REQ numbers, Build with Claude queue ---------- */
.sg-ptabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-top: -4px; }
.sg-ptab { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); padding: 10px 14px 12px; position: relative; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.sg-ptab:hover, .sg-ptab[aria-selected="true"] { color: var(--ink); }
.sg-ptab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--gradient); }
.sg-ptabn { background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 1px 8px; font-size: .7rem; font-weight: 700; }
.sg-ptabn.warn { background: var(--warn-soft); color: var(--warn); }
.sg-ref { display: inline-flex; align-items: center; gap: 6px; font: 700 .86rem/1 Menlo, Consolas, "SFMono-Regular", monospace; color: var(--navy); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 8px; padding: 7px 10px; cursor: pointer; white-space: nowrap; flex: none; }
:root[data-theme="dark"] .sg-ref { color: var(--ink); }
.sg-ref span { font-family: inherit; font-weight: 400; opacity: .55; }
.sg-ref:hover { border-color: var(--accent); }
.sg-ref:hover span { opacity: 1; }
.sg-ref.sm { font-size: .78rem; padding: 4px 7px; margin-right: 8px; vertical-align: 2px; }
.sg-refsm { font: 700 .7rem/1 Menlo, Consolas, monospace; color: var(--accent); }
.sg-steps { list-style: none; counter-reset: sgstep; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sg-steps li { counter-increment: sgstep; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 12px 50px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: .78rem; color: var(--muted); }
.sg-steps li::before { content: counter(sgstep); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; background: linear-gradient(135deg, var(--cyan), var(--teal)); }
.sg-steps b { color: var(--ink); font-size: .86rem; }
.sg-qsec { display: flex; flex-direction: column; gap: 8px; }
.sg-qsec-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sg-qsec-h h2 { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); display: inline-flex; gap: 8px; align-items: center; }
.sg-qsec-h h2 span { background: var(--surface-3); border-radius: 999px; padding: 1px 8px; font-size: .68rem; letter-spacing: 0; }
.sg-qsec-h p { margin: 0; font-size: .76rem; color: var(--muted); }
.sg-qempty { margin: 0; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.sg-qlist { display: flex; flex-direction: column; gap: 8px; }
.sg-qrow { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.sg-qrow:hover, .sg-qrow:focus-visible { border-color: var(--teal); box-shadow: var(--shadow-hover); outline: none; }
.sg-qrow.st-building { border-left-color: var(--teal); background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.sg-qrow.u-high { border-left-color: var(--warn); }
.sg-qrow.u-blocking { border-left-color: var(--crit); }
.sg-qrow.st-done { opacity: .78; box-shadow: none; }
.sg-qmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sg-qtitle { font-weight: 700; font-size: .92rem; }
.sg-qq { font-size: .8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-qmeta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.sg-qmeta .pill { font-size: .64rem; padding: 1px 6px; }
.sg-qacts { display: flex; gap: 6px; flex: none; }
.sg-qwait { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; font: inherit; cursor: pointer; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 12px; padding: 12px 16px; }
.sg-qwait span { font-size: .8rem; font-weight: 600; color: var(--warn); }
@media (max-width: 760px) {
  .sg-steps { grid-template-columns: minmax(0, 1fr); }
  .sg-qrow { flex-wrap: wrap; gap: 10px; align-items: flex-start; }
  .sg-qmain { flex-basis: calc(100% - 110px); }
  .sg-qq { white-space: normal; }
  .sg-qacts { width: 100%; }
  .sg-qacts button { flex: 1; }
}
.sg-opt { border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.sg-opt > summary { cursor: pointer; font-size: .74rem; font-weight: 700; color: var(--accent); list-style: none; }
.sg-opt > summary::-webkit-details-marker { display: none; }
.sg-opt > summary small { font-weight: 500; color: var(--muted); }
.sg-opt[open] > summary { margin-bottom: 2px; }
.sg-editbtn { align-self: flex-start; font-size: .8rem; padding: 2px 0; }

/* phones: the summary tiles become one swipeable strip so the requests start on the first screen;
   the thank-you buttons stack full width */
@media (max-width: 640px) {
  .sg-kpis { display: flex; overflow-x: auto; gap: 8px; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 2px 12px 6px; scrollbar-width: none; }
  .sg-kpis::-webkit-scrollbar { display: none; }
  .sg-kpi { flex: 0 0 132px; scroll-snap-align: start; padding: 11px 12px 9px; }
  .sg-kpi .v { font-size: 1.3rem; margin: 2px 0 1px; }
  .sg-kpi .s { font-size: .66rem; }
  .sg-phead p { font-size: .8rem; }
  .sg-sent { padding: 32px 18px; }
  .sg-sent-acts { flex-direction: column; width: 100%; }
  .sg-sent-acts > * { width: 100%; justify-content: center; }
  .sg-search { max-width: none; flex-basis: 100%; }
  .sg-toolbar select { width: 100%; max-width: none; }
}
@media (max-width: 640px) {
  .sg-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sg-steps li { padding: 30px 8px 8px; text-align: center; align-items: center; font-size: 0; }
  .sg-steps li span { display: none; }
  .sg-steps li b { font-size: .7rem; line-height: 1.25; }
  .sg-steps li::before { left: 50%; top: 6px; transform: translateX(-50%); width: 20px; height: 20px; font-size: .68rem; }
}
