@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --stone: #e4e0ec;
  --jade: #1f9d68;
  --jade-deep: #16734c;
  --ink: #1e1a33;
  --paper: #fff;
  --paper-strong: #f6f2fb;
  --bg: #f4effa;
  --bg-deep: #e6ddf4;
  --panel-line: rgba(30, 26, 51, 0.12);
  --shadow: 0 12px 28px rgba(30, 26, 51, 0.14);
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.45), transparent 36%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
}

.gt-app {
  max-width: 1440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.gt-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
  padding: 24px 28px 28px;
  border-radius: 20px;
  background: linear-gradient(120deg, #2a1b6b 0%, #7b2fbe 55%, #d81b7a 100%);
  box-shadow: 0 14px 30px rgba(42, 27, 107, 0.35);
  position: relative;
  overflow: hidden;
}

.gt-header::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 7px;
  background: repeating-linear-gradient(90deg, #ffb000 0 24px, #00b4a6 24px 48px, #ff6b35 48px 72px, #fff 72px 96px);
  content: "";
}

.gt-title {
  margin: 0 0 4px;
  color: #fff;
  font-family: 'Fraunces', serif;
  font-size: clamp(38px, 6vw, 58px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gt-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  line-height: 1.4;
}

.gt-stat {
  min-width: 190px;
  text-align: right;
}

.gt-stat-main {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.gt-stat-num {
  color: #ffd36b;
  font-family: 'Fraunces', serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
}

.gt-stat-label,
.gt-stat-sub {
  color: rgba(255, 255, 255, 0.82);
}

.gt-stat-label { font-size: 14px; }

.gt-stat-sub {
  margin-top: 3px;
  font-size: 12.5px;
}

.gt-auth {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: flex-end;
}

.gt-header-toggle {
  display: none;
}

.gt-auth-login,
.gt-auth-logout {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font: 600 13px 'Space Grotesk', sans-serif;
  transition: background 0.15s ease;
}

.gt-auth-login:hover,
.gt-auth-logout:hover {
  background: rgba(255, 255, 255, 0.26);
}

.gt-auth-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.gt-auth-email {
  max-width: min(28vw, 280px);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gt-bar-track {
  width: 190px;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.25);
}

.gt-bar-fill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ffb000, #ffd36b);
  transition: width 0.45s ease;
}

.gt-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px 24px;
  margin-bottom: 12px;
}

.gt-department-filter {
  display: grid;
  gap: 5px;
  color: rgba(30, 26, 51, 0.72);
  font-size: 12px;
  font-weight: 600;
}

.gt-department-filter select {
  min-width: 230px;
  min-height: 42px;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 500 14px 'Space Grotesk', sans-serif;
}

.gt-pending-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.gt-pending-filter input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--jade);
}

.gt-nearby-btn {
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--jade);
  box-shadow: 0 4px 12px rgba(22, 115, 76, 0.2);
  color: #fff;
  cursor: pointer;
  font: 600 14px 'Space Grotesk', sans-serif;
  transition: background 0.15s ease, transform 0.15s ease;
}

.gt-nearby-btn:hover {
  transform: translateY(-1px);
  background: var(--jade-deep);
}

.gt-nearby-btn:focus-visible,
.gt-nearby-item:focus-visible {
  outline: 3px solid rgba(39, 136, 232, 0.55);
  outline-offset: 2px;
}

.gt-suggestion {
  margin-top: 14px;
}

.gt-suggestion-toggle,
.gt-suggestion-submit,
.gt-suggestion-location {
  min-height: 42px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--jade);
  color: #fff;
  cursor: pointer;
  font: 600 14px 'Space Grotesk', sans-serif;
  transition: background 0.15s ease;
}

.gt-suggestion-toggle:hover,
.gt-suggestion-submit:hover:not(:disabled),
.gt-suggestion-location:hover {
  background: var(--jade-deep);
}

.gt-suggestion-panel {
  margin-top: 12px;
  padding: 20px;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

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

.gt-suggestion-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.gt-suggestion-heading h2 {
  margin: 0 0 4px;
  font: 600 24px 'Fraunces', serif;
}

.gt-suggestion-heading p {
  margin: 0;
  color: rgba(30, 26, 51, 0.66);
  font-size: 13px;
}

.gt-suggestion-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: var(--paper-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.gt-suggestion-close:hover { background: var(--bg-deep); }

#gt-suggestion-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gt-suggestion-field {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.gt-suggestion-field small {
  color: rgba(30, 26, 51, 0.56);
  font-size: 11px;
  font-weight: 400;
}

.gt-suggestion-field input,
.gt-suggestion-field select,
.gt-suggestion-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--panel-line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: 400 14px 'Space Grotesk', sans-serif;
}

