:root {
  --paper: #efebe3;
  --paper-raised: #f7f4ee;
  --ink: #1c1a17;
  --ink-soft: #5c564c;
  --steel: #1d2b30;
  --steel-soft: #2d3d43;
  --line: #d8d2c4;
  --orange: #e8871e;
  --orange-ink: #1c1a17;
  --teal: #4c7a6b;
  --rust: #b23a2e;
}

* { box-sizing: border-box; }

a { color: var(--steel); }
a:visited { color: var(--steel); }

body {
  margin: 0;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

h1, h2, .brand, .site-card-name, dialog h2 {
  font-family: "Oswald", "Arial Narrow", sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Top bar: steel plate with a single hazard-amber edge */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--steel);
  border-bottom: 3px solid var(--orange);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 20px;
  color: var(--paper);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.user-name { color: #b9c4c2; }

.link-muted { color: #b9c4c2; text-decoration: none; }
.link-muted:hover { color: var(--paper); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin: 20px 0 14px;
}

h1 { font-size: 26px; margin: 0 0 2px 0; color: var(--ink); }
h2 { font-size: 18px; margin: 0; color: var(--ink); }

.muted { color: var(--ink-soft); font-size: 14px; margin: 2px 0; }
.small { font-size: 12px; }

.notes {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--steel);
  padding: 12px 14px;
  white-space: pre-wrap;
  font-size: 14px;
  margin: 0 0 20px;
}

.empty-state {
  color: var(--ink-soft);
  text-align: center;
  padding: 48px 16px;
  font-size: 15px;
  border: 1px dashed var(--line);
}

/* Buttons: flat, square-cornered, no shadows */
.btn-primary, .btn-secondary {
  border: none;
  border-radius: 3px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: "IBM Plex Sans", sans-serif;
}

.btn-primary {
  background: var(--orange);
  color: var(--orange-ink);
}
.btn-primary:active { background: #cf7415; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.link-btn {
  background: none;
  border: none;
  color: var(--steel);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn-danger { color: var(--rust); }

/* Site list: job-ticket rows, not floating cards */
.site-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-card {
  display: flex;
  align-items: stretch;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--orange);
  text-decoration: none;
  color: inherit;
  min-height: 92px;
}

.site-card.is-complete { border-left-color: var(--teal); }

.site-cover {
  width: 92px;
  height: 92px;
  object-fit: cover;
  display: block;
  background: #e3ddcf;
  flex-shrink: 0;
}

.site-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
  padding: 6px;
}

.site-card-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.site-card-name { font-size: 18px; margin: 0 0 2px; }

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}
.status-dot.is-complete { background: var(--teal); }

/* Photo grid: each photo gets a tied-on tag label */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px 12px;
}

.photo-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
}

.photo-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--line);
}

.photo-card-body { padding: 8px 10px 10px; position: relative; }

.photo-card-body form.inline-form input[type="text"] {
  width: 100%;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font-size: 15px;
  font-weight: 600;
  padding: 2px 0;
  margin-top: 0;
  background: transparent;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
}
.photo-card-body form.inline-form input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--orange);
}

.photo-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

/* Forms / dialogs */
dialog {
  border: none;
  border-top: 4px solid var(--orange);
  border-radius: 0;
  padding: 22px;
  width: 90%;
  max-width: 420px;
  background: var(--paper-raised);
}
dialog::backdrop { background: rgba(28, 26, 23, 0.55); }

dialog h2 { margin-bottom: 4px; }

form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 14px;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="file"],
form select,
form textarea {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 15px;
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.photo-source-buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.photo-source-buttons button { flex: 1; font-size: 14px; padding: 12px 10px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.auth-card {
  max-width: 360px;
  margin: 48px auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  padding: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}
.auth-body { padding: 28px; }
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(20,32,31,.55) 0%, rgba(20,32,31,.35) 45%, rgba(20,32,31,.75) 100%),
    url("/static/login-bg.jpg") 50% 40% / cover no-repeat;
}

.auth-card h1 { margin-bottom: 18px; }
.auth-card .btn-primary { width: 100%; margin-top: 20px; }

.error {
  background: #f6e2de;
  color: var(--rust);
  border-left: 3px solid var(--rust);
  padding: 10px 12px;
  font-size: 14px;
}

/* ---- Survey sections ---- */
.btn-link { display: inline-block; text-decoration: none; text-align: center; color: var(--ink); }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 2px solid var(--line);
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.tabs a {
  flex: 0 0 auto;
  padding: 10px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--orange); }

