:root { font: 16px/1.45 system-ui, sans-serif; color: #171719; background: #f5f5f6; --red: #bd0928; --border: #d8d8dc; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.top { background: #161618; color: white; border-bottom: 4px solid var(--red); }
.bar { max-width: 1160px; margin: auto; padding: 16px clamp(14px, 4vw, 32px); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand strong { display: block; font-size: 1.6rem; line-height: 1; letter-spacing: -.05em; }
.brand strong span { color: #ff526d; }
.company { display: block; margin-top: 4px; font-size: .875rem; color: #e1e1e5; }
main { max-width: 1160px; margin: auto; padding: clamp(14px, 4vw, 32px); }
.panel { min-width: 0; background: white; border: 1px solid var(--border); border-radius: 14px; padding: clamp(16px, 3vw, 26px); }
.login { max-width: 420px; margin: 7vh auto; }
#workspace { display: grid; grid-template-columns: minmax(230px, 300px) minmax(0, 1fr); gap: 20px; align-items: start; }
h1, h2 { margin: 0 0 16px; line-height: 1.15; overflow-wrap: anywhere; }
h1 { font-size: 1.65rem; } h2 { font-size: 1.5rem; }
form { display: grid; gap: 12px; }
label { display: block; font-weight: 650; }
input { display: block; width: 100%; margin-top: 5px; border: 1px solid #a0a0a6; border-radius: 8px; padding: 10px; font: inherit; }
button, .action { min-height: 44px; padding: 10px 14px; border: 1px solid transparent; border-radius: 8px; background: var(--red); color: white; font: inherit; font-weight: 700; cursor: pointer; }
button:disabled, .action:has(input:disabled) { opacity: .55; cursor: wait; }
.outline { background: transparent; border-color: #8b8b91; }
:focus-visible, .action:focus-within { outline: 3px solid #555; outline-offset: 3px; }
.outline:focus-visible { outline-color: white; }
#projects { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 7px; }
.project { width: 100%; text-align: left; background: #f5f5f6; color: #171719; overflow-wrap: anywhere; }
.project[aria-current="true"] { background: #ffedf0; border-color: var(--red); }
.project small { display: block; font-size: .875rem; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.action { position: relative; display: inline-flex; align-items: center; }
.action input { position: absolute; inset: 0; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.secondary { background: white; color: #171719; border-color: #919198; }
.hint { font-size: .875rem; color: #55555d; }
.message { padding: 12px 16px; background: white; border-left: 4px solid var(--red); overflow-wrap: anywhere; margin: 0 0 16px; }
#photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 145px), 1fr)); gap: 12px; }
figure { margin: 0; }
figure img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #eee; }
figcaption { font-size: .875rem; margin-top: 5px; }
@media (max-width: 660px) { #workspace { grid-template-columns: 1fr; gap: 12px; } }
:root { --red: #d50000; }
.top { background: white; color: #090909; border: 0; }
.bar { position: relative; justify-content: center; }
.brand { text-align: center; }
.logo { display: block; width: 205px; max-width: 100%; height: auto; margin: 0 auto 4px; }
.brand strong { font-size: 1.85rem; }
.outline { position: absolute; right: 16px; color: #151515; background: #f4f4f4; border: 0; font-size: .875rem; }
.outline:focus-visible { outline-color: #555; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-head h1 { margin: 0; }
#new-project { width: 44px; padding: 0; font-size: 1.85rem; border-radius: 12px; }
#project-form { margin-top: 16px; }
#projects { gap: 0; }
.project { display: grid; grid-template-columns: 90px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border: 0; border-bottom: 1px solid #e9e9e9; border-radius: 0; background: white; }
.project[aria-current="true"] { background: #fff4f4; border-color: #eee; }
.project-cover { width: 90px; height: 70px; object-fit: cover; border-radius: 10px; background: #f0f0f0; color: #595959; display: grid; place-items: center; font-size: 1.5rem; }
.project .chevron { padding-right: 5px; font-size: 1.4rem; }
#mobile-nav, #back-projects { display: none; }
#photos { display: block; }
.photo-day { margin: 16px 0 9px; font-size: 1rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,155px),1fr)); gap: 8px; }
.photo-grid figure { position: relative; }
.photo-grid figcaption { position: absolute; bottom: 6px; left: 6px; color: white; background: #000b; border-radius: 5px; padding: 2px 6px; pointer-events: none; }
@media (max-width: 660px) {
  body { background: white; }
  .bar { min-height: 148px; padding: 12px; }
  .outline { right: 8px; top: 5px; min-height: 34px; padding: 4px 7px; font-size: .75rem; }
  main { padding: 0 0 86px; }
  .panel { padding: 13px 16px; border: 0; border-radius: 0; }
  .login { padding: 20px; }
  #workspace { display: block; }
  #workspace:not(.detail) #gallery, #workspace.detail aside { display: none; }
  body:has(#workspace.detail) .top { display: none; }
  #gallery { padding: 0 0 16px; }
  #project-title { color: white; background: #080808; margin: 0; padding: 0 16px 17px; text-align: center; font-size: 1.25rem; }
  #back-projects { display: block; width: 100%; text-align: left; background: #080808; border-radius: 0; }
  #photo-actions, #photos, #empty { margin: 12px 14px; }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #mobile-nav { position: fixed; inset: auto 0 0; display: flex; justify-content: space-around; background: #080808; padding-bottom: env(safe-area-inset-bottom); z-index: 2; }
  #mobile-nav button { width: 50%; background: transparent; font-size: .85rem; border-radius: 0; }
  #mobile-nav button:first-child { border-top: 3px solid #f00000; }
  #mobile-nav button span { display: block; font-size: 1.65rem; line-height: 1.1; }
}
.list-head h1 { margin-right: auto; }
.search-toggle { color: black; background: #f1f1f1; border-radius: 12px; width: 44px; padding: 0; font-size: 1.7rem; }
select { display: block; width: 100%; margin-top: 5px; border: 1px solid #a0a0a6; border-radius: 8px; padding: 10px; font: inherit; background: white; }
#search-wrap { margin-top: 10px; }
.project { grid-template-columns: 104px minmax(0,1fr) auto; padding: 11px 0; line-height: 1.18; }
.project-cover { width: 104px; height: 82px; }
.project .row-address { white-space: pre-line; margin: 4px 0 5px; }
.project .project-status { display: inline-block; background: #707070; border-radius: 20px; color: white; padding: 3px 12px; font-size: .8rem; margin-top: 3px; }
.project-status[data-status="In Progress"] { background: #198638; }
.project-status[data-status="Completed"] { background: #087cb7; }
#project-address { text-align: center; margin: 0; }
#gallery-label { background: var(--red); color: white; padding: 10px 18px; border-radius: 10px; font-weight: 700; width: max-content; margin: 8px 14px; }
@media(max-width:660px) {
  #workspace:not(.detail) aside { min-height: calc(100dvh - 206px); }
  #projects { margin-top: 10px; }
  #project-address { color: white; background: #080808; padding: 0 12px 13px; margin-top: -12px; font-size: .9rem; }
  #gallery:has(.photo-grid) { display: flex; flex-direction: column; }
  .photo-grid img { aspect-ratio: 1.12; }
}
#gallery-label { display: flex; flex-wrap: wrap; width: auto; padding: 0; background: #292929; }
#gallery-label button { flex: 1; white-space: nowrap; padding-inline: 9px; background: transparent; font-size: .875rem; }
#gallery-label button[aria-pressed=true] { background: var(--red); }
.project-section { padding: 12px 16px 20px; }
.report-cover { background: #f7f7f7; border-radius: 12px; padding: 16px; margin-bottom: 12px; text-align: center; }
.report-cover > img { width: 160px; display: block; margin: auto; }
.report-cover h3 { margin: 8px 0 4px; font-size: 1.6rem; }
.report-cover p { margin: 4px 0 12px; }
#report-images { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
#report-images img, .photo-grid video { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; background: #151515; }
#reports > button { width: 100%; margin-bottom: 8px; }
#share-box { margin: 8px 0; }
#share-box button { margin-top: 6px; }
#active-links { list-style: none; padding: 0; }
#active-links li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
#capture-dialog { background: #0b0b0b; color: white; border: 0; border-radius: 16px; width: min(460px, 100%); padding: 16px; }
#capture-dialog::backdrop { background: #000b; }
.capture-head { display: flex; align-items: center; }
.capture-head h2 { margin: 0 auto 0 12px; }
#close-capture { background: transparent; font-size: 1.5rem; padding: 0 9px; }
#capture-dialog .hint { color: #eee; }
.capture-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.location { display: flex; align-items: center; gap: 8px; padding: 10px 0; font-size: .9rem; }
.location input { width: auto; margin: 0; }
.shared-project { background: white; padding: 20px; }
@media(max-width:660px) {
  #capture-dialog { max-width: 100%; width: 100%; max-height: 100%; min-height: 100dvh; border-radius: 0; margin: 0; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#capture-dialog { box-sizing: border-box; padding: 0; background: #000; }
.capture-head { position: relative; justify-content: center; min-height: 60px; padding: 0 45px; }
.capture-head h2 { margin: 0; font-size: 1.25rem; }
#close-capture { position: absolute; left: 8px; top: 8px; }
.capture-project { margin: 0 16px 12px; }
.capture-project select { appearance: auto; background: #272727; color: white; border-color: #333; padding: 11px; border-radius: 12px; }
.viewfinder { position: relative; min-height: 205px; aspect-ratio: 4/4.5; display: grid; place-content: center; background: #1b1b1b; text-align: center; padding: 16px; }
.viewfinder video { position: absolute; width: 100%; height: 100%; inset: 0; object-fit: cover; }
#preview-camera { background: #343434; color: white; }
#preview-status { max-width: 26ch; margin: 10px auto 0; font-size: .875rem; }
#capture-dialog .location { justify-content: center; margin: 0 13px; padding: 8px 0 0; }
.capture-actions { display: grid; grid-template-columns: 1fr 88px 1fr; align-items: center; justify-items: center; padding: 14px 6px max(22px, env(safe-area-inset-bottom)); }
.capture-option { background: transparent; display: grid; justify-items: center; gap: 4px; font-size: .875rem; padding: 4px 10px; }
.capture-option span { color: white; font-size: 1.65rem; line-height: 1; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 4px solid white; background: white; box-shadow: inset 0 0 0 3px black; }
#capture-dialog .action:focus-within { outline-color: white; }
.report-cover .report-dates { margin: 13px 0 0; font-weight: 700; }
.report-cover .report-credit { margin: 4px 0 0; font-size: .875rem; }
#capture-dialog .location-status { margin: 6px 16px 0; text-align: center; color: #eee; }
.photo-grid .map-link { position: absolute; top: 6px; right: 6px; padding: 5px 8px; border-radius: 5px; color: white; background: #000d; font-size: .8rem; text-decoration: underline; }
#open-trash { margin-top: 10px; }
.danger { color: #ae001b; border-color: #ae001b; }
.photo-grid { align-items: start; }
.photo-grid figcaption { bottom: 48px; }
.photo-grid .media-delete { display: block; width: 100%; margin-top: 4px; min-height: 42px; background: white; color: #ae001b; border-color: #ddd; padding: 6px 8px; }
.shared-project .photo-grid figcaption { bottom: 6px; }
#trash-dialog { width: min(520px, calc(100% - 24px)); border: 1px solid #ddd; border-radius: 14px; padding: 16px; }
#trash-dialog::backdrop { background: #0009; }
.trash-head, #trash-items li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.trash-head h2 { margin: 0; }
#trash-items { padding: 0; list-style: none; }
#trash-items li { border-top: 1px solid #ddd; padding: 10px 0; }
#take-photo:disabled { opacity: .45; cursor: default; }
#take-photo:focus-visible { outline-color: white; }
.capture-head { position: sticky; top: 0; z-index: 2; background: #000; padding-inline: 66px; }
#finish-capture { position: absolute; right: 8px; bottom: 8px; min-height: 44px; padding: 6px 10px; background: #252525; }
#finish-capture:focus-visible { outline-color: white; }
@media (max-width: 660px) {
  .capture-head { padding-top: env(safe-area-inset-top); }
  #close-capture { top: auto; bottom: 8px; }
}
#capture-dialog.files-only .viewfinder,
#capture-dialog.files-only .location,
#capture-dialog.files-only #take-photo { display: none; }
#capture-dialog.files-only .capture-actions { grid-template-columns: repeat(2, 1fr); }
#full-photo-dialog { padding: 0; border: 0; color: white; background: #080808; width: 100%; max-width: 100%; height: 100dvh; max-height: 100%; margin: 0; }
#full-photo-dialog[open] { display: flex; flex-direction: column; }
#full-photo-dialog::backdrop { background: #080808; }
.full-photo-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 8px; }
.full-photo-head h2 { margin: 0; font-size: 1rem; }
.full-photo-head button { background: #252525; padding: 6px 8px; font-size: .875rem; }
.full-photo-head :is(button, a):focus-visible { outline-color: white; }
#full-photo-viewport { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding-bottom: env(safe-area-inset-bottom); }
#full-photo-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
#share-full-photo { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 10px; border-radius: 8px; background: #252525; color: white; font-size: .875rem; text-decoration: none; white-space: nowrap; }

.photo-grid .photo-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.full-photo-head { position: sticky; top: 0; z-index: 2; background: #080808; }

#name-form, #status-form { margin: 16px 0; }

#trash-items li { align-items: flex-start; flex-direction: column; }
.trash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#empty-trash { margin: 12px 0 0; }

.selecting-photos .photo-open { position: relative; }
.selecting-photos .photo-open::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 25px;
  height: 25px;
  border: 2px solid white;
  border-radius: 50%;
  background: #18181880;
}
.selecting-photos .photo-open.selected::after {
  content: "✓";
  background: #a00912;
  color: white;
  font-weight: 700;
  line-height: 21px;
}
.selecting-photos .media-delete, .selecting-photos .map-link { visibility: hidden; }
