@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}

:root {
  --fm-navy: #0D2B45;
  --fm-dark-green: #2E7D32;
  --fm-green: #8BC34A;
  --fm-orange: #FF8A00;
  --fm-blue: #3FA9F5;
  --fm-dark-gray: #2B2F33;
  --fm-medium-gray: #6B7280;
  --fm-light-gray: #E5E7EB;
  --fm-offwhite: #F3F6F9;
  --fm-white: #FFFFFF;
  --fm-line: rgba(13, 43, 69, .08);
  --fm-shadow: 0 14px 40px rgba(13, 43, 69, .08);
  --fm-shadow-sm: 0 6px 18px rgba(13, 43, 69, .06);
  --fm-radius: 16px;
  --fm-radius-sm: 10px;

  --fm-primary: var(--fm-navy);
  --fm-accent: var(--fm-orange);
  --fm-success: var(--fm-dark-green);
  --fm-ink: var(--fm-dark-gray);
  --fm-muted: var(--fm-medium-gray);
  --fm-paper: var(--fm-offwhite);
  --fm-card: var(--fm-white);
  --fm-font-display: "Poppins", "Segoe UI", sans-serif;
  --fm-font-body: "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body.fm-body, body.fm-field-body {
  margin: 0;
  font-family: var(--fm-font-body);
  color: var(--fm-ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(139,195,74,.16), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(63,169,245,.1), transparent 50%),
    linear-gradient(180deg, #eef3f7 0%, var(--fm-paper) 40%, #eef2f6 100%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  width: 100%;
}

body.fm-guest {
  position: relative;
  background:
    linear-gradient(165deg, rgba(13,43,69,.96) 0%, rgba(13,43,69,.9) 38%, rgba(30,90,55,.72) 78%, rgba(46,125,50,.62) 100%),
    radial-gradient(900px 480px at 88% 12%, rgba(63,169,245,.3), transparent 55%),
    var(--fm-navy);
  color: var(--fm-ink);
  isolation: isolate;
}

.fm-waves {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(120px, 28vh, 220px);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.fm-wave {
  position: absolute;
  left: -5%;
  bottom: 0;
  width: 110%;
  height: 100%;
  min-width: 1200px;
}
.fm-wave-1 {
  color: rgba(139, 195, 74, .22);
  animation: fm-wave-drift 14s ease-in-out infinite;
}
.fm-wave-2 {
  color: rgba(63, 169, 245, .18);
  animation: fm-wave-drift 10s ease-in-out infinite reverse;
  bottom: -8px;
}
.fm-wave-3 {
  color: rgba(13, 43, 69, .55);
  animation: fm-wave-drift 18s ease-in-out infinite;
  bottom: -16px;
  height: 85%;
}
@keyframes fm-wave-drift {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(-3%) translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .fm-wave-1, .fm-wave-2, .fm-wave-3 { animation: none; }
}

body.fm-guest .fm-main,
body.fm-guest .fm-footer {
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4, h5, .fm-brand, .fm-auth-title, .fm-page-title, .fm-panel-title {
  font-family: var(--fm-font-display);
  font-weight: 700;
  color: var(--fm-navy);
}

/* ——— Top bar ——— */
.fm-topbar, .fm-field-bar {
  display: flex;
  align-items: center;
  gap: .75rem 1rem;
  flex-wrap: wrap;
  padding: .7rem 1.15rem;
  background: linear-gradient(180deg, #143a5c 0%, var(--fm-navy) 100%);
  color: #fff;
  border-bottom: 2px solid var(--fm-green);
  box-shadow: 0 10px 28px rgba(13,43,69,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.fm-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: .04em;
  min-width: 0;
}
.fm-brand img {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.fm-brand-text { font-weight: 700; }
.fm-brand-text .mark { color: var(--fm-green); }
.fm-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  align-items: center;
}
.fm-nav a {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: .86rem;
  font-weight: 500;
  white-space: nowrap;
  padding: .42rem .7rem;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.fm-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.fm-nav a.is-active {
  color: var(--fm-navy);
  background: var(--fm-green);
  font-weight: 600;
}
.fm-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.fm-user-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  color: #fff;
  padding: .2rem .55rem .2rem .2rem;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.fm-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--fm-green), var(--fm-dark-green));
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.fm-user-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .86rem;
  font-weight: 500;
}
.fm-btn-logout {
  border: 1px solid rgba(255,255,255,.35) !important;
  color: #fff !important;
  border-radius: 999px !important;
  padding: .28rem .75rem !important;
  background: transparent !important;
}
.fm-btn-logout:hover {
  background: rgba(255,255,255,.12) !important;
  color: #fff !important;
}
.fm-nav-toggle {
  display: none;
  margin-left: auto;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.fm-nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 1px;
}

/* ——— App shell ——— */
.fm-main {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.fm-main-app {
  padding: 1rem 1.15rem 2rem;
}
.fm-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}
.fm-main .table-responsive,
.fm-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ——— Buttons ——— */
.fm-btn-primary {
  background: linear-gradient(180deg, #35953a 0%, var(--fm-dark-green) 100%);
  border: 0;
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(46,125,50,.28);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.fm-btn-primary:hover {
  background: linear-gradient(180deg, #3aa740 0%, #256628 100%);
  color: #fff;
  filter: brightness(1.03);
  box-shadow: 0 10px 22px rgba(46,125,50,.34);
}
.fm-btn-primary:active { transform: translateY(1px); }
.fm-btn-primary.is-loading,
.fm-btn-primary:disabled.is-loading {
  opacity: .85;
  cursor: wait;
  pointer-events: none;
}
.fm-invite-btn-loading {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.fm-invite-btn-loading[hidden] { display: none !important; }
.fm-btn-ghost {
  background: #fff;
  border: 1px solid var(--fm-line);
  color: var(--fm-navy);
  font-weight: 600;
  border-radius: 10px;
  box-shadow: var(--fm-shadow-sm);
}
.fm-btn-ghost:hover {
  background: #f7fafc;
  border-color: rgba(13,43,69,.16);
  color: var(--fm-navy);
}
.fm-btn-soft {
  background: rgba(139,195,74,.16);
  border: 0;
  color: var(--fm-navy);
  font-weight: 600;
  border-radius: 8px;
}
.fm-btn-soft:hover {
  background: rgba(139,195,74,.28);
  color: var(--fm-navy);
}
.btn-outline-secondary,
.btn-outline-primary {
  border-radius: 10px;
  font-weight: 600;
}
.btn-outline-primary {
  border-color: rgba(46,125,50,.35);
  color: var(--fm-dark-green);
}
.btn-outline-primary:hover {
  background: var(--fm-dark-green);
  border-color: var(--fm-dark-green);
  color: #fff;
}

/* ——— Auth ——— */
.fm-main-auth {
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  width: 100%;
}
.fm-auth-card {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.6rem 1.75rem;
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.55);
  box-shadow:
    0 24px 60px rgba(8,24,40,.28),
    0 1px 0 rgba(255,255,255,.65) inset;
  backdrop-filter: blur(10px);
  animation: fm-auth-in .45s ease both;
}
@keyframes fm-auth-in {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.fm-auth-logo {
  display: block;
  width: min(220px, 72%);
  height: auto;
  margin: 0 auto 1.35rem;
}
.fm-auth-title {
  margin: 0 0 .35rem;
  text-align: center;
  font-size: 1.25rem;
  color: var(--fm-navy);
  letter-spacing: -.01em;
}
.fm-auth-lead {
  margin: 0 0 1.15rem;
  text-align: center;
  color: var(--fm-muted);
  font-size: .9rem;
  line-height: 1.45;
}
.fm-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.fm-field .form-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--fm-navy);
  margin-bottom: .35rem;
}
.fm-auth-link {
  font-size: .82rem;
  font-weight: 500;
  color: var(--fm-dark-green);
  text-decoration: none;
  white-space: nowrap;
}
.fm-auth-link:hover { color: var(--fm-orange); text-decoration: underline; }
.fm-forgot-row {
  margin-top: .55rem;
  text-align: right;
}
.fm-auth-card .form-control {
  min-height: 48px;
  font-size: 1rem;
  border-radius: 10px;
  border-color: #d7dde5;
  background: #fbfcfe;
  padding: .65rem .9rem;
}
.fm-password {
  position: relative;
  display: block;
}
.fm-password .form-control { padding-right: 3rem; }
.fm-password-toggle {
  position: absolute;
  top: 50%;
  right: .45rem;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--fm-muted);
  cursor: pointer;
  padding: 0;
}
.fm-password-toggle:hover,
.fm-password-toggle:focus-visible {
  color: var(--fm-navy);
  background: rgba(13,43,69,.06);
  outline: none;
}
.fm-password-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.fm-password-toggle[aria-pressed="true"] { color: var(--fm-dark-green); }
.fm-auth-card .form-control:focus { background: #fff; }
.fm-auth-submit {
  min-height: 48px;
  width: 100%;
  border-radius: 10px;
  margin-top: .25rem;
}
.fm-auth-footer-link {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: .88rem;
}
.fm-auth-footer-link a {
  color: var(--fm-dark-green);
  font-weight: 500;
  text-decoration: none;
}
.fm-auth-footer-link a:hover { color: var(--fm-orange); text-decoration: underline; }
.fm-auth-card .form-text {
  color: var(--fm-muted);
  font-size: .8rem;
  margin-top: .4rem;
}

/* ——— Page / panels ——— */
.fm-page { animation: fm-page-in .35s ease both; }
@keyframes fm-page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fm-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-bottom: 1rem;
}
.fm-eyebrow {
  margin: 0 0 .2rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fm-dark-green);
}
.fm-page-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.fm-page-sub {
  margin: .25rem 0 0;
  color: var(--fm-muted);
  font-size: .9rem;
  max-width: 36rem;
}
.fm-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}
.fm-panel {
  background: var(--fm-card);
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  box-shadow: var(--fm-shadow);
  overflow: hidden;
}
.fm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--fm-line);
  background: linear-gradient(180deg, #fcfdff 0%, #f7fafc 100%);
}
.fm-panel-title {
  margin: 0;
  font-size: 1rem;
}

/* ——— Office forms ——— */
/* Shared column for form page header + panel (Back stays with the form). */
.fm-form-page {
  width: 100%;
  max-width: 680px;
}
.fm-form-page .fm-page-header {
  margin-bottom: 1.15rem;
}
.fm-form-panel {
  width: 100%;
  max-width: 680px;
}
.fm-form-page .fm-form-panel {
  max-width: none;
}
.fm-form-panel--full {
  max-width: 100%;
}
.fm-form-panel .fm-panel-head {
  padding: .9rem 1.15rem;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fb 100%);
  border-bottom: 1px solid var(--fm-line);
  box-shadow: inset 3px 0 0 var(--fm-green);
}
.fm-form-panel .fm-panel-title {
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.fm-form {
  padding: 1.1rem 1.15rem 1.15rem;
}
.fm-form--flush {
  padding: 0;
}
.fm-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .75rem .85rem;
  align-items: start;
}
.fm-form-grid > * {
  margin: 0;
  min-width: 0;
}
.fm-form-grid .mb-1,
.fm-form-grid .mb-2,
.fm-form-grid .mb-3,
.fm-form-grid .mb-4,
.fm-form .mb-1,
.fm-form .mb-2,
.fm-form .mb-3,
.fm-form .mb-4 {
  margin-bottom: 0 !important;
}
.fm-form-span-2 { grid-column: 1 / -1; }
.fm-form .form-label,
.fm-shell .fm-form .form-label {
  display: block;
  margin-bottom: .35rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--fm-navy);
  letter-spacing: .01em;
  line-height: 1.3;
}
.fm-form .form-control,
.fm-form .form-select,
.fm-shell .fm-form .form-control,
.fm-shell .fm-form .form-select {
  min-height: 40px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid #d0d9e3;
  background: #fbfcfe;
  padding: .5rem .75rem;
  font-size: .9375rem;
  line-height: 1.35;
  color: var(--fm-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.fm-form textarea.form-control,
.fm-shell .fm-form textarea.form-control {
  min-height: 72px;
  padding-top: .55rem;
  padding-bottom: .55rem;
  resize: vertical;
}
.fm-form .form-control:hover,
.fm-form .form-select:hover,
.fm-shell .fm-form .form-control:hover,
.fm-shell .fm-form .form-select:hover {
  border-color: #b8c4d1;
  background: #fff;
}
.fm-form .form-control:focus,
.fm-form .form-select:focus,
.fm-shell .fm-form .form-control:focus,
.fm-shell .fm-form .form-select:focus {
  background: #fff;
  border-color: var(--fm-green);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(139, 195, 74, .28);
}
.fm-form .form-text {
  margin-top: .4rem;
  font-size: .8rem;
  color: var(--fm-muted);
}
.fm-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  margin-top: 1rem;
  margin-bottom: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--fm-line);
}
.fm-form-actions--bare {
  margin-top: .35rem;
  padding-top: 0;
  border-top: 0;
}
.fm-form-actions .btn {
  min-height: 40px;
  padding: .5rem 1.05rem;
  border-radius: 10px;
}
.fm-form-danger {
  margin: 0;
  padding: .7rem 1.15rem 1rem;
  border-top: 1px solid var(--fm-line);
  background: linear-gradient(180deg, #fcfdfe 0%, #fafbfc 100%);
}
.fm-btn-danger-text {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .25rem 0;
  border: 0;
  background: transparent;
  color: #a33b32;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}
.fm-btn-danger-text:hover,
.fm-btn-danger-text:focus-visible {
  color: #7f2c25;
  text-decoration: underline;
  outline: 0;
}
.fm-text-link {
  color: var(--fm-dark-green);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
}
.fm-text-link:hover { color: var(--fm-orange); text-decoration: underline; }
.fm-muted { color: var(--fm-muted); }
.fm-empty {
  text-align: center;
  color: var(--fm-muted);
  padding: 1.75rem 1rem !important;
}

/* ——— Stats ——— */
.fm-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.fm-stat {
  display: flex;
  align-items: center;
  gap: .9rem;
  background: var(--fm-card);
  border-radius: var(--fm-radius);
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--fm-line);
  box-shadow: var(--fm-shadow);
  position: relative;
  overflow: hidden;
}
.fm-stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,195,74,.18), transparent 70%);
  pointer-events: none;
}
.fm-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  background:
    linear-gradient(145deg, rgba(139,195,74,.35), rgba(46,125,50,.15)),
    var(--fm-navy);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.fm-stat--sites .fm-stat-icon {
  background: linear-gradient(145deg, #3FA9F5, #0D2B45);
}
.fm-stat--equipment .fm-stat-icon {
  background: linear-gradient(145deg, #8BC34A, #2E7D32);
}
.fm-stat--photos .fm-stat-icon {
  background: linear-gradient(145deg, #FF8A00, #0D2B45);
}
.fm-stat-n {
  font-family: var(--fm-font-display);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--fm-navy);
  line-height: 1;
  letter-spacing: -.02em;
}
.fm-stat-l {
  color: var(--fm-muted);
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .25rem;
  letter-spacing: .02em;
}

.fm-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.fm-stats-panel {
  min-width: 0;
}

.fm-stats-chart-wrap {
  position: relative;
  height: 260px;
  max-width: 320px;
  margin: 0 auto;
  padding: .5rem 1rem 1rem;
}

.fm-stats-chart-wrap--bar {
  max-width: none;
  height: 280px;
}

.fm-stats-empty {
  padding: 1.25rem 1.1rem 1.5rem;
  margin: 0;
}

@media (max-width: 900px) {
  .fm-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ——— Tables ——— */
.fm-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}
.fm-table thead th {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fm-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--fm-line);
  padding: .85rem 1.15rem;
  white-space: nowrap;
}
.fm-table tbody td {
  padding: .95rem 1.15rem;
  border-bottom: 1px solid var(--fm-line);
  vertical-align: middle;
  font-size: .94rem;
}
.fm-table tbody tr:last-child td { border-bottom: 0; }
.fm-table tbody tr {
  transition: background .12s ease;
}
.fm-table tbody tr:hover { background: rgba(139,195,74,.06); }
.fm-row-title {
  color: var(--fm-navy);
  font-weight: 600;
  text-decoration: none;
}
a.fm-row-title:hover { color: var(--fm-dark-green); text-decoration: underline; }
.fm-col-action {
  text-align: right;
  white-space: nowrap;
}
.fm-row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: flex-end;
  align-items: center;
}
.fm-row-actions--nowrap {
  flex-wrap: nowrap;
  white-space: nowrap;
}
.fm-row-actions form {
  display: inline-flex;
  margin: 0;
  vertical-align: middle;
}
.fm-export-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--fm-line);
  background: #fcfdff;
  padding: .85rem 1.1rem;
}
.fm-btn-danger {
  background: #fff;
  border: 1px solid rgba(197, 48, 48, .35);
  color: #b42318;
  font-weight: 600;
  border-radius: 8px;
}
.fm-btn-danger:hover {
  background: rgba(197, 48, 48, .08);
  border-color: #b42318;
  color: #912018;
}
.fm-badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: capitalize;
  background: rgba(13,43,69,.08);
  color: var(--fm-navy);
}
.fm-badge--ok {
  background: rgba(46,125,50,.12);
  color: #1b5e20;
}
.fm-badge--warn {
  background: rgba(255,138,0,.16);
  color: #9a5b00;
}
.fm-badge--danger {
  background: rgba(163,58,58,.12);
  color: #8a2a2a;
}
.fm-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}
.fm-color-field {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.fm-color-swatch {
  width: 2.75rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid rgba(13, 43, 69, .18);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  flex: 0 0 auto;
}
.fm-color-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.fm-color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}
.fm-color-swatch::-moz-color-swatch {
  border: none;
  border-radius: 5px;
}
.fm-color-preview {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(13, 43, 69, .16);
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.fm-log-tail {
  margin: 0;
  padding: 1rem 1.1rem;
  max-height: 320px;
  overflow: auto;
  background: #0f1720;
  color: #d7e0ea;
  font-size: .75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.fm-btn-danger-text {
  background: transparent;
  border: 0;
  color: #a33a3a;
  font-weight: 600;
}
.fm-btn-danger-text:hover,
.fm-btn-danger-text:focus-visible {
  color: #7f2c25;
  background: rgba(163,58,58,.08);
}

/* Bootstrap tables/forms inside shell also get polish */
.fm-shell > .d-flex.justify-content-between,
.fm-shell > .d-flex.flex-wrap {
  margin-bottom: 1.1rem !important;
}
.fm-shell > h1.h3,
.fm-shell .h3 {
  letter-spacing: -.02em;
}
.fm-shell .table {
  background: #fff;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  overflow: hidden;
  box-shadow: var(--fm-shadow);
  border-collapse: separate;
  border-spacing: 0;
}
.fm-shell .table > :not(caption) > * > * {
  border-bottom-color: var(--fm-line);
  padding: .85rem 1rem;
}
.fm-shell .table thead th {
  background: #f8fafc;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--fm-muted);
  font-weight: 700;
  border-bottom-width: 1px;
}
.fm-shell .table tbody tr:hover { background: rgba(139,195,74,.05); }
.fm-shell .form-control,
.fm-shell .form-select {
  min-height: 44px;
  border-radius: 10px;
  border-color: #d7dde5;
  background: #fbfcfe;
}
.fm-shell .form-label {
  font-weight: 600;
  color: var(--fm-navy);
  font-size: .85rem;
}
.fm-shell .nav-tabs {
  border-bottom: 1px solid var(--fm-line);
  gap: .25rem;
}
.fm-shell .nav-tabs .nav-link {
  border: 0;
  border-radius: 999px;
  color: var(--fm-muted);
  font-weight: 600;
  padding: .45rem .9rem;
}
.fm-shell .nav-tabs .nav-link:hover {
  color: var(--fm-navy);
  background: rgba(13,43,69,.05);
}
.fm-shell .nav-tabs .nav-link.active {
  color: var(--fm-navy);
  background: rgba(139,195,74,.22);
}
.fm-shell .alert {
  border-radius: 12px;
  border: 0;
  box-shadow: var(--fm-shadow-sm);
}
.fm-shell .fm-settings-form,
.fm-shell .fm-site-card {
  background: #fff;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  box-shadow: var(--fm-shadow);
  padding: 1.15rem 1.25rem;
}
.fm-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.15rem;
}
.fm-settings-tab {
  display: inline-flex;
  align-items: center;
  padding: .5rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--fm-line);
  background: #fff;
  color: var(--fm-muted, #5b6b7c);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--fm-shadow-sm);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.fm-settings-tab:hover {
  color: var(--fm-navy);
  border-color: rgba(139, 195, 74, .55);
  background: rgba(139, 195, 74, .08);
}
.fm-settings-tab.is-active {
  color: var(--fm-navy);
  background: rgba(139, 195, 74, .22);
  border-color: rgba(139, 195, 74, .65);
}
.fm-settings-panel {
  max-width: 960px;
}
.fm-settings-form-body {
  padding: 1.25rem 1.25rem 1.35rem;
}
.fm-settings-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.fm-settings-section {
  border: 1px solid var(--fm-line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 1.1rem 1.15rem 1.2rem;
}
.fm-settings-section-title {
  margin: 0 0 .85rem;
  font-size: .92rem;
  font-weight: 700;
  color: var(--fm-navy);
  letter-spacing: -.01em;
}
.fm-settings-hint {
  margin: -.35rem 0 .85rem;
  font-size: .8rem;
  color: var(--fm-muted, #64748b);
}
.fm-settings-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.fm-settings-fields--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem 1.25rem;
}
.fm-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  min-width: 0;
}
.fm-field--full {
  grid-column: 1 / -1;
}
.fm-field--switch {
  justify-content: center;
  min-height: 2.5rem;
}
.fm-field .form-label {
  margin-bottom: 0;
}
.fm-field .form-control,
.fm-field .form-select {
  min-height: 42px;
}
.fm-field .form-check {
  margin: 0;
  min-height: auto;
  padding-left: 2.6em;
}
.fm-field .form-check-input {
  width: 2.1em;
  height: 1.15em;
  margin-left: -2.6em;
}
.fm-field .form-check-label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--fm-navy);
  line-height: 1.35;
}
.fm-settings-form-body .fm-form-actions {
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--fm-line);
}
@media (max-width: 760px) {
  .fm-settings-fields--2 {
    grid-template-columns: 1fr;
  }
}

