:root {
  --ground: #f6f5f2;
  --surface: #eceae4;
  --surface-strong: #e2dfd7;
  --ink: #14161a;
  --ink-soft: #4a4f57;
  --accent: #14624e;
  --accent-ink: #ffffff;
  --danger: #a4262c;
  --radius: 4px;
  --gap: clamp(16px, 3vw, 32px);
  --measure: 68ch;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: inherit; }

img { display: block; max-width: 100%; }

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

h1, h2, h3 {
  margin: 0 0 8px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 12px; max-width: var(--measure); }

.site-head {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 18px var(--gap);
  background: var(--ground);
  position: sticky;
  top: 0;
  z-index: 20;
}

.wordmark {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
}

.nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 10px 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a:hover, .nav a:focus-visible { color: var(--ink); }

.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 18px;
  min-height: 44px;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.btn:hover { background: #0f4d3d; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid #7fb8a5; outline-offset: 2px; }

.btn.ghost {
  background: var(--surface);
  color: var(--ink);
}
.btn.ghost:hover { background: var(--surface-strong); }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8a1f24; }

.btn.small { padding: 6px 12px; font-size: 0.9rem; }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.app-main {
  padding: 8px var(--gap) 80px;
  min-height: 60vh;
}

.site-foot {
  padding: 32px var(--gap) 48px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.hero {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 4vw, 48px) 0 clamp(24px, 5vw, 56px);
  max-width: 900px;
}

.hero p { color: var(--ink-soft); font-size: 1.1rem; }

.searchbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input, .select, .textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #cfcabf;
  border-radius: 2px;
  padding: 11px 12px;
  font-size: 16px; /* keeps iOS from zooming on focus */
  min-height: 44px;
}

.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.textarea { min-height: 110px; resize: vertical; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field .hint { color: var(--ink-soft); font-size: 0.85rem; }

.form-panel {
  background: var(--surface);
  padding: clamp(18px, 3vw, 32px);
  max-width: 560px;
}

.grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(16px, 2.5vw, 28px);
  margin-top: 24px;
}

.product-card {
  background: #fff;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.product-media {
  aspect-ratio: 4 / 3;
  background: var(--surface-strong);
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink-soft);
  overflow: hidden;
}

.product-media img { width: 100%; height: 100%; object-fit: cover; }

.product-body { padding: 16px; display: grid; gap: 6px; }
.product-title { font-weight: 700; font-size: 1.05rem; }
.product-meta { color: var(--ink-soft); font-size: 0.88rem; }
.price { font-weight: 800; font-size: 1.15rem; }

.detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); margin-top: 20px; }
.detail-media { background: var(--surface-strong); aspect-ratio: 4 / 3; overflow: hidden; display: grid; place-items: center; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 16px;
  min-height: 60vh;
}

.conv-list { background: var(--surface); padding: 12px; display: grid; gap: 6px; align-content: start; max-height: 70vh; overflow: auto; }
.conv-item { padding: 12px; min-height: 44px; cursor: pointer; text-align: left; background: transparent; border: 0; width: 100%; }
.conv-item:hover, .conv-item.active { background: var(--surface-strong); }
.conv-item .name { font-weight: 700; }
.conv-item .prev { color: var(--ink-soft); font-size: 0.85rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-panel { display: grid; grid-template-rows: auto 1fr auto; background: #fff; min-height: 60vh; }
.chat-head { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); flex-wrap: wrap; }
.messages { padding: 18px; overflow: auto; display: grid; gap: 10px; align-content: start; max-height: 52vh; }
.msg { max-width: 72%; padding: 10px 14px; background: var(--surface); border-radius: 2px; }
.msg.mine { justify-self: end; background: var(--accent); color: var(--accent-ink); }
.msg .meta { display: block; font-size: 0.75rem; opacity: 0.75; margin-bottom: 2px; }
.msg.recalled { opacity: 0.7; font-style: italic; }
.msg .edited { display: block; font-size: 0.75rem; opacity: 0.75; margin-top: 4px; }
.msg-actions { display: flex; gap: 10px; margin-top: 6px; }
.msg-action {
  background: none;
  border: 0;
  padding: 4px 0;
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.8;
  text-decoration: underline;
  cursor: pointer;
  min-height: 32px;
}
.msg-action:hover { opacity: 1; }
.chat-form { display: flex; gap: 10px; padding: 14px; background: var(--surface); }
.chat-form .input { flex: 1; }

.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 24px; }
.tab { padding: 8px 14px; background: var(--surface); border: 0; cursor: pointer; font-weight: 600; }
.tab.active { background: var(--accent); color: var(--accent-ink); }

