/* ===== Lendmark for Agencies — standalone styles =====
   Shares the Lendmark V4 design language (charcoal + emerald, Inter, soft shadows)
   but is fully self-contained so this site can move to agency.lendmark.co.uk
   without depending on the main app's style.css. */

:root {
  --navy:        #0a0e14;
  --navy-2:      #131720;
  --primary:     #10a37f;
  --primary-dark:#0d8a6a;
  --primary-soft:#d4f4e8;
  --amber:       #b8860b;
  --amber-soft:  #fff4dc;
  --amber-text:  #8e6700;
  --danger:      #e0352b;
  --danger-soft: #ffeae8;
  --green:       #10a37f;
  --green-soft:  #d4f4e8;
  --green-text:  #0d8a6a;

  --bg:          #faf8f5;
  --surface:     #ffffff;
  --surface-2:   #f7f5f1;
  --text:        #1a1a1a;
  --text-muted:  #6b6b70;
  --border:      #e5e5ea;
  --border-strong:#d1d1d6;

  --radius:      16px;
  --radius-sm:   12px;
  --radius-lg:   22px;
  --shadow:      0 1px 2px rgba(10,14,20,0.04), 0 1px 3px rgba(10,14,20,0.03);
  --shadow-hover:0 8px 28px rgba(10,14,20,0.10);
  --font:        'Inter', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw:        1140px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }

/* ===== Header ===== */
.ag-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250,248,245,0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 0.5px solid var(--border);
}
.ag-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
}
.ag-logo { display: flex; align-items: center; gap: 10px; color: var(--navy); }
.ag-logo:hover { text-decoration: none; }
.ag-logo__mark { width: 30px; height: 30px; color: var(--primary); flex: 0 0 auto; }
.ag-logo__mark svg { width: 100%; height: 100%; display: block; }
.ag-logo__text { display: flex; align-items: baseline; gap: 8px; }
.ag-logo__title { font-weight: 700; font-size: 19px; color: var(--navy); letter-spacing: -0.02em; }
.ag-logo__badge {
  font-size: 12px; font-weight: 600; color: var(--primary-dark);
  background: var(--primary-soft); padding: 2px 8px; border-radius: 999px;
}
.ag-header__nav { display: flex; align-items: center; gap: 10px; }
.ag-userchip { font-size: 13px; color: var(--text-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Buttons ===== */
.ag-btn {
  font-family: inherit; font-size: 15px; font-weight: 600;
  border-radius: 999px; padding: 11px 20px; border: 1px solid transparent;
  cursor: pointer; transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; line-height: 1;
}
.ag-btn:hover { text-decoration: none; }
.ag-btn:active { transform: translateY(1px); }
.ag-btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.ag-btn--primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-hover); }
.ag-btn--ghost { background: var(--surface); color: var(--navy); border-color: var(--border-strong); }
.ag-btn--ghost:hover { background: var(--surface-2); }
.ag-btn--sm { padding: 8px 14px; font-size: 13px; }
.ag-btn--block { width: 100%; }
.ag-link {
  background: none; border: none; color: var(--primary-dark); font-family: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 2px;
}
.ag-link:hover { text-decoration: underline; }
.ag-link--muted { color: var(--text-muted); font-weight: 500; }

