:root {
  color-scheme: light;
  --ink: #161a1d;
  --muted: #66716d;
  --line: #dde3df;
  --paper: #f5f3ec;
  --panel: #ffffff;
  --green: #0f6b49;
  --green-dark: #0a4a35;
  --gold: #b98522;
  --rose: #b84545;
  --shadow: 0 22px 70px rgba(22, 26, 29, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(185, 133, 34, .2), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(15, 107, 73, .18), transparent 30%),
    linear-gradient(180deg, #fffdf7 0%, #f5f3ec 52%, #eef2ec 100%),
    var(--paper);
}

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

button {
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--green);
  min-height: 44px;
  padding: 0 18px;
  cursor: pointer;
}

button:hover { background: var(--green-dark); }

button.secondary {
  color: var(--ink);
  background: #eef3ed;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: rgba(22, 115, 75, .58);
  box-shadow: 0 0 0 3px rgba(22, 115, 75, .12);
}

.app-shell, .admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero, .admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 56px;
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.subline {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.8;
}

.grand-hero {
  min-height: 26vh;
  align-items: center;
  padding: 24px 0 18px;
}

.grand-hero h1 {
  max-width: 900px;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  text-decoration: none;
  white-space: nowrap;
}

.search-panel, .answer-card, .admin-card {
  border: 1px solid rgba(223, 230, 221, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 22px;
}

.grand-search {
  width: min(920px, 100%);
  margin: 0 auto;
  border-color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
}

.search-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 148px;
  gap: 12px;
}

#queryInput {
  min-height: 64px;
  font-size: 18px;
  border-radius: 8px;
}

.voice-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 18px;
  background: var(--rose);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.voice-btn.listening {
  background: #c22f2f;
  box-shadow: 0 0 0 6px rgba(184, 69, 69, .18);
}

.mic-dot {
  display: inline-block;
  width: 18px;
  height: 24px;
  border: 3px solid white;
  border-radius: 14px;
  position: relative;
}

.mic-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 16px;
  height: 8px;
  border-bottom: 3px solid white;
  border-left: 3px solid white;
  border-right: 3px solid white;
  border-radius: 0 0 10px 10px;
  transform: translateX(-50%);
}

.voice-label {
  font-weight: 800;
  white-space: nowrap;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

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

.answer-card {
  width: min(920px, 100%);
  margin: 18px auto 0;
  padding: 16px 18px;
}

.answer-card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
}

.merchant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(1080px, 100%);
  margin: 18px auto 0;
}

.merchant-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(23, 42, 31, .08);
}

.storefront-frame {
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: #edf2ef;
}

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

.detail-storefront {
  aspect-ratio: 16 / 8;
}

.merchant-cover {
  display: grid;
  place-items: center;
  min-height: 118px;
  color: white;
  background: linear-gradient(135deg, #16734b, #b7791f);
  font-size: 24px;
  font-weight: 800;
}

.location-line {
  margin: 5px 0 0;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.floor-map {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid #d8e3db;
  border-radius: 8px;
  background: #f7faf7;
}

.map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.map-head strong {
  color: var(--green-dark);
}

.real-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(7, 34px);
  gap: 4px;
}

.map-core {
  grid-column: 2 / 7;
  grid-row: 2 / 7;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px dashed #b8c9be;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(15, 107, 73, .12) 46%, rgba(15, 107, 73, .12) 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(185, 133, 34, .13) 46%, rgba(185, 133, 34, .13) 54%, transparent 54%),
    #eef5f0;
  color: #64746b;
  font-size: 11px;
  font-weight: 800;
}

.elevator {
  position: relative;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--green-dark);
  background: white;
  box-shadow: 0 4px 10px rgba(15, 107, 73, .08);
}

.corridor {
  position: absolute;
  color: #7c8a82;
  font-size: 10px;
  font-weight: 700;
}

