* {
  box-sizing: border-box;
}

html,
body,
.map-shell,
.station-map {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: #1f2937;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.map-shell {
  position: relative;
}

.station-map {
  background: #d9e6de;
}

.map-controls {
  align-items: end;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  left: 14px;
  max-width: calc(100% - 28px);
  padding: 10px;
  position: absolute;
  top: 14px;
  z-index: 500;
}

.map-controls label {
  color: #334155;
  display: grid;
  font-size: 12px;
  font-weight: 650;
  gap: 4px;
}

.map-controls select {
  appearance: none;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  color: #111827;
  font: inherit;
  min-height: 34px;
  min-width: 150px;
  padding: 6px 28px 6px 8px;
}

.map-toggle {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  left: 14px;
  line-height: 1;
  padding: 6px 10px;
  position: absolute;
  top: 14px;
  z-index: 500;
}

.map-toggle:hover {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.24);
}

.map-close {
  align-items: center;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  font-size: 18px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 6px;
  top: 4px;
}

.map-close:hover {
  color: #334155;
}

.map-controls.is-hidden {
  display: none;
}

.search-box {
  align-items: flex-start;
  display: flex;
  left: 14px;
  position: absolute;
  top: 52px;
  z-index: 500;
}

.search-actions {
  display: grid;
  gap: 4px;
}

.search-icon,
.proposal-icon {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  color: #94a3b8;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 8px;
}

.proposal-icon {
  color: #334155;
  font-size: 18px;
  font-weight: 700;
  min-width: 34px;
  padding: 6px 10px;
}

.search-icon:hover,
.proposal-icon:hover {
  background: #ffffff;
  color: #475569;
}

.search-input {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  color: #111827;
  font: inherit;
  font-size: 13px;
  min-width: 200px;
  outline: none;
  padding: 8px 10px;
  display: none;
  margin-left: 4px;
  vertical-align: middle;
}

.search-input:focus {
  border-color: #1d4ed8;
}

.search-box.open .search-icon {
  border-radius: 8px 0 0 8px;
  border-right: none;
  box-shadow: none;
}

.search-box.open .search-input {
  border-left: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  display: inline-block;
}

.search-results {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18);
  list-style: none;
  margin: 4px 0 0 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
  position: absolute;
  left: 38px;
  top: 34px;
  width: 100%;
}

.search-results li {
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
  color: #334155;
}

.search-results li:hover,
.search-results li:focus {
  background: #eff6ff;
  color: #1d4ed8;
}

.search-results li .muted {
  color: #94a3b8;
  font-size: 11px;
  margin-left: 6px;
}

#station-count {
  color: #475569;
  font-size: 13px;
  min-width: 90px;
  padding: 8px 2px;
}

.station-popup {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.station-popup strong {
  color: #0f172a;
  font-size: 14px;
}

.station-popup span {
  color: #475569;
  font-size: 12px;
}

.suggestion-open {
  background: #1d4ed8;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  margin-top: 4px;
  padding: 7px 9px;
  text-align: left;
}

.suggestion-open:hover {
  background: #1e40af;
}

.suggestion-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: absolute;
  z-index: 800;
}

.proposal-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: absolute;
  z-index: 800;
}

.auth-modal {
  align-items: center;
  background: rgba(15, 23, 42, 0.34);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: absolute;
  z-index: 800;
}

.auth-modal[hidden] {
  display: none;
}

.proposal-modal[hidden] {
  display: none;
}

.suggestion-modal[hidden] {
  display: none;
}

.suggestion-form,
.proposal-form,
.auth-form {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.24);
  display: grid;
  gap: 10px;
  max-height: min(720px, calc(100% - 32px));
  max-width: 860px;
  overflow: auto;
  padding: 16px;
  position: relative;
  width: min(100%, 860px);
}

.proposal-form {
  max-width: 620px;
  width: min(100%, 620px);
}

.auth-form {
  max-width: 360px;
  width: min(100%, 360px);
}

.suggestion-form strong,
.proposal-form strong,
.auth-form strong {
  color: #0f172a;
  font-size: 16px;
  padding-right: 24px;
}

.suggestion-form label,
.proposal-form label,
.auth-form label {
  color: #334155;
  display: grid;
  font-size: 12px;
  font-weight: 650;
  gap: 4px;
}

.suggestion-form input,
.suggestion-form select,
.suggestion-form textarea,
.proposal-form input,
.proposal-form select,
.proposal-form textarea,
.auth-form input {
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  color: #111827;
  font: inherit;
  min-height: 34px;
  padding: 7px 8px;
  width: 100%;
}

.suggestion-form textarea,
.proposal-form textarea {
  min-height: 110px;
  resize: vertical;
}

.proposal-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.proposal-center {
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  color: #334155;
  cursor: pointer;
  font: inherit;
  min-height: 34px;
  padding: 7px 8px;
  width: fit-content;
}

.proposal-center:hover {
  background: #f8fafc;
}

.suggestion-table-wrap {
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  max-height: 360px;
  overflow: auto;
}

.suggestion-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 720px;
  width: 100%;
}

.suggestion-table th,
.suggestion-table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.suggestion-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.suggestion-table tr:last-child td {
  border-bottom: none;
}

.suggestion-current {
  color: #475569;
  max-width: 240px;
  overflow-wrap: anywhere;
}

.suggestion-table select,
.suggestion-table input {
  min-height: 30px;
}

.suggestion-value-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

#suggestion-status,
#proposal-status,
#auth-status {
  color: #475569;
  font-size: 13px;
  min-height: 18px;
}

#suggestion-status.is-error,
#proposal-status.is-error,
#auth-status.is-error {
  color: #b91c1c;
}

#suggestion-status.is-success,
#proposal-status.is-success,
#auth-status.is-success {
  color: #047857;
}

.auth-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.auth-actions span {
  color: #475569;
  font-size: 13px;
}

.auth-actions button,
.auth-link-button {
  background: none;
  border: none;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 0;
}

.auth-actions .auth-icon {
  align-items: center;
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.auth-icon svg {
  fill: currentColor;
  height: 18px;
  width: 18px;
}

.auth-actions .auth-icon:hover {
  background: #f8fafc;
}

.auth-actions button:hover,
.auth-link-button:hover {
  color: #1e40af;
}

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

.suggestion-submit {
  background: #047857;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  min-height: 36px;
  padding: 8px 10px;
}

.suggestion-submit:hover {
  background: #065f46;
}

@media (max-width: 760px) {
  .map-controls {
    align-items: stretch;
    bottom: 12px;
    left: 12px;
    right: 12px;
    top: auto;
  }

  .map-controls label,
  .map-controls select {
    min-width: 0;
    width: 100%;
  }

  .suggestion-form {
    align-self: stretch;
  }

  .proposal-grid {
    grid-template-columns: 1fr;
  }
}
