:root {
  --red: #EE2C2C; --red-dark: #c81f1f; --teal: #00B2BF; --ink: #231F20;
  --muted: #6b6e72; --line: #e3e6ea; --bg: #f7f8fa; --card: #fff;
  --ok: #2e7d32; --ok-bg: #e2efda; --warn-bg: #fff2cc; --bad: #b00020; --bad-bg: #f4cccc;
  --remote: #fff2cc; --travel: #fce4d6; --onsite: #e2efda; --multiple: #e4dfec;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--red-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* app shell — sidebar + main column */
.shell { display: flex; min-height: 100vh; align-items: stretch; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px; min-height: 59px; padding: 12px 20px; background: var(--card);
  border-bottom: 3px solid; border-image: linear-gradient(90deg, var(--red), var(--teal)) 1;
  position: sticky; top: 0; z-index: 10;
}
.logo { height: 34px; width: 142px; object-fit: contain; display: block; }
.app-name { font-weight: 600; font-size: 15px; color: var(--ink); white-space: nowrap; }
header .spacer, .topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; }
.who select { margin-left: 6px; }

.hamburger { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 34px; height: 34px;
  border: 1px solid rgba(255,255,255,.20); background: rgba(255,255,255,.08); border-radius: 7px;
  cursor: pointer; padding: 0; flex: 0 0 auto; }
.hamburger span { display: block; width: 16px; height: 2px; background: #fff; margin: 0 auto; }

nav.tabs { display: flex; gap: 4px; padding: 10px 20px 0; background: var(--card); border-bottom: 1px solid var(--line); }
nav.tabs button {
  border: none; background: none; padding: 9px 14px; cursor: pointer; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0;
}
nav.tabs button.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }

main { padding: 20px; max-width: 1200px; margin: 0 auto; width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
h1 { font-size: 20px; margin: 0 0 4px; } h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); }