/* ===== Views ===== */
.ag-view { animation: agFade .25s ease; }
@keyframes agFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Hero ===== */
.ag-hero {
  max-width: var(--maxw); margin: 0 auto; padding: 56px 20px 28px;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center;
}
.ag-eyebrow {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--primary-dark); background: var(--primary-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}
.ag-hero__title { font-size: clamp(30px, 4.6vw, 50px); font-weight: 800; color: var(--navy); }
.ag-hero__lead { font-size: 18px; color: #3a3a40; margin: 18px 0 26px; max-width: 38ch; }
.ag-hero__lead strong { color: var(--navy); font-weight: 600; }
.ag-hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.ag-hero__cta--center { justify-content: center; }
.ag-hero__trust { font-size: 13px; color: var(--text-muted); margin-top: 18px; }

/* hero preview panel */
.ag-hero__panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover); padding: 18px; min-height: 280px;
}
.ag-prev__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ag-prev__title { font-size: 13px; font-weight: 700; color: var(--text-muted); letter-spacing: .03em; text-transform: uppercase; }
.ag-prev__kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.ag-prev__kpi { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.ag-prev__kpi b { display: block; font-size: 20px; color: var(--navy); }
.ag-prev__kpi span { font-size: 11px; color: var(--text-muted); }
.ag-prev__row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); }
.ag-prev__row span { font-size: 13px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* score dot/badge shared */
.ag-score { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; border-radius: 999px; }
.ag-score--badge { min-width: 42px; height: 42px; font-size: 15px; padding: 0 6px; }
.ag-score--mini { min-width: 30px; height: 24px; font-size: 12px; }
.ag-score.is-green { background: var(--green-soft); color: var(--green-text); }
.ag-score.is-amber { background: var(--amber-soft); color: var(--amber-text); }
.ag-score.is-red   { background: var(--danger-soft); color: var(--danger); }

/* ===== Sections ===== */
.ag-section { max-width: var(--maxw); margin: 0 auto; padding: 44px 20px; }
.ag-section--alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); max-width: none; }
.ag-section--alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.ag-section--cta { text-align: center; }
.ag-section__title { font-size: clamp(24px, 3vw, 34px); font-weight: 700; color: var(--navy); text-align: center; }
.ag-section__sub { font-size: 17px; color: var(--text-muted); text-align: center; max-width: 56ch; margin: 12px auto 30px; }

.ag-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.ag-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); transition: box-shadow .15s ease, transform .1s ease;
}
.ag-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.ag-card__ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; font-weight: 700; font-size: 17px;
  background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 14px;
}
.ag-card h3 { font-size: 18px; color: var(--navy); margin-bottom: 8px; }
.ag-card p { font-size: 15px; color: #4a4a50; margin: 0; }
.ag-card p strong { color: var(--navy); }

.ag-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; }
.ag-step { display: flex; gap: 14px; align-items: flex-start; }
.ag-step__n {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 999px;
  background: var(--navy); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.ag-step h3 { font-size: 17px; color: var(--navy); margin-bottom: 4px; }
.ag-step p { font-size: 14px; color: var(--text-muted); margin: 0; }

.ag-law { max-width: 760px; margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 10px; }
.ag-law li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 16px; font-size: 15px; color: #3a3a40; }
.ag-law li strong { color: var(--navy); }
.ag-disclaimer { font-size: 13px; color: var(--text-muted); text-align: center; max-width: 60ch; margin: 22px auto 0; }

/* FAQ */
.ag-faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 18px; margin-bottom: 10px; max-width: 760px; margin-left: auto; margin-right: auto; }
.ag-faq__item summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 13px 0; list-style: none; font-size: 16px; }
.ag-faq__item summary::-webkit-details-marker { display: none; }
.ag-faq__item summary::after { content: '+'; float: right; color: var(--text-muted); font-weight: 400; font-size: 20px; }
.ag-faq__item[open] summary::after { content: '\2013'; }
.ag-faq__item p { font-size: 15px; color: #4a4a50; margin: 0 0 14px; }

/* ===== Auth ===== */
#ag-auth { display: flex; justify-content: center; padding: 60px 20px; }
.ag-auth__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); padding: 32px; max-width: 420px; width: 100%; }
.ag-auth__title { font-size: 24px; color: var(--navy); }
.ag-auth__sub { font-size: 14px; color: var(--text-muted); margin: 10px 0 22px; }
.ag-auth__form { display: grid; gap: 14px; }
.ag-field { display: grid; gap: 6px; }
.ag-field span { font-size: 13px; font-weight: 600; color: var(--text); }
.ag-field input {
  font-family: inherit; font-size: 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
}
.ag-field input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.ag-auth__err { color: var(--danger); font-size: 14px; margin: 14px 0 0; background: var(--danger-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
#ag-magic { display: block; margin: 14px auto 0; }
#ag-auth-back { display: block; margin: 18px auto 0; }

/* ===== Dashboard ===== */
#ag-dashboard { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 60px; }
.ag-dash__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.ag-dash__title { font-size: 28px; color: var(--navy); }
.ag-dash__sub { font-size: 15px; color: var(--text-muted); margin: 4px 0 0; }

.ag-demobanner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--amber-soft); border: 1px solid #f0dca0; color: var(--amber-text);
  border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 20px; font-size: 14px;
}
.ag-demobanner .ag-link { color: var(--amber-text); }

