.atm-shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto 48px;
  color: #1c2836;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
}

.atm-titlebar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 18px;
}

.atm-shell .atm-titlebar h1 {
  margin: 0 0 6px;
  color: #effaf3 !important;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

.atm-shell .atm-titlebar p {
  max-width: 760px;
  margin: 0;
  color: #c1d2ca !important;
  font-size: 15px;
  line-height: 1.5;
}

.atm-health {
  border: 1px solid #bad8ce;
  background: #f3fbf7;
  color: #1d6048;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

.atm-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(520px, 1.35fr);
  gap: 18px;
  align-items: start;
}

.atm-panel {
  border: 1px solid #d7e2e8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(29, 45, 61, 0.08);
}

.atm-input-panel,
.atm-result-panel,
.atm-map-panel {
  padding: 18px;
}

.atm-map-panel {
  margin-top: 18px;
}

.atm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.atm-panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.atm-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-bottom: 12px;
}

.atm-field span,
.atm-check span {
  color: #34495d;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
}

.atm-field input,
.atm-field select,
.atm-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c9d7e1;
  border-radius: 8px;
  background: #f8fbfc;
  color: #172536;
  font-size: 15px;
  line-height: 1.45;
  padding: 10px 11px;
}

.atm-field input:focus,
.atm-field select:focus,
.atm-field textarea:focus {
  border-color: #2d7f67;
  outline: 0;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(45, 127, 103, 0.18);
}

.atm-source-field textarea {
  min-height: 315px;
  resize: vertical;
}

.atm-line-meta,
.atm-progress-meta,
.atm-muted {
  color: #657386;
  font-size: 13px;
  line-height: 1.4;
}

.atm-line-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 14px;
}

.atm-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.atm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 12px;
}

.atm-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.atm-actions,
.atm-result-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.atm-btn {
  border: 1px solid #bac8d4;
  border-radius: 8px;
  background: #ffffff;
  color: #203247;
  padding: 9px 13px;
  min-height: 38px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.25;
}

.atm-btn:hover {
  border-color: #7c91a3;
  background: #f4f8fa;
}

.atm-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.atm-btn-primary {
  border-color: #236f59;
  background: #2d7f67;
  color: #ffffff;
}

.atm-btn-primary:hover {
  border-color: #1d5d4b;
  background: #256e59;
}

.atm-btn-ghost {
  background: #f8fbfc;
}

.atm-suggestions {
  display: none;
  border: 1px solid #bed0dc;
  border-radius: 8px;
  background: #ffffff;
  margin: -6px 0 12px;
  max-height: 260px;
  overflow: auto;
  box-shadow: 0 16px 34px rgba(21, 39, 58, 0.14);
}

.atm-suggestion {
  appearance: none;
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #eef2f6;
  background: #ffffff;
  color: #183044;
  cursor: pointer;
  text-align: left;
  font: inherit;
  box-shadow: none;
}

.atm-suggestion:last-child {
  border-bottom: 0;
}

.atm-suggestion:hover,
.atm-suggestion:focus {
  background: #edf7f4;
  outline: 0;
}

.atm-suggestion strong {
  display: block;
  color: #183044;
  font-size: 15px;
}

.atm-suggestion small {
  display: block;
  color: #587086;
  margin-top: 3px;
}

.atm-progress {
  margin-top: 16px;
}

.atm-progress-track {
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #e9eef5;
}

.atm-progress-bar {
  width: 0;
  height: 100%;
  background: #2d7f67;
  transition: width 160ms ease;
}

.atm-progress-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.atm-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 12px;
}

.atm-badge {
  border: 1px solid #d5dee9;
  border-radius: 8px;
  padding: 6px 9px;
  background: #f9fbfd;
  color: #33455d;
  font-size: 13px;
  font-weight: 700;
}

.atm-output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.atm-output-grid textarea {
  min-height: 160px;
  font-family: Consolas, "Courier New", monospace;
}

.atm-output-wide {
  grid-column: span 2;
}

.atm-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #dde5ee;
  border-radius: 8px;
}

.atm-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.atm-result-table th,
.atm-result-table td {
  border-bottom: 1px solid #edf1f6;
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

.atm-result-table th {
  position: sticky;
  top: 0;
  background: #f5f8fb;
  color: #33455d;
  z-index: 1;
}

.atm-result-table td {
  color: #26374d;
}

.atm-xy-lines {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.35;
  white-space: nowrap;
}

.atm-xy-line {
  display: block;
}

.atm-locate-btn {
  appearance: none;
  border: 1px solid #b9cce0;
  border-radius: 6px;
  background: #f8fbfd;
  color: #17314d;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  min-width: 48px;
  padding: 5px 9px;
  white-space: nowrap;
}

.atm-locate-btn:hover,
.atm-locate-btn:focus {
  border-color: #2d7f67;
  background: #edf7f4;
  outline: 0;
}

.atm-locate-empty {
  color: #9aa8b8;
}

.atm-status-ok {
  color: #176d48;
  font-weight: 700;
}

.atm-status-warn {
  color: #9a5b00;
  font-weight: 700;
}

.atm-status-error {
  color: #b42318;
  font-weight: 700;
}

#resultMap {
  width: 100%;
  height: clamp(420px, 48vh, 560px);
  min-height: 420px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #eef3f7;
}

@media (max-width: 980px) {
  .atm-shell {
    width: min(calc(100vw - 20px), 760px);
  }

  .atm-titlebar,
  .atm-grid {
    display: block;
  }

  .atm-health,
  .atm-result-panel {
    margin-top: 14px;
  }

  .atm-titlebar h1 {
    font-size: 26px;
  }

  .atm-options,
  .atm-output-grid,
  .atm-progress-meta {
    grid-template-columns: 1fr;
  }

  .atm-output-wide {
    grid-column: auto;
  }

  .atm-result-actions {
    justify-content: flex-start;
  }

  #resultMap {
    height: 420px;
  }
}