.gt-suggestion-field textarea {
  min-height: 84px;
  resize: vertical;
}

.gt-suggestion-field input:focus,
.gt-suggestion-field select:focus,
.gt-suggestion-field textarea:focus {
  border-color: var(--jade);
  outline: 3px solid rgba(31, 157, 104, 0.14);
}

.gt-suggestion-coordinates {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--paper-strong);
}

.gt-suggestion-coordinates > div {
  display: grid;
  gap: 3px;
  color: rgba(30, 26, 51, 0.62);
  font-size: 11px;
}

.gt-suggestion-coordinates output {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.gt-suggestion-location {
  grid-column: 3;
  grid-row: 1;
  background: #55409a;
  font-size: 12px;
}

.gt-suggestion-location:hover { background: #3f2d7d; }

.gt-suggestion-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(30, 26, 51, 0.62);
  font-size: 11px;
}

.gt-suggestion-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.gt-suggestion-submit {
  justify-self: end;
  align-self: center;
}

.gt-suggestion-submit:disabled {
  cursor: wait;
  opacity: 0.6;
}

.gt-map-card {
  position: relative;
  padding: 10px;
  border: 1px solid var(--panel-line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-strong) 100%);
  box-shadow: var(--shadow);
}

#gt-leaflet-map {
  width: 100%;
  height: max(70vh, 520px);
  min-height: 70vh;
  border-radius: 12px;
  background: #e9e7ef;
}

