/* ==========================================================================
   Design tokens
   Palette: indigo (#3654F4) + coral accent (#FF6A3D) — modern HomeQuote Pro brand
   Clean white/near-white surfaces, dark ink text, muted slate for secondary text
   Type: "Inter" throughout (modern SaaS sans, no serif)
   Concept: a fast, trustworthy comparison app — not a job-site ledger.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #3654F4;        /* primary (was navy) */
  --navy-deep: #1E2C9E;   /* primary-dark (was navy-deep) */
  --gold: #FF6A3D;        /* accent (was gold) */
  --gold-bright: #FF8863; /* accent-bright (was gold-bright) */
  --paper: #F6F7FB;       /* page background (was paper) */
  --paper-line: #E7E9F0;  /* borders (was paper-line) */
  --ink: #14161A;
  --slate: #6B7280;
  --ok: #16A34A;
  --warn: #DC2626;
  --radius: 12px;
  --serif: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

a { color: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.site-header {
  background: var(--navy);
  color: var(--paper);
  padding: 28px 20px 26px;
  position: relative;
margin-top: 6px;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: 0.01em;
}

.brand-tagline {
  color: var(--gold-bright);
  font-size: 0.92rem;
  margin-top: 4px;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Landing hero (search view). Photo is optional and admin-editable via
   siteSettings/homepage in Firestore (see loadHeroImage in app.js and the
   "Homepage hero photo" control in the Companies admin tab) — with no photo
   set, this stays a plain brand-color gradient, never a stock/fake image. */
.hero-landing {
  margin: 0 -20px;
}
.hero-banner {
  position: relative;
  min-height: 300px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  background-size: cover;
  background-position: center 30%;
  display: flex;
  align-items: flex-end;
  padding: 30px 20px 30px;
  color: #fff;
  overflow: hidden;
}
.hero-banner.has-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,12,20,0.25) 0%, rgba(10,12,20,0.5) 55%, rgba(10,12,20,0.85) 100%);
}
.hero-banner-content {
  position: relative;
  z-index: 1;
}
.hero-banner h1 {
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  text-shadow: 0 2px 14px rgba(0,0,0,0.3);
}
.hero-banner p.lead {
  font-size: 0.92rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
  max-width: 340px;
  margin: 0;
}
.hero-search-card {
  background: #fff;
  margin: -30px 20px 0;
  position: relative;
  z-index: 2;
  border-radius: var(--radius);
  padding: 18px 18px 8px;
  box-shadow: 0 18px 40px -18px rgba(20,22,26,0.35);
}
.trust-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 20px 0;
}
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EEF1FE;
  color: var(--navy-deep);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 99px;
}
.how-section {
  padding: 30px 20px 10px;
}
.how-section h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 16px;
}
.step-row {
  display: flex;
  gap: 13px;
  margin-bottom: 18px;
}
.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #EEF1FE;
  color: var(--navy-deep);
  font-weight: 800;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-text b {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
}
.step-text span {
  font-size: 0.82rem;
  color: var(--slate);
  line-height: 1.4;
}

/* Admin: homepage hero photo control (Companies tab) */
.hero-settings-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  background: #fff;
}
.hero-settings-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: var(--paper);
  flex-shrink: 0;
  border: 1px solid var(--paper-line);
}
.hero-settings-info {
  flex: 1;
  min-width: 180px;
}
.hero-settings-info p {
  margin: 0;
}
.hero-settings-title {
  font-weight: 700;
  font-size: 0.88rem;
}
.hero-settings-sub {
  font-size: 0.78rem;
  color: var(--slate);
  margin-top: 2px !important;
}

.directory {
  padding: 34px 0 8px;
}

.directory h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.directory p.lead {
  color: var(--slate);
  margin: 0 0 22px;
  font-size: 0.96rem;
}

.company-ledger {
  border-top: 1px solid var(--paper-line);
}

.company-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--paper-line);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}

.company-row:hover .company-name { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }

.company-main .company-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  display: block;
}

