@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
    --ink: #17211b;
    --muted: #68746c;
    --line: #dce4dc;
    --paper: #f7f8f3;
    --white: #ffffff;
    --green: #1c6b4b;
    --green-dark: #125139;
    --mint: #dceee2;
    --red-bg: #fff0ee;
    --red: #a33a32;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: 'DM Sans', sans-serif; }
h1, h2 { margin: 0; font-family: 'Space Grotesk', sans-serif; letter-spacing: 0; }
h1 { font-size: clamp(2.4rem, 5vw, 4.7rem); line-height: 1.02; }
h2 { font-size: 2rem; line-height: 1.1; }
p { line-height: 1.6; }
.auth-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.brand-panel { display: flex; flex-direction: column; justify-content: center; padding: 8vw; background: var(--green); color: var(--white); position: relative; overflow: hidden; }
.brand-panel::after { content: ''; position: absolute; width: 28rem; height: 28rem; right: -12rem; bottom: -13rem; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; box-shadow: 0 0 0 4rem rgba(255,255,255,.06), 0 0 0 8rem rgba(255,255,255,.04); }
.brand-panel h1 { max-width: 620px; margin-top: 1rem; }
.brand-copy { max-width: 440px; color: #cbe1d2; font-size: 1.08rem; }
.eyebrow { margin: 0 0 .7rem; color: var(--green); font-size: .75rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.brand-panel .eyebrow { color: #a7d0b5; }
.login-panel { display: grid; place-items: center; padding: 2rem; background: var(--white); }
.login-card { width: min(100%, 430px); }
.login-logo { display: block; width: min(100%, 360px); height: auto; margin: 0 0 2.2rem; object-fit: contain; object-position: left center; }
.login-card h2 { margin-bottom: .6rem; }
.muted { color: var(--muted); margin-top: 0; }
form { margin-top: 2rem; }
label { display: block; margin: 1.2rem 0 .45rem; font-size: .9rem; font-weight: 600; }
input, select, textarea { width: 100%; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font: inherit; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28,107,75,.12); }
button, .button-link { display: inline-flex; align-items: center; justify-content: center; gap: .7rem; width: 100%; margin-top: 1.6rem; padding: 1rem; border: 0; border-radius: 6px; background: var(--green); color: var(--white); font: 600 1rem 'DM Sans', sans-serif; text-decoration: none; cursor: pointer; }
button:hover, .button-link:hover { background: var(--green-dark); }
.alert, .success { margin-top: 1.4rem; padding: .85rem 1rem; border-radius: 6px; font-size: .9rem; }
.alert { background: var(--red-bg); color: var(--red); }
.success { background: var(--mint); color: var(--green-dark); }
.message-shell { display: grid; min-height: 100vh; place-items: center; padding: 2rem; }
.message-shell .login-card { padding: 2.5rem; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(23,33,27,.08); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: .45rem 2.2rem; border-bottom: 1px solid #e5e9e5; background: rgba(255,255,255,.96); box-shadow: 0 3px 16px rgba(23,33,27,.04); }
.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo img { display: block; width: auto; height: 38px; max-width: 175px; object-fit: contain; }
.user-menu { display: flex; align-items: center; gap: .9rem; color: var(--muted); font-size: .82rem; }
.user-menu > span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 .75rem; border-right: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.logout-link { color: var(--green); font-weight: 700; text-decoration: none; }
.logout-link:hover { color: var(--green-dark); }
.dashboard-content { max-width: 1100px; margin: 0 auto; padding: 7rem 5vw; }
.dashboard-content h1 { font-size: clamp(2.2rem, 5vw, 4rem); max-width: 700px; }
.dashboard-content .muted { font-size: 1.1rem; }
.stat-grid { display: grid; grid-template-columns: minmax(220px, 360px); gap: 1rem; margin-top: 3rem; }
.stat-card { padding: 1.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.stat-card-link { display: block; color: inherit; text-decoration: none; transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.stat-card-link:hover { border-color: var(--green); box-shadow: 0 12px 28px rgba(23,33,27,.08); transform: translateY(-2px); }
.stat-card span { color: var(--muted); font-size: .9rem; }
.stat-card strong { display: block; margin-top: .5rem; color: var(--green); font: 700 2.2rem 'Space Grotesk', sans-serif; }
.page-content { max-width: 1180px; margin: 0 auto; padding: 4.5rem 5vw; }
.leads-page { max-width: 1540px; min-height: calc(100vh - 86px); }
.leads-page { padding-top: 1rem; padding-bottom: 1rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.page-heading h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.leads-page .page-heading h1 { margin: 0; font-size: 1.5rem; line-height: 1.1; }
.leads-page .page-heading { margin-bottom: 0; }
.leads-page .page-heading h1 { margin-top: 0; }
.leads-page .page-heading .muted { margin-bottom: 0; }
.page-heading .button-link { width: auto; margin-top: 0; padding: .8rem 1.2rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 16px 40px rgba(23,33,27,.06); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.lead-table table { min-width: 900px; }
.lead-table tbody tr { transition: background .2s ease; }
.lead-table tbody tr:hover { background: #fbfcf9; }
.data-toolbar { display: grid; grid-template-columns: minmax(250px, 2fr) repeat(2, minmax(120px, .7fr)) minmax(190px, 1fr) minmax(180px, 1fr) auto; gap: .65rem; align-items: center; margin: .45rem 0 .5rem; padding: .65rem; border: 1px solid var(--line); border-radius: 10px; background: var(--white); box-shadow: 0 10px 28px rgba(23,33,27,.04); }
.data-toolbar input, .data-toolbar select { min-width: 0; padding: .7rem .8rem; font-size: .85rem; }
.search-field { display: flex; align-items: center; gap: .55rem; min-width: 0; padding-left: .75rem; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.search-field input { border: 0; padding-left: 0; box-shadow: none; }
.clear-filters { width: auto; margin: 0; padding: .7rem .9rem; font-size: .85rem; }
.table-summary { display: flex; justify-content: space-between; margin: .8rem .2rem; color: var(--muted); font-size: .8rem; }
.pagination { display: flex; justify-content: center; gap: .35rem; padding: 1.1rem 0; }
.pagination button { width: 2.2rem; margin: 0; padding: .55rem; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-size: .85rem; }
.pagination button:hover, .pagination button.active { background: var(--green); color: var(--white); }
.lead-name { display: block; font-size: 1rem; }
.detail-text { display: block; margin-top: .25rem; color: var(--muted); font-size: .82rem; }
.detail-text + .detail-text { margin-top: .12rem; }
.comment-link { display: inline-flex; align-items: center; width: auto; margin: 0; padding: .45rem .7rem; border: 0; border-radius: 999px; background: var(--mint); color: var(--green-dark); font: 700 .82rem 'DM Sans', sans-serif; text-decoration: none; }
.comment-link:hover { background: #cbe6d5; }
.action-link { color: var(--green); font-weight: 600; text-decoration: none; }
.danger-button { width: auto; margin: 0; padding: 0; background: none; color: var(--red); font: 600 .9rem 'DM Sans', sans-serif; }
.danger-button:hover { background: none; color: #762720; }
.inline-form { display: inline; }
.form-card { max-width: 760px; padding: 2.5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 16px 40px rgba(23,33,27,.06); }
.lead-form-page { max-width: 1320px; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.lead-form-card { max-width: none; padding: 1.35rem 1.7rem; }
.lead-form-card h1 { font-size: 2.25rem; }
.lead-form-card > .muted { margin-bottom: .8rem; font-size: .9rem; }
.lead-form-card form { margin-top: .5rem; }
.lead-form-card .field-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .05rem 1rem; }
.lead-form-card .field-span-2 { grid-column: span 2; }
.lead-form-card label { margin-top: .75rem; }
.lead-form-card input, .lead-form-card select { padding: .72rem .85rem; }
.lead-form-card .form-actions { margin-top: .5rem; }
.form-card form { margin-top: 1rem; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .15rem 1.2rem; }
.field-span-2 { grid-column: span 2; }
.field input { margin-bottom: .35rem; }
.password-toggle { display: flex; align-items: center; gap: .5rem; margin: .35rem 0 0; color: var(--muted); font-size: .85rem; font-weight: 500; }
.password-toggle input { width: auto; margin: 0; accent-color: var(--green); }
.form-actions { display: flex; gap: .8rem; }
.form-actions button, .form-actions .button-link { width: auto; flex: 1; }
.back-link { display: inline-block; margin-bottom: 2.5rem; color: var(--green); font-weight: 600; text-decoration: none; }
.lead-detail-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.lead-detail-heading h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.lead-location { display: flex; flex-direction: column; gap: .25rem; padding: .9rem 1.1rem; border-left: 3px solid var(--green); color: var(--muted); }
.lead-location strong { color: var(--ink); }
.lead-detail-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 1.5rem; align-items: start; }
.comment-form-card { max-width: none; }
.comments-panel { min-width: 0; padding: 2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: 0 16px 40px rgba(23,33,27,.06); }
.comments-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.comments-heading h2 { font-size: 1.7rem; }
.comment-count { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green-dark); font-weight: 700; }
.comment-list { display: grid; gap: .8rem; }
.comment-item { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 8px; background: #fbfcf9; }
.comment-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .78rem; }
.comment-type { padding: .28rem .55rem; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-weight: 700; }
.comment-item p { margin: .8rem 0 .6rem; white-space: normal; overflow-wrap: anywhere; }
.comment-item small { color: var(--muted); }
.empty-comments { display: grid; gap: .35rem; padding: 2rem 1rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); text-align: center; }
.empty-comments strong { color: var(--ink); }
.comment-dialog { width: min(680px, calc(100% - 2rem)); max-height: min(760px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px rgba(23,33,27,.22); }
.comment-dialog::backdrop { background: rgba(23,33,27,.42); backdrop-filter: blur(4px); }
.comment-dialog-inner { padding: 1.25rem 1.5rem; }
.comment-dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line); }
.comment-dialog-header h2 { font-size: 1.55rem; }
.comment-dialog-header .muted { margin-bottom: 0; }
.modal-close { display: grid; width: 2.2rem; height: 2.2rem; margin: 0; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink); font-size: 1.5rem; line-height: 1; }
.modal-close:hover { background: var(--mint); color: var(--green-dark); }
.modal-comments { display: grid; max-height: 310px; gap: .5rem; overflow-y: auto; padding: 1rem 0; }
.modal-comment-form { margin-top: 0; padding-top: .9rem; border-top: 1px solid var(--line); }
.modal-form-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem; }
.modal-form-submit button { width: auto; margin-top: 0; white-space: nowrap; }
.modal-comment-form textarea { min-height: 64px; resize: vertical; }
.modal-comments .comment-item { padding: .7rem .85rem; }
.modal-comments .comment-meta { font-size: .72rem; }
.modal-comments .comment-item p { margin: .4rem 0 .3rem; font-size: .88rem; line-height: 1.35; }
.modal-comments .comment-item small { font-size: .72rem; }
.modal-comments .comment-type { padding: .2rem .45rem; }
.custom-comment-type { margin-top: .55rem; }
@media (max-width: 980px) { .data-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .search-field { grid-column: span 2; } .clear-filters { width: 100%; } }
@media (max-width: 760px) { .auth-shell { grid-template-columns: 1fr; } .brand-panel { min-height: 46vh; padding: 3rem 2rem; } .brand-panel h1 { font-size: 2.7rem; } .login-panel { padding: 3rem 2rem; } .login-logo { width: min(100%, 330px); margin-bottom: 1.8rem; } .topbar { min-height: 54px; padding: .4rem 1rem; } .logo img { height: 30px; max-width: 140px; } .user-menu { gap: .45rem; } .user-menu > span { padding: 0 .45rem; } .dashboard-content, .page-content { padding: 3.5rem 1.2rem; } .leads-page { padding-top: 1rem; padding-bottom: 1rem; } .lead-form-page { padding-top: 1rem; padding-bottom: 1rem; } .stat-grid { grid-template-columns: 1fr; } .page-heading { align-items: start; flex-direction: column; } .page-heading .button-link { width: auto; } .form-card { padding: 1.5rem; } .lead-form-card { padding: 1.2rem; } .lead-form-card h1 { font-size: 2rem; } .field-grid, .lead-form-card .field-grid { grid-template-columns: 1fr; } .field-span-2, .lead-form-card .field-span-2 { grid-column: span 1; } }
@media (max-width: 760px) { .lead-detail-heading { align-items: start; flex-direction: column; } .lead-location { width: 100%; } .lead-detail-grid { grid-template-columns: 1fr; } .comments-panel { padding: 1.5rem; } }
@media (max-width: 560px) { .comment-dialog-inner { padding: 1.25rem; } .modal-form-row { grid-template-columns: 1fr; gap: .1rem; } .modal-form-submit button { width: 100%; margin-top: 1rem; } }
