:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2430;
  --muted: #6b7482;
  --line: #e3e6ea;
  --line-strong: #cfd4da;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --green: #15803d;
  --green-soft: #e6f4ea;
  --amber: #b45309;
  --amber-soft: #fdf2e3;
  --red: #c62828;
  --red-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body.no-scroll { overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 2px; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 10px; }
h4 { font-size: 14px; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.r { text-align: right; }
.hint { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo {
  width: 26px; height: 26px; border-radius: 7px; flex: none; background: var(--accent);
  -webkit-mask: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M14 34 32 18l18 16v14a2 2 0 0 1-2 2H16a2 2 0 0 1-2-2z' fill='white'/%3E%3C/svg%3E");
  background-size: cover;
}
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tabs a[hidden] { display: none; }
.tabs a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 550;
}
.tabs a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.tabs a.on { color: var(--accent); background: var(--accent-soft); }

.timer-bar {
  position: sticky; top: 56px; z-index: 19;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: #fff7ed; border-bottom: 1px solid #fed7aa; font-size: 14px;
}
.timer-bar[hidden] { display: none; }
.timer-bar b { font-variant-numeric: tabular-nums; }

.view { max-width: 960px; margin: 0 auto; padding: 24px 20px 80px; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f8f9fb; border-color: #b9c0c8; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4fd8; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.danger-text { color: var(--red) !important; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.link-btn {
  border: 0; background: none; padding: 4px 0; color: var(--accent); font: inherit; font-weight: 550; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  width: 32px; height: 32px; border: 0; background: none; border-radius: 6px;
  color: var(--muted); font-size: 16px; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover:not(:disabled) { background: var(--bg); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.sm { width: 26px; height: 26px; font-size: 13px; }

.input {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
  font: inherit; color: var(--text);
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.input.big { font-size: 17px; height: 44px; font-weight: 550; }
.input.sm { height: 32px; font-size: 14px; padding: 0 8px; }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 40, 40, .12); }
.input::placeholder { color: #a0a7b1; }
input[type=number].input { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }

.affix { display: flex; align-items: center; gap: 0; position: relative; }
.affix em { font-style: normal; color: var(--muted); padding: 0 6px; font-size: 14px; }
.affix .input { min-width: 0; }
.affix.sm em { padding: 0 3px; font-size: 13px; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button {
  border: 0; background: none; padding: 0 14px; height: 36px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--bg); }
.seg button.on { background: var(--accent); color: #fff; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 4px 12px;
  font: inherit; font-size: 13px; font-weight: 550; color: var(--text); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--bg); color: var(--muted); white-space: nowrap;
}
.badge.opt { background: #f1effd; color: #5b47c9; }
.badge.prog { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.timer { background: #fff1e6; color: #c2410c; }
.tag { display: inline-block; font-size: 12px; color: var(--muted); background: var(--bg); border-radius: 4px; padding: 1px 6px; margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.big-empty { padding: 56px 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }

/* ---------- Overview ---------- */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat.total { background: var(--text); border-color: var(--text); color: #fff; }
.stat.total .stat-label, .stat.total .stat-sub { color: #b8c0cc; }

.progress-line { display: flex; align-items: center; gap: 12px; margin: 14px 2px 22px; font-size: 13px; color: var(--muted); }
.progress-line .bar { flex: 0 0 160px; height: 6px; background: #e3e6ea; border-radius: 99px; overflow: hidden; }
.progress-line .bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar .search { flex: 1; }
.toolbar select { width: auto; }

/* Sections */
.sec { margin-bottom: 18px; }
.sec.depth1 { margin: 10px 0 4px 14px; }
.sec-head { display: flex; align-items: center; gap: 6px; padding: 4px 2px 6px; border-radius: 8px; }
.sec-toggle {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  border: 0; background: none; padding: 4px 2px; font: inherit; color: var(--text); cursor: pointer; text-align: left;
}
.sec-toggle.static { cursor: default; }
.sec-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depth1 .sec-name { font-size: 14.5px; }
.sec-num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.sec-total { color: var(--muted); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sec-head .chev { transition: transform .15s; color: var(--muted); font-size: 12px; }
.sec.collapsed > .sec-head .chev { transform: rotate(-90deg); }
.sec-menu { opacity: .7; }
.sec-head.drop-into { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.sec-empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; text-align: center; }
.sec-empty.drop-into { background: var(--accent-soft); border-color: var(--accent); }
.list-foot { margin: 4px 0 24px; }

/* Job rows */
.job {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px;
  box-shadow: var(--shadow); scroll-margin-top: 120px; transition: box-shadow .2s, border-color .2s;
}
.job.open { border-color: var(--line-strong); box-shadow: 0 4px 16px rgba(16, 24, 40, .08); margin: 10px 0; }
.job.flash { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.job.dragging { opacity: .4; }
.job.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.job.drop-after { box-shadow: 0 3px 0 var(--accent); }
.job-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 6px; cursor: pointer; user-select: none; }
.job-row:hover .job-title { color: var(--accent); }
.handle { width: 16px; text-align: center; color: #b7bec7; cursor: grab; visibility: hidden; font-size: 14px; }
.can-drag .job:not(.st-dropped) .job-row:hover .handle { visibility: visible; }
.check, .check-spacer { width: 22px; height: 22px; flex: none; }
.check {
  border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; color: transparent; font-size: 13px;
}
.check::after { content: "✓"; font-weight: 800; }
.check:hover { border-color: var(--green); color: var(--green); }
.st-done .check { background: var(--green); border-color: var(--green); color: #fff; }
.st-done .job-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7bec7; }
.job-main { flex: 1; min-width: 0; }
.job-title { font-weight: 600; }
.job-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.job-price { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-price .spent { font-size: 12px; font-weight: 500; color: var(--muted); }
.job-row .chev { color: var(--muted); font-size: 12px; transition: transform .15s; width: 12px; }
.job.open > .job-row .chev { transform: rotate(180deg); }
.st-dropped .job-title { color: var(--muted); }

/* Expanded job */
.job-detail { border-top: 1px solid var(--line); padding: 16px 18px 14px 42px; cursor: default; }
.d-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.status-seg button { height: 32px; font-size: 13px; padding: 0 12px; }
.status-seg button.on.s-done { background: var(--green); }
.status-seg button.on.s-dropped { background: #6b7482; }
.d-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.d-photo {
  width: 96px; height: 72px; border-radius: 8px; border: 1px solid var(--line); padding: 0; cursor: zoom-in;
  background: #eee center/cover no-repeat;
}
.d-photo:hover { outline: 2px solid var(--accent); }
.d-details { white-space: pre-wrap; margin-bottom: 14px; }
.d-sec { margin-top: 18px; }
.d-sec > h4, .d-head h4 { margin-bottom: 8px; }
.d-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.d-head h4 { margin: 0; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.d-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }

.opt-view { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.opt-view.chosen { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.opt-view.not-chosen .ov-head { opacity: .65; }
.ov-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: #fafbfc; font: inherit; color: var(--text); cursor: pointer; text-align: left;
}
.ov-head:hover { background: #f3f5f8; }
.ov-name { flex: 1; font-weight: 600; min-width: 0; }
.ov-total { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-head .chev { color: var(--muted); font-size: 11px; transition: transform .15s; }
.opt-view.exp .ov-head .chev { transform: rotate(180deg); }
.ov-body { padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ov-notes { color: var(--muted); font-style: italic; white-space: pre-wrap; }
.opt-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: #fff; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.chosen .opt-num { background: var(--green); }

table.bd { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
table.bd td { padding: 5px 0; border-bottom: 1px solid #f0f2f4; vertical-align: top; }
table.bd td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
table.bd tr:not(.bd-grp):not(.bd-sum) td:first-child { padding-left: 12px; }
.bd-grp td { font-weight: 650; padding-top: 10px !important; color: var(--text); }
.bd-sum td { font-weight: 700; border-bottom: 0 !important; padding-top: 8px !important; }
a.ext { font-size: 12px; padding: 0 3px; }
.bd-grp { font-weight: 650; }
.resources { margin-bottom: 10px; }
.resources .bd-grp { font-size: 14px; margin: 4px 0 6px; }
.resource {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 5px; color: var(--text); font-size: 14px;
}
.resource:hover { border-color: var(--accent); text-decoration: none; }
.resource em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 12px; }

.eva {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; background: #fafbfc;
  border: 1px solid var(--line); border-radius: 8px;
}
.eva-big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eva-note { grid-column: 1 / -1; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.eva-note.ok { background: var(--green-soft); color: var(--green); }
.eva-note.over { background: var(--red-soft); color: var(--red); }

.timer-live {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px;
}
.timer-live .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-live select { width: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #ea580c; animation: pulse 1.2s infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; } }

.mini-form {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px; margin-bottom: 8px;
  background: var(--accent-soft); border-radius: 8px;
}
.mini-form .input { width: auto; }
.mini-form input[type=number] { width: 90px; }
.mini-form .affix .input { width: 72px; }
.mini-form .grow { flex: 1; min-width: 160px; }
.mini-form input[type=date] { width: 150px; }

.entries { border: 1px solid var(--line); border-radius: 8px; }
.entry { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; font-size: 14px; }
.entry + .entry { border-top: 1px solid #f0f2f4; }
.e-date { color: var(--muted); width: 98px; flex: none; font-size: 13px; }
.e-main { flex: 1; min-width: 0; }
.e-amt { font-variant-numeric: tabular-nums; font-weight: 600; }

.dropped { margin-top: 12px; }
.dropped-head {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 2px; margin-bottom: 6px;
  font: inherit; font-weight: 650; color: var(--muted); cursor: pointer;
}
.dropped-head .chev { font-size: 11px; transform: rotate(-90deg); transition: transform .15s; }
.dropped.open .dropped-head .chev { transform: none; }
.dropped .job { opacity: .8; }

/* Menu */
.menu {
  position: absolute; z-index: 60; min-width: 180px; padding: 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, .16);
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--text); }
.menu button:hover { background: var(--bg); }

/* ---------- Modals ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
  animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--card); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; max-height: 92vh; outline: none;
}
.modal.small { max-width: 420px; }
.modal.wide { max-width: 820px; }
.modal.sheet { max-width: 900px; }
.modal.lightbox { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 18px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 14px 14px; }
.modal-foot .muted { margin-right: auto; }

/* Editor */
.ed-total { margin-right: auto; color: var(--muted); font-size: 14px; }
.ed-total strong { color: var(--text); font-size: 16px; }
.ed-block { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.ed-photos { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-photo { position: relative; }
.ed-photo-img { width: 92px; height: 70px; border-radius: 8px; border: 1px solid var(--line); background: #eee center/cover; cursor: pointer; padding: 0; display: block; }
.ed-photo-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--text); color: #fff; font-size: 11px; cursor: pointer;
}
.ed-photo-add {
  width: 92px; height: 70px; border-radius: 8px; border: 1.5px dashed var(--line-strong); background: #fafbfc;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.ed-photo-add b { font-size: 18px; line-height: 1; }
.ed-photo-add:hover { border-color: var(--accent); color: var(--accent); }

.opt-card { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: #fff; }
.opt-card.chosen { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.opt-head { display: flex; align-items: center; gap: 10px; }
.opt-name { font-weight: 600; flex: 1 1 0; min-width: 0; }
.opt-total { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.opt-tools { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 6px; min-height: 30px; }
.tool-group { display: flex; }
.choose { display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 600; color: var(--green); cursor: pointer; }
.notes { font-size: 14px; margin-bottom: 4px; }
.part { margin-top: 12px; }
.part-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
.part-total { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.part .hint { margin: -2px 0 6px; }
.add-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }

.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; gap: 6px; align-items: center; }
.row .input { height: 34px; font-size: 14px; padding: 0 8px; }
.row-hdr { font-size: 12px; font-weight: 600; color: var(--muted); }
.row-materials { grid-template-columns: minmax(120px, 2.2fr) 58px minmax(150px, 1.6fr) 46px minmax(80px, 1fr) 84px 26px; }
.row-rentals { grid-template-columns: minmax(120px, 2fr) 76px 100px 64px 46px minmax(70px, 1fr) 70px 26px; }
.row-fees { grid-template-columns: 1fr 120px 26px; }
.row-labor { grid-template-columns: 1fr 76px 100px 70px 26px; }
.row-resources { grid-template-columns: 1fr 1.4fr 26px; }
.range { display: flex; align-items: center; gap: 4px; }
.range i { font-style: normal; color: var(--muted); font-size: 12px; }
.cell { display: flex; flex-direction: column; min-width: 0; }
.cell small { display: none; }
.range .cell { flex: 1; }
.tax { display: flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); cursor: pointer; }
.line-total { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.photo-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.photo-img { display: block; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; background: #eee center/cover; cursor: zoom-in; }
.photo-info { padding: 10px 12px 12px; }
.photo-desc { font-size: 14px; }
.photo-jobs { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.job-link { font-size: 13px; display: block; }
.job-link::before { content: "→ "; color: var(--muted); }

.lb { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
.lb-imgwrap { position: relative; background: #111; border-radius: 10px; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.lb-imgwrap img { max-width: 100%; max-height: 70vh; display: block; border-radius: 6px; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .85); font-size: 24px; cursor: pointer; line-height: 1;
}
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pick {
  position: relative; border: 2px solid transparent; border-radius: 10px; padding: 0; background: #fafbfc; cursor: pointer;
  text-align: left; font: inherit; overflow: hidden;
}
.pick-img { display: block; aspect-ratio: 4 / 3; background: #eee center/cover; }
.pick-desc { display: block; padding: 6px 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-check {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255, 255, 255, .9); border: 2px solid var(--line-strong); color: transparent;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.pick.on { border-color: var(--accent); }
.pick.on .pick-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick.already { opacity: .5; cursor: default; }
.pick-badge { position: absolute; top: 6px; left: 6px; font-size: 11px; background: rgba(0, 0, 0, .65); color: #fff; padding: 2px 6px; border-radius: 4px; }

/* Settings */
.loc-list { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.loc { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; background: var(--bg); border-radius: 999px; font-size: 14px; }

/* Toasts */
#toastRoot { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; background: #1d2430; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: auto;
}
.toast.show { opacity: 1; transform: none; }
.toast-btn { border: 0; background: none; color: #93b4ff; font: inherit; font-weight: 700; cursor: pointer; }

#printRoot { display: none; }

/* ---------- Phones / narrow screens ---------- */
@media (max-width: 720px) {
  .topbar { padding: 0 12px; }
  .tabs a { padding: 6px 8px; }
  .view { padding: 16px 12px 80px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .stat.total { grid-column: 1 / -1; }
  .stat-value { font-size: 17px; }
  .stat { padding: 12px; }
  .brand { gap: 8px; font-size: 14px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar #addJobBtn { flex: 1; }
  .grid { grid-template-columns: 1fr; }
  .job-detail { padding: 14px 12px; }
  .handle { display: none; }
  .job-row { padding-left: 12px; }
  .eva { grid-template-columns: 1fr; }
  .lb { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; }
  .modal { max-height: 100vh; border-radius: 0; min-height: 100vh; }
  .modal.small { min-height: 0; border-radius: 14px; margin: 20vh 12px 0; }
  .row-hdr { display: none; }
  .row { grid-template-columns: 1fr 1fr 1fr !important; padding: 8px 36px 8px 8px; background: #fafbfc; border-radius: 8px; position: relative; align-items: end; }
  .row > .c-name { grid-column: 1 / -1; }
  .row .range { grid-column: span 2; }
  .range i { display: none; }
  .cell small { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .row-x { position: absolute; top: 6px; right: 4px; }
  .opt-total { min-width: 0; font-size: 14px; }
  .status-seg button { padding: 0 8px; }
  .e-date { width: 76px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; font-size: 12px; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block; }
  #printRoot h1 { font-size: 20px; }
  #printRoot h2 { font-size: 15px; margin: 18px 0 6px; border-bottom: 2px solid #000; display: flex; justify-content: space-between; }
  #printRoot h2.sub { font-size: 13px; border-bottom-width: 1px; margin-left: 12px; }
  .p-totals td { padding: 2px 16px 2px 0; }
  .p-job { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid #ccc; }
  .p-job-head { display: flex; justify-content: space-between; font-size: 13px; }
  .p-meta { color: #555; font-size: 11px; }
  .p-opt { margin: 4px 0 0 12px; }
  .p-opt table.bd { font-size: 11px; margin-bottom: 0; }
  a { color: #000; }
}

/* ---------- v2: users, groups, quick edit, sharing, reports ---------- */
.user-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px 0 4px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
}
.user-btn:hover { border-color: var(--line-strong); }
.user-btn .caret { font-size: 10px; color: var(--muted); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none;
}
.menu-title { padding: 8px 12px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.share-menu label { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.share-menu label:hover { background: var(--bg); }
.pad-s { padding: 6px 12px; }

/* Required / optional groups inside a section */
.grp-head {
  display: flex; justify-content: space-between; align-items: center; margin: 10px 2px 6px; padding: 0 2px 4px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); border-radius: 0;
}
.grp-head.opt { color: #5b47c9; border-bottom-color: #e3defb; }
.grp-head.drop-into { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.grp-total { font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; font-weight: 600; }
.job.is-opt { border-left: 3px solid #cfc7f6; }
.badge.user { background: #eef6f0; color: #2f6b45; }
.badge.share { background: var(--bg); color: var(--muted); font-weight: 500; }

/* Hover-to-edit values */
.foot-meta { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }

.share-btn {
  border: 1px dashed var(--line-strong); background: #fff; border-radius: 999px; padding: 4px 10px; height: 32px;
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }
.ov-meta { margin-bottom: 8px; }
.ov-meta .share-btn { height: 28px; font-size: 12px; }
.ov-head { user-select: none; }
.d-top .btns { align-items: center; }

/* Editor additions */
.share-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; }
.opt-share { min-height: 0; margin: 8px 0 0; }
.chip.sm { padding: 2px 10px; font-size: 12px; }
.ed-static { background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.ed-static p { white-space: pre-wrap; margin: 8px 0 0; }
.ed-static .ed-photos { margin-top: 10px; }
.opt-card.readonly { background: #fafbfc; }

/* Settings: users */
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.user-main { flex: 1; display: flex; flex-direction: column; min-width: 160px; }

/* Reports */
.report-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rep-info { min-width: 0; }
.rep-quick { margin-bottom: 8px; }
.rep-tree { border: 1px solid var(--line); border-radius: 10px; max-height: 46vh; overflow-y: auto; padding: 4px 0; }
.rep-sec { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px 4px; }
.rep-job { padding: 2px 12px; }
.rep-job.on { background: #f7f9ff; }
.rep-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.rep-title { flex: 1; min-width: 0; }
.rep-amt { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; white-space: nowrap; }
.rep-opts { display: flex; flex-direction: column; gap: 2px; padding: 0 0 8px 28px; font-size: 14px; }
.rep-opts label { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; cursor: pointer; }
.rep-show { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.rep-show label { display: flex; gap: 8px; align-items: center; cursor: pointer; }

@media (max-width: 720px) {
  .brand #brandName { display: none; }
  .user-btn .uname { display: none; }
  .tabs a { padding: 6px 6px; font-size: 14px; }
  .rep-show { grid-template-columns: 1fr; }
  .ov-head { flex-wrap: wrap; row-gap: 4px; }
  .ov-name { flex: 1 1 55%; min-width: 0; }
  .ov-head .badge { order: 5; }
}

@media print {
  .p-grp { font-size: 12px; margin: 8px 0 2px; color: #444; display: flex; justify-content: space-between; text-transform: uppercase; }
  .p-opt-head { display: flex; gap: 6px; }
  .p-opt-head > span:last-child { margin-left: auto; }
  .p-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
  .p-photos figure { margin: 0; }
  .p-photos img { width: 100%; border-radius: 4px; }
  .p-photos figcaption { font-size: 9px; color: #555; }

}

/* Report layout (the report area is only visible when printing) */
#printRoot { font-size: 12px; color: #000; }
#printRoot h1 { font-size: 20px; margin-bottom: 4px; }
#printRoot h2 { font-size: 15px; margin: 18px 0 6px; border-bottom: 2px solid #000; display: flex; justify-content: space-between; }
#printRoot h2.sub { font-size: 13px; border-bottom-width: 1px; margin-left: 12px; }
#printRoot .p-grp { font-size: 11px; margin: 8px 0 2px; color: #444; display: flex; justify-content: space-between; text-transform: uppercase; }
#printRoot .p-totals { margin: 8px 0 12px; }
#printRoot .p-totals td { padding: 2px 16px 2px 0; }
#printRoot .p-job { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid #ccc; }
#printRoot .p-job-head { display: flex; justify-content: space-between; font-size: 13px; gap: 12px; }
#printRoot .p-meta { color: #555; font-size: 11px; }
#printRoot .p-opt { margin: 6px 0 0 12px; }
#printRoot .p-opt-head { display: flex; gap: 6px; }
#printRoot .p-opt-head > span:last-child { margin-left: auto; }
#printRoot .p-opt table.bd { font-size: 11px; margin-bottom: 0; }
#printRoot .p-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
#printRoot .p-photos figure { margin: 0; }
#printRoot .p-photos img { width: 100%; border-radius: 4px; display: block; }
#printRoot .p-photos figcaption { font-size: 9px; color: #555; }

/* ---------- v3: access levels, history, photo groups ---------- */
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px; }
.seg.mini button { height: 28px; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.share-menu { min-width: 280px; }
.acc-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.acc-pick select { width: auto; }
.d-photo { position: relative; }
.d-photo.add {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
  background: #fafbfc; border: 1.5px dashed var(--line-strong); color: var(--muted); font-size: 20px; line-height: 1; font-weight: 600;
}
.d-photo.add small { font-size: 11px; margin-top: 2px; }
.d-photo.add:hover { border-color: var(--accent); color: var(--accent); outline: none; }
.ph-shared { position: absolute; right: 3px; bottom: 3px; background: rgba(255,255,255,.9); border-radius: 4px; font-size: 11px; padding: 0 3px; }
.photo-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 0; margin-bottom: 12px; background: #fcfcfd; }
.pg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.pg-head .share-btn { height: 28px; font-size: 12px; }
.pg-title { margin: 20px 0 10px; }
.pg-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg-title-row .pg-title { margin-bottom: 10px; }
.lb-share { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 2px 0; cursor: pointer; }
.ov-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ov-actions .link-btn.small { font-size: 13px; margin-left: auto; }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.hist-row.current { background: #f6fbf7; }
.hist-main { min-width: 0; }

/* ---------- v4: Not doing, Inspections & Reports, permissions ---------- */
.btn.ghost { border-style: dashed; color: var(--muted); }
.btn.ghost:hover { color: var(--red); border-color: var(--red); background: #fff; }
.undo-bar { display: inline-flex; align-items: center; gap: 10px; padding: 3px 4px 3px 12px; border-radius: 8px; background: #fff7ed; border: 1px solid #fed7aa; font-size: 13px; font-weight: 600; }
.suggest-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: var(--amber-soft); font-size: 14px; }
.radio-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-weight: 600; cursor: pointer; }
.tab-short { display: none; }

.stat .of { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat.total .of { color: #b8c0cc; }
.stat .bar { height: 5px; background: #e3e6ea; border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.stat.total .bar { background: #3a4452; }
.stat .bar span { display: block; height: 100%; background: var(--green); }

.insp-doc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 22px; box-shadow: var(--shadow); }
.insp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.insp-prog { font-weight: 700; font-size: 14px; white-space: nowrap; color: var(--green); }
details.facts, .ref-panels details { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fafbfc; }
details > summary { cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 14px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--muted); }
details[open] > summary::before { content: "▾ "; }
details > *:not(summary) { margin-left: 12px; margin-right: 12px; }
details[open] { padding-bottom: 8px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 14px; margin-top: 0; }
dt { font-weight: 600; color: var(--muted); }
dd { margin: 0; }
.ref-panels { margin-bottom: 8px; }
.auth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.auth-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; font-size: 13px; }
.auth-card p { margin: 6px 0 0; }
.process { font-size: 14px; padding-left: 22px; margin: 4px 0; }
.process li { margin-bottom: 6px; }
.codes { font-size: 13px; }
.warn-note { background: var(--amber-soft); color: #7c3d06; border-radius: 8px; padding: 9px 12px; margin: 8px 0; font-size: 14px; }
.grp-note { margin: 0 2px 8px; }

.badge.auth { font-weight: 700; }
.badge.auth-low { background: #e6f4ea; color: #1f7a3a; }
.badge.auth-moderate { background: #fff1d6; color: #9a5b00; }
.badge.auth-high { background: var(--red-soft); color: var(--red); }
.badge.insp { background: #eaf2ff; color: #1e4fb8; }
.badge.insp.lead { background: #fdf0e6; color: #a2470b; }
.badge.job-count { background: var(--bg); color: var(--text); }

.insp-item { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: #fff; }
.insp-item.open { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(16, 24, 40, .07); }
.insp-item.optional { border-style: dashed; }
.ii-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.ii-row:hover .ii-title { color: var(--accent); }
.ii-ref { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 700; background: var(--bg); padding: 2px 6px; border-radius: 5px; white-space: nowrap; flex: none; }
.ii-main { flex: 1; min-width: 0; }
.ii-title { font-weight: 600; }
.ii-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.insp-item.done .ii-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7bec7; }
.insp-item.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.check.auto { cursor: default; }
.check:disabled { cursor: default; }
.insp-item:not(.done) .check:disabled:hover { border-color: var(--line-strong); color: transparent; }
.insp-item .chev { color: var(--muted); font-size: 12px; transition: transform .15s; }
.insp-item.open .chev { transform: rotate(180deg); }
.ii-detail { border-top: 1px solid var(--line); padding: 12px 14px 14px 46px; font-size: 14px; }
.ii-detail p { margin-bottom: 8px; }
.ii-notes { color: var(--muted); }
table.readings { border-collapse: collapse; font-size: 13px; margin: 6px 0 10px; width: 100%; }
table.readings th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 4px 8px 4px 0; }
table.readings td { border-bottom: 1px solid #f0f2f4; padding: 4px 8px 4px 0; }
.approaches { margin-bottom: 8px; }
.appr { padding: 3px 0; }
.ii-steps { margin: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 2px 0; font-size: 14px; }
.step input { margin-top: 3px; }
.step.done { color: var(--muted); text-decoration: line-through; }
.ii-jobs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.job-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; }
.job-chip.done { background: var(--green-soft); }
.ii-job-btns { display: inline-flex; gap: 6px; margin-left: auto; }

.insp-req .req-card { border: 1px solid var(--line); border-left: 4px solid #8fb1f5; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.insp-req .req-card.lead { border-left-color: #f0a46b; }
.rc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rc-status { margin-left: auto; }
.insp-chip { display: inline-flex; align-items: center; gap: 6px; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 11px; padding: 0 2px; }
.pick-list { max-height: 50vh; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; border-bottom: 1px solid #f0f2f4; font-size: 14px; }

.perm-block { margin-bottom: 18px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f2f4; }
.perm-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.perm-row select { width: auto; }
.perm-row.perm-job { padding: 5px 0 5px 12px; font-size: 14px; }
.perm-row.bulk { flex-wrap: wrap; }
.perm-sec { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 4px 0; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.perm-sec select { width: auto; text-transform: none; }

@media (max-width: 720px) {
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .auth-grid { grid-template-columns: 1fr; }
  .ii-detail { padding-left: 14px; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 6px; }
}
@media (max-width: 720px) { .tabs { overflow-x: auto; scrollbar-width: none; min-width: 0; } .tabs a { white-space: nowrap; } .brand { flex: none; } }

#printRoot .p-insp { width: 100%; border-collapse: collapse; font-size: 11px; }
#printRoot .p-insp td { border-bottom: 1px solid #ccc; padding: 3px 6px 3px 0; vertical-align: top; }
@media (max-width: 1000px) { .tab-long { display: none; } .tab-short { display: inline; } }

/* ---------- v5: simple inspections overview, work order ---------- */
.insp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-top: 18px; box-shadow: var(--shadow); }
.insp-card h2 { margin-bottom: 4px; }
.ic-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.insp-card > p.muted { margin-bottom: 10px; }
.cl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.cl-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid #f0f2f4; font-size: 14px; }
.cl-row .check { margin-top: 1px; }
.cl-row.done .cl-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7bec7; }
.cl-row.done .check, .fr.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.fr { display: flex; align-items: flex-start; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #f0f2f4; }
.fr:last-of-type { border-bottom: 0; }
.fr .check { margin-top: 1px; }
.fr .ii-ref { margin-top: 2px; min-width: 76px; text-align: center; }
.ii-ref.lead { background: #fdf0e6; color: #a2470b; font-family: inherit; }
.fr-main { flex: 1; min-width: 0; }
.fr-title { font-weight: 600; font-size: 14.5px; }
.fr.done .fr-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7bec7; }
.fr-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.fr-req { color: var(--text); }
.fr-meta .job-chip { padding: 1px 10px; text-decoration: none; color: var(--accent); }
.fr-meta .job-chip.done { color: var(--green); }
.lead-rules { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; font-size: 14px; }
.lead-rules ul { padding-left: 20px; margin: 6px 12px; }
.insp-note { border-left: 4px solid #8fb1f5; background: #f5f8ff; border-radius: 6px; padding: 8px 12px; margin: 12px 0 4px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.insp-note.lead { border-left-color: #f0a46b; background: #fff8f2; }

.wo-user { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.wo-user select { width: auto; }
.wo-list { list-style: none; padding: 0; margin: 0 0 16px; }
.wo-row { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 10px 6px; margin-bottom: 6px; box-shadow: var(--shadow); }
.wo-row .handle { visibility: visible; cursor: grab; }
.wo-row.dragging { opacity: .4; }
.wo-row.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.wo-row.drop-after { box-shadow: 0 3px 0 var(--accent); }
.wo-num { width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.wo-row.done .wo-num { background: var(--green); }
.wo-row.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.wo-row.done .wo-title { color: var(--muted); text-decoration: line-through; }
.wo-main { flex: 1; min-width: 0; }
.wo-title { font-weight: 600; color: var(--text); }
.wo-btns { display: flex; }
@media (max-width: 720px) {
  .cl-cols { grid-template-columns: 1fr; }
  .fr .ii-ref { min-width: 0; }
  .page-head { flex-wrap: wrap; }
  .wo-row .handle { display: none; }
}
.tabs a { white-space: nowrap; }
@media (max-width: 1000px) { .tabs a { padding: 7px 8px; } .tabs { gap: 0; } }
@media (max-width: 1000px) {
  .brand #brandName { display: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; min-width: 0; }
}

/* ---------- v6: clearer sections, quieter optional jobs, work order phases ---------- */
.sec.depth0 { --sc: #6b7482; margin: 0 0 28px; }
.sec.depth0 > .sec-head {
  background: color-mix(in srgb, var(--sc) 9%, #fff); border: 1px solid color-mix(in srgb, var(--sc) 22%, #fff);
  border-left: 5px solid var(--sc); border-radius: 12px; padding: 8px 10px 8px 12px; gap: 10px; margin-bottom: 10px;
}
.sec.depth0.unsorted > .sec-head { background: #f0f1f4; border-color: #e1e4e8; border-left-color: #9aa2ad; }
.sec.depth0 > .sec-head .chev { cursor: pointer; padding: 4px; }
.sec.depth0 > .sec-head .sec-toggle { gap: 12px; }
.sec-badge {
  width: 32px; height: 32px; border-radius: 9px; background: var(--sc); color: #fff; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.sec-titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sec-kicker { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--sc); }
.sec.depth0 .sec-name { font-size: 18px; font-weight: 750; }
.sec-count { color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.sec-total { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; color: var(--text); }
.opt-total { font-size: 12px; font-weight: 500; color: var(--muted); }
.sec.depth0 > .sec-body { padding-left: 14px; border-left: 2px solid color-mix(in srgb, var(--sc) 18%, #fff); margin-left: 14px; }
.sec-details { margin: -2px 2px 10px; color: #4a5361; font-size: 14px; white-space: pre-line; }
.sec-details .qe { cursor: pointer; }
.sec.depth1 { margin: 18px 0 8px; }
.sec-head.sub { padding: 0 2px 6px; margin-bottom: 8px; border-bottom: 1px solid var(--line); border-radius: 0; gap: 8px; }
.sec-head.sub .sec-num { color: var(--sc); font-weight: 750; }
.sec-head.sub .sec-name { font-size: 15px; font-weight: 700; }
.sec-head.sub .sec-total { font-size: 13px; }
.sec-head.sub.drop-into { border-radius: 6px; }
.grow { flex: 1; }

/* Optional jobs: same list, visibly lighter */
.badge.opt { background: #eceef1; color: #5f6875; font-weight: 600; }
.job.is-opt { border-left: 1px solid var(--line); border-style: dashed; background: #fbfbfc; box-shadow: none; }
.job.is-opt .job-title { color: #4a5361; font-weight: 550; }
.job.is-opt .job-price { color: var(--muted); font-weight: 550; }
.job.is-opt.open { border-style: solid; background: var(--card); }

/* Work order */
.step-num {
  min-width: 26px; height: 26px; border-radius: 50%; background: #2b3340; color: #fff; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0 4px;
}
.st-done .step-num { background: var(--green); }
.list-foot { display: flex; gap: 18px; }
@media (max-width: 720px) {
  .sec.depth0 > .sec-body { padding-left: 0; border-left: 0; margin-left: 0; }
  .sec.depth0 .sec-name { font-size: 16px; white-space: normal; }
  .sec-badge { width: 28px; height: 28px; font-size: 14px; }
}

/* Inspections: step-by-step guide and linked jobs */
.guide-h { font-size: 15px; margin: 18px 0 6px; padding: 6px 10px; border-radius: 8px; background: #eef4ff; color: #1e4fb8; }
.guide-h.lead { background: #fff3e8; color: #a2470b; }
.guide-h .muted { font-weight: 500; }
.guide { list-style: none; padding: 0; margin: 0; }
.g-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid #f0f2f4; }
.g-step:last-child { border-bottom: 0; }
.g-step .check { margin-top: 1px; }
.g-step.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.g-num { width: 22px; height: 22px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.g-body { flex: 1; min-width: 0; }
.g-title { font-weight: 650; font-size: 15px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.g-n { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.g-step.done .g-title { color: var(--muted); text-decoration: line-through; text-decoration-color: #b7bec7; }
.g-how { margin: 6px 0 4px; padding-left: 18px; font-size: 14px; color: #3a4350; }
.g-how li { margin-bottom: 3px; }
.g-sub { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 6px; }
.risk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.risk-card { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 13px; background: #fff; }
.risk-card p { margin: 5px 0 0; }
.fix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fix-table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 4px 8px 4px 0; }
.fix-table td { border-bottom: 1px solid #f0f2f4; padding: 6px 8px 6px 0; vertical-align: top; }
.fix-table .ii-ref { font-size: 11px; padding: 1px 5px; }

.fr { display: grid; grid-template-columns: 22px 1fr 260px; gap: 12px; padding: 12px 2px; }
.fr-title { display: block; }
.fr-title .ii-ref { display: inline-block; margin: 0 6px 0 0; min-width: 0; vertical-align: 1px; }
.fr-req { font-size: 13.5px; margin-top: 4px; color: #3a4350; }
.fr-req .badge { margin-left: 4px; }
.linked { border-left: 3px solid #dbe5f7; padding: 2px 0 2px 12px; font-size: 13.5px; }
.linked-title { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.linked-list { list-style: none; padding: 0; margin: 0 0 4px; }
.linked-list li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.linked-list a { color: var(--accent); text-decoration: none; display: inline-flex; gap: 6px; min-width: 0; }
.linked-list a:hover { text-decoration: underline; }
.lj-dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; margin-top: 2px; }
.linked-list li.done .lj-dot { background: var(--green); border-color: var(--green); color: #fff; }
.linked-list li.done a { color: var(--green); }
.lj-st { color: var(--muted); font-size: 12px; white-space: nowrap; }
.photo-jobs .linked-title { margin: 6px 0 2px; }
@media (max-width: 720px) {
  .fr { grid-template-columns: 22px 1fr; }
  .fr .linked { grid-column: 2; }
  .risk-grid { grid-template-columns: 1fr; }
}

/* Jobs page: All jobs / Work order switch */
.view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.view-seg button { height: 36px; padding: 0 16px; font-weight: 600; font-size: 14px; }
.view-hint { flex: 1; min-width: 200px; }

/* Jobs page: All jobs / Work order switch */
.view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.view-seg button { height: 36px; padding: 0 16px; font-weight: 600; font-size: 14px; }
.view-hint { flex: 1; min-width: 200px; }

/* Job details: "Heading:" lines and "- " bullets */
.d-details { white-space: normal; margin-bottom: 14px; font-size: 14.5px; color: #2b3340; }
.d-details > .qe { display: block; }
.d-details p { margin: 0 0 6px; }
.d-details ul { margin: 2px 0 10px; padding-left: 20px; }
.d-details li { margin-bottom: 3px; }
.dd-h { font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 12px 0 3px; }
.d-details .qe > .dd-h:first-child, .d-details > .dd-h:first-child { margin-top: 0; }
.dd-h.warn { color: var(--amber); }
.dd-h.lead { color: #a2470b; }



/* Project-wide costs: a card in the totals row that opens the list */
.summary.four { grid-template-columns: repeat(4, 1fr); }
button.stat { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.proj-stat { background: #f7f8fa; border-style: dashed; transition: border-color .12s, background .12s; }
.proj-stat:hover { border-color: var(--accent); background: #fff; }
.proj-open { color: var(--accent); font-weight: 600; white-space: nowrap; }
.pc-list { border-top: 1px solid var(--line); margin-top: 10px; }
.pc-row { border-bottom: 1px solid var(--line); }
.pc-line { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.pc-name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.pc-name:hover { color: var(--accent); }
.pc-price { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-price small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.pc-row .chev { color: var(--muted); font-size: 12px; cursor: pointer; transition: transform .15s; }
.pc-row.open .chev { transform: rotate(180deg); }
.pc-row.st-done .check { background: var(--green); border-color: var(--green); color: #fff; }
.pc-row.st-done .pc-name { color: var(--muted); text-decoration: line-through; }
.pc-row.st-dropped .pc-name, .pc-row.st-dropped .pc-price { color: var(--muted); }
.pc-detail { padding: 2px 4px 12px 34px; }
.pc-actions { display: flex; gap: 8px; margin-top: 10px; }
.pc-total { display: flex; justify-content: space-between; padding: 12px 2px 0; font-size: 15px; }
@media (max-width: 1000px) { .summary.four { grid-template-columns: 1fr 1fr; } .summary.four .stat.total { grid-column: auto; } }
@media (max-width: 720px) { .pc-detail { padding-left: 4px; } }

/* Edit mode (inline). Values only become boxes while a job is being edited. Each box grows outward around the
   text (negative margin = padding + border), so nothing moves when Edit mode turns on, and the real input that
   opens on click takes exactly the box's place. */
.qe {
  display: inline; cursor: text; padding: 1px 4px; margin: 0 -5px; border: 1px solid var(--line-strong); border-radius: 5px;
  background: #fff; color: var(--text); -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: border-color .12s;
}
.qe:hover { border-color: #93a9d6; }
.qe[data-qt=select] { cursor: pointer; }
.qe[data-qt=select]::after { content: " ▾"; font-size: .8em; color: var(--muted); }
.qe.editing { display: none; }
input.qe-input, select.qe-input, textarea.qe-input {
  display: inline-block; height: auto; width: auto; margin: -2px -5px; padding: 1px 4px; line-height: inherit; min-height: 0;
  font: inherit; color: var(--text); vertical-align: baseline; border-radius: 5px;
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea.qe-input { display: block; width: 100%; margin: 0; padding: 8px 10px; resize: vertical; }
.d-details > .qe, .sec-details > .qe { display: block; margin: -9px -11px; padding: 8px 10px; }
.d-details > textarea.qe-input { margin: -9px -11px; width: calc(100% + 22px); }
.job.editing .d-details { margin-top: 18px; margin-bottom: 22px; }
.d-details.muted > .qe { color: var(--muted); }
.job-title .qe { font-weight: inherit; }

.job.editing { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12), 0 4px 16px rgba(16, 24, 40, .08); }
.edit-bar { align-items: center; }
.edit-badge { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; }
.edit-fields { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin: -4px 0 14px; font-size: 14px; color: var(--muted); }
.ef { display: inline-flex; align-items: center; gap: 10px; }
.ef select { width: auto; max-width: 260px; }
.ph-wrap { position: relative; display: inline-flex; }
.ph-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #2b3340; color: #fff; font-size: 11px; cursor: pointer; }
.ph-x:hover { background: var(--red); }
.row-x { margin-left: 6px; color: var(--muted); }
.row-x:hover { color: var(--red); }
.tax-tog { border: 1px solid var(--line-strong); background: #fff; color: var(--muted); border-radius: 99px; font: inherit; font-size: 12px; padding: 0 8px; cursor: pointer; margin-left: 4px; }
.tax-tog.on { background: var(--accent-soft); border-color: #b9cdf7; color: var(--accent); }
.opt-tools-inline { display: inline-flex; gap: 2px; margin-left: 4px; }
.resource.editing { display: flex; gap: 14px; align-items: center; padding: 4px 0; }
.job.editing .add-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 4px; }
.qe-after { margin-left: 14px; font-size: 12.5px; }
.job.editing table.bd td { padding-top: 6px; padding-bottom: 6px; }

/* Typing straight into a value box: same box, so nothing moves */
.qe { position: relative; }
.qe.live { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); outline: none; cursor: text; white-space: pre-wrap; }
.qe.live:empty { display: inline-block; min-width: 4em; vertical-align: bottom; }
.qe[data-qt=select].live::after { content: " ▾"; }
.qe-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; }

/* Receipt scanning */
.rcpt { display: grid; grid-template-columns: minmax(200px, 1fr) 1.2fr; gap: 18px; }
.rcpt-img { min-height: 360px; border-radius: 10px; background: #f1f3f6 center / contain no-repeat; border: 1px solid var(--line); }
.rcpt-status { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.rcpt-status .bar { height: 6px; background: #e3e6ea; border-radius: 99px; overflow: hidden; }
.rcpt-status .bar span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.rcpt-status.ok { background: var(--green-soft); color: var(--green); }
.rcpt-status.ok .bar span { background: var(--green); }
.rcpt-status.warn { background: var(--amber-soft); color: #7c3d06; }
.rcpt-btn { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 0 2px; }
@media (max-width: 720px) { .rcpt { grid-template-columns: 1fr; } .rcpt-img { min-height: 220px; } }

/* Linking photos to jobs (Photos tab) */
.photo-link-btn { margin-top: 6px; }
.lb-job { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lb-job .job-link { flex: 1; min-width: 0; }
.pjp-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.pjp-thumb { width: 56px; height: 42px; border-radius: 6px; background: #eee center / cover; flex: none; border: 1px solid var(--line); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-chips .chip { display: inline-flex; align-items: center; gap: 4px; }
.cat-add { width: auto; flex: 1; min-width: 150px; }
.photo-info .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.job-link.add-link::before { content: none; }
.job-link.add-link { color: var(--accent); }

/* Jobs page: one totals bar, then the project-wide costs panel */
.totals { display: grid; grid-template-columns: 1fr 1fr 1.15fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.t-cell { padding: 14px 18px; min-width: 0; }
.t-cell + .t-cell { border-left: 1px solid var(--line); }
.t-cell.total { background: var(--text); color: #fff; border-left-color: var(--text); }
.t-cell.total .stat-label, .t-cell.total .stat-sub { color: #b8c0cc; }
.proj-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px 10px; margin: -8px 0 20px; }
.pp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pp-title { font-weight: 700; font-size: 15px; margin-right: 8px; }
.pp-sub { font-size: 13px; color: var(--muted); }
.pp-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pp-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f2f4; }
.pp-row .check { flex: none; }
.pp-row.st-done .check { background: var(--green); border-color: var(--green); color: #fff; }
.pp-row.st-done .pp-name { color: var(--muted); text-decoration: line-through; }
.pp-main { flex: 1; min-width: 0; }
.pp-name { font-weight: 600; color: var(--text); text-decoration: none; }
.pp-name:hover { color: var(--accent); }
.pp-links { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 1px; }
.pp-links a { color: var(--accent); text-decoration: none; }
.pp-links a:hover { text-decoration: underline; }
.pp-links .sep { color: #c3c9d1; }
.pp-price { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pp-price small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.pp-foot { display: flex; justify-content: space-between; padding-top: 8px; font-size: 13px; }
.pp-add, .pp-more { color: var(--accent); text-decoration: none; font-size: 13px; }
.pc-note { border-left: 4px solid #c9d2df; background: #f7f8fa; border-radius: 6px; padding: 8px 12px; margin: 12px 0 4px; font-size: 14px; }
.pc-note a { color: var(--accent); }
@media (max-width: 720px) {
  .totals { grid-template-columns: 1fr 1fr; }
  .t-cell.total { grid-column: 1 / -1; border-left: 0; }
  .t-cell { padding: 12px; }
  .pp-sub { display: block; }
}

/* Project-wide costs, two columns: total on the left, one line per item on the right */
.proj-panel { display: grid; grid-template-columns: 1fr 2.15fr; padding: 0; overflow: hidden; margin: -8px 0 20px; }
.pp-left { border-right: 1px solid var(--line); }
.pp-list { padding: 6px 10px 6px; min-width: 0; }
.pp-line { display: flex; align-items: baseline; gap: 12px; width: 100%; border: 0; background: none; font: inherit; color: var(--text); text-align: left;
  padding: 3px 8px; border-radius: 6px; cursor: pointer; line-height: 1.45; }
.pp-line:hover { background: var(--bg); }
.pp-line:hover .pp-name { color: var(--accent); }
.pp-line .pp-name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.pp-line .pp-price { font-weight: 600; font-size: 14px; }
.pp-line.st-done .pp-name, .pp-line.st-done .pp-price { color: var(--muted); }
.pp-list .pp-foot { padding: 4px 8px 2px; border-top: 1px solid #f0f2f4; margin-top: 4px; }
.pci-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.pci-for { font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 12px; }
.pci-for a { color: var(--accent); text-decoration: none; }
.pci-for .sep { color: #c3c9d1; }
@media (max-width: 720px) { .proj-panel { grid-template-columns: 1fr; } .pp-left { border-right: 0; border-bottom: 1px solid var(--line); } }

/* Details: plain text exactly as typed, edited in place */
.d-details { white-space: pre-wrap; }
.d-details > .qe.live { white-space: pre-wrap; }
.proj-panel { margin: 12px 0 20px; }
/* Work order: project items at the top */
.proj-items { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px 6px; margin-bottom: 18px; }
.pi-title { font-weight: 700; font-size: 15px; padding: 0 8px 6px; }
.pi-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
@media (max-width: 720px) { .pi-grid { grid-template-columns: 1fr; } }
.fr .linked.photo-jobs { border-left: 0; padding: 0; }
.fr .linked .job-link { font-size: 13px; }

/* Print icon (opens Printouts) at the right end of the bar above the totals */
.print-btn { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); }
.print-btn:hover { border-color: var(--accent); color: var(--accent); }
.back-link { display: inline-block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 4px; }
.back-link:hover { color: var(--accent); }

/* Print dialog */
button.print-btn { cursor: pointer; padding: 0; font: inherit; }
.pr-seg { display: flex; }
.pr-seg button { flex: 1; height: 36px; font-size: 14px; }
.pr-links { display: flex; gap: 16px; margin-top: 6px; font-size: 13px; }
.pr-links a, .pr-csv { color: var(--accent); text-decoration: none; font-size: 13px; }
/* Printed pages: simple lists and plain details */
#printRoot .p-simple { list-style: none; padding: 0; margin: 4px 0 10px; }
#printRoot .p-simple li { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; border-bottom: 1px solid #e3e3e3; font-size: 12.5px; break-inside: avoid; }
#printRoot .p-simple li i { color: #666; }
#printRoot .p-simple li.done { color: #666; }
#printRoot .p-box { width: 11px; height: 11px; border: 1px solid #555; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; flex: none; position: relative; top: 1px; }
#printRoot .p-num { font-weight: 700; }
#printRoot .p-sum { margin: 4px 0 10px; color: #333; }
#printRoot .p-details { white-space: pre-wrap; margin: 4px 0; }

/* Work order: project items, styled like a phase */
.proj-sec .sec-badge { font-size: 14px; }
.pi-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 6px; }
.pi-row:hover .pi-name { color: var(--accent); }
.pi-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-where { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pi-price { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pi-row.st-done .pi-name { color: var(--muted); text-decoration: line-through; }
.proj-sec .pp-foot { padding: 2px 4px; }
.phase-items a { color: var(--accent); text-decoration: none; font-weight: 500; }
.phase-items .sep { color: #c3c9d1; }
.pi-label { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.pick-row.sub { padding-left: 24px; }
@media (max-width: 720px) { .pi-where { display: none; } }

/* Work order: project items collapsed at the top; "Link project items" line in each phase */
.proj-sec > .sec-head { cursor: pointer; }
.proj-sec .sec-count { margin-left: 6px; color: var(--accent); font-weight: 600; }
.phase-items { margin: -2px 0 10px; border: 1px dashed color-mix(in srgb, var(--sc) 35%, #fff); border-radius: 8px; background: color-mix(in srgb, var(--sc) 4%, #fff); }
.pi-line { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; font: inherit; text-align: left; padding: 7px 12px; cursor: pointer; color: var(--text); }
.pi-line:disabled { cursor: default; }
.pi-line .pi-label { color: var(--sc); margin: 0; }
.pi-linked { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-line .chev { color: var(--muted); font-size: 12px; transition: transform .15s; }
.phase-items.open .pi-line .chev { transform: rotate(180deg); }
.pi-opt { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.pi-opt:hover { background: #fff; }
.pi-opt-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .pi-drop { grid-template-columns: 1fr; } }
.sec-details-edit { cursor: pointer; }
.sec-details-edit:hover { color: var(--accent); }
.doc-link { color: var(--accent); text-decoration: none; white-space: nowrap; }
.doc-link:hover { text-decoration: underline; }
.pi-drop { border-top: 1px solid color-mix(in srgb, var(--sc) 20%, #fff); padding: 6px 8px 8px; }
.pi-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
.pi-opt { min-width: 0; overflow: hidden; }
.pi-opt input { flex: none; }
.pi-opt-cost { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.pi-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; margin-top: 4px; border-top: 1px solid color-mix(in srgb, var(--sc) 15%, #fff); }
@media (max-width: 720px) { .pi-opts { grid-template-columns: minmax(0, 1fr); } }
.ic-head { align-items: center; }
.ic-right { display: inline-flex; align-items: center; gap: 14px; flex: none; }
.doc-btn { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 10px; background: #fff; }
.doc-btn:hover { border-color: var(--accent); }
@media (max-width: 720px) { .ic-head { flex-wrap: wrap; } }

/* Work order: each phase's project items section (own lines, open like jobs) */
.phase-items .pi-items { padding: 4px 8px 6px; }
.phase-items .pi-items .job { margin-bottom: 6px; box-shadow: none; }
.phase-items .pi-items .job:not(.open) .job-row { padding-top: 7px; padding-bottom: 7px; }
.pi-item { display: flex; align-items: flex-start; gap: 8px; }
.pi-item > .job { flex: 1; min-width: 0; }
.pi-check { margin-top: 13px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); cursor: pointer; }
.pi-total { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }
.pi-add { display: block; width: calc(100% - 16px); margin: 2px 8px 4px; padding: 8px 12px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: #fff; color: var(--accent); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pi-add:hover { border-color: var(--accent); }
.phase-items .pi-drop { padding: 4px 0 8px; }
.phase-items .pi-actions { margin: 6px 8px 0; }

/* Online: sign-in page and the save status in the header */
.signin { max-width: 380px; margin: 60px auto; padding: 24px; }
.signin h2 { margin-bottom: 4px; }
.signin form { margin-top: 14px; display: flex; flex-direction: column; }
.signin .btn { margin-top: 6px; height: 40px; }
.sync-status { font-size: 12px; color: var(--muted); margin-right: 8px; white-space: nowrap; }
.sync-status[data-state=error] { color: var(--red); }
