:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d9e2f2;
  --primary: #0f766e;
  --primary-strong: #0d9488;
  --danger: #dc2626;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft Yahei", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #e0f2fe 0%, #f8fbff 32%, #f1f5f9 100%);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  min-height: 100%;
  background: transparent;
  position: relative;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
  background: rgba(248, 250, 252, 0.86);
  border-bottom: 1px solid var(--line);
}

.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 4px;
}

.page-container {
  min-height: calc(100vh - 132px);
}

.page {
  display: none;
  padding: 10px 12px 0;
}

.page.is-active {
  display: block;
}

#page-map {
  padding: 0;
  position: relative;
}

#map-view {
  width: 100%;
  height: calc(100vh - 132px);
  min-height: 460px;
}

.fab {
  position: absolute;
  right: 16px;
  bottom: 92px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(130deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.35);
}

.map-sheet {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 84px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 650;
}

.sheet-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

#sheet-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

#sheet-desc {
  font-size: 14px;
  margin-top: 8px;
}

.sheet-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 6px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.input:focus {
  outline: 2px solid #5eead4;
  border-color: transparent;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.item h4 {
  font-size: 15px;
}

.item p {
  margin-top: 6px;
  font-size: 13px;
  color: #334155;
}

.tag {
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid #bcd5ff;
  color: #1d4ed8;
  background: #eff6ff;
}

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

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

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

.row-actions.split > div {
  flex: 1;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(130deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.btn.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.full {
  width: 100%;
  margin-top: 10px;
}

.icon-btn {
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  line-height: 1;
  font-size: 20px;
  color: #334155;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}

.tab {
  border: 0;
  background: transparent;
  padding: 12px 6px;
  font-weight: 600;
  color: #475569;
}

.tab.is-active {
  color: var(--primary);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.45);
  z-index: 40;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 20px 40px rgba(2, 6, 23, 0.28);
  z-index: 50;
  padding: 12px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-card {
  background: linear-gradient(145deg, #fefce8 0%, #ecfeff 100%);
}

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

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0ea5e9;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-lg {
  width: 64px;
  height: 64px;
}

.profile-upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.upload-controls {
  flex: 1;
  min-width: 0;
}

.row-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.compact {
  gap: 6px;
}

.chat-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  background: #f8fafc;
  padding: 10px;
}

.chat-item {
  margin-bottom: 8px;
  display: flex;
}

.chat-item.mine {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 10px;
  border-radius: 10px;
  background: #e2e8f0;
  font-size: 13px;
}

.chat-item.mine .chat-bubble {
  background: #ccfbf1;
}

.chat-meta {
  margin-top: 3px;
  font-size: 11px;
  color: #64748b;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.status-pill {
  font-size: 12px;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid #bfdbfe;
}

.status-pill.offline {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.status-pill.active {
  border-color: #bbf7d0;
  color: #065f46;
  background: #ecfdf5;
}

.is-hidden {
  display: none !important;
}

.empty {
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

@media (min-width: 900px) {
  .tabbar {
    left: 50%;
    width: 860px;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
  }

  .topbar {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
  }
}
