/* 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; }
.role { opacity: .8; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.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; gap: 1rem; justify-content: space-between; align-items: flex-start; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem; max-width: 560px; }
.vcard-name { font-weight: 600; margin: .2rem 0; }
.vcard-qr img { width: 120px; height: 120px; }

.photo-editor { margin: .6rem 0; }
.pe-stage { max-height: 60vh; }
.pe-stage img { max-width: 100%; }
.photo-editor label { display: inline-flex; align-items: center; gap: .3rem; font-size: .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; }