.corridor-h {
  left: 8px;
  right: 8px;
  top: 50%;
  text-align: right;
  transform: translateY(-50%);
}

.corridor-v {
  top: 8px;
  bottom: 8px;
  left: 50%;
  writing-mode: vertical-rl;
  transform: translateX(-50%);
}

.shop-cell {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 1px;
  border: 1px solid #dde5de;
  border-radius: 5px;
  color: #738078;
  background: white;
  text-align: center;
  overflow: hidden;
}

.shop-cell span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
}

.shop-cell small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 8px;
}

.shop-cell.active {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--gold));
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(15, 107, 73, .24);
}

.merchant-body {
  padding: 14px;
}

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

.merchant-title h3 {
  margin: 0;
  font-size: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--green-dark);
  background: #e8f2eb;
  font-size: 12px;
  white-space: nowrap;
}

.meta {
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
}

.tag {
  padding: 4px 8px;
  border-radius: 6px;
  background: #f5f1e8;
  color: #7a5519;
  font-size: 12px;
}

.detail-btn {
  width: 100%;
}

.merchant-dialog {
  width: min(620px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}

.merchant-dialog::backdrop {
  background: rgba(10, 20, 12, .48);
}

.close-btn {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .28);
}

.detail-content {
  padding: 0 0 18px;
}

.detail-content .merchant-cover {
  min-height: 190px;
}

.detail-inner {
  padding: 18px;
}

.detail-inner p {
  color: var(--muted);
  line-height: 1.8;
}

.interior-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.interior-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f6f4ee;
}

.admin-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  align-items: start;
}

.admin-card {
  padding: 18px;
}

.lead-card {
  grid-column: 1 / -1;
}

.login-card {
  max-width: 420px;
}

.login-card input + input,
.login-card input + button {
  margin-top: 10px;
}

.editor {
  display: grid;
  gap: 12px;
}

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

.editor-head h2 {
  margin-bottom: 4px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #e8f2ec;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.editor label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.form-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.photo-uploader {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

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

.photo-head label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.photo-head span {
  color: var(--muted);
  font-size: 12px;
}

.photo-preview,
.photo-grid-preview {
  min-height: 80px;
}

.photo-preview {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 16 / 6.8;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
}

.photo-preview img,
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview button,
.photo-thumb button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 28px;
  padding: 0 9px;
  background: rgba(22, 26, 29, .72);
  font-size: 12px;
}

