:root {
  --navy: #1a3a5c;
  --navy-dark: #12283f;
  --accent: #2f7de1;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2530;
  --muted: #6b7684;
  --border: #dde2e8;
  --ok: #2e8b57;
  --defect: #c0392b;
  --review: #c9820b;
  --na: #8a929c;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

#app {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  color: white;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  font-size: 19px;
  margin: 0;
  flex: 1;
  font-weight: 600;
}

.topbar .sub {
  font-size: 13px;
  color: #cbd8e6;
  font-weight: 400;
}

.btn {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  touch-action: manipulation;
}
.btn:active { opacity: 0.75; }
.btn.secondary { background: #e4e9ef; color: var(--text); }
.btn.ghost { background: transparent; color: white; padding: 8px 10px; }
.btn.ghost.dark { color: var(--accent); }
.btn.danger { background: var(--defect); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: default; }

.content {
  padding: 16px;
  max-width: 780px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.job-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.job-card .info { flex: 1; }
.job-card .name { font-size: 17px; font-weight: 600; }
.job-card .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .icon { font-size: 42px; margin-bottom: 12px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field input[type=text], .field input[type=date], .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  font-family: inherit;
  color: var(--text);
}
.field textarea { min-height: 90px; resize: vertical; }

.search-box {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  background: white;
}

.category-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 20px 0 8px;
}
.category-heading:first-child { margin-top: 0; }

.item-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.item-row .title { font-weight: 600; font-size: 15px; }
.item-row .wording { font-size: 13px; color: var(--muted); margin-top: 4px; }

.custom-item-btn {
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.entry-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.entry-card .entry-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.entry-card .entry-title { font-weight: 600; font-size: 15px; }
.entry-card .entry-loc { font-size: 13px; color: var(--muted); margin-top: 2px; }

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}
.status-pill.maintained { background: var(--ok); }
.status-pill.defect { background: var(--defect); }
.status-pill.review { background: var(--review); }
.status-pill.na { background: var(--na); }

.status-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.status-option {
  flex: 1;
  min-width: 42%;
  padding: 12px 8px;
  text-align: center;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  background: white;
  color: var(--text);
  cursor: pointer;
}
.status-option.selected.maintained { border-color: var(--ok); background: #e9f6ee; color: var(--ok); }
.status-option.selected.defect { border-color: var(--defect); background: #fbeae8; color: var(--defect); }
.status-option.selected.review { border-color: var(--review); background: #fdf1e0; color: var(--review); }
.status-option.selected.na { border-color: var(--na); background: #eef0f2; color: var(--na); }

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.photo-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.add-photo-btn {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--accent);
  font-size: 26px;
  cursor: pointer;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.action-row .btn { flex: 1; }

.footer-bar {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-dark);
  color: white;
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

.count-badge {
  background: rgba(255,255,255,0.18);
  color: white;
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
}
