:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #d5dce3;
  --text: #1f2a37;
  --muted: #516273;
  --primary: #0c66e4;
  --primary-dark: #0847a6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.ocean-graph {
  background: linear-gradient(135deg, #e0f2fe 0%, #f0fdfa 45%, #f8fafc 100%);
}

body.ocean-graph .topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #cfe6f4;
  backdrop-filter: blur(8px);
}

body.ocean-graph .left-panel {
  background: linear-gradient(180deg, rgba(224, 242, 254, 0.55), rgba(240, 253, 250, 0.35));
}

body.ocean-graph .card {
  position: relative;
  overflow: hidden;
  border: 1px solid #cfe6f4;
  box-shadow: 0 12px 28px rgba(11, 79, 108, 0.08);
}

body.ocean-graph .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5a4, #38bdf8, #0ea5a4);
}

body.ocean-graph #search-title,
body.ocean-graph #search-keyword {
  color: #0b4f6c;
}

body.ocean-graph .kv-list div {
  border-bottom: 1px dashed #b6d8ea;
}

body.ocean-graph .score-pill {
  margin: 0;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

body.ocean-graph .score-pill.metric {
  background: #e0f2fe;
  color: #0b4f6c;
}

body.ocean-graph .score-pill.best {
  background: #7FBF3F;
  color: #000000;
}

body.ocean-graph .score-pill.good {
  background: #FBBC05;
  color: #000000;
}

body.ocean-graph .score-pill.fair {
  background: #4285F4;
  color: #FFFFFF;
}

body.ocean-graph .score-pill.poor {
  background: #EA4335;
  color: #FFFFFF;
}

body.ocean-graph .score-pill.worst {
  background: #4F4F4F;
  color: #FFFFFF;
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.auth-card {
  width: min(420px, 92vw);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(30, 41, 59, 0.08);
}

.error {
  color: #b42318;
}

.topbar {
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome {
  font-size: 1.1rem;
  font-weight: 600;
}

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

.page {
  padding: 18px;
}

.layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: calc(100vh - 64px);
}

.left-panel {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-panel {
  min-height: 500px;
}

#map {
  width: 100%;
  height: calc(100vh - 64px);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

.card.narrow {
  max-width: 720px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.action-row {
  display: flex;
  gap: 8px;
}

form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--muted);
}

input {
  width: 100%;
  margin-top: 4px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}

input[readonly] {
  background: #f8fafc;
  color: #475467;
}

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

.field-hint {
  margin-top: -2px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.btn {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

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

.btn.secondary {
  background: #344054;
}

.btn.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #dbeafe;
  color: #0b4bb2;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #f8fafc;
  color: var(--muted);
}

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

.table-wrap {
  overflow-x: auto;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.kv-list {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.kv-list div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 5px;
}

.kv-list dt {
  color: var(--muted);
}

.kv-list dd {
  margin: 0;
  font-weight: 600;
}

.detail-box p {
  margin: 6px 0;
}

.place-item {
  border-bottom: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 8px;
}

.place-summary {
  cursor: pointer;
  list-style: none;
}

.place-summary::-webkit-details-marker {
  display: none;
}

.place-body {
  margin-top: 8px;
}

.place-body p {
  margin: 4px 0;
}

.subtle-line {
  margin: 4px 0 8px;
  color: var(--muted);
}

.dashed-line {
  margin: 8px 0 12px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 1020px) {
  .page {
    padding: 12px;
  }

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

  .left-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  #map {
    height: 55vh;
  }
}
