:root {
  --bg: #FDF7EF;
  --bg-soft: #FBF3E7;
  --card: #FFFFFF;
  --ink: #2E3138;
  --ink-soft: #5B6068;
  --muted: #8C929C;
  --line: #EFE7DA;
  --blue: #6C8FF0;
  --blue-deep: #4E72D8;
  --blue-soft: #E9F0FF;
  --orange: #FFB54D;
  --orange-soft: #FFF1DE;
  --pink: #FFE7EA;
  --red: #F1686B;
  --green: #58BE6A;
  --green-soft: #E7F6EA;
  --violet-soft: #F1EBFF;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 28px rgba(147, 124, 92, .10);
  --shadow-soft: 0 4px 14px rgba(147, 124, 92, .07);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); font-size: 15px; }

/* ---------- shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 28px;
  background: linear-gradient(180deg, #EAF2FF 0%, rgba(253, 247, 239, 0) 100%);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 16px;
  background: linear-gradient(160deg, #8FB0FF, #6C8FF0);
  display: grid; place-items: center; color: #fff; font-size: 22px;
  box-shadow: var(--shadow-soft);
}
.brand-text h1 { margin: 0; font-size: 24px; letter-spacing: 1px; }
.brand-text p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: #fff; padding: 6px 14px 6px 6px; border-radius: 999px;
  box-shadow: var(--shadow-soft); font-size: 14px; color: var(--ink-soft);
}
.user-chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--blue-soft); }
.icon-btn {
  position: relative; border: 0; background: #fff; width: 42px; height: 42px;
  border-radius: 14px; box-shadow: var(--shadow-soft); font-size: 18px; color: var(--ink-soft);
  display: grid; place-items: center;
}
.badge-dot {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 11px;
  display: grid; place-items: center; font-weight: 600;
}
.ghost-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 9px 14px; font-size: 14px; color: var(--ink-soft);
}
.ghost-btn:hover { background: var(--blue-soft); border-color: #DCE6FF; }

.shell { max-width: 1320px; margin: 0 auto; padding: 8px 28px 60px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; border: 1px solid #F7EEE1;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h2 { margin: 0; font-size: 17px; letter-spacing: .5px; }
.card-head .act { margin-left: auto; }
.card-ico {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  background: var(--blue-soft); font-size: 15px;
}

/* ---------- stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  border-radius: 18px; padding: 16px 16px 14px; text-align: center;
  background: var(--blue-soft);
}
.stat.orange { background: var(--orange-soft); }
.stat.green { background: var(--green-soft); }
.stat.pink { background: var(--pink); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: 1px; }
.stat .k { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-left: 2px; }

/* ---------- lists ---------- */
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.row:last-child { border-bottom: 0; }
.row img.thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; background: var(--bg-soft); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-size: 15px; }
.row .t2 { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.avatar-s { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--blue-soft); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--blue-soft); color: var(--blue-deep);
}
.pill.green { background: var(--green-soft); color: #2E8C42; }
.pill.red { background: var(--pink); color: #C6464A; }
.pill.grey { background: #F2F3F6; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.off { background: #C9CDD4; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 13px 20px; font-size: 15px;
  background: var(--blue); color: #fff; font-weight: 600;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.lg { padding: 17px 24px; font-size: 17px; border-radius: 18px; }
.btn.soft { background: var(--blue-soft); color: var(--blue-deep); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.line { background: #fff; color: var(--ink-soft); border: 1px solid var(--line); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 11px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #FFFDFA; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: #BFD0FF; background: #fff; }
.field textarea { min-height: 76px; resize: vertical; }

/* ---------- photo grid ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.photo-card { border-radius: 16px; overflow: hidden; background: var(--bg-soft); position: relative; }
.photo-card img { width: 100%; height: 118px; object-fit: cover; display: block; background: #F3EADF; }
.photo-card .meta { padding: 10px 12px 12px; background: #fff; }
.photo-card .meta .d { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card .meta .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.photo-card .corner {
  position: absolute; top: 8px; right: 8px; display: flex; gap: 5px;
}
.photo-card .corner span {
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 3px 8px; font-size: 11.5px;
}
.photo-card .acts { position: absolute; inset: auto 0 0; display: flex; gap: 6px; justify-content: flex-end; padding: 6px; opacity: 0; transition: opacity .15s; }
.photo-card:hover .acts { opacity: 1; }
.photo-card .acts button { border: 0; background: rgba(255,255,255,.94); border-radius: 9px; padding: 4px 8px; font-size: 11.5px; color: var(--ink-soft); }

/* ---------- upload ---------- */
.drop-zone {
  border: 2px dashed #CFE0FF; border-radius: 18px; background: #F7FAFF;
  padding: 26px 18px; text-align: center; color: var(--ink-soft); cursor: pointer;
}
.drop-zone .big { font-size: 30px; }
.drop-zone p { margin: 8px 0 4px; font-size: 15px; }
.drop-zone small { color: var(--muted); font-size: 12.5px; }
.upload-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.upload-item { display: flex; gap: 12px; align-items: center; background: var(--bg-soft); border-radius: 14px; padding: 10px; }
.upload-item img { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; }
.upload-item .grow { flex: 1; min-width: 0; }
.upload-item input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; background: #fff; }
.mini-audio { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- audio ---------- */
.audio-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--bg-soft); border-radius: 14px; margin-bottom: 8px;
}
.audio-row .play {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blue);
  color: #fff; font-size: 14px; display: grid; place-items: center; flex: none;
}
.audio-row .play.playing { background: var(--blue-deep); }
.audio-row .who { font-size: 14px; }
.audio-row .time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.audio-row .dur { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.audio-row .new { background: var(--red); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 999px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid var(--line); }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(46, 49, 56, .45);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 40;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 22px; padding: 24px; width: min(560px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.modal h3 { margin: 0 0 16px; font-size: 18px; }
.modal-close { float: right; border: 0; background: transparent; font-size: 20px; color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: rgba(46,49,56,.92); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  border: 0; border-radius: 999px; padding: 9px 16px; font-size: 13.5px;
  background: #F4F1EC; color: var(--ink-soft);
}
.tab.active { background: var(--blue); color: #fff; }

.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 26px 10px; }
.hidden { display: none !important; }

/* ---------- admin layout ---------- */
.admin-wrap { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 22px; max-width: 1360px; margin: 0 auto; padding: 10px 26px 60px; }
.side-nav {
  background: #fff; border-radius: var(--radius); padding: 16px 12px; box-shadow: var(--shadow);
  height: fit-content; position: sticky; top: 18px;
}
.side-nav .nav-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 14px;
  font-size: 14.5px; color: var(--ink-soft); cursor: pointer;
}
.side-nav .nav-item.active { background: var(--blue); color: #fff; }
.side-nav .nav-item:hover:not(.active) { background: var(--blue-soft); }
.side-nav .ico { width: 22px; text-align: center; }
.side-foot { margin-top: 18px; padding: 14px; border-radius: 16px; background: #FFF7EA; font-size: 12px; color: #A8825A; line-height: 1.7; }

/* ---------- grandma mobile ---------- */
.gm-body { background: #FDF8F1; max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 84px; }
.gm-header {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px;
}
.gm-header h1 { font-size: 19px; margin: 0; letter-spacing: 1px; }
.gm-header .back { border: 0; background: transparent; font-size: 22px; color: var(--ink); padding: 0 4px; }
.gm-card { background: #fff; border-radius: 22px; margin: 12px 16px; padding: 16px; box-shadow: var(--shadow); }
.gm-photo { border-radius: 18px; overflow: hidden; background: #F3EADF; }
.gm-photo img { width: 100%; display: block; }
.gm-who { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.gm-who img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.gm-who .n { font-size: 17px; font-weight: 600; }
.gm-who .t { font-size: 12.5px; color: var(--muted); }
.gm-desc { font-size: 16px; line-height: 1.6; margin-top: 12px; color: var(--ink); }
.gm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.gm-btn { border: 0; border-radius: 18px; padding: 18px 10px; font-size: 18px; font-weight: 600; color: #fff; }
.gm-btn.like { background: var(--green); }
.gm-btn.dislike { background: var(--red); }
.gm-btn.secondary { background: var(--blue-soft); color: var(--blue-deep); font-size: 15px; padding: 14px 10px; }
.gm-btn.chosen { outline: 3px solid #FFD466; }
.gm-tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 0 10px; z-index: 20;
}
.gm-tabbar button { border: 0; background: transparent; font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; justify-items: center; }
.gm-tabbar button span { font-size: 20px; }
.gm-tabbar button.active { color: var(--blue-deep); }
.gm-section { display: none; }
.gm-section.active { display: block; }
.recorder { text-align: center; padding: 8px 0 4px; }
.rec-icon {
  width: 108px; height: 108px; border-radius: 50%; margin: 14px auto 10px; border: 0;
  background: linear-gradient(160deg, #8FB0FF, #6C8FF0); color: #fff; font-size: 40px;
  display: grid; place-items: center; box-shadow: 0 14px 30px rgba(108,143,240,.35);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.rec-icon.recording { background: linear-gradient(160deg, #FF8A8A, #F1686B); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(241,104,107,.4); } 70% { box-shadow: 0 0 0 22px rgba(241,104,107,0); } 100% { box-shadow: 0 0 0 0 rgba(241,104,107,0); } }
.rec-time { font-size: 24px; font-variant-numeric: tabular-nums; color: var(--ink); }
.rec-hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.badge-bubble {
  display: flex; align-items: center; gap: 12px; background: #FFF7E6; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px;
}
.badge-bubble img { width: 44px; height: 44px; border-radius: 50%; }
.badge-bubble .cnt { background: var(--red); color: #fff; border-radius: 999px; padding: 3px 9px; font-size: 13px; }

@media (max-width: 900px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .admin-wrap { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; overflow-x: auto; gap: 6px; padding: 10px; }
  .side-nav .nav-item { white-space: nowrap; }
  .side-foot { display: none; }
  .shell { padding: 8px 14px 40px; }
  .topbar { padding: 12px 14px; }
}
