* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --accent: #6366f1;
  --accent-light: #eef2ff;
  --success: #16a34a;
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, .08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .16);
}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(99, 102, 241, .10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* 登录 */
.view { min-height: 100vh; }
#login-view {
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(900px 500px at 20% 20%, rgba(255, 255, 255, .10), transparent 60%),
    linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #0f172a 100%);
}
.login-card {
  background: rgba(255, 255, 255, .96); padding: 44px 40px; border-radius: 20px;
  width: 360px; max-width: 100%;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
  animation: fade-up .4s ease;
}
.login-card h1 { text-align: center; font-size: 28px; color: var(--primary); letter-spacing: 1px; }
.login-card .subtitle { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 26px; }
.login-card .form-item input { border-radius: 10px; padding: 12px 14px; }
.login-card .btn { width: 100%; padding: 12px; border-radius: 10px; font-size: 15px; margin-top: 6px; }

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff; padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 4px 16px rgba(15, 23, 42, .18);
}
.topbar .logo { font-size: 19px; font-weight: 800; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.topbar .logo .ver {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.75);
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px; padding: 1px 8px; letter-spacing: 0;
}
.topbar .logo::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #818cf8);
  box-shadow: 0 0 12px rgba(96, 165, 250, .8);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.user-menu-wrap { position: relative; }
.user-name { color: #ffffff; font-size: 14px; background: rgba(255,255,255,.12); border: none; border-radius: 8px; padding: 6px 14px; cursor: pointer; transition: background .15s; display: flex; align-items: center; gap: 6px; }
.user-name:hover { background: rgba(255,255,255,.22); }
.user-role-icon { font-size: 14px; line-height: 1; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 140px; background: #ffffff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 100; }
.menu-item { display: block; padding: 9px 14px; color: var(--text); text-decoration: none; font-size: 14px; border-radius: 6px; cursor: pointer; transition: background .15s; white-space: nowrap; }
.menu-item:hover { background: var(--primary-light); color: var(--primary); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(220, 38, 38, .08); color: var(--danger); }
.nav-link { color: #94a3b8; text-decoration: none; font-size: 14px; cursor: pointer; transition: color .15s; }
.nav-link:hover { color: #fff; }
.nav-link.danger { color: #fca5a5; }
.nav-link.danger:hover { color: #f87171; }

/* 容器 */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 16px 48px; }

/* 工具栏 */
.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.toolbar-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 8px; background: rgba(255, 255, 255, .7); padding: 4px; border-radius: 12px; border: 1px solid var(--border); flex-wrap: nowrap; }
.tab {
  padding: 8px 18px; border: none; background: transparent;
  border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--muted);
  white-space: nowrap; transition: all .18s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37, 99, 235, .35); }
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.toolbar-right input {
  padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; width: 220px;
  background: #fff; transition: all .15s;
}
.toolbar-right input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* 按钮 */
.btn {
  padding: 9px 18px; border: 1px solid var(--border); background: #fff;
  border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--text);
  transition: all .18s; box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .30);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--primary-dark), #4338ca); box-shadow: 0 6px 16px rgba(37, 99, 235, .4); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; border-color: var(--danger); }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }

