:root {
  color-scheme: light;
  --surface-page: #f4efe6;
  --surface-panel: rgba(255, 253, 248, 0.92);
  --surface-panel-strong: #fffdf8;
  --surface-ink: #1c2732;
  --surface-muted: #667789;
  --surface-line: rgba(25, 48, 84, 0.12);
  --surface-line-strong: rgba(15, 118, 110, 0.18);
  --surface-shadow: 0 18px 48px rgba(22, 30, 45, 0.12);
  --surface-brand: #0f766e;
  --surface-brand-deep: #0d4f4a;
  --surface-brand-soft: rgba(15, 118, 110, 0.12);
  --surface-warm: #b7791f;
  --surface-warm-soft: rgba(183, 121, 31, 0.14);
  --surface-danger: #b42318;
  --surface-success: #1f6a3d;
  --surface-warning: #8a4b04;
  --surface-radius-lg: 1.5rem;
  --surface-radius-md: 1rem;
  --surface-radius-sm: 0.85rem;
  --surface-focus: 0 0 0 3px rgba(15, 118, 110, 0.16), 0 0 0 1px rgba(15, 118, 110, 0.28);
  --surface-font: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface-page);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--surface-font);
  color: var(--surface-ink);
  background:
    radial-gradient(circle at top left, rgba(183, 121, 31, 0.16), transparent 26rem),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.12), transparent 24rem),
    linear-gradient(180deg, #f8f4ed 0%, var(--surface-page) 100%);
}

body.is-modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.24), transparent 32%),
    linear-gradient(300deg, rgba(255, 255, 255, 0.18), transparent 26%);
  opacity: 0.45;
}

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

a {
  color: inherit;
}