.fm-map {
  height: 360px;
  border-radius: var(--fm-radius);
  overflow: hidden;
  border: 1px solid var(--fm-line);
  box-shadow: var(--fm-shadow-sm);
}
.fm-map--inset {
  height: 420px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.fm-map--picker {
  height: 320px;
  margin-top: .35rem;
}
.fm-geo-search {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  align-items: start;
}
.fm-geo-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1200;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(13, 43, 69, .14);
  border-radius: 10px;
  box-shadow: var(--fm-shadow);
}
.fm-geo-result {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: .65rem .85rem;
  font: inherit;
  color: var(--fm-ink);
  border-bottom: 1px solid rgba(13, 43, 69, .06);
  cursor: pointer;
}
.fm-geo-result:last-child { border-bottom: 0; }
.fm-geo-result:hover,
.fm-geo-result:focus-visible {
  background: rgba(139, 195, 74, .12);
  outline: none;
}
.fm-geo-empty {
  padding: .75rem .85rem;
  color: var(--fm-muted);
  font-size: .9rem;
}
@media (max-width: 640px) {
  .fm-geo-search {
    grid-template-columns: 1fr;
  }
}
.fm-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .5rem;
}
.fm-gallery-item {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.fm-gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--fm-shadow-sm);
}
.fm-gallery-item:focus-visible {
  outline: 2px solid var(--fm-green);
  outline-offset: 2px;
}
.fm-gallery-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* ——— Site detail ——— */
.fm-site-overview { margin-bottom: 1.15rem; }
.fm-panel-meta {
  font-size: .78rem;
  font-weight: 600;
  color: var(--fm-muted);
  letter-spacing: .02em;
}
.fm-panel-body {
  padding: 1.15rem 1.25rem;
}
.fm-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem 1.35rem;
  margin: 0;
  padding: 1.15rem 1.25rem 1.25rem;
}
.fm-meta-grid > div { min-width: 0; }
.fm-meta-grid dt {
  margin: 0 0 .3rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fm-muted);
}
.fm-meta-grid dd {
  margin: 0;
  color: var(--fm-navy);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.35;
  word-break: break-word;
}
.fm-meta-mono {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: .88rem;
  color: var(--fm-muted);
}
.fm-meta-span { grid-column: 1 / -1; }
.fm-site-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .9fr);
  gap: 1.15rem;
  align-items: start;
}
.fm-site-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
}
.fm-site-aside {
  position: sticky;
  top: 1rem;
  min-width: 0;
}
.fm-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(13,43,69,.9);
  display: grid;
  place-items: center;
  z-index: 2000;
  color: #fff;
  padding: 1rem;
}
.fm-lightbox img { max-width: min(90vw, 900px); max-height: 70vh; }