.company-main .company-services {
  color: var(--slate);
  font-size: 0.88rem;
  margin-top: 3px;
}

.company-badges {
  display: block;
  margin-top: 6px;
}

.trust-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ok);
  background: #E9F1EB;
  padding: 2px 8px;
  border-radius: 20px;
  margin-right: 6px;
}

.company-license {
  display: block;
  font-size: 0.76rem;
  color: var(--slate);
  margin-top: 5px;
}

.company-loc {
  color: var(--slate);
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.form-card {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 3px double var(--paper-line);
}

.form-card h2 {
  font-family: var(--serif);
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.form-card .sub {
  color: var(--slate);
  font-size: 0.92rem;
  margin: 0 0 22px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--slate);
  font-weight: 400;
  margin-left: 6px;
}

input[type=text], input[type=tel], input[type=email], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--paper-line);
  background: #fff;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--ink);
}

textarea { resize: vertical; min-height: 90px; }

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--paper-line);
}

.lead-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.lead-photos img {
  cursor: pointer;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--paper-line);
}

.company-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.gallery-photo-wrap {
  position: relative;
  display: inline-block;
}
.gallery-photo-wrap img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  margin: 4px;
}
.delete-photo-btn {
  position: absolute;
  top: 0px;
  right: 0px;
  background: rgba(200,0,0,0.85);
  color: #fff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.company-gallery img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--paper-line);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

fieldset {
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 12px 14px 6px;
  margin: 0 0 18px;
}
.modern-company-form fieldset { margin-top: 10px; }

fieldset legend {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  padding: 0 6px;
}

.radio-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink);
}

.btn-primary {
  background: var(--navy);
  color: var(--paper);
  border: none;
  padding: 13px 22px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  width: 100%;
}

.btn-primary:hover { background: var(--navy-deep); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.88rem;
  color: var(--slate);
  text-decoration: none;
}
.back-link:hover { color: var(--navy); }

.form-status {
  margin-top: 14px;
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: var(--radius);
  display: none;
}
.form-status.show { display: block; }
.form-status.ok {
  background: #1f7a3f;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 16px;
  border: 2px solid #145c2c;
}
.form-status.err {
  background: #a33c1e;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 16px;
  border: 2px solid #7a2c14;
}

footer.site-footer {
  text-align: center;
  color: var(--slate);
  font-size: 0.78rem;
  padding: 40px 20px 30px;
}

.panel-tabs {
  display: flex;
  gap: 6px;
  padding-top: 22px;
}

.tab-btn {
  background: none;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--navy);
  color: var(--paper);
  border-color: var(--navy);
}

.company-row-admin {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--paper-line);
}

.company-row-admin .company-name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.company-row-admin .company-services { color: var(--slate); font-size: 0.85rem; margin-top: 3px; }

.link-btn {
  background: none;
  border: none;
  color: var(--slate);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  white-space: nowrap;
}
.link-btn:hover { color: var(--navy); }
.link-btn.danger:hover { color: var(--warn); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header .brand-mark { font-size: 1.35rem; }

#signOutBtn {
  background: none;
  border: 1px solid rgba(246,243,236,0.4);
  color: var(--paper);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
}
#signOutBtn:hover { background: rgba(246,243,236,0.12); }

.login-screen {
  max-width: 360px;
  margin: 60px auto;
  padding: 0 20px;
}

.login-screen h1 {
  font-family: var(--serif);
  font-size: 1.4rem;
  margin-bottom: 18px;
}

.notice-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--gold-bright);
  color: var(--navy-deep);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 20px;
}
.notice-bar.show { display: flex; }

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-toolbar h1 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0;
}

.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--sans);
  font-size: 0.85rem;
}

.lead-ledger {
  border-top: 1px solid var(--paper-line);
  padding-bottom: 40px;
}

.lead-row {
  border-bottom: 1px solid var(--paper-line);
  padding: 16px 0;
}

.lead-row.is-new { background: linear-gradient(90deg, #FBF3E1, transparent 18%); }

.lead-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  cursor: pointer;
}

.lead-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
}

