:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7f8;
  color: #172426;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

.topbar {
  align-items: center;
  background: #0b5f66;
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 18px 16px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.eyebrow {
  font-size: 12px;
  margin: 0 0 4px;
  opacity: .8;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  margin-bottom: 0;
}

h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

main {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 920px;
  padding: 14px;
}

section {
  background: #fff;
  border: 1px solid #d9e3e5;
  border-radius: 8px;
  padding: 14px;
}

.panel-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

#routeDesc {
  color: #557276;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 0;
}

button,
.secondary,
.icon-link {
  align-items: center;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
}

.primary,
.submit {
  background: #147d74;
  color: #fff;
}

.secondary,
.icon-link {
  background: #e6f0ef;
  color: #0b5f66;
}

.point-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.point {
  align-items: center;
  border: 1px solid #dae5e6;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 36px 1fr auto;
  min-height: 56px;
  padding: 8px;
}

.point.done {
  border-color: #6dbf9b;
  background: #eefaf5;
}

.point-number {
  align-items: center;
  background: #eef2f3;
  border-radius: 999px;
  color: #496266;
  display: flex;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.point.done .point-number {
  background: #147d74;
  color: #fff;
}

.point-name {
  font-weight: 700;
}

.point-meta {
  color: #557276;
  font-size: 12px;
}

.selected-point-card {
  background: #f6fbfa;
  border: 1px solid #cfe1df;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 12px;
}

.selected-point-card h3 {
  font-size: 20px;
  margin: 8px 0 4px;
}

.selected-point-card p {
  color: #557276;
  font-size: 13px;
  margin-bottom: 0;
}

.point-badge {
  background: #147d74;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.selected-point-card dl {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
}

.selected-point-card dt {
  color: #557276;
  font-size: 12px;
}

.selected-point-card dd {
  color: #172426;
  font-size: 14px;
  font-weight: 700;
  margin: 2px 0 0;
}

form {
  display: grid;
  gap: 12px;
}

label {
  color: #314c50;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.field-hint {
  color: #557276;
  font-size: 12px;
}

select,
textarea,
input[type="file"],
input[type="text"],
input[type="number"],
input[type="time"] {
  border: 1px solid #cbdadc;
  border-radius: 6px;
  font: inherit;
  min-height: 42px;
  padding: 9px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.photo-preview {
  border-radius: 8px;
  display: none;
  max-height: 240px;
  object-fit: cover;
  width: 100%;
}

.location-line,
.actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

#locationText {
  color: #557276;
  font-size: 13px;
  line-height: 1.4;
}

.issue-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.issue-list li {
  background: #fff7ea;
  border: 1px solid #f1d6a8;
  border-radius: 8px;
  color: #674817;
  padding: 10px;
}

.issue-list li.resolved {
  background: #eefaf5;
  border-color: #b7dfcc;
  color: #245743;
}

.issue-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr auto;
  margin-top: 10px;
}

.remedy-text {
  margin: 8px 0 0;
}

.inspection-box {
  display: grid;
  gap: 8px;
}

.inspection-box h3 {
  font-size: 15px;
  margin: 2px 0;
}

.inspection-row {
  align-items: center;
  border: 1px solid #e2e9ea;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 110px;
  padding: 8px;
}

.muted {
  color: #557276;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 0;
}

.admin-main {
  max-width: 1040px;
}

.admin-point-list {
  display: grid;
  gap: 12px;
}

.admin-point {
  border: 1px solid #d9e3e5;
  border-radius: 8px;
  padding: 12px;
}

.admin-point-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.admin-grid {
  display: grid;
  gap: 10px;
}

.admin-grid.compact {
  grid-template-columns: 1fr;
}

.check-item-editor {
  margin-top: 10px;
}

