:root {
  --navy: #0d1b3d;
  --pink: #ff6b8f;
  --bg: #f5f6fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --weak: #9ca3af;
  --line: #e8ebf1;
  --green: #18a957;
  --orange: #f59e0b;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px 18px;
  color: #fff;
  background: var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 24px;
}

.brand img {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #fff;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  display: block;
  padding: 13px 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  cursor: pointer;
}

.side-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.side-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  min-width: 0;
  padding: 24px 28px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

.topbar p,
.table-head p,
.audit-card p,
.drawer-head p {
  color: var(--muted);
  font-size: 13px;
}

.topbar h1 {
  margin-top: 4px;
  color: var(--navy);
  font-size: 28px;
}

.top-actions,
.batch-actions,
.drawer-actions {
  display: flex;
  gap: 10px;
}

button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  color: var(--navy);
  font-weight: 700;
  background: #eef2f7;
}

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

.secondary {
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--line);
}

.compact {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

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

.summary-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary-grid article.warning {
  background: #fff8ed;
}

.summary-grid span,
.summary-grid em {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.summary-grid strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--navy);
  font-size: 30px;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-box span {
  position: absolute;
  left: 14px;
  top: 11px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--weak);
  border-radius: 50%;
}

.search-box span::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -6px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--weak);
  transform: rotate(45deg);
}

input,
select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.search-box input {
  padding-left: 42px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(760px, 1fr) 380px;
  gap: 14px;
  align-items: start;
  min-height: 548px;
}

.store-content-grid {
  grid-template-columns: minmax(0, 1fr);
}

.table-card,
.editor-drawer,
.audit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.table-card {
  min-width: 0;
  overflow-x: auto;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.table-head h2,
.audit-card h2,
.drawer-head h2 {
  color: var(--navy);
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

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

th {
  color: var(--muted);
  font-weight: 700;
  background: #fafbfe;
}

th:nth-child(1) {
  width: 210px;
}

th:nth-child(6) {
  width: 150px;
}

th:nth-child(10) {
  width: 120px;
}

.store-table th:nth-child(2) {
  width: 210px;
}

.store-table th:nth-child(7) {
  width: 150px;
}

.store-table th:nth-child(11) {
  width: 120px;
}

th.check-col,
td.check-col {
  width: 44px;
  padding-left: 14px;
  padding-right: 8px;
  text-align: center;
}

th.check-col input,
td.check-col input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--pink);
}

tbody tr.batch-selected td {
  background: #fff9fb;
}

.store-cell {
  display: flex;
  min-width: 0;
  gap: 10px;
}

.store-cell img {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  object-fit: cover;
  background: #f4f6fb;
}

.store-cell strong,
.store-cell span,
.mini-meta {
  display: block;
}

.store-cell strong {
  color: var(--navy);
}

.store-cell span,
.mini-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.status-badge,
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin: 0 5px 5px 0;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.green {
  color: var(--green);
  background: #eafff2;
}

.orange {
  color: var(--orange);
  background: #fff6e5;
}

.red {
  color: var(--red);
  background: #fee2e2;
}

.gray {
  color: var(--muted);
  background: #f1f4f8;
}

.blue {
  color: var(--navy);
  background: #eef2ff;
}

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

.row-actions button {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
}

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

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 13px;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-size-control select {
  width: 76px;
  height: 32px;
  padding: 0 8px;
}

.pagination button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.page-number-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.page-number {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy);
  background: #fff;
  font-weight: 800;
}

.page-number:hover {
  border-color: var(--pink);
  color: var(--pink);
}

.page-current {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.page-current:hover {
  color: #fff;
}

.page-ellipsis {
  min-width: 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.editor-drawer {
  position: sticky;
  top: 0;
  z-index: 2;
  width: auto;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  box-shadow: 0 16px 34px rgba(13, 27, 61, 0.12);
}

.editor-drawer.admin-modal {
  position: fixed;
  top: 28px;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  width: min(760px, calc(100vw - 56px));
  max-height: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.editor-drawer.admin-modal.stacked-editor {
  width: min(1040px, calc(100vw - 56px));
  padding: 20px 22px 0;
  border-radius: 14px;
  background: #f8fafc;
}

.editor-drawer.admin-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(13, 27, 61, 0.32);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
}

.option-manager {
  width: min(620px, calc(100vw - 56px));
}

.option-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 18px 0 14px;
}

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

.option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.option-row strong,
.option-row span {
  display: block;
}

.option-row strong {
  color: var(--navy);
}

.option-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.option-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fbfcff;
}

.admin-modal .form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-modal .form-grid > label {
  grid-column: span 2;
}

.admin-modal > .drawer-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  margin: 18px -22px 0;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, .96);
  backdrop-filter: blur(8px);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin: -2px 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef1f6;
}

.drawer-head h2 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.25;
}