.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { text-align: left; padding: 12px; vertical-align: top; }
.table tbody tr:nth-child(even) { background: #faf9f6; }

.report-row { display: grid; gap: 6px; padding: 18px; background: #fff; margin-bottom: 14px; }
.report-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tag { display: inline-block; padding: 2px 8px; background: var(--surface-strong); font-size: 0.8rem; }
.snapshot { background: var(--surface); padding: 12px; max-height: 220px; overflow: auto; font-size: 0.85rem; }
.snapshot p { margin: 0 0 4px; }

.empty { padding: 48px 0; color: var(--ink-soft); }

.stat-row { display: flex; gap: 32px; flex-wrap: wrap; margin: 18px 0 8px; }
.stat { display: grid; }
.stat .num { font-size: 2rem; font-weight: 800; }
.stat .label { color: var(--ink-soft); font-size: 0.9rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  z-index: 60;
  max-width: 90vw;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 26, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}

.dialog {
  background: var(--ground);
  padding: 24px;
  width: min(520px, 100%);
  max-height: 86vh;
  overflow: auto;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.muted { color: var(--ink-soft); }
.mono { font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; }
  .conv-list { max-height: 32vh; }
}

/* Phone: 375-first layout, tables become stacked cards, nothing overflows. */
@media (max-width: 720px) {
  .site-head {
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 12px 16px;
  }
  .wordmark { margin-right: 0; }
  .nav { order: 3; width: 100%; gap: 14px; overflow-x: auto; }
  .head-actions { margin-left: auto; }
  .app-main { padding: 4px 16px 64px; }
  .grid-products { grid-template-columns: 1fr; }
  .detail-actions .btn { flex: 1 1 100%; }
  .chat-form { flex-wrap: wrap; }
  .chat-form .input { flex: 1 1 100%; }

  .table, .table thead, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    background: #fff;
    margin-bottom: 12px;
    padding: 6px 0;
  }
  .table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 14px;
    text-align: right;
  }
  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--ink-soft);
    text-align: left;
    flex: 0 0 auto;
  }
  .table td:empty { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .product-card, .btn, .tab, .conv-item { transition: background 120ms ease, transform 120ms ease; }
}

/* ================================================================
   Liquid glass — scoped to 首頁 (home) and 商品詳情 (product).
   Other pages are untouched until signed off.
   Performance rules: backdrop-filter only on the sticky header and the
   non-scrolling hero/panel surfaces; scrolling card lists use a
   translucent white tint + edge highlight instead (no backdrop repaint).
   ================================================================ */

body[data-page] {
  --ink-soft: #3d4642;
  --glass: rgba(255, 255, 255, 0.56);
  --glass-strong: rgba(255, 255, 255, 0.74);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --glass-line: rgba(255, 255, 255, 0.9);
  --glass-ring: rgba(22, 30, 26, 0.1);
  --glass-blur: blur(24px) saturate(150%);
  --shadow-float: 0 18px 40px -22px rgba(24, 38, 32, 0.45);
  --radius-card: 26px;
  --radius-inner: 18px;
  --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
  background-color: #e9e8e2;
  isolation: isolate;
}

/* Ambient light field: what the glass refracts. Fixed, so it never repaints. */
body[data-page]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(58% 48% at 8% 4%, rgba(126, 172, 150, 0.62), transparent 70%),
    radial-gradient(44% 40% at 92% 10%, rgba(214, 195, 160, 0.6), transparent 72%),
    radial-gradient(52% 46% at 74% 88%, rgba(140, 166, 186, 0.5), transparent 72%),
    radial-gradient(40% 36% at 22% 78%, rgba(198, 206, 186, 0.5), transparent 72%),
    linear-gradient(180deg, #eeede7 0%, #e3e2db 100%);
}

/* Fine grain: keeps the field from looking like a flat gradient. */
body[data-page]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

body[data-page] .site-head{
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 30px -24px rgba(24, 38, 32, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

body[data-page] .nav a{
  color: #2f3a35;
  padding: 10px 14px;
  border-radius: 999px;
  transition: background 220ms var(--ease-soft), color 220ms var(--ease-soft);
}

body[data-page] .nav a:hover{
  background: rgba(255, 255, 255, 0.7);
  color: #101a15;
}

body[data-page] .site-foot{
  color: #3b4641;
}

/* --- shared glass surfaces --- */

.glass-panel {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    var(--shadow-float);
}

/* one specular sweep across the top edge — no rainbow gradients */
.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, 0.65), transparent 60%);
  opacity: 0.9;
}

