/* Contractor portal */
:root {
	--asphalt: #1c2326;
	--ink-2: #36434a;
	--muted: #5b686f;
	--steel: #24404f;
	--steel-soft: #e2eaee;
	--safety: #f2b705;
	--safety-deep: #d9a300;
	--safety-soft: #fff4cf;
	--concrete: #eceeea;
	--surface: #ffffff;
	--line: #d8dcd6;
	--line-2: #c3c9c1;
	--ok: #1d6b36;
	--ok-soft: #ddf0e2;
	--danger: #b42318;
	--danger-soft: #fbe6e3;
	--radius: 10px;
	--font: "Archivo", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--concrete); color: var(--asphalt); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--steel); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--safety); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; font-variation-settings: "wdth" 112; font-weight: 800; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }
.boot { padding: 40px 20px; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons and fields */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 46px; padding: 10px 18px;
	border: 2px solid var(--line-2); border-radius: 8px;
	background: var(--surface); color: var(--asphalt);
	font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--asphalt); }
.btn--primary { background: var(--safety); border-color: var(--safety); }
.btn--primary:hover { background: var(--safety-deep); border-color: var(--safety-deep); }
.btn--dark { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--danger { color: var(--danger); }
.btn--sm { min-height: 36px; padding: 6px 12px; font-size: .92rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }

label, .label { display: block; font-weight: 700; font-size: .95rem; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.field .help { color: var(--muted); font-size: .88rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], select, textarea {
	width: 100%; min-height: 48px; padding: 10px 12px;
	border: 1.5px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px rgba(36,64,79,.18); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--steel); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* Sign-in */
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.signin__card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 14px; padding: 28px 24px; box-shadow: 0 12px 40px rgba(28,35,38,.12); border-top: 6px solid var(--safety); }
.signin__brand { display: block; text-align: center; margin-bottom: 16px; color: var(--asphalt); text-decoration: none; font-size: 1.3rem; }
.signin__brand img { max-width: 220px; max-height: 120px; }
.signin h1 { font-size: 1.5rem; margin-top: 6px; }
.signin form input { margin-bottom: 14px; }
.signin .check { margin: 2px 0 18px; }
.signin__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 16px 0 0; font-size: .92rem; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-weight: 600; }

/* App shell */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top__inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; min-height: 68px; display: flex; align-items: center; gap: 18px; }
.top__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--asphalt); margin-right: auto; min-width: 0; }
.top__brand img { height: 48px; width: auto; max-width: 130px; object-fit: contain; }
.top__acct { line-height: 1.2; min-width: 0; }
.top__acct strong { display: block; font-variation-settings: "wdth" 106; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__acct span { color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 2px; }
.tabs a { padding: 22px 12px 19px; color: var(--ink-2); text-decoration: none; font-weight: 700; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--asphalt); }
.tabs a[aria-current="page"] { color: var(--asphalt); border-bottom-color: var(--safety); }
.top__user { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(28,35,38,.15); min-width: 220px; padding: 6px; z-index: 30; }
.menu a, .menu span { display: block; padding: 10px 12px; border-radius: 6px; color: var(--asphalt); text-decoration: none; }
.menu span { color: var(--muted); font-size: .88rem; }
.menu a:hover { background: var(--concrete); }

.bottombar { display: none; }
@media (max-width: 760px) {
	.tabs { display: none; }
	.top__order { display: none; }
	.bottombar {
		display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
		background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
	}
	.bottombar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 700; }
	.bottombar a svg { width: 22px; height: 22px; }
	.bottombar a[aria-current="page"] { color: var(--asphalt); }
	.bottombar a.is-order span.ico { background: var(--safety); color: var(--asphalt); border-radius: 12px; padding: 4px 14px; }
	body { padding-bottom: 72px; }
	.top__brand img { height: 40px; }
}

.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--asphalt); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.card h2 { margin-bottom: 10px; }
.cols { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .cols { grid-template-columns: 1.5fr 1fr; } .cols > * + * { margin-top: 0; } }

.paused { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 12px 16px; font-weight: 600; margin-bottom: 16px; }