.tabs {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 4px;
  margin: 12px 0 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f6fb;
  overflow-x: auto;
}

.tabs button {
  flex: 0 0 auto;
  min-width: 104px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  white-space: nowrap;
}

.tabs button.active {
  color: #fff;
  background: var(--pink);
  box-shadow: 0 8px 18px rgba(255, 107, 143, .22);
}

.editor-panel {
  display: none;
}

.editor-panel.active {
  display: block;
}

.stacked-editor .editor-panel {
  display: block;
  margin: 0 0 14px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(13, 27, 61, 0.035);
}

.editor-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef1f6;
}

.editor-section-head h3 {
  position: relative;
  margin: 0;
  padding-left: 12px;
  color: var(--navy);
  font-size: 17px;
  line-height: 1.25;
}

.editor-section-head h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--pink);
}

.editor-section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 420px;
  font-size: 12px;
  line-height: 1.55;
  text-align: right;
}

.form-grid {
  display: grid;
  gap: 10px;
}

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

.form-span-2 {
  grid-column: 1 / -1;
}

.admin-modal input,
.admin-modal select {
  height: 40px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
}

.coordinate-check {
  align-content: end;
  grid-template-columns: 18px 1fr;
  min-height: 72px;
  color: var(--navy);
}

.coordinate-check input {
  width: 18px;
  height: 18px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.select-menu-box {
  position: relative;
  display: grid;
  gap: 6px;
}

.select-menu-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 44px;
  z-index: 60;
  display: none;
  max-height: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(13, 27, 61, 0.14);
  overflow: auto;
}

.select-menu-list.open {
  display: grid;
  gap: 4px;
}

.select-menu-list button {
  display: block;
  height: auto;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 7px;
  text-align: left;
  background: #fff;
}

.select-menu-list button:hover,
.select-menu-list button.selected {
  background: #fff0f5;
}

.select-menu-list strong,
.select-menu-list span {
  display: block;
}

.select-menu-list strong {
  color: var(--navy);
  font-size: 13px;
}

.select-menu-list span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.map-preview {
  position: relative;
  height: 240px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #f4f7fb;
  cursor: default;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.map-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #eef2f7;
}

.map-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  background:
    linear-gradient(rgba(13, 27, 61, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 27, 61, 0.06) 1px, transparent 1px),
    #f4f7fb;
  background-size: 28px 28px;
}

.map-empty[hidden] {
  display: none;
}

.map-status-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 10px 12px;
  border: 1px solid rgba(232, 235, 241, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(13, 27, 61, 0.12);
  pointer-events: none;
}

.map-status-panel strong,
.map-status-panel span {
  display: block;
}

.map-status-panel strong {
  color: var(--navy);
}

.map-status-panel span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.service-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 14px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
}

.service-list label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.media-gallery-field {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.field-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.field-title-row strong,
.field-title-row span {
  display: block;
}

.field-title-row strong {
  color: var(--navy);
  font-size: 15px;
}

.field-title-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  text-align: right;
}

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

.store-gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.store-gallery-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.store-gallery-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
  background: #eef2f7;
}

.store-gallery-card.empty {
  grid-column: 1 / -1;
  min-height: 110px;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
  text-align: center;
  background: #fff;
}

.store-gallery-card.empty strong {
  color: var(--navy);
}

.store-gallery-card.empty span {
  margin-top: 4px;
  font-size: 12px;
}

.store-gallery-url {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-gallery-badges {
  min-height: 22px;
}

.store-gallery-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}

.store-gallery-actions button {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

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

.drawer-actions button {
  flex: 1;
}

.audit-card {
  margin-top: 14px;
  padding: 18px;
}

.audit-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.audit-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
}

.audit-list strong {
  color: var(--navy);
}

.audit-list span,
.audit-list em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.audit-list button {
  grid-row: 1 / span 3;
  grid-column: 2;
  align-self: center;
}

.summary-grid article {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.summary-grid article:hover,
.summary-grid article.active {
  border-color: rgba(255, 107, 143, 0.38);
  box-shadow: 0 10px 24px rgba(13, 27, 61, 0.08);
  transform: translateY(-1px);
}

tbody tr[data-id] {
  cursor: pointer;
}

tbody tr[data-id]:hover td,
tbody tr[data-id].selected td {
  background: #fff9fb;
}

@media (max-width: 1280px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .editor-drawer:not(.admin-modal) {
    position: static;
  }
}

@media (max-width: 760px) {
  .editor-drawer.admin-modal {
    inset: 14px;
    width: auto;
  }

  .admin-modal .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-modal .form-grid > label,
  .form-span-2 {
    grid-column: 1 / -1;
  }

  .editor-section-head {
    display: block;
  }

  .editor-section-head p {
    max-width: none;
    margin-top: 6px;
    text-align: left;
  }
}