.lead-new-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 7px;
  vertical-align: middle;
}

.lead-meta {
  color: var(--slate);
  font-size: 0.82rem;
  margin-top: 2px;
}

.lead-when {
  color: var(--slate);
  font-size: 0.8rem;
  white-space: nowrap;
}

.lead-detail {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--paper-line);
  font-size: 0.92rem;
}

.lead-detail.open { display: block; }

.lead-detail dl {
  display: grid;
  grid-template-columns: 100px 1fr;
  row-gap: 8px;
  column-gap: 10px;
  margin: 0 0 14px;
}

.lead-detail dt { color: var(--slate); font-size: 0.82rem; }
.lead-detail dd { margin: 0; }

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}

.status-select {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--paper-line);
  font-family: var(--sans);
  font-size: 0.88rem;
}

.status-tag {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: none;
}
.status-tag.nuevo { background: #FBF3E1; color: #8A6115; }
.status-tag.contactado { background: #E4EAF3; color: var(--navy); }
.status-tag.cotizado { background: #EAE3F2; color: #5B3B8C; }
.status-tag.ganado { background: #E9F1EB; color: var(--ok); }
.status-tag.perdido { background: #F6E7E1; color: var(--warn); }

.empty-state {
  padding: 50px 0;
  text-align: center;
  color: var(--slate);
}

.empty-state .serif { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); display: block; margin-bottom: 6px; }

@media (max-width: 480px) {
  .row-2 { grid-template-columns: 1fr; }
  .lead-detail dl { grid-template-columns: 84px 1fr; }
}

.company-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.company-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.company-card.selected {
  border-color: #1a73e8;
  border-width: 2px;
}
.company-card-checkbox {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.company-card-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}
.company-card-info {
  flex: 1;
}
.company-card-name {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}
.company-card-loc {
  margin: 0;
  font-size: 13px;
  color: #666;
}

.profile-view { padding-bottom: 96px; padding-top: 18px; }

.profile-card {
  text-align: center;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: 10px;
  padding: 24px 20px;
  margin-top: 14px;
}
.profile-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  display: block;
}
.profile-card h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}
.profile-meta {
  font-size: 0.86rem;
  color: var(--slate);
  margin: 5px 0 0;
}

.profile-project-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: 10px;
  padding: 20px;
  margin-top: 14px;
  text-align: center;
}
.profile-project-label {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
  margin-bottom: 4px;
}
.free-estimate-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #8A6115;
  margin-bottom: 10px;
}
.profile-project-context {
  color: var(--slate);
  font-size: 0.86rem;
  margin: 0 0 14px;
}
.profile-project-card .btn-primary {
  background: var(--gold);
}
.profile-project-card .btn-primary:hover { background: #9c7526; }
.profile-project-note {
  display: block;
  color: var(--slate);
  font-size: 0.78rem;
  margin-top: 10px;
}

.profile-section {
  padding: 22px 2px 0;
}
.profile-section:first-of-type { margin-top: 4px; }
.profile-section h3 {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-line);
}
.profile-about-text {
  color: var(--ink);
  font-size: 0.94rem;
  margin: 0;
  white-space: pre-line;
}

.profile-overview-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.profile-overview-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.92rem;
  color: var(--ink);
}
.profile-overview-list .overview-icon {
  flex-shrink: 0;
  color: var(--gold);
  margin-top: 1px;
}
.profile-overview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.service-chip {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  padding: 3px 10px;
  border-radius: 20px;
}