.photo-grid-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.photo-thumb,
.photo-empty {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-size: 12px;
  text-align: center;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stats-strip article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.stats-strip strong,
.stats-strip span {
  display: block;
}

.stats-strip strong {
  color: var(--green-dark);
  font-size: 24px;
}

.stats-strip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.import-panel h2 {
  margin-bottom: 6px;
}

.import-actions {
  display: grid;
  grid-template-columns: 1fr 110px 110px;
  gap: 8px;
  align-items: center;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.table-head h2 {
  margin: 0;
}

.table-head input {
  max-width: 260px;
}

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

.table-tools select {
  width: 150px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.empty-cell {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.danger {
  background: var(--rose);
}

.warn-line {
  margin-top: 5px;
  color: var(--rose);
  font-size: 12px;
  font-weight: 700;
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .app-shell, .admin-shell {
    width: min(100% - 18px, 760px);
    padding-top: 8px;
    padding-bottom: 20px;
  }

  .hero, .admin-header {
    position: relative;
    display: block;
    align-items: flex-start;
    padding-top: 8px;
  }

  .grand-hero {
    min-height: auto;
    align-items: flex-end;
    padding-bottom: 10px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.12;
  }

  h2 {
    font-size: 18px;
  }

  .eyebrow {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .subline {
    margin-top: 7px;
    font-size: 13px;
    line-height: 1.55;
  }

  .admin-link {
    position: absolute;
    top: 8px;
    right: 0;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }

  .hero > div,
  .admin-header > div {
    padding-right: 58px;
  }

  .search-panel {
    padding: 12px;
  }

  .search-kicker {
    font-size: 11px;
    margin-bottom: 8px;
  }

  .input-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #queryInput,
  .voice-btn {
    min-height: 44px;
  }

  #queryInput {
    font-size: 14px;
    padding: 7px 10px;
  }

  .voice-btn {
    font-size: 14px;
    gap: 7px;
  }

  .mic-dot {
    width: 16px;
    height: 21px;
    border-width: 2px;
  }

  .mic-dot::after {
    width: 14px;
    height: 7px;
    bottom: -9px;
    border-bottom-width: 2px;
    border-left-width: 2px;
    border-right-width: 2px;
  }

  .hint {
    margin-top: 10px;
    font-size: 11px;
    line-height: 1.45;
  }

  .answer-card {
    margin-top: 8px;
    padding: 9px 11px;
  }

  .answer-card p {
    font-size: 13px;
    line-height: 1.45;
  }

  .merchant-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
  }

  .storefront-frame {
    aspect-ratio: 16 / 6.8;
  }

  .merchant-cover {
    min-height: 86px;
    font-size: 20px;
  }

  .merchant-body {
    padding: 10px;
  }

  .merchant-title h3 {
    font-size: 15px;
  }

  .location-line {
    font-size: 12px;
    margin-top: 3px;
  }

  .badge,
  .tag {
    font-size: 10px;
  }

  .meta {
    margin: 8px 0;
    font-size: 12px;
    line-height: 1.45;
  }

  .floor-map {
    margin: 8px 0;
    padding: 7px;
  }

  .map-head {
    margin-bottom: 6px;
    font-size: 11px;
  }

  .real-map {
    grid-template-rows: repeat(7, 24px);
    gap: 3px;
  }

  .map-core {
    font-size: 9px;
    border-radius: 5px;
  }

  .elevator {
    padding: 3px 5px;
  }

  .corridor {
    font-size: 8px;
  }

  .shop-cell {
    border-radius: 4px;
  }

  .shop-cell span {
    font-size: 8px;
  }

  .shop-cell small {
    font-size: 7px;
  }

  .tags {
    gap: 5px;
    margin: 8px 0 10px;
  }

  .tag {
    padding: 3px 6px;
  }

  .detail-btn {
    min-height: 36px;
    font-size: 13px;
  }

  .detail-content .merchant-cover {
    min-height: 130px;
  }

  .detail-inner {
    padding: 14px;
  }

  .detail-inner p {
    font-size: 14px;
    line-height: 1.65;
  }

  .admin-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .admin-card {
    padding: 14px;
  }

  .editor {
    gap: 10px;
  }

  .editor label {
    font-size: 12px;
  }

  input, select, textarea {
    min-height: 40px;
    font-size: 14px;
    padding: 8px 10px;
  }

  .table-head {
    display: grid;
    gap: 10px;
  }

  .form-grid-two,
  .form-actions,
  .stats-strip,
  .import-panel,
  .import-actions,
  .photo-grid-preview,
  .interior-gallery {
    grid-template-columns: 1fr;
  }

  .table-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-tools select {
    width: 100%;
  }

  .table-head input {
    max-width: none;
  }

  table {
    min-width: 620px;
  }

  th, td {
    padding: 10px 8px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .app-shell, .admin-shell {
    width: min(100% - 16px, 420px);
    padding-top: 7px;
  }

  .grand-hero {
    padding-bottom: 8px;
  }

  h1 {
    font-size: 24px;
  }

  .subline {
    font-size: 12px;
  }

  .search-panel {
    padding: 11px;
  }

  #queryInput,
  .voice-btn {
    min-height: 42px;
  }

  .voice-label {
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 22px;
  }

  .hero, .admin-header {
    gap: 10px;
  }

  .admin-link {
    font-size: 13px;
    padding: 0 10px;
  }

  #queryInput {
    font-size: 13px;
  }
}