/* --- home hero --- */

body[data-page] .hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: stretch;
  max-width: 1240px;
  margin: clamp(14px, 2.5vw, 28px) auto 0;
  padding: clamp(26px, 4vw, 56px);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: 32px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow-float);
}

body[data-page] .hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 70% at 20% -20%, rgba(255, 255, 255, 0.75), transparent 58%);
}

.hero-copy { display: grid; gap: 20px; align-content: center; position: relative; z-index: 1; }

body[data-page] .hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0;
  text-wrap: balance;
  color: #0f1512;
}

body[data-page] .hero-copy p {
  color: #333d38;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.6;
  max-width: 34ch;
  margin: 0;
}

/* search + filter as one control cluster */
.hero-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 24px -20px rgba(24, 38, 32, 0.7);
  max-width: 460px;
}

.search-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: #45534c;
  pointer-events: none;
}

/* a real input surface: light fill + inset hairline, so it reads as typeable */
.hero-search .input {
  width: 100%;
  border: 1px solid rgba(20, 34, 28, 0.14);
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 16px 10px 44px;
  border-radius: 999px;
  min-height: 48px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.hero-search .input::placeholder { color: #58655f; }

.hero-search .input:focus {
  outline: none;
  border-color: rgba(20, 98, 78, 0.55);
  background: #fff;
}

.hero-search:focus-within {
  box-shadow: 0 0 0 2px rgba(20, 98, 78, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hero-search .btn { border-radius: 999px; padding: 0 22px; flex: 0 0 auto; white-space: nowrap; }

body[data-page] #hero-spotlight { display: grid; align-content: center; }
body[data-page] .spotlight { height: auto; }

body[data-page] .hero .admin-tabs,
.filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px;
  margin: 0;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

body[data-page] .hero .admin-tabs::-webkit-scrollbar { display: none; }

body[data-page] .hero .tab,
.filter-row .tab {
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  min-height: 42px;
  white-space: nowrap;
  color: #2c3733;
  transition: background 240ms var(--ease-soft), color 240ms var(--ease-soft), box-shadow 240ms var(--ease-soft);
}

body[data-page] .hero .tab:hover { background: rgba(255, 255, 255, 0.6); }

body[data-page] .hero .tab.active,
.filter-row .tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: #0d2b21;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 6px 16px -12px rgba(24, 38, 32, 0.8);
}

/* --- hero spotlight: the newest listing, live from the API --- */

.spotlight {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 10px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 22px 48px -28px rgba(24, 38, 32, 0.7);
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  transition: transform 380ms var(--ease-soft), box-shadow 380ms var(--ease-soft);
}

.spotlight:hover { transform: translateY(-3px); }
.spotlight:focus-visible { outline: 3px solid #14624e; outline-offset: 3px; }

.spotlight-media {
  position: relative;
  height: 180px;
  border-radius: var(--radius-inner);
  overflow: hidden;
  background:
    radial-gradient(90% 90% at 30% 20%, rgba(255, 255, 255, 0.75), transparent 60%),
    linear-gradient(160deg, #cfdcd3, #b9c8bf);
  display: grid;
  place-items: center;
}

.spotlight-media img { width: 100%; height: 100%; object-fit: cover; }

/* no-photo placeholder: line icon + caption, shared by cards, spotlight and detail */
.media-empty {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 12px;
  color: #55655d;
  text-align: center;
}

.media-empty .media-icon {
  width: 34px;
  height: 34px;
  opacity: 0.75;
}

.media-empty span { font-size: 0.82rem; letter-spacing: 0.02em; }

.spotlight-body { display: grid; gap: 6px; padding: 8px 14px 16px; align-content: center; }
.spotlight-label { font-size: 0.78rem; letter-spacing: 0.08em; color: #46524c; }
.spotlight-title { font-size: 1.25rem; font-weight: 700; line-height: 1.25; color: #0e1a14; }
.spotlight-price { font-size: 1.05rem; font-weight: 700; letter-spacing: 0; color: #12463a; font-variant-numeric: tabular-nums; }
.spotlight-meta { font-size: 0.85rem; color: #48534d; }
.spotlight-empty { display: grid; gap: 10px; align-content: center; min-height: 240px; padding: 22px; }
.spotlight-empty strong { font-size: 1.1rem; }

/* --- product list --- */

body[data-page] #list-heading {
  max-width: 1240px;
  margin: clamp(36px, 5vw, 64px) auto 0;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: -0.02em;
}

body[data-page] #list-region { max-width: 1240px; margin: 0 auto; }

body[data-page] .grid-products {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: clamp(16px, 2.2vw, 26px);
  margin-top: 18px;
}

body[data-page] .product-card {
  gap: 0;
  padding: 8px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 16px 34px -26px rgba(24, 38, 32, 0.65);
  transition:
    transform 420ms var(--ease-soft),
    box-shadow 420ms var(--ease-soft),
    background 420ms var(--ease-soft);
}

body[data-page] .product-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 26px 48px -28px rgba(24, 38, 32, 0.75);
}

body[data-page] .product-card:active { transform: translateY(-1px) scale(0.995); }
body[data-page] .product-card:focus-visible { outline: 3px solid #14624e; outline-offset: 3px; }

body[data-page] .product-media {
  border-radius: var(--radius-inner);
  background: linear-gradient(160deg, #d6dfd8, #c3cfc7);
  max-height: 420px;
}

body[data-page] .product-body { padding: 14px 12px 12px; gap: 5px; }
body[data-page] .product-title { font-size: 1.12rem; line-height: 1.28; font-weight: 700; color: #0f1a15; }
body[data-page] .price { font-size: 1.05rem; font-weight: 700; color: #12463a; font-variant-numeric: tabular-nums; }
body[data-page] .product-meta { color: #4a544e; font-size: 0.84rem; }

body[data-page] .tag{
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 3px 10px;
  color: #2c4a3e;
  font-size: 0.8rem;
}

body[data-page] .empty {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-card);
  padding: 48px 28px;
  text-align: center;
  color: #3d4642;
}

/* --- buttons on the glass pages: press / hover / focus / loading --- */

body[data-page] .btn{
  --btn-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  border-radius: 999px;
  padding: 12px 24px;
  background: #14624e;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 22px -16px rgba(15, 60, 46, 0.9);
  transition:
    transform 110ms var(--btn-ease),
    background 150ms var(--btn-ease),
    box-shadow 150ms var(--btn-ease),
    color 150ms var(--btn-ease);
}

/* the specular edge travels 1px on hover — no glow, no flicker */
body[data-page] .btn::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 42%);
  opacity: 0.9;
  transition: transform 150ms var(--btn-ease), opacity 150ms var(--btn-ease);
}

@media (hover: hover) {
  body[data-page] .btn:hover {
    background: #0f4d3d;
    transform: translateY(-1px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 16px 28px -16px rgba(15, 60, 46, 0.95);
  }
  body[data-page] .btn:hover::after { transform: translateY(-1px); }
}

body[data-page] .btn:active{
  transform: scale(0.97);
  transition-duration: 90ms;
}

body[data-page] .btn:focus-visible{
  outline: 3px solid #0b2b21;
  outline-offset: 3px;
}

body[data-page] .btn[disabled],
body[data-page] .btn[aria-busy="true"]{
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

body[data-page] .btn.ghost{
  background: rgba(255, 255, 255, 0.62);
  color: #16211c;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

@media (hover: hover) {
  body[data-page] .btn.ghost:hover {
    background: rgba(255, 255, 255, 0.88);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 1),
      0 14px 26px -20px rgba(24, 38, 32, 0.9);
  }
}

body[data-page] .btn.small{ padding: 8px 16px; }

/* loading: label is swapped by JS, the ring rides inline before it */
body[data-page] .btn.is-loading{ opacity: 0.9; padding-right: 24px; }

.btn.is-loading::before {
  content: "";
  position: static;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: btn-spin 700ms linear infinite;
}

@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ghost buttons carry the ring on the darker stroke so it stays visible */
body[data-page] .btn.ghost.is-loading::before{ border-color: #16211c; border-top-color: transparent; }

@media (prefers-reduced-motion: reduce) {
  body[data-page] .btn,
  body[data-page] .btn::after {
    transition: background 150ms linear, color 150ms linear, box-shadow 150ms linear;
  }
  body[data-page] .btn:hover,
  body[data-page] .btn:active { transform: none; }
  .btn.is-loading::before { animation: none; border-top-color: currentColor; opacity: 0.5; }
}

/* --- product detail --- */

body[data-page] .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: clamp(16px, 3vw, 28px) 0 0;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #1d2a24;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 260ms var(--ease-soft), transform 260ms var(--ease-soft);
}

body[data-page] .back-link:hover { background: rgba(255, 255, 255, 0.78); transform: translateX(-2px); }

body[data-page] .detail {
  max-width: 1240px;
  margin: clamp(16px, 2.5vw, 26px) auto 0;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: stretch;
}

.detail-frame {
  padding: 10px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow-float);
  position: sticky;
  top: 96px;
  align-self: start;
}

body[data-page] .detail-media {
  border-radius: 22px;
  aspect-ratio: 4 / 3;
  max-height: 380px;
  background: linear-gradient(160deg, #d6dfd8, #c1cec6);
}

/* no photo: a compact placeholder instead of a column-filling block */
body[data-page] .detail-media.is-empty {
  aspect-ratio: auto;
  height: clamp(260px, 30vw, 320px);
}

.detail-panel {
  padding: clamp(24px, 3.4vw, 40px);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 30px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow-float);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
}

body[data-page] .detail-panel h1 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
  color: #101714;
}

.detail-price {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0c3327;
  font-variant-numeric: tabular-nums;
  margin: 0;
  white-space: nowrap;
}

.detail-seller {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: #35403a;
  font-size: 0.95rem;
  margin-top: 2px;
}

.seller-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.seller-monogram {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #14624e;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex: 0 0 auto;
}

.detail-section-label {
  margin: 4px 0 -8px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: #46524c;
}

.detail-desc {
  margin: 4px 0 0;
  color: #2c3733;
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 52ch;
  white-space: pre-wrap;
}

body[data-page] .detail-actions { margin-top: auto; padding-top: 8px; gap: 10px; }

/* --- entrance: one gentle rise, staggered; content stays if JS never loads --- */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  body[data-page] .hero,
  body[data-page] .detail-panel,
  body[data-page] .detail-frame {
    animation: rise-in 620ms var(--ease-soft) both;
  }
  body[data-page] .hero { animation-delay: 40ms; }
  body[data-page] .product-card { animation: rise-in 620ms var(--ease-soft) both; animation-delay: calc(90ms + var(--i, 0) * 55ms); }
  body[data-page] .detail-panel { animation-delay: 120ms; }
}

/* --- phone: glass budget = sticky header + at most one blurred surface --- */

@media (max-width: 860px) {
  body[data-page] .hero {
    grid-template-columns: 1fr;
    padding: clamp(22px, 5vw, 32px);
    gap: 22px;
    border-radius: 26px;
  }
  body[data-page] .detail { grid-template-columns: 1fr; }
  .detail-frame { position: static; }
}

/* tablet: the spotlight turns on its side so the hero doesn't grow a full-screen image */
@media (max-width: 860px) and (min-width: 721px) {
  body[data-page] .spotlight {
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: stretch;
  }
  body[data-page] .spotlight-media {
    aspect-ratio: auto;
    min-height: 170px;
    height: 100%;
  }
  body[data-page] .spotlight-body { align-content: center; padding: 6px 20px; }
  body[data-page] .spotlight-title { font-size: 1.35rem; }
}

@media (max-width: 720px) {
  /* drop blur on scrolling surfaces; keep the tint, edge and shadow */
  body[data-page] .hero {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 0.66);
  }
  body[data-page] .hero h1 { font-size: clamp(2.1rem, 9vw, 2.8rem); }
  body[data-page] .hero-copy p { max-width: none; }
  .hero-search { border-radius: 22px; flex-wrap: wrap; max-width: none; }
  .search-field { flex: 1 1 100%; }
  .hero-search .btn { flex: 1 1 100%; height: 48px; }
  body[data-page] .hero .admin-tabs { width: 100%; border-radius: 18px; }
  body[data-page] .product-card { background: rgba(255, 255, 255, 0.7); }
  body[data-page] #list-heading { margin-top: 28px; }
  .detail-panel { border-radius: 24px; padding: 22px; }
  .detail-frame { border-radius: 24px; padding: 8px; }
  body[data-page] .detail-media { border-radius: 18px; }
  body[data-page] .detail-actions .btn { flex: 1 1 100%; }
}

/* Non-supporting browsers: solid fallbacks so text never sits on a see-through box. */
@supports not (backdrop-filter: blur(1px)) {
  body[data-page] .site-head,
  body[data-page] .hero { background: rgba(255, 255, 255, 0.9); }
}

/* --- small phones: header stays one fixed-height row, never wraps --- */

@media (max-width: 480px) {
  body[data-page] .site-head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    min-height: 62px;
  }
  body[data-page] .wordmark {
    margin-right: auto;
    font-size: 1.08rem;
    flex: 0 0 auto;
  }
  body[data-page] .nav {
    order: 0;
    width: auto;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body[data-page] .nav::-webkit-scrollbar { display: none; }
  body[data-page] .nav a {
    padding: 8px 10px;
    font-size: 0.9rem;
    white-space: nowrap;
  }
  /* the page you are already on doesn't need a link */
  body[data-page] .nav a[aria-current="page"] { display: none; }
  body[data-page] .head-actions { gap: 8px; flex-wrap: nowrap; flex: 0 0 auto; }
  body[data-page] .head-actions > .muted { display: none; }
  body[data-page] .btn.small { padding: 7px 13px; font-size: 0.86rem; }
}

/* ================================================================
   Rollout: 註冊/登入、發佈/修改商品、我的商品、私訊、舉報彈窗、後台
   Same language as the home page. No business logic in this layer.
   ================================================================ */

/* --- page framing --- */

.page-head {
  max-width: 1100px;
  margin: clamp(18px, 3vw, 34px) auto 0;
  display: grid;
  gap: 8px;
}

body[data-page] .app-main > h1 {
  max-width: 1100px;
  margin: clamp(20px, 3vw, 36px) auto 12px;
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  letter-spacing: -0.03em;
  color: #101714;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  letter-spacing: -0.03em;
  color: #101714;
}

.page-sub {
  color: #3d4642;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 68ch;
  margin: 0;
  text-wrap: pretty;
}

/* --- fields: one visible input base everywhere --- */

body[data-page] .input,
body[data-page] .select,
body[data-page] .textarea {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(20, 34, 28, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 46px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9);
  transition: border-color 150ms var(--ease-soft), box-shadow 150ms var(--ease-soft), background 150ms var(--ease-soft);
}

body[data-page] .input:focus,
body[data-page] .select:focus,
body[data-page] .textarea:focus {
  outline: none;
  border-color: rgba(20, 98, 78, 0.6);
  box-shadow: 0 0 0 3px rgba(20, 98, 78, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  background: #fff;
}

body[data-page] .field label { color: #23302a; }
body[data-page] .field .hint { color: #4d5952; }

/* keep the hero search as a pill, it sits inside its own glass cluster */
body[data-page] .hero-search .input {
  border-radius: 999px;
  padding: 10px 16px 10px 44px;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.82);
}

/* --- 註冊 / 登入 --- */

.auth-shell {
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px) 0 clamp(40px, 8vw, 96px);
}

.auth-card {
  width: min(560px, 100%);
  padding: clamp(24px, 4vw, 44px);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: 32px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    var(--shadow-float);
  display: grid;
  gap: 18px;
}

.auth-card h1 { margin: 0; font-size: clamp(1.8rem, 3vw, 2.4rem); letter-spacing: -0.03em; }
.auth-card .auth-sub { margin: 0; color: #3d4642; font-size: 0.97rem; line-height: 1.6; max-width: 46ch; }

body[data-page] .auth-card .form-panel {
  background: transparent;
  padding: 0;
  max-width: none;
  display: grid;
  gap: 4px;
}

body[data-page] .auth-card .row { gap: 10px; }
body[data-page] .auth-card .btn { flex: 1 1 auto; }

@media (max-width: 560px) {
  .auth-shell { padding: 8px 0 48px; }
  .auth-card { border-radius: 24px; width: 100%; padding: 22px 18px; }
  body[data-page] .auth-card .row { flex-direction: column; align-items: stretch; }
  body[data-page] .auth-card .btn { width: 100%; justify-content: center; text-align: center; }
}

/* --- 發佈 / 修改商品 --- */

.stack { max-width: 1100px; margin: 0 auto; display: grid; gap: clamp(24px, 4vw, 44px); }

.publish-card {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: 30px;
  padding: clamp(22px, 3.4vw, 40px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    var(--shadow-float);
}

.publish-card > h2 { margin: 0 0 18px; font-size: clamp(1.25rem, 2vw, 1.6rem); }

.form-group {
  border: 0;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 14px;
}

.form-group > legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  color: #46524c;
  font-weight: 600;
}

.form-group .field { margin-bottom: 0; }

/* desktop: the publish form runs in two columns so it doesn't become a 1100px-wide column of inputs */
@media (min-width: 861px) {
  .publish-card #product-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 30px;
    align-items: start;
  }
  .publish-card #product-form .form-group:nth-of-type(3) { grid-column: 1 / -1; }
  .publish-card #product-form .form-actions { grid-column: 1 / -1; margin-top: 4px; }
}

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 720px) {
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
}

/* image dropzone */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 148px;
  padding: 20px;
  border: 2px dashed rgba(20, 98, 78, 0.3);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
  color: #3f5148;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms var(--ease-soft), background 150ms var(--ease-soft);
}

.dropzone:hover, .dropzone:focus-within {
  border-color: rgba(20, 98, 78, 0.55);
  background: rgba(255, 255, 255, 0.72);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone input[type="file"]:focus-visible + .dropzone-face { outline: 3px solid #0b2b21; outline-offset: 3px; }

.dropzone-face { display: grid; place-items: center; gap: 8px; pointer-events: none; }
.dropzone-face svg { width: 26px; height: 26px; opacity: 0.8; }
.dropzone-face strong { font-weight: 600; font-size: 0.95rem; }
.dropzone-face span { font-size: 0.84rem; color: #4d5952; }

.preview-thumb {
  margin-top: 12px;
  max-height: 180px;
  width: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px -18px rgba(24, 38, 32, 0.8);
}

/* --- 我的商品 --- */

.my-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: clamp(14px, 2vw, 22px);
  margin-top: 14px;
}

.my-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 14px 30px -26px rgba(24, 38, 32, 0.7);
}

.my-media {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, #d6dfd8, #c3cfc7);
  display: grid;
  place-items: center;
  text-decoration: none;
}

.my-media img { width: 100%; height: 100%; object-fit: cover; }
.my-media .media-empty { padding: 6px; gap: 4px; }
.my-media .media-icon { width: 22px; height: 22px; }
.my-media .media-empty span { font-size: 0.68rem; }

.my-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.my-title { font-weight: 700; font-size: 1rem; color: #101a15; text-decoration: none; line-height: 1.3; }
.my-title:hover { text-decoration: underline; }
.my-price { font-weight: 700; color: #12463a; font-size: 0.98rem; font-variant-numeric: tabular-nums; }
.my-meta { font-size: 0.82rem; color: #4a544e; }
.my-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.my-actions .btn { min-height: 44px; }

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

/* --- 私訊 --- */

body[data-page="chat"] .chat-shell {
  max-width: 1180px;
  margin: 0 auto;
  gap: 18px;
}

body[data-page="chat"] .conv-list {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  padding: 8px;
}

body[data-page="chat"] .conv-item {
  border-radius: 14px;
  padding: 12px 14px;
  transition: background 150ms var(--ease-soft);
}

body[data-page="chat"] .conv-item:hover { background: rgba(255, 255, 255, 0.8); }
body[data-page="chat"] .conv-item.active {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 #fff, 0 8px 18px -16px rgba(24, 38, 32, 0.9);
}

body[data-page="chat"] .chat-panel {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  overflow: hidden;
  min-height: 64vh;
}

/* glass only on the thin top bar and the composer, never on the message list */
body[data-page="chat"] .chat-head {
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255, 255, 255, 0.7);
  padding: 12px 16px;
}

body[data-page="chat"] .messages { background: transparent; }

body[data-page="chat"] .chat-form {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  padding: 12px;
}

body[data-page="chat"] .chat-form .input { border-radius: 999px; }

body[data-page="chat"] .msg {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 10px 14px;
  max-width: 74%;
}

body[data-page="chat"] .msg.mine {
  background: #14624e;
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

body[data-page="chat"] .msg .meta,
body[data-page="chat"] .msg .edited { color: #57635c; font-size: 0.74rem; }
body[data-page="chat"] .msg.mine .meta,
body[data-page="chat"] .msg.mine .edited { color: rgba(255, 255, 255, 0.78); }

body[data-page="chat"] .msg.recalled { background: rgba(255, 255, 255, 0.55); color: #4f5a54; font-style: normal; }
body[data-page="chat"] .msg.mine.recalled .meta,
body[data-page="chat"] .msg.mine.recalled .edited { color: #57635c; }

.chat-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.7);
  color: #16211c;
  cursor: pointer;
  flex: 0 0 auto;
}

@media (max-width: 860px) {
  body[data-page="chat"] .chat-shell { grid-template-columns: 1fr; gap: 12px; }
  body[data-page="chat"] .conv-list { max-height: none; }
  body[data-page="chat"] .chat-shell.has-active .conv-list { display: none; }
  body[data-page="chat"] .chat-shell:not(.has-active) .chat-panel { display: none; }
  body[data-page="chat"] .chat-back { display: inline-flex; }
  body[data-page="chat"] .chat-head { gap: 10px; }
  body[data-page="chat"] .chat-head strong { flex: 1 1 auto; }
  body[data-page="chat"] .messages { max-height: 60vh; }
}

/* --- 舉報彈窗 --- */

body[data-page] .dialog-backdrop {
  background: rgba(14, 24, 19, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body[data-page] .dialog {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  padding: clamp(20px, 3vw, 30px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 30px 60px -30px rgba(12, 24, 18, 0.7);
}

body[data-page] .dialog h2 { margin: 0 0 6px; font-size: 1.35rem; letter-spacing: -0.02em; }

/* the edit-product dialog is a full form: wider, two columns on desktop */
body[data-page] .dialog.dialog-wide { width: min(760px, 100%); }

@media (min-width: 720px) {
  body[data-page] .dialog.dialog-wide .dialog-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px 26px;
    align-items: start;
  }
  body[data-page] .dialog.dialog-wide .form-group { margin-bottom: 14px; }
  body[data-page] .dialog.dialog-wide .form-group:nth-of-type(3) { grid-column: 1 / -1; }
  body[data-page] .dialog.dialog-wide .form-group:nth-of-type(3) .dropzone { min-height: 118px; }
  body[data-page] .dialog.dialog-wide .dialog-actions { grid-column: 1 / -1; margin-top: 6px; }
}

.report-form, .dialog-form { display: grid; gap: 16px; margin-top: 10px; }

.reason-group { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.reason-group > legend { padding: 0; font-size: 0.88rem; color: #46524c; font-weight: 600; margin-bottom: 2px; }

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

.reason {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(20, 34, 28, 0.12);
  cursor: pointer;
  transition: background 150ms var(--ease-soft), border-color 150ms var(--ease-soft);
}

.reason input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.reason span { font-size: 0.97rem; color: #1b2620; }

.reason:hover { background: rgba(255, 255, 255, 0.85); }

.reason:has(input:checked) {
  background: rgba(20, 98, 78, 0.1);
  border-color: rgba(20, 98, 78, 0.5);
}

.reason:has(input:focus-visible) { outline: 3px solid #0b2b21; outline-offset: 2px; }

.dialog-actions { display: flex; gap: 10px; margin-top: 4px; }
.dialog-actions .btn { flex: 1 1 0; }

@media (max-width: 480px) {
  .dialog-actions { flex-direction: column-reverse; }
}

/* --- 後台：轻量，表格保持密度，不加玻璃、不做动画 --- */

body[data-page="admin"] .stat-row { gap: 24px; margin: 20px 0 10px; }

body[data-page="admin"] .stat {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 18px;
  padding: 14px 18px;
  min-width: 148px;
}

body[data-page="admin"] .stat .num { color: #0f3f30; }

body[data-page="admin"] .admin-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.75);
  margin: 18px 0 22px;
  overflow-x: auto;
}

body[data-page="admin"] .admin-tabs .tab {
  border-radius: 999px;
  background: transparent;
  padding: 8px 16px;
  min-height: 40px;
  transition: background 150ms var(--ease-soft), color 150ms var(--ease-soft);
}

body[data-page="admin"] .admin-tabs .tab.active {
  background: rgba(255, 255, 255, 0.95);
  color: #0d2b21;
}

body[data-page="admin"] .report-row {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 12px;
}

body[data-page="admin"] .snapshot {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  border: 1px solid rgba(20, 34, 28, 0.08);
}

body[data-page="admin"] .table {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  overflow: hidden;
  animation: none;
}

body[data-page="admin"] .report-actions .btn,
body[data-page="admin"] .table .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body[data-page="admin"] .table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.45); }
body[data-page="admin"] .table tbody tr { animation: none; }

/* admin on a phone keeps the existing stacked-card table, untouched */
@media (max-width: 720px) {
  body[data-page="admin"] .table { background: transparent; border-radius: 0; }
  body[data-page="admin"] .table tr { border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.8); }
}
