:root {
  --bg: #061522;
  --panel: #0b2131;
  --panel2: #0e293b;
  --line: #1d4053;
  --text: #e8f3f7;
  --muted: #88a5b5;
  --aqua: #35d2c0;
  --blue: #3ba7ff;
  --amber: #f4b740;
  --red: #ff6b67;
  --ok: #4ed394;
}
* {
  box-sizing: border-box;
}
.pull-refresh {
  display: none;
}
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(4, 23, 34, 0.93), rgba(8, 57, 65, 0.88)),
    radial-gradient(circle at 30% 20%, #35d2c044, transparent 35%);
  backdrop-filter: blur(8px);
}
.login-gate[hidden] {
  display: none;
}
.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid #3a7180;
  border-radius: 18px;
  background: #0a2131f2;
  box-shadow: 0 28px 80px #0009;
}
.login-card h1 {
  margin: 0 0 5px;
  color: #f4fbfd;
  font-size: 22px;
}
.login-card > p {
  margin: 0 0 22px;
  color: #9eb8c3;
  font-size: 12px;
}
.login-card label {
  display: block;
  margin-top: 14px;
  color: #c7dbe2;
}
.login-card input {
  padding: 12px;
  font-size: 16px;
}
.login-card .login-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: #ff8c87;
}
.login-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
}
.login-card .login-vendor {
  margin: 20px -32px -32px;
  padding: 14px 20px;
  border-top: 1px solid #2b5263;
  border-radius: 0 0 18px 18px;
  background: #071a28b8;
  color: #c7dbe2;
  text-align: center;
  font-size: 11px;
  line-height: 1.5;
}
.login-card .login-vendor span {
  display: block;
  margin-bottom: 2px;
  color: #6fa8b9;
  font-size: 9px;
  letter-spacing: 0.14em;
}
.login-logo-plate {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 22px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px #0004;
}
.login-company-logo {
  display: block;
  width: 100%;
  height: auto;
}
.auth-locked > :not(.login-gate) {
  pointer-events: none;
  user-select: none;
}
.signed-user {
  align-self: center;
  color: #b9d8df;
  font-size: 11px;
  white-space: nowrap;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  overflow: hidden;
}
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #081b29;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.logo-link {
  color: inherit;
  text-decoration: none;
}
.brand:hover .logo-plate {
  box-shadow: 0 3px 16px #0007;
}
.logo-link:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 4px;
  border-radius: 8px;
}
.logo-plate {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 12px #0005;
}
.company-logo {
  display: block;
  width: 190px;
  height: auto;
}
.brandmark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--aqua), #177f91);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #06202b;
  box-shadow: 0 0 24px #35d2c033;
}
.brand strong {
  display: block;
  letter-spacing: 0.04em;
}
.brand small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 11px;
}
.top-actions,
.dialog-actions {
  display: flex;
  gap: 10px;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.primary,
.ghost {
  border-radius: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
}
.primary {
  background: var(--aqua);
  color: #042028;
  font-weight: 800;
}
.ghost {
  background: #102a3a;
  border-color: #295064;
}
.app-tabs {
  height: 48px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0 24px;
  background: #0a2131;
  border-bottom: 1px solid var(--line);
}
.app-tabs button {
  position: relative;
  min-width: 112px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: #86a5b1;
  font-weight: 700;
}
.app-tabs button::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}
.app-tabs button.active {
  color: #fff;
}
.app-tabs button.active::after {
  background: var(--aqua);
}
.shell {
  height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: 300px 1fr;
}
.page-view {
  box-sizing: border-box;
  height: calc(100vh - 120px);
  padding: 26px;
  overflow: auto;
  background: #eef4f5;
  color: #173b49;
}
.page-view[hidden],
.shell[hidden] {
  display: none !important;
}
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 22px;
  max-width: 1380px;
}
.page-heading small {
  color: #008c95;
  font-weight: 800;
  letter-spacing: .08em;
}
.page-heading h1 {
  margin: 5px 0 4px;
  font-size: 28px;
}
.page-heading p {
  margin: 0;
  color: #6f8791;
}
.page-filters {
  display: flex;
  gap: 8px;
  max-width: 1380px;
  margin: 0 auto 18px;
}
.page-filters button {
  padding: 8px 15px;
  border: 1px solid #b9cfd5;
  border-radius: 999px;
  background: #fff;
  color: #476875;
}
.page-filters button.active {
  border-color: #008c95;
  background: #008c95;
  color: #fff;
}
.atlas-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  max-width: 1380px;
  margin: auto;
}
.atlas-card {
  overflow: hidden;
  border: 1px solid #cfdee2;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 7px 22px #173c4b12;
}
.atlas-photo {
  position: relative;
  height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #dfe9ec;
  color: #7693a0;
  font-size: 13px;
}
.atlas-inspection-photo {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 150px;
  height: 105px;
  padding: 0;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 5px 18px #0007;
}
.atlas-inspection-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-toggle {
  padding: 8px 12px;
  border: 1px solid #87b3ba;
  border-radius: 8px;
  background: #fff;
  color: #087d84;
  font-weight: 800;
}
.map-photo-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 800;
  background: #fffffff0;
  box-shadow: 0 3px 12px #0004;
}
.inspection-photo-marker {
  border: 0 !important;
  background: transparent !important;
}
.inspection-photo-marker img {
  box-sizing: border-box;
  width: 72px;
  height: 54px;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 7px;
  box-shadow: 0 4px 14px #000a;
  cursor: zoom-in;
}
.atlas-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.atlas-body {
  padding: 15px;
}
.atlas-body small,
.atlas-meta {
  color: #708994;
}
.atlas-body h3 {
  margin: 5px 0 12px;
  font-size: 17px;
}
.atlas-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.records-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1380px;
  margin: 0 auto 14px;
  color: #637e89;
}
.records-toolbar label {
  width: min(460px, 100%);
  color: #476875;
  font-size: 12px;
}
.records-toolbar input,
.records-toolbar select {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  margin-top: 6px;
  padding: 0 13px;
  border: 1px solid #b9cfd5;
  border-radius: 8px;
  background: #fff;
  color: #173b49;
  font-size: 16px;
}
.records-table-wrap {
  max-width: 1380px;
  margin: auto;
  overflow: auto;
  border: 1px solid #cfdee2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 22px #173c4b10;
}
.records-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.records-table th,
.records-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #dbe6e9;
  text-align: left;
  vertical-align: middle;
}
.records-table th {
  position: sticky;
  top: 0;
  background: #e4eff1;
  color: #476875;
  font-size: 12px;
}
.records-table td {
  font-size: 13px;
}
.records-table tr:last-child td {
  border-bottom: 0;
}
.records-table .empty-row {
  padding: 42px;
  color: #718a94;
  text-align: center;
}
.record-location small {
  display: block;
  max-width: 300px;
  overflow: hidden;
  color: #718a94;
  text-overflow: ellipsis;
}
.record-thumb {
  width: 52px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
}
.photo-count {
  color: #637e89;
  font-size: 12px;
}
.record-actions {
  display: flex;
  gap: 6px;
}
.record-actions button {
  padding: 6px 9px;
  border: 1px solid #8eb8c0;
  border-radius: 6px;
  background: #eef8f8;
  color: #087d84;
  font-size: 12px;
  font-weight: 700;
}
.record-actions button:last-child {
  border-color: #e3b596;
  background: #fff5ee;
  color: #b55728;
}
.record-detail-dialog {
  width: min(760px, calc(100vw - 32px));
}
.record-detail-dialog .dialog-head {
  margin: 0;
  padding: 20px;
}
.record-detail-content {
  padding: 20px;
}
.record-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.record-detail-grid > div {
  padding: 12px;
  border: 1px solid #24495a;
  border-radius: 8px;
  background: #0e293a;
}
.record-detail-grid .detail-wide {
  grid-column: 1 / -1;
}
.record-detail-grid dt {
  color: #7fa2ae;
  font-size: 11px;
}
.record-detail-grid dd {
  margin: 5px 0 0;
}
.record-detail-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.record-detail-photos img {
  width: 100%;
  border-radius: 8px;
}
.detail-photo-item {
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #102c3d;
}
.detail-photo-item.selected {
  border-color: var(--aqua);
}
.detail-photo-open {
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
}
.detail-photo-open img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.feature-photo-button {
  width: 100%;
  margin-top: 6px;
  padding: 7px;
  border: 0;
  border-radius: 6px;
  background: #173e4d;
  color: #bcd3da;
  font-size: 12px;
}
.detail-photo-item.selected .feature-photo-button {
  background: #087d84;
  color: #fff;
}
.photo-viewer {
  width: min(1100px, calc(100vw - 24px));
  max-height: 94vh;
  background: #07141d;
}
.photo-viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #294653;
}
.photo-viewer-bar > div {
  display: flex;
  gap: 6px;
}
.photo-viewer-bar button {
  min-width: 38px;
  padding: 7px 9px;
  border: 1px solid #456575;
  border-radius: 6px;
  background: #102a39;
  color: #fff;
}
.photo-viewer-stage {
  height: min(78vh, 760px);
  display: grid;
  place-items: center;
  overflow: auto;
  background: #02080c;
}
.photo-viewer-stage img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  transform-origin: center;
  transition: transform .15s ease;
  touch-action: pinch-zoom;
}
.sidebar {
  background: #081b29;
  border-right: 1px solid var(--line);
  padding: 18px;
  overflow: auto;
}
.search {
  height: 40px;
  background: #102838;
  border: 1px solid #234759;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}
.search input {
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  width: 100%;
}
.search input::placeholder {
  color: #7293a5;
}
.ports {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 16px 0;
}
.ports button {
  padding: 9px 2px;
  border: 1px solid #234759;
  background: #0d2434;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 700;
}
.ports button.active {
  background: #123f4c;
  color: #7cf4e5;
  border-color: #288d8a;
}
.progress-card {
  background: linear-gradient(145deg, #102d3f, #0c2332);
  padding: 13px;
  border: 1px solid #214357;
  border-radius: 10px;
  margin-bottom: 18px;
}
.progress-card > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.progress-card strong {
  color: var(--aqua);
}
.bar {
  height: 5px;
  background: #1a3d4e;
  border-radius: 9px;
  margin-top: 11px;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--aqua), var(--blue));
  width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.facilities {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.facility {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 8px;
  border-radius: 8px;
}
.facility:hover,
.facility.active {
  background: #102a3a;
  border-color: #23495d;
}
.facility i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.facility strong {
  font-size: 13px;
  display: block;
}
.facility small {
  font-size: 10px;
  color: var(--muted);
}
.facility em {
  font-size: 10px;
  font-style: normal;
  color: #6f91a2;
}
.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 52px minmax(320px, 1fr) 300px;
}
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #0a1e2d;
}
.mobile-port-tabs {
  display: none;
}
.crumb {
  font-size: 13px;
}
.crumb span {
  color: var(--aqua);
  font-weight: 700;
}
.crumb b {
  margin: 0 10px;
  color: #456475;
}
.segmented {
  display: flex;
  background: #071825;
  border: 1px solid #224557;
  border-radius: 8px;
  padding: 3px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 6px 11px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
}
.segmented button.active {
  background: #1a4051;
  color: white;
}
.map-wrap {
  position: relative;
  overflow: hidden;
  background: #061724;
}
#map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.shore {
  fill: #162f38;
  stroke: #31525b;
  stroke-width: 3;
}
.breakwater {
  fill: none;
  stroke: #85a5aa;
  stroke-width: 18;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}
