:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #141b29;
  --muted: #5c677d;
  --border: #dce3ef;
  --primary: #0052d9;
  --primary-hover: #003eb3;
  --primary-soft: #eaf1ff;
  --success: #0d9488;
  --warning: #d97706;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.brand-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.gps-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f6ff 100%);
}

.gps-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.gps-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gps-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18);
}

.gps-dot.active {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.18);
}

.gps-dot.error {
  background: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}

.gps-title {
  font-size: 14px;
  font-weight: 600;
}

.gps-sub {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

.badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field-group:last-child {
  margin-bottom: 0;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

select,
input[type="text"],
input[type="tel"],
input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 82, 217, 0.12);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.nearby-box {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.nearby-box.hidden {
  display: none;
}

.nearby-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.nearby-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nearby-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #c9dbff;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.nearby-chip.selected {
  border-color: var(--primary);
  background: #eef4ff;
  font-weight: 600;
}

.nearby-dist {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.nearby-dist.guess {
  color: var(--warning);
}

.gps-learn-toast {
  margin-top: 6px;
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.gps-learn-toast.hidden {
  display: none;
}

.store-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.store-tools.hidden,
.btn-link.hidden {
  display: none;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.action-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 82, 217, 0.25);
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  background: #9fb7e5;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #c9dbff;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}

.sub-actions {
  display: flex;
  justify-content: center;
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
}

.btn-ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}
