:root{
  --navy:#071B2B;
  --navy-2:#102D40;
  --champagne:#CBB88C;
  --ivory:#F4F1EA;
  --paper:#FBFAF7;
  --white:#FFFFFF;
  --ink:#071B2B;
  --muted:#60707A;
  --border:#DDD8CE;
  --soft:#EEE8DC;
  --soft-2:#E7E1D5;
  --success:#E8EEE9;
  --danger:#9B2525;
  font-family:Montserrat,Arial,sans-serif;
  color:var(--ink);
  background:var(--ivory);
  font-size:16px;
  line-height:1.55;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--ivory);color:var(--ink)}
a{color:inherit;text-underline-offset:4px}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
img{max-width:100%}
h1,h2,h3,p{overflow-wrap:anywhere}
h1{font-size:clamp(2rem,3.5vw,3.45rem);font-weight:400;line-height:1.05;letter-spacing:-1.7px;margin:6px 0 12px}
h2{font-size:1.32rem;font-weight:500;line-height:1.25;margin:0 0 18px}
h3{font-size:1rem;margin:22px 0 8px}
small{display:block;color:var(--muted);font-size:.82rem;margin-top:4px}
.muted{color:var(--muted)}
.preserve{white-space:pre-wrap;overflow-wrap:anywhere}
.eyebrow{margin:0 0 8px;font-size:.72rem;font-weight:600;letter-spacing:2.1px;color:#8D7443;text-transform:uppercase}

/* Persistent internal header */
.crm-topbar{
  position:sticky;top:0;z-index:1000;
  min-height:86px;
  padding:0 clamp(22px,4.5vw,72px);
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:34px;
  background:var(--navy);
  color:var(--ivory);
  border-bottom:1px solid #ffffff18;
  box-shadow:0 5px 24px #071b2b18;
}
.crm-brand{text-decoration:none;display:flex;flex-direction:column;min-width:max-content}
.crm-brand-name{font-size:1.18rem;letter-spacing:4.8px;font-weight:500;line-height:1.15}
.crm-brand-sub{font-size:.59rem;letter-spacing:2.35px;color:var(--champagne);margin-top:7px}
.crm-nav{display:flex;align-items:center;justify-content:center;gap:3px;min-width:0;flex-wrap:wrap}
.crm-nav a{
  text-decoration:none;
  color:#DCE2E5;
  padding:10px 11px;
  border-radius:5px;
  font-size:.82rem;
  white-space:nowrap;
  transition:.15s background,.15s color;
}
.crm-nav a:hover{background:#ffffff10;color:#fff}
.crm-nav a.active{color:var(--champagne);background:#ffffff0e}
.crm-account{display:flex;align-items:center;gap:14px;justify-content:flex-end}
.crm-account strong{font-size:.82rem;font-weight:600;display:block;text-align:right}
.crm-account small{font-size:.67rem;color:var(--champagne);text-align:right;margin:2px 0 0}
.crm-account form{margin:0}
.crm-logout{
  min-height:36px;
  border:1px solid #ffffff42;
  border-radius:5px;
  padding:7px 10px;
  background:transparent;
  color:var(--ivory);
  font-size:.76rem;
}
.crm-logout:hover{background:#ffffff12}
.crm-mobile-nav{display:none}

/* Main page shell */
.crm-shell{
  width:min(1510px,100%);
  margin:0 auto;
  padding:48px clamp(22px,4.5vw,72px) 90px;
}
.crm-shell>header,
.page-heading{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:28px;
  margin:0 0 30px;
}
.crm-shell>header>div>p:last-child{margin-bottom:0}
.back-link,.crm-shell>a:first-child{
  display:inline-flex;
  align-items:center;
  gap:7px;
  color:var(--muted);
  font-size:.84rem;
  text-decoration:none;
  margin-bottom:20px;
}
.back-link:hover,.crm-shell>a:first-child:hover{color:var(--ink)}

.panel{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:12px;
  padding:27px;
  margin-bottom:22px;
  box-shadow:0 8px 26px #071b2b08;
}
.panel>h2:first-child{margin-top:0}
.notice{
  padding:14px 18px;
  background:#ECE5D8;
  border-left:3px solid #A8874B;
  border-radius:5px;
  margin:0 0 22px;
  font-size:.9rem;
}
.error{color:var(--danger)}

.button,button{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;
  border:1px solid var(--navy);
  border-radius:5px;
  background:var(--navy);
  color:var(--ivory);
  padding:10px 17px;
  font-size:.86rem;
  font-weight:600;
  text-decoration:none;
  transition:.15s background,.15s transform;
}
.button:hover,button:hover{background:var(--navy-2)}
.button:active,button:active{transform:translateY(1px)}
.button.secondary,.quiet{
  background:transparent;
  color:var(--navy);
  border-color:var(--champagne);
}
.button.secondary:hover,.quiet:hover{background:#f1ece1}
.badge{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border:1px solid var(--champagne);
  background:#F2EDE3;
  border-radius:999px;
  font-size:.77rem;
  white-space:nowrap;
}

/* Forms */
label{display:flex;flex-direction:column;gap:7px;font-size:.87rem;font-weight:500;margin-bottom:16px;min-width:0}
input,select,textarea{
  width:100%;
  color:var(--ink);
  background:#fff;
  border:1px solid #C8C4BA;
  border-radius:5px;
  padding:11px 12px;
  min-height:46px;
  font-size:.95rem;
  transition:.15s border,.15s box-shadow;
}
textarea{min-height:112px;resize:vertical}
input:hover,select:hover,textarea:hover{border-color:#9F9A90}
input:focus,select:focus,textarea:focus{
  outline:0;
  border-color:#9A773A;
  box-shadow:0 0 0 3px #cbb88c38;
}
input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible,button:focus-visible{
  outline:3px solid #AC843E;
  outline-offset:3px;
}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 22px}
.grid-wide{grid-column:1/-1}
.check{display:flex;flex-direction:row;align-items:center;gap:9px}
.check input{width:auto;min-height:auto;margin:0}
.filters{display:flex;align-items:end;gap:13px;flex-wrap:wrap;padding:18px 20px}
.filters label{margin:0;flex:1;min-width:145px}
.filters label:first-child{flex:2}
details.panel>summary{cursor:pointer;font-weight:600;list-style:none}
details.panel>summary::-webkit-details-marker{display:none}
details.panel[open]>summary{margin-bottom:24px}
.preference-box{
  grid-column:1/-1;
  background:#F2EEE6;
  border:1px solid #E1DBCF;
  border-radius:8px;
  padding:14px 16px;
  display:flex;
  gap:26px;
  flex-wrap:wrap;
  margin-bottom:16px;
}
.preference-box label{margin:0}
.preference-check{
  width:max-content;
  max-width:100%;
  background:#F5F1E9;
  border:1px solid #DED6C8;
  border-radius:7px;
  padding:12px 14px;
}

/* Tables */
.table-wrap{overflow:auto;padding:0}
table{border-collapse:collapse;width:100%;text-align:left;min-width:720px}
th{background:#F1EDE5;color:#58666F;font-size:.76rem;font-weight:600;letter-spacing:.25px}
th,td{padding:17px 18px;border-bottom:1px solid #E9E5DD;vertical-align:top}
td{font-size:.9rem}
tbody tr{transition:.12s background}
tbody tr:hover{background:#FCFBF8}
td a{text-decoration:none}
td a:hover{text-decoration:underline}
.empty{text-align:center;padding:52px 22px;color:var(--muted)}
.empty h2,.empty h3{color:var(--ink)}

/* Dashboard */
.crm-dashboard{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:0 0 24px;
}
.crm-stat{
  display:block;
  text-decoration:none;
  min-height:122px;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:10px;
  padding:19px 20px;
  box-shadow:0 6px 20px #071b2b06;
}
.crm-stat:hover{border-color:#C4B690;transform:translateY(-1px)}
.crm-stat span{display:block;font-size:.74rem;letter-spacing:1.2px;text-transform:uppercase;color:#68757C}
.crm-stat strong{display:block;font-family:Georgia,serif;font-size:2.2rem;font-weight:400;margin:8px 0 1px;color:#987B43}
.crm-stat small{font-size:.76rem}
.dashboard-intro{
  background:var(--navy);
  color:var(--ivory);
  border-radius:13px;
  padding:30px;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
}
.dashboard-intro .eyebrow{color:var(--champagne)}
.dashboard-intro h1{font-size:clamp(2rem,3vw,3rem);margin-bottom:8px}
.dashboard-intro p{color:#C7D0D5;margin:0;max-width:680px}
.dashboard-intro .button{background:var(--champagne);border-color:var(--champagne);color:var(--navy)}
.dashboard-intro .button:hover{background:#D9C9A6}

/* Inquiry detail */
.columns{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(330px,.8fr);gap:24px;align-items:start}
.columns>section.panel{position:sticky;top:108px}
.event{padding:16px 0;border-top:1px solid #E4E0D8}
.event:first-child{border-top:0}
.event strong{display:block}
.event small{margin:3px 0 7px}
.lead-preferences,.mini-tags,.match-tags{display:flex;gap:7px;flex-wrap:wrap}
.lead-preferences{margin:13px 0}
.lead-preferences span,.mini-tags span,.match-tags span{
  display:inline-flex;
  align-items:center;
  border:1px solid #D5C59F;
  background:#F5F0E5;
  color:#4E5960;
  border-radius:999px;
  padding:5px 9px;
  font-size:.72rem;
  font-weight:600;
}
.mini-tags{margin-top:7px}
.mini-tags span{padding:3px 7px;font-size:.68rem}

/* Smart pickers */
.smart-picker,.property-picker{position:relative}
.smart-picker-selected{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}
.smart-picker-chip{
  min-height:31px;
  padding:5px 9px;
  border:0;
  border-radius:999px;
  background:var(--navy);
  color:#fff;
  font-size:.75rem;
}
.smart-picker-options,.property-picker-results{
  display:none;
  position:absolute;
  z-index:40;
  left:0;right:0;
  top:50px;
  max-height:365px;
  overflow:auto;
  background:#fff;
  border:1px solid #C9C5BB;
  border-radius:8px;
  box-shadow:0 18px 45px #071b2b26;
  padding:7px;
}
.smart-picker.is-open .smart-picker-options,.property-picker.is-open .property-picker-results{display:grid}
.smart-picker-option,.property-picker-result{
  background:#fff;
  color:var(--ink);
  border:0;
  text-align:left;
  min-height:0;
  font-weight:500;
}
.smart-picker-option{padding:10px 12px;border-radius:5px}
.smart-picker-option:hover,.property-picker-result:hover,
.smart-picker-option.is-active,.property-picker-result.is-active{background:#EEE7D9}
.smart-picker-option.is-selected{background:var(--navy);color:#fff}
.property-picker-results{gap:4px}
.property-picker-result{
  display:grid;
  grid-template-columns:82px minmax(0,1fr);
  gap:12px;
  align-items:center;
  padding:8px;
  border-radius:7px;
}
.property-picker-result img,.property-picker-placeholder{
  width:82px;height:62px;
  border-radius:5px;
  object-fit:cover;
  background:#E8E2D7;
}
.property-picker-placeholder{display:grid;place-items:center;color:#8C7445;font-family:Georgia,serif;font-size:28px}
.property-picker-result-copy{display:block;min-width:0}
.property-picker-result-copy strong{display:block;font-size:.92rem}
.property-picker-result-copy>span{display:block;color:#66727A;font-size:.78rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.property-picker-result-copy small{font-size:.73rem}
.property-picker-choice{
  margin-top:8px;
  padding:10px 12px;
  background:#F3EFE7;
  border-left:3px solid var(--champagne);
  border-radius:4px;
  font-size:.84rem;
}
.property-picker-choice.has-choice{
  display:grid;
  grid-template-columns:82px minmax(0,1fr);
  gap:12px;
  align-items:center;
  background:var(--success);
}
.property-picker-choice.has-choice img,.property-picker-choice.has-choice .property-picker-placeholder{width:82px;height:62px;border-radius:5px;object-fit:cover}
.property-picker-clear{
  min-height:auto;
  padding:7px 0;
  background:transparent;
  color:var(--muted);
  border:0;
  text-decoration:underline;
  text-underline-offset:3px;
  font-size:.76rem;
}
.property-picker-clear:hover{background:transparent;color:var(--ink)}

/* Property cards/list */
.property-admin-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
}
.property-admin-card{
  overflow:hidden;
  background:#fff;
  border:1px solid var(--border);
  border-radius:11px;
  box-shadow:0 7px 22px #071b2b07;
}
.property-admin-card>a{display:block;text-decoration:none}
.property-admin-image{
  aspect-ratio:4/2.55;
  background:#E8E2D7;
  overflow:hidden;
  position:relative;
}
.property-admin-image img{width:100%;height:100%;object-fit:cover;display:block;transition:.2s transform}
.property-admin-card:hover .property-admin-image img{transform:scale(1.02)}
.property-admin-image .no-photo{height:100%;display:grid;place-items:center;font-family:Georgia,serif;font-size:46px;color:#A58C5C}
.property-admin-status{
  position:absolute;
  left:12px;top:12px;
  background:#fffffff2;
  border-radius:999px;
  padding:5px 9px;
  font-size:.7rem;
  font-weight:600;
}
.property-admin-body{padding:17px}
.property-admin-body .eyebrow{margin-bottom:6px}
.property-admin-body h2{font-size:1.04rem;margin:0 0 6px}
.property-admin-body p{font-size:.82rem;color:var(--muted);margin:5px 0}
.property-admin-price{display:block;font-size:1rem;margin-top:11px}
.property-toolbar{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:20px}

/* Property detail */
.property-admin-hero{
  display:grid;
  grid-template-columns:minmax(330px,.92fr) minmax(0,1.08fr);
  gap:28px;
  align-items:stretch;
  margin-bottom:24px;
}
.property-admin-cover{
  min-height:310px;
  border-radius:12px;
  overflow:hidden;
  background:#E8E2D7;
  box-shadow:0 8px 26px #071b2b0b;
}
.property-admin-cover img{width:100%;height:100%;min-height:310px;object-fit:cover;display:block}
.property-admin-cover .no-photo{height:100%;min-height:310px;display:grid;place-items:center;font-family:Georgia,serif;font-size:64px;color:#A58C5C}
.property-admin-summary{
  background:var(--navy);
  color:var(--ivory);
  border-radius:12px;
  padding:32px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.property-admin-summary .eyebrow{color:var(--champagne)}
.property-admin-summary h1{font-size:clamp(2rem,3vw,3rem)}
.property-admin-summary p{color:#C8D0D4;margin:4px 0}
.property-admin-summary .property-price{font-family:Georgia,serif;font-size:2rem;color:var(--champagne);margin:18px 0}
.property-admin-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.property-admin-actions .button.secondary{color:var(--ivory);border-color:#ffffff60}
.property-admin-actions .button.secondary:hover{background:#ffffff10}
.form-section{padding-top:8px}
.form-section+.form-section{border-top:1px solid #E6E1D8;margin-top:28px;padding-top:28px}
.form-section-title{display:flex;justify-content:space-between;gap:20px;align-items:end;margin-bottom:18px}
.form-section-title h2{margin:0}
.photo-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px}
.photo-grid figure{margin:0}
.photo-grid img{width:100%;height:180px;object-fit:cover;border-radius:8px}
.photo-grid figcaption{font-size:.76rem;color:var(--muted);margin-top:5px}

/* Matching */
.search-summary{display:flex;justify-content:space-between;align-items:flex-end;gap:24px}
.search-summary h2{margin:4px 0 7px}
.section-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:18px;margin-bottom:16px}
.section-heading h2{margin:4px 0 0}
.match-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px}
.report-actions{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:20px}
@media print{.crm-topbar,.crm-mobile-nav,.no-print{display:none!important}.crm-shell{max-width:none;padding:0}.panel{break-inside:avoid;box-shadow:none}.table-wrap{overflow:visible}body{background:#fff}a{color:inherit}}
.match-reasons{margin:12px 0 0;padding:10px 10px 10px 25px;background:#F4F1EA;border-left:3px solid #CBB88C;font-size:.8rem;color:var(--ink)}
.match-card-body .match-confirmed{margin-top:12px;color:#246147;font-size:.78rem}
.smart-picker-add{border-top:1px solid #EEE7D9}
.match-card{
  display:grid;
  grid-template-columns:155px minmax(0,1fr);
  min-height:145px;
  overflow:hidden;
  padding:0;
  border:1px solid #E1DDD4;
  border-radius:9px;
  background:#fff;
}
.match-photo{display:block;background:#E8E2D7;min-height:145px}
.match-photo img{width:100%;height:100%;min-height:145px;object-fit:cover;display:block}
.match-photo span{height:100%;display:grid;place-items:center;font-family:Georgia,serif;font-size:42px;color:#A58C5C}
.match-card-body{padding:15px 17px;min-width:0}
.match-card-body p{margin:5px 0;color:var(--muted);font-size:.82rem}
.match-card-body>strong{display:block;font-size:1rem;margin-top:8px}
.match-address{display:block;font-size:.98rem;font-weight:600;margin-top:6px;text-decoration:none}
.match-title{font-size:.78rem!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.match-grid.compact .match-card{grid-template-columns:110px minmax(0,1fr);min-height:100px}
.match-grid.compact .match-photo,.match-grid.compact .match-photo img{min-height:100px}

/* Login */
.login{
  margin:0;
  min-height:100vh;
  max-width:none;
  display:grid;
  place-items:center;
  padding:24px;
  background:var(--navy);
}
.login .panel{width:min(440px,100%);padding:36px}
.login .panel:before{
  content:"MATTICOLI";
  display:block;
  letter-spacing:5px;
  font-weight:500;
  margin-bottom:26px;
}
.login button{width:100%}

/* Public preview: intentionally simple, but never traps a logged-in CRM user */
.public{
  width:min(1180px,100%);
  margin:0 auto;
  padding:34px clamp(20px,5vw,60px) 80px;
}
.public>header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:18px 0 24px;
  border-bottom:1px solid var(--border);
  margin-bottom:36px;
}
.public .brand{font-size:1.2rem;letter-spacing:5px;text-decoration:none}
.crm-return-bar{
  position:sticky;top:0;z-index:1200;
  background:var(--navy);
  color:var(--ivory);
  padding:10px 5%;
  display:flex;
  justify-content:center;
}
.crm-return-bar a{color:var(--champagne);font-size:.84rem;font-weight:600}

/* Responsive */
@media(max-width:1180px){
  .crm-topbar{grid-template-columns:auto 1fr;min-height:auto;padding-top:17px;padding-bottom:13px}
  .crm-nav{grid-column:1/-1;grid-row:2;justify-content:flex-start;overflow-x:auto;flex-wrap:nowrap;padding-bottom:2px}
  .crm-account{grid-column:2;grid-row:1}
  .property-admin-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:850px){
  .crm-topbar{position:sticky;display:flex;justify-content:space-between;padding:16px 20px;min-height:72px}
  .crm-nav{display:none}
  .crm-account strong,.crm-account small{display:none}
  .crm-mobile-nav{
    position:sticky;top:72px;z-index:950;
    display:flex;
    overflow-x:auto;
    background:#0B2638;
    color:#E6ECEF;
    padding:0 12px;
    border-bottom:1px solid #ffffff16;
  }
  .crm-mobile-nav a{flex:0 0 auto;text-decoration:none;padding:11px 12px;font-size:.78rem}
  .crm-shell{padding:30px 18px 70px}
  .crm-dashboard{grid-template-columns:repeat(2,minmax(0,1fr))}
  .columns{grid-template-columns:1fr}
  .columns>section.panel{position:static}
  .property-admin-hero{grid-template-columns:1fr}
  .property-admin-cover,.property-admin-cover img,.property-admin-cover .no-photo{min-height:250px}
  .match-grid{grid-template-columns:1fr}
}
@media(max-width:620px){
  h1{font-size:2.1rem}
  .crm-brand-name{font-size:1rem;letter-spacing:3.8px}
  .crm-account{gap:7px}
  .crm-logout{padding:6px 8px}
  .crm-shell>header,.page-heading{align-items:flex-start;flex-direction:column;gap:10px}
  .grid{grid-template-columns:1fr}
  .grid-wide{grid-column:auto}
  .panel{padding:20px}
  .filters{align-items:stretch}
  .filters label{min-width:100%}
  .dashboard-intro{display:block;padding:24px}
  .dashboard-intro .button{margin-top:20px}
  .crm-dashboard{grid-template-columns:1fr 1fr;gap:10px}
  .crm-stat{min-height:108px;padding:15px}
  .crm-stat strong{font-size:1.8rem}
  .property-admin-grid{grid-template-columns:1fr}
  .property-toolbar{align-items:flex-start;flex-direction:column}
  .search-summary{display:block}
  .match-card{grid-template-columns:105px minmax(0,1fr)}
  .property-picker-result{grid-template-columns:68px minmax(0,1fr)}
  .property-picker-result img,.property-picker-placeholder{width:68px;height:54px}
  .property-picker-choice.has-choice{grid-template-columns:68px minmax(0,1fr)}
  .property-picker-choice.has-choice img,.property-picker-choice.has-choice .property-picker-placeholder{width:68px;height:54px}
  table{min-width:660px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

.feature-group{padding:16px 0;border-bottom:1px solid #ded8ca}.feature-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px;margin:12px 0}.form-section>summary{cursor:pointer;padding:12px 0;font-size:18px}.form-section[hidden]{display:none}
@media print{table{min-width:0;font-size:.8rem}.crm-topbar,.crm-mobile-nav,.no-print{display:none!important}}
