:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --text: #18201d;
  --muted: #66716d;
  --line: #dfe5e2;
  --brand: #156b4a;
  --brand-strong: #0f563b;
  --brand-soft: #e8f4ee;
  --warning: #a45a13;
  --warning-soft: #fff1dd;
  --danger: #a43b36;
  --radius: 8px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { display: grid; grid-template-columns: 228px minmax(0, 1fr); font-size: 14px; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }

.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: #17221e; color: #dfe8e4; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: #d9f14a; color: #17221e; font-weight: 800; border-radius: 7px; }
.brand-mark.large { width: 48px; height: 48px; font-size: 20px; margin: 0 auto; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: #94a29c; margin-top: 2px; font-size: 11px; }
nav { display: grid; gap: 4px; }
nav a { height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 11px; border-radius: 6px; color: #aebbb6; font-weight: 500; }
nav a:hover { background: #22312b; color: #fff; }
nav a.active { background: #d9f14a; color: #18201d; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #2a3a33; padding: 14px 7px 0; display: flex; align-items: center; gap: 7px; color: #94a29c; font-size: 12px; }
.sidebar-footer form { margin-left: auto; }
.service-dot { width: 7px; height: 7px; border-radius: 50%; background: #5fd391; box-shadow: 0 0 0 3px #284d3b; }

main { min-width: 0; }
.topbar { min-height: 92px; padding: 20px 30px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.topbar > div:first-of-type { margin-right: auto; }
.topbar h1 { margin: 3px 0 0; font-size: 23px; line-height: 1.2; letter-spacing: 0; }
.eyebrow { color: var(--muted); font-size: 12px; }
.backlink { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.backlink svg { width: 14px; height: 14px; }
.content { padding: 26px 30px 48px; max-width: 1540px; margin: 0 auto; }
.mobile-menu.icon-button, .sidebar-scrim { display: none; }

.button, button.button { min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 13px; background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: #b8c2bd; background: var(--surface-2); }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-strong); }
.button.icon-only { width: 38px; padding: 0; }
.icon-button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; display: inline-grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: var(--surface-2); color: var(--text); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric { min-height: 128px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; }
.metric span { color: var(--muted); font-weight: 500; }
.metric strong { font-size: 32px; line-height: 1; margin: 12px 0 9px; }
.metric small { color: var(--muted); margin-top: auto; }
.metric.accent { border-top: 3px solid var(--brand); }
.metric.warning { border-top: 3px solid #d48a32; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
.span-2 { grid-column: auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-head { min-height: 68px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-head > a { color: var(--brand); font-size: 12px; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 40px; padding: 0 14px; color: var(--muted); background: var(--surface-2); text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; white-space: nowrap; }
td { height: 62px; padding: 9px 14px; border-top: 1px solid #edf0ef; vertical-align: middle; white-space: nowrap; }
tbody tr:hover { background: #fbfcfc; }
td a:not(.person):not(.icon-button) { color: var(--brand); font-weight: 500; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person strong, .person small { display: block; }
.person small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #e6ece9; color: #31413a; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.avatar.xl { width: 54px; height: 54px; font-size: 19px; }
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status.neutral { background: #edf1ef; color: #53605a; }
.status.success { background: var(--brand-soft); color: var(--brand-strong); }
.status.warning { background: var(--warning-soft); color: var(--warning); }
.fit-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; margin-right: 6px; background: #aab3af; }
.fit-dot.high { background: #269765; }.fit-dot.medium { background: #d88b30; }.fit-dot.low { background: #b64b45; }
.muted { color: var(--muted); }.block { display: block; margin-top: 3px; }.grow { flex: 1; }.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.funnel-list { padding: 14px 18px 18px; display: grid; gap: 13px; }
.funnel-list > div { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: 12px; }
.funnel-list strong { font-size: 12px; }
.bar { grid-column: 1 / -1; height: 5px; background: #edf1ef; border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.lead-list { display: grid; }
.lead-list a { min-height: 58px; padding: 8px 17px; display: flex; align-items: center; gap: 11px; border-top: 1px solid #edf0ef; }
.lead-list a:first-child { border-top: 0; }
.lead-list a:hover { background: var(--surface-2); }
.lead-list strong, .lead-list small { display: block; }
.lead-list small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.lead-list a > svg { color: #a5afaa; width: 16px; }
.rank-list { padding: 7px 18px 13px; }
.rank-list div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0ef; }
.rank-list div:last-child { border-bottom: 0; }

.filterbar { padding: 12px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: minmax(240px, 1fr) repeat(3, auto) auto; gap: 8px; }
.search { height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.search input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
select, .login-panel input { height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 32px 0 10px; background: var(--surface); color: var(--text); }
.table-panel { overflow: hidden; }
.pagination { height: 58px; border-top: 1px solid var(--line); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.pagination div { display: flex; gap: 6px; }
.empty { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--muted); text-align: center; }
.empty svg { width: 28px; height: 28px; margin-bottom: 5px; }.empty strong { color: var(--text); }.empty.small { min-height: 100px; }

.action-row { position: relative; display: flex; gap: 8px; }
.action-menu { display: none; position: absolute; z-index: 10; top: 44px; right: 0; width: 285px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 14px 38px rgba(22, 33, 28, .14); }
.action-menu.open { display: block; }
.action-menu form + form { border-top: 1px solid #edf0ef; }
.action-menu button { width: 100%; min-height: 56px; padding: 9px; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; border-radius: 5px; }
.action-menu button:hover { background: var(--surface-2); }
.action-menu button span, .action-menu button strong, .action-menu button small { display: block; }
.action-menu button small { margin-top: 3px; color: var(--muted); }
.alert { min-height: 42px; padding: 10px 13px; margin-bottom: 14px; border-radius: 6px; display: flex; align-items: center; gap: 8px; }
.alert.success { background: var(--brand-soft); color: var(--brand-strong); }.alert.error { background: #fae8e6; color: var(--danger); }
.lead-hero { min-height: 112px; margin-bottom: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 15px; }
.lead-hero p { margin: 8px 0 0; color: var(--muted); }
.status-line { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-strip { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 20px; }
dt { color: var(--muted); font-size: 11px; }.contact-strip dd, .field-grid dd { margin: 5px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.detail-main { display: grid; gap: 16px; }
.field-grid { margin: 0; padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }
.field-grid .wide { grid-column: 1 / -1; }.field-grid.compact { padding: 16px 0 2px; }
.technical { padding: 16px 18px; }.technical summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.timeline-panel { max-height: 760px; overflow: hidden; }
.timeline { list-style: none; margin: 0; padding: 16px 18px 22px; max-height: 690px; overflow-y: auto; }
.timeline li { position: relative; min-height: 58px; padding: 0 0 17px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 13px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li > span { position: absolute; left: 1px; top: 5px; width: 11px; height: 11px; border: 3px solid var(--brand-soft); border-radius: 50%; background: var(--brand); }
.timeline strong, .timeline time, .timeline small { display: block; }.timeline strong { font-size: 12px; }.timeline time, .timeline small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.section-intro { margin: -6px 0 18px; color: var(--muted); max-width: 760px; line-height: 1.55; }
.item-grid { display: grid; gap: 10px; }
.item-card { min-height: 108px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 15px; }
.item-card.active-card { border-left: 3px solid var(--brand); }
.item-icon { width: 42px; height: 42px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 7px; }
.item-card h2 { margin: 8px 0 3px; font-size: 15px; }.item-card p { margin: 0; color: var(--muted); }
.item-card > dl { margin: 0 14px 0 0; min-width: 240px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }.item-card > dl dd { margin: 5px 0 0; font-weight: 600; }
.template-list { padding: 8px 18px; }.template-list > div { min-height: 52px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #edf0ef; }.template-list > div:last-child { border-bottom: 0; }.template-list strong, .template-list small { display: block; }.template-list small { margin-top: 3px; color: var(--muted); }
.compact-filter { grid-template-columns: minmax(240px, 420px) auto; justify-content: start; }.event-icon { width: 28px; height: 28px; display: inline-grid; place-items: center; margin-right: 8px; border-radius: 6px; background: #edf1ef; color: var(--muted); vertical-align: middle; }.event-icon svg { width: 14px; }.truncate { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }

.login-page {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
  align-items: center;
  justify-content: center;
  grid-template-columns: none;
  background: #f7f6fa;
  color: #24213a;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}
.login-panel {
  width: min(360px, 100%);
  padding: 28px;
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .035), 0 18px 55px rgba(0, 0, 0, .055);
  display: grid;
  gap: 20px;
}
.login-header { display: flex; align-items: center; gap: 12px; }
.login-brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f64c72;
  color: #242582;
  font-size: 15px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
}
.login-header h1 { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: 0; }
.login-header p { margin: 2px 0 0; color: #71717a; font-size: 12px; }
.login-field { display: grid; gap: 7px; color: #52525b; font-size: 12px; font-weight: 550; }
.login-page .login-field input {
  width: 100%;
  height: 44px;
  padding: 0 86px 0 11px;
  border: 1px solid #d4d4d8;
  border-radius: 7px;
  background: #fff;
  color: #18181b;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.login-page .login-field input:focus { border-color: #99738e; box-shadow: 0 0 0 3px rgba(246, 76, 114, .16); }
.password-control { position: relative; display: block; }
.password-toggle { position: absolute; top: 0; right: 4px; height: 44px; padding: 0 8px; border: 0; background: transparent; color: #553d67; font-size: 12px; font-weight: 600; cursor: pointer; }
.password-toggle:focus-visible { outline: 2px solid #f64c72; outline-offset: -4px; border-radius: 6px; }
.login-submit {
  width: 100%;
  height: 44px;
  border: 1px solid #2f2fa2;
  border-radius: 7px;
  background: #2f2fa2;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, transform .08s ease;
}
.login-submit:hover { background: #242582; }
.login-submit:active { transform: scale(.99); }
.login-submit:disabled { cursor: wait; opacity: .72; }
.login-page .alert { margin: 0; }

@media (max-width: 480px) {
  .login-page { padding: 16px; align-items: center; }
  .login-panel { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-page * { transition-duration: .01ms !important; }
}

@media (min-width: 1250px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1.75fr) minmax(300px, .8fr); }
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filterbar { grid-template-columns: 1fr 1fr; }
  .filterbar .search { grid-column: 1 / -1; }
  .contact-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  body { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 228px; transition: transform .2s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 15; background: rgba(12, 20, 16, .45); }
  body.menu-open .sidebar-scrim { display: block; }
  .mobile-menu.icon-button { display: inline-grid; }
  .topbar { min-height: 78px; padding: 15px 18px; }
  .topbar h1 { font-size: 19px; }
  .content { padding: 18px 14px 36px; }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .lead-hero { align-items: flex-start; flex-wrap: wrap; }
  .contact-strip { width: 100%; border-top: 1px solid var(--line); padding-top: 15px; }
}

@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric { min-height: 116px; padding: 14px; }.metric strong { font-size: 27px; }.metric small { font-size: 10px; }
  .filterbar { grid-template-columns: 1fr; }.filterbar .search { grid-column: auto; }
  .filterbar .button { width: 100%; }
  .field-grid, .contact-strip { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .topbar .button:not(.primary), .topbar .button.primary > svg:first-child { display: none; }
  .topbar .button.primary { padding: 0 10px; }
  .item-card { align-items: flex-start; flex-wrap: wrap; }.item-card > dl { width: 100%; min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
}