:where(.login-shell, .hub-shell, .admin-shell, .customer-shell) {
  width: min(96rem, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 1rem 0 1.5rem;
  position: relative;
  z-index: 0;
}

.hub-shell,
.admin-shell {
  width: min(96rem, calc(100vw - 1.5rem));
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: 1.2rem;
}

:where(.login-card, .hub-hero, .admin-topbar, .panel, .summary-card, .catalog-card, .detail-card, .mini-card, .order-card, .customer-card, .detail-order-card, .modal-card) {
  background: var(--surface-panel);
  border: 1px solid var(--surface-line);
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(10px);
  animation: surface-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

:where(.login-card, .hub-hero, .admin-topbar, .panel, .summary-card, .catalog-card, .detail-card, .mini-card, .order-card, .customer-card, .detail-order-card, .modal-card) {
  border-radius: var(--surface-radius-lg);
}

:where(.btn, .topbar-link, .hero-link, .auth-tab, .catalog-badge, .customer-code-badge, .section-counter, .btn-chip, .topbar-identity, .hero-identity, .order-badge, .order-status-badge) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
}

:where(.btn, .topbar-link, .hero-link, .auth-tab, .customer-card, .catalog-card, .order-card, .detail-order-card, .summary-card, .mini-card, .detail-card, .panel, .modal-card) {
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

:where(.btn, .topbar-link, .hero-link, .auth-tab, .customer-card, .catalog-card, .order-card, .detail-order-card, .btn-chip) {
  cursor: pointer;
}

:where(.btn, .topbar-link, .hero-link, .auth-tab, .field-input, .customer-card, .catalog-card, .btn-chip, .modal-close, .customer-auth-close, .customer-auth-entry, .customer-auth-logout-inline) {
  -webkit-tap-highlight-color: transparent;
}

:where(.btn, .topbar-link, .hero-link, .auth-tab, .field-input, .customer-card, .catalog-card, .btn-chip, .modal-close, .customer-auth-close, .customer-auth-entry, .customer-auth-logout-inline):focus-visible {
  outline: none;
  box-shadow: var(--surface-focus);
}

.eyebrow,
.catalog-badge,
.customer-code-badge,
.section-counter,
.topbar-identity,
.hero-identity {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow,
.catalog-badge,
.section-counter,
.customer-code-badge {
  font-size: 0.74rem;
}

.eyebrow {
  margin-bottom: 0.4rem;
  color: var(--surface-brand);
  font-weight: 800;
}

:where(.field-label, .status-line, .topbar-copy, .hero-text, .detail-copy, .customer-card-subtitle, .customer-card-foot, .detail-order-items, .section-copy, .modal-copy, .customer-auth-text, .customer-auth-field-help, .toggle-text, .profile-form-note) {
  color: var(--surface-muted);
  line-height: 1.5;
}

.field-input {
  width: 100%;
  min-height: 2.95rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(109, 126, 145, 0.25);
  background: rgba(255, 255, 255, 0.96);
  padding: 0.78rem 0.92rem;
  font: inherit;
  color: var(--surface-ink);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field-input:hover {
  border-color: rgba(15, 118, 110, 0.34);
}

.field-input:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
}

.field-input.is-invalid,
:where(.auth-field.is-invalid .field-input) {
  border-color: rgba(180, 35, 24, 0.48);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.btn,
.topbar-link,
.hero-link,
.auth-tab {
  border: 1px solid transparent;
}

.btn,
.topbar-link,
.hero-link {
  min-height: 2.95rem;
  padding: 0.74rem 1rem;
  text-decoration: none;
}

.admin-topbar,
.hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  overflow: hidden;
}

.topbar-actions,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.topbar-actions > *,
.hero-actions > * {
  flex: 0 0 auto;
}

.btn-primary,
.hero-link,
.topbar-link {
  color: #fff;
  background: linear-gradient(135deg, var(--surface-brand), #0f8b7e);
}

.btn-primary:hover,
.hero-link:hover,
.topbar-link:hover {
  transform: translateY(-1px);
}

.btn-outline,
.hero-link-secondary,
.topbar-link-secondary,
.auth-tab,
.customer-auth-logout-inline,
.catalog-card .btn-outline,
.catalog-card .hero-link-secondary {
  color: var(--surface-ink);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 118, 110, 0.16);
}

.btn-danger {
  color: #8f2c2c;
  background: rgba(180, 35, 24, 0.08);
  border-color: rgba(180, 35, 24, 0.16);
}

.btn-chip {
  min-height: 2.3rem;
  padding-inline: 0.75rem;
  background: rgba(15, 118, 110, 0.08);
  color: var(--surface-brand-deep);
  border: 1px solid rgba(15, 118, 110, 0.14);
}

.summary-card,
.mini-card,
.detail-card,
.order-card,
.detail-order-card,
.customer-card {
  border-color: rgba(25, 48, 84, 0.12);
}

.summary-card,
.mini-card {
  padding: 1rem;
}

.summary-card strong,
.mini-card strong,
.summary-card .money,
.topbar-identity,
.hero-identity {
  font-variant-numeric: tabular-nums;
}

.summary-card strong,
.mini-card strong {
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
}

.status-line {
  margin: 0.8rem 0 0;
}

.status-line.is-error,
.customer-feedback[data-state="error"],
.topbar-copy.is-error {
  color: var(--surface-danger);
}

.status-line.is-success,
.customer-feedback[data-state="success"] {
  color: var(--surface-success);
}

.empty-state {
  margin: 0;
  padding: 1rem 1.05rem;
  border-radius: 1rem;
  background: rgba(15, 118, 110, 0.06);
  color: var(--surface-muted);
}

.login-card {
  width: min(37rem, 100%);
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
}

.login-card::after,
.hub-hero::after,
.admin-topbar::after {
  content: "";
  position: absolute;
  inset: auto -2rem -2rem auto;
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  background: radial-gradient(circle, var(--surface-brand-soft), transparent 64%);
  pointer-events: none;
}

.login-card h1,
.hub-hero h1,
.admin-topbar h1,
.customer-topbar h1 {
  margin-bottom: 0;
  line-height: 0.96;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.catalog-card,
.customer-card,
.order-card,
.detail-order-card {
  position: relative;
  overflow: hidden;
}

.catalog-card::before,
.customer-card::before,
.order-card::before,
.detail-order-card::before {
  content: "";
  position: absolute;
  inset: auto -1.5rem -1.5rem auto;
  width: 6rem;
  height: 6rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(183, 121, 31, 0.12), transparent 68%);
  pointer-events: none;
}

.catalog-card:hover,
.customer-card:hover,
.btn:hover,
.topbar-link:hover,
.hero-link:hover,
.auth-tab:hover {
  transform: translateY(-1px);
}

.catalog-card:hover,
.customer-card:hover,
.order-card:hover,
.detail-order-card:hover {
  border-color: rgba(15, 118, 110, 0.24);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.modal-shell.is-hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 30, 0.56);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(1120px, calc(100vw - 1rem));
  max-height: calc(100vh - 1rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.15rem;
  border-radius: 1.35rem;
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: rgba(255, 255, 255, 0.96);
  color: var(--surface-brand-deep);
  font-size: 1.25rem;
}

.detail-definition-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.detail-definition-list > div {
  display: grid;
  gap: 0.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.95rem;
  background: rgba(15, 118, 110, 0.04);
}

.detail-definition-list dt {
  color: var(--surface-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-definition-list dd {
  margin: 0;
  color: var(--surface-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.order-status-badge {
  min-height: 2.1rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid transparent;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.order-status-badge.is-neutral {
  background: rgba(15, 118, 110, 0.08);
  color: var(--surface-brand-deep);
  border-color: rgba(15, 118, 110, 0.12);
}

.order-status-badge.is-warning {
  background: rgba(183, 121, 31, 0.1);
  color: var(--surface-warning);
  border-color: rgba(183, 121, 31, 0.16);
}

.order-status-badge.is-success {
  background: rgba(31, 106, 61, 0.1);
  color: var(--surface-success);
  border-color: rgba(31, 106, 61, 0.16);
}

.order-status-badge.is-danger {
  background: rgba(180, 35, 24, 0.1);
  color: var(--surface-danger);
  border-color: rgba(180, 35, 24, 0.16);
}

@keyframes surface-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  :where(.login-shell, .hub-shell, .admin-shell, .customer-shell) {
    width: min(100vw - 1rem, 100%);
    padding-top: 0.75rem;
  }

  .login-card,
  .hub-hero,
  .admin-topbar,
  .panel,
  .modal-card {
    border-radius: 1.2rem;
  }
}

@media (min-width: 1200px) {
  .admin-topbar,
  .hub-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .topbar-actions,
  .hero-actions {
    justify-content: flex-end;
    max-width: none;
  }
}

@media (min-width: 1200px) {
  .admin-topbar .topbar-actions,
  .hub-hero .hero-actions {
    flex-wrap: nowrap;
  }

  .admin-topbar .topbar-link,
  .hub-hero .hero-link {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .topbar-actions,
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: none;
  }

  .topbar-link,
  .hero-link {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
