/* Gutters app chrome — layered on base.css (rainline theme). */

.topbar {
	background: linear-gradient(180deg, var(--slate-deep), var(--slate));
	border-bottom: 3px solid var(--copper);
	margin-bottom: var(--space-5);
}
.topbar-inner {
	width: 78%;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 var(--space-4);
	display: flex;
	align-items: center;
	gap: var(--space-5);
	height: 52px;
}
.brand {
	font-family: "Alegreya Sans", "Trebuchet MS", sans-serif;
	font-weight: 800;
	font-size: 1.25rem;
	letter-spacing: 0.03em;
	color: #fff;
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 8px;
}
.brand:hover { color: var(--copper-soft); }
.brand-drop {
	width: 12px;
	height: 16px;
	background: var(--copper);
	border-radius: 50% 50% 50% 50% / 20% 20% 80% 80%;
	display: inline-block;
	transform: rotate(180deg);
}
.mainnav { display: flex; gap: 2px; flex: 1; }
.mainnav a {
	color: #cfd6dd;
	text-decoration: none;
	padding: 15px 14px 12px;
	border-bottom: 3px solid transparent;
	margin-bottom: -3px;
	font-weight: 500;
}
.mainnav a:hover { color: #fff; }
.mainnav a.active { color: #fff; border-bottom-color: var(--copper); }
.userbox { display: flex; align-items: center; gap: var(--space-4); color: #cfd6dd; }
.userbox .who small { display: block; font-size: 0.72rem; color: #97a3ae; }
.signout-form { display: inline; margin: 0; }
.signout {
	background: none;
	border: none;
	padding: 0;
	color: #cfd6dd;
	font-size: 0.85rem;
	text-decoration: underline;
	cursor: pointer;
}
.signout:hover { color: #fff; background: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.page-head-actions { display: flex; align-items: center; gap: var(--space-2); }
.inline-form { display: inline; margin: 0; }
.page-head h1 { margin: 0; font-family: "Alegreya Sans", "Trebuchet MS", sans-serif; }

/* Login */
.login-page {
	background:
		radial-gradient(ellipse at 30% -10%, rgba(181, 106, 60, 0.14), transparent 55%),
		repeating-linear-gradient(115deg, transparent 0, transparent 46px, rgba(51, 73, 94, 0.05) 46px, rgba(51, 73, 94, 0.05) 48px),
		var(--slate-deep);
}
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-4); }
.login-card { width: 380px; max-width: 100%; padding: var(--space-6); }
.login-brand {
	font-family: "Alegreya Sans", "Trebuchet MS", sans-serif;
	font-weight: 800;
	font-size: 1.7rem;
	color: var(--slate-deep);
	display: flex;
	align-items: center;
	gap: 8px;
}
.login-tag { color: var(--ink-soft); margin: 2px 0 var(--space-5); font-size: 0.9rem; }
.login-card label { margin-top: var(--space-3); }
.login-btn { width: 100%; margin-top: var(--space-4); height: 38px; }

/* Password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
	position: absolute;
	right: 4px;
	top: 4px;
	height: 24px;
	padding: 0 8px;
	font-size: 0.75rem;
	background: var(--paper);
	color: var(--ink-soft);
	border: 1px solid var(--line);
}
.pw-toggle:hover { background: var(--line); color: var(--ink); }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: var(--space-4); border: 1px solid; }
.flash-ok { background: #e8f2ea; border-color: var(--ok); color: var(--ok); }
.flash-error { background: #f7e8e8; border-color: var(--danger); color: var(--danger); }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.settings-grid > div > .card { margin-bottom: var(--space-4); }
.settings-grid form button[type="submit"] { margin-top: var(--space-4); }
.hint { color: var(--ink-soft); font-size: 0.85rem; }
.rates-table input[type="number"] { width: 110px; }
.rates-table .unit-cell { color: var(--ink-soft); white-space: nowrap; }
.rates-table .check-cell { text-align: center; }
.rates-table .check-cell input { width: auto; height: auto; }
.config-state { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.state-pill { padding: 3px 10px; border-radius: 20px; font-size: 0.8rem; border: 1px solid; }
.state-ok { background: #e8f2ea; border-color: var(--ok); color: var(--ok); }
.state-missing { background: #f7efe8; border-color: var(--warn); color: var(--warn); }

/* Users */
.users-grid { display: grid; grid-template-columns: 3fr 2fr; gap: var(--space-4); align-items: start; }
.row-form { display: flex; gap: var(--space-2); align-items: center; }
.row-form select, .row-form input { width: auto; }
.btn-small { padding: 3px 10px; font-size: 0.85rem; }

/* Jobs list */
.jobs-grid { display: grid; grid-template-columns: 3fr 1fr; gap: var(--space-4); align-items: start; }
.muted { color: var(--ink-soft); }
.filter-form select { width: auto; }
.status-pill {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 20px;
	font-size: 0.8rem;
	border: 1px solid var(--line-strong);
	background: var(--paper);
	white-space: nowrap;
}
.status-draft { background: var(--paper); }
.status-accepted, .status-contracted { background: #e8f2ea; border-color: var(--ok); color: var(--ok); }
.status-sent, .status-approved, .status-quoted { background: var(--copper-soft); border-color: var(--copper); color: #8f5230; }
.status-lost { background: #f7e8e8; border-color: var(--danger); color: var(--danger); }
.new-job-card label { margin-top: var(--space-2); }
.new-job-card button { margin-top: var(--space-3); }
.nj-meta { font-size: 0.82rem; min-height: 18px; margin-top: 4px; }
gmp-place-autocomplete.gt-places, .gt-places {
	width: 100%;
	--gmp-mat-color-surface: #fff;
	--gmp-mat-color-on-surface: var(--ink);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	display: block;
}
.places-manual-link {
	background: none;
	border: none;
	padding: 2px 0;
	color: var(--ink-soft);
	font-size: 0.78rem;
	text-decoration: underline;
	cursor: pointer;
}
.places-manual-link:hover { color: var(--ink); background: none; }

/* Job detail */
.container-wide { width: 92%; max-width: 1700px; }
.job-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-4); align-items: start; }
.job-side .card { margin-bottom: var(--space-4); }
.job-side label { margin-top: var(--space-2); }
.job-side button[type="submit"] { margin-top: var(--space-3); }
.acquire-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); }
.acquire-option { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: var(--space-4); }
.acquire-option button { margin-top: var(--space-2); }
.county-links { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space-3); padding: 8px 10px; background: var(--copper-soft); border-radius: var(--radius); }
.county-links a { font-size: 0.9rem; color: #8f5230; font-weight: bold; }
.stage-card { padding: var(--space-2); }
.stage-toolbar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2); }
.stage-toolbar .toolbar-note { color: var(--ink-soft); font-size: 0.8rem; }
.stage-toolbar .toolbar-spacer { flex: 1; }
.btn-quiet { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--line); }
#draw-line-btn.active { background: var(--copper); border-color: #8f5230; }
.stage {
	position: relative;
	height: 72vh;
	min-height: 420px;
	background: var(--slate-deep);
	border-radius: var(--radius);
	overflow: hidden;
	cursor: grab;
	touch-action: none;
}
.stage canvas { position: absolute; inset: 0; }
/* Trace toolbar + panels */
.tool { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.tool:hover { background: var(--line); }
.tool.active { background: var(--slate); color: #fff; border-color: var(--slate-deep); }
.story-toggle { display: inline-flex; }
.story-btn {
	background: var(--paper);
	color: var(--ink);
	border: 1px solid var(--line-strong);
	padding: 6px 10px;
}
.story-btn.story-1.active { background: #31c48d; border-color: #23926a; color: #fff; }
.story-btn.story-2.active { background: #f59e0b; border-color: #b97708; color: #fff; }
.story-toggle .story-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.story-toggle .story-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.trace-strip { display: flex; gap: var(--space-4); padding: 6px var(--space-2) 2px; min-height: 24px; align-items: center; }
.trace-list { font-size: 0.88rem; }
.trace-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 6px;
	border-radius: var(--radius);
	cursor: pointer;
}
.trace-row:hover { background: rgba(51, 73, 94, 0.07); }
.trace-row.selected { background: var(--copper-soft); }
.trace-row.excluded .trace-row-label { color: var(--ink-soft); text-decoration: line-through; }
.swatch { width: 14px; height: 5px; border-radius: 2px; flex: none; }
.swatch-round { width: 10px; height: 10px; border-radius: 50%; }
.drops-head { margin-top: var(--space-4); }
.totals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.tot { display: flex; flex-direction: column; padding: 8px; background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line); }
.tot-label { font-size: 0.75rem; color: var(--ink-soft); }
.tot strong { font-size: 1.05rem; }
.sel-controls { display: flex; flex-direction: column; gap: var(--space-2); }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ink); }
.check-label input { width: auto; height: auto; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #f7e8e8; }

/* Estimate review */
.estimate-grid { display: grid; grid-template-columns: 5fr 6fr; gap: var(--space-4); align-items: start; }
.estimate-grid > div > .card { margin-bottom: var(--space-4); }
.trace-render { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.items-table input { width: 100%; min-width: 60px; }
.items-table .it-qty, .items-table .it-rate { width: 90px; }
.items-table .it-amount { white-space: nowrap; font-weight: bold; }
.items-total-row td { font-weight: bold; font-size: 1.05rem; border-top: 2px solid var(--slate-deep); }
.disclaimer-box {
	margin-top: var(--space-3);
	padding: 10px 12px;
	background: var(--copper-soft);
	border-left: 3px solid var(--copper);
	border-radius: var(--radius);
	font-size: 0.85rem;
	color: #6b4226;
}
.est-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
/* Send preview */
.send-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; border-left: 4px solid var(--copper); }
.send-meta { display: flex; flex-direction: column; gap: 2px; font-size: 0.95rem; }
.email-preview { max-width: 640px; margin: var(--space-4) 0; padding: var(--space-4); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: 0 3px 14px rgba(34, 50, 63, 0.1); }

.report-tiles { margin-bottom: var(--space-4); }
.delta-big { color: var(--danger); font-weight: bold; }
.delivery-timeline { display: flex; flex-direction: column; gap: 6px; margin: var(--space-3) 0; }
.dt-step { padding: 7px 12px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); font-size: 0.9rem; }
.dt-step.done { background: #e8f2ea; border-color: var(--ok); color: var(--ok); font-weight: bold; }
.est-actions .btn { text-decoration: none; }
.item-add-row { display: flex; gap: var(--space-2); margin-top: var(--space-3); align-items: center; }
.item-add-row select { width: auto; max-width: 320px; }

.scale-row { display: flex; justify-content: space-between; margin: var(--space-2) 0; }
.scale-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.scale-note { margin-top: var(--space-2); font-size: 0.85rem; min-height: 18px; }
.note-ok { color: var(--ok); }
.note-bad { color: var(--danger); }

/* Field verification — one thumb, outdoors, Florida sun. High contrast,
   48px+ targets, numeric keypads. */
.field-wrap { max-width: 760px; margin: 0 auto; padding: var(--space-3); }
.field-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.field-head h1 { font-size: 1.15rem; margin: 0 0 4px; }
.field-totals { display: flex; gap: var(--space-3); background: var(--slate-deep); color: #cfd6dd; padding: 10px 14px; border-radius: var(--radius-lg); font-size: 0.85rem; }
.field-totals strong { display: block; color: #fff; font-size: 1.1rem; }
.field-section { margin: var(--space-5) 0 var(--space-2); }
.field-photo-wrap { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 2px solid var(--slate); }
.field-photo-wrap img { display: block; width: 100%; }
.drop-dot {
	position: absolute;
	transform: translate(-50%, -50%);
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 3px solid #fff;
	color: #fff;
	font-weight: bold;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.85rem;
	box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.drop-dot.story-1 { background: #23926a; }
.drop-dot.story-2 { background: #b97708; }
.tap-hint { position: absolute; inset: auto 0 0 0; background: rgba(34, 50, 63, 0.92); color: #fff; padding: 12px; text-align: center; font-weight: bold; }
.field-cards { display: flex; flex-direction: column; gap: var(--space-3); }
.fcard { background: var(--card); border: 2px solid var(--line-strong); border-radius: var(--radius-lg); padding: var(--space-3); }
.fcard-off { opacity: 0.55; border-style: dashed; }
.fcard-top { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.fstory { min-height: 48px; padding: 0 18px; font-weight: bold; font-size: 1rem; border-radius: var(--radius); border: none; color: #fff; }
.fstory.story-1 { background: #23926a; }
.fstory.story-2 { background: #b97708; }
.fswitch { display: flex; align-items: center; gap: 8px; font-weight: bold; margin-left: auto; min-height: 48px; }
.fswitch input { width: 28px; height: 28px; }
.fcard-len { display: flex; align-items: baseline; gap: var(--space-3); margin: var(--space-3) 0; }
.fest { color: var(--ink-soft); font-size: 0.85rem; min-width: 110px; }
.flen { height: 56px; font-size: 1.6rem; font-weight: bold; width: 130px; text-align: right; border-width: 2px; }
.funit { font-size: 1.2rem; font-weight: bold; color: var(--ink-soft); }
.fcard-actions { display: flex; gap: var(--space-2); align-items: center; }
.fcard-actions .fnote { flex: 1; height: 44px; }
/* 16px minimum on every field-screen input: below that, phone browsers zoom
   the page on focus and leave the layout scaled afterward. */
.field-wrap input { font-size: 16px; }
.flen { font-size: 1.6rem; }
.fadd input { font-size: 1.25rem; }
.fbtn {
	min-width: 52px;
	min-height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.15rem;
	background: var(--paper);
	color: var(--ink);
	border: 2px solid var(--line-strong);
	border-radius: var(--radius);
	cursor: pointer;
	padding: 0 12px;
}
.fbtn.story-1 { background: #23926a; color: #fff; border-color: #1a6e50; font-size: 1rem; font-weight: bold; }
.fbtn.story-2 { background: #b97708; color: #fff; border-color: #8a5906; font-size: 1rem; font-weight: bold; }
.fremove { color: var(--danger); border-color: var(--danger); }
.fthumbs { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }
.fthumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line-strong); }
.fthumbs-lg img { width: 110px; height: 110px; }
.fphoto-lg { min-height: 110px; min-width: 110px; flex-direction: column; font-size: 0.95rem; }
.fadd { display: flex; gap: var(--space-2); margin-top: var(--space-3); align-items: center; }
.fadd input { height: 52px; font-size: 1.2rem; width: 140px; text-align: right; border-width: 2px; }
.ffinish { margin: var(--space-6) 0; text-align: center; }
.ffinish button { min-height: 56px; font-size: 1.15rem; padding: 0 34px; }

@media (max-width: 1100px) {
	.settings-grid, .users-grid, .jobs-grid, .job-grid, .estimate-grid { grid-template-columns: 1fr; }
	.topbar-inner { width: 100%; }
	.container-wide { width: 100%; }
}

/* Grid items must be allowed to shrink below their content's natural width,
   or a wide table inside a card stretches the whole page sideways. */
.settings-grid > div, .users-grid > div, .jobs-grid > div,
.estimate-grid > div, .job-main, .job-side, .card { min-width: 0; }

/* Phones — every staff screen usable one-handed. Wide tables scroll inside
   their card instead of stretching the page; 16px inputs stop focus zoom. */
@media (max-width: 640px) {
	.container, .container-wide { width: 100%; padding: 10px; }
	.page-head { flex-wrap: wrap; gap: 8px; }
	.page-head h1 { font-size: 1.15rem; }
	.card { padding: 12px; overflow-x: auto; }
	.card > table, .card .items-table, .card .rates-table { min-width: 540px; }
	input, select, textarea { font-size: 16px; }
	.login-card { width: 100%; padding: var(--space-4); }
	.stage { height: 62vh; min-height: 320px; }
	.stage-toolbar { flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
	.stage-toolbar .toolbar-note { display: none; }
	.trace-strip { flex-wrap: wrap; gap: 4px; }
	.row-form, .est-actions, .config-state, .scale-actions { flex-wrap: wrap; }
	.items-table .it-qty, .items-table .it-rate { width: 76px; }
	.rates-table input[type="number"] { width: 84px; }
	.fadd { flex-wrap: wrap; }
	.totals-grid { grid-template-columns: 1fr 1fr; }
	.delivery-timeline { font-size: 0.85rem; }
}

/* Phones: the topbar must never force horizontal overflow — an overflowing
   layout makes mobile browsers render zoomed out and pan sideways. */
@media (max-width: 640px) {
	.topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 10px; gap: 4px 14px; }
	.mainnav { order: 3; flex-basis: 100%; }
	.mainnav a { padding: 8px 10px 6px; }
	.userbox { margin-left: auto; gap: var(--space-2); }
	.userbox .who { font-size: 0.85rem; }
	.userbox .who small { display: none; }
	.field-totals { width: 100%; justify-content: space-between; }
}
