* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-brand-cream);
  color: var(--color-text);
  font-family: var(--font-sans);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
}

[hidden] {
  display: none !important;
}

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

button,
.upload-button {
  touch-action: manipulation;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  background: var(--color-text);
  color: var(--color-surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 5%, rgba(215, 188, 241, 0.5), transparent 26rem),
    var(--color-brand-cream);
}

.topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 246, 249, 0.94);
}

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

.session-name {
  color: var(--color-brand-berry);
  font-size: 14px;
  font-weight: 700;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-brand-pink);
  color: var(--color-surface);
  font-weight: 800;
}

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

.brand small {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.service-status {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.service-status::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--color-text-muted);
  content: "";
}

.service-status[data-state="ok"]::before {
  background: var(--color-success);
}

.service-status[data-state="error"]::before {
  background: var(--color-danger);
}

.workspace {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 190px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-height: calc(100vh - 72px);
  flex-direction: column;
  gap: 6px;
  padding: 28px 18px;
  border-right: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.62);
  min-width: 0;
}

.nav-item {
  padding: 12px 16px;
  border-radius: var(--radius-small);
  color: var(--color-text-muted);
  font-weight: 650;
  text-decoration: none;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(215, 188, 241, 0.34);
  color: var(--color-brand-berry);
  outline: none;
}

.nav-item--active {
  background: var(--color-brand-pink);
  color: var(--color-surface);
}

.content {
  width: min(1120px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
}

.login-layout {
  display: grid;
  min-height: calc(100vh - 72px);
  padding: 32px 18px;
  place-items: center;
}

.login-card {
  display: grid;
  width: min(430px, 100%);
  gap: 10px;
  padding: clamp(28px, 6vw, 48px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.login-card h1 {
  margin: 4px 0 0;
}

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

.helper {
  margin: -3px 0 3px;
  font-size: 13px;
}

.form-message {
  min-height: 1.5em;
  margin: 0;
  color: var(--color-danger);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  margin-bottom: 40px;
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius-large);
  background: linear-gradient(135deg, var(--color-brand-pink), var(--color-brand-berry));
  box-shadow: var(--shadow-soft);
  color: var(--color-surface);
}

.hero h1 {
  max-width: 18em;
  margin: 6px 0 10px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.18;
}

.hero p {
  max-width: 44em;
  margin: 0;
  line-height: 1.7;
}

.hero__decoration {
  display: grid;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.76);
  font-size: 64px;
  font-weight: 800;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: 24px;
}

.section-heading .eyebrow {
  color: var(--color-brand-berry);
}

.badge {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 12px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease;
}

.button:focus-visible,
.list-button:focus-visible,
.text-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(122, 78, 94, 0.28);
  outline-offset: 2px;
}

.button:disabled,
.button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.5;
}

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

.button--primary:hover:not(:disabled) {
  background: var(--color-text);
}

.button--secondary {
  border-color: var(--color-brand-pink);
  background: var(--color-surface);
  color: var(--color-brand-berry);
}

.button--secondary:hover:not(:disabled),
.button--quiet:hover:not(:disabled) {
  background: rgba(242, 123, 164, 0.12);
}

.button--quiet {
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
}