/* KPIs */
.ag-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
.ag-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.ag-kpi__num { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.ag-kpi__num.is-red { color: var(--danger); }
.ag-kpi__num.is-amber { color: var(--amber-text); }
.ag-kpi__num.is-green { color: var(--green-text); }
.ag-kpi__lbl { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* Blocks */
.ag-block { margin-bottom: 30px; }
.ag-block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ag-block__title { font-size: 19px; color: var(--navy); }
.ag-block__hint { font-size: 13px; color: var(--text-muted); }
.ag-search { font-family: inherit; font-size: 14px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); min-width: 220px; }
.ag-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Property rows */
.ag-proplist { display: grid; gap: 10px; }
.ag-prop {
  display: flex; align-items: center; gap: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.ag-prop--flag { border-left: 4px solid var(--danger); }
.ag-prop--warn { border-left: 4px solid var(--amber); }
.ag-prop__body { flex: 1; min-width: 0; }
.ag-prop__addr { font-weight: 600; color: var(--navy); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-prop__meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.ag-prop__issue { font-size: 13px; color: var(--danger); margin-top: 4px; }
.ag-prop__issue.is-amber { color: var(--amber-text); }
.ag-chip { background: var(--surface-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--text-muted); }
.ag-prop__risk { font-size: 13px; font-weight: 600; color: var(--danger); white-space: nowrap; }

/* Portfolio groups */
.ag-portfolio { display: grid; gap: 22px; }
.ag-group__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ag-group__name { font-size: 15px; font-weight: 700; color: var(--navy); }
.ag-group__count { font-size: 13px; color: var(--text-muted); }
.ag-group__rows { display: grid; gap: 8px; }

/* Viewings */
.ag-viewings { display: grid; gap: 8px; }
.ag-viewrow { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; box-shadow: var(--shadow); }
.ag-viewrow__ic { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ag-viewrow__body { flex: 1; min-width: 0; }
.ag-viewrow__t { font-size: 14px; font-weight: 600; color: var(--navy); }
.ag-viewrow__m { font-size: 12.5px; color: var(--text-muted); }
.ag-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.ag-badge.is-green { background: var(--green-soft); color: var(--green-text); }
.ag-badge.is-amber { background: var(--amber-soft); color: var(--amber-text); }
.ag-badge.is-red   { background: var(--danger-soft); color: var(--danger); }

/* Empty / muted states */
.ag-empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--text-muted); }
.ag-empty h3 { color: var(--navy); margin-bottom: 8px; }
.ag-empty p { margin: 0 auto 8px; max-width: 52ch; font-size: 15px; }
.ag-muted { font-size: 14px; color: var(--text-muted); padding: 8px 2px; }

/* ===== Footer ===== */
.ag-footer { border-top: 1px solid var(--border); padding: 26px 20px; text-align: center; margin-top: 20px; }
.ag-footer__legal { font-size: 13px; color: var(--text-muted); margin: 0 0 6px; }
.ag-footer__company { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ===== Toast ===== */
.ag-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow-hover); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 80; max-width: 90vw;
}
.ag-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .ag-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
  .ag-hero__panel { order: -1; }
  .ag-kpis { grid-template-columns: repeat(2, 1fr); }
  .ag-cards { grid-template-columns: 1fr; }
  .ag-steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ag-header__inner { padding: 10px 14px; }
  .ag-logo__badge { display: none; }
  .ag-hero__title { font-size: 30px; }
  .ag-hero__lead { font-size: 16px; }
  .ag-kpis { grid-template-columns: repeat(2, 1fr); }
  .ag-dash__head { flex-direction: column; }
  .ag-section, #ag-dashboard, .ag-hero { padding-left: 16px; padding-right: 16px; }
  .ag-search { min-width: 0; width: 100%; }
  .ag-block__head { flex-direction: column; align-items: stretch; }
}
