:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e7eb;
  --primary: #111827;
  --primary-hover: #000000;
  --accent: #16a34a;
  --accent-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
}

.page {
  padding: 24px 0 48px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 22px;
  white-space: nowrap;
}

.logo span {
  color: var(--accent);
}

.header-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.header-search input,
.search-box input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0 16px;
  outline: none;
}

.header-search input:focus,
.search-box input:focus,
.form-control:focus {
  border-color: var(--text);
  background: var(--surface);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.mobile-menu-btn {
  display: none;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 650;
  transition: 0.15s ease;
  text-align: center;
}

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

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}

.btn-full {
  width: 100%;
}

.hero {
  padding: 40px 0 22px;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.hero h1 {
  max-width: 680px;
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.hero p {
  max-width: 650px;
  margin: 0 0 24px;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 18px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.chip.active,
.chip:hover {
  color: var(--text);
  border-color: var(--text);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.card,
.product-card,
.form-card,
.notice-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.product-card {
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover {
  transform: translateY(-2px);
}

.product-image {
  position: relative;
  aspect-ratio: 1 / 0.78;
  background: var(--surface-2);
  overflow: hidden;
}

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

.product-body {
  padding: 12px;
}

.product-title {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.product-meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.badge-success {
  background: var(--accent-soft);
  color: #166534;
  border-color: #bbf7d0;
}

.badge-warning {
  background: var(--warning-soft);
  color: #92400e;
  border-color: #fde68a;
}

.badge-danger {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: #fecaca;
}

.product-image .badge {
  position: absolute;
  top: 10px;
  left: 10px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.detail-gallery,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.detail-gallery img {
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  background: var(--surface-2);
}

.detail-panel {
  padding: 22px;
}

.detail-title {
  margin: 0 0 8px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.detail-price {
  font-size: 30px;
  font-weight: 850;
  letter-spacing: -0.05em;
  margin: 12px 0;
}

.meta-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.meta-row span:first-child {
  color: var(--muted);
}

.action-stack {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.description {
  margin-top: 18px;
  color: var(--text);
}

.form-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 22px;
}

.form-title {
  margin: 0 0 18px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

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

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  outline: none;
}

textarea.form-control {
  min-height: 130px;
  resize: vertical;
}

.help-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.alert,
.notice-card {
  padding: 14px 16px;
}

.alert-info {
  background: var(--info-soft);
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
}

.alert-warning {
  background: var(--warning-soft);
  color: #78350f;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
}

.status-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.status-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.status-step.active {
  background: var(--accent-soft);
  color: #166534;
  border-color: #bbf7d0;
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  background: var(--surface-2);
  font-size: 13px;
  color: var(--muted);
}

.auth-page {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.auth-card {
  width: min(100%, 440px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.05em;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  color: var(--muted);
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.disclaimer {
  color: var(--muted);
  max-width: 980px;
}

.hide-desktop {
  display: none;
}

@media (max-width: 920px) {
  .header-search {
    display: none;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .header-actions .btn-secondary {
    display: none;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .container {
    width: min(100% - 24px, var(--container));
  }

  .page {
    padding-top: 16px;
  }

  .header-inner {
    min-height: 62px;
    gap: 10px;
  }

  .logo {
    font-size: 20px;
  }

  .hero {
    padding-top: 20px;
  }

  .hero-card {
    padding: 20px;
    border-radius: 22px;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .product-body {
    padding: 10px;
  }

  .product-title {
    font-size: 14px;
  }

  .product-price {
    font-size: 16px;
  }

  .detail-panel,
  .form-card,
  .auth-card {
    padding: 18px;
    border-radius: 20px;
  }

  .status-stepper {
    grid-template-columns: 1fr 1fr;
  }

  .hide-mobile {
    display: none;
  }

  .hide-desktop {
    display: inline-flex;
  }

  .btn {
    padding-left: 13px;
    padding-right: 13px;
  }
}

/* PHP app compatibility layer */
.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.language-switcher a {
  min-width: 34px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.language-switcher a.active {
  background: var(--primary);
  color: #fff;
}

.site-nav.is-open {
  display: flex;
}

.btn:not(.btn-secondary):not(.btn-danger):not(.btn-ghost),
button:not(.mobile-menu-btn) {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn:not(.btn-secondary):not(.btn-danger):not(.btn-ghost):hover,
button:not(.mobile-menu-btn):hover {
  background: var(--primary-hover);
}

.btn-small {
  min-height: 38px;
}

.muted,
.meta {
  color: var(--muted);
}

.hero {
  padding: 0;
}

.hero:not(.hero-card) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.hero h1 {
  max-width: 680px;
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 18px;
}

.search-form select {
  min-width: 190px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--text);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-card {
  display: grid;
  gap: 16px;
}

.form-card h1,
.panel h1 {
  margin-top: 0;
  letter-spacing: -0.04em;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-card-body {
  padding: 12px;
}

.product-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.product-card > img,
.product-card > a > img {
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  background: var(--surface-2);
}

.price {
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.detail-image {
  width: 100%;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: var(--surface-2);
}

.order-summary {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: start;
}

.order-summary img {
  width: 160px;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.list-row img {
  width: 72px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.list-row small {
  display: block;
  color: var(--muted);
}

.message-row {
  grid-template-columns: minmax(150px, 0.8fr) 1fr auto;
}

.message-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.message {
  max-width: 760px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.message-own {
  margin-left: auto;
  background: var(--accent-soft);
  border-color: #bbf7d0;
}

.message p {
  margin: 6px 0;
}

.message small {
  color: var(--muted);
}

.safety-notice {
  margin-top: 24px;
}

.safety-notice p {
  margin: 4px 0 0;
  color: var(--muted);
}

.alert-success {
  background: var(--accent-soft);
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
}

.alert-danger {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 920px) {
  .site-nav {
    display: none;
    width: 100%;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 14px;
  }

  .site-nav .btn {
    justify-content: flex-start;
  }

  .site-nav.is-open .btn-secondary {
    display: inline-flex;
  }
}

@media (max-width: 680px) {
  .hero:not(.hero-card) {
    padding: 20px;
    border-radius: 22px;
  }

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

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid,
  .order-summary,
  .list-row,
  .message-row {
    grid-template-columns: 1fr;
  }

  .order-summary img,
  .list-row img {
    width: 100%;
  }
}
