/* =====================================================================
   FormBuilder: visual language shared with wiseRide
   (navy sidebar, Poppins, soft white cards on #f8f8fb)
   ===================================================================== */
:root {
  --fb-navy: #002169;
  --fb-navy-2: #0a2c7a;
  --fb-navy-ink: #a6b0cf;
  --fb-navy-ink-dim: #6d7aa3;
  --fb-accent: #3d6bff;
  --fb-bg: #f8f8fb;
  --fb-ink: #343a40;
  --fb-muted: #74788d;
  --fb-border: #eceff5;
  --fb-card-shadow: 0 .75rem 1.5rem rgba(18, 38, 63, .04);
  --fb-sidebar-w: 250px;
  --fb-sidebar-w-collapsed: 72px;
  --fb-topbar-h: 70px;
  --fb-radius: .6rem;
  --tint: #002169;

  --bs-body-font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: .875rem;
  --bs-body-bg: #fff;
  --bs-body-color: #495057;
  --bs-emphasis-color: var(--fb-ink);
  --bs-secondary-color: var(--fb-muted);
  --bs-border-color: var(--fb-border);
  --bs-primary: var(--fb-navy);
  --bs-primary-rgb: 0, 33, 105;
  --bs-link-color: #2b54d9;
  --bs-link-color-rgb: 43, 84, 217;
  --bs-link-hover-color: var(--fb-navy);
  --bs-border-radius: .45rem;
  --bs-focus-ring-color: rgba(61, 107, 255, .25);
  --fb-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

/* Entity color tints */
.tint-navy   { --tint: #002169; }
.tint-blue   { --tint: #3d6bff; }
.tint-teal   { --tint: #0e9f9a; }
.tint-green  { --tint: #2fae7e; }
.tint-amber  { --tint: #e0a12b; }
.tint-orange { --tint: #ef7d32; }
.tint-red    { --tint: #e5534b; }
.tint-pink   { --tint: #d9488f; }
.tint-purple { --tint: #7c5cff; }
.tint-slate  { --tint: #5b6b84; }

html { font-size: 16px; }
body { background: var(--fb-bg); color: var(--bs-body-color); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { color: var(--fb-ink); }
code, .font-monospace, .sql-name { font-family: var(--fb-mono); font-variant-ligatures: none; }
:focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- buttons & forms */
.btn { --bs-btn-font-size: .85rem; --bs-btn-font-weight: 500; --bs-btn-padding-x: .95rem; --bs-btn-padding-y: .48rem; border-radius: .45rem; }
.btn-sm { --bs-btn-padding-x: .6rem; --bs-btn-padding-y: .28rem; --bs-btn-font-size: .78rem; }
.btn-primary {
  --bs-btn-bg: var(--fb-navy); --bs-btn-border-color: var(--fb-navy);
  --bs-btn-hover-bg: var(--fb-navy-2); --bs-btn-hover-border-color: var(--fb-navy-2);
  --bs-btn-active-bg: #001a54; --bs-btn-active-border-color: #001a54;
  --bs-btn-disabled-bg: var(--fb-navy); --bs-btn-disabled-border-color: var(--fb-navy);
  box-shadow: 0 2px 6px rgba(0, 33, 105, .18);
}
.btn-outline-primary {
  --bs-btn-color: var(--fb-navy); --bs-btn-border-color: rgba(0, 33, 105, .35);
  --bs-btn-hover-bg: var(--fb-navy); --bs-btn-hover-border-color: var(--fb-navy);
  --bs-btn-active-bg: var(--fb-navy); --bs-btn-active-border-color: var(--fb-navy);
}
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--fb-border); --bs-btn-color: #495057; --bs-btn-hover-bg: #f3f5f9; --bs-btn-hover-border-color: #dfe3ec; }
.btn-soft-danger { --bs-btn-color: #d0413a; --bs-btn-bg: #fdeceb; --bs-btn-border-color: transparent; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #e5534b; --bs-btn-active-bg: #d0413a; --bs-btn-active-color: #fff; }
.btn-icon { --bs-btn-disabled-border-color: transparent; --bs-btn-disabled-bg: transparent; --bs-btn-disabled-opacity: .3; --bs-btn-padding-x: 0; width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; --bs-btn-color: var(--fb-muted); --bs-btn-hover-bg: #eef1f7; --bs-btn-hover-color: var(--fb-navy); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; }
.btn-icon.danger { --bs-btn-hover-bg: #fdeceb; --bs-btn-hover-color: #d0413a; }

.form-label { font-weight: 500; color: var(--fb-ink); font-size: .84rem; margin-bottom: .35rem; }
.form-control, .form-select { font-size: .875rem; border-color: #dfe3ec; padding: .5rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #9db2ff; box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-text { font-size: .78rem; color: var(--fb-muted); }
.form-check-input:checked { background-color: var(--fb-navy); border-color: var(--fb-navy); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); border-color: #9db2ff; }
.input-group-text { background: #f6f7fb; border-color: #dfe3ec; color: var(--fb-muted); font-size: .82rem; }
.req { color: #e5534b; margin-left: .15rem; }

/* ---------------------------------------------------------------- shell */
.fb-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--fb-sidebar-w); z-index: 1040;
  background: var(--fb-navy); color: var(--fb-navy-ink);
  display: flex; flex-direction: column; transition: width .2s ease, transform .25s ease;
}
.fb-brand { height: var(--fb-topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1.35rem; color: #fff; text-decoration: none; flex: 0 0 auto; }
.fb-brand:hover { color: #fff; }
.fb-brand-mark { width: 34px; height: 34px; border-radius: .55rem; display: grid; place-items: center; background: rgba(255, 255, 255, .12); font-size: 1.05rem; flex: 0 0 auto; }
.fb-brand-text { font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; white-space: nowrap; }
.fb-brand-text small { display: block; font-size: .66rem; font-weight: 400; color: var(--fb-navy-ink); letter-spacing: .06em; text-transform: uppercase; margin-top: -2px; }

.fb-nav { flex: 1 1 auto; overflow-y: auto; padding: .5rem 0 1.5rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.fb-nav-title { padding: 1.1rem 1.5rem .45rem; font-size: .66rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--fb-navy-ink-dim); white-space: nowrap; }
.fb-nav a {
  position: relative; display: flex; align-items: center; gap: .8rem; margin: 1px .75rem; padding: .55rem .75rem;
  color: var(--fb-navy-ink); text-decoration: none; border-radius: .5rem; font-size: .86rem; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.fb-nav a > i { font-size: 1.1rem; width: 1.25rem; text-align: center; flex: 0 0 auto; }
.fb-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.fb-nav a.active { color: #fff; background: rgba(255, 255, 255, .11); }
.fb-nav a.active::before { content: ""; position: absolute; left: -.75rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 0 3px 3px 0; background: #7f9cff; }
.fb-nav .nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.fb-nav .nav-count { font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--fb-navy-ink); }
.fb-nav .nav-dot { width: 1.25rem; height: 1.25rem; border-radius: .35rem; display: grid; place-items: center; font-size: .72rem; flex: 0 0 auto; background: color-mix(in srgb, var(--tint) 62%, #ffffff); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.fb-nav .nav-empty { padding: .3rem 1.5rem; font-size: .78rem; color: var(--fb-navy-ink-dim); }

.fb-main { margin-left: var(--fb-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.fb-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--fb-topbar-h); background: #fff;
  display: flex; align-items: center; gap: 1rem; padding: 0 1.75rem 0 1rem;
  box-shadow: 0 1px 0 var(--fb-border), 0 .5rem 1.25rem rgba(18, 38, 63, .03);
}
.fb-topbar .breadcrumb { margin: 0; font-size: .82rem; }
.fb-qs-picker { display: flex; align-items: center; gap: .45rem; margin: 0 .75rem 0 0; color: var(--fb-navy); flex: 0 0 auto; }
.fb-qs-picker .form-select { min-width: 150px; max-width: 240px; font-weight: 500; }
.fb-topbar .breadcrumb-item a { color: var(--fb-muted); text-decoration: none; }
.fb-topbar .breadcrumb-item a:hover { color: var(--fb-navy); }
.fb-topbar .breadcrumb-item.active { color: var(--fb-ink); font-weight: 500; }
.fb-content { flex: 1 1 auto; padding: 1.75rem 1.75rem 3rem; max-width: 1480px; width: 100%; }

/* collapsed rail (desktop) */
body.sidebar-collapsed .fb-sidebar { width: var(--fb-sidebar-w-collapsed); }
body.sidebar-collapsed .fb-main { margin-left: var(--fb-sidebar-w-collapsed); }
body.sidebar-collapsed .fb-brand { padding: 0 1.1rem; }
body.sidebar-collapsed .fb-brand-text,
body.sidebar-collapsed .fb-nav-title,
body.sidebar-collapsed .fb-nav .nav-label,
body.sidebar-collapsed .fb-nav .nav-count,
body.sidebar-collapsed .fb-nav .nav-empty { display: none; }
body.sidebar-collapsed .fb-nav a { justify-content: center; margin: 2px .65rem; padding: .6rem 0; }
body.sidebar-collapsed .fb-nav-group + .fb-nav-group { border-top: 1px solid rgba(255,255,255,.07); margin-top: .5rem; padding-top: .5rem; }

.fb-backdrop { display: none; }
@media (max-width: 991.98px) {
  .fb-sidebar { transform: translateX(-100%); width: var(--fb-sidebar-w) !important; }
  .fb-main { margin-left: 0 !important; }
  body.sidebar-open .fb-sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.sidebar-open .fb-backdrop { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(15, 23, 42, .35); }
  body.sidebar-collapsed .fb-brand-text, body.sidebar-collapsed .fb-nav-title, body.sidebar-collapsed .fb-nav .nav-label,
  body.sidebar-collapsed .fb-nav .nav-count { display: revert; }
  body.sidebar-collapsed .fb-nav a { justify-content: flex-start; margin: 1px .75rem; padding: .55rem .75rem; }
  .fb-topbar { padding: 0 1rem; }
  .fb-content { padding: 1.25rem 1rem 2.5rem; }
}
@media (prefers-reduced-motion: reduce) { .fb-sidebar, .fb-main { transition: none; } }

/* ---------------------------------------------------------------- page heading */
.fb-page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.fb-page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.fb-page-head .lead-text { margin: .2rem 0 0; color: var(--fb-muted); font-size: .86rem; }
.fb-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* entity identity tile */
.fb-tile {
  width: 44px; height: 44px; border-radius: .7rem; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 1.25rem;
  color: var(--tint); background: color-mix(in srgb, var(--tint) 11%, #fff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 16%, transparent);
}
.fb-tile.sm { width: 34px; height: 34px; font-size: 1rem; border-radius: .55rem; }
.fb-tile.lg { width: 56px; height: 56px; font-size: 1.55rem; border-radius: .9rem; }
.fb-tile.solid { color: #fff; background: var(--tint); box-shadow: 0 6px 14px color-mix(in srgb, var(--tint) 30%, transparent); }

/* entity workspace header (Records · Fields · Form layout · Settings) */
.fb-entity-head { background: #fff; border-radius: var(--fb-radius); box-shadow: var(--fb-card-shadow); border: 1px solid var(--fb-border); margin-bottom: 1.5rem; }
.fb-entity-head .head-top { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 1.25rem 1.5rem 1rem; }
.fb-entity-head .head-title { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 1rem; }
.fb-entity-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.fb-entity-head .meta { color: var(--fb-muted); font-size: .82rem; margin-top: .15rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.fb-tabs { display: flex; gap: .25rem; padding: 0 1.25rem; border-top: 1px solid var(--fb-border); overflow-x: auto; }
.fb-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .85rem .6rem; margin: 0 .2rem; color: var(--fb-muted); text-decoration: none; font-weight: 500; font-size: .85rem; border-bottom: 2px solid transparent; white-space: nowrap; }
.fb-tabs a:hover { color: var(--fb-ink); }
.fb-tabs a.active { color: var(--fb-navy); border-bottom-color: var(--fb-navy); }
.fb-tabs .count { font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; background: #eef1f7; color: var(--fb-muted); }
.fb-tabs a.active .count { background: rgba(0, 33, 105, .08); color: var(--fb-navy); }

.sql-name { font-family: var(--fb-mono); font-size: .76rem; color: #5b6b84; background: #f1f3f8; padding: .12rem .45rem; border-radius: .35rem; white-space: nowrap; }

/* ---------------------------------------------------------------- cards */
.card { --bs-card-border-color: var(--fb-border); --bs-card-border-radius: var(--fb-radius); --bs-card-cap-bg: #fff; box-shadow: var(--fb-card-shadow); }
.card-header { padding: 1rem 1.35rem; border-bottom-color: var(--fb-border); }
.card-title { font-size: .95rem; font-weight: 600; margin: 0; color: var(--fb-ink); }
.card-subtitle { font-size: .78rem; color: var(--fb-muted); margin-top: .15rem; }
.card-body { padding: 1.35rem; }

/* ---------------------------------------------------------------- dashboard */
.fb-hello { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem 1.75rem; border-radius: var(--fb-radius); margin-bottom: 1.5rem; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #1b46b8 0%, rgba(27, 70, 184, 0) 55%), var(--fb-navy); box-shadow: 0 12px 28px rgba(0, 33, 105, .18); }
.fb-hello h1 { color: #fff; font-size: 1.35rem; font-weight: 600; margin: 0; }
.fb-hello p { margin: .3rem 0 0; color: #c6d0ef; font-size: .86rem; }
.fb-hello .totals { display: flex; gap: 2rem; }
.fb-hello .totals div { text-align: right; }
.fb-hello .totals strong { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.1; color: #fff; }
.fb-hello .totals span { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #9fb0e0; }

.entity-card { display: flex; flex-direction: column; height: 100%; transition: transform .15s, box-shadow .15s; }
.entity-card:hover { transform: translateY(-2px); box-shadow: 0 1rem 2rem rgba(18, 38, 63, .08); }
.entity-card .card-body { display: flex; gap: 1rem; align-items: flex-start; }
.entity-card h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .15rem; }
.entity-card h3 a { color: inherit; text-decoration: none; }
.entity-card h3 a::after { content: ""; position: absolute; inset: 0; }
.entity-card .desc { font-size: .8rem; color: var(--fb-muted); margin: .35rem 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entity-card .stats { display: flex; gap: 1.25rem; padding: .8rem 1.35rem; border-top: 1px solid var(--fb-border); font-size: .78rem; color: var(--fb-muted); margin-top: auto; align-items: center; }
.entity-card .stats strong { color: var(--fb-ink); font-weight: 600; font-size: .9rem; margin-right: .2rem; }
.entity-card .stats .links { margin-left: auto; position: relative; z-index: 1; display: flex; gap: .15rem; }
.entity-card.add { border: 2px dashed #d9deea; box-shadow: none; background: transparent; align-items: center; justify-content: center; min-height: 150px; color: var(--fb-muted); text-decoration: none; }
.entity-card.add:hover { border-color: var(--fb-navy); color: var(--fb-navy); background: #fff; }
.entity-card.add i { font-size: 1.5rem; display: block; text-align: center; margin-bottom: .3rem; }

/* empty states */
.fb-empty { text-align: center; padding: 3.5rem 1.5rem; }
.fb-empty .fb-empty-icon { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 1rem; display: grid; place-items: center; font-size: 1.7rem; color: var(--fb-navy); background: #eef1fb; }
.fb-empty h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: .35rem; }
.fb-empty p { color: var(--fb-muted); max-width: 460px; margin: 0 auto 1.25rem; font-size: .86rem; }
.fb-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; text-align: left; max-width: 760px; margin: 1.75rem auto 0; }
.fb-steps div { padding: 1rem 1.1rem; border-radius: .6rem; background: #f6f7fb; font-size: .82rem; color: var(--fb-muted); }
.fb-steps b { display: block; color: var(--fb-ink); font-weight: 600; margin-bottom: .2rem; font-size: .86rem; }
.fb-steps .step-no { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--fb-navy); color: #fff; font-size: .72rem; font-weight: 600; margin-bottom: .55rem; }

/* ---------------------------------------------------------------- tables */
.fb-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; padding: 1rem 1.35rem; border-bottom: 1px solid var(--fb-border); }
.fb-search { position: relative; flex: 0 1 320px; }
.fb-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--fb-muted); pointer-events: none; }
.fb-search input { padding-left: 2.2rem; background: #f6f7fb; border-color: transparent; }
.fb-search input:focus { background: #fff; }
.fb-toolbar .count-label { color: var(--fb-muted); font-size: .8rem; }

.table { --bs-table-color: #495057; margin: 0; font-size: .85rem; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-bottom-color: var(--fb-border); }
.table > :not(caption) > * > *:first-child { padding-left: 1.35rem; }
.table > :not(caption) > * > *:last-child { padding-right: 1.35rem; }
.table thead th { background: #f8f9fc; color: var(--fb-muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--fb-border); }
.table thead th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.table thead th a:hover, .table thead th a.sorted { color: var(--fb-navy); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table td.actions { width: 1%; white-space: nowrap; text-align: right; }
.table td.id-cell { color: var(--fb-muted); font-family: var(--fb-mono); font-size: .76rem; width: 1%; }
tr[data-href] { cursor: pointer; }
.cell-title { font-weight: 600; color: var(--fb-ink); text-decoration: none; }
.cell-title:hover { color: var(--fb-navy); }
.cell-sub { font-size: .76rem; color: var(--fb-muted); }

.fb-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.35rem; border-top: 1px solid var(--fb-border); font-size: .8rem; color: var(--fb-muted); }
.pagination { --bs-pagination-font-size: .8rem; --bs-pagination-border-color: var(--fb-border); --bs-pagination-color: #495057; --bs-pagination-active-bg: var(--fb-navy); --bs-pagination-active-border-color: var(--fb-navy); --bs-pagination-hover-bg: #f1f3f8; gap: .25rem; }
.pagination .page-link { border-radius: .4rem !important; min-width: 2rem; text-align: center; }

/* type chips */
.type-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 500; padding: .22rem .6rem; border-radius: 999px; color: color-mix(in srgb, var(--tint) 85%, #000); background: color-mix(in srgb, var(--tint) 10%, #fff); white-space: nowrap; }
.flag { display: inline-flex; align-items: center; gap: .25rem; font-size: .72rem; font-weight: 500; padding: .1rem .5rem; border-radius: 999px; background: #f1f3f8; color: var(--fb-muted); }
.flag.on { background: #e7f6ef; color: #23845f; }

/* ---------------------------------------------------------------- field editor */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .55rem; }
.type-grid .btn-check + label, .type-grid .type-tile {
  display: flex; align-items: center; gap: .6rem; text-align: left; padding: .6rem .75rem; height: 100%;
  border: 1px solid var(--fb-border); background: #fff; color: var(--fb-ink); border-radius: .55rem; font-size: .8rem; font-weight: 500;
}
.type-grid .btn-check + label i, .type-grid .type-tile i { width: 30px; height: 30px; border-radius: .45rem; display: grid; place-items: center; flex: 0 0 auto; font-size: .95rem; color: var(--tint); background: color-mix(in srgb, var(--tint) 10%, #fff); }
.type-grid .type-tile { text-decoration: none; }
.type-grid .btn-check + label:hover, .type-grid .type-tile:hover { border-color: #c9d2e6; background: #fbfcff; }
.type-grid .btn-check:checked + label { border-color: var(--fb-navy); box-shadow: 0 0 0 1px var(--fb-navy); background: #f7f9ff; }
.type-grid .btn-check:disabled + label { opacity: .5; }
.type-grid .btn-check:disabled:checked + label { opacity: 1; }
.type-grid .btn-check:focus-visible + label { outline: 2px solid var(--fb-accent); outline-offset: 2px; }

.preview-card { position: sticky; top: calc(var(--fb-topbar-h) + 1.5rem); }
.preview-stage { padding: 1.5rem 1.35rem; background: linear-gradient(#fff, #fff) padding-box, repeating-linear-gradient(45deg, #f4f6fb 0 10px, #f9fafc 10px 20px); border-radius: 0 0 var(--fb-radius) var(--fb-radius); }
.preview-stage .preview-surface { background: #fff; border: 1px solid var(--fb-border); border-radius: .55rem; padding: 1.1rem; box-shadow: 0 6px 16px rgba(18, 38, 63, .05); }
.preview-sql { font-family: var(--fb-mono); font-size: .74rem; color: #5b6b84; padding: .7rem 1.35rem; border-top: 1px solid var(--fb-border); background: #fafbfd; border-radius: 0 0 var(--fb-radius) var(--fb-radius); word-break: break-all; }

/* entity appearance picker */
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .4rem; }
.icon-grid label { height: 42px; display: grid; place-items: center; border-radius: .5rem; border: 1px solid var(--fb-border); font-size: 1.1rem; color: #5b6b84; cursor: pointer; background: #fff; }
.icon-grid label:hover { border-color: #c9d2e6; color: var(--fb-navy); }
.icon-grid .btn-check:checked + label { border-color: var(--fb-navy); color: var(--fb-navy); background: #f2f5ff; box-shadow: 0 0 0 1px var(--fb-navy); }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatches label { width: 30px; height: 30px; border-radius: 50%; background: var(--tint); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); position: relative; }
.swatches .btn-check:checked + label { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--tint); }
.swatches .btn-check:focus-visible + label, .icon-grid .btn-check:focus-visible + label { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.appearance-preview { display: flex; align-items: center; gap: .9rem; padding: 1rem; border-radius: .6rem; background: var(--fb-navy); }
.appearance-preview .nav-mock { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: .85rem; padding: .45rem .7rem; border-radius: .45rem; background: rgba(255,255,255,.11); flex: 1 1 auto; min-width: 0; }
.appearance-preview .nav-mock span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.danger-zone { border-color: #f6d4d2; }
.danger-zone .card-header { background: #fff8f7; border-bottom-color: #f6d4d2; }

/* ---------------------------------------------------------------- generated record form */
.fb-form-section { margin-bottom: 1.25rem; }
.fb-form-section .card-header { display: flex; align-items: center; gap: .6rem; }
.fb-form-section .card-header::before { content: ""; width: 4px; height: 1.1rem; border-radius: 2px; background: var(--tint); }
.fb-sticky-actions {
  position: sticky; bottom: 1rem; z-index: 10; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-top: 1.5rem; padding: .75rem 1rem; border-radius: var(--fb-radius); background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--fb-border); box-shadow: 0 10px 30px rgba(18, 38, 63, .1);
}
.fb-sticky-actions .spacer { flex: 1 1 auto; }
.wysiwyg-editor { min-height: 170px; background: #fff; }
.ql-toolbar.ql-snow { border-color: #dfe3ec !important; border-radius: .45rem .45rem 0 0; background: #fafbfd; font-family: inherit !important; }
.ql-container.ql-snow { border-color: #dfe3ec !important; border-radius: 0 0 .45rem .45rem; font-family: inherit !important; font-size: .9rem; }
.is-invalid-wrap .ql-toolbar, .is-invalid-wrap .ql-container { border-color: var(--bs-danger) !important; }
.file-current { display: flex; align-items: center; gap: .75rem; padding: .55rem .8rem; border: 1px solid var(--fb-border); border-radius: .45rem; background: #fafbfd; margin-bottom: .5rem; font-size: .82rem; }
.file-current a { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* "Multiple files" field */
.attach-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .45rem; }
.attach-list:empty { display: none; }
.attach-item { display: flex; align-items: flex-start; gap: .75rem; padding: .55rem .8rem; border: 1px solid var(--fb-border); border-radius: .45rem; background: #fafbfd; font-size: .82rem; }
.attach-item.new { background: #f4f8ff; border-style: dashed; }
.attach-item.removed { opacity: .55; }
.attach-item.removed .attach-name a { text-decoration: line-through; }
.attach-icon { font-size: 1.25rem; color: var(--fb-muted); line-height: 1.2; }
.attach-main { flex: 1 1 auto; min-width: 0; display: grid; gap: .35rem; }
.attach-name { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.attach-name a, .attach-name > span:first-child { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-meta { flex: 0 0 auto; color: var(--fb-muted); font-size: .75rem; }
.attach-desc { color: var(--fb-muted); }
.attach-remove { flex: 0 0 auto; margin: .1rem 0 0; }
.attach-drop { position: relative; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .9rem 1rem; margin: 0;
  border: 1.5px dashed #c9d0de; border-radius: .5rem; background: #fff; color: var(--fb-muted); font-size: .85rem; cursor: pointer; text-align: center; }
.attach-drop i { font-size: 1.3rem; color: var(--fb-navy); }
.attach-drop b { color: var(--fb-navy); font-weight: 600; }
.attach-drop:hover, .attach-drop.over { border-color: var(--fb-navy); background: #f4f6fb; }
.attach-drop:focus-within { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.attach-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.is-invalid-wrap .attach-drop { border-color: var(--bs-danger); }
.attach-cell { white-space: nowrap; }
.attach-cell a { text-decoration: none; }
.radio-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.radio-pills .btn-check + label { border: 1px solid #dfe3ec; background: #fff; color: #495057; border-radius: 999px; padding: .38rem .95rem; font-size: .82rem; font-weight: 500; cursor: pointer; }
.radio-pills .btn-check:checked + label { background: var(--fb-navy); border-color: var(--fb-navy); color: #fff; }
.radio-pills .btn-check:focus-visible + label { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.radio-pills.is-invalid .btn-check + label { border-color: var(--bs-danger); }
.switch-field { display: flex; align-items: center; min-height: 38px; }
.switch-field .form-check-input { width: 2.4em; height: 1.3em; margin-top: 0; }
.switch-field .form-check-label { margin-left: .5rem; color: var(--fb-muted); }

/* ---------------------------------------------------------------- layout designer */
.designer-section { background: #fff; border: 1px solid var(--fb-border); border-radius: var(--fb-radius); margin-bottom: 1rem; box-shadow: var(--fb-card-shadow); }
.designer-section-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--fb-border); }
.designer-section-head .section-handle { cursor: grab; color: #a3acc2; font-size: 1.1rem; padding: .2rem; }
.designer-section-head input { border: 1px solid transparent; font-weight: 600; background: transparent; padding: .3rem .5rem; color: var(--fb-ink); }
.designer-section-head input:hover { border-color: var(--fb-border); }
.designer-section-head input:focus { background: #fff; }
.designer-grid { min-height: 84px; padding: 1rem .9rem .25rem; margin: 0; background-image: linear-gradient(90deg, rgba(0,33,105,.035) 1px, transparent 1px); background-size: calc((100% - 1.8rem) / 12) 100%; background-position: .9rem 0; background-origin: content-box; }
.designer-grid:empty::before { content: "Drag fields here"; display: block; width: 100%; padding: 1.1rem; margin-bottom: .75rem; text-align: center; color: var(--fb-muted); font-size: .82rem; border: 2px dashed #d9deea; border-radius: .5rem; background: #fff; }
.designer-field { margin-bottom: .75rem; }
.designer-field-inner { display: flex; align-items: center; gap: .6rem; height: 100%; padding: .55rem .6rem .55rem .7rem; border: 1px solid #dbe1ee; border-radius: .5rem; background: #fff; cursor: grab; transition: box-shadow .15s, border-color .15s; }
.designer-field-inner:hover { border-color: #b9c5e3; box-shadow: 0 4px 12px rgba(18, 38, 63, .06); }
.designer-field-inner .ficon { width: 30px; height: 30px; border-radius: .45rem; display: grid; place-items: center; flex: 0 0 auto; color: var(--tint); background: color-mix(in srgb, var(--tint) 10%, #fff); }
.designer-field-inner .meta { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.designer-field-inner .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; color: var(--fb-ink); font-weight: 600; }
.designer-field-inner .meta small { color: var(--fb-muted); font-size: .72rem; }
.designer-field-inner select { width: auto; flex: 0 0 auto; font-size: .76rem; padding: .2rem 1.6rem .2rem .5rem; background-position: right .35rem center; }
.sortable-ghost .designer-field-inner { opacity: .45; border-style: dashed; border-color: var(--fb-navy); }
.sortable-chosen .designer-field-inner { box-shadow: 0 10px 24px rgba(0, 33, 105, .16); }
/* section column picker (1 / 2 / 3) */
.col-picker { display: inline-flex; align-items: center; gap: .15rem; flex: 0 0 auto; padding: .15rem; border: 1px solid var(--fb-border); border-radius: .5rem; background: #fafbfd; }
.col-picker-label { font-size: .72rem; color: var(--fb-muted); padding: 0 .35rem 0 .3rem; }
.col-picker .btn { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; font-size: .76rem; border: 0; border-radius: .35rem; color: var(--fb-muted); background: transparent; }
.col-picker .btn:hover { color: var(--fb-navy); background: #fff; }
.col-picker .btn.active { color: #fff; background: var(--fb-navy); }
.col-picker .btn:focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 1px; }
/* the grid guides follow the section's columns */
.designer-section[data-columns="1"] .designer-grid { background-image: none; }
.designer-section[data-columns="2"] .designer-grid { background-size: calc((100% - 1.8rem) / 2) 100%; }
.designer-section[data-columns="3"] .designer-grid { background-size: calc((100% - 1.8rem) / 3) 100%; }
@media (max-width: 575.98px) {
  .designer-section-head { flex-wrap: wrap; }
  .designer-section-head .section-heading { flex: 1 1 60%; }
  .col-picker-label { display: none; }
}
.designer-add { width: 100%; border: 2px dashed #d3d9e7; background: transparent; border-radius: var(--fb-radius); padding: .9rem; color: var(--fb-muted); font-weight: 500; font-size: .85rem; }
.designer-add:hover { border-color: var(--fb-navy); color: var(--fb-navy); background: #fff; }

/* ---------------------------------------------------------------- feedback */
.toast-container { z-index: 1090; }
.toast { border: 0; border-radius: .6rem; box-shadow: 0 12px 32px rgba(18, 38, 63, .16); overflow: hidden; font-size: .85rem; }
.toast .toast-body { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; }
.toast .toast-body > i { font-size: 1.15rem; line-height: 1.2; }
.toast.ok { border-left: 4px solid #2fae7e; } .toast.ok .toast-body > i { color: #2fae7e; }
.toast.err { border-left: 4px solid #e5534b; } .toast.err .toast-body > i { color: #e5534b; }
.modal-content { border: 0; border-radius: .8rem; box-shadow: 0 24px 60px rgba(18, 38, 63, .25); }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .9rem; font-size: 1.4rem; color: #e5534b; background: #fdeceb; }
.alert { border-radius: .55rem; font-size: .85rem; border: 0; }
.alert-danger { background: #fdeceb; color: #a8322c; }
.alert-info { background: #edf2ff; color: #22408f; }
.alert-warning { background: #fdf4e3; color: #8a5a00; }

/* unsaved layout changes */
.btn.pulse { position: relative; }
.btn.pulse::after { content: ""; position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: #ef7d32; box-shadow: 0 0 0 2px #fff; }
.min-w-0 { min-width: 0; }

/* ---------------------------------------------------------------- sidebar menu groups (wiseRide-style collapsible) */
.fb-menu-toggle {
  display: flex; align-items: center; gap: .8rem; width: calc(100% - 1.5rem); margin: 1px .75rem; padding: .55rem .75rem;
  border: 0; border-radius: .5rem; background: transparent; color: var(--fb-navy-ink); font-size: .86rem; text-align: left; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.fb-menu-toggle:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.fb-menu-toggle > .bi:first-child { font-size: 1.1rem; width: 1.25rem; text-align: center; flex: 0 0 auto; }
.fb-menu-toggle .group-initial { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; border-radius: .35rem; display: grid; place-items: center; font-size: .68rem; font-weight: 600; background: rgba(255, 255, 255, .1); color: #dfe5f7; }
.fb-menu-toggle .chev { margin-left: auto; font-size: .7rem; transition: transform .2s; opacity: .7; }
.fb-menu-group.has-active > .fb-menu-toggle { color: #fff; }
.fb-menu-group.closed > .fb-menu-toggle .chev { transform: rotate(-90deg); }
.fb-menu-group.closed > .fb-submenu { display: none; }
.fb-submenu { position: relative; margin: 0 0 .25rem; }
.fb-submenu::before { content: ""; position: absolute; left: 1.95rem; top: .2rem; bottom: .35rem; width: 1px; background: rgba(255, 255, 255, .09); }
.fb-nav .fb-submenu a { padding: .42rem .75rem .42rem 2.35rem; font-size: .83rem; color: #8f9bc2; }
.fb-nav .fb-submenu a:hover, .fb-nav .fb-submenu a.active { color: #fff; }
.fb-nav .fb-submenu .nav-dot { width: 1.1rem; height: 1.1rem; font-size: .64rem; }
@media (prefers-reduced-motion: reduce) { .fb-menu-toggle .chev { transition: none; } }

/* rail mode: no group headers, every visible entity as an icon */
body.sidebar-collapsed .fb-menu-toggle { display: none; }
body.sidebar-collapsed .fb-menu-group > .fb-submenu { display: block; }
body.sidebar-collapsed .fb-submenu::before { display: none; }
body.sidebar-collapsed .fb-nav .fb-submenu a { padding: .6rem 0; }
body.sidebar-collapsed .fb-menu-group + .fb-menu-group { border-top: 1px solid rgba(255, 255, 255, .07); padding-top: .25rem; margin-top: .25rem; }
@media (max-width: 991.98px) {
  body.sidebar-collapsed .fb-menu-toggle { display: flex; }
  body.sidebar-collapsed .fb-menu-group.closed > .fb-submenu { display: none; }
  body.sidebar-collapsed .fb-nav .fb-submenu a { padding: .42rem .75rem .42rem 2.35rem; }
}

/* ---------------------------------------------------------------- menu builder */
.mb-group { margin-bottom: 1rem; }
.mb-group-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-bottom: 1px solid var(--fb-border); }
.mb-handle { cursor: grab; color: #a3acc2; font-size: 1.1rem; padding: .2rem; }
.mb-group-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: .55rem; border: 1px solid transparent; background: var(--fb-navy); color: #fff; font-size: 1rem; }
.mb-group-icon.empty { background: #fff; color: #a3acc2; border: 1px dashed #c9d2e6; }
.mb-group-icon:not(.static):hover { box-shadow: 0 0 0 3px rgba(61, 107, 255, .2); }
.mb-group-icon.static { background: #eef1f7; color: var(--fb-muted); }
.mb-title { border: 1px solid transparent; font-weight: 600; color: var(--fb-ink); background: transparent; padding: .35rem .55rem; flex: 1 1 auto; min-width: 0; }
.mb-title:hover { border-color: var(--fb-border); }
.mb-title:focus { background: #fff; }
.mb-count { font-size: .74rem; color: var(--fb-muted); white-space: nowrap; }
.mb-items { min-height: 64px; padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.mb-items:empty::before { content: "Drag entities here"; display: block; padding: .9rem; text-align: center; color: var(--fb-muted); font-size: .8rem; border: 2px dashed #d9deea; border-radius: .5rem; }
.mb-item { display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem .5rem .5rem; border: 1px solid #e3e8f2; border-radius: .55rem; background: #fff; cursor: grab; transition: box-shadow .15s, border-color .15s, opacity .15s; }
.mb-item:hover { border-color: #c9d2e6; box-shadow: 0 4px 12px rgba(18, 38, 63, .06); }
.mb-item .mb-grip { color: #b5bdd0; }
.mb-item .fb-tile { border: 0; cursor: pointer; }
.mb-item .fb-tile:hover { box-shadow: 0 0 0 3px rgba(61, 107, 255, .2); }
.mb-item .meta { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.mb-item .meta strong { display: block; font-size: .86rem; color: var(--fb-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-item .meta small { font-size: .72rem; color: var(--fb-muted); }
.mb-item .mb-hidden-flag { display: none; }
.mb-item.is-hidden { background: #fafbfd; border-style: dashed; }
.mb-item.is-hidden .fb-tile, .mb-item.is-hidden .meta { opacity: .55; }
.mb-item.is-hidden .mb-hidden-flag { display: inline-flex; }
.mb-item .form-switch .form-check-input { width: 2.3em; height: 1.25em; cursor: pointer; }
.mb-group.sortable-ghost, .mb-item.sortable-ghost { opacity: .45; border-style: dashed; border-color: var(--fb-navy); }
.mb-item.sortable-chosen { box-shadow: 0 10px 24px rgba(0, 33, 105, .16); }
.mb-ungrouped { border-style: dashed; box-shadow: none; }
.mb-icon-choice { height: 42px; display: grid; place-items: center; border-radius: .5rem; border: 1px solid var(--fb-border); font-size: 1.1rem; color: #5b6b84; background: #fff; }
.mb-icon-choice:hover, .mb-icon-choice.current { border-color: var(--fb-navy); color: var(--fb-navy); background: #f2f5ff; }

/* builder preview: a small copy of the real sidebar */
.mb-preview { background: var(--fb-navy); padding: .75rem 0 1rem; min-height: 220px; border-radius: 0; }
.mb-preview .fb-nav { padding: 0; overflow: visible; }
.mb-preview .fb-nav a, .mb-preview .fb-menu-toggle { pointer-events: none; }
.mb-preview .empty-note { padding: 1rem 1.5rem; color: var(--fb-navy-ink-dim); font-size: .8rem; }

.mb-preview-note { padding: .75rem 1.35rem; font-size: .78rem; color: var(--fb-muted); border-top: 1px solid var(--fb-border); }

/* ---------------------------------------------------------------- date fields (DD/MM/YYYY + calendar) */
.date-field { max-width: 220px; flex-wrap: nowrap; }
.date-field-helper { display: none !important; }
.date-field .btn.btn-light { border: 1px solid #dfe3ec; color: var(--fb-navy); background: #fff; }
.date-field .btn.btn-light:hover { background: #f2f5ff; }
.date-field.is-invalid .btn.btn-light { border-color: var(--bs-form-invalid-border-color); }
.flatpickr-calendar { font-family: inherit; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--fb-navy); border-color: var(--fb-navy); }

/* ---------------------------------------------------------------- quality system setup */
.flag.warn { background: #fff4e0; color: #9a5b00; }
.qs-palette-card { position: sticky; top: 76px; }
.qs-palette { padding: .75rem 1rem 1rem; display: flex; flex-direction: column; gap: .4rem; max-height: calc(100vh - 260px); overflow-y: auto; }
.qs-item { display: flex; align-items: center; gap: .55rem; padding: .4rem .6rem .4rem .4rem; border: 1px solid #e3e8f2; border-radius: .55rem; background: #fff; cursor: grab; }
.qs-item[hidden] { display: none; }
.qs-item:hover { border-color: #c9d2e6; box-shadow: 0 4px 12px rgba(18, 38, 63, .06); }
.qs-item .mb-grip { color: #b5bdd0; }
.qs-item .fb-tile.sm { width: 28px; height: 28px; font-size: .85rem; }
.qs-caption { flex: 1 1 auto; min-width: 0; font-size: .84rem; font-weight: 500; color: var(--fb-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-item .btn-icon { width: 28px; height: 28px; }
.qs-level-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.qs-level-tabs a { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border: 1px solid var(--fb-border); border-radius: 999px; background: #fff; color: var(--fb-muted); font-weight: 500; font-size: .85rem; text-decoration: none; }
.qs-level-tabs a:hover { color: var(--fb-navy); border-color: #c9d2e6; }
.qs-level-tabs a.active { background: var(--fb-navy); border-color: var(--fb-navy); color: #fff; }
.qs-level-tabs .count { font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; background: #eef1f7; color: var(--fb-muted); }
.qs-level-tabs a.active .count { background: rgba(255, 255, 255, .18); color: #fff; }
.qs-level-records-head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--fb-border); flex-wrap: wrap; }
.qs-level-records-head .card-title { margin: 0; font-size: .98rem; }
.qs-level-records-head .card-title a { color: inherit; text-decoration: none; }
.qs-level-records-head .card-title a:hover { color: var(--fb-navy); }
.qs-level-records-empty { padding: 1.25rem; text-align: center; color: var(--fb-muted); font-size: .85rem; }
.qs-level-tabs a.ms-auto { border-style: dashed; }
/* Published content: one document page per record */
.qs-page-bar { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 0 0 .75rem; }
.qs-page-bar h2 { margin: 0; font-size: 1rem; font-weight: 600; }
.qs-page-bar h2 a { color: var(--fb-ink); text-decoration: none; }
.qs-page-bar h2 a:hover { color: var(--fb-navy); }
.qs-page { max-width: 900px; padding: 1.75rem 2rem 2rem; }
.qs-page-empty { padding: 1.5rem 2rem; color: var(--fb-muted); font-size: .9rem; }
.qs-page-head { display: flex; align-items: flex-start; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--fb-border); }
.qs-page-kicker { font-size: .8rem; font-weight: 500; color: var(--fb-muted); letter-spacing: .02em; }
.qs-page-head h3 { margin: .15rem 0 .5rem; font-size: 1.45rem; font-weight: 600; line-height: 1.25; color: var(--fb-ink); overflow-wrap: anywhere; }
.qs-page-facts { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; font-size: .85rem; color: var(--fb-ink); }
.qs-fact-label { color: var(--fb-muted); margin-right: .2rem; }
.qs-fact-published { color: #23845f; font-weight: 500; }
.qs-page-section { margin-top: 1.5rem; }
.qs-page-section h4 { font-size: .74rem; font-weight: 600; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .5rem; }
.qs-rich { font-size: .95rem; line-height: 1.7; color: var(--fb-ink); overflow-wrap: anywhere; }
.qs-rich > :last-child { margin-bottom: 0; }
.qs-rich img { max-width: 100%; height: auto; }
.qs-pre { white-space: pre-wrap; font-size: .95rem; line-height: 1.7; color: var(--fb-ink); }
.qs-file-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--fb-border); border-radius: .6rem; overflow: hidden; }
.qs-file-list li + li { border-top: 1px solid var(--fb-border); }
.qs-file { display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; color: inherit; text-decoration: none; }
.qs-file:hover { background: #f5f7fc; }
.qs-file-icon { font-size: 1.5rem; color: var(--fb-navy); flex: 0 0 auto; line-height: 1; }
.qs-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.qs-file-caption { font-size: .9rem; font-weight: 500; color: var(--fb-ink); overflow-wrap: anywhere; }
.qs-file-meta { font-size: .76rem; color: var(--fb-muted); overflow-wrap: anywhere; }
.qs-file-dl { color: var(--fb-muted); font-size: 1.05rem; }
.qs-file:hover .qs-file-dl { color: var(--fb-navy); }
@media (max-width: 575.98px) { .qs-page { padding: 1.25rem 1rem 1.5rem; } }
.qs-captions { padding: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.qs-caption-field { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.qs-caption-field > label { font-size: .72rem; font-weight: 600; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .04em; }
.qs-level-title [data-level-name] { text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--fb-ink); }
.qs-level-title .qs-level-no { font-weight: 500; text-transform: none; letter-spacing: 0; color: #a3acc2; }
.qs-procs { min-height: 120px; padding: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.qs-procs:empty::before { content: "Drag an entity here to add a procedure"; display: block; padding: 2rem; text-align: center; color: var(--fb-muted); font-size: .85rem; border: 2px dashed #d9deea; border-radius: .6rem; }
.qs-proc { border: 1px solid var(--fb-border); border-radius: var(--fb-radius); background: #fff; }
.qs-proc-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--fb-border); background: #fafbfd; border-radius: var(--fb-radius) var(--fb-radius) 0 0; }
.qs-proc-head .qs-caption { font-size: .92rem; font-weight: 600; }
.qs-proc-body { padding: .3rem .8rem .8rem; }
.qs-level-title { font-size: .74rem; font-weight: 600; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .04em; margin: .6rem 0 .35rem; display: flex; align-items: center; gap: .5rem; }
.qs-lane { min-height: 46px; padding: .4rem; display: flex; flex-wrap: wrap; gap: .4rem; border: 2px dashed #d9deea; border-radius: .55rem; }
.qs-lane:empty::before { content: "Drag entities here"; padding: .45rem; color: var(--fb-muted); font-size: .78rem; }
.qs-lane .qs-item { flex: 0 1 260px; min-width: 0; }
.qs-level.over .qs-lane { border-color: #f0c78a; background: #fffaf0; }
.qs-level.over .qs-item { opacity: .6; }
.qs-proc.sortable-ghost, .qs-item.sortable-ghost { opacity: .45; border-style: dashed; border-color: var(--fb-navy); }

/* settings: customizations card */
.custom-list .list-group-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .75rem; padding: .85rem 1.35rem; font-size: .85rem; }
.custom-list .custom-label { flex: 0 0 130px; font-weight: 600; color: var(--fb-ink); }
.custom-list .custom-db { flex: 1 1 300px; display: grid; gap: .25rem; color: #495057; }
.custom-list .custom-db b { font-weight: 600; color: var(--fb-ink); }

/* entity delete: keep or drop the table */
.delete-choice { display: grid; gap: .6rem; }
.delete-choice label { display: flex; gap: .85rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid var(--fb-border); border-radius: .6rem; cursor: pointer; background: #fff; }
.delete-choice label > i { font-size: 1.2rem; color: var(--fb-muted); margin-top: .1rem; }
.delete-choice label b { display: block; color: var(--fb-ink); font-size: .9rem; }
.delete-choice label small { color: var(--fb-muted); font-size: .8rem; }
.delete-choice .btn-check:checked + label { border-color: var(--fb-navy); box-shadow: 0 0 0 1px var(--fb-navy); background: #f7f9ff; }
.delete-choice .btn-check:checked + label > i { color: var(--fb-navy); }
.delete-choice .btn-check:focus-visible + label { outline: 2px solid var(--fb-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- branding (sidebar top-left)
   The logo sits in a box of --logo-w x --logo-h (set from Branding settings); the image is scaled to fit
   inside it with its proportions kept, and the header grows to fit the box. */
.fb-brand { min-width: 0; height: auto; min-height: var(--fb-topbar-h); padding-top: .75rem; padding-bottom: .75rem; }
.fb-brand-text { min-width: 0; overflow: hidden; }
.fb-brand-name { display: block; overflow: hidden; text-overflow: ellipsis; }
.fb-brand-text small { overflow: hidden; text-overflow: ellipsis; }
.fb-brand-mark { font-weight: 600; font-size: 1rem; }

.fb-logo { flex: 0 0 auto; display: grid; place-items: center; width: var(--logo-w, 34px); height: var(--logo-h, 34px);
  box-sizing: content-box; border-radius: .55rem; transition: width .15s, height .15s; }
.fb-logo.plate { background: #fff; padding: 5px; }
.fb-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Full width: the logo replaces the name */
.fb-brand.wide .fb-logo.plate { padding: 6px 10px; }
.fb-brand.wide .fb-logo { max-width: calc(var(--fb-sidebar-w) - 2.7rem - 20px); }

/* Stacked: a large logo centered above the name */
.fb-brand.stacked { flex-direction: column; justify-content: center; text-align: center; gap: .55rem; padding-top: 1.1rem; padding-bottom: 1rem; }
.fb-brand.stacked .fb-brand-text { max-width: 100%; }

/* Collapsed rail: a small tile, so the rail stays 72px wide */
.fb-brand .rail-only { display: none; }
body.sidebar-collapsed .fb-brand { min-height: var(--fb-topbar-h); padding-top: 0; padding-bottom: 0; }
body.sidebar-collapsed .fb-brand .fb-logo { width: 34px; height: 34px; }
body.sidebar-collapsed .fb-brand .fb-logo.plate { padding: 3px; }
body.sidebar-collapsed .fb-brand.wide .fb-logo { display: none; }
body.sidebar-collapsed .fb-brand.wide .rail-only { display: grid; }
@media (max-width: 991.98px) {
  body.sidebar-collapsed .fb-brand { padding-top: .75rem; padding-bottom: .75rem; }
  body.sidebar-collapsed .fb-brand .fb-logo { width: var(--logo-w, 34px); height: var(--logo-h, 34px); }
  body.sidebar-collapsed .fb-brand .fb-logo.plate { padding: 5px; }
  body.sidebar-collapsed .fb-brand.wide .fb-logo { display: grid; }
  body.sidebar-collapsed .fb-brand.wide .rail-only { display: none; }
}
@media (prefers-reduced-motion: reduce) { .fb-logo { transition: none; } }

/* branding page */
.logo-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.logo-current { width: 96px; height: 96px; flex: 0 0 auto; display: grid; place-items: center; border-radius: .8rem; padding: 10px;
  background: var(--fb-navy); color: #fff; font-size: 2rem; }
.logo-current.plate { background: #fff; border: 1px solid var(--fb-border); }
.logo-current img { max-width: 100%; max-height: 100%; object-fit: contain; }
#logoOptions:disabled { opacity: .5; }
.logo-modes { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.brand-preview { display: flex; background: var(--fb-bg); }
.brand-preview-wide, .brand-preview-rail { background: var(--fb-navy); padding: .25rem 0; }
.brand-preview-wide { flex: 0 0 var(--fb-sidebar-w); max-width: calc(100% - var(--fb-sidebar-w-collapsed) - 1rem); }
.brand-preview-rail { flex: 0 0 var(--fb-sidebar-w-collapsed); margin-left: auto; }
.brand-preview-rail .fb-brand { padding: 0 1.1rem; }

/* branding page: logo size */
.logo-size { border-top: 1px solid var(--fb-border); padding-top: 1rem; margin-top: 1.25rem; }
.size-row { display: grid; grid-template-columns: 60px 1fr 110px; gap: .75rem; align-items: center; margin-top: .6rem; }
.size-row label { font-size: .82rem; font-weight: 500; color: var(--fb-ink); margin: 0; }
.size-row .form-range::-webkit-slider-thumb { background: var(--fb-navy); }
.size-row .form-range::-moz-range-thumb { background: var(--fb-navy); }
.size-note { font-size: .78rem; color: var(--fb-muted); margin-top: .6rem; }
.size-note .warn { color: #b7791f; }
/* preview of the collapsed rail (mirrors body.sidebar-collapsed rules) */
.rail-scope .fb-brand { min-height: var(--fb-topbar-h); padding: 0 1.1rem; }
.rail-scope .fb-logo { width: 34px; height: 34px; }
.rail-scope .fb-logo.plate { padding: 3px; }
.rail-scope .fb-brand-text { display: none; }
.rail-scope .fb-brand.wide .fb-logo { display: none; }
.rail-scope .fb-brand.wide .rail-only { display: grid; }
.brand-preview { align-items: flex-start; }

/* ---------------------------------------------------------------- multi-select field */
.multi-pick { display: grid; gap: .6rem; }
.multi-all { margin: 0; }
.multi-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.multi-options .btn-check + label { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid #dfe3ec; background: #fff; color: #495057;
  border-radius: 999px; padding: .36rem .9rem .36rem .7rem; font-size: .82rem; font-weight: 500; cursor: pointer; }
.multi-options .btn-check + label .bi { opacity: 0; font-size: .85rem; margin-left: -.15rem; transition: opacity .1s; }
.multi-options .btn-check:checked + label { background: var(--fb-navy); border-color: var(--fb-navy); color: #fff; }
.multi-options .btn-check:checked + label .bi { opacity: 1; }
.multi-options .btn-check:focus-visible + label { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.multi-pick.is-all .multi-options { opacity: .45; pointer-events: none; }
.is-invalid-wrap .multi-options .btn-check + label { border-color: var(--bs-danger); }
.link-chip { display: inline-flex; align-items: center; gap: .25rem; margin: 0 .25rem .15rem 0; padding: .1rem .5rem; border-radius: 999px;
  background: #eef2fb; color: #3a4a74; font-size: .72rem; font-weight: 500; white-space: nowrap; }
.link-chip.all { background: #e6f4ec; color: #1f7a4a; }

/* ---------------------------------------------------------------- related records table (in a record form) */
.related-table { border: 1px solid var(--fb-border); border-radius: .5rem; background: #fff; }
.related-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .75rem; border-bottom: 1px solid var(--fb-border); }
.related-empty { padding: .9rem .9rem; font-size: .84rem; color: var(--fb-muted); }
.related-grid th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--fb-muted); font-weight: 600; padding: .55rem .75rem; background: #fafbfd; }
.related-grid td { padding: .5rem .75rem; font-size: .85rem; }
.related-grid td.actions { width: 1%; white-space: nowrap; text-align: right; }
.related-frame { width: 100%; height: min(78vh, 760px); border: 0; display: block; }
body.fb-embed { background: var(--fb-bg); }
body.fb-embed .fb-content { padding: 1rem 1.25rem 0; }
body.fb-embed .fb-page-head { margin-bottom: 1rem; }

/* ---------------------------------------------------------------- sign-in pages */
body.fb-auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: linear-gradient(180deg, var(--fb-navy) 0, #0a2c7a 42vh, var(--fb-bg) 42vh); }
.fb-auth-box { width: 100%; max-width: 440px; }
.fb-auth-brand { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.fb-auth-brand .fb-brand { height: auto; padding: 0; }
.fb-auth .card-body { padding: 2rem; }
.fb-auth-title { font-size: 1.3rem; font-weight: 600; margin: 0 0 .25rem; }
.fb-auth-lead { color: var(--fb-muted); font-size: .86rem; margin-bottom: 1.5rem; }
.fb-auth-foot { color: var(--fb-muted); font-size: .78rem; text-align: center; margin: 1.25rem 0 0; }

/* ---------------------------------------------------------------- users and roles */
.fb-user-menu { margin-left: .5rem; flex: 0 0 auto; }
.fb-topbar > .btn { white-space: nowrap; flex: 0 0 auto; }
.fb-user-menu > .btn { display: inline-flex; align-items: center; gap: .5rem; --bs-btn-padding-x: .5rem; --bs-btn-padding-y: .3rem; }
.fb-user-menu .dropdown-header { font-size: .78rem; line-height: 1.4; }
.fb-user-menu .dropdown-item { font-size: .85rem; }
.user-avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto; font-size: .74rem; font-weight: 600; background: #e8ecf8; color: var(--fb-navy); }
.user-avatar.sm { width: 1.75rem; height: 1.75rem; font-size: .66rem; }
.user-avatar.admin { background: #fde8e7; color: #b8322b; }
.user-cell { display: flex; align-items: center; gap: .75rem; }
tr.row-inactive td { opacity: .55; }
.role-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.role-pick { display: flex; gap: .65rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid #dfe3ec; border-radius: .55rem; cursor: pointer; background: #fff; }
.role-pick.on { border-color: var(--fb-navy); background: #f4f6fd; }
.role-pick .form-check-input { margin-top: .2rem; flex: 0 0 auto; }
.role-pick b { display: block; color: var(--fb-ink); font-weight: 600; font-size: .86rem; }
.role-pick small { display: block; color: var(--fb-muted); font-size: .76rem; }
.role-subhead { font-size: .8rem; font-weight: 600; color: var(--fb-ink); margin: 1.25rem 0 .5rem; }
.role-grid td { padding-top: .45rem !important; padding-bottom: .45rem !important; }
.role-grid .form-check-input { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.role-grid thead .btn-link { font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; text-decoration: none; }
.role-grid thead .btn-link:hover { color: var(--fb-navy); }
[data-systems].is-disabled { opacity: .5; }

/* ---------------------------------------------------------------- read-only record, history */
.fb-record-view .form-label { color: var(--fb-muted); font-weight: 500; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.fb-record-view .view-value { color: var(--fb-ink); font-size: .9rem; min-height: 1.4rem; overflow-wrap: anywhere; }
.fb-record-view .view-value.empty { color: #b3b9c6; }
.record-stamp { margin: .3rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .76rem; color: var(--fb-muted); }
.record-stamp b { color: var(--fb-ink); font-weight: 500; }
.record-history > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.record-history > summary::-webkit-details-marker { display: none; }
.record-history > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; color: var(--fb-muted); transition: transform .15s; }
.record-history[open] > summary::after { transform: rotate(180deg); }
.history-list { list-style: none; margin: 0; padding: .5rem 1.35rem 1rem; }
.history-list > li { padding: .75rem 0; border-bottom: 1px solid var(--fb-border); }
.history-list > li:last-child { border-bottom: 0; }
.history-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .84rem; }
.history-head b { color: var(--fb-ink); font-weight: 500; }
.history-action { font-size: .7rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: #eef1f7; color: var(--fb-navy); }
.history-action.create { background: #e7f6ef; color: #23845f; }
.history-action.delete { background: #fdeceb; color: #d0413a; }
.history-changes { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .8rem; }
.history-changes li { padding: .15rem 0; overflow-wrap: anywhere; }
.history-field { display: inline-block; min-width: 9rem; color: var(--fb-muted); font-weight: 500; }
.history-old { color: #9aa1b1; text-decoration: line-through; }
.history-new { color: var(--fb-ink); }
.level-pick { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; font-size: .82rem; margin: 0; }
[data-role-levels] tr.is-disabled td { opacity: .45; }

/* ---------------------------------------------------------------- quality system dashboard (procedure cards with their levels) */
.qs-dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
.qs-dash-head { display: flex; align-items: center; gap: .85rem; padding: 1.1rem 1.25rem; }
.qs-dash-head h2 { font-size: .98rem; font-weight: 600; margin: 0; line-height: 1.3; }
.qs-dash-head h2 a { color: inherit; text-decoration: none; }
.qs-dash-head h2 a:hover { color: var(--fb-navy); }
.qs-dash-level { border-top: 1px solid var(--fb-border); padding: .75rem 1.25rem .85rem; }
.qs-dash-level h3 { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fb-muted); margin: 0 0 .45rem; }
.qs-dash-level ul { list-style: none; margin: 0; padding: 0; }
.qs-dash-level li { display: flex; align-items: center; gap: .25rem; }
.qs-dash-entity { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; margin: 0 -.5rem; border-radius: .45rem; color: var(--fb-ink); text-decoration: none; font-size: .85rem; }
.qs-dash-entity:hover { background: #f4f6fb; color: var(--fb-navy); }
.qs-dash-entity .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-dash-entity .count { font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; background: #eef1f7; color: var(--fb-muted); }
.fb-tile.xs { width: 26px; height: 26px; font-size: .8rem; border-radius: .45rem; }
.role-grid .fb-tile { display: inline-grid; vertical-align: middle; }
.fb-entity-head .record-count { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--fb-navy); }

/* ---------------------------------------------------------------- published content: hero card (header band, badges, file tiles) */
.qs-hero { overflow: hidden; }
.qs-hero-band { display: flex; align-items: flex-start; gap: 1rem; padding: 1.5rem 1.75rem 1.35rem; color: #fff;
  background: linear-gradient(120deg, color-mix(in srgb, var(--tint) 78%, #000) 0%, color-mix(in srgb, var(--tint) 88%, #3d6bff) 100%); }
.qs-hero-kicker { font-size: .8rem; font-weight: 500; letter-spacing: .03em; color: rgba(255, 255, 255, .72); }
.qs-hero-band h3 { margin: .15rem 0 .7rem; font-size: 1.5rem; font-weight: 600; line-height: 1.25; color: #fff; overflow-wrap: anywhere; }
.qs-hero-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.qs-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 500; padding: .2rem .7rem; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.qs-badge a { color: inherit; }
.qs-badge.published { background: #1f9d6b; box-shadow: none; }
.qs-hero-band .btn-icon { --bs-btn-color: rgba(255, 255, 255, .8); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255, 255, 255, .16); }
.qs-hero-section { padding: 1.25rem 1.75rem 0; }
.qs-hero-section:last-child { padding-bottom: 1.5rem; }
.qs-hero-section h4 { font-size: .72rem; font-weight: 600; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .6rem; }
.qs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.qs-tile { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1rem .9rem; border: 1px solid var(--fb-border); border-radius: .75rem;
  color: var(--fb-ink); text-decoration: none; background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s; }
.qs-tile:hover { border-color: color-mix(in srgb, var(--tint) 35%, #fff); box-shadow: 0 .6rem 1.4rem rgba(18, 38, 63, .08); transform: translateY(-2px); color: var(--fb-ink); }
.qs-tile-icon { width: 40px; height: 40px; border-radius: .6rem; display: grid; place-items: center; font-size: 1.3rem; margin-bottom: .35rem;
  color: var(--tint); background: color-mix(in srgb, var(--tint) 11%, #fff); }
.qs-tile-caption { font-size: .86rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; padding-right: 1.25rem; }
.qs-tile-meta { font-size: .74rem; color: var(--fb-muted); overflow-wrap: anywhere; }
.qs-tile-dl { position: absolute; top: .9rem; right: .9rem; color: var(--fb-muted); }
.qs-tile:hover .qs-tile-dl { color: var(--tint); }
@media (max-width: 575.98px) { .qs-hero-band { padding: 1.25rem 1rem; } .qs-hero-section { padding: 1rem 1rem 0; } .qs-hero-section:last-child { padding-bottom: 1.25rem; } }

/* published content: the record's fields as a grid above its texts and files */
.qs-record { overflow: hidden; border-top: 3px solid var(--tint); }
.qs-record-top { display: flex; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.75rem; border-bottom: 1px solid var(--fb-border); }
.qs-record-fields { flex: 1 1 auto; min-width: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem 1.5rem; }
.qs-record-fields dt { font-size: .7rem; font-weight: 600; color: var(--fb-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem; }
.qs-record-fields dd { margin: 0; font-size: .92rem; font-weight: 500; color: var(--fb-ink); overflow-wrap: anywhere; }
.qs-status { display: inline-flex; font-size: .76rem; font-weight: 600; padding: .15rem .65rem; border-radius: 999px; background: #eef1f7; color: var(--fb-muted); }
.qs-status.published { background: #e3f5ec; color: #1f8a5c; }
@media (max-width: 575.98px) { .qs-record-top { padding: 1rem; } }

/* files: Open + Download buttons (tiles, file lists, forms) and the Word preview page */
.qs-tile { padding: 0; }
.qs-tile-link { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1rem .9rem; color: inherit; text-decoration: none; height: 100%; }
.qs-tile-link:hover { color: var(--fb-ink); }
.qs-tile-link .qs-tile-caption { padding-right: 3.5rem; }
.qs-tile .file-buttons { position: absolute; top: .55rem; right: .55rem; }
.file-buttons { display: inline-flex; gap: .1rem; flex: 0 0 auto; }
.file-buttons .btn-icon { width: 1.9rem; height: 1.9rem; }
.file-buttons .btn-icon:hover { --bs-btn-hover-color: var(--tint, var(--fb-navy)); }
li.qs-file { display: flex; align-items: center; gap: .5rem; padding: 0 .6rem 0 0; }
li.qs-file:hover { background: #f5f7fc; }
.qs-file-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .85rem; padding: .7rem .9rem; color: inherit; text-decoration: none; }
.attach-open { font-size: .76rem; margin-left: .5rem; text-decoration: none; white-space: nowrap; }
.docx-view { background: #e9ecf3; border-radius: var(--fb-radius); padding: 1rem; overflow: auto; min-height: 50vh; }
.docx-view .docx-wrapper { background: transparent !important; padding: 0 !important; }
.docx-view .docx-wrapper > section.docx { box-shadow: 0 .5rem 1.5rem rgba(18, 38, 63, .12); margin: 0 auto 1rem !important; }
.docx-status { padding: 2rem; text-align: center; color: var(--fb-muted); }

/* Quality System Setup: groups of procedures */
.qs-group { border: 1px solid #c9d3ec; border-radius: var(--fb-radius); background: #f3f6fd; }
.qs-group-head { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; }
.qs-group-icon { color: var(--fb-navy); font-size: 1.05rem; }
.qs-group-name { max-width: 340px; font-weight: 600; }
.qs-group-head .mb-count { margin-left: auto; font-size: .76rem; color: var(--fb-muted); white-space: nowrap; }
.qs-group-procs { min-height: 64px; padding: 0 .8rem .8rem 2rem; display: flex; flex-direction: column; gap: .7rem; }
.qs-group-procs:empty::before { content: attr(data-empty); display: block; padding: 1rem; text-align: center; color: var(--fb-muted); font-size: .8rem; border: 2px dashed #c9d3ec; border-radius: .55rem; background: #fff; }
.qs-group.sortable-ghost { opacity: .45; }
.mb-count + .qs-remove-group { margin-left: .25rem; }
.qs-dash + .qs-dash, .qs-dash + .qs-dash-group { margin-top: 1.75rem; }
.qs-dash-group { display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; font-weight: 600; margin: 0 0 .85rem; color: var(--fb-ink); }
.qs-dash-group .bi { color: var(--fb-navy); }
.qs-dash-group .count-label { font-size: .8rem; font-weight: 400; color: var(--fb-muted); }
