:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #14212b;
  --muted: #5b6875;
  --line: #dce4ea;
  --primary: #0f6f78;
  --primary-strong: #0a535b;
  --accent: #2b7de9;
  --ok: #2f7d4f;
  --warn: #a15c08;
  --shadow: 0 16px 40px rgba(20, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 111, 120, 0.13), transparent 34rem),
    linear-gradient(180deg, rgba(43, 125, 233, 0.09), transparent 22rem),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 1rem;
}

.brand-block {
  display: grid;
  gap: 0.7rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
}

.brand-lockup strong,
.footer-brand strong {
  display: block;
  line-height: 1.1;
}

.brand-lockup small,
.footer-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
}

.brand-mark img {
  width: 1.9rem;
  height: 1.9rem;
  object-fit: contain;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1;
}

.header-copy {
  max-width: 35rem;
  margin-bottom: 0;
}

h2 {
  margin-bottom: 0.35rem;
  font-size: 1.55rem;
}

h3 {
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

p {
  color: var(--muted);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 2.5rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(5rem, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.tab,
.ghost-button,
.primary-button {
  min-height: 2.6rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.tab {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.is-active {
  background: var(--primary);
  color: white;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(161, 92, 8, 0.25);
  border-radius: 8px;
  background: rgba(255, 247, 222, 0.9);
  color: #6f430a;
}

.notice.is-connected {
  border-color: rgba(47, 125, 79, 0.25);
  background: rgba(233, 248, 239, 0.92);
  color: #255d3d;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin: 1.2rem 0;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.product-card,
.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.product-card {
  overflow: hidden;
}

.product-art {
  display: grid;
  min-height: 8rem;
  place-items: center;
  color: white;
  font-size: 2.6rem;
  font-weight: 800;
}

.product-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--line);
}

.product-body {
  padding: 1rem;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0 1rem;
}

.price {
  font-size: 1.2rem;
  font-weight: 800;
}

.deadline {
  color: var(--muted);
  font-size: 0.88rem;
}

.qty-control {
  display: grid;
  grid-template-columns: 2.5rem 1fr 2.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.qty-control button {
  min-height: 2.5rem;
  border: 0;
  background: var(--surface-strong);
  color: var(--primary);
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 800;
}

.qty-control input {
  width: 100%;
  border: 0;
  border-inline: 1px solid var(--line);
  text-align: center;
  font-weight: 800;
}

.panel {
  margin-top: 1rem;
  padding: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 0.8rem;
}

.order-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(7rem, 1fr)) minmax(10rem, auto);
  gap: 1rem;
  align-items: end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.order-summary span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.order-summary strong,
.metric strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.45rem;
}

.primary-button {
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 0 1rem;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--primary);
  font-weight: 800;
  padding: 0 0.9rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--line);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-brand img {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0.35rem;
  border-radius: 8px;
  background: var(--primary);
}

.site-footer a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.admin-login {
  display: grid;
  gap: 1rem;
  max-width: 28rem;
}

.admin-content.is-locked {
  display: none;
}

.metric {
  padding: 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.8fr);
  gap: 1rem;
}

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

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

th,
td {
  padding: 0.75rem 0.55rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
}

.status {
  display: inline-block;
  min-width: 4.8rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
}

.status.pending {
  background: #fff0cc;
  color: var(--warn);
}

.status.confirmed {
  background: #dff2e5;
  color: var(--ok);
}

.status.unpaid {
  background: #f4dfd8;
  color: var(--accent);
}

.payment-list {
  display: grid;
  gap: 0.75rem;
}

.payment-row {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.payment-row header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.payment-row p {
  margin: 0;
  font-size: 0.9rem;
}

.payment-actions {
  display: flex;
  gap: 0.5rem;
}

.small-button {
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 0.7rem;
}

.small-button.confirm {
  background: var(--ok);
  color: white;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  transform: translateY(5rem);
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: #1f2933;
  color: white;
  opacity: 0;
  transition: 180ms ease;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 760px) {
  .app-header,
  .section-head,
  .payment-row header,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    align-items: stretch;
  }

  .tabs,
  .form-grid,
  .order-summary,
  .metrics,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .catalog {
    grid-template-columns: 1fr;
  }
}
