:root {
  --primary: #2563eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --bg: #ffffff;
  --bg-light: #f5f7fa;
  --bg-dark: #101d35;
  --text: #17243b;
  --text-muted: #68758a;
  --text-inverse: #ffffff;
  --border: #e5eaf1;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body { margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 3px solid var(--primary); outline-offset: 6px; border-radius: 3px; }
.container { width: min(1200px, calc(100% - 80px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--border); }
.header-inner { min-height: 92px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.brand-name { color: var(--primary); font-size: 28px; font-weight: 900; letter-spacing: -1.3px; }
.brand-tagline { color: var(--text-muted); font-size: 11px; }
.site-nav { display: flex; gap: 26px; font-size: 13px; font-weight: 600; }
.site-nav a:hover, .footer-links a:hover { color: var(--primary); }
section { padding-block: 104px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(56px, 5.1vw, 72px); font-weight: 900; line-height: 1.07; letter-spacing: -3.2px; color: var(--primary); }
h2 { font-size: clamp(36px, 3.5vw, 48px); font-weight: 800; line-height: 1.14; letter-spacing: -1.6px; }
h3 { font-size: 20px; font-weight: 700; line-height: 1.4; letter-spacing: -.45px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 24px; }
.eyebrow::before { content: ''; width: 24px; height: 2px; background: var(--primary); }
.hero { padding-block: 112px 120px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 60px; }
.hero-description { font-size: 19px; line-height: 1.7; color: var(--text-muted); max-width: 575px; margin-top: 30px; }
.section-heading { margin-bottom: 44px; }
.features, .about { background: var(--bg-light); }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.feature-card { background: var(--bg); padding: 28px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.feature-icon { display: flex; justify-content: center; align-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--primary); background: #eff4ff; font-size: 23px; font-weight: 700; margin-bottom: 34px; }
.feature-card p { color: var(--text-muted); font-size: 14px; line-height: 1.75; margin-top: 12px; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; list-style: none; margin: 0; padding: 0; }
.step-number { display: block; color: var(--primary); font-size: 48px; font-weight: 800; letter-spacing: -2px; margin-bottom: 24px; }
.steps li { border-top: 1px solid var(--border); padding-top: 24px; }
.steps p { color: var(--text-muted); font-size: 16px; line-height: 1.7; margin-top: 12px; }
.cta { background: var(--bg-dark); color: var(--text-inverse); text-align: center; }
.cta h2 { max-width: 720px; margin-inline: auto; }
.cta p { opacity: .8; font-size: 18px; line-height: 1.7; margin-top: 24px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: start; }
.about-copy { font-size: 20px; line-height: 1.85; color: var(--text-muted); padding-top: 36px; }
.contacts a { display: inline-block; font-size: clamp(30px, 5vw, 64px); font-weight: 800; letter-spacing: -1.8px; color: var(--primary); overflow-wrap: anywhere; }
.contacts a:hover { text-decoration: underline; text-underline-offset: 8px; }
.contacts p { font-size: 16px; color: var(--text-muted); margin-top: 20px; line-height: 1.6; }
.site-footer { background: var(--bg-dark); color: var(--text-inverse); padding-block: 34px; font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.footer-links { display: flex; gap: 28px; }
.site-footer p, .footer-links { opacity: .8; }
@media (max-width: 1100px) {
  .header-inner { grid-template-columns: 1fr auto; }
  .header-space { display: none; }
  .hero-grid { grid-template-columns: 1.6fr 1fr; gap: 24px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { gap: 28px; }
}
@media (max-width: 767px) {
  html { scroll-padding-top: 140px; }
  .container { width: calc(100% - 40px); }
  .header-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding-block: 16px; }
  .brand { flex-direction: row; align-items: center; gap: 14px; }
  .brand-name { font-size: 24px; }
  .brand-tagline { font-size: 10px; max-width: 110px; line-height: 1.45; }
  .site-nav { width: 100%; gap: 10px; justify-content: space-between; font-size: 10px; }
  section { padding-block: 72px; }
  .hero { padding-block: 72px 80px; }
  .hero-grid, .about-grid { grid-template-columns: 1fr; gap: 0; }
  .hero-space { display: none; }
  h1 { font-size: clamp(38px, 7.5vw, 56px); letter-spacing: -1.8px; }
  h2 { font-size: 34px; letter-spacing: -1.2px; }
  .hero-description { font-size: 18px; margin-top: 24px; }
  .section-heading { margin-bottom: 32px; }
  .steps { grid-template-columns: 1fr; gap: 32px; }
  .step-number { margin-bottom: 16px; }
  .about-copy { font-size: 18px; padding-top: 24px; }
  .cta p { font-size: 16px; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 20px; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; gap: 16px; }
  .feature-card { padding: 28px; }
  .feature-icon { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* CTA and native profile menu: scoped to the public home page. */
.btn-primary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; padding: 14px 28px; border-radius: 12px; font-weight: 700; font-size: 16px; line-height: 1.4; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.text-link { color: var(--primary); font-size: 16px; font-weight: 600; padding: 14px 4px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.header-inner { grid-template-columns: auto 1fr auto; gap: 24px; }
.site-nav { justify-content: center; gap: 20px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.header-actions .btn-primary { padding: 12px 18px; font-size: 14px; }
.hero-actions, .cta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
.cta-actions { justify-content: center; }
.avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--primary); color: #ffffff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.user-menu { position: relative; min-width: 0; max-width: 240px; }
.user-menu summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
.user-name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.user-menu-content { position: absolute; right: 0; top: calc(100% + 8px); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.1); padding: 8px; min-width: 210px; display: none; z-index: 20; }
.user-menu[open] .user-menu-content { display: block; }
.user-menu-content a { display: block; padding: 10px 14px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.user-menu-content a + a { margin-top: 4px; }
.user-menu-content a:hover { background: var(--bg-light); }
@media (min-width: 768px) and (max-width: 1100px) {
  .header-inner { grid-template-columns: 1fr auto; padding-block: 16px; row-gap: 16px; }
  .site-nav { grid-row: 2; grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  html { scroll-padding-top: 210px; }
  .header-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .site-nav { grid-row: 3; gap: 8px; justify-content: space-between; }
  .header-actions { justify-content: space-between; gap: 16px; }
  .header-actions .btn-primary { padding: 12px 16px; }
  .user-menu { max-width: 100%; }
  .user-menu-content { right: auto; left: 0; max-width: calc(100vw - 40px); }
}

/* Shared public pages only; the landing page keeps its original layout. */
.public-layout { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-light); }
.public-layout .public-content { flex: 1; min-width: 0; }
.public-layout .site-nav { justify-content: center; }
.public-layout .form-card { max-width: 480px; margin: 60px auto; padding: 40px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.public-layout .form-card h1 { font-size: 32px; font-weight: 800; color: var(--primary); margin-bottom: 24px; text-align: center; letter-spacing: -1px; line-height: 1.2; }
.public-layout .form-card label { display: block; font-weight: 700; color: var(--text); margin: 14px 0 6px; }
.public-layout .form-card input:not([type="radio"]) { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 15px; font-family: inherit; background: var(--bg); color: var(--text); }
.public-layout .form-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.public-layout .form-card button { width: 100%; margin-top: 22px; padding: 14px; background: var(--accent); color: #fff; border: 0; border-radius: 12px; font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer; }
.public-layout .form-card button:hover { background: var(--accent-hover); }
.public-layout .form-card button:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.public-layout .bottom-link { margin-top: 18px; text-align: center; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.public-layout .bottom-link a { color: var(--primary); font-weight: 600; }
.public-layout .bottom-link a:hover { text-decoration: underline; }
.public-layout .error { margin-bottom: 16px; padding: 10px 12px; border-radius: 12px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; overflow-wrap: anywhere; }
.public-layout .roles { padding: 0; margin-bottom: 20px; }
.public-layout .roles h2 { font-size: 16px; letter-spacing: 0; line-height: 1.4; margin-bottom: 12px; }
.public-layout .role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.public-layout .role-cards label { margin: 0; position: relative; }
.public-layout .role-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.public-layout .role-card { position: relative; min-height: 145px; padding: 32px 8px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; }
.public-layout .role-input:checked + .role-card { border-color: var(--accent); background: #eff6ff; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.public-layout .role-input:focus-visible + .role-card { outline: 3px solid var(--accent); outline-offset: 3px; }
.public-layout .role-icon { width: 30px; height: 30px; color: var(--primary); }
.public-layout .role-title { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.public-layout .role-card.disabled { background: var(--bg-light); color: var(--text-muted); cursor: not-allowed; }
.public-layout .role-card.disabled .role-icon { color: var(--text-muted); }
.public-layout .soon { position: absolute; top: 8px; right: 8px; padding: 3px 7px; border-radius: 999px; background: var(--border); font-size: 10px; font-weight: 600; }
.public-layout .news-card h1 { margin-bottom: 0; }
@media (max-width: 520px) {
  .public-layout .form-card { padding: 24px; margin: 32px auto; }
  .public-layout .role-cards { grid-template-columns: 1fr; }
  .public-layout .role-card { min-height: 105px; padding-top: 24px; }
  .public-layout .form-card h1 { font-size: 28px; }
}

/* News administration: scoped to avoid changes to existing pages. */
.admin-panel { margin: 48px auto; padding: 32px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; min-width: 0; }
.admin-panel h1 { font-size: 32px; color: var(--primary); letter-spacing: -1px; }
.admin-heading, .admin-actions, .admin-sections { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.admin-heading { justify-content: space-between; }
.admin-sections { margin-top: 24px; align-items: stretch; }
.admin-placeholder { border: 1px solid var(--border); border-radius: 12px; padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-placeholder small { flex-basis: 100%; color: var(--text-muted); }
.admin-back, .admin-empty { margin: 24px 0; }
.admin-back a, .admin-actions a { color: var(--primary); font-weight: 600; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; }
.admin-table th, .admin-table td { padding: 16px 12px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.admin-table td:first-child { max-width: 360px; }
.admin-status { font-size: 13px; padding: 6px 10px; background: var(--bg-light); border-radius: 8px; display: inline-block; }
.admin-actions button { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; font: inherit; }
.admin-actions button.btn-primary { background: var(--accent); color: white; }
.public-layout .admin-form { max-width: 720px; }
.admin-form textarea { width: 100%; resize: vertical; min-height: 200px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; font: inherit; color: var(--text); background: var(--bg); }
.admin-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.public-layout .admin-form .publish-toggle { display: flex; align-items: center; gap: 10px; }
.public-layout .admin-form input[type=checkbox] { width: 20px; height: 20px; padding: 0; accent-color: var(--accent); }
.admin-dialog { position: fixed; inset: 0; margin: auto; max-width: min(480px, calc(100vw - 32px)); max-height: 90vh; padding: 24px; border: 1px solid var(--border); border-radius: 20px; color: var(--text); overflow: auto; }
.admin-dialog::backdrop { background: rgba(15,23,42,.5); }
.admin-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-dialog h2 { font-size: 24px; letter-spacing: 0; }
.admin-dialog p { margin: 16px 0; overflow-wrap: anywhere; }
.admin-dialog-head button { background: transparent; border: 0; font-size: 28px; cursor: pointer; padding: 4px 8px; }
@media (max-width: 767px) {
  .admin-panel { padding: 20px; margin: 32px auto; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table thead { display: none; }
  .admin-table tr { padding-block: 12px; border-bottom: 1px solid var(--border); }
  .admin-table td { padding: 8px 0; border: 0; }
  .admin-table td:first-child { font-weight: 700; max-width: none; }
  .admin-panel h1 { font-size: 28px; }
}

/* Local Quill editor: only news forms, never public authentication forms. */
.admin-form #quill-editor { min-height: 300px; background: #fff; border-radius: 0 0 12px 12px; }
.admin-form .ql-toolbar { border-radius: 12px 12px 0 0; border-color: var(--border); background: #fff; }
.admin-form .ql-container { border-color: var(--border); font-size: 15px; font-family: inherit; }
.admin-form .ql-editor { min-height: 300px; overflow-wrap: anywhere; }
.admin-form .ql-editor h1, .admin-form .ql-editor h2, .admin-form .ql-editor h3 { color: inherit; text-align: inherit; letter-spacing: normal; margin: 0; }
.public-layout .admin-form .ql-toolbar button { width: 28px; height: 24px; margin: 0; padding: 3px 5px; background: transparent; color: inherit; border: 0; border-radius: 0; }
.public-layout .admin-form .ql-toolbar button:hover { background: transparent; }
.public-layout .admin-form .ql-toolbar .ql-picker-label { margin: 0; font-weight: normal; color: inherit; }
.admin-form .ql-tooltip { max-width: min(340px, calc(100vw - 64px)); white-space: normal; }
.admin-form .ql-tooltip input[type=text] { max-width: 100%; width: 150px; padding: 3px 5px; border-radius: 0; }
.admin-form .ql-editor a { overflow-wrap: anywhere; }

.admin-form .ql-editor img { max-width: 100%; height: auto; }

/* Public news cards, shared by the listing and the landing page. */
.news-page { padding-block: 60px; }
.news-page > h1 { font-size: clamp(32px, 4vw, 48px); letter-spacing: -1px; margin-bottom: 36px; }
.news-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.news-item { display: block; padding: 28px 32px; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.08); cursor: pointer; overflow-wrap: anywhere; }
.news-item:hover { box-shadow: 0 14px 36px rgba(0,0,0,.12); }
.news-item h2 { color: var(--primary); font-size: 24px; font-weight: 700; letter-spacing: -.4px; line-height: 1.35; }
.news-date { display: block; color: var(--text-muted); font-size: 14px; margin-top: 12px; }
.news-preview { color: var(--text-muted); font-size: 16px; line-height: 1.7; margin-top: 16px; }
.news-empty { color: var(--text-muted); line-height: 1.6; }
.news-all { margin-top: 32px; }
.news-pagination { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px; }
@media (max-width: 767px) {
  .news-page { padding-block: 36px; }
  .news-item { padding: 24px 20px; border-radius: 16px; }
  .news-item h2 { font-size: 20px; }
}

/* Individual public news article; scoped to avoid changing other pages. */
.news-article { max-width: 800px; margin: 60px auto; padding: 0 20px; overflow-wrap: anywhere; overflow-x: hidden; }
.news-article .breadcrumbs { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; line-height: 1.6; }
.news-article .breadcrumbs a { color: var(--accent); text-decoration: none; }
.news-article .breadcrumbs a:hover { text-decoration: underline; }
.news-article > h1 { font-size: 32px; font-weight: 700; color: var(--text); margin-bottom: 12px; line-height: 1.3; letter-spacing: normal; }
.news-article > .news-date { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.news-content { font-size: 16px; line-height: 1.7; color: var(--text); overflow-wrap: break-word; word-wrap: break-word; max-width: 100%; min-width: 0; }
/* Suppress legacy Quill highlights without rewriting stored news. */
.news-content p, .news-content span { background: transparent !important; }
.news-content pre, .news-content code { white-space: pre-wrap; word-break: break-word; max-width: 100%; overflow-x: auto; }
.news-content h1, .news-content h2, .news-content h3 { color: var(--primary); margin-top: 32px; margin-bottom: 16px; line-height: 1.3; letter-spacing: normal; }
.news-content h1 { font-size: 32px; }
.news-content h2 { font-size: 28px; }
.news-content h3 { font-size: 22px; }
.news-content p + p { margin-top: 16px; }
.news-content img { max-width: 100%; height: auto; border-radius: 12px; margin: 20px 0; }
.news-content a { color: var(--accent); text-decoration: underline; }
.news-content ul, .news-content ol { padding-left: 24px; }
.news-content blockquote { border-left: 4px solid var(--accent); padding-left: 16px; color: var(--text-muted); margin: 16px 0; }
.news-content pre { max-width: 100%; overflow-x: auto; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.news-article .news-back-link { display: inline-block; margin: 16px 0; color: var(--accent); text-decoration: none; font-weight: 700; }
.news-article .news-back-link:hover { text-decoration: underline; }
@media (max-width: 767px) {
  .news-article { margin: 36px auto; padding: 0; }
}

/* User management only; other admin tables keep their existing styles. */
.admin-users .btn-danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.admin-users .btn-danger:hover { background: #991b1b; }
.admin-users .btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.admin-users-table { table-layout: fixed; font-size: 14px; }
.admin-users-table th, .admin-users-table td { padding: 12px 8px; }
.admin-users-table th:first-child { width: 48px; }
.admin-users-table th:nth-child(4) { width: 23%; }
.user-role { display: inline-block; padding: 5px 8px; border-radius: 8px; }
.user-role-user { color: #475569; background: #f1f5f9; }
.user-role-private_lender { color: #1d4ed8; background: #eff6ff; }
.user-role-financial_org { color: #7e22ce; background: #faf5ff; }
.user-role-admin { color: #b91c1c; background: #fef2f2; font-weight: 700; }
.user-verified.yes { color: #15803d; }
.user-verified.no { color: #b91c1c; }
@media (max-width: 767px) {
  .admin-users-table td::before { content: attr(data-label) ": "; color: var(--text-muted); font-weight: 600; }
  .admin-users-table td { overflow-wrap: anywhere; }
}
