* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; background: #f8fafc; color: #0f172a; }
a { color: inherit; text-decoration: none; }
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.96); border-bottom: 1px solid #e2e8f0; padding: 16px; display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.topbar h1 { margin: 6px 0 4px; font-size: 24px; }
.topbar p { margin: 0; color: #475569; }
.summary { text-align: right; }
.label, .muted, .small { color: #64748b; }
.strong { font-weight: 700; }
.back-link { display: inline-block; color: #334155; font-size: 14px; margin-bottom: 4px; }
.layout { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: white; border: 1px solid #e2e8f0; border-radius: 20px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.panel h2, .panel h3 { margin-top: 0; }
.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 12px; align-items: center;  flex-wrap: wrap;}
.between { justify-content: space-between; align-items: center; }
input[type="text"], textarea { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 12px; font: inherit; }
button, .pill-link { border: 0; background: #0f172a; color: white; border-radius: 12px; padding: 12px 16px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; justify-content: center; }
button.secondary, .report-type-btn.secondary { background: #e2e8f0; color: #0f172a; }
button.danger { background: #dc2626; }
.small-btn { padding: 8px 12px; }
.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; background: #e2e8f0; color: #0f172a; font-size: 14px; }
.active-box, .empty { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 12px; }
.project-list { display: grid; gap: 12px; }
.project-card { border: 1px solid #e2e8f0; border-radius: 18px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #fff; }
.link-btn { background: transparent; color: #0f172a; padding: 0; border-radius: 0; font-weight: 700; font-size: 18px; text-align: left; }
.pill-link { min-width: 90px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.photo-card { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 18px; background: white; }
.photo-card img { width: 100%; height: 220px; object-fit: cover; display: block; background: #e2e8f0; }
.card-body { padding: 12px; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px;z-index: 2000; }
.modal.hidden { display: none; }
.modal-card {
  position: relative;
  z-index: 2001;
  width: min(460px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
}
.report-options { display: grid; gap: 12px; margin-top: 12px; }
.report-type-btn { width: 100%; }
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .summary { text-align: left; }
  .stack-mobile { flex-direction: column; align-items: stretch; }
  .project-card { flex-direction: column; align-items: stretch; }
}

.status-pill { display: inline-block; margin-top: 10px; padding: 8px 12px; border-radius: 999px; font-size: 14px; }
.status-pill.online { background: #dcfce7; color: #166534; }
.status-pill.offline { background: #fee2e2; color: #991b1b; }
.card-top-row { margin-bottom: 8px; }

.photo-missing { height: 220px; display: flex; align-items: center; justify-content: center; background: #e2e8f0; color: #475569; }
button:disabled { opacity: .55; cursor: not-allowed; }

.hidden { display: none !important; }

.photo-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: #e2e8f0;
}

.photo-image-wrap img,
.photo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  pointer-events: none;
}

.photo-status-badge.server {
  background: rgba(15, 23, 42, 0.85);
}

.photo-status-badge.phone {
  background: rgba(234, 88, 12, 0.9);
}


.project-header-row {
  align-items: center;
  gap: 12px;
}

.project-header-row h1 {
  margin: 6px 0 4px;
}

.project-header-row .status-pill {
  margin-top: 0;
  white-space: nowrap;
}



.markup-modal-card {
  width: min(1400px, 96vw);
  height: calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.markup-header {
  align-items: center;
}

.markup-header h3 {
  margin: 0;
}

.markup-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.markup-toolbar > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#markupToolSelect {
  flex: 999 1 180px;
  min-width: 120px;
}

#markupLineWidth {
  flex: 1 1 88px;
  min-width: 78px;
}

#clearMarkupBtn,
#saveMarkupBtn,
#closeMarkupBtn {
  flex: 1 1 96px;
  min-width: 88px;
}

.markup-toolbar .small-btn,
.markup-toolbar .markup-select {
  width: 100%;
}

.markup-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  background: #e2e8f0;
  border-radius: 16px;
  padding: 8px;
}

#markupCanvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  touch-action: none;
}

.markup-select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  min-height: 44px;
}

.markup-width-select {
  min-width: 92px;
}

@media (max-width: 800px) {
  .markup-modal-card {
    width: 100%;
    height: calc(100vh - 8px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    padding: 10px;
    gap: 8px;
    overflow: hidden;
  }

  .markup-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  #markupToolSelect {
    flex: 999 1 140px;
    min-width: 110px;
  }

  #markupLineWidth {
    flex: 1 1 80px;
    min-width: 72px;
  }

  #clearMarkupBtn,
  #saveMarkupBtn,
  #closeMarkupBtn {
    flex: 1 1 84px;
    min-width: 78px;
  }

  .markup-toolbar .small-btn,
  .markup-toolbar .markup-select {
    min-height: 42px;
    padding: 8px 10px;
    min-width: 0;
    box-sizing: border-box;
  }

  .markup-stage {
    flex: 1;
    min-height: 0;
    padding: 6px;
    border-radius: 12px;
    overflow: auto;
  }

  #markupCanvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}

.description-editor {
  display: grid;
  gap: 10px;
}

.description-line2-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.description-line2-row input[type="text"],
.description-line2-row select {
  width: 100%;
  min-width: 0;
}

.description-line2-hint {
  margin: -2px 0 0;
}

@media (max-width: 640px) {
  .description-line2-row {
    grid-template-columns: 1fr;
  }
}
.stack-mobile {
  margin-top: 8px;
}

.photos-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-inline {
  margin: 0;
  line-height: 1.2;
}

.photos-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

@media (max-width: 800px) {
  .photos-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .photos-header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}


.photos-header-row {
  margin-bottom: 8px;
}

#photoGrid.photo-grid {
  margin-top: 0;
  gap: 16px;
}

.panel.wide > .photos-header-row + #photoGrid {
  margin-top: 0;
}

.back-btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 10px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.back-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.back-btn:active {
  transform: translateY(1px);
}

.back-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}


.photo-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.photo-status-badge {
  z-index: 2;
}


.layout-stage {
  margin-top: 12px;
}

.layout-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
}

.layout-image {
  display: block;
  width: 100%;
  height: auto;
}



.layout-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #d93025;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.layout-marker.has-photos {
  background: #0b57d0;
}

