:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8e0ea;
  --paper: #f8fafc;
  --panel: #ffffff;
  --brand: #0891b2;
  --brand-dark: #0e7490;
  --accent: #f97316;
  --success: #16a34a;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.18), transparent 34rem),
    linear-gradient(135deg, #f8fafc 0%, #eef6f8 45%, #fff7ed 100%);
  color: var(--ink);
  font-family:
    "Pretendard",
    "Noto Sans KR",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

.affiliate-ticker {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  background: #111827;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  min-width: 200%;
  animation: ticker 28s linear infinite;
}

.ticker-track span {
  padding: 0.72rem 2rem;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.site-header {
  position: sticky;
  top: 2.7rem;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(216, 224, 234, 0.9);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand), #111827);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(8, 145, 178, 0.24);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.1rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.86rem;
}

.top-nav {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.32rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

[hidden] {
  display: none !important;
}

.nav-button,
.category-pill {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.nav-button {
  padding: 0.7rem 1rem;
}

.nav-button.active,
.category-pill.active {
  background: #111827;
  color: #fff;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.4rem);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.login-panel {
  width: min(440px, 100%);
  margin: clamp(2rem, 10vh, 7rem) auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0;
  font-size: 1.8rem;
}

.login-panel p:not(.eyebrow) {
  margin: 0.7rem 0 1.25rem;
  color: var(--muted);
  line-height: 1.65;
}

.login-panel .primary-button {
  width: 100%;
  margin-top: 1rem;
}

.logout-button {
  color: #b91c1c;
}

.notice-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(8, 145, 178, 0.13), transparent),
    rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.notice-panel h1,
.admin-sidebar h1 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.notice-panel h1 {
  font-size: clamp(0.825rem, 2vw, 1.7rem);
}

.admin-sidebar h1 {
  font-size: clamp(1.65rem, 4vw, 3.4rem);
}

.notice-panel > p {
  margin: 0;
  align-self: center;
  padding: 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--brand-dark);
  font-weight: 900;
  font-size: 0.86rem;
}

.shop-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.25rem;
}

.guest-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.info-card {
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  padding: 1.1rem;
}

.info-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.18rem;
}

.info-disclosure {
  align-self: start;
}

.info-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.info-disclosure summary::-webkit-details-marker {
  display: none;
}

.info-disclosure summary::after {
  content: "+";
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--brand-dark);
  font-size: 1.25rem;
  font-weight: 900;
}

.info-disclosure[open] summary::after {
  content: "−";
}

.info-disclosure summary h2 {
  margin: 0;
}

.disclosure-content {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.info-card p {
  margin: 0;
  color: #334155;
  line-height: 1.75;
}

.contact-line {
  margin-top: 0.8rem !important;
  color: var(--brand-dark) !important;
  font-weight: 900;
}

.feedback-card {
  grid-column: 1 / -1;
}

.feedback-form > .form-help {
  margin: 0;
}

.category-rail {
  position: sticky;
  top: 8.2rem;
  align-self: start;
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
}

#guestCategories {
  display: grid;
  gap: 0.55rem;
}

.category-pill {
  width: 100%;
  padding: 0.82rem 1rem;
  text-align: left;
  background: #f1f5f9;
}

.section-heading,
.panel-title,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2,
.panel-title h2 {
  margin: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.product-card {
  overflow: hidden;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.13);
}

.product-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #dbeafe;
}

.product-body {
  padding: 1rem;
}

.product-category {
  color: var(--brand-dark);
  font-size: 0.84rem;
  font-weight: 900;
}

.product-name {
  min-height: 3.2rem;
  margin: 0.35rem 0 0.85rem;
  font-size: 1.05rem;
  line-height: 1.45;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.sale-price {
  color: #dc2626;
  font-size: 1.25rem;
  font-weight: 900;
}

.regular-price {
  color: var(--muted);
  text-decoration: line-through;
}

.select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.select-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-weight: 800;
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.75rem 1rem;
  font-weight: 900;
}

.primary-button {
  background: var(--brand);
  color: white;
}

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

.secondary-button {
  background: #111827;
  color: white;
}

.ghost-button {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

.admin-shell {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
}

.admin-sidebar,
.panel {
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.admin-sidebar {
  position: sticky;
  top: 8.2rem;
  align-self: start;
  padding: 1.25rem;
}

.admin-sidebar p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.metric-stack {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.metric-stack div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.metric-stack strong {
  font-size: 1.35rem;
}

.metric-stack span {
  color: var(--muted);
  font-weight: 800;
}

.admin-content {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

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

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 0.42rem;
  color: #334155;
  font-weight: 900;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.check-label input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0.78rem 0.85rem;
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

.image-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.form-help {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.button-row {
  display: inline-flex;
  gap: 0.5rem;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.table-controls input {
  min-width: min(260px, 100%);
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

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

.data-table th,
.data-table td {
  padding: 0.72rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.94rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  color: #334155;
  font-weight: 900;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table input[type="text"] {
  min-width: 220px;
}

.data-table input[type="checkbox"] {
  width: auto;
}

.benefit-cell {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.admin-list,
.customer-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.feedback-message {
  display: block;
  margin-top: 0.35rem;
  color: #334155;
  line-height: 1.55;
}

.admin-item,
.customer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.admin-item strong,
.customer-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.admin-item small,
.customer-item small {
  color: var(--muted);
}

.item-actions {
  display: inline-flex;
  gap: 0.45rem;
}

.item-actions button,
.icon-button {
  display: inline-grid;
  min-width: 2.25rem;
  min-height: 2.25rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.checkout-dialog {
  width: min(560px, calc(100vw - 2rem));
  border: 0;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.checkout-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.checkout-items {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.checkout-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem;
  border-radius: var(--radius);
  background: #f1f5f9;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

.empty-state {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.64);
}

@media (max-width: 900px) {
  .site-header,
  .section-heading,
  .panel-title,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    top: 2.65rem;
  }

  .top-nav,
  .button-row {
    width: 100%;
  }

  .top-nav button,
  .button-row button {
    flex: 1;
  }

  .notice-panel,
  .shop-layout,
  .guest-footer,
  .admin-shell,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .category-rail,
  .admin-sidebar {
    position: static;
  }

  .category-rail,
  #guestCategories {
    display: flex;
    overflow-x: auto;
  }

  .category-pill {
    width: auto;
    white-space: nowrap;
  }
}

@media (max-width: 560px) {
  main {
    padding: 0.85rem;
  }

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

  .admin-item,
  .customer-item {
    grid-template-columns: 1fr;
  }
}