.profile-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  padding: 4px 0 12px;
}
.profile-gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}
.gallery-thumb-wrap {
  position: relative;
}
.gallery-more-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.full-gallery-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  overflow-y: auto;
  padding: 70px 16px 30px;
}
.full-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
}
.full-gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.lightbox-close {
  position: fixed; top: 16px; right: 16px; z-index: 1001;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1;
}
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 1001;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  width: 44px; height: 44px; border-radius: 50%; font-size: 20px;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.sticky-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 12px 16px;
  z-index: 50;
} .profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 8px 0;
}
.profile-badge {
  background: #e8f0fe;
  color: #1a4d8f;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid #b3d1f5;
}
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100; display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}
.profile-contact-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--navy, #1c2b4a);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--navy, #1c2b4a);
  background: #fff;
}
.contact-pill:hover {
  background: #f2f2f2;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e6e1d3;
  border-top: 4px solid #c9a227;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
.admin-lightbox-delete {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-bright);
  color: var(--navy-deep);
  border: none;
  padding: 9px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1001;
  cursor: pointer;
}
.admin-lightbox-delete:hover { background: #e2b95c; }

.company-row-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.company-row-avatar-empty {
  display: inline-block;
  background: var(--paper);
  border: 1px dashed var(--paper-line);
}

.company-reviews-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--paper);
  border-radius: 8px;
}
.reviews-panel-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.98rem;
  margin: 0 0 10px;
  color: var(--ink);
}
.admin-review-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.admin-review-card:last-child { margin-bottom: 0; }
.admin-reply-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 10px 0 4px;
}
.admin-reply-input {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.86rem;
  margin-bottom: 8px;
}
.admin-review-actions {
  display: flex;
  gap: 8px;
}
.delete-review-btn {
  background: none;
  border: 1px solid var(--paper-line);
  color: var(--warn);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 3px;
  cursor: pointer;
}
.delete-review-btn:hover { border-color: var(--warn); }
/* ==========================================================================
   Unified app additions: discreet admin access, login modal, wizard steps,
   field validation, coverage message, thank-you polish, photo upload cards
   ========================================================================== */

.admin-trigger {
  cursor: default;
  user-select: none;
}

.login-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(11, 23, 40, 0.6);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-modal-overlay.show { display: flex; }
.login-modal {
  position: relative;
  background: var(--paper);
  border-radius: 6px;
  padding: 32px 26px 26px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.login-modal h1 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0 0 16px;
}
.modal-close-x {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--slate);
  cursor: pointer;
  padding: 4px;
}
.modal-close-x:hover { color: var(--navy); }

.field-invalid {
  border-color: var(--warn) !important;
  box-shadow: 0 0 0 3px rgba(164, 75, 46, 0.14) !important;
}
.field-error-msg {
  color: var(--warn);
  font-size: 0.8rem;
  margin: 6px 0 0;
  display: none;
}
.field-error-msg.show { display: block; }

.step-nav {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.step-nav .btn-secondary {
  background: none;
  border: 1px solid var(--paper-line);
  color: var(--navy);
  padding: 13px 22px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  flex: 1;
}
.step-nav .btn-secondary:hover { background: #fff; border-color: var(--navy); }
.step-nav .btn-primary { flex: 2; width: auto; }

.wizard-step { display: block; }

.coverage-empty {
  text-align: center;
  padding: 46px 24px;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: 10px;
  margin-top: 10px;
}
.coverage-empty .coverage-icon {
  color: var(--slate);
  margin-bottom: 12px;
}
.coverage-empty h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.coverage-empty p {
  color: var(--slate);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 380px;
}
.rescue-form {
  text-align: left;
  max-width: 380px;
  margin: 22px auto 0;
  padding-top: 20px;
  border-top: 1px dashed var(--paper-line);
}
.rescue-form-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 14px;
  text-align: center;
}
.rescue-form-status {
  display: none;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ok);
  background: #E9F1EB;
  padding: 12px 16px;
  border-radius: 20px;
  margin-top: 6px;
}
.rescue-form-status.show { display: block; }

.thankyou-icon-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.thankyou-next {
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 0 0 24px;
}
.thankyou-next p {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.thankyou-next ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.7;
}

