/* Mobile-first, minimal. */
:root { --brand: #1b3a5b; --accent: #1b3a5b; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #1b1f24;
  background: #f5f6f8;
}
a { color: #1a5fb4; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 1rem;
  background: var(--brand); color: #fff;
}
.topbar a, .topbar .role { color: #fff; }
.topbar .brand { font-weight: 700; font-size: 1.1rem; display: inline-flex; align-items: center; gap: .5rem; }
.brandlogo { height: 24px; width: auto; border-radius: 4px; background: #fff; }
.herologo { height: 64px; width: auto; margin-bottom: .5rem; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
/* Marketing (no-role) header: white bar so the contractor's own logo reads. */
.topbar-light { background: #fff; color: var(--brand); border-bottom: 1px solid #e6e8ec; }
.topbar-light a, .topbar-light .role, .topbar-light .brand { color: var(--brand); }
.topbar-light .brandlogo { background: transparent; border-radius: 0; height: 30px; }
.role { opacity: .8; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
/* Hamburger nav toggle: hidden on desktop, collapses the menu on mobile. */
.navtoggle { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 42px; height: 38px; padding: 8px 9px; background: transparent; border: 1px solid currentColor; border-radius: 6px; color: inherit; cursor: pointer; }
.navtoggle span { display: block; width: 100%; height: 2px; background: currentColor; border-radius: 2px; }
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; }
  .navtoggle { display: inline-flex; }
  .topbar nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; margin-top: .5rem; }
  .topbar nav.open { display: flex; }
  .topbar nav > * { padding: .6rem .25rem; border-top: 1px solid rgba(127,127,127,.22); }
  .topbar nav form.inline { display: block; }
}
.navbadge { background: #e11d48; color: #fff; border-radius: 999px; padding: 0 .4rem; font-size: .75rem; }
.card.unread { border-left: 3px solid #1a5fb4; }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem; }

/* Header row: title on the left, primary action on the right */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin: .2rem 0; }
.crumb { margin: 0 0 .25rem; }

/* Two-column layout (main + sidebar) on wider screens; stacks on mobile */
.layout { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 820px) {
  .layout { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
  .sidebar { position: sticky; top: 1rem; }
}

/* Forms read better constrained */
.formcard { max-width: 680px; }

/* Definition list for sidebar facts */
.facts { margin: 0; }
.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; margin-top: .5rem; }
.facts dd { margin: 0; }

h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1rem; margin: 0 0 .5rem; color: #444; }
.muted { color: #6b7280; }

.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 1rem; margin: .75rem 0;
}
.stack > * { display: block; width: 100%; margin-bottom: .75rem; }
.stack input, .stack textarea, .stack select {
  width: 100%; padding: .6rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit;
}

.btn {
  display: inline-block; background: #1a5fb4; color: #fff; border: 0;
  padding: .6rem 1rem; border-radius: 8px; font: inherit; cursor: pointer;
}
.btn:hover { background: #154c91; text-decoration: none; }
.btn.small { padding: .4rem .7rem; font-size: .9rem; }
.btn.danger { background: #991b1b; }
.declinebox summary { cursor: pointer; font-weight: 600; }

/* Project milestone timeline (portal + job detail) */
.timeline { list-style: none; padding: 0; margin: .5rem 0 1rem .55rem; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; border-left: 2px solid #e2e6ea; }
.timeline li:last-child { padding-bottom: .2rem; border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: .15rem; width: 14px; height: 14px; border-radius: 50%; background: #e2e6ea; }
.timeline li.done::before { background: var(--brand); }
.timeline li.current::before { background: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.timeline li.current .t-label { font-weight: 700; color: var(--brand); }
.timeline li.upcoming .t-label { color: #8a929d; }
.t-date { color: #7a828d; font-size: .85rem; margin-left: .4rem; }
.t-now { background: var(--accent); color: #1b1f24; font-size: .7rem; font-weight: 700; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; margin-left: .45rem; }
.nextstep { background: #f1f5f9; border-left: 4px solid var(--accent); padding: .75rem 1rem; border-radius: 6px; }
.holdbanner { background: #fef3c7; color: #92400e; padding: .6rem .9rem; border-radius: 6px; }
.hp { position: absolute; left: -9999px; }

/* Category filter chips (showcase gallery) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { padding: .3rem .8rem; border: 1px solid #cbd5e1; border-radius: 999px; font-size: .9rem; color: #1b1f24; }
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.linenote { font-size: .88rem; }
.stars { color: #f3b415; letter-spacing: .1em; }
.nudgecard { border-left: 4px solid var(--accent); }

/* Dashboard KPI strip + filter bar */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: #fff; border-radius: 10px; padding: .8rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.kpi-num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--brand); }
.kpi-label { color: #7a828d; font-size: .85rem; }
.filterbar { margin-bottom: 1rem; align-items: center; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

/* Onboarding checklist */
.onboard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.meter { height: 8px; background: #e2e6ea; border-radius: 999px; overflow: hidden; margin: .4rem 0 .8rem; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.onboardlist { list-style: none; padding: 0; margin: 0; }
.onboardlist li { display: flex; align-items: baseline; gap: .5rem; padding: .3rem 0; }
.onboardlist li.done { color: #8a929d; }
.onboardlist .tick { width: 1.1rem; color: var(--brand); font-weight: 700; flex-shrink: 0; }

.resourcelist { list-style: none; padding: 0; margin: 0; }
.resourcelist li { padding: .55rem 0; border-bottom: 1px solid #eef0f3; }
.resourcelist li:last-child { border-bottom: 0; }
.resourcelist a { font-weight: 600; }
.resourcelist p { margin: .15rem 0 0; font-size: .92rem; }

/* Stack read-only line-item tables on phones */
@media (max-width: 600px) {
  .lineitems.stackable thead { display: none; }
  .lineitems.stackable tr { display: block; border-bottom: 1px solid #eef0f3; padding: .5rem 0; }
  .lineitems.stackable td, .lineitems.stackable tfoot th { display: block; border: 0; padding: .15rem .5rem; text-align: left; }
  .lineitems.stackable td::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 600; color: #7a828d; text-transform: uppercase; letter-spacing: .04em; }
  .lineitems.stackable td[data-label="Description"]::before { content: none; }
  .lineitems.stackable tfoot tr { border-bottom: 0; }
  .lineitems.stackable tfoot th[colspan] { display: none; }
}
.errorlist { margin: .2rem 0 .4rem; padding: .45rem .6rem .45rem 1.5rem; list-style-position: inside; color: #991b1b; background: #fee2e2; border-radius: 6px; font-size: .9rem; }
button[disabled], .btn[disabled] { opacity: .6; cursor: default; pointer-events: none; }
.declinebox textarea { width: 100%; padding: .5rem; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.linkbtn { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; text-decoration: underline; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.joblist { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .joblist { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.joblist .card { margin: 0; }
.joblink { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.jobtitle { font-weight: 600; }

.badge {
  font-size: .8rem; padding: .15rem .5rem; border-radius: 999px;
  background: #e5e7eb; color: #374151; white-space: nowrap;
}
.status-approved, .status-completed, .status-closed { background: #d1fae5; color: #065f46; }
.status-on_hold, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-in_progress, .status-scheduled { background: #dbeafe; color: #1e40af; }

.qa { border-bottom: 1px solid #eef0f3; padding: .5rem 0; }
.qa p { margin: .2rem 0; }
.qa-reply { margin-left: 1.25rem; padding-left: .75rem; border-left: 2px solid #dbe3ea; }

.vcard { display: flex; flex-direction: column; gap: 1rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem; max-width: 560px; }
.vcard-body { width: 100%; }
.vcard-name { font-weight: 600; margin: .2rem 0; }
.vcard-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.vcard-qr { text-align: center; }
.vcard-qr img { width: min(200px, 60vw); height: auto; }

/* Photo enhancer: thumbnail strip + editor modal */
.pe-strip { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0; }
.pe-thumb { position: relative; width: 120px; }
.pe-thumb > img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid #e5e7eb; display: block; }
.pe-thumb .pe-badge { position: absolute; top: 4px; left: 4px; background: #16a34a; color: #fff; font-size: .62rem; padding: .05rem .35rem; border-radius: 999px; }
.pe-thumb-actions { display: flex; justify-content: space-between; align-items: center; gap: .25rem; margin-top: .2rem; font-size: .78rem; }

.pe-overlay { position: fixed; inset: 0; background: rgba(15,18,25,.75); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pe-modal { width: min(680px, 96vw); max-height: 94vh; overflow-y: auto; }
.pe-stage { max-height: 56vh; margin-bottom: .75rem; }
.pe-stage img { max-width: 100%; }
/* live preview: adjustments applied to the cropper image */
.pe-overlay .cropper-view-box img, .pe-overlay .cropper-canvas img { filter: var(--pe-filter, none); }
.pe-controls { display: flex; flex-direction: column; gap: .4rem; }
.pe-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pe-row .pe-sp { flex: 1 1 auto; }
.pe-slider { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: .6rem; font-size: .82rem; }
.pe-slider input[type=range] { width: 100%; }
.pe-ba { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; margin-left: auto; }
.pe-actions { display: flex; gap: .75rem; align-items: center; margin-top: .9rem; }

.hero { padding: 1.5rem 0; }
.hero h1 { font-size: 1.8rem; }
.lead { font-size: 1.15rem; color: #374151; }
.features { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(3, 1fr); } }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin: 1rem 0; }
.tile { display: block; position: relative; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid #e5e7eb; }
.tile img { width: 100%; height: 180px; object-fit: cover; display: block; }
.tile-title { display: block; padding: .5rem .75rem; font-weight: 600; }
.tile figcaption { padding: .4rem .75rem; color: #6b7280; font-size: .9rem; }

.docgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.doc { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: #fff; }
.doc img { width: 100%; height: 110px; object-fit: cover; display: block; }
.doc-file { display: block; padding: 1.2rem .5rem; font-size: .8rem; word-break: break-word; }
.doc-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .35rem .5rem; }
.row input[type=file] { font: inherit; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.row select { padding: .45rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; }
.link-danger { background: none; border: 0; color: #991b1b; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.linkbtn-dark { background: none; border: 0; color: #374151; cursor: pointer; font: inherit; padding: 0 .15rem; }

.tablewrap { overflow-x: auto; }
.lineitems { width: 100%; border-collapse: collapse; }
.lineitems th, .lineitems td { padding: .4rem .5rem; text-align: left; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.lineitems thead th { background: var(--brand); color: #fff; }
.lineitems input { width: 100%; padding: .35rem; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.lineitems tfoot th { border-top: 2px solid #333; }
.quotelist { list-style: none; padding: 0; }
.quotelist li { padding: .35rem 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.state-draft { background: #e5e7eb; color: #374151; }
.state-paid { background: #d1fae5; color: #065f46; }
.state-void { background: #e5e7eb; color: #6b7280; text-decoration: line-through; }
.state-sent { background: #dbeafe; color: #1e40af; }
.state-approved { background: #d1fae5; color: #065f46; }
.state-declined { background: #fee2e2; color: #991b1b; }

.messages { list-style: none; padding: 0; margin: 0; }
.msg { padding: .6rem 1rem; }
.msg.success { background: #d1fae5; color: #065f46; }
.msg.error { background: #fee2e2; color: #991b1b; }

/* Settings form (site editor) */
.settingsform { max-width: 46rem; }
.settingsform .hint { color: #7a828d; font-weight: 400; font-size: .85rem; }
.fieldrow { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 600px) { .fieldrow { grid-template-columns: 1fr; } }
.colorpick { display: flex; align-items: center; gap: .6rem; }
.colorpick input[type=color] { width: 3.2rem; height: 2.4rem; padding: 2px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.hexval { color: #4a5568; background: #f1f5f9; padding: .2rem .5rem; border-radius: 6px; font-size: .85rem; }
.imgpreview { display: block; height: 56px; width: auto; border-radius: 8px; border: 1px solid #e2e6ea; background: #fff; padding: 4px; margin: .35rem 0; }
.imgpreview-wide { height: 72px; }
.togglerow { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.toggle { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
.toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
.savebar { position: sticky; bottom: 0; background: linear-gradient(transparent, #f5f6f8 30%); padding: .8rem 0; }

/* Work-order verification page */
.verifycard { max-width: 26rem; margin: 2rem auto; text-align: center; }
.verifycard .herologo { margin: 0 auto .5rem; }
.verifycode { font-family: ui-monospace, Consolas, monospace; font-size: 1.9rem; font-weight: 700; color: var(--brand); letter-spacing: .06em; margin: .2rem 0 1rem; }
.verifycard .facts { text-align: left; }
.verifynote { font-size: .85rem; }

/* Job page: tabs, horizontal timeline, status dropdown */
.jobcode { font-family: ui-monospace, Consolas, monospace; font-size: .55em; color: #7a828d; background: #eef2f6; border-radius: 6px; padding: .15rem .5rem; vertical-align: middle; margin-left: .4rem; }
.statusdrop { display: flex; align-items: center; gap: .5rem; }
.statusdrop select { padding: .45rem .6rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-weight: 600; color: var(--brand); background: #fff; }
.timeline-h { list-style: none; display: flex; flex-wrap: wrap; gap: 0; padding: 0; margin: .25rem 0 .5rem; }
.timeline-h li { display: flex; align-items: center; gap: .35rem; padding: .2rem .9rem .2rem 0; position: relative; font-size: .85rem; }
.timeline-h li:not(:last-child)::after { content: ""; width: .55rem; height: 2px; background: #d6dce3; margin-left: .35rem; }
.timeline-h .dot { width: 11px; height: 11px; border-radius: 50%; background: #d6dce3; flex-shrink: 0; }
.timeline-h .done .dot { background: var(--brand); }
.timeline-h .current .dot { background: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.timeline-h .current .t-label { font-weight: 700; color: var(--brand); }
.timeline-h .upcoming .t-label { color: #98a1ab; }
.timeline-h .t-date { color: #98a1ab; font-size: .75rem; }
.nextstep.slim { padding: .45rem .8rem; margin: 0 0 1rem; font-size: .9rem; }
.tabbar { display: flex; gap: .25rem; border-bottom: 2px solid #e2e6ea; margin: .25rem 0 1rem; overflow-x: auto; }
.tabbar button { border: 0; background: none; font: inherit; font-weight: 600; color: #5a6472; padding: .55rem 1rem; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabbar button:hover { color: var(--brand); }
.tabbar button.active { color: var(--brand); border-bottom-color: var(--accent); }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.cardhead h2 { margin: 0; }

/* Global input polish + people subnav */
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]):not([type=submit]), select, textarea {
  padding: .5rem .65rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--brand); }
.tabbar a { display: inline-block; font-weight: 600; color: #5a6472; padding: .55rem 1rem; border-bottom: 3px solid transparent; margin-bottom: -2px; text-decoration: none; white-space: nowrap; }
.tabbar a:hover { color: var(--brand); text-decoration: none; }
.tabbar a.active { color: var(--brand); border-bottom-color: var(--accent); }
.refdocs ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