.breakwater.selected {
  stroke: #7cf4e5;
  filter: url(#glow);
}
.marker {
  cursor: pointer;
}
.marker circle:first-child {
  stroke: #071e31;
  stroke-width: 4;
}
.marker text {
  fill: white;
  font-size: 15px;
  font-weight: 800;
  pointer-events: none;
}
.marker-label {
  fill: #d8edf1 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}
.legend {
  position: absolute;
  left: 18px;
  bottom: 34px;
  display: flex;
  gap: 13px;
  background: #081a27dd;
  border: 1px solid #25485b;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 11px;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.structure-legend {
  position: absolute;
  left: 18px;
  bottom: 78px;
  display: flex;
  gap: 12px;
  padding: 8px 11px;
  border: 1px solid #25485b;
  border-radius: 8px;
  background: #081a27dd;
  font-size: 11px;
}
.structure-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.structure-legend i {
  width: 18px;
  height: 4px;
  border-radius: 3px;
}
.structure-legend .caisson {
  background: #b88a00;
}
.structure-legend .block {
  background: #d86500;
}
.structure-legend .rubble {
  background: #7dd3fc;
}
.ok {
  background: var(--ok);
}
.watch {
  background: var(--amber);
}
.risk {
  background: var(--red);
}
.pending {
  background: #718b98;
}
.grade-zero {
  background: #7693a0;
}
.grade-one {
  background: var(--ok);
}
.grade-two {
  background: var(--amber);
}
.grade-three {
  background: #ff8a55;
}
.grade-four {
  background: var(--red);
}
.map-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25px;
  background: #06131edb;
  display: flex;
  justify-content: space-between;
  padding: 5px 18px;
  font: 10px ui-monospace;
  color: #789bab;
}
.facility-name-marker {
  width: max-content !important;
  height: auto !important;
  margin: 0 !important;
  cursor: pointer;
}
.facility-name-marker span {
  display: block;
  transform: translate(-50%, -140%);
  background: rgba(4, 24, 37, 0.88);
  border: 1px solid rgba(255, 210, 28, 0.75);
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  color: #fff7bf;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  white-space: nowrap;
}
.leaflet-marker-draggable.facility-name-marker {
  cursor: move;
}
.leaflet-marker-draggable.facility-name-marker span {
  border-color: var(--aqua);
  box-shadow: 0 0 0 2px rgba(53, 210, 192, 0.2), 0 3px 10px #0008;
}
.map-controls {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  flex-direction: column;
}
.map-controls button {
  width: 34px;
  height: 34px;
  background: #0a2232e8;
  border: 1px solid #2b5163;
}
.bottom-panel {
  background: #0a1d2b;
  border-top: 1px solid var(--line);
  padding: 18px 22px;
  overflow: auto;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-head small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
}
.panel-head h2 {
  margin: 2px 0 0;
  font-size: 19px;
}
.badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: #153546;
  color: #9ab8c6;
  font-size: 11px;
}
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.stat {
  border: 1px solid #214255;
  background: #0e2737;
  border-radius: 9px;
  padding: 10px 12px;
}
.stat small {
  color: var(--muted);
  font-size: 10px;
}
.stat strong {
  display: block;
  font-size: 20px;
  margin-top: 3px;
}
.stat strong span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}
.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}
.recent-head strong {
  font-size: 12px;
}
.text-btn {
  border: 0;
  background: none;
  color: var(--aqua);
  font-size: 11px;
}
.records {
  display: flex;
  flex-direction: column;
}
.record {
  display: grid;
  grid-template-columns: 90px 1.4fr 0.9fr 0.8fr 70px;
  gap: 12px;
  align-items: center;
  padding: 8px 5px;
  border-top: 1px solid #183749;
  font-size: 11px;
}
.record strong {
  font-size: 12px;
}
.record small {
  color: var(--muted);
}
.pill {
  justify-self: start;
  border-radius: 999px;
  padding: 3px 7px;
  background: #173646;
  color: #b8d0db;
}
.grade-A {
  color: var(--ok);
}
.grade-1 {
  color: var(--ok);
}
.grade-0 {
  color: #9bb0b9;
}
.grade-B {
  color: var(--amber);
}
.grade-2 {
  color: var(--amber);
}
.grade-C,
.grade-D,
.grade-3,
.grade-4 {
  color: var(--red);
}
dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: 90vh;
  background: #0b2131;
  color: var(--text);
  border: 1px solid #2a5265;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 30px 100px #000b;
}
dialog::backdrop {
  background: #020b12c7;
  backdrop-filter: blur(4px);
}
form {
  padding: 20px;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #244759;
  padding-bottom: 13px;
  margin-bottom: 16px;
}
.dialog-head small {
  color: var(--aqua);
}
.dialog-head h2 {
  margin: 3px 0;
}
.dialog-head p {
  margin: 4px 0 0;
  color: #76909b;
  font-size: 12px;
}
.close {
  background: none;
  border: 0;
  font-size: 26px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid > label {
  min-width: 0;
}
.form-grid input,
.form-grid select {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
}
.form-grid input[readonly] {
  color: #dceaf0;
  background: #102c3d;
}
.form-section {
  margin: 14px 0;
  padding: 15px;
  border: 1px solid #22485b;
  border-radius: 10px;
  background: #0e293a;
}
.form-section-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}
.form-section-title b {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 10px;
  background: #163e4b;
  color: var(--aqua);
}
.form-section-title strong,
.form-section-title small {
  display: block;
}
.form-section-title small {
  margin-top: 2px;
  color: #88a5b5;
}
.gps-card {
  margin-top: 13px;
  padding: 13px;
  border: 1px solid #9bcfd2;
  border-radius: 12px;
  background: #eef9f8;
}
.gps-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.gps-title > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  color: #008c95;
  font-size: 23px;
  font-weight: 900;
}
.gps-title strong,
.gps-title small {
  display: block;
}
.gps-title strong {
  color: #174653;
}
.gps-title small {
  margin-top: 2px;
  color: #718d96;
  font-size: 11px;
}
.gps-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: #008c86;
  color: #fff;
  font-weight: 800;
}
.gps-button:disabled {
  opacity: 0.65;
  cursor: wait;
}
.gps-values {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.gps-values input[readonly] {
  background: #fff;
  color: #204b57;
}
.gps-status {
  margin: 7px 0 0;
  color: #66838d;
  font-size: 11px;
}
.gps-status.success {
  color: #087b61;
}
.gps-status.error {
  color: #c34840;
}
label {
  font-size: 11px;
  color: #9ab6c5;
}
#formDate {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 44px;
}
#formDate::-webkit-date-and-time-value {
  min-height: 1.2em;
  text-align: left;
}
input,
select,
textarea {
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1px solid #2a5265;
  border-radius: 7px;
  background: #071a28;
  color: var(--text);
  font: inherit;
}
textarea {
  resize: vertical;
}
.dynamic-fields {
  margin: 15px 0;
  padding: 13px;
  border: 1px solid #22485b;
  background: #0e293a;
  border-radius: 9px;
}
.dynamic-fields h3 {
  margin: 0 0 10px;
  font-size: 13px;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.checks label {
  border: 1px solid #2a5265;
  background: #0a2130;
  padding: 7px 9px;
  border-radius: 7px;
}
.checks input {
  width: auto;
  margin: 0 5px 0 0;
}
.hidden {
  display: none;
}
.wide {
  display: block;
  margin-top: 12px;
}
.upload {
  display: block;
  border: 1px dashed #3b7184;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  color: var(--aqua);
  margin: 12px 0;
}
.upload input {
  display: none;
}
.dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid #23485a;
  padding-top: 14px;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #183d4c;
  border: 1px solid #3d7684;
  padding: 12px 18px;
  border-radius: 9px;
  transform: translateY(120px);
  opacity: 0;
  transition: 0.25s;
}
.toast.show {
  transform: none;
  opacity: 1;
}
@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  .shell {
    grid-template-columns: 1fr;
    height: auto;
  }
  .atlas-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    height: calc(100vh - 120px);
    grid-template-rows: 48px 52vh 1fr;
  }
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .record {
    grid-template-columns: 70px 1fr 75px;
  }
  .record > *:nth-child(3),
  .record > *:nth-child(4) {
    display: none;
  }
  .brand small {
    display: none;
  }
  .company-logo {
    width: 130px;
  }
  .top-actions .ghost {
    display: none;
  }
}
@media (max-width: 600px) {
  .pull-refresh {
    position: fixed;
    top: 10px;
    left: 50%;
    z-index: 20000;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid #b9d5dc;
    border-radius: 999px;
    background: #fffffff2;
    color: #187d84;
    font-size: 12px;
    box-shadow: 0 7px 22px #123b4a32;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -64px);
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
  .pull-refresh.visible {
    opacity: 1;
  }
  .pull-refresh.ready {
    color: #fff;
    border-color: #008c95;
    background: #008c95;
  }
  .pull-refresh.refreshing span {
    animation: pull-spin 0.7s linear infinite;
  }
  .topbar {
    height: 86px !important;
    gap: 8px;
    padding: 8px 10px;
  }
  .app-tabs {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 48px;
    justify-content: space-around;
    padding: 0 4px;
    overflow-x: auto;
  }
  .app-tabs button {
    min-width: 96px;
    padding: 0 10px;
    font-size: 13px;
  }
  .topbar .brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: 7px;
  }
  .topbar .brand > div {
    min-width: 0;
  }
  .topbar .brand strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .logo-plate {
    padding: 4px 5px;
  }
  .company-logo {
    width: 76px;
  }
  .topbar .top-actions {
    flex: 0 0 auto;
    gap: 4px;
  }
  .signed-user {
    display: none;
  }
  #newBtn {
    padding: 9px 10px;
    white-space: nowrap;
    font-size: 12px;
  }
  .workspace {
    height: calc(100dvh - 134px) !important;
    grid-template-rows: 50px 44vh 1fr;
  }
  .page-view {
    height: calc(100dvh - 134px);
    padding: 18px 12px 28px;
  }
  .page-heading {
    align-items: flex-start;
    margin-bottom: 16px;
  }
  .page-heading h1 {
    font-size: 23px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .page-heading .primary {
    flex: 0 0 auto;
    padding: 9px 11px;
    font-size: 12px;
  }
  .page-filters {
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .page-filters button {
    flex: 0 0 auto;
  }
  .atlas-grid {
    grid-template-columns: 1fr;
  }
  .atlas-photo {
    height: 190px;
  }
  .atlas-inspection-photo {
    right: 9px;
    bottom: 9px;
    width: 104px;
    height: 76px;
  }
  .map-photo-toggle {
    top: 8px;
    right: 8px;
    padding: 7px 9px;
    font-size: 11px;
  }
  .records-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .records-table th,
  .records-table td {
    padding: 11px 12px;
  }
  .records-table {
    table-layout: fixed;
    white-space: normal;
  }
  .records-table th:nth-child(1),
  .records-table td:nth-child(1),
  .records-table th:nth-child(3),
  .records-table td:nth-child(3),
  .records-table th:nth-child(6),
  .records-table td:nth-child(6),
  .records-table th:nth-child(7),
  .records-table td:nth-child(7) {
    display: none;
  }
  .records-table th:nth-child(2) { width: 27%; }
  .records-table th:nth-child(4) { width: 22%; }
  .records-table th:nth-child(5) { width: 25%; }
  .records-table th:nth-child(8) { width: 24%; }
  .records-table th:nth-child(5),
  .records-table td:nth-child(5) {
    white-space: nowrap;
  }
  .records-table .empty-row {
    display: table-cell !important;
  }
  .record-location small {
    display: none;
  }
  .record-actions {
    align-items: center;
    flex-direction: row;
    gap: 3px;
  }
  .record-actions button {
    width: auto;
    min-width: 34px;
    padding: 5px 4px;
    font-size: 10px;
  }
  .record-detail-dialog .dialog-head {
    margin: 0;
  }
  .record-detail-content {
    padding: 16px;
    overflow: auto;
  }
  .record-detail-grid {
    grid-template-columns: 1fr;
  }
  .record-detail-grid .detail-wide {
    grid-column: auto;
  }
  .record-detail-grid > div {
    border-color: #d5e3e8;
    background: #fff;
  }
  .record-detail-grid dt {
    color: #708994;
  }
  .record-detail-photos {
    grid-template-columns: 1fr;
  }
  .detail-photo-item {
    background: #eef4f5;
  }
  .photo-viewer {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
  }
  .photo-viewer-stage {
    height: calc(100dvh - 64px);
  }
  .map-toolbar {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 6px 8px !important;
    scrollbar-width: none;
  }
  .map-toolbar::-webkit-scrollbar {
    display: none;
  }
  .map-toolbar .crumb {
    display: none !important;
  }
  .mobile-port-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    padding-right: 8px;
    border-right: 1px solid #2b4d5d;
  }
  .mobile-port-tabs button {
    padding: 7px 10px;
    border: 1px solid #315668;
    border-radius: 6px;
    background: #102a3a;
    color: #a9c2cb;
    white-space: nowrap;
    font-size: 11px;
  }
  .mobile-port-tabs button.active {
    border-color: #37c8bf;
    background: #0a6f76;
    color: #fff;
  }
  .map-toolbar .segmented {
    display: none;
  }
  .map-toolbar .segmented button {
    padding: 7px 10px;
    white-space: nowrap;
    font-size: 11px;
  }
  .legend {
    left: 8px;
    bottom: 34px;
    max-width: none;
    flex-wrap: nowrap;
    gap: 7px;
    padding: 7px 9px;
    font-size: 10px;
  }
  .structure-legend {
    left: 8px;
    bottom: 72px;
    gap: 7px;
    padding: 7px 9px;
    font-size: 10px;
  }
  dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #f4f7f8;
    color: #173b49;
  }
  dialog form {
    min-height: 100%;
    padding: 0 16px 104px;
  }
  .dialog-head {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 0 -16px 18px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid #d7e5ea;
    background: #fff;
  }
  .dialog-head small {
    color: #008c95;
    font-weight: 800;
  }
  .dialog-head h2 {
    margin-top: 5px;
    color: #173b49;
    font-size: 26px;
  }
  .dialog-head p {
    color: #728b96;
    font-size: 13px;
  }
  .close {
    color: #456674;
    font-size: 30px;
  }
  .form-section {
    margin: 14px 0;
    padding: 18px;
    border-color: #d5e3e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 18px #173c4b0d;
  }
  .form-section-title b {
    background: #e7f6f4;
    color: #008c83;
  }
  .form-section-title strong {
    color: #173b49;
    font-size: 18px;
  }
  .form-section-title small {
    color: #8198a2;
    font-size: 12px;
  }
  .gps-card {
    padding: 13px;
  }
  .gps-button {
    min-height: 47px;
    font-size: 16px;
  }
  .gps-values {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  dialog label {
    color: #294b59;
    font-size: 14px;
    font-weight: 700;
  }
  dialog input,
  dialog select,
  dialog textarea {
    min-height: 50px;
    margin-top: 7px;
    padding: 12px 13px;
    border-color: #c8d9e0;
    border-radius: 10px;
    background: #fbfcfd;
    color: #173b49;
    font-size: 16px;
  }
  #formDate {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
  }
  dialog textarea {
    min-height: 110px;
  }
  .upload {
    margin: 0;
    padding: 18px 12px;
    border: 2px dashed #63aeb9;
    background: #edf8f8;
    color: #007f88;
  }
  .dialog-actions {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid #d9e5e9;
    background: #fffffff2;
    box-shadow: 0 -8px 24px #173c4b18;
  }
  .dialog-actions .ghost {
    display: none;
  }
  .dialog-actions .primary {
    width: 100%;
    min-height: 54px;
    border-radius: 12px;
    background: #ec6b30;
    color: #fff;
    font-size: 17px;
    box-shadow: 0 7px 18px #d75b2638;
  }
  .summary {
    gap: 6px;
  }
  .bottom-panel {
    padding: 14px;
  }
  .legend {
    flex-wrap: nowrap;
    max-width: none;
  }
}
@keyframes pull-spin {
  to { transform: rotate(360deg); }
}