button.btn { background: var(--red); color: #fff; border: none; border-radius: 7px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
button.btn:hover { background: var(--red-dark); }
button.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
button.btn.ok { background: var(--ok); } button.btn.bad { background: var(--bad); }
button.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
th { background: #1F4E78; color: #fff; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.hours td { font-weight: 600; background: #f2f2f2; }
.cat-Remote { background: var(--remote); } .cat-Travel { background: var(--travel); }
.cat-On-Site { background: var(--onsite); } .cat-Multiple { background: var(--multiple); }
.grand td { background: #9bc2e6; font-weight: 700; }

.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status.draft { background:#eee; color:#555; } .status.submitted,.status.in_review { background: var(--warn-bg); color:#8a5a00; }
.status.approved { background: var(--ok-bg); color: var(--ok); } .status.sent { background:#dbeafe; color:#0b3d66; }
.status.rejected { background: var(--bad-bg); color: var(--bad); }

.pill { display:inline-block; padding:1px 8px; border-radius:6px; font-size:12px; font-weight:600; }
.pill.High { background: var(--bad-bg); color: var(--bad); } .pill.Medium { background: var(--warn-bg); color:#8a5a00; }
.pill.PASS { background: var(--ok-bg); color: var(--ok); } .pill.FAIL { background: var(--bad-bg); color: var(--bad); }
.pill.NA, .pill\.N\/A { background:#f2f2f2; color:#666; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content:""; position:absolute; left:-5px; top:11px; width:8px; height:8px; border-radius:50%; background: var(--teal); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 30px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.drag { border-color: var(--red); background: #fff6f6; }
.grid-scroll { overflow-x: auto; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color:#fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: .95; } .toast.err { background: var(--bad); }
.hidden { display: none; }

/* auth gate — hide the whole app until authenticated, so nothing flashes pre-login */
#splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; background: var(--bg); }
#splash p { margin: 0; }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--red);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* in-page loading state (route transitions) */
.loading { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 0 14px; color: var(--muted); }
.loading .spin { width: 18px; height: 18px; border-width: 2px; }
.loading p { margin: 0; }
body:not(.ready) .shell { display: none !important; }
body.ready #splash { display: none; }

/* ---------- sidebar (platform-level nav) ---------- */
.sidebar { width: 240px; flex: 0 0 auto; background: var(--ink); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: width .18s ease; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 12px 12px 16px;
  flex: 0 0 auto; border-bottom: 1px solid rgba(255,255,255,.12); overflow: hidden; min-height: 59px; }
.sidebar-brand .app-name { color: #fff; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; flex: 1; }
.nav-section { display: flex; align-items: center; gap: 8px; margin: 10px 0 5px; color: rgba(255,255,255,.70);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
.nav-section span { border: 1px solid rgba(255,255,255,.20); border-radius: 999px; padding: 2px 9px;
  background: rgba(255,255,255,.05); }
.nav-section::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.10); }
.sidebar-nav button.mod {
  display: flex; align-items: center; gap: 10px; border: 1px solid transparent; background: transparent;
  color: rgba(255,255,255,.85); padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 600; text-align: left; width: 100%; white-space: nowrap; overflow: hidden;
}
.sidebar-nav button.mod .mod-icon { flex: 0 0 18px; width: 18px; height: 18px; display: flex; align-items: center;
  justify-content: center; }
.sidebar-nav button.mod .mod-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sidebar-nav button.mod .mod-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav button.mod:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-nav button.mod.active { background: var(--red); color: #fff; }

/* collapsed desktop state — icon rail only */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 12px 10px; }
.sidebar.collapsed .sidebar-brand .app-name,
.sidebar.collapsed .sidebar-brand .logo { display: none; }
.sidebar.collapsed .sidebar-nav button.mod { justify-content: center; }
.sidebar.collapsed .sidebar-nav button.mod .mod-label { display: none; }
.sidebar.collapsed .nav-section { justify-content: center; margin: 10px 0 5px; }
.sidebar.collapsed .nav-section span { width: 28px; height: 8px; padding: 0; font-size: 0; }
.sidebar.collapsed .nav-section::after { display: none; }

.nav-backdrop { display: none; }

/* ---------- mobile: sidebar becomes an off-canvas drawer ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-100%);
    transition: transform .24s ease; box-shadow: none; }
  .sidebar.collapsed { width: 264px; }
  .sidebar.collapsed .sidebar-brand { justify-content: space-between; padding: 12px 12px 12px 16px; }
  .sidebar.collapsed .sidebar-brand .app-name,
  .sidebar.collapsed .sidebar-brand .logo,
  .sidebar.collapsed .sidebar-nav button.mod .mod-label { display: inline-block; }
  .sidebar.collapsed .sidebar-nav button.mod { justify-content: flex-start; }
  .sidebar.collapsed .nav-section { justify-content: flex-start; }
  .sidebar.collapsed .nav-section span { width: auto; height: auto; padding: 2px 9px; font-size: 11px; }
  .sidebar.collapsed .nav-section::after { display: block; }
  body[data-nav-open] .sidebar { transform: translateX(0); box-shadow: 0 0 24px rgba(0,0,0,.35); }
  .nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 19; }
  body[data-nav-open] .nav-backdrop { display: block; }
  main { padding: 14px; }
}

/* admin management console */
.admin-shell { max-width: none; }
.admin-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.admin-hero h1 { margin-bottom: 4px; }
.admin-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.kpi b { display: block; font-size: 22px; line-height: 1.1; margin-bottom: 2px; }
.admin-layout { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.admin-nav { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 6px; }
.admin-nav button { border: 1px solid transparent; background: transparent; color: var(--ink); text-align: left;
  padding: 9px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.admin-nav button:hover { background: #fff; border-color: var(--line); }
.admin-nav button.active { background: var(--ink); color: #fff; }
.admin-panel { min-width: 0; }
.admin-section { display: none; }
.admin-section.active { display: block; }
.admin-section.active > .card { border-left: 4px solid rgba(0,178,191,.55); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.admin-section.active > .card + .card { margin-top: 14px; }
.admin-section h2 { letter-spacing: 0; }
.action-list { display: grid; gap: 8px; margin-bottom: 14px; }
.action-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 8px; background: #fff; }
.management-grid { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(340px, 1.15fr); gap: 14px; align-items: start; }
.access-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 12px; }
.access-filters { display: inline-flex; gap: 4px; padding: 3px; background: #eef0f3; border-radius: 8px; }
.access-filters button { border: 0; background: transparent; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); }
.access-filters button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.group-list { display: grid; gap: 8px; }
.group-list-item { width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 10px; cursor: pointer; }
.group-list-item.active { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.group-list-item .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: 12px; }
.group-detail-empty { min-height: 240px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 12px; }
.module-access-list { display: grid; gap: 8px; }
.dash-hero, .section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.dash-hero { margin-bottom: 14px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tool-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-height: 118px;
  text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 12px; text-align: left; }
.tool-tile:hover { border-color: var(--teal); text-decoration: none; }
.tool-tile b { font-size: 15px; }
.tool-tile.as-button { width: 100%; cursor: pointer; font: inherit; }
.tool-tile .muted { overflow-wrap: anywhere; }
.tool-empty { grid-column: 1 / -1; border: 1px dashed var(--line); border-radius: 8px; padding: 18px;
  background: #fff; text-align: center; }
.tool-empty p { max-width: 640px; margin: 0 auto; }
.preview-results { margin-top: 12px; }

/* AI Assistant workspace */
main:has(.assistant-shell) { max-width: none; padding: 0; }
.assistant-page { height: calc(100vh - 59px); }
.assistant-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100%; background: #fbfbfa; }
.assistant-sidebar { border-right: 1px solid var(--line); background: #f1f1ef; padding: 12px; overflow: auto; }
.assistant-side-head, .assistant-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.assistant-side-head { margin-bottom: 12px; }
.assistant-session-list { display: grid; gap: 6px; }
.session-item { border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 9px 10px; text-align: left;
  cursor: pointer; color: var(--ink); display: grid; gap: 2px; }
.session-item:hover { background: #fff; border-color: var(--line); }
.session-item.active { background: #fff; border-color: #d4d4d0; box-shadow: inset 3px 0 0 var(--red); }
.session-item b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-chat { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.assistant-chat-head { padding: 18px 24px; border-bottom: 1px solid var(--line); background: #fff; }
.assistant-chat-head p { margin: 2px 0 0; }
.assistant-thread { overflow: auto; padding: 22px min(8vw, 96px); display: flex; flex-direction: column; gap: 12px; }
.assistant-empty { margin: auto; max-width: 560px; text-align: center; color: var(--ink); }
.assistant-empty h2 { font-size: 20px; }
.assistant-bubble { padding: 12px 15px; border-radius: 14px; max-width: 760px; white-space: pre-wrap; line-height: 1.55;
  border: 1px solid var(--line); }
.assistant-bubble.user { align-self: flex-end; background: var(--ink); color: #fff; border-color: var(--ink); }
.assistant-bubble.bot { align-self: flex-start; background: #fff; color: var(--ink); }
.assistant-composer { margin: 0 auto 18px; width: min(880px, calc(100% - 32px)); border: 1px solid #d8d8d4; border-radius: 14px;
  background: #fff; padding: 10px; box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.assistant-composer.drag { border-color: var(--teal); background: #f2fbfc; }
.assistant-drop-hint { color: var(--muted); font-size: 12px; padding: 0 4px 8px; }
.assistant-input-row { display: flex; gap: 8px; align-items: flex-end; }
.assistant-input-row textarea { flex: 1; resize: none; border: 0; min-height: 44px; max-height: 160px; font: inherit; outline: none; padding: 8px; }
.assistant-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 8px; background: #f7f8fa; font-size: 12px; }
.attach-chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); }
@media (max-width: 980px) {
  .admin-layout, .management-grid { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .admin-nav button { white-space: nowrap; }
  .dash-hero, .section-head { flex-direction: column; }
  .assistant-shell { grid-template-columns: 1fr; }
  .assistant-sidebar { max-height: 190px; border-right: 0; border-bottom: 1px solid var(--line); }
  .assistant-page { height: auto; min-height: calc(100vh - 59px); }
}

/* dynamic form fields */
.field { margin-bottom: 14px; }
.field .flabel { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; max-width: 460px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; font: inherit; box-sizing: border-box; }
.field textarea { max-width: 100%; }
.field .fhelp { font-size: 12px; margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.chk.grow { flex: 1; }
.chkrow { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.chkrow input[type=date] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

/* read-only key/value rows on a record detail */
.kv { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv .k { flex: 0 0 220px; color: var(--muted); }
.kv .v { flex: 1; }

/* access board (security-group buckets, drag & drop) */
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 14px; }
.modchip { background: var(--red); color: #fff; padding: 6px 12px; border-radius: 7px; font-size: 13px;
  font-weight: 600; cursor: grab; user-select: none; }
.modchip:active { cursor: grabbing; }
.buckets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.bucket { border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #fafafa; }
.bucket-h { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; word-break: break-all; }
.dropz { min-height: 54px; border: 1.5px dashed var(--line); border-radius: 8px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px; background: #fff; }
.dropz.over { border-color: var(--teal); background: #f0fbfc; }
.acc { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 5px 8px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 13px; }
.acc b { flex: 1; }
button.btn.ghost { line-height: 1; }
/* project estimates — section side panel + spreadsheet preview */
.est-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.est-side { flex: 0 0 240px; max-height: 72vh; overflow: auto; }
.est-main { flex: 1; min-width: 320px; }
.sec-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.sec-item:hover { border-color: var(--teal); }
.sec-item.active { border-color: var(--red); background: #fff5f5; }
.sec-pick .sec-grid { display: flex; flex-wrap: wrap; gap: 6px 20px; }
/* the estimate detail uses the FULL page width (no 1200px cap, no wasted whitespace) */
main:has(.est-detail) { max-width: none; }
.xl-scroll { max-height: 74vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
table.xl { font-size: 12px; border-collapse: collapse; table-layout: fixed; }
table.xl th, table.xl td { border: 1px solid #d5d8dd; padding: 2px 6px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
table.xl th { position: sticky; top: 0; z-index: 1; background: #f3f4f6; color: #444; font-weight: 600; }
table.xl th.xl-rownum { position: sticky; left: 0; z-index: 2; }         /* freeze row numbers */
table.xl th.xl-corner { position: sticky; left: 0; top: 0; z-index: 3; } /* freeze the corner */
table.xl .xl-corner, table.xl .xl-rownum { background: #eef0f3; color: #666; text-align: center; }
table.xl td.sel { outline: 2px solid var(--red); outline-offset: -2px; }
table.xl td { cursor: cell; }
/* Excel-style formula bar above the grid */
.xl-fbar { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 8px; background: #fff; font-size: 13px; overflow: hidden; }
.xl-fbar .fbar-ref { flex: 0 0 72px; padding: 6px 8px; border-right: 1px solid var(--line);
  background: #f3f4f6; font-weight: 600; text-align: center; color: #555; }
.xl-fbar .fbar-content { padding: 6px 10px; min-height: 20px; font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #0b3d66; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.xl td.xl-dd { position: relative; padding-right: 15px; background: #fbfdff; }
table.xl td.xl-dd .dd-caret { position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  color: #888; font-size: 9px; }
table.xl td.xl-dd .dd-v { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
/* progress bar */
.prog-wrap { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.prog { flex: 0 0 130px; height: 9px; background: #e9ebee; border-radius: 999px; overflow: hidden; }
.prog.wide { flex: 0 0 340px; max-width: 55%; }
.prog-fill { height: 100%; background: var(--teal); transition: width .3s ease; }
.callout { background: var(--warn-bg); border: 1px solid var(--line); border-left: 3px solid var(--red);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.xl-embed { width: 100%; height: 600px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* collapsible bucket headers */
.chead { flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.chead .caret { color: var(--muted); font-size: 12px; width: 12px; }
.chead b { flex: 0 0 auto; }

/* form builder — spacious question cards */
.fcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.fcard-top { display: flex; gap: 10px; align-items: center; }
.f-label { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 15px; }
.fcard-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.fcard-meta { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.f-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.f-inline select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
.f-sub { font-size: 12px; color: var(--muted); }
.f-optwrap { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.f-opts { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; width: 100%; box-sizing: border-box; }
/* give builder buckets full width so questions have room */
.buckets .bucket .fcard { max-width: 100%; }
.mem { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.memchip { display: inline-flex; align-items: center; gap: 3px; background: #eef2ff; border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; }
.memchip button.btn { padding: 0 6px; }
.memchip.grp { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }

/* BC environment transparency badge */
.env-row { align-items: center; gap: 10px; margin-bottom: 10px; }
.env-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; }
.env-badge.prod { color: #065f46; background: #d1fae5; border-color: #6ee7b7; }
.env-badge.sandbox { color: #92400e; background: #fef3c7; border-color: #fcd34d; }
