.fb-public-header, .fb-public-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}
.fb-mark {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.fb-mark .fb-brand-img {
  height: 2.4rem;
  width: auto;
  max-width: 11rem;
  object-fit: contain;
  display: block;
}
.fb-auth-logo .fb-brand-img {
  height: 2.4rem;
  width: auto;
  max-width: 11rem;
  object-fit: contain;
  display: block;
}
.fb-public-nav { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .92rem; }
.fb-public-nav a { text-decoration: none; color: var(--ink-soft); }
.fb-public-nav a.is-on, .fb-public-nav a:hover { color: var(--ink); }

.fb-hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 2rem;
  padding: 3rem 0 4rem;
  align-items: center;
}
.fb-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 4.1rem);
  line-height: 1.05;
  font-weight: 550;
  margin: 0 0 1rem;
}
.fb-hero p { color: var(--ink-soft); font-size: 1.05rem; max-width: 38rem; }
.fb-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.4rem; }
.fb-panel-note {
  background: var(--ink);
  color: #efe7d8;
  border-radius: 28px;
  padding: 1.6rem;
  min-height: 16rem;
}
.fb-panel-note small { letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.fb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding-bottom: 3rem; }
.fb-grid-3 h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 .4rem; }

.fb-auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: #3e86ad url("../img/login-sky.svg") center/cover no-repeat;
}
.fb-auth-card {
  width: min(340px, 100%);
  background: #fff;
  border-radius: 6px;
  padding: 1.1rem 1.15rem 1.2rem;
  box-shadow: 0 12px 40px rgba(12, 32, 48, .28);
  text-align: center;
}
.fb-auth-card h1 {
  font-size: .92rem;
  font-weight: 700;
  margin: .55rem 0 .7rem;
  color: var(--lagoon-deep);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.fb-auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.fb-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  margin: .75rem 0 .15rem;
}
.fb-auth-tabs a {
  border-radius: 999px;
  padding: .38rem .4rem;
  font-size: .72rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  background: #d9efed;
  color: var(--lagoon-deep);
}
.fb-auth-tabs a:last-child { background: #e4e9f2; color: var(--ink); }
.fb-auth-tabs a.is-on { background: var(--lagoon); color: #fff; }
.fb-auth-tabs a:last-child.is-on { background: var(--ink); color: #fff; }
.fb-auth-card .fb-btn { text-transform: uppercase; border-radius: 4px; padding: .45rem .7rem; font-size: .78rem; }
.fb-auth-card .fb-field { text-align: left; margin-bottom: .55rem; }
.fb-auth-card .fb-field span { font-size: .72rem; }
.fb-auth-card .fb-field input {
  border-radius: 3px;
  padding: .4rem .5rem;
  font-size: 12px;
}
.fb-auth-rule {
  border: 0;
  border-top: 1px solid #dce3ea;
  margin: .7rem 0 .55rem;
}
.fb-auth-lead {
  font-size: .78rem;
  font-weight: 700;
  margin: .55rem 0 .7rem;
  color: var(--lagoon-deep);
  line-height: 1.35;
}
.fb-auth-card.is-register {
  width: min(520px, 100%);
  padding: 1rem 1.1rem 1.15rem;
  text-align: center;
}
.fb-reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem .65rem;
  text-align: left;
}
.fb-reg-grid .fb-field { margin-bottom: .15rem; }
.fb-reg-span { grid-column: 1 / -1; }
.fb-reg-file { text-align: left; margin: .45rem 0 .35rem; }
.fb-reg-file input[type="file"] {
  font-size: 11px;
  padding: .28rem .35rem;
}

/* Register page only: one desktop viewport, no page/card scroll */
html:has(body.fb-auth-body.is-register-page) {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body.fb-auth-body.is-register-page {
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
body.fb-auth-body.is-register-page .fb-auth-card.is-register {
  box-sizing: border-box;
  width: min(520px, 100%);
  max-width: 540px;
  max-height: calc(100vh - 20px);
  margin: 0;
  padding: 12px 14px;
  overflow: hidden;
  line-height: 1.25;
}
body.fb-auth-body.is-register-page .fb-auth-logo {
  height: auto;
  margin: 0;
}
body.fb-auth-body.is-register-page .fb-auth-logo .fb-brand-img {
  height: 2.6rem;
  max-width: 12rem;
}
body.fb-auth-body.is-register-page .fb-auth-rule {
  margin: 6px 0 8px;
}
body.fb-auth-body.is-register-page .fb-auth-card.is-register h1 {
  margin: 6px 0 8px;
  font-size: .82rem;
  letter-spacing: .03em;
  line-height: 1.2;
}
body.fb-auth-body.is-register-page .fb-reg-form {
  margin: 0;
}
body.fb-auth-body.is-register-page .fb-reg-grid {
  gap: 6px 8px;
}
body.fb-auth-body.is-register-page .fb-auth-card .fb-field,
body.fb-auth-body.is-register-page .fb-reg-grid .fb-field {
  gap: 2px;
  margin: 0;
}
body.fb-auth-body.is-register-page .fb-auth-card .fb-field span {
  font-size: .68rem;
  margin-bottom: 2px;
  line-height: 1.2;
}
body.fb-auth-body.is-register-page .fb-auth-card .fb-field input,
body.fb-auth-body.is-register-page .fb-auth-card .fb-field select {
  height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 3px;
}
body.fb-auth-body.is-register-page .fb-reg-file {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0 0;
}
body.fb-auth-body.is-register-page .fb-reg-file span {
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}
body.fb-auth-body.is-register-page .fb-reg-file input[type="file"] {
  height: 30px;
  padding: 2px 4px;
  font-size: 11px;
  flex: 1 1 auto;
  min-width: 0;
}
body.fb-auth-body.is-register-page .fb-auth-card .fb-btn {
  height: 34px;
  margin-top: 8px;
  padding: 0 .7rem;
  font-size: .75rem;
  line-height: 34px;
}
body.fb-auth-body.is-register-page .fb-auth-links.fb-auth-links-center {
  margin: 6px 0 0;
  line-height: 1.3;
  font-size: .72rem;
}
body.fb-auth-body.is-register-page .fb-auth-card .fb-alert {
  padding: 4px 8px;
  margin: 0 0 6px;
  font-size: .7rem;
  line-height: 1.25;
  border-radius: 4px;
}
body.fb-auth-body.is-register-page .fb-auth-foot {
  display: none;
}

@media (max-height: 800px) and (min-width: 641px) {
  body.fb-auth-body.is-register-page .fb-auth-card.is-register { padding: 10px 12px; }
  body.fb-auth-body.is-register-page .fb-auth-logo .fb-brand-img { height: 2.2rem; }
  body.fb-auth-body.is-register-page .fb-auth-rule { margin: 4px 0 6px; }
  body.fb-auth-body.is-register-page .fb-auth-card.is-register h1 { margin: 4px 0 6px; }
  body.fb-auth-body.is-register-page .fb-reg-grid { gap: 5px 8px; }
  body.fb-auth-body.is-register-page .fb-auth-card .fb-field input,
  body.fb-auth-body.is-register-page .fb-auth-card .fb-field select { height: 30px; }
  body.fb-auth-body.is-register-page .fb-reg-file { margin-top: 4px; }
  body.fb-auth-body.is-register-page .fb-auth-card .fb-btn { height: 32px; line-height: 32px; margin-top: 6px; }
}

@media (max-height: 700px) and (min-width: 641px) {
  body.fb-auth-body.is-register-page .fb-auth-card.is-register { padding: 8px 10px; }
  body.fb-auth-body.is-register-page .fb-auth-logo .fb-brand-img { height: 2rem; }
  body.fb-auth-body.is-register-page .fb-auth-card.is-register h1 { margin: 3px 0 5px; font-size: .76rem; }
  body.fb-auth-body.is-register-page .fb-reg-grid { gap: 4px 8px; }
  body.fb-auth-body.is-register-page .fb-auth-card .fb-field span { font-size: .64rem; }
  body.fb-auth-body.is-register-page .fb-auth-card .fb-field input,
  body.fb-auth-body.is-register-page .fb-auth-card .fb-field select { height: 28px; padding: 2px 6px; }
  body.fb-auth-body.is-register-page .fb-reg-file input[type="file"] { height: 26px; }
  body.fb-auth-body.is-register-page .fb-auth-card .fb-btn { height: 30px; line-height: 30px; margin-top: 5px; }
  body.fb-auth-body.is-register-page .fb-auth-links.fb-auth-links-center { margin-top: 5px; }
}
.fb-auth-links-center {
  display: block;
  text-align: center;
  margin-top: .7rem;
  line-height: 1.45;
}
.fb-auth-note {
  font-size: .82rem;
  color: var(--ink-soft);
  margin: .4rem 0 .8rem;
}
.fb-auth-resend { margin-top: .45rem; }
.fb-auth-resend .fb-btn { font-size: .72rem; padding: .38rem .7rem; border-radius: 4px; }
.fb-auth-card .fb-alert { text-align: left; font-size: .75rem; padding: .45rem .55rem; margin-bottom: .55rem; border-radius: 4px; }
.fb-auth-links {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin: .55rem 0 .2rem;
  font-size: .75rem;
}
.fb-auth-links a { color: var(--lagoon-deep); }
.fb-auth-links.fb-auth-links-center {
  display: block;
  text-align: center;
  justify-content: center;
}
.fb-auth-support { font-size: .75rem; color: var(--ink-soft); margin: .45rem 0 0; }
.fb-auth-foot {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: .9rem 0 0;
  font-size: .75rem;
}
.fb-auth-foot a { color: #f4fbff; text-decoration: none; }
.fb-auth-admin { background: #142033; }


@media (max-width: 900px) {
  .fb-hero, .fb-grid-3 { grid-template-columns: 1fr; }
  .fb-public-header { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  html:has(body.fb-auth-body.is-register-page) {
    height: auto;
    overflow: auto;
  }
  .fb-reg-grid { grid-template-columns: 1fr; }
  body.fb-auth-body.is-register-page {
    height: auto;
    min-height: 100vh;
    max-height: none;
    overflow: auto;
    padding: 12px 10px 16px;
  }
  body.fb-auth-body.is-register-page .fb-auth-card.is-register {
    width: min(340px, 100%);
    max-height: none;
    overflow: visible;
  }
  body.fb-auth-body.is-register-page .fb-reg-file {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Phase 5 inventory management */
.fb-inv-toolbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-bottom:1rem; flex-wrap:wrap; }
.fb-subnav { display:flex; gap:.35rem; flex-wrap:wrap; }
.fb-subnav a { padding:.4rem .8rem; border-radius:999px; text-decoration:none; color:var(--ink-soft); border:1px solid transparent; font-weight:600; font-size:.9rem; }
.fb-subnav a.is-on { background:#fff; border-color:var(--line); color:var(--ink); }
.fb-inv-form-wrap { max-width:920px; }
.fb-inv-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.85rem 1rem; }
.fb-inv-actions { display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin-top:1.1rem; }
.fb-inv-extra { margin-top:1.25rem; padding-top:1rem; border-top:1px solid var(--line); }
.fb-section-title { margin:0 0 .8rem; font-size:1rem; }
.fb-detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.9rem 1.25rem; }
.fb-detail-grid .fb-muted { display:block; font-size:.78rem; margin-bottom:.15rem; }
.fb-muted { color:var(--ink-soft); font-size:.9rem; }
.fb-stat-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.8rem; margin:1rem 0; }
.fb-stat { background:var(--paper-2); border:1px solid var(--line); border-radius:var(--radius); padding:1rem; }
.fb-stat span { display:block; color:var(--ink-soft); font-size:.8rem; margin-bottom:.35rem; }
.fb-stat strong { font-size:1.4rem; }
.fb-btn-sm { padding:.35rem .7rem; font-size:.82rem; }
.fb-row-actions { display:flex; gap:.35rem; }
.fb-err-list { margin:0; padding-left:1.1rem; }
@media (max-width:900px) {
  .fb-inv-grid, .fb-detail-grid, .fb-stat-row { grid-template-columns:1fr 1fr; }
}
@media (max-width:640px) {
  .fb-inv-grid, .fb-detail-grid, .fb-stat-row { grid-template-columns:1fr; }
}

/* Phase 6 access control */
.fb-perm-table th:nth-child(n+2), .fb-perm-table td:nth-child(n+2) { text-align:center; width:5.5rem; }
.fb-perm-group td { background:#f3eee6; font-weight:700; letter-spacing:.04em; text-transform:uppercase; font-size:.75rem; color:var(--ink-soft); }
.fb-radio { display:inline-flex; align-items:center; gap:.3rem; font-size:.85rem; cursor:pointer; }
.fb-radio input { margin:0; }