.status-banner {
  min-height: 44px;
  margin: -20px 0 24px;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.status-banner:empty {
  display: none;
}

.status-banner[data-state="ok"] {
  border-color: rgba(45, 125, 87, 0.35);
  color: var(--color-success);
}

.status-banner[data-state="error"] {
  border-color: rgba(180, 61, 87, 0.35);
  color: var(--color-danger);
}

.catalog-grid,
.editor-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.panel {
  max-width: 100%;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel h3 {
  margin: 0;
}

.compact-form {
  display: grid;
  gap: 8px;
}

.compact-form label,
.inventory-form label,
.login-card label {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
}

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

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

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

.field-row > div {
  display: grid;
  gap: 8px;
}

.form-actions,
.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.upload-row input:first-child {
  min-width: 0;
  flex: 1;
}

.upload-button {
  flex: 0 0 auto;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.category-list,
.sku-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.category-list li,
.sku-list li {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-small);
  background: var(--color-brand-cream);
}

.list-button,
.text-button {
  min-height: 44px;
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: var(--color-brand-berry);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--color-brand-cream);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status--active {
  background: rgba(45, 125, 87, 0.12);
  color: var(--color-success);
}

.status--hidden,
.status--archived,
.status--inactive {
  background: rgba(180, 61, 87, 0.1);
  color: var(--color-danger);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--color-text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

td:nth-child(3),
td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  gap: 4px;
}

.empty-state {
  padding: 28px;
  color: var(--color-text-muted);
  text-align: center;
}

.inventory-form {
  display: grid;
  grid-template-columns: 0.7fr 1fr auto;
  align-items: end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.inventory-form label {
  grid-row: 1;
}

.inventory-form input,
.inventory-form button {
  grid-row: 2;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric-card {
  padding: 24px;
  border: 1px solid rgba(242, 123, 164, 0.2);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.metric-card--purple {
  background: linear-gradient(145deg, var(--color-surface), rgba(215, 188, 241, 0.42));
}

.metric-card--cream {
  background: linear-gradient(145deg, var(--color-surface), var(--color-brand-cream));
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--color-text-muted);
}

.metric-card strong {
  display: block;
  margin: 10px 0 8px;
  color: var(--color-brand-berry);
  font-size: 36px;
}

.app-view > h1,
.section-heading h1 {
  margin: 5px 0 0;
  font-size: clamp(26px, 4vw, 36px);
}

.view-state,
.owner-notice {
  margin: 16px 0;
  padding: 20px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-small);
  background: rgba(255, 255, 255, 0.66);
  color: var(--color-text-muted);
  text-align: center;
}

.view-state[data-state="error"],
.field-error,
.owner-notice {
  color: var(--color-danger);
}

.dashboard-breakdown,
.order-detail {
  margin-top: 18px;
}

.status-breakdown {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.status-breakdown dt,
.status-breakdown dd {
  margin: 0;
  text-align: center;
}

.status-breakdown dt {
  color: var(--color-text-muted);
  font-size: 12px;
}

.status-breakdown dd {
  grid-row: 1;
  color: var(--color-brand-berry);
  font-size: 24px;
  font-weight: 800;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(118px, 0.8fr)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-bar > div,
.dialog-field {
  display: grid;
  gap: 7px;
}

.filter-bar label,
.dialog-field label {
  font-size: 13px;
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.status--waiting_confirmation {
  background: rgba(242, 123, 164, 0.18);
  color: var(--color-brand-berry);
}

.status--paid,
.status--shipped {
  background: rgba(215, 188, 241, 0.34);
  color: var(--color-brand-berry);
}

.status--completed {
  background: rgba(45, 125, 87, 0.12);
  color: var(--color-success);
}

.status--cancelled {
  background: rgba(180, 61, 87, 0.1);
  color: var(--color-danger);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}

.detail-grid > div {
  padding: 14px;
  border-radius: var(--radius-small);
  background: var(--color-brand-cream);
}

.detail-grid dt {
  color: var(--color-text-muted);
  font-size: 12px;
}

.detail-grid dd {
  margin: 7px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-block {
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}

.detail-block h3,
.detail-block p {
  margin: 0 0 8px;
}

.detail-items,
.timeline {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
}

.proof-warning {
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: rgba(242, 123, 164, 0.12);
  color: var(--color-brand-berry);
}

.proof-image {
  display: block;
  width: min(520px, 100%);
  max-height: 560px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  object-fit: contain;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
}

.field-error {
  min-height: 1.4em;
  margin: 2px 0;
  font-size: 14px;
}

.audit-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  display: grid;
  gap: 4px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--color-border);
}

.audit-list span,
.audit-list small {
  color: var(--color-text-muted);
}

.confirm-dialog {
  width: min(540px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: 0 24px 80px rgba(66, 42, 51, 0.28);
  color: var(--color-text);
}

.confirm-dialog::backdrop {
  background: rgba(66, 42, 51, 0.5);
}

.confirm-dialog h2 {
  margin-top: 0;
}

.confirm-dialog [data-action-fields] {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

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

  .sidebar {
    position: sticky;
    z-index: 1;
    top: 72px;
    min-height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
    width: 100%;
    max-width: 100vw;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .hero__decoration {
    display: none;
  }

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

  .topbar__actions {
    gap: 6px;
  }

  .service-status,
  .session-name {
    display: none;
  }

  .content {
    padding: 24px 16px 40px;
  }

  .catalog-grid,
  .editor-grid,
  .field-row,
  .settings-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

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

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

  .panel {
    padding: 18px;
  }

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

  .inventory-form label,
  .inventory-form input,
  .inventory-form button {
    grid-row: auto;
  }

  .form-actions,
  .upload-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .brand small,
  .hero {
    display: none;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .sidebar {
    top: 64px;
  }

  .nav-item {
    padding: 10px 12px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .status-breakdown,
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pager {
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
