:root {
  color-scheme: light;
  --ink: #292421;
  --muted: #756963;
  --paper: #f6f0e9;
  --card: #fffdf9;
  --line: #dfd2c7;
  --accent: #9b5648;
  --accent-soft: #f5dfd7;
  --safe: #27644b;
  --shadow: 0 24px 70px rgba(74, 52, 42, .10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Noto Sans TC", sans-serif; }
button, a, input, select, textarea { font: inherit; }

.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); border-bottom: 1px solid rgba(117, 105, 99, .18); background: rgba(246, 240, 233, .88); backdrop-filter: blur(18px); }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); font-family: Georgia, "Noto Serif TC", serif; font-size: 18px; font-weight: 700; text-decoration: none; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font: 700 9px/1.2 ui-monospace, monospace; letter-spacing: .16em; }
.brand-mark { display: grid; width: 40px; aspect-ratio: 1; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font: 700 12px/1 ui-monospace, monospace; letter-spacing: .08em; }
.environment { display: flex; gap: 9px; align-items: center; padding: 9px 13px; border: 1px solid #afcdbf; border-radius: 999px; background: #eff8f3; color: var(--safe); font-size: 13px; font-weight: 750; }
.environment i { width: 8px; height: 8px; border-radius: 50%; background: #3aa275; box-shadow: 0 0 0 5px rgba(58, 162, 117, .13); }

main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 64px; align-items: end; min-height: 630px; padding: 90px 0 70px; }
.eyebrow { margin: 0 0 20px; color: var(--accent); font: 800 12px/1.2 ui-monospace, monospace; letter-spacing: .16em; }
h1 { max-width: 900px; margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(52px, 7.4vw, 104px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
h1 em { color: var(--accent); font-weight: 500; }
.lead { max-width: 760px; margin: 30px 0 0; color: var(--muted); font-size: clamp(17px, 2vw, 22px); line-height: 1.8; }
.safety-card { display: flex; gap: 18px; align-items: flex-start; padding: 24px; border: 1px solid #b6cfc3; border-radius: 26px; background: rgba(240, 249, 244, .72); }
.shield { display: grid; flex: 0 0 40px; aspect-ratio: 1; place-items: center; border-radius: 14px; background: var(--safe); color: #fff; font-weight: 900; }
.safety-card strong { font-size: 16px; }
.safety-card p { margin: 7px 0 0; color: #587065; font-size: 14px; line-height: 1.65; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: rgba(255, 253, 249, .65); box-shadow: var(--shadow); }
.metrics article { min-height: 155px; padding: 25px 28px; border-right: 1px solid var(--line); }
.metrics article:last-child { border-right: 0; }
.metrics span { display: block; color: var(--muted); font-size: 13px; }
.metrics strong { display: block; margin: 12px 0 17px; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(28px, 4vw, 45px); font-weight: 500; letter-spacing: -.04em; }
.metrics small { color: var(--accent); font: 750 10px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.announcement-banner { margin: -34px 0 44px; padding: 16px 20px; border: 1px solid #dcbcaf; border-radius: 16px; background: var(--accent-soft); color: #743f35; font-weight: 750; line-height: 1.65; text-align: center; }
.store-content { padding: 90px 0 15px; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 32px; }
.business-hours { display: grid; gap: 1px; }
.business-hours p { display: flex; justify-content: space-between; margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.business-hours p:last-child { border-bottom: 0; }
.business-hours strong { color: var(--ink); }
.news-item { padding: 2px 0 15px; border-bottom: 1px solid var(--line); }
.news-item:last-child { padding-bottom: 0; border-bottom: 0; }
.news-item p { margin: 7px 0; color: var(--muted); line-height: 1.65; white-space: pre-wrap; }
.news-item a { color: var(--accent); font-size: 13px; font-weight: 750; }

.catalog { padding: 120px 0 90px; }
.section-heading { display: flex; gap: 40px; align-items: end; justify-content: space-between; }
.section-heading h2 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(38px, 5vw, 66px); font-weight: 500; letter-spacing: -.04em; }
.section-heading > p { max-width: 460px; margin: 0; color: var(--muted); line-height: 1.7; }
.categories { display: flex; gap: 9px; overflow-x: auto; margin: 38px 0 30px; padding: 2px 0 10px; scrollbar-width: thin; }
.categories button { flex: 0 0 auto; padding: 11px 17px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.categories button:hover, .categories button:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.categories button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.catalog-state { display: flex; gap: 16px; align-items: center; justify-content: center; min-height: 170px; padding: 28px; border: 1px dashed var(--line); border-radius: 24px; color: var(--muted); text-align: center; }
.catalog-state[hidden] { display: none; }
.catalog-state button { padding: 9px 14px; border: 1px solid var(--ink); border-radius: 99px; background: var(--ink); color: #fff; cursor: pointer; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.product-card { overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--card); box-shadow: 0 14px 45px rgba(65, 44, 34, .06); }
.media { position: relative; display: grid; min-height: 300px; overflow: hidden; place-items: center; background: linear-gradient(145deg, #ecd8cb, #f6ebe2 55%, #d9c1b4); }
.media-fallback { color: rgba(87, 59, 47, .25); font: 900 13px/1 ui-monospace, monospace; letter-spacing: .2em; }
.media img { position: absolute; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.product-card:hover .media img { transform: scale(1.035); }
.product-body { padding: 25px; }
.product-category { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 750; }
.product-card h3 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: 25px; font-weight: 600; line-height: 1.35; }
.description { display: -webkit-box; min-height: 47px; margin: 12px 0 18px; overflow: hidden; color: var(--muted); font-size: 14px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.price { font-family: Georgia, serif; font-size: 24px; color: var(--ink); }
.variants { display: grid; gap: 7px; max-height: 152px; margin: 20px 0; padding: 0; overflow-y: auto; list-style: none; }
.variants li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 11px; border-radius: 10px; background: #f7f2ed; color: var(--muted); font-size: 12px; }
.variants li > span { flex: 1; }
.variants strong { font-size: 11px; }
.in-stock { color: var(--safe); }
.sold-out { color: #a04d44; }
.product-body > button { width: 100%; padding: 12px; border: 1px solid #ded4cb; border-radius: 12px; background: #f1ece7; color: #978b84; cursor: not-allowed; }
.operations { padding: 60px 0 90px; }
.operation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 36px; }
.compact-top { margin-top: 24px; }
.panel { padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 14px 45px rgba(65, 44, 34, .05); }
.panel h3 { margin: 0 0 18px; font-family: Georgia, "Noto Serif TC", serif; font-size: 26px; }
.stack { display: grid; gap: 13px; }
.stack label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 3px solid rgba(155, 86, 72, .12); }
button.primary, button.secondary, button.tiny { border-radius: 11px; cursor: pointer; }
button.primary { padding: 13px 16px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 750; }
button.secondary { padding: 10px 13px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
button.tiny { flex: 0 0 auto; padding: 6px 9px; border: 1px solid var(--accent); background: #fff; color: var(--accent); font-size: 11px; }
button.danger { border-color: #b65b51; color: #9a4038; }
button:disabled { opacity: .48; cursor: not-allowed; }
.muted { color: var(--muted); }
.cart-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.total-line { display: flex; justify-content: space-between; margin: 24px 0; font-size: 18px; }
.form-state { min-height: 22px; margin: 0; color: var(--safe); font-size: 13px; line-height: 1.6; }
.form-state.error, .error { color: #9a4038; }
.status-pill { width: fit-content; padding: 8px 12px; border-radius: 999px; background: #eff8f3; color: var(--safe); font-weight: 800; }
.notice { padding: 14px; border-left: 4px solid var(--accent); border-radius: 6px 12px 12px 6px; background: var(--accent-soft); line-height: 1.65; }
.detail-list { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: var(--muted); }
.segment-line { margin: 0; padding: 10px 12px; border-radius: 10px; background: #f7f2ed; }
.admin-main { padding-bottom: 100px; }
.admin-intro { padding: 90px 0 55px; }
.admin-intro h1 { font-size: clamp(48px, 6vw, 84px); }
.admin-login { max-width: 520px; margin-bottom: 90px; }
.admin-toolbar { display: flex; gap: 24px; align-items: center; justify-content: space-between; margin: 20px 0 30px; }
.admin-toolbar p { margin: 6px 0 0; }
.toolbar-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.orders-list { display: grid; gap: 24px; }
.order-admin-card { display: grid; gap: 20px; }
.order-admin-heading, .segment-heading { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; }
.order-admin-heading h3 { margin-bottom: 4px; }
.order-admin-heading p { margin: 0; }
.segment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.segment-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #f8f3ee; }
.segment-card p { margin: 9px 0; font-size: 13px; line-height: 1.6; }
.inline-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 10px; align-items: center; }
.shipment-form { grid-template-columns: minmax(150px, .7fr) minmax(180px, 1fr) auto; }
.admin-nav { position: sticky; z-index: 10; top: 76px; display: flex; gap: 8px; overflow-x: auto; margin: 0 0 34px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 249, .94); box-shadow: 0 10px 35px rgba(65, 44, 34, .07); backdrop-filter: blur(16px); }
.admin-nav button { flex: 0 0 auto; padding: 10px 15px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.admin-nav button:hover, .admin-nav button:focus-visible { border-color: var(--line); color: var(--ink); outline: none; }
.admin-nav button.active { background: var(--ink); color: #fff; }
.admin-view { display: grid; gap: 24px; }
.admin-view[hidden] { display: none; }
.view-heading { display: flex; gap: 24px; align-items: end; justify-content: space-between; }
.view-heading .eyebrow { margin-bottom: 9px; }
.view-heading h2 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(32px, 4vw, 54px); font-weight: 500; letter-spacing: -.035em; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.admin-form-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.compact-form { align-content: start; }
.two-fields, .three-fields { display: grid; gap: 10px; }
.two-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-fields label, .three-fields label, .media-toolbar label, .admin-wide-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.check-line { display: flex !important; gap: 8px !important; align-items: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.check-line input { width: auto; }
.form-hint { margin: 0; font-size: 12px; }
.admin-data-stack { display: grid; gap: 20px; }
.table-scroll { max-width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { min-width: 95px; padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--muted); font-size: 11px; letter-spacing: .06em; white-space: nowrap; }
.admin-table td:first-child { min-width: 170px; font-weight: 700; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table input { min-width: 90px; padding: 8px; }
.media-toolbar { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.media-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.media-admin-card { display: grid; gap: 12px; align-content: start; }
.media-admin-card > img { width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; background: #f2ebe4; object-fit: cover; }
.media-admin-card p { margin: 0; font-size: 12px; }
.filter-bar { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) auto; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 253, 249, .7); }
.admin-wide-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; align-items: end; }
.admin-wide-form h3, .admin-wide-form .wide-field, .admin-wide-form .row-actions { grid-column: 1 / -1; }
.hours-grid { display: grid; gap: 8px; }
.hours-row { display: grid; grid-template-columns: minmax(85px, .7fr) minmax(85px, .7fr) 1fr 1fr; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.hours-row:last-child { border-bottom: 0; }
.log-card { display: grid; gap: 12px; }
.log-card p { margin: 0; }
.log-detail { max-height: 240px; margin: 0; padding: 14px; overflow: auto; border-radius: 12px; background: #292421; color: #f9eee6; font: 12px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-open { background: #fff0ed; color: #9a4038; }
footer { display: flex; gap: 24px; justify-content: space-between; width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 45px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer a { color: var(--accent); }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 100px; }
  .safety-card { max-width: 560px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .operation-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .segment-grid { grid-template-columns: 1fr; }
  .media-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .media-toolbar, .admin-wide-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-wide-form h3, .admin-wide-form .wide-field, .admin-wide-form .row-actions { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  main { width: min(100% - 28px, 1240px); }
  .topbar { min-height: 68px; padding-inline: 14px; }
  .environment { padding: 8px 10px; font-size: 11px; }
  .hero { gap: 38px; padding: 68px 0 50px; }
  h1 { font-size: clamp(46px, 15vw, 68px); }
  .metrics { grid-template-columns: 1fr 1fr; border-radius: 20px; }
  .metrics article { min-height: 130px; padding: 20px; }
  .catalog { padding-top: 85px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 20px; }
  .product-grid { grid-template-columns: 1fr; }
  .media { min-height: 340px; }
  .admin-toolbar, .order-admin-heading { align-items: stretch; flex-direction: column; }
  .inline-form, .shipment-form { grid-template-columns: 1fr; }
  .admin-nav { top: 68px; margin-inline: -4px; }
  .view-heading { align-items: stretch; flex-direction: column; }
  .admin-form-grid, .media-admin-grid, .media-toolbar, .admin-wide-form, .two-fields, .three-fields, .filter-bar { grid-template-columns: 1fr; }
  .admin-form-grid > :last-child:nth-child(odd), .admin-wide-form h3, .admin-wide-form .wide-field, .admin-wide-form .row-actions { grid-column: auto; }
  .hours-row { grid-template-columns: 1fr 1fr; }
  .hours-row strong { grid-column: 1 / -1; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