.record-filters {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.record-table-wrap {
  overflow-x: auto;
}

.record-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.record-table th,
.record-table td {
  border-bottom: 1px solid #e2e9ea;
  font-size: 13px;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.record-table th {
  color: #557276;
  font-weight: 700;
}

.muted-cell {
  color: #9aa4aa;
  text-align: center;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.records-page {
  background: #f3f5f7;
  color: #333;
}

.records-console {
  background: #fff;
  display: block;
  margin: 16px 8px;
  max-width: none;
  min-height: calc(100vh - 32px);
  padding: 16px 32px 32px;
}

.records-console section {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.records-filters {
  border-bottom: 1px solid #e5e8ec;
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
}

.filter-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 30px;
}

.filter-line > span,
.filter-line label {
  align-items: center;
  color: #495060;
  display: inline-flex;
  font-size: 14px;
  gap: 8px;
}

.filter-line select {
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 0;
  color: #333;
  font-size: 14px;
  min-height: 32px;
  min-width: 110px;
  padding: 4px 30px 4px 10px;
}

.segmented {
  display: inline-flex;
  gap: 8px;
}

.segmented button,
.view-tabs button,
.record-actions button,
.record-actions a {
  background: #fff;
  border: 1px solid #d7dbe2;
  border-radius: 0;
  color: #606878;
  font-size: 14px;
  min-height: 32px;
  padding: 0 12px;
}

.segmented button.active,
.view-tabs button.active {
  border-color: #1f7ae0;
  color: #1f7ae0;
}

.records-toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 16px 0;
}

.view-tabs,
.record-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.view-tabs button + button {
  margin-left: -1px;
}

.view-tabs span {
  color: #8a919d;
  font-size: 14px;
  margin-left: 10px;
}

.view-tabs a,
.record-actions button {
  color: #1f7ae0;
  text-decoration: none;
}

.view-tabs a {
  font-size: 14px;
  margin-left: 8px;
}

.record-actions {
  gap: 14px;
  justify-content: flex-end;
}

.record-actions button {
  border-color: transparent;
  padding: 0;
}

.record-actions button:hover,
.view-tabs a:hover {
  text-decoration: underline;
}

.record-actions button:disabled {
  color: #b9bec7;
  opacity: 1;
}

.search-box {
  align-items: center;
  border: 1px solid #d7dbe2;
  color: #8a919d;
  display: inline-flex;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
}

.search-box input {
  border: 0;
  min-height: 28px;
  outline: 0;
  padding: 0;
  width: 110px;
}

.record-actions .disabled-link {
  background: #f5f5f5;
  border-color: #d7dbe2;
  color: #b9bec7;
  pointer-events: none;
}

.records-content {
  min-height: 540px;
  position: relative;
}

.record-card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.data-card {
  border: 1px solid #e1e5ea;
  border-radius: 2px;
  padding: 14px;
}

.data-card-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
}

.data-card-head label {
  display: block;
}

.data-card-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ok-status,
.danger-status {
  border-radius: 2px;
  display: inline-flex;
  font-size: 12px;
  line-height: 1;
  padding: 5px 7px;
}

.ok-status {
  background: #ecf8f0;
  color: #238447;
}

.danger-status {
  background: #fff0f0;
  color: #c23a3a;
}

.data-card dl {
  display: grid;
  gap: 8px 10px;
  grid-template-columns: 70px 1fr;
  margin: 14px 0 0;
}

.data-card dt {
  color: #8a919d;
}

.data-card dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-note {
  background: #fafbfc;
  color: #606878;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0 0;
  padding: 8px;
}

.data-card-actions {
  border-top: 1px solid #eef1f4;
  margin-top: 12px;
  padding-top: 10px;
}

.data-card-actions a {
  color: #1f7ae0;
  text-decoration: none;
}

.data-card-actions span {
  color: #b9bec7;
}

.data-table-wrap {
  border: 1px solid #e1e5ea;
}

.data-table {
  min-width: 920px;
}

.data-table th {
  background: #fafbfc;
}

.records-empty {
  color: #c2c7cf;
  left: 50%;
  position: absolute;
  text-align: center;
  top: 120px;
  transform: translateX(-50%);
}

.empty-icon {
  border: 2px solid #d8dce2;
  border-radius: 8px 8px 4px 4px;
  height: 34px;
  margin: 0 auto 10px;
  position: relative;
  width: 62px;
}

.empty-icon::before {
  background: #fff;
  border: 2px solid #d8dce2;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  content: "";
  height: 11px;
  left: 15px;
  position: absolute;
  top: -13px;
  width: 28px;
}

.records-empty p {
  font-size: 13px;
  margin: 0;
}

@media print {
  .records-filters,
  .records-toolbar {
    display: none;
  }

  .records-console {
    margin: 0;
    min-height: auto;
    padding: 0;
  }

  .record-card-grid {
    display: none;
  }

  .data-table-wrap {
    display: block !important;
  }
}

@media (max-width: 900px) {
  .records-console {
    padding: 14px;
  }

  .records-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .record-actions {
    justify-content: flex-start;
  }
}

.danger {
  background: #fff0ed;
  color: #a63b25;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.print-page {
  background: #fff;
  padding: 24px;
}

.print-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.print-grid section {
  break-inside: avoid;
}

.qr-fallback {
  align-items: center;
  aspect-ratio: 1;
  border: 2px dashed #0b5f66;
  color: #0b5f66;
  display: flex;
  font-size: 20px;
  font-weight: 800;
  justify-content: center;
  text-align: center;
}

.qr-img {
  aspect-ratio: 1;
  display: block;
  height: auto;
  margin: 10px auto;
  max-width: 220px;
  width: 100%;
}

@media (min-width: 760px) {
  main {
    grid-template-columns: 1.2fr .8fr;
  }

  .route-panel,
  .manager-panel {
    grid-column: 1 / -1;
  }

  .admin-grid {
    grid-template-columns: 1.4fr .8fr .8fr .8fr;
  }

  .admin-grid.compact {
    grid-template-columns: 1fr .7fr .7fr .7fr;
  }
}

@media (max-width: 560px) {
  .selected-point-card dl {
    grid-template-columns: 1fr;
  }

  .issue-actions {
    grid-template-columns: 1fr;
  }
}

.patrol-page {
  background: #fff;
  display: block;
  max-width: 390px;
  min-height: 100vh;
  padding: 0;
}

.point-hero {
  background: #23609a;
  border: 0;
  border-radius: 0;
  color: #fff;
  position: relative;
  padding: 18px 14px 16px;
}

.admin-links {
  display: flex;
  gap: 8px;
  position: absolute;
  right: 12px;
  top: calc(env(safe-area-inset-top) + 12px);
}

.admin-links a {
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  padding: 7px 9px;
  text-decoration: none;
}

.point-hero > h1 {
  font-size: 24px;
  margin: 28px 0 14px;
  text-align: center;
}

.mini-card {
  background: #fff;
  border: 0;
  border-radius: 4px;
  color: #172426;
  margin-top: 10px;
  padding: 14px;
}

.mini-card h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.result-card {
  text-align: center;
}

.result-card h2 {
  text-align: left;
}

#resultText {
  display: block;
  font-size: 18px;
  margin: 8px 0;
}

