:root {
  --ink: #16211f;
  --muted: #697774;
  --paper: #f7f6ef;
  --surface: #ffffff;
  --line: #d9ded6;
  --green: #1f7a5c;
  --green-deep: #14523e;
  --amber: #d9952f;
  --red: #cc4b37;
  --blue: #3178c6;
  --shadow: 0 18px 50px rgba(22, 33, 31, 0.18);
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 18px;
  gap: 14px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand h1,
.drawer-header h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.panel,
.filters {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.field-label,
label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.16);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
  margin-top: 12px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.action-btn,
.filter-chip,
.secondary,
.primary,
.icon-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.action-btn:hover,
.filter-chip:hover,
.secondary:hover,
.icon-btn:hover {
  border-color: var(--green);
}

.danger {
  color: var(--red);
}

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

.star-toggle {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--red);
  background: #fff;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.star-toggle[aria-pressed="true"] {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

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

.voice-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--green);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.voice-btn.recording {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.voice-btn.disabled {
  color: var(--muted);
  background: #f2f3ef;
}

.media-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.media-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--green);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}

.media-item {
  position: relative;
  overflow: hidden;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.media-item img,
.media-item video {
  display: block;
  width: 100%;
  height: 86px;
  object-fit: cover;
  background: #eef0ec;
}

.media-remove {
  position: absolute;
  right: 5px;
  top: 5px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  color: #fff;
  background: rgba(22, 33, 31, 0.72);
  font-size: 16px;
  font-weight: 800;
}

.media-name {
  padding: 6px 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.upload-status {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: #e7ebe5;
}

.upload-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.18s ease;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 0 12px;
}

.filter-chip.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(22, 33, 31, 0.06);
}

.record-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.16);
}

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.record-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.record-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.star-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 800;
}

.status-todo {
  background: var(--amber);
}

.status-done {
  background: var(--green);
}

.record-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.record-note {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

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

.map-shell {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.map {
  width: 100%;
  height: 100%;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--muted);
  z-index: 2;
}

.mobile-topbar {
  display: none;
}

.floating-tools {
  position: absolute;
  right: 18px;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 4;
}

.round-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 700;
}

.round-btn.active,
.action-btn.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(22, 33, 31, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 12;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(22, 33, 31, 0.24);
  z-index: 20;
}

.editor-drawer {
  position: fixed;
  right: 22px;
  top: 22px;
  width: min(440px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 34px));
  transition: transform 0.24s ease;
  z-index: 1000;
}

.editor-drawer.open {
  transform: translateX(0);
}

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

.icon-btn {
  min-width: 38px;
  padding: 0 10px;
  font-size: 18px;
}

.text-btn {
  font-size: 14px;
}

.record-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

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

.coord-row {
  grid-template-columns: 1fr 1fr;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.secondary,
.primary {
  min-width: 92px;
  padding: 0 14px;
}

.primary {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.primary:hover {
  background: var(--green-deep);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: min(58vh, 520px);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform: translateY(calc(100% + 18px));
    transition: transform 0.24s ease;
    z-index: 900;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .brand h1 {
    font-size: 20px;
  }

  .panel {
    padding: 10px;
  }

  .actions-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .action-btn {
    padding: 0 6px;
    font-size: 13px;
  }

  .map-shell {
    height: 100%;
  }

  .mobile-topbar {
    position: absolute;
    left: 12px;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    z-index: 800;
  }

  .floating-tools {
    top: calc(88px + env(safe-area-inset-top));
    right: 12px;
    z-index: 850;
  }

  .drawer-backdrop.show {
    display: none;
  }

  .editor-drawer {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 54dvh;
    max-height: 54vh;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
    transform: translateY(105%);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 1200;
  }

  .editor-drawer::before {
    content: "";
    position: sticky;
    top: 0;
    display: block;
    height: 1px;
    margin-top: -1px;
    background: var(--surface);
    z-index: 2;
  }

  .editor-drawer .drawer-header {
    position: sticky;
    top: 0;
    padding-bottom: 10px;
    background: var(--surface);
    z-index: 3;
  }

  .editor-drawer .drawer-header h2 {
    font-size: 22px;
    line-height: 1.12;
  }

  .editor-drawer .drawer-tools {
    gap: 8px;
  }

  .editor-drawer .star-toggle {
    width: 46px;
    height: 46px;
    font-size: 29px;
  }

  .editor-drawer .icon-btn {
    min-width: 46px;
    height: 46px;
  }

  .editor-drawer input,
  .editor-drawer select,
  .editor-drawer textarea {
    font-size: 16px;
  }

  .keyboard-open .editor-drawer {
    max-height: 42dvh;
    max-height: 42vh;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    padding: 10px 0 0;
    background: var(--surface);
  }

  .editor-drawer.open {
    transform: translateY(0);
  }

  .drawer-handle {
    width: 46px;
    height: 4px;
    margin: 0 auto 12px;
    border-radius: 99px;
    background: var(--line);
  }

  .form-grid,
  .coord-row {
    grid-template-columns: 1fr;
  }
}