.gt-map-legend {
  position: absolute;
  z-index: 500;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 9px 12px;
  border: 1px solid rgba(30, 26, 51, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 12px rgba(30, 26, 51, 0.12);
  color: var(--ink);
  font-size: 12px;
  pointer-events: none;
}

.gt-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gt-legend-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.gt-legend-pin.pending { background: #8b8795; }
.gt-legend-pin.visited { background: var(--jade); }

.gt-leaflet-pin-wrapper {
  border: 0;
  background: transparent;
}

.gt-leaflet-pin {
  display: block;
  width: 22px;
  height: 30px;
  transform: rotate(-45deg);
  border: 3px solid var(--paper);
  border-radius: 50% 50% 50% 0;
  background: #8b8795;
  box-shadow: 0 2px 7px rgba(30, 26, 51, 0.35);
}

.gt-leaflet-pin::after {
  display: block;
  width: 7px;
  height: 7px;
  margin: 4px auto;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.gt-leaflet-pin.visited { background: var(--jade); }

.gt-popup-btn {
  margin: 7px 0;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--jade);
  color: #fff;
  cursor: pointer;
  font: 500 13px 'Space Grotesk', sans-serif;
}

.gt-popup-btn:hover { background: var(--jade-deep); }

.gt-map-error {
  display: grid;
  min-height: 70vh;
  margin: 0;
  padding: 24px;
  place-items: center;
  color: #a33434;
  text-align: center;
}

.gt-nearby {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.gt-nearby-title {
  margin: 0 0 10px;
  font: 600 22px 'Fraunces', serif;
}

.gt-nearby-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 6px 10px;
  margin: 0;
  padding-left: 28px;
}

.gt-nearby-list li { padding-left: 4px; }

.gt-nearby-item {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: 500 14px 'Space Grotesk', sans-serif;
  text-align: left;
}

.gt-nearby-item:hover { background: rgba(31, 157, 104, 0.09); }

.gt-nearby-name { min-width: 0; }

.gt-nearby-distance {
  flex: 0 0 auto;
  color: var(--jade-deep);
  font-size: 12px;
  font-weight: 600;
}

.gt-nearby-empty {
  grid-column: 1 / -1;
  color: rgba(30, 26, 51, 0.65);
  font-size: 14px;
}

.gt-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.gt-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(30, 26, 51, 0.58);
  cursor: pointer;
  font: 500 13px 'Space Grotesk', sans-serif;
  transition: color 0.15s, background 0.15s;
}

.gt-reset-btn:hover {
  background: rgba(166, 58, 36, 0.06);
  color: #a63a24;
}

.gt-toast {
  position: fixed;
  z-index: 9999;
  bottom: 28px;
  left: 50%;
  padding: 10px 22px;
  transform: translate(-50%, 20px);
  border-radius: 12px;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(30, 26, 51, 0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}

.gt-toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 640px) {
  .gt-app {
    padding: 12px 12px calc(88px + env(safe-area-inset-bottom));
  }

  .gt-header {
    position: fixed;
    z-index: 1000;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    max-height: calc(100svh - 24px - env(safe-area-inset-bottom));
    margin: 0;
    padding: 17px 16px 22px;
    border-radius: 16px;
    overflow-y: auto;
    transition: padding 0.2s ease, border-radius 0.2s ease;
  }

  .gt-header.is-collapsed {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 9px 13px 15px;
    border-radius: 14px;
    box-shadow: 0 8px 26px rgba(30, 26, 51, 0.3);
  }

  .gt-header-toggle {
    display: inline-grid;
    width: 38px;
    height: 38px;
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    font: 700 21px 'Space Grotesk', sans-serif;
  }

  .gt-header-toggle:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
  }

  .gt-header-left {
    grid-column: 1 / -1;
  }

  .gt-title {
    font-size: clamp(34px, 9vw, 42px);
  }

  .gt-subtitle {
    max-width: 38ch;
    font-size: 13px;
  }

  .gt-stat {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 7px;
    width: auto;
    min-width: 0;
    text-align: left;
  }

  .gt-stat-main {
    justify-content: flex-start;
  }

  .gt-stat-num {
    font-size: 36px;
  }

  .gt-stat-label {
    font-size: 12px;
  }

  .gt-stat-sub {
    grid-column: 2;
    margin-top: 0;
    font-size: 11px;
    text-align: right;
  }

  .gt-bar-track {
    grid-column: 1 / -1;
    width: 100%;
    height: 5px;
    margin-top: 5px;
  }

  .gt-auth {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .gt-auth-user {
    width: 100%;
    gap: 6px;
    justify-content: flex-start;
  }

  .gt-auth-login,
  .gt-auth-logout {
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .gt-auth-email {
    max-width: calc(100vw - 140px);
    font-size: 11px;
  }

  .gt-filters {
    align-items: stretch;
    gap: 8px 10px;
    margin-bottom: 10px;
  }

  .gt-department-filter {
    flex: 1 1 100%;
    gap: 4px;
    font-size: 12px;
  }

  .gt-department-filter select {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .gt-pending-filter {
    flex: 0 1 auto;
    min-height: 44px;
    gap: 7px;
    font-size: 13px;
    white-space: nowrap;
  }

  .gt-pending-filter input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
  }

  .gt-nearby-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .gt-map-card {
    padding: 7px;
    border-radius: 14px;
  }

  #gt-leaflet-map {
    height: clamp(360px, 56svh, 480px);
    min-height: 360px;
    border-radius: 10px;
  }

  .gt-map-legend {
    right: 12px;
    bottom: 12px;
    gap: 6px 10px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .gt-suggestion {
    margin-top: 10px;
  }

  .gt-suggestion-toggle {
    width: 100%;
    min-height: 44px;
  }

  .gt-suggestion-panel {
    padding: 16px;
    border-radius: 14px;
  }

  .gt-suggestion-heading {
    gap: 10px;
  }

  .gt-suggestion-heading h2 {
    font-size: 21px;
  }

  .gt-suggestion-coordinates {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .gt-suggestion-location {
    grid-column: 1 / -1;
    grid-row: auto;
    width: 100%;
    min-height: 44px;
  }

  .gt-suggestion-submit {
    width: 100%;
    min-height: 44px;
  }

  .gt-nearby {
    margin-top: 12px;
    padding: 14px;
    border-radius: 14px;
  }

  .gt-nearby-title {
    font-size: 20px;
  }

  .gt-nearby-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    padding-left: 24px;
  }

  .gt-nearby-item {
    min-height: 44px;
    padding: 8px;
    font-size: 13px;
  }

  .gt-footer {
    justify-content: center;
  }

  .gt-reset-btn {
    min-height: 44px;
    padding: 8px 12px;
  }

  .gt-toast {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 10px 14px;
    text-align: center;
    white-space: normal;
  }

  #gt-suggestion-form { grid-template-columns: 1fr; }

  .gt-header.is-collapsed {
    align-items: center;
  }

  .gt-header.is-collapsed .gt-header-left {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .gt-header.is-collapsed .gt-title {
    margin: 0;
    overflow: hidden;
    font-size: 20px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .gt-header.is-collapsed .gt-subtitle,
  .gt-header.is-collapsed .gt-stat-label,
  .gt-header.is-collapsed .gt-stat-sub,
  .gt-header.is-collapsed .gt-bar-track,
  .gt-header.is-collapsed .gt-auth {
    display: none;
  }

  .gt-header.is-collapsed .gt-stat {
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: auto;
    text-align: right;
  }

  .gt-header.is-collapsed .gt-stat-main {
    justify-content: flex-end;
  }

  .gt-header.is-collapsed .gt-stat-num {
    font-size: 19px;
  }

  .gt-header.is-collapsed .gt-header-toggle {
    grid-column: 3;
    grid-row: 1;
    width: 34px;
    height: 34px;
  }
}