#resultText.normal {
  color: #16b45f;
}

#resultText.abnormal {
  color: #dc3b3b;
}

#resultMeta,
#recordEmpty,
.entry-row p {
  color: #9aa4aa;
  font-size: 12px;
  margin-bottom: 0;
}

.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 26px;
}

.tabs span {
  color: #9aa4aa;
}

.record-card {
  min-height: 116px;
}

.entry-row {
  align-items: center;
  background: #f1f4f7;
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

.entry-row button {
  background: #2672c9;
  border-radius: 3px;
  color: #fff;
  min-height: 34px;
  padding: 0 20px;
}

.plain-panel,
.check-panel {
  border: 0;
  border-radius: 0;
  padding: 22px 22px 0;
}

.plain-panel h2,
.check-panel h2 {
  color: #0c5ca8;
  font-size: 16px;
  margin-bottom: 12px;
}

.plain-panel h2::after {
  border-top: 1px dashed #0c5ca8;
  content: "";
  display: inline-block;
  margin-left: 8px;
  transform: translateY(-4px);
  width: 145px;
}

.plain-panel p,
.plain-panel li {
  color: #235b9b;
  font-size: 13px;
  line-height: 1.7;
}

.info-box {
  border: 1px dashed #0c5ca8;
  margin: 0;
  min-height: 78px;
  padding: 16px 18px 16px 30px;
}

.info-box ul {
  margin: 0;
  padding-left: 18px;
}

.info-box p {
  margin: 0;
  overflow-wrap: anywhere;
}

.check-panel[hidden] {
  display: none;
}

.check-panel {
  padding-bottom: 24px;
}

.required {
  color: #d63232;
}

.form-label {
  display: inline;
}

.photo-capture {
  align-items: center;
  background: #f1f4f7;
  border: 0;
  border-radius: 0;
  color: #333;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 118px;
  padding: 42px 12px;
  width: 100%;
}

.camera-icon {
  color: #999;
  font-size: 18px;
}

.result-choices {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.result-choice {
  background: #fae7e8;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #d63232;
  font-weight: 700;
  min-height: 42px;
}

.result-choice.active {
  background: #e9fff2;
  border-color: #16c56f;
  color: #10aa58;
}

.result-choice[data-status="abnormal"].active {
  background: #fff1f1;
  border-color: #d63232;
  color: #d63232;
}

.form-section-title {
  border-bottom: 1px solid #1d70d2;
  color: #0c5ca8;
  font-size: 15px;
  margin: 8px 0 4px;
  padding-bottom: 8px;
}

.check-panel input[readonly],
.location-block button {
  background: #f4f8fa;
  color: #23609a;
}

.location-block {
  display: grid;
  gap: 8px;
}

.location-block > span {
  color: #314c50;
  font-size: 13px;
}

.location-block button {
  border: 1px solid #cbdadc;
  border-radius: 3px;
  justify-content: flex-start;
}

.location-block p {
  color: #9aa4aa;
  font-size: 12px;
  margin: 0;
}

.check-panel .submit {
  background: #2672c9;
  border-radius: 3px;
  min-height: 44px;
}

.camera-sheet {
  background: #000;
  border: 0;
  inset: 0;
  padding: 0;
  position: fixed;
  z-index: 100;
}

.camera-sheet[hidden] {
  display: none;
}

.camera-sheet video {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.camera-watermark {
  background: linear-gradient(180deg, rgba(0, 0, 0, .72), rgba(0, 0, 0, .5) 70%, rgba(0, 0, 0, 0));
  color: #fff;
  left: 0;
  padding: calc(env(safe-area-inset-top) + 18px) 22px 34px;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 0;
  text-shadow: 0 2px 5px rgba(0, 0, 0, .55);
}

.camera-watermark strong {
  background: #ffd21f;
  border-radius: 3px;
  color: #111;
  display: inline-block;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 22px;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 7px 10px;
  text-shadow: none;
}

.camera-watermark div {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: auto 5px 1fr;
}

.camera-watermark span {
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
}

.camera-watermark i {
  background: #ffd21f;
  display: block;
  min-height: 66px;
  width: 5px;
}

.camera-watermark p {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.camera-watermark b {
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.camera-watermark em {
  font-size: 14px;
  font-style: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.camera-actions {
  align-items: center;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  left: 0;
  padding: 28px 34px calc(env(safe-area-inset-bottom) + 30px);
  position: absolute;
  right: 0;
}

.camera-actions button {
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  color: #fff;
  min-height: 52px;
  padding: 0;
  width: 52px;
}

#cameraCloseBtn {
  font-size: 42px;
  font-weight: 300;
}

#cameraShotBtn {
  background: #fff;
  border: 8px solid rgba(255, 255, 255, .6);
  height: 78px;
  justify-self: center;
  outline: 4px solid rgba(255, 255, 255, .28);
  width: 78px;
}

@media (min-width: 760px) {
  .patrol-page {
    grid-template-columns: none;
  }
}