/* Home */
.hello { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; background: var(--steel); color: #fff; border-radius: 14px; padding: 22px 22px; margin-bottom: 18px; }
.hello h1 { color: #fff; font-size: 1.6rem; }
.hello p { margin: 0; color: #cdd9df; }
.hello .btn--primary { min-height: 54px; font-size: 1.05rem; padding: 12px 22px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--asphalt); font-size: 1.05rem; margin-bottom: 4px; }

/* Job cards */
.jobs { display: grid; gap: 10px; }
.job { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; }
.job:hover { border-color: var(--ink-2); }
.job--attention { border-left: 5px solid var(--safety); }
.job__title { font-weight: 800; font-variation-settings: "wdth" 106; }
.job__meta { color: var(--muted); font-size: .92rem; grid-column: 1 / -1; }
.job__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .82rem; font-weight: 700; white-space: nowrap; background: var(--concrete); color: var(--ink-2); }
.chip--requested { background: var(--steel-soft); color: var(--steel); }
.chip--quoted { background: var(--safety-soft); color: #6b4e00; }
.chip--approved, .chip--scheduled { background: #e6e1f3; color: #4b3a7a; }
.chip--delivered, .chip--pickup_requested { background: var(--ok-soft); color: var(--ok); }
.chip--closed { background: var(--concrete); color: var(--ink-2); }
.chip--declined, .chip--cancelled { background: var(--danger-soft); color: var(--danger); }

.filter { display: flex; gap: 6px; margin-bottom: 12px; }
.filter button { border: 1.5px solid var(--line-2); background: #fff; border-radius: 99px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--asphalt); border-color: var(--asphalt); color: #fff; }

/* Job detail: tracker */
.tracker { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); counter-reset: s; }
.tracker li { position: relative; text-align: center; font-size: .8rem; font-weight: 700; color: var(--muted); padding-top: 34px; }
.tracker li::before {
	counter-increment: s; content: counter(s);
	position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 1;
	width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	background: #fff; border: 2px solid var(--line-2); color: var(--muted); font-size: .78rem;
}
.tracker li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.tracker li:first-child::after { display: none; }
.tracker li.is-done { color: var(--ink-2); }
.tracker li.is-done::before { content: "✓"; background: var(--steel); border-color: var(--steel); color: #fff; }
.tracker li.is-done::after, .tracker li.is-current::after { background: var(--steel); }
.tracker li.is-current { color: var(--asphalt); }
.tracker li.is-current::before { background: var(--safety); border-color: var(--safety); color: var(--asphalt); }
@media (max-width: 560px) {
	.tracker { grid-template-columns: 1fr; gap: 0; }
	.tracker li { text-align: left; padding: 4px 0 14px 40px; font-size: .92rem; }
	.tracker li::before { left: 13px; top: 2px; }
	.tracker li::after { left: 12px; top: -14px; width: 3px; height: 20px; }
}

.quote-card { background: var(--safety); border-radius: 14px; padding: 20px; color: var(--asphalt); }
.quote-card h2 { margin: 0 0 4px; }
.quote-card .amount { font-size: 2.4rem; font-weight: 800; font-variation-settings: "wdth" 118; line-height: 1.1; margin: 4px 0 8px; }
.quote-card p { white-space: pre-wrap; margin: 0 0 14px; }
.quote-card .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quote-card .btn { border-color: var(--asphalt); }
.quote-card .btn--dark { min-width: 160px; }
.quote-done { background: var(--ok-soft); border-radius: var(--radius); padding: 14px 16px; }
.quote-done.is-declined { background: var(--danger-soft); }

.service { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 480px) { .service { grid-template-columns: 1fr; } }
.service .btn { min-height: 54px; }
.reqs { list-style: none; padding: 0; margin: 12px 0 0; }
.reqs li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }

.facts { display: grid; grid-template-columns: 130px 1fr; margin: 0; }
.facts dt, .facts dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .92rem; }
.facts dd { font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--steel); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: .85rem; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }

/* Order form */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 640px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choices--sites { grid-template-columns: 1fr; }
@media (min-width: 640px) { .choices--sites { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; display: block; margin: 0; cursor: pointer; font-weight: 500; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span { display: flex; flex-direction: column; justify-content: center; height: 100%; min-height: 52px; padding: 10px 12px; border: 2px solid var(--line-2); border-radius: 8px; background: #fff; font-weight: 700; }
.choice small { font-weight: 500; color: var(--muted); }
.choice input:checked + span { border-color: var(--asphalt); background: var(--safety-soft); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(242,183,5,.6); }
.choice--add span { border-style: dashed; color: var(--steel); align-items: center; }
.order-section { padding: 18px 0; border-top: 1px solid var(--line); }
.order-section:first-of-type { border-top: 0; padding-top: 0; }
.order-section h2 { font-size: 1.05rem; }
.error { color: var(--danger); font-weight: 700; margin: 10px 0 0; }
.error:empty { display: none; }
.sticky-submit { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--surface) 30%); padding: 14px 0 4px; }
@media (max-width: 760px) { .sticky-submit { bottom: 66px; } }

/* Sheet (dialogs) */
.scrim { position: fixed; inset: 0; background: rgba(28,35,38,.4); z-index: 40; }
.sheet { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 20px 50px rgba(28,35,38,.25); }
@media (max-width: 560px) { .sheet { top: auto; bottom: 0; transform: translateX(-50%); border-radius: 14px 14px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); } }
.sheet__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* Jobsites */
.sites { display: grid; gap: 10px; }
@media (min-width: 760px) { .sites { grid-template-columns: 1fr 1fr; } }
.site { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.site h3 { margin-bottom: 4px; }
.site p { margin: 0 0 4px; color: var(--ink-2); }
.site .row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag-out { color: var(--danger); font-weight: 700; font-size: .88rem; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: var(--asphalt); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; box-shadow: 0 10px 30px rgba(28,35,38,.3); max-width: calc(100vw - 32px); }
.toast--error { background: var(--danger); }
.skeleton { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, #e2e5e0 0%, #f0f2ee 50%, #e2e5e0 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton + .skeleton { margin-top: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