.fm-field-main {
  padding-bottom: max(4rem, env(safe-area-inset-bottom));
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.fm-field-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.fm-pad { padding: 1rem; }
.fm-photo-strip {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}
.fm-photo-card {
  min-width: 160px;
  max-width: 180px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--fm-line);
  padding: .5rem;
  box-shadow: var(--fm-shadow-sm);
}
.fm-photo-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
}
.fm-gps { font-size: .75rem; margin-top: .35rem; }
.fm-gps.ok { color: var(--fm-dark-green); }
.fm-gps.warn { color: var(--fm-orange); }
.fm-gps.bad { color: #c53030; }
.fm-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.fm-chip {
  background: rgba(139,195,74,.2);
  color: var(--fm-navy);
  border-radius: 999px;
  padding: .15rem .55rem;
  font-size: .75rem;
  font-weight: 500;
}
.fm-soft-lock { outline: 2px solid var(--fm-orange); }
.fm-toast {
  position: fixed;
  top: max(.85rem, env(safe-area-inset-top, 0px));
  right: max(.85rem, env(safe-area-inset-right, 0px));
  left: auto;
  bottom: auto;
  transform: none;
  background: var(--fm-navy);
  color: #fff;
  padding: .65rem 1rem;
  border-radius: 10px;
  z-index: 5000;
  max-width: min(90vw, 22rem);
  box-shadow: var(--fm-shadow);
  pointer-events: none;
  text-align: left;
  line-height: 1.35;
}
.fm-site-card {
  background: #fff;
  border-radius: var(--fm-radius);
  padding: 1rem 1.1rem;
  margin-bottom: .75rem;
  border: 1px solid var(--fm-line);
  box-shadow: var(--fm-shadow-sm);
}
.fm-eq-card {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: .85rem 1rem;
  margin-bottom: .5rem;
  border: 1px solid var(--fm-line);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--fm-shadow-sm);
  transition: border-color .15s ease, transform .15s ease;
}
.fm-eq-card:hover {
  border-color: var(--fm-green);
  transform: translateY(-1px);
}