/* 表单 */
.form-item { margin-bottom: 16px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff;
  transition: all .15s;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row input, .form-row select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: #fff; }
.loc-row { flex-wrap: nowrap; }
.loc-row input { min-width: 0; }
.loc-btn { flex: 0 0 auto; padding: 8px 12px; font-size: 16px; line-height: 1; }

.msg { margin-top: 12px; font-size: 14px; color: var(--danger); min-height: 20px; }

/* 标签徽章 */
.tag-badge {
  display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5; vertical-align: 2px;
  background: color-mix(in srgb, var(--tagc) 15%, transparent);
  color: var(--tagc); border: 1px solid color-mix(in srgb, var(--tagc) 35%, transparent);
}
.tag-click { cursor: pointer; display: inline-block; }
.tag-click:hover .tag-badge, .tag-click:hover .tag-empty { filter: brightness(1.15); }
.tag-empty {
  display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--muted, #888);
  border: 1px dashed var(--border, #ccc); cursor: pointer; vertical-align: 2px;
}

/* 标签弹窗 */
.tag-modal-card { width: 420px; max-width: 92vw; }
.tag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tag-opt {
  background: var(--card, #fff); border: 1px solid var(--border, #ddd); border-radius: 12px;
  padding: 8px 4px; cursor: pointer; transition: all .15s; text-align: center;
}
.tag-opt:hover { border-color: var(--primary, #3b82f6); transform: translateY(-1px); }
.tag-opt.active { border-color: var(--primary, #3b82f6); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #3b82f6) 25%, transparent); }
.tag-opt .tag-badge { margin-left: 0; }
.tag-chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  color: var(--muted, #888); border: 1px dashed var(--border, #ccc);
}
@media (max-width: 480px) { .tag-grid { grid-template-columns: repeat(3, 1fr); } }

/* 笔记列表 */
.note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.note-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer; transition: all .2s; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.note-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0; transition: opacity .2s;
}
.note-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: #c7d2fe; }
.note-card:hover::before { opacity: 1; }
.note-card .note-type {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  margin-bottom: 4px; font-weight: 600; letter-spacing: .3px; line-height: 1.4;
}
.note-type.text { background: var(--primary-light); color: var(--primary-dark); }
.note-type.voice { background: #dcfce7; color: var(--success); }
.note-type.video { background: #fef9c3; color: #a16207; }
.note-card h3 { font-size: 14px; line-height: 1.3; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card .note-preview { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; min-height: 20px; }
.note-card .note-meta { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.note-card .owner-badge { color: var(--primary); font-weight: 600; }

.pagination { margin-top: 24px; display: flex; justify-content: center; gap: 8px; }
.pagination button {
  padding: 7px 14px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* 详情 */
.detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-title { font-size: 22px; font-weight: 800; flex: 1; line-height: 1.4; }
.detail-actions { display: flex; gap: 8px; }
.detail-content {
  background: var(--card); border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  animation: fade-up .3s ease;
}
.transcript-box {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}
.transcript-box h3 { margin: 0 0 8px; font-size: 14px; color: var(--accent); font-weight: 700; }
.transcript-text {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 14px;
  max-height: 320px;
  overflow-y: auto;
}
.transcript-status { margin: 0; color: var(--muted); font-size: 13px; }
.transcript-status.failed { color: #e57373; }
.transcript-status.processing { color: var(--accent); }

.note-body { line-height: 1.85; white-space: pre-wrap; word-break: break-word; margin-bottom: 18px; font-size: 15px; }
.media-box { margin-bottom: 18px; }
.media-box audio, .media-box video { width: 100%; border-radius: 12px; background: #000; box-shadow: var(--shadow-sm); }

.map-box { width: 100%; height: 320px; border-radius: 14px; margin: 12px 0; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }

/* 位置信息卡片 */
.location-info {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #f0f7ff 0%, #f6f5ff 100%);
  border: 1px solid #dbeafe; border-radius: 12px;
  padding: 14px 16px; font-size: 14px; margin: 14px 0;
}
.location-info.clickable { cursor: pointer; transition: all .15s; }
.location-info.clickable:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.location-info.clickable:active { transform: none; }
.loc-icon { font-size: 22px; line-height: 1.3; filter: drop-shadow(0 2px 3px rgba(37, 99, 235, .25)); }
.loc-body { flex: 1; min-width: 0; }
.loc-coord {
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 13px; font-weight: 600; color: var(--primary-dark);
  word-break: break-all;
}
.loc-addr { font-size: 14px; color: var(--text); margin-top: 4px; line-height: 1.5; word-break: break-all; }
.loc-hint { align-self: center; font-size: 13px; color: var(--primary); white-space: nowrap; font-weight: 600; }

/* 编辑表单 */
.edit-form .form-item label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--muted); font-weight: 600; }
.edit-form textarea { width: 100%; min-height: 160px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical; }
.edit-form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.edit-form .type-select { display: flex; gap: 8px; margin-bottom: 16px; background: rgba(255,255,255,.7); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }

/* 分享区 */
.share-section { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 18px; }
.share-section h3 { margin-bottom: 12px; }
.share-user-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.share-user-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary-dark);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
}
.share-user-chip button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 15px; line-height: 1; margin-left: 2px; }
.public-link { background: #f8fafc; padding: 12px; border-radius: 10px; font-size: 13px; word-break: break-all; margin: 8px 0; border: 1px dashed var(--border); }

/* 用户管理 */
.user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.user-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  box-shadow: var(--shadow-sm); transition: all .15s;
}
.user-card:hover { box-shadow: var(--shadow-md); }
.user-card .user-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.user-card .user-role { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.user-card .user-role.admin { background: #fee2e2; color: #b91c1c; }
.user-card .user-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* 模态 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(3px); animation: fade-in .18s ease; }
.modal-card { background: var(--card); border-radius: 16px; padding: 26px; width: 380px; max-width: 92vw; box-shadow: var(--shadow-lg); animation: pop-in .2s ease; }
.map-modal-card { width: 640px; max-width: 94vw; padding: 20px; }
.map-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.map-modal-title { font-size: 16px; font-weight: 700; }
.map-modal-body .map-box { margin: 0; }

/* 分享页 */
.share-body {
  background:
    radial-gradient(900px 450px at 15% -5%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(99, 102, 241, .10), transparent 55%),
    #eef2f7;
  min-height: 100vh;
}
.share-container { max-width: 720px; margin: 0 auto; padding: 32px 16px 48px; }
#share-content {
  background: var(--card); border-radius: 18px; padding: 28px;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  animation: fade-up .35s ease;
}
.share-container h1 { font-size: 24px; margin-bottom: 10px; line-height: 1.4; }
.share-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px; display: flex; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.share-body-text { line-height: 1.85; white-space: pre-wrap; margin-bottom: 18px; font-size: 15px; }
.share-location {
  border-top: 1px solid var(--border); padding-top: 18px; margin-top: 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f6f5ff 100%);
  border-radius: 12px; padding: 18px;
}
.share-location h3 { margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.share-location p { color: var(--muted); font-size: 14px; margin: 5px 0; }
.share-location p.clickable { cursor: pointer; transition: color .15s; }
.share-location p.clickable:hover { color: var(--primary); text-decoration: underline; }
#share-coord { font-family: "SF Mono", Consolas, Menlo, monospace; font-weight: 600; color: var(--primary-dark); }
#share-address { color: var(--text); font-size: 15px; font-weight: 500; }
.share-actions { display: flex; gap: 10px; margin: 16px 0 4px; }
.qr-box { text-align: center; margin-top: 14px; }
.qr-box canvas { border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: #fff; box-shadow: var(--shadow-sm); }
#share-error { background: #fef2f2; color: var(--danger); padding: 18px; border-radius: 12px; text-align: center; box-shadow: var(--shadow-sm); }

/* 实时录音 */
.rec-time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); align-self: center; }
.rec-time.recording { color: var(--danger); font-weight: 600; animation: rec-blink 1s steps(2) infinite; }
@keyframes rec-blink { 50% { opacity: 0.35; } }
.rec-tip { font-size: 12px; color: var(--muted); }
#rec-preview audio { width: 100%; max-width: 360px; }
#vid-preview video, #vid-preview img { width: 100%; max-width: 360px; border-radius: 10px; }
.media-img { display: block; }

/* 地图地址弹窗 */
.map-pop { padding: 6px 4px; max-width: 240px; }
.map-pop-addr { font-size: 13px; font-weight: 600; color: #334155; line-height: 1.5; margin-bottom: 4px; }
.map-pop-coord { font-size: 11px; color: #94a3b8; font-family: "SF Mono", Consolas, Menlo, monospace; }

/* 二维码弹窗 */
.qr-modal-card { max-width: 320px; }
.qr-modal-body { text-align: center; padding: 8px 4px 4px; }
.qr-link-input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--muted); background: var(--bg-soft, #f8fafc); }

/* 动画 */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-main { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: center; flex-wrap: nowrap; overflow-x: auto; }
  .tab { flex: 0 0 auto; }
  .toolbar-right { flex-direction: column; }
  .toolbar-right input { width: 100%; }
  .note-list { grid-template-columns: 1fr; }
  .detail-content { padding: 20px; }
  .topbar { padding: 0 16px; }
  .map-modal-card { padding: 14px; }
  .map-modal-body .map-box { height: 55vh; min-height: 280px; }
}
