/* ==========================================================================
   Leads FM design system — Union Jack palette
   ========================================================================== */
:root {
  --lfm-navy: #012169;
  --lfm-navy-700: #0b2d80;
  --lfm-navy-900: #01153f;
  --lfm-red: #C8102E;
  --lfm-red-600: #a80d26;
  --lfm-white: #ffffff;
  --lfm-bg: #f4f6fa;
  --lfm-line: #e3e7ef;
  --lfm-ink: #1a2233;
  --lfm-muted: #5f6b7a;
  --lfm-gold: #f2a900;
  --lfm-green: #178a4a;
  --lfm-radius: 12px;
  --lfm-shadow: 0 1px 2px rgba(1,33,105,.06), 0 8px 24px -12px rgba(1,33,105,.18);
  --bs-primary: var(--lfm-navy);
  --bs-primary-rgb: 1,33,105;
  --bs-danger: var(--lfm-red);
  --bs-danger-rgb: 200,16,46;
  --bs-body-color: var(--lfm-ink);
  --bs-body-bg: var(--lfm-bg);
  --bs-link-color: var(--lfm-navy);
  --bs-link-hover-color: var(--lfm-red);
  --bs-border-color: var(--lfm-line);
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html { scroll-behavior: smooth; }
body { font-family: var(--bs-font-sans-serif); color: var(--lfm-ink); background: var(--lfm-bg); -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,.h1,.h2,.h3,.h4,.h5 { font-weight: 700; letter-spacing: -.01em; color: var(--lfm-navy-900); }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.text-navy { color: var(--lfm-navy) !important; }
.text-red { color: var(--lfm-red) !important; }
.text-muted { color: var(--lfm-muted) !important; }
.bg-navy { background: var(--lfm-navy) !important; color: #fff; }
.bg-red { background: var(--lfm-red) !important; color: #fff; }
.bg-soft { background: var(--lfm-bg) !important; }
.bg-white { background: #fff !important; }
.border-line { border-color: var(--lfm-line) !important; }
.small-caps { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--lfm-muted); }

/* Flag stripe: navy · white · red */
.flag-stripe { height: 4px; background: linear-gradient(90deg, var(--lfm-navy) 0 40%, #fff 40% 60%, var(--lfm-red) 60% 100%); }
.flag-stripe-sm { display:inline-block; width: 40px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--lfm-navy) 0 40%, #cfd6e6 40% 60%, var(--lfm-red) 60% 100%); vertical-align: middle; }

/* Buttons */
.btn { border-radius: 8px; font-weight: 600; padding: .6rem 1.1rem; }
.btn-primary { background: var(--lfm-navy); border-color: var(--lfm-navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--lfm-navy-700); border-color: var(--lfm-navy-700); }
.btn-danger, .btn-red { background: var(--lfm-red); border-color: var(--lfm-red); color: #fff; }
.btn-danger:hover, .btn-red:hover { background: var(--lfm-red-600); border-color: var(--lfm-red-600); color: #fff; }
.btn-outline-primary { color: var(--lfm-navy); border-color: var(--lfm-navy); }
.btn-outline-primary:hover { background: var(--lfm-navy); border-color: var(--lfm-navy); }
.btn-outline-light:hover { color: var(--lfm-navy); }
.btn-lg { padding: .8rem 1.4rem; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }

/* Forms */
.form-control, .form-select { border-radius: 8px; border-color: var(--lfm-line); padding: .6rem .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--lfm-navy); box-shadow: 0 0 0 .2rem rgba(1,33,105,.12); }
.form-label { font-weight: 600; font-size: .875rem; color: var(--lfm-navy-900); }

/* Cards */
.card { border: 1px solid var(--lfm-line); border-radius: var(--lfm-radius); box-shadow: var(--lfm-shadow); }
.card-header { background: #fff; border-bottom: 1px solid var(--lfm-line); font-weight: 700; }

/* Badges / chips */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef1f8; color: var(--lfm-navy); border: 1px solid #dfe5f2; white-space: nowrap; }
.chip:hover { background: var(--lfm-navy); color: #fff; text-decoration: none; }
.chip-red { background: #fdecef; color: var(--lfm-red); border-color: #f7cfd6; }
.chip-red:hover { background: var(--lfm-red); color: #fff; }
.badge-claimed { background: #e6f5ec; color: var(--lfm-green); border: 1px solid #bfe6cd; font-weight: 600; font-size: .72rem; padding: .25rem .5rem; border-radius: 6px; }

/* Rating */
.stars { display: inline-flex; gap: 1px; color: var(--lfm-gold); font-size: .95rem; line-height: 1; }
.stars .bi-star { color: #d5d9e2; }
.rating-pill { display: inline-flex; align-items: center; gap: .35rem; background: var(--lfm-navy); color: #fff; font-weight: 700; padding: .3rem .6rem; border-radius: 8px; font-size: .9rem; }
.rating-pill .bi { color: var(--lfm-gold); }

/* Top bar + navbar */
.topbar { background: var(--lfm-navy-900); color: #c9d3ec; font-size: .8rem; }
.topbar a { color: #fff; }
.navbar-lfm { background: #fff; border-bottom: 1px solid var(--lfm-line); box-shadow: 0 2px 12px rgba(1,33,105,.05); }
.navbar-lfm .nav-link { font-weight: 600; color: var(--lfm-navy-900); padding: .6rem .9rem; }
.navbar-lfm .nav-link:hover, .navbar-lfm .nav-link.active { color: var(--lfm-red); }
.navbar-lfm .dropdown-menu { border: 1px solid var(--lfm-line); border-radius: 10px; box-shadow: var(--lfm-shadow); padding: .5rem; }
.navbar-lfm .dropdown-item { border-radius: 6px; font-size: .9rem; padding: .45rem .75rem; }
.navbar-lfm .dropdown-item:hover { background: #eef1f8; color: var(--lfm-navy); }
.mega { min-width: 560px; columns: 2; column-gap: .5rem; }
.mega .dropdown-item { break-inside: avoid; }
@media (max-width: 991px) { .mega { min-width: 0; columns: 1; } }

/* Hero */
.hero { position: relative; background: var(--lfm-navy); color: #fff; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background:
  linear-gradient(115deg, transparent 0 48.2%, rgba(255,255,255,.10) 48.2% 49.2%, rgba(200,16,46,.45) 49.2% 50.8%, rgba(255,255,255,.10) 50.8% 51.8%, transparent 51.8%),
  linear-gradient(65deg,  transparent 0 48.2%, rgba(255,255,255,.10) 48.2% 49.2%, rgba(200,16,46,.45) 49.2% 50.8%, rgba(255,255,255,.10) 50.8% 51.8%, transparent 51.8%),
  radial-gradient(1200px 500px at 80% -10%, rgba(11,45,128,.9), transparent 60%);
  opacity: .55; pointer-events: none; }
.hero .container { position: relative; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4vw, 3rem); }
.hero .lead { color: #c9d3ec; }
.hero-search { background: #fff; border-radius: 12px; padding: .5rem; box-shadow: 0 20px 40px -20px rgba(0,0,0,.5); }
.hero-search .form-control { border: 0; box-shadow: none; font-size: 1.05rem; }
.hero-search .btn { border-radius: 8px; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 1.6rem; color: #fff; }
.stat span { color: #c9d3ec; font-size: .85rem; }

/* Section titles */
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.section-title h2 { margin: 0; font-size: 1.5rem; }
.section-title p { margin: .25rem 0 0; color: var(--lfm-muted); }

/* Company card */
.company-card { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--lfm-line); border-radius: var(--lfm-radius); padding: 1.1rem 1.2rem; transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; }
.company-card:hover { transform: translateY(-2px); box-shadow: var(--lfm-shadow); border-color: #c9d3ec; }
.company-card .name { font-size: 1.05rem; font-weight: 700; color: var(--lfm-navy-900); margin: 0 0 .2rem; }
.company-card .name a::after { content: ""; position: absolute; inset: 0; }
.company-card .name a:hover { text-decoration: none; color: var(--lfm-red); }
.company-card .addr { color: var(--lfm-muted); font-size: .85rem; }
.company-card .chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; position: relative; z-index: 1; }
.company-card .meta { margin-top: auto; padding-top: .8rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .85rem; color: var(--lfm-muted); }
.company-card .rank { position: absolute; top: -10px; left: 14px; background: var(--lfm-red); color: #fff; font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; }

/* Category tile */
.cat-tile { display: flex; align-items: center; gap: .8rem; background: #fff; border: 1px solid var(--lfm-line); border-radius: 10px; padding: .85rem 1rem; color: var(--lfm-navy-900); font-weight: 600; transition: all .15s; }
.cat-tile:hover { border-color: var(--lfm-navy); color: var(--lfm-navy); text-decoration: none; transform: translateY(-1px); }
.cat-tile .ico { width: 38px; height: 38px; border-radius: 9px; background: #eef1f8; color: var(--lfm-navy); display: grid; place-items: center; font-size: 1.1rem; flex: none; }
.cat-tile small { display: block; color: var(--lfm-muted); font-weight: 500; font-size: .78rem; }
.city-link { display: flex; justify-content: space-between; padding: .55rem .8rem; border-radius: 8px; background: #fff; border: 1px solid var(--lfm-line); color: var(--lfm-navy-900); font-weight: 500; }
.city-link:hover { border-color: var(--lfm-red); color: var(--lfm-red); text-decoration: none; }
.city-link span { color: var(--lfm-muted); font-size: .8rem; }

/* Page header */
.page-head { background: #fff; border-bottom: 1px solid var(--lfm-line); }
.page-head h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: .25rem 0; }
.breadcrumb { font-size: .82rem; margin: 0; }
.breadcrumb-item + .breadcrumb-item::before { color: #b8c0d1; }

/* Profile */
.profile-head { background: #fff; border-bottom: 1px solid var(--lfm-line); }
.profile-head h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.fact { display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px dashed var(--lfm-line); }
.fact:last-child { border-bottom: 0; }
.fact .bi { color: var(--lfm-red); font-size: 1.05rem; flex: none; margin-top: .1rem; }
.fact .k { font-size: .75rem; color: var(--lfm-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.fact .v { word-break: break-word; }
.review { border: 1px solid var(--lfm-line); border-radius: 10px; padding: 1rem; background: #fff; }
.review .who { font-weight: 600; }
.review .when { color: var(--lfm-muted); font-size: .8rem; }
.enquiry-card { position: sticky; top: 90px; border-top: 4px solid var(--lfm-red); }
.side-list a { display: block; padding: .5rem 0; border-bottom: 1px solid var(--lfm-line); color: var(--lfm-navy-900); }
.side-list a:last-child { border-bottom: 0; }
.side-list a:hover { color: var(--lfm-red); text-decoration: none; }
.side-list small { display: block; color: var(--lfm-muted); }

/* Footer */
footer.lfm-footer { background: var(--lfm-navy-900); color: #b9c4e0; font-size: .9rem; }
footer.lfm-footer h5 { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1rem; }
footer.lfm-footer a { color: #d7deef; }
footer.lfm-footer a:hover { color: #fff; }
footer.lfm-footer ul { list-style: none; padding: 0; margin: 0; }
footer.lfm-footer li { margin-bottom: .45rem; }
footer.lfm-footer .bottom { border-top: 1px solid rgba(255,255,255,.1); color: #8d9bc2; font-size: .8rem; }

/* Pagination */
.pagination { gap: .25rem; }
.page-link { border-radius: 8px !important; border-color: var(--lfm-line); color: var(--lfm-navy); font-weight: 600; }
.page-item.active .page-link { background: var(--lfm-navy); border-color: var(--lfm-navy); }

/* Alerts */
.alert { border-radius: 10px; }

/* Honeypot */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--lfm-navy); position: relative; }
.auth-wrap::before { content: ""; position: absolute; inset: 0; background:
  linear-gradient(115deg, transparent 0 48%, rgba(200,16,46,.5) 48% 51%, transparent 51%),
  linear-gradient(65deg, transparent 0 48%, rgba(200,16,46,.5) 48% 51%, transparent 51%); opacity: .7; }
.auth-card { position: relative; width: 100%; max-width: 420px; }

/* Utilities */
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sticky-top-offset { top: 90px; }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-body { background: #eef1f7; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 250px; flex: none; background: linear-gradient(180deg, var(--lfm-navy) 0%, var(--lfm-navy-900) 100%); color: #c9d3ec; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.admin-side .brand { padding: 1rem 1.25rem .9rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-side .brand small { display: block; color: #8d9bc2; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; margin-top: .35rem; }
.admin-side .nav-link { color: #c9d3ec; padding: .55rem 1.25rem; display: flex; align-items: center; gap: .7rem; font-weight: 500; font-size: .9rem; border-left: 3px solid transparent; }
.admin-side .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.admin-side .nav-link.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--lfm-red); }
.admin-side .nav-link .bi { width: 18px; text-align: center; font-size: 1rem; }
.admin-side .nav-link .badge { margin-left: auto; font-size: .68rem; }
.admin-side .section { padding: 1rem 1.25rem .35rem; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: #7f8db3; font-weight: 700; }
.admin-side .foot { margin-top: auto; padding: .9rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; }
.admin-side .foot .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lfm-red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { background: #fff; border-bottom: 1px solid var(--lfm-line); padding: .75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 var(--lfm-line); }
.admin-top::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--lfm-navy) 0 50%, var(--lfm-red) 50% 100%); }
.admin-top h1 { font-size: 1.15rem; margin: 0; }
.admin-top .crumb { font-size: .75rem; color: var(--lfm-muted); }
.admin-content { padding: 1.5rem; flex: 1; }
.admin-footer { padding: .75rem 1.5rem; font-size: .75rem; color: var(--lfm-muted); border-top: 1px solid var(--lfm-line); background: #fff; }
.kpi { background: #fff; border: 1px solid var(--lfm-line); border-radius: var(--lfm-radius); padding: 1rem 1.2rem; display: flex; align-items: center; gap: 1rem; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lfm-navy); }
.kpi.red::before { background: var(--lfm-red); }
.kpi.green::before { background: var(--lfm-green); }
.kpi .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; background: #eef1f8; color: var(--lfm-navy); flex: none; }
.kpi.red .ico { background: #fdecef; color: var(--lfm-red); }
.kpi.green .ico { background: #e6f5ec; color: var(--lfm-green); }
.kpi strong { display: block; font-size: 1.45rem; line-height: 1.1; color: var(--lfm-navy-900); }
.kpi span { font-size: .8rem; color: var(--lfm-muted); }
.card-header { display: flex; align-items: center; gap: .5rem; }
.card-header::before { content: ""; width: 3px; height: 14px; background: var(--lfm-red); border-radius: 2px; }
.table-lfm { background: #fff; font-size: .9rem; }
.table-lfm thead th { background: #f8f9fc; color: var(--lfm-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--lfm-line); font-weight: 600; white-space: nowrap; }
.table-lfm td { vertical-align: middle; border-color: var(--lfm-line); padding: .55rem .6rem; }
.table-lfm th { padding: .55rem .6rem; }
.table-lfm tr:hover td { background: #fafbfe; }
.status { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status-new { background: #fdecef; color: var(--lfm-red); }
.status-contacted { background: #fff4d6; color: #9a6700; }
.status-qualified { background: #e6eefc; color: var(--lfm-navy); }
.status-sold { background: #e6f5ec; color: var(--lfm-green); }
.status-closed { background: #eceff4; color: #5f6b7a; }
.status-pending { background: #fff4d6; color: #9a6700; }
.status-approved { background: #e6f5ec; color: var(--lfm-green); }
.status-rejected { background: #eceff4; color: #5f6b7a; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark i { display: block; flex: 1; background: var(--lfm-navy); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark i:last-child { background: var(--lfm-red); }
.quick-action { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; background: #fff; border: 1px solid var(--lfm-line); border-radius: 10px; color: var(--lfm-navy-900); font-weight: 600; font-size: .9rem; }
.quick-action:hover { border-color: var(--lfm-navy); text-decoration: none; color: var(--lfm-navy); }
.quick-action .bi { width: 34px; height: 34px; border-radius: 8px; background: #eef1f8; color: var(--lfm-red); display: grid; place-items: center; }
.tool-card { border: 1px solid var(--lfm-line); border-radius: 10px; background: #fff; padding: 1rem; height: 100%; display: flex; flex-direction: column; gap: .5rem; }
.tool-card.billed { border-color: #f7cfd6; background: #fffafb; }
pre.tool-output { background: var(--lfm-navy-900); color: #d7deef; border-radius: 10px; padding: 1rem; font-size: .8rem; max-height: 320px; overflow: auto; }
@media (max-width: 991px) { .admin-side { position: fixed; left: -250px; z-index: 1040; transition: left .2s; } .admin-side.open { left: 0; } .admin-shell.side-open::after { content:""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030; } }

/* Login (split layout) */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand { background: var(--lfm-navy); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; }
.auth-brand::before { content: ""; position: absolute; inset: 0; background:
  linear-gradient(115deg, transparent 0 48.5%, rgba(255,255,255,.12) 48.5% 49.3%, rgba(200,16,46,.55) 49.3% 50.7%, rgba(255,255,255,.12) 50.7% 51.5%, transparent 51.5%),
  linear-gradient(65deg, transparent 0 48.5%, rgba(255,255,255,.12) 48.5% 49.3%, rgba(200,16,46,.55) 49.3% 50.7%, rgba(255,255,255,.12) 50.7% 51.5%, transparent 51.5%),
  linear-gradient(90deg, transparent 0 48.8%, rgba(255,255,255,.10) 48.8% 49.4%, rgba(200,16,46,.5) 49.4% 50.6%, rgba(255,255,255,.10) 50.6% 51.2%, transparent 51.2%),
  linear-gradient(0deg, transparent 0 48.8%, rgba(255,255,255,.10) 48.8% 49.4%, rgba(200,16,46,.5) 49.4% 50.6%, rgba(255,255,255,.10) 50.6% 51.2%, transparent 51.2%);
  opacity: .35; }
.auth-brand > * { position: relative; }
.auth-brand h2 { color: #fff; font-size: 1.9rem; }
.auth-brand p { color: #c9d3ec; }
.auth-brand .stat-row { display: flex; gap: 2rem; }
.auth-brand .stat-row strong { display: block; font-size: 1.5rem; }
.auth-brand .stat-row span { color: #c9d3ec; font-size: .8rem; }
.auth-form { background: #fff; display: grid; place-items: center; padding: 3rem 1.5rem; }
.auth-form > div { width: 100%; max-width: 400px; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-brand { padding: 2rem 1.5rem; min-height: 0; } .auth-brand .stat-row, .auth-brand .tag { display: none; } }