.fm-footer {
  margin-top: auto;
  background: linear-gradient(180deg, #0f3352 0%, var(--fm-navy) 100%);
  color: #fff;
  padding: .75rem 1.15rem;
  border-top: 2px solid var(--fm-green);
}
body.fm-guest .fm-footer {
  background: rgba(8,24,40,.35);
  border-top: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
}
.fm-footer-inner {
  display: flex;
  flex-wrap: nowrap;
  gap: .75rem 1rem;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.fm-footer img {
  height: 26px;
  width: auto;
  display: block;
  flex-shrink: 0;
  opacity: .95;
}
.fm-footer-version {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: .28rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(90deg, var(--fm-dark-green), var(--fm-green));
  box-shadow: 0 4px 12px rgba(46,125,50,.25);
}

.badge.text-bg-success { background: var(--fm-dark-green) !important; }
.badge.text-bg-secondary {
  background: rgba(13,43,69,.1) !important;
  color: var(--fm-navy) !important;
}
.badge.text-bg-warning { background: var(--fm-orange) !important; color: #fff !important; }

.table > :not(caption) > * > * { border-bottom-color: var(--fm-light-gray); }
.form-control:focus, .form-select:focus {
  border-color: var(--fm-green);
  box-shadow: 0 0 0 .2rem rgba(139,195,74,.25);
}

.modal-dialog-bottom {
  margin: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 100%;
}

/* ——— Confirm modal ——— */
.fm-confirm-modal .modal-content {
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  box-shadow: var(--fm-shadow);
  overflow: hidden;
}
.fm-confirm-modal .modal-header {
  border-bottom: 1px solid var(--fm-line);
  padding: 1rem 1.2rem;
  background: #f8fafc;
}
.fm-confirm-modal .modal-title {
  font-family: var(--fm-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fm-navy);
  letter-spacing: -.01em;
}
.fm-confirm-modal .modal-body {
  padding: 1.15rem 1.2rem;
}
.fm-confirm-modal .fm-confirm-message {
  color: var(--fm-ink);
  font-size: .95rem;
  line-height: 1.5;
}
.fm-confirm-modal .modal-footer {
  border-top: 1px solid var(--fm-line);
  padding: .9rem 1.2rem;
  gap: .5rem;
  background: #fff;
}
.fm-confirm-modal .modal-footer .btn {
  min-height: 40px;
  padding-inline: 1rem;
}

@media (max-width: 900px) {
  .fm-stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .fm-topbar {
    flex-wrap: wrap;
    row-gap: .5rem;
  }
  .fm-nav-toggle { display: inline-flex; }
  .fm-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
    padding: .35rem 0 .5rem;
    border-top: 1px solid rgba(255,255,255,.12);
  }
  .fm-nav.is-open { display: flex; }
  .fm-nav a {
    padding: .7rem .7rem;
    border-radius: 10px;
  }
  .fm-user {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    order: 3;
  }
  .fm-user-name { max-width: 45vw; }
  .fm-map { height: 240px; }
  .fm-map--inset { height: 280px; }
  .fm-site-layout { grid-template-columns: 1fr; }
  .fm-site-aside { position: static; }
  .fm-main-auth { padding: 1.25rem .85rem; }
  .fm-main-app { padding: .75rem .85rem 1.5rem; }
  .fm-auth-card {
    padding: 1.5rem 1.15rem 1.35rem;
    border-radius: 16px;
  }
  .fm-page-header { align-items: stretch; }
  .fm-page-actions { width: 100%; }
  .fm-page-actions .btn { flex: 1 1 auto; }
  .fm-form-grid {
    grid-template-columns: 1fr;
    gap: .7rem;
  }
  .fm-form-span-2 { grid-column: auto; }
  .fm-form {
    padding: 1rem .95rem 1.05rem;
  }
  .fm-form-panel .fm-panel-head {
    padding: .8rem .95rem;
  }
  .fm-form-actions {
    margin-top: .9rem;
    padding-top: .9rem;
  }
  .fm-form-actions .btn { flex: 1 1 auto; }
  .fm-form-danger {
    padding: .65rem .95rem .9rem;
  }
  .fm-footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .fm-eq-card { flex-wrap: wrap; }
  .fm-field-bar .fm-brand-text { font-size: .9rem; }
  .fm-table thead th,
  .fm-table tbody td {
    padding: .8rem .85rem;
  }
}

@media (max-width: 420px) {
  .fm-brand-text { letter-spacing: .02em; }
  .fm-stat-n { font-size: 1.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fm-page, .fm-auth-card { animation: none; }
}
