:root {
  --blue: #1b5e9b;
  --blue-dark: #134a7c;
  --green: #1f8a4c;
  --red: #c0392b;
  --amber: #b9770e;
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #d9e0e7;
  --bg: #f2f5f8;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
a { color: var(--blue); }
p { margin: .4rem 0 .8rem; }
small, .muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; white-space: nowrap; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 24px; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.card.narrow { max-width: 460px; margin: 8vh auto 0; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card.job:active { background: #eef3f8; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head h1 { margin: 0; }
.back { margin: 0 0 8px; }
.client-line { font-size: 1.1rem; margin: 0 0 .5rem; }
.two-col, .three-col { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
.actions, .btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; }
.btn-row > * { flex: 1 1 220px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin: 0 0 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  font: inherit; font-weight: 400; color: var(--ink);
  padding: 12px; min-height: 48px;
  border: 1.5px solid #aeb9c5; border-radius: 10px; background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #7db4e6; outline-offset: 1px; }
input[type=file] { padding: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  font: inherit; font-weight: 700; text-align: center; text-decoration: none;
  color: var(--blue); background: #fff; border: 2px solid var(--blue); border-radius: 12px;
  cursor: pointer; margin: 0; -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.big { min-height: 60px; font-size: 1.1rem; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .95rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { filter: brightness(.9); }
button.link { background: none; border: 0; font: inherit; text-decoration: underline; cursor: pointer; padding: 4px; }
button.link.danger { color: var(--red); }

/* ---------- badges & notices ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: #e5eaf0; color: #33414f; white-space: nowrap; }
.st-new { background: #e5eaf0; }
.st-assigned { background: #fdebc8; color: #7a4d00; }
.st-in_progress { background: #d6e8fb; color: #0d4a86; }
.st-ready_for_office { background: #d8f1e2; color: #14683a; }
.st-qc { background: #e6dbf6; color: #4e2a84; }
.st-approved { background: #1f8a4c; color: #fff; }
.vis-manager { background: #fbdcd8; color: #8a2a1d; }
.vis-vendor { background: #d6e8fb; color: #0d4a86; }
.vis-both { background: #e5eaf0; }
.bid-accepted { background: #d8f1e2; color: #14683a; }
.bid-rejected { background: #fbdcd8; color: #8a2a1d; }
.bid-pending { background: #fdebc8; color: #7a4d00; }
.role-manager { background: #e6dbf6; color: #4e2a84; }
.role-vendor { background: #d6e8fb; color: #0d4a86; }
.notice { padding: 12px; border-radius: 10px; margin: 10px 0; font-weight: 600; }
.notice.error { background: #fbdcd8; color: #8a2a1d; }
.notice.ok { background: #d8f1e2; color: #14683a; }

/* ---------- top bar / bottom tabs / banner ---------- */
#banner { position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: #d6e8fb; color: #0d4a86; font-weight: 700; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
#banner.warn { background: #fdebc8; color: #7a4d00; }
#topbar { background: var(--blue); color: #fff; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#topbar .brand { font-weight: 800; font-size: 1.1rem; }
#topbar .topnav { display: none; gap: 4px; }
#topbar .topnav a { color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; }
#topbar .topnav a.active { background: rgba(255,255,255,.22); }
#topbar .who { display: flex; align-items: center; gap: 10px; }
#topbar .who span { display: none; }
#topbar .who small { color: #cfe1f2; }
#topbar .btn.small { display: none; }
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; min-height: 60px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 700; }
#tabbar a span { font-size: 1.35rem; line-height: 1.1; }
#tabbar a.active { color: var(--blue); }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 14px; font-size: .98rem; }
.card table.grid { border: 0; margin: 0; }
table.grid th, table.grid td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid thead th { background: #eef2f6; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.grid tbody tr[data-href] { cursor: pointer; }
table.grid tbody tr[data-href]:hover { background: #f3f8fd; }
table.grid tfoot th { border-bottom: 0; background: #fafbfc; font-size: 1rem; text-transform: none; color: var(--ink); }
.desktop-only { display: none; }

/* ---------- filters ---------- */
.filters { display: grid; gap: 10px; grid-template-columns: 1fr; align-items: end; }
.filters label, .filters input, .filters select { margin-bottom: 0; }

/* ---------- items, notes, photos ---------- */
.item-row { display: grid; grid-template-columns: 1fr 110px 44px; gap: 8px; margin-bottom: 8px; align-items: start; }
.item-row input { margin-top: 0; }
.note { border-top: 1px solid var(--line); padding: 10px 0; }
.note:first-child { border-top: 0; }
.note p { margin: .3rem 0 0; }
.note .meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.photo-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 8px; }
.photo { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.photo img { display: block; width: 100%; max-height: 320px; object-fit: cover; background: #e5eaf0; }
.photo .noimg { padding: 40px 12px; text-align: center; color: var(--muted); background: #eef2f6; }
.photo figcaption { padding: 10px; font-size: .9rem; display: grid; gap: 2px; }
.photo.pending { border-color: var(--amber); }
.pstatus { font-weight: 700; color: var(--amber); }
.margin-box { display: flex; flex-direction: column; justify-content: flex-end; margin-bottom: 12px; font-weight: 600; }
.margin-box b { font-size: 1.6rem; }
.margin-box b.pos { color: var(--green); }
.margin-box b.neg { color: var(--red); }
.doc { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc .actions { margin: 0; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { background: #25303c; color: #fff; padding: 14px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 560px; margin: 0 auto; }
.toast.error { background: var(--red); }

/* ---------- wider screens ---------- */
@media (min-width: 700px) {
  .two-col { grid-template-columns: 1fr 1fr; }
  .three-col { grid-template-columns: 1fr 1fr 1fr; }
  .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  main { padding-top: 20px; }
  #tabbar { display: none !important; }
  #topbar .topnav { display: flex; }
  #topbar .who span { display: inline; }
  #topbar .btn.small { display: inline-flex; background: transparent; color: #fff; border-color: #fff; }
  .desktop-only { display: table; }
  .mobile-only { display: none; }
  #toasts { bottom: 20px; }
}
@media print { #topbar, #tabbar, .btn, #banner { display: none !important; } }

/* ---------- Manager work order page (office look) ---------- */
body.mgr #topbar { background: #0a2f5c; }
body.mgr #topbar .topnav a.active { background: #1d4d86; }
.detail.mgr .wo-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  background: #fdfbd3; border: 1px solid #e6e0a0; border-radius: 8px 8px 0 0;
  padding: 8px 12px; font-size: .95rem; word-break: break-word;
}
.detail.mgr .wo-strip .badge { font-size: .8rem; }
.wo-tools { display: flex; flex-wrap: wrap; gap: 6px; background: #e8e8e8; border: 1px solid #d3d3d3; border-top: 0; padding: 6px 8px; }
.wo-tools .tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px;
  font: inherit; font-size: .95rem; font-weight: 700; color: #222; text-decoration: none;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.wo-tools .tool:hover { background: #d4d4d4; }
.wo-tabs {
  display: flex; gap: 2px; overflow-x: auto; white-space: nowrap;
  background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px;
  padding: 0 8px; margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.wo-tabs a { padding: 12px 14px; color: var(--blue); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.wo-tabs a:hover { background: #f3f8fd; }
.wo-tabs a.active { color: #000; font-weight: 800; border-bottom-color: var(--blue); }
.wo-layout { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 14px; }
.wo-layout .card { margin: 0; }
.infogrid { display: grid; grid-template-columns: minmax(96px, 120px) 1fr; align-items: stretch; }
.infogrid .lbl { text-align: right; color: var(--muted); font-weight: 600; padding: 10px 10px 0 0; }
.infogrid .val { border: 1px solid #555; margin: 0 0 -1px; padding: 8px 10px; min-height: 40px; word-break: break-word; background: #fff; }
.infogrid .val.wide { grid-column: auto; }
.card.side .saved { background: #c9e8c9; border: 1px solid #8fc58f; color: #1c5a1c; padding: 8px 10px; margin-bottom: 12px; font-weight: 600; }
@media (min-width: 900px) {
  .wo-layout { grid-template-columns: 1fr 320px; align-items: start; }
  .infogrid { grid-template-columns: 110px 1fr 110px 1fr; }
  .infogrid .val.wide { grid-column: span 3; }
}
@media print {
  .wo-tools, .wo-tabs, .card.side select { display: none; }
}

.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }
.doc-row .actions { margin: 0; }
#docform { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
#docform h3 { margin: 0 0 8px; font-size: 1.05rem; }

/* ---------- invoice editor (manager) ---------- */
.inv-block { margin-bottom: 26px; }
.inv-block h3 { margin: 0; font-size: 1.15rem; }
.inv-total { font-size: 1.1rem; }
.inv-head { display: none; }
.inv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; padding: 10px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 10px; align-items: center; }
.inv-row .i-desc { grid-column: 1 / -1; }
.inv-row input, .inv-row output { margin-top: 0; }
.inv-row output { display: block; padding: 12px; text-align: right; font-weight: 700; }
.inv-row .i-flat { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.inv-row input[type=checkbox], .checks input[type=checkbox] { width: 22px; height: 22px; min-height: 0; margin: 0; display: inline-block; }
.inv-row .i-del { justify-self: end; }
.inv-sum { display: grid; gap: 10px; justify-items: end; margin: 16px 0; }
.inv-sum label { margin: 0; display: flex; align-items: center; gap: 10px; }
.inv-sum label input { width: 110px; margin: 0; text-align: right; }
.inv-sum output, .inv-sum b { min-width: 110px; text-align: right; display: inline-block; font-weight: 700; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0 12px; }
.chk { display: flex; align-items: center; gap: 8px; margin: 0; }
.margin-bar { padding: 12px 14px; margin-bottom: 14px; background: #eef2f6; border-radius: 10px; font-weight: 600; }
.margin-bar b { font-size: 1.4rem; margin-left: 8px; }
.margin-bar b.pos { color: var(--green); }
.margin-bar b.neg { color: var(--red); }
@media (min-width: 900px) {
  .inv-head, .inv-row { grid-template-columns: minmax(200px, 1fr) 80px 110px 110px 100px 44px; }
  .inv-head { display: grid; gap: 8px; padding: 0 10px; font-size: .85rem; color: var(--muted); font-weight: 700; margin-top: 10px; }
  .inv-head span:nth-child(2), .inv-head span:nth-child(3), .inv-head span:nth-child(4) { text-align: right; }
  .inv-row { margin: 6px 0; padding: 6px 10px; background: #fff; }
  .inv-row .i-desc { grid-column: auto; }
}

.caps { text-transform: uppercase; letter-spacing: .03em; font-size: 1.05rem; }
#bidappform { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ---------- Admin drop-down (top menu) ---------- */
#topbar .topnav .dd { position: relative; }
#topbar .topnav .ddbtn { color: #fff; background: none; border: 0; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
#topbar .topnav .ddbtn.active, #topbar .topnav .ddbtn:hover { background: rgba(255,255,255,.22); }
body.mgr #topbar .topnav .ddbtn.active { background: #1d4d86; }
#topbar .topnav .ddmenu { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); padding: 6px; z-index: 60; }
#topbar .topnav .dd.open .ddmenu { display: block; }
#topbar .topnav .ddmenu a { display: block; color: var(--ink); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
#topbar .topnav .ddmenu a:hover, #topbar .topnav .ddmenu a.active { background: #eef3f8; color: var(--blue); }

/* ---------- Reports ---------- */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); margin: 10px 0 14px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 600; color: var(--muted); }
.tile b { display: block; font-size: 1.45rem; color: var(--ink); }
.tile b.pos, td.pos, th.pos { color: var(--green); }
.tile b.neg, td.neg, th.neg { color: var(--red); }
.table-scroll { overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.table-scroll table.grid { min-width: 720px; margin: 0; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(5, 1fr); } }
@media print { .no-print { display: none !important; } .table-scroll table.grid { min-width: 0; } }

.chk input[type=checkbox] { width: 22px; height: 22px; min-height: 0; margin: 0; display: inline-block; flex: none; }

/* ---------- rich text editor + display ---------- */
.rich ul, .rich ol, .re-box ul, .re-box ol { margin: .2rem 0 .2rem 1.3rem; padding: 0; }
.rich p, .rich div { margin: 0; }
.item-row { align-items: start; }
.item-row .price { margin-top: 0; }
.re { border: 1.5px solid #aeb9c5; border-radius: 10px; background: #fff; overflow: hidden; min-width: 0; }
.re:focus-within { outline: 3px solid #7db4e6; outline-offset: 1px; }
.re-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; background: #eef2f6; border-bottom: 1px solid var(--line); }
.re-bar button { min-width: 40px; min-height: 40px; padding: 4px 10px; font: inherit; font-size: .95rem; color: var(--ink); background: #fff; border: 1px solid #aeb9c5; border-radius: 8px; cursor: pointer; }
.re-bar button:active { background: #dbe6f1; }
.re-colors { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; }
.re-bar .re-sw { min-width: 30px; width: 30px; min-height: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #aeb9c5; }
.re-pick { display: inline-flex; align-items: center; gap: 2px; margin: 0; font-weight: 400; cursor: pointer; }
.re-pick input { width: 30px; height: 30px; min-height: 0; padding: 0; margin: 0; border: 0; background: none; }
.re-box { min-height: 84px; padding: 10px 12px; font-size: 1rem; font-weight: 400; outline: none; word-break: break-word; }
.re-box:empty::before { content: attr(data-placeholder); color: #8794a3; }

/* Work to do lines: editor gets the full width on phones */
.item-row { grid-template-columns: 1fr auto; }
.item-row .re-slot { grid-column: 1 / -1; }
.item-row .price { width: 100%; }
@media (min-width: 700px) {
  .item-row { grid-template-columns: 1fr 140px 44px; }
  .item-row .re-slot { grid-column: auto; }
}
#topbar .who a { color: #fff; text-decoration: none; }
#topbar .who a:hover { text-decoration: underline; }
#topbar .who a small { color: #cfe1f2; }

/* ---------- photos: card buttons, deleted list ---------- */
.row.wrap { flex-wrap: wrap; }
.small { font-size: .9rem; }
.link-label { display: inline; margin: 0; font-weight: 400; color: var(--blue); text-decoration: underline; cursor: pointer; }
.link-label.btn { display: inline-flex; text-decoration: none; font-weight: 700; color: #fff; margin: 0; }
.photo-open { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; }
.photo .actions { margin-top: 6px; }
.photo.gone img { opacity: .55; filter: grayscale(.6); }
details.deleted { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
details.deleted summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
details.deleted h3 { margin: 14px 0 6px; font-size: 1.05rem; }

/* ---------- live camera ---------- */
body.cam-open, body.pv-open { overflow: hidden; }
.cam-overlay { position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; display: flex; flex-direction: column; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: camflash .18s ease-out; }
@keyframes camflash { from { opacity: .85; } to { opacity: 0; } }
.cam-top, .cam-bottom { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.55), transparent); }
.cam-bottom { margin-top: auto; padding-top: 14px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.cam-btn { min-width: 56px; min-height: 48px; padding: 8px 16px; font: inherit; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.7); border-radius: 12px; cursor: pointer; }
.cam-count { font-weight: 700; font-size: 1.1rem; text-shadow: 0 1px 3px #000; }
.cam-count b { font-size: 1.5rem; }
.cam-shutter { width: 80px; height: 80px; border-radius: 50%; background: #fff; border: 6px solid rgba(255,255,255,.55); box-shadow: 0 0 0 3px #000 inset; cursor: pointer; }
.cam-shutter:active { transform: scale(.92); }
.cam-shutter:disabled { opacity: .35; }
.cam-thumb { width: 64px; height: 64px; border-radius: 10px; background: #222 center / cover; border: 2px solid rgba(255,255,255,.7); }
.cam-state { width: 64px; text-align: center; font-size: .85rem; font-weight: 700; text-shadow: 0 1px 3px #000; }
.cam-msg { position: relative; z-index: 2; margin: auto 20px; padding: 16px; text-align: center; background: rgba(0,0,0,.75); border-radius: 12px; font-size: 1.05rem; }

/* ---------- big photo viewer ---------- */
.pv-overlay { position: fixed; inset: 0; z-index: 250; background: rgba(0,0,0,.82); display: flex; align-items: center; justify-content: center; padding: 12px; }
.pv-card { display: flex; flex-direction: column; width: min(1180px, 100%); max-height: calc(100vh - 56px); background: #f9f9f9; color: var(--ink); border-radius: 14px; overflow: hidden; }
.pv-stage { position: relative; flex: 1 1 auto; min-height: 42vh; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; font-size: 2rem; line-height: 1; color: #fff; background: rgba(0,0,0,.45); border: 0; border-radius: 10px; cursor: pointer; z-index: 2; }
.pv-prev { left: 8px; } .pv-next { right: 8px; }
.pv-info { flex: 0 0 auto; max-height: 40vh; overflow-y: auto; padding: 14px 16px; }
.pv-info h3 { margin: 0 0 8px; }
.pv-info dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: .92rem; }
.pv-info dt { color: var(--muted); font-weight: 700; }
.pv-info dd { margin: 0; word-break: break-all; }
.pv-info textarea { min-height: 0; margin-bottom: 6px; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pv-close { position: absolute; top: 10px; right: 12px; z-index: 5; width: 44px; height: 44px; font-size: 1.3rem; color: #222; background: #fff; border: 0; border-radius: 50%; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.pv-count { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); padding: 4px 14px; font-size: .9rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.7); border-radius: 999px; }
@media (min-width: 900px) {
  .pv-card { flex-direction: row; height: min(760px, calc(100vh - 56px)); }
  .pv-stage { flex: 1 1 auto; min-height: 0; }
  .pv-info { flex: 0 0 340px; max-height: none; }
}
@media print { .cam-overlay, .pv-overlay { display: none; } }

/* ---------- manager: dense photo grid (like the office system) ---------- */
.tile-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); margin-top: 10px; }
.tile-grid[hidden] { display: none; }
.ptile { position: relative; aspect-ratio: 4 / 3; background: #e5eaf0; border: 1px solid #222; overflow: hidden; }
.ptile:not(.ready)::after { content: 'Loading…'; position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 1px 8px; font-size: .75rem; color: #333; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.3); pointer-events: none; }
.ptile.noimg-ptile::after { content: none; }
.ptile-img { display: block; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; }
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ptile .noimg { height: 100%; display: flex; align-items: center; justify-content: center; padding: 4px; font-size: .8rem; }
.ptile-tools { position: absolute; top: 5px; left: 5px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.ptile:hover .ptile-tools, .ptile:focus-within .ptile-tools { opacity: 1; }
.ptile-tools button, .ptile-del { min-width: 30px; width: 30px; height: 30px; padding: 0; font-size: .95rem; line-height: 1; color: #222; background: rgba(255,255,255,.92); border: 0; border-radius: 4px; cursor: pointer; }
.ptile-del { position: absolute; right: 5px; bottom: 5px; color: #fff; background: #c00000; opacity: 0; transition: opacity .12s; }
.ptile:hover .ptile-del, .ptile:focus-within .ptile-del { opacity: 1; }
.ptile-badge { position: absolute; top: 5px; right: 5px; padding: 1px 6px; font-size: .85rem; background: #fff; border-radius: 4px; }
.ptile.pending { outline: 3px solid var(--amber); outline-offset: -3px; }
@media (hover: none) { .ptile-tools, .ptile-del { opacity: 1; } .ptile-tools button, .ptile-del { min-width: 26px; width: 26px; height: 26px; font-size: .8rem; } }
@media (min-width: 700px) { .tile-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* ---------- photo rows (vendor "See photos", manager deleted list) ---------- */
.prow-list { display: block; margin: 10px 0; }
.prow { display: flex; align-items: center; gap: 12px; padding: 10px 6px; background: #fff; border-bottom: 1px solid var(--line); }
.prow:first-child { border-top: 1px solid var(--line); }
.prow.pending { background: #fffaf0; }
.prow.gone .prow-thumb img { opacity: .55; filter: grayscale(.6); }
.prow-thumb { flex: none; width: 104px; height: 78px; padding: 0; margin: 0; border: 0; background: #e5eaf0; border-radius: 4px; overflow: hidden; cursor: zoom-in; display: block; }
.prow-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prow-thumb .noimg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: .75rem; color: var(--muted); }
.prow-text { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.prow-time { font-size: 1.05rem; }
.prow-label { color: var(--muted); font-size: .95rem; word-break: break-word; }
.prow-status { margin-top: 2px; font-weight: 600; }
.prow-status.ok { color: #1a8a1a; } .prow-status.warn { color: var(--amber); } .prow-status.bad { color: var(--red); } .prow-status.info { color: var(--blue); }
.my-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .95rem; font-weight: 700; background: #e5eaf0; }
.pill.ok { background: #d8f1e2; color: #14683a; } .pill.warn { background: #fdebc8; color: #7a4d00; } .pill.bad { background: #fbdcd8; color: #8a2a1d; }
.notice.warn { background: #fdebc8; color: #7a4d00; }

.prow-status small.why { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