.saved-note {
  background: #e3efe9;
  color: #2f5a4b;
  border-left: 3px solid var(--teal);
  padding: 8px 12px;
  font-size: 14px;
  margin: 0 0 14px;
}

.search-form { margin-bottom: 14px; }
.search-form input[type="search"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 15px;
  font-family: inherit;
  background: var(--paper-raised);
  color: var(--ink);
}
.search-form input[type="search"]:focus { outline: none; border-color: var(--orange); }

.panel-form {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  padding: 4px 16px 16px;
  margin-bottom: 18px;
}
.field-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 640px) {
  .field-grid { grid-template-columns: 1fr 1fr; }
  .field-grid .wide { grid-column: 1 / -1; }
}
.panel-form > label.wide { margin-top: 14px; }
form input[type="number"] {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 15px;
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
}
form input[type="number"]:focus { outline: none; border-color: var(--orange); }
.form-actions { margin-top: 18px; }

.check-group { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line); }
.check-group:first-child { border-top: none; margin-top: 8px; }
.check-group h3 { font-size: 16px; margin: 10px 0 0; }

.section-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin: 8px 0 14px;
}
.list-heading { margin: 22px 0 10px; }

.type-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .type-grid { grid-template-columns: 1fr 1fr; } }
.type-tile {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel);
  padding: 12px 52px 12px 14px;
  cursor: pointer;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
}
.type-tile b { display: block; font-size: 16px; }
.type-tile small { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.type-tile:active { background: #ece7dc; }
.type-count {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  color: var(--orange-ink);
  background: var(--orange);
  padding: 3px 8px;
}

.inventory { display: flex; flex-direction: column; gap: 8px; }
.inventory-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
}
.inventory-row div { flex: 1; min-width: 0; }
.inventory-row b { display: block; }
.inventory-row small { color: var(--ink-soft); font-size: 13px; }
.inventory-row .number {
  width: 28px; height: 28px; line-height: 28px; text-align: center;
  background: var(--steel); color: var(--paper); font-weight: 600; font-size: 14px;
}
.inventory-row .chevron { font-size: 24px; color: var(--ink-soft); }

.danger-zone { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }

@media print { .tabs, .topbar { display: none; } }

/* ---- Admin ---- */
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  padding: 12px 14px;
}
.user-row.is-blocked { border-left-color: var(--rust); background: #f3e7e3; }
.user-main { flex: 1; min-width: 0; }
.user-main b { margin-right: 6px; }
.user-main small { display: block; color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
.role-tag {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px;
  background: var(--steel); color: var(--paper); margin-right: 4px;
}
.role-blocked { background: var(--rust); }
.btn-danger {
  border: none; border-radius: 3px; padding: 10px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--rust); color: #fff; font-family: "IBM Plex Sans", sans-serif;
}

/* ---- Equipment: dropdown + cards ---- */
.add-equipment {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--orange);
  padding: 4px 14px 14px;
  margin-bottom: 8px;
}
.add-equipment-row { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.add-equipment-row select { flex: 1; min-width: 0; margin-top: 0; }
.add-equipment-row .btn-primary { padding: 10px 20px; }

.eq-list { display: flex; flex-direction: column; gap: 10px; }
.eq-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--steel);
}
.eq-main { display: flex; gap: 12px; align-items: stretch; text-decoration: none; color: var(--ink); }
.eq-thumb { width: 104px; height: 92px; object-fit: cover; display: block; flex-shrink: 0; background: #e3ddcf; }
.eq-thumb-empty {
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--ink-soft); font-size: 12px; padding: 6px;
}
.eq-text { padding: 10px 12px 10px 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.eq-text b { font-size: 16px; }
.eq-text small { color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }
.eq-camera { padding: 0 12px 12px; }
.eq-camera .btn-secondary { width: 100%; padding: 9px 12px; font-size: 14px; }

/* ---- Overview ---- */
.ov-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.ov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ov-head a { font-size: 13px; color: var(--steel); }
.ov-list { margin: 0; }
.ov-list > div { display: flex; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ov-list dt { flex: 0 0 38%; font-weight: 600; color: var(--ink-soft); }
.ov-list dd { margin: 0; flex: 1; overflow-wrap: anywhere; }
.ov-notes { white-space: pre-wrap; font-size: 14px; margin: 8px 0 0; padding-left: 10px; border-left: 3px solid var(--steel); }
.ov-item { padding: 10px 0; border-top: 1px solid var(--line); }
.ov-item:first-of-type { border-top: none; }
.ov-item-head { display: block; text-decoration: none; color: var(--ink); }
.ov-item-head small { display: block; color: var(--ink-soft); font-size: 13px; }
.ov-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.thumb-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumb-strip img { width: 72px; height: 72px; object-fit: cover; display: block; border: 1px solid var(--line); }
.wide-btn { display: block; width: 100%; padding: 13px; margin: 6px 0 24px; color: var(--orange-ink); }

@media (max-width: 699px) {
  .auth-card { margin-top: 44vh; margin-bottom: 24px; background: rgba(247,244,237,.93); }
  .auth-body { padding: 22px 24px 24px; }
  .auth-card h1 { font-size: 1.5rem; margin-bottom: 12px; }
}

@media (min-width: 700px) {
  .auth-bg { background-position: 50% 33%; }
  .auth-card { position: relative; left: min(27vw, 450px); margin-top: 90px; }
}

.topbar-right { flex-shrink: 0; }
.brand { white-space: nowrap; }
.user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #6f8187;
  padding: 6px 12px;
  white-space: nowrap;
}
.logout-btn:hover { background: var(--orange); border-color: var(--orange); color: var(--steel); }
@media (max-width: 420px) { .user-name { display: none; } .topbar { padding: 10px 12px; } .brand { font-size: 17px; } }

/* ---------- offline queue + photo viewer ---------- */
main img[src^="/static/uploads/"], main img[data-pending] { cursor: zoom-in; }

.pending-banner {
  background: #fdf1de;
  border: 1px solid var(--orange);
  border-left: 5px solid var(--orange);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.pending-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pending-banner p { margin: 6px 0 10px; }
.pending-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.pending-strip figure { margin: 0; flex: 0 0 96px; font-size: 12px; }
.pending-strip img { width: 96px; height: 96px; object-fit: cover; display: block; border: 1px solid var(--line); }
.pending-strip figcaption { margin-top: 4px; line-height: 1.2; word-break: break-word; }
.pending-x { background: none; border: 0; padding: 4px 0; color: var(--rust); text-decoration: underline; font-size: 12px; }
.pending-badge { color: #a35d0a; font-weight: 600; }

.app-toast {
  position: fixed; left: 12px; right: 12px; bottom: 18px; z-index: 300;
  background: var(--steel); color: var(--paper); padding: 14px 16px;
  border-left: 5px solid var(--orange); box-shadow: 0 6px 24px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.app-toast.show { opacity: 1; transform: none; }
.app-busy {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  background: rgba(20,32,31,.7); color: #fff; font-size: 18px; font-weight: 600;
}

.lb { position: fixed; inset: 0; z-index: 500; background: #0b1214; display: flex; flex-direction: column; }
.lb[hidden] { display: none; }
body.lb-open { overflow: hidden; }
.lb-top {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; color: #dfe6e8;
  background: rgba(0,0,0,.4); flex: 0 0 auto;
}
.lb-count { flex: 1; font-weight: 600; }
.lb-orig { color: #dfe6e8; font-size: 14px; }
.lb-close {
  background: var(--orange); color: var(--steel); border: 0; font-size: 22px; font-weight: 700;
  width: 44px; height: 44px; line-height: 1;
}
.lb-stage {
  flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.lb.zoomed .lb-stage { overflow: auto; display: block; touch-action: auto; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.lb.zoomed .lb-img { max-width: none; max-height: none; width: 220vw; height: auto; cursor: zoom-out; }
.lb-cap { flex: 0 0 auto; color: #fff; text-align: center; padding: 12px 70px 18px; font-size: 16px; min-height: 22px; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px;
  background: rgba(0,0,0,.45); color: #fff; border: 0; font-size: 40px; line-height: 1;
}
.lb-prev { left: 0; } .lb-next { right: 0; }
.lb.single .lb-nav, .lb.zoomed .lb-nav { display: none; }

/* ---------- photo description + detect ---------- */
.photo-desc textarea { width: 100%; font: inherit; font-size: 16px; line-height: 1.45; padding: 10px; resize: vertical; min-height: 120px; overflow: hidden; }
.detect-btn { width: 100%; margin: 6px 0; }
.detect-note { padding: 12px 14px; margin: 0 0 14px; border-left: 5px solid var(--teal); background: #e4efe9; }
.detect-note.bad { border-left-color: var(--rust); background: #f6e2de; color: var(--rust); }
.lb-desc { white-space: pre-line; text-align: left; font-size: 17px; line-height: 1.45; font-weight: 400; margin: 8px auto 0; max-width: 34em; color: #dfe6e8; max-height: 40vh; overflow: auto; }
.lb-cap { max-height: 38vh; overflow: auto; }
@media (max-width: 560px) { .photo-grid { grid-template-columns: 1fr !important; } .photo-desc textarea { min-height: 140px; } }

/* ---------- meter pulse panel ---------- */
.meter-panel { margin-top: 18px; border-left: 5px solid var(--teal); }
.meter-status { font-weight: 600; margin: 4px 0 12px; color: var(--ink-soft); }
.meter-status.ok { color: #2f6b4f; }
.meter-status.warn { color: #a35d0a; }
.check-row { display: flex; align-items: flex-start; gap: 10px; }
.check-row input[type="checkbox"] { width: 24px; height: 24px; margin-top: 2px; flex: 0 0 auto; }

/* ---------- BoilerWatch hand-over box ---------- */
.handover-panel { margin-top: 14px; border-left: 5px solid var(--steel); }
.handover-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
.handover-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); word-break: break-all; }
.handover-wait { color: #a35d0a; font-weight: 600; margin: 8px 0 12px; }
.btn-secondary.disabled { opacity: .45; pointer-events: none; text-align: center; display: block; }
a.btn-secondary.wide-btn { display: block; text-align: center; text-decoration: none; }
.serial-cmd { display:block; padding:10px; background:#f1f3f5; border-radius:6px; font-size:16px; word-break:break-all; user-select:all; }

/* ---------- full-screen description editor ---------- */
.desc-hint { display: block; font-size: 12px; color: var(--muted, #667); margin-top: 2px; }
.photo-desc textarea { cursor: pointer; }
.ded { position: fixed; inset: 0; z-index: 9999; background: #fff; display: flex; flex-direction: column; padding: 12px 16px; }
.ded[hidden] { display: none; }
.ded-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; }
.ded-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ded-text { flex: 1; width: 100%; font: inherit; font-size: 18px; line-height: 1.5; padding: 12px; border: 1px solid #c8d0d4; border-radius: 8px; resize: none; }
.ded-note { margin: 8px 0 0; }
body.ded-open { overflow: hidden; }
@media (prefers-color-scheme: dark) { .ded { background: #14191c; color: #eef2f3; } .ded-text { background: #1c2327; color: #eef2f3; border-color: #38444a; } }

.pdf-keep { margin: 18px 0 6px; }
.pdf-keep .btn-link { display: inline-block; text-decoration: none; }

/* ---------- single photo page ---------- */
.pd-image { text-align: center; margin: 8px 0 14px; }
.pd-image img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 8px; background: #111; cursor: zoom-in; }
.pd-box { background: var(--paper-raised, #fff); border: 2px solid var(--line, #c8d0d4); border-radius: 10px; padding: 14px; margin: 12px 0; }
.pd-title { display: block; font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.pd-box textarea { width: 100%; min-height: 240px; font: inherit; font-size: 18px; line-height: 1.55; padding: 12px; border: 1px solid var(--line, #c8d0d4); border-radius: 8px; resize: vertical; white-space: pre-wrap; }
.pd-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pd-actions .btn-link { display: inline-block; text-decoration: none; }
.pd-detect { margin: 6px 0 14px; }
.pd-detect .detect-btn { width: 100%; padding: 14px; font-size: 17px; }

/* ---------- photo cards: full width, picture left, detected text fills the rest ---------- */
.photo-grid { display: flex !important; flex-direction: column; gap: 14px; }
.photo-card { display: flex; flex-direction: row; align-items: stretch; width: 100%; box-sizing: border-box; }
.photo-card > img { width: 38%; max-width: 260px; height: auto; min-height: 160px; max-height: 320px; flex: 0 0 38%; border-bottom: none; border-right: 1px solid var(--line); align-self: flex-start; }
.photo-card-body { flex: 1 1 auto; min-width: 0; }
.photo-desc textarea { min-height: 200px; }
@media (max-width: 420px) { .photo-card > img { width: 34%; flex-basis: 34%; } }