.photo-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 6px 0 18px;
}
.photo-upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: 1.5px dashed var(--paper-line);
  border-radius: 8px;
  padding: 18px 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.photo-upload-card:hover {
  border-color: var(--gold);
  background: #FBF7EE;
}
.photo-upload-card svg { color: var(--navy); }
/* Modernized company-edit/add form (Companies admin tab) */
.modern-company-form .section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  margin: 26px 0 12px;
}
.modern-company-form .section-label:first-child { margin-top: 0; }
.modern-company-form .section-label-hint {
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--slate);
  opacity: 0.85;
}
.modern-company-form .services-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modern-company-form .services-checklist label {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--paper-line);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.modern-company-form .services-checklist label:has(input:checked) {
  background: #EEF1FE;
  border-color: var(--navy);
  color: var(--navy-deep);
  font-weight: 800;
}
.modern-company-form .services-checklist input {
  margin-right: 6px;
}
.photo-upload-card .photo-upload-label {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--navy);
}
.photo-upload-card .photo-upload-sub {
  font-size: 0.74rem;
  color: var(--slate);
}
.photo-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.photo-upload-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--paper-line);
}

.photo-btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  color: var(--navy);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
  margin-right: 8px;
  margin-top: 6px;
}
.photo-btn-chip:hover { background: #fff; border-color: var(--gold); }
.photo-btn-chip svg { flex-shrink: 0; }

/* ==========================================================================
   Project details step, reviews, and rating badges
   ========================================================================== */

.question-group {
  margin-bottom: 22px;
}
.question-group-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 10px;
}
.option-chip {
  display: block;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 0.94rem;
  color: var(--ink);
  cursor: pointer;
  background: #fff;
}
.option-chip input {
  margin-right: 10px;
}
.option-chip.selected {
  border-color: var(--gold);
  background: #FBF7EE;
  color: var(--navy);
  font-weight: 600;
}
.question-group.field-invalid .question-group-label {
  color: var(--warn);
}
.question-group.field-invalid .option-chip {
  border-color: var(--warn);
}
.option-other-input {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.question-group.field-invalid .option-other-input {
  border-color: var(--warn);
}

.badge-free-estimate {
  display: inline-block;
  background: var(--navy);
  color: var(--paper);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
}
.badge-rating {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--gold);
  color: #8A6115;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 3px;
}

.profile-reviews-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.review-card {
  border-bottom: 1px solid var(--paper-line);
  padding-bottom: 14px;
}
.review-card:last-child { border-bottom: none; }
.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.review-stars {
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 600;
}
.review-date {
  color: var(--slate);
  font-size: 0.78rem;
  white-space: nowrap;
}
.review-comment {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--ink);
}
.review-author {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}
.review-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.review-photos img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--paper-line);
}
.review-reply {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 6px;
  border-left: 3px solid var(--gold);
}
.review-reply-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 3px;
}
.review-reply p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink);
}

.profile-rating-row {
  margin: 4px 0 6px;
}
.rating-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 16px;
}
.breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--slate);
}
.breakdown-label { width: 34px; flex-shrink: 0; }
.breakdown-track {
  flex: 1;
  height: 6px;
  background: var(--paper);
  border-radius: 3px;
  overflow: hidden;
}
.breakdown-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
}
.breakdown-pct { width: 34px; text-align: right; flex-shrink: 0; }

.star-picker {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 34px;
  margin: 6px 0 18px;
}
.star-picker span {
  color: var(--paper-line);
  cursor: pointer;
}
.star-picker span.selected {
  color: var(--gold);
}

