:root {
  --bg: #f4f8f6;
  --ink: #102a2a;
  --muted: #5f7171;
  --line: #d5e6df;
  --card: #ffffffcc;
  --brand: #0d9488;
  --brand-deep: #0f766e;
  --accent: #f97316;
  --danger: #dc2626;
  --ok: #059669;
  --shadow: 0 12px 38px rgba(15, 118, 110, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Source Han Sans SC", "PingFang SC", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 90% 10%, #ffedd5 0%, transparent 30%),
    radial-gradient(circle at 8% 22%, #ccfbf1 0%, transparent 25%), var(--bg);
}

body.device-mobile {
  background: radial-gradient(circle at 90% 8%, #fff7ed 0%, transparent 34%),
    radial-gradient(circle at 10% 16%, #d1fae5 0%, transparent 26%), var(--bg);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  backdrop-filter: blur(12px);
  background: #ffffffdb;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  color: #0f766e;
}

.nav a.active {
  background: #ccfbf1;
  border: 1px solid #99f6e4;
}

.nav .btn {
  padding: 6px 10px;
}

.mobile-nav-toggle {
  display: none;
}

.topbar.mobile-nav-mode {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}

.topbar.mobile-nav-mode .mobile-nav-toggle {
  display: inline-flex;
}

body.device-desktop .mobile-nav-toggle {
  display: none !important;
}

.topbar.mobile-nav-mode .nav {
  width: 100%;
  display: none;
}

.topbar.mobile-nav-mode.nav-expanded .nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
}

.topbar.mobile-nav-mode .nav a,
.topbar.mobile-nav-mode .nav .btn,
.topbar.mobile-nav-mode .nav .chip {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar.mobile-nav-mode .nav .chip[data-role="user-tag"] {
  grid-column: 1 / -1;
}

.container {
  width: min(1120px, calc(100% - 26px));
  margin: 18px auto 48px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero h1 {
  margin: 5px 0 8px;
  line-height: 1.2;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.hero p {
  margin: 0;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.hero-lead {
  color: #334155;
  line-height: 1.7;
  margin-top: 8px;
}

.hero-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.intro-card {
  border: 1px solid #bae6fd;
  background: linear-gradient(160deg, #f8fafc, #f0fdfa);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.avatar-badge {
  display: inline-flex;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0f766e;
  background: linear-gradient(135deg, #99f6e4, #fde68a);
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.2);
}

.profile-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-tags span {
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #166534;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.journey-list {
  margin: 0;
  padding-left: 18px;
  color: #334155;
  display: grid;
  gap: 6px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.feature-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.feature-item p {
  margin: 8px 0 0;
  color: #475569;
  line-height: 1.65;
}

.eyebrow {
  margin: 0;
  color: #0f766e;
  font-weight: 700;
}

.tiny {
  color: var(--muted);
  margin: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stats,
.chips {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid #a5f3fc;
  background: #ecfeff;
  color: #155e75;
  font-weight: 700;
}

.announcement-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.announcement-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.announcement-item.pinned {
  background: #fff7ed;
  border-color: #fdba74;
}

.announcement-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.announcement-item h3 {
  margin: 0;
}

.announcement-item p {
  margin: 6px 0;
}

.announcement-summary {
  color: #475569;
  line-height: 1.7;
}

.announcement-item time {
  color: var(--muted);
  font-size: 0.85rem;
}

.announcement-item .row,
.product-card .row {
  margin-top: 8px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  background: #f97316;
  color: #fff;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.product-card h3,
.card h2,
.card h3 {
  margin: 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.chart-grid .card {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

canvas {
  width: 100%;
  height: 220px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.product-cover {
  border-radius: 10px;
  height: 126px;
  background: linear-gradient(135deg, #99f6e4, #fdba74);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.35rem;
  font-weight: 800;
}

.product-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.buy-row,
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.buy-row input {
  width: 88px;
}

.table-wrap {
  overflow: auto;
}

.pager {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #dbeafe;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pager-info {
  margin: 0;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager-size select {
  min-width: 76px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px;
  text-align: left;
}

th {
  background: #f8fafc;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.84rem;
}

.status.pending_payment {
  color: #92400e;
  background: #fef3c7;
}

.status.paid {
  color: #166534;
  background: #dcfce7;
}

.status.user-active {
  color: #166534;
  background: #dcfce7;
}

.status.user-blacklisted {
  color: #991b1b;
  background: #fee2e2;
}

.status.book-request-submitted {
  color: #92400e;
  background: #fef3c7;
}

.status.book-request-contacted {
  color: #075985;
  background: #e0f2fe;
}

.status.book-request-completed {
  color: #166534;
  background: #dcfce7;
}

.status.book-request-cancelled {
  color: #991b1b;
  background: #fee2e2;
}

.status.order-process-pending {
  color: #92400e;
  background: #fef3c7;
}

.status.order-process-processed {
  color: #166534;
  background: #dcfce7;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.btn-sm {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.btn.ghost {
  border: 1px solid #a5f3fc;
  background: #ecfeff;
  color: #155e75;
}

.btn.success {
  background: linear-gradient(135deg, #10b981, #059669);
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

label {
  display: grid;
  gap: 4px;
  font-weight: 650;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

textarea {
  resize: vertical;
}

.empty {
  color: #64748b;
  text-align: center;
  padding: 10px;
}

.muted-box {
  border: 1px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 12px;
  padding: 12px;
}

.book-request-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.book-request-form-grid .full-span {
  grid-column: 1 / -1;
}

.book-address-shortcuts {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed #99f6e4;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0fdfa, #f8fafc);
}

.chip-button {
  border: 1px solid #a5f3fc;
  background: #ecfeff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.chip-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.12);
}

.chip-button.is-active {
  border-color: #14b8a6;
  background: #99f6e4;
  color: #134e4a;
}

.book-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.book-inline-check input[type="checkbox"] {
  margin: 0;
}

.book-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.book-photo-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.book-photo-card img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-form {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.upload-progress {
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.upload-progress progress {
  width: 100%;
  height: 12px;
}

.upload-progress.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.upload-progress.error .tiny {
  color: #b91c1c;
}

.home-image-admin-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.home-image-preview {
  margin-top: 12px;
  border: 1px dashed #93c5fd;
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.home-image-preview-img,
.home-image-public {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 10px;
  display: block;
  background: #fff;
}

.home-image-public-wrap {
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.home-rich-editor-wrap {
  margin-top: 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.product-rich-editor-wrap .rich-editor,
.product-rich-editor-wrap .rich-source {
  min-height: 220px;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rich-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.rich-select {
  min-width: 116px;
}

.rich-color-label {
  display: inline-flex;
  align-items: center;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
}

.rich-color-input {
  width: 40px;
  height: 34px;
  padding: 2px;
  border-radius: 8px;
}

.rich-editor {
  min-height: 260px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.rich-editor:focus {
  outline: 2px solid #7dd3fc;
  outline-offset: 0;
}

.rich-source {
  min-height: 260px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: Consolas, "Courier New", monospace;
  padding: 12px;
  line-height: 1.65;
}

.rich-source:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 0;
}

.home-rich-content {
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
  color: #1e293b;
  line-height: 1.75;
}

.home-rich-content h1,
.home-rich-content h2,
.home-rich-content h3 {
  margin: 0 0 10px;
  color: #0f172a;
}

.home-rich-content p {
  margin: 0 0 10px;
}

.home-rich-content ul,
.home-rich-content ol {
  margin: 0 0 10px 18px;
}

.home-rich-content hr {
  border: none;
  border-top: 1px solid #cbd5e1;
  margin: 14px 0;
}

.home-rich-content a {
  color: #0369a1;
  text-decoration: underline;
  word-break: break-all;
}

.home-rich-content blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 4px solid #38bdf8;
  background: #f0f9ff;
  border-radius: 8px;
}

.home-rich-content pre {
  margin: 0 0 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
}

.home-rich-content code {
  font-family: Consolas, "Courier New", monospace;
}

.home-rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

.home-rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 0.95rem;
}

.home-rich-content th,
.home-rich-content td {
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
}

.home-rich-content th {
  background: #f8fafc;
  font-weight: 700;
}

.full-row {
  grid-column: 1 / -1;
}

.product-detail-wrap {
  display: grid;
  gap: 14px;
}

.product-gallery {
  display: grid;
  gap: 10px;
  align-content: start;
}

.product-detail-top {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
}

.product-detail-cover {
  height: 240px;
}

.product-cover.clickable {
  cursor: zoom-in;
}

.product-cover-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-cover-thumb {
  width: 62px;
  height: 62px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
}

.product-cover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-cover-thumb.active {
  border-color: #0d9488;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.14);
}

.product-detail-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

.product-buy-panel {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.product-rich-content-wrap h3 {
  margin: 0 0 10px;
}

.product-rich-content {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
  color: #1e293b;
  line-height: 1.75;
}

.product-rich-content h1,
.product-rich-content h2,
.product-rich-content h3 {
  margin: 0 0 10px;
  color: #0f172a;
}

.product-rich-content p {
  margin: 0 0 10px;
}

.product-rich-content ul,
.product-rich-content ol {
  margin: 0 0 10px 18px;
}

.product-rich-content hr {
  border: none;
  border-top: 1px solid #cbd5e1;
  margin: 14px 0;
}

.product-rich-content a {
  color: #0369a1;
  text-decoration: underline;
  word-break: break-all;
}

.product-rich-content blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 4px solid #38bdf8;
  background: #f0f9ff;
  border-radius: 8px;
}

.product-rich-content pre {
  margin: 0 0 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
}

.product-rich-content code {
  font-family: Consolas, "Courier New", monospace;
}

.product-rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

.product-rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 0.95rem;
}

.product-rich-content th,
.product-rich-content td {
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
}

.product-rich-content th {
  background: #f8fafc;
  font-weight: 700;
}

.announcement-rich-content {
  margin-top: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
  color: #1e293b;
  line-height: 1.75;
}

.announcement-rich-content h1,
.announcement-rich-content h2,
.announcement-rich-content h3 {
  margin: 0 0 10px;
  color: #0f172a;
}

.announcement-rich-content p {
  margin: 0 0 10px;
}

.announcement-rich-content ul,
.announcement-rich-content ol {
  margin: 0 0 10px 18px;
}

.announcement-rich-content hr {
  border: none;
  border-top: 1px solid #cbd5e1;
  margin: 14px 0;
}

.announcement-rich-content a {
  color: #0369a1;
  text-decoration: underline;
  word-break: break-all;
}

.announcement-rich-content blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 4px solid #38bdf8;
  background: #f0f9ff;
  border-radius: 8px;
}

.announcement-rich-content pre {
  margin: 0 0 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
}

.announcement-rich-content code {
  font-family: Consolas, "Courier New", monospace;
}

.announcement-rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 8px 0;
  display: block;
}

.announcement-rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 0.95rem;
}

.announcement-rich-content th,
.announcement-rich-content td {
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
}

.announcement-rich-content th {
  background: #f8fafc;
  font-weight: 700;
}

.cart-list {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.cart-item {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
}

.cart-item-cover {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f766e;
}

.cart-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-item-main {
  display: grid;
  gap: 8px;
}

.cart-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.cart-item-head h3 {
  margin: 0;
}

.cart-inline-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
}

.cart-inline-label input[type="number"] {
  width: 88px;
}

.cart-shipping {
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  padding: 10px;
  background: #eff6ff;
  display: grid;
  gap: 8px;
}

.cart-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
}

.image-preview-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  max-height: calc(100vh - 36px);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.image-preview-close {
  justify-self: end;
}

.image-preview-img {
  width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 10px;
  background: #f8fafc;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 18px;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
}

.admin-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  margin: 0;
}

.user-location-dialog {
  width: min(980px, 100%);
  padding: 0;
  overflow: hidden;
}

.user-location-head {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-location-head h3 {
  margin: 0;
}

.user-location-body {
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 12px;
}

.user-location-meta-wrap {
  display: grid;
  gap: 8px;
  align-content: start;
}

.user-location-meta {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.user-location-meta p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.user-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-location-map {
  display: block;
  width: 100%;
  aspect-ratio: 13 / 7;
  min-height: 360px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  object-fit: cover;
}

.share-modal-dialog {
  width: min(560px, 100%);
  padding: 0;
}

.share-modal-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.share-link-field {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 650;
}

.share-link-input {
  width: 100%;
}

.share-qr-wrap {
  border: 1px dashed #93c5fd;
  border-radius: 12px;
  background: #eff6ff;
  padding: 12px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.share-qr-image {
  width: min(260px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  object-fit: contain;
}

.user-share-fab {
  position: fixed;
  right: 18px;
  bottom: 74px;
  z-index: 140;
  border-radius: 999px;
  padding: 9px 14px;
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.28);
}

body.device-mobile .user-share-fab {
  right: 12px;
  bottom: 72px;
}

.is-hidden {
  display: none !important;
}

.portal-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.portal-card {
  width: min(860px, 100%);
}

.portal-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.portal-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  text-decoration: none;
}

.portal-item h2 {
  margin: 0 0 8px;
}

.portal-item p {
  margin: 0;
  color: var(--muted);
}

.captcha-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.captcha-image {
  width: 140px;
  height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.pay-qr-image {
  width: 220px;
  height: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.status.post-pending {
  color: #92400e;
  background: #fef3c7;
}

.status.post-approved {
  color: #166534;
  background: #dcfce7;
}

.status.post-rejected {
  color: #9f1239;
  background: #ffe4e6;
}

.post-image-upload-box {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.post-image-selected-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.post-image-selected-item {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fafc;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.post-image-selected-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.post-image-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.post-image-grid img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #dbeafe;
  background: #fff;
}

.mini-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.mini-photo-link {
  display: block;
}

.mini-photo-grid img {
  width: 100%;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #dbeafe;
  background: #fff;
}

.post-image-item {
  display: grid;
  gap: 8px;
}

.post-image-zoomable {
  cursor: zoom-in;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  border-radius: 10px;
  padding: 10px 14px;
  background: #0f172a;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--danger);
}

body.page-user-payment #paymentInfo,
body.page-user-payment #wechatLinkHint,
body.page-user-orders .table-wrap td,
body.page-user-cart #cartSummaryText,
body.page-user-cart #couponQuoteText {
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.page-user-payment #wechatPayPanel {
  display: grid;
  gap: 10px;
}

body.page-user-payment .pay-qr-image {
  width: min(220px, 100%);
  height: auto;
  aspect-ratio: 1 / 1;
}

@media (max-width: 980px) {
  body.page-user-orders .table-wrap {
    overflow: visible;
  }

  body.page-user-orders table {
    min-width: 0;
  }

  body.page-user-orders .table-wrap table thead {
    display: none;
  }

  body.page-user-orders .table-wrap table,
  body.page-user-orders .table-wrap table tbody,
  body.page-user-orders .table-wrap table tr,
  body.page-user-orders .table-wrap table td {
    display: block;
    width: 100%;
  }

  body.page-user-orders .table-wrap table tr {
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 10px;
    overflow: hidden;
  }

  body.page-user-orders .table-wrap table td {
    border: 0;
    border-bottom: 1px dashed #dbeafe;
    padding: 9px 10px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    text-align: right;
  }

  body.page-user-orders .table-wrap table td::before {
    content: attr(data-label);
    color: #475569;
    font-weight: 700;
    text-align: left;
    flex: 0 0 7.2em;
  }

  body.page-user-orders .table-wrap table td:last-child {
    border-bottom: 0;
  }

  body.page-user-orders .table-wrap table td.empty {
    display: block;
    text-align: center;
  }

  body.page-user-orders .table-wrap table td.empty::before {
    content: none;
  }
}

@media (max-width: 880px) {
  body.page-user-post-publish .rich-toolbar-group {
    width: 100%;
  }

  body.page-user-post-publish .rich-toolbar-group .btn {
    flex: 1 1 auto;
  }

  body.page-user-post-publish .rich-select {
    min-width: 0;
    flex: 1 1 120px;
  }

  body.page-user-post-publish .post-image-upload-box > label {
    flex: 1 1 100%;
  }

  body.page-user-post-publish #uploadPostImagesBtn {
    width: 100%;
  }

  body.page-user-payment .row > label {
    flex: 1 1 210px;
    min-width: 0;
  }

  body.page-user-payment .row > .btn,
  body.page-user-payment .row > a.btn {
    flex: 1 1 150px;
  }

  body.page-user-payment #wechatPayPanel {
    justify-items: center;
  }

  body.page-user-payment #wechatPayHint,
  body.page-user-payment #wechatLinkHint {
    width: 100%;
  }

  body.page-user-cart .cart-item-head {
    flex-direction: column;
    align-items: flex-start;
  }

  body.page-user-cart .cart-item-main .row {
    align-items: stretch;
  }

  body.page-user-cart .cart-item-main .row .btn,
  body.page-user-cart .cart-item-main .row > a.btn {
    flex: 1 1 140px;
  }

  body.page-user-cart .cart-shipping .grid-2 {
    grid-template-columns: 1fr;
  }

  body.page-user-orders .pager .row {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 560px) {
  body.page-user-payment .pay-qr-image {
    width: min(180px, 100%);
  }

  body.page-user-orders .table-wrap table td {
    display: grid;
    gap: 4px;
    justify-items: start;
    text-align: left;
  }

  body.page-user-orders .table-wrap table td::before {
    flex: 0 0 auto;
  }
}

@media (max-width: 880px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 14px;
    gap: 10px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav a,
  .nav .btn,
  .nav .chip {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    line-height: 1.25;
    padding: 8px 10px;
  }

  .nav .chip[data-role="user-tag"] {
    grid-column: 1 / -1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .container {
    width: min(1120px, calc(100% - 16px));
    margin: 12px auto 34px;
    gap: 10px;
  }

  .card {
    padding: 14px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-head > .row {
    width: 100%;
  }

  .grid-2,
  .admin-grid,
  .portal-grid,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .home-hero-grid,
  .home-feature-grid {
    grid-template-columns: 1fr;
  }

  .product-detail-top {
    grid-template-columns: 1fr;
  }

  .product-detail-cover {
    height: 200px;
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .cart-item-cover {
    width: 100%;
    height: 180px;
  }

  .user-location-body {
    grid-template-columns: 1fr;
  }

  .user-location-map {
    min-height: 280px;
  }
}

@media (max-width: 760px) {
  .book-request-form-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }

  .table-wrap table thead {
    display: none;
  }

  .table-wrap table,
  .table-wrap table tbody,
  .table-wrap table tr,
  .table-wrap table td {
    display: block;
    width: 100%;
  }

  .table-wrap table tr {
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 10px;
    overflow: hidden;
  }

  .table-wrap table td {
    border: 0;
    border-bottom: 1px dashed #dbeafe;
    padding: 9px 10px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    text-align: right;
  }

  .table-wrap table td::before {
    content: attr(data-label);
    color: #475569;
    font-weight: 700;
    text-align: left;
    flex: 0 0 7.2em;
  }

  .table-wrap table td:last-child {
    border-bottom: 0;
  }

  .table-wrap table td.empty {
    display: block;
    text-align: center;
  }

  .table-wrap table td.empty::before {
    content: none;
  }

  .toast {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .user-share-fab {
    right: 12px;
    bottom: 64px;
  }
}