.marker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 600;
}

.marker-mini-preview {
  position: relative;
  width: 100%;
  max-width: 320px;   /* was 180px */
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 8px;
  background: #fff;
}

.marker-mini-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.marker-mini-shape {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.marker-mini-shape.shape-circle {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #d93025;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.marker-mini-shape.shape-square {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #d93025;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.marker-mini-shape.shape-triangle {
  width: 18px;
  height: 16px;
  background: #d93025;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}


.layout-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 2px solid #fff;
  background: #d93025;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.layout-marker.has-photos {
  background: #0b57d0;
}

.layout-marker.shape-circle {
  border-radius: 999px;
}

.layout-marker.shape-square {
  border-radius: 6px;
}

.layout-marker.shape-triangle {
  width: 44px;
  height: 38px;
  min-width: 44px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 0;
  background: #d93025;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.layout-marker.shape-triangle.has-photos {
  background: #0b57d0;
}

.layout-marker.shape-triangle::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}

.marker-shape-toolbar {
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.marker-shape-btn {
  border: 1px solid #cfd8e3;
  background: #eef3f8;
  color: #1f2a37;
  transition: all 0.15s ease;
}

.marker-shape-btn:hover {
  background: #e3ebf5;
}

.marker-shape-btn.active {
  background: #0b57d0;
  color: #fff;
  border-color: #0b57d0;
  box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.15);
}


.layout-marker-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: auto;
  cursor: default;
}
.layout-marker {
  pointer-events: auto;
  cursor: pointer;
}

.layout-marker {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}


.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #111;
  font: inherit;
}

.button-link:hover {
  background: #e9e9e9;
}


.template-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #111827;
  border-radius: 10px;
  background: #111827;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.template-btn:hover {
  background: #374151;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.22);
  transform: translateY(-1px);
}

.template-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(17, 24, 39, 0.16);
}


.template-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 41.5px !important;
  padding: 12px 16px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}
#createChecklistBtn {
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
}
@media (max-width: 800px) {
  .template-btn {
    display: flex !important;
    width: 100% !important;
    margin-top: 0 !important;
    text-align: center !important;
  }
}

@media (max-width: 800px) {
  .layout-marker {
    min-width: 22px !important;
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    font-size: 9px !important;
    border-width: 1.5px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25) !important;
  }

  .layout-marker.shape-circle {
    border-radius: 999px !important;
  }

  .layout-marker.shape-square {
    border-radius: 4px !important;
  }

  .layout-marker.shape-triangle {
    width: 26px !important;
    height: 22px !important;
    min-width: 26px !important;
    padding: 0 !important;
  }

  .layout-marker.shape-triangle::after {
    font-size: 8px !important;
    top: 62% !important;
  }
}

.precon-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 41.5px !important;
  padding: 12px 16px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: #0f172a !important;
  color: #ffffff !important;
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

#createProjectBtn,
.precon-btn,
#createPreconBtn {
  font-family: Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  line-height: 1.2 !important;
}

@media (max-width: 800px) {
  .precon-btn {
    display: flex !important;
    width: 100% !important;
    text-align: center !important;
  }
}