.status-tag.completed { background: var(--navy); color: #fff; }
.status-tag.out-of-area { background: #F6E7E1; color: var(--warn); }

/* HomeQuote Pro platform rating (public display, independent of contractor reviews) */
.hqp-public-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hqp-public-rating-stars {
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 1px;
}
.hqp-public-rating-avg {
  font-weight: 700;
  color: var(--ink);
}
.hqp-public-rating-count {
  color: var(--slate);
  font-size: 0.85rem;
}
.hqp-public-rating-quote {
  text-align: center;
  color: var(--slate);
  font-size: 0.88rem;
  font-style: italic;
  margin-top: 8px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.btn-mark-complete {
  display: inline-block;
  background: var(--navy);
  color: var(--paper);
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-mark-complete:hover { background: var(--navy-deep); }
.btn-request-review {
  display: inline-block;
  background: var(--gold);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-request-review:hover { background: #9c7526; }
.review-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--paper-line);
}
.review-status-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ok);
  background: #E9F1EB;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ==================== NEW: chat, resume banner, PWA install, analytics, goals ==================== */

.progress-step-label {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 998;
  font-size: 11px;
  color: var(--slate);
  background: var(--paper);
  padding: 2px 8px;
  border-radius: 20px;
}

.resume-banner {
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  z-index: 997;
  background: var(--navy);
  color: var(--paper);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.resume-icon { font-style: normal; margin-right: 6px; }
.resume-btn-continue, .resume-btn-dismiss {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--paper);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.resume-btn-dismiss { border-color: transparent; opacity: 0.7; }

.trust-message {
  text-align: center;
  font-size: 12px;
  color: var(--slate);
  margin: 4px 0 12px;
}

.thankyou-chat-btns { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.thankyou-chat-btns .btn-secondary { width: 100%; }

.install-banner-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 995;
  background: #EEF2F8;
  border-top: 1px solid var(--paper-line);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--navy);
}
.install-banner-btn {
  background: var(--navy);
  color: var(--paper);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  max-height: 420px;
  overflow-y: auto;
  padding: 10px 0;
}
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}
.chat-bubble-them {
  align-self: flex-start;
  background: #EFEBDF;
  color: var(--ink);
}
.chat-bubble-me {
  align-self: flex-end;
  background: var(--navy);
  color: var(--paper);
}
.chat-bubble-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--paper-line);
  padding-top: 10px;
}
.chat-input-row input { flex: 1; min-width: 0; }
.chat-input-row .btn-primary { width: auto; flex: 0 0 auto; white-space: nowrap; }

.my-messages-link { color: var(--paper); text-decoration: underline; font-size: inherit; }

.messages-fab {
  position: fixed;
  bottom: 70px;
  right: 18px;
  z-index: 996;
  background: var(--navy);
  color: var(--paper);
  border: none;
  padding: 12px 18px;
  border-radius: 30px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  display: none;
  align-items: center;
  gap: 6px;
}
.messages-fab .unread-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
}

.client-dashboard { padding: 10px 0; }
.client-dashboard-header { margin-bottom: 14px; }
.client-dashboard-row {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.tab-badge {
  background: var(--warn);
  color: #fff;
  font-size: 11px;
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 4px;
}

.messages-inbox { display: flex; flex-direction: column; gap: 8px; }
.message-thread-row {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.message-thread-row.unread { border-left: 3px solid var(--warn); }
.message-thread-name { font-weight: 600; font-size: 14px; }
.message-thread-name .unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  margin-left: 6px;
}
.message-thread-preview { font-size: 12px; color: var(--slate); margin-top: 2px; }
.message-thread-time { font-size: 11px; color: var(--slate); white-space: nowrap; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.analytics-metric-card {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 14px;
}
.analytics-metric-label { font-size: 12px; color: var(--slate); margin: 0; }
.analytics-metric-value { font-size: 22px; font-weight: 600; color: var(--navy); margin: 4px 0 0; }

.analytics-funnel { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.analytics-funnel-row {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.analytics-table { width: 100%; font-size: 13px; border-collapse: collapse; margin-bottom: 20px; }
.analytics-table th { text-align: left; color: var(--slate); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--paper-line); }
.analytics-table td { padding: 6px 4px; border-bottom: 1px solid var(--paper-line); }
.analytics-table td.num, .analytics-table th.num { text-align: right; }

.goal-bar-wrap { margin-bottom: 14px; }
.goal-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.goal-bar-track { background: #EFEBDF; border-radius: 8px; height: 10px; overflow: hidden; }
.goal-bar-fill { height: 100%; background: var(--gold); }
.goal-bar-sub { font-size: 11px; color: var(--slate); margin-top: 2px; }

.analytics-goals-form, .analytics-spend-form {
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
}
.analytics-goals-form .row-2, .analytics-spend-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
