:root {
  --background: #edf2f5;
  --foreground: #142832;
  --card: #ffffff;
  --card-foreground: #142832;
  --primary: #1a7089;
  --primary-foreground: #ffffff;
  --muted: #e7eef2;
  --muted-foreground: #5f7480;
  --border: #cfdbe3;
  --ok: #009767;
  --warning: #b45309;
  --danger: #dc2626;
  --radius: 14px;
  --radius-lg: 18px;
  --header-h: 56px;
  --max: 80rem;
  --font: "Cairo", system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(15, 36, 48, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: #0c151a;
  --foreground: #e6eef2;
  --card: #121f26;
  --card-foreground: #e6eef2;
  --primary: #3eb0cb;
  --primary-foreground: #071318;
  --muted: #162229;
  --muted-foreground: #8fa8b5;
  --border: #243842;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html.site-locked body {
  overflow: hidden;
}

html.site-locked body > :not(#site-gate) {
  display: none !important;
}

html.site-auth-pending body {
  overflow: hidden;
}

html.site-auth-pending body > :not(#site-gate) {
  visibility: hidden;
}

.site-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow: hidden;
  color: #e8f2f6;
}

.site-gate-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, #040a0e 0%, #0a1419 38%, #0d1f28 72%, #081218 100%);
}

.site-gate-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: siteGateOrb 14s ease-in-out infinite alternate;
  pointer-events: none;
}

.site-gate-orb--1 {
  width: min(52vw, 420px);
  height: min(52vw, 420px);
  top: -8%;
  right: -6%;
  background: radial-gradient(circle, rgba(62, 176, 203, 0.55), transparent 68%);
}

.site-gate-orb--2 {
  width: min(44vw, 360px);
  height: min(44vw, 360px);
  bottom: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(26, 112, 137, 0.5), transparent 70%);
  animation-delay: -4s;
}

.site-gate-orb--3 {
  width: min(28vw, 220px);
  height: min(28vw, 220px);
  top: 42%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(120, 210, 230, 0.22), transparent 72%);
  animation-delay: -8s;
}

@keyframes siteGateOrb {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(0, -18px, 0) scale(1.08);
  }
}

.site-gate-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 78%);
  opacity: 0.45;
  pointer-events: none;
}

.site-gate[hidden] {
  display: none !important;
}

.site-gate-shell {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
}

.site-gate-card {
  position: relative;
  padding: 34px 30px 28px;
  border-radius: 28px;
  border: 1px solid rgba(62, 176, 203, 0.22);
  background:
    linear-gradient(165deg, rgba(18, 31, 38, 0.94) 0%, rgba(12, 21, 26, 0.9) 100%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  backdrop-filter: blur(22px);
  animation: siteGateIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.site-gate.is-checking .site-gate-card {
  animation: siteGateIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both, siteGatePulse 1.6s ease-in-out infinite;
}

@keyframes siteGateIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes siteGatePulse {
  0%,
  100% {
    box-shadow:
      0 28px 80px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  }
  50% {
    box-shadow:
      0 28px 80px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(62, 176, 203, 0.18) inset,
      0 0 40px rgba(62, 176, 203, 0.08);
  }
}

.site-gate-shake {
  animation: siteGateShake 0.45s ease;
}

@keyframes siteGateShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

.site-gate-badge {
  display: flex;
  width: fit-content;
  margin-inline: auto;
  align-items: center;
  gap: 8px;
  margin: 0 auto 18px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(62, 176, 203, 0.28);
  background: rgba(62, 176, 203, 0.1);
  color: #7fd0e4;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.site-gate-badge svg {
  flex-shrink: 0;
}

.site-gate-head {
  text-align: center;
  margin-bottom: 22px;
}

.site-gate-logo {
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  object-fit: cover;
  object-position: center 14%;
  border-radius: 22px;
  border: 2px solid rgba(62, 176, 203, 0.35);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.site-gate-card h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-gate-lead {
  margin: 0;
  color: #8fa8b5;
  font-size: 0.9rem;
  line-height: 1.6;
}

.site-gate-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.site-gate-password-wrap {
  position: relative;
}

.site-gate-field-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6f8d9c;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.site-gate-input {
  width: 100%;
  min-height: 52px;
  padding-inline: 44px 48px;
  border-radius: 16px;
  border: 1px solid rgba(36, 56, 66, 0.95);
  background: rgba(7, 14, 18, 0.88);
  color: #edf5f8;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.site-gate-input::placeholder {
  color: #5f7a88;
  letter-spacing: 0;
  font-weight: 500;
}

.site-gate-input:focus {
  outline: none;
  border-color: rgba(62, 176, 203, 0.65);
  box-shadow: 0 0 0 4px rgba(62, 176, 203, 0.14);
  background: rgba(7, 14, 18, 0.98);
}

.site-gate-input:disabled {
  opacity: 0.7;
}

.site-gate-toggle {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #8fa8b5;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-gate-toggle:hover {
  color: #3eb0cb;
  background: rgba(62, 176, 203, 0.1);
}

.site-gate-toggle.is-visible .icon-eye {
  display: none;
}

.site-gate-toggle.is-visible .icon-eye-off {
  display: block !important;
}

.site-gate-submit {
  position: relative;
  width: 100%;
  min-height: 52px;
  margin-top: 2px;
  border: 0;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #1f8aa6 0%, #1a7089 55%, #155f75 100%);
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(26, 112, 137, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.site-gate-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(26, 112, 137, 0.45);
}

.site-gate-submit:active:not(:disabled) {
  transform: translateY(0);
}

.site-gate-submit:disabled {
  cursor: wait;
  opacity: 0.88;
}

.site-gate-submit.is-loading .site-gate-submit-text {
  opacity: 0;
}

.site-gate-spinner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: siteGateSpin 0.7s linear infinite;
  opacity: 0;
}

.site-gate-submit.is-loading .site-gate-spinner {
  opacity: 1;
}

@keyframes siteGateSpin {
  to {
    transform: rotate(360deg);
  }
}

.site-gate-error {
  margin: 14px 0 0;
  padding: 11px 14px;
  border-radius: 14px;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.site-gate-error[hidden] {
  display: none !important;
}

.site-gate-foot {
  margin: 18px 0 0;
  text-align: center;
  color: #5f7a88;
  font-size: 0.78rem;
  font-weight: 600;
}

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

button,
input {
  font: inherit;
}

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

.muted {
  color: var(--muted-foreground);
}

.muted.small {
  font-size: 0.8rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(var(--max), calc(100% - 24px));
  margin-inline: auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center 14%;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border));
  background: #1a7089;
}

.hero-logo-full {
  width: min(150px, 68%);
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.brand-text {
  min-width: 0;
  line-height: 1.2;
}

.brand-title {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
}

.brand-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.header-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 60%, transparent);
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.nav-pill.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.nav-short {
  display: none;
}

/* Page */
.page-shell {
  width: min(var(--max), calc(100% - 24px));
  margin-inline: auto;
  padding: 16px 0 112px;
}

.surface-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Hero */
.hero-mobile {
  margin-bottom: 16px;
}

.hero-mobile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 16px;
  text-align: center;
}

.hero-mobile-copy h1 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.35;
}

.hero-desktop {
  display: none;
  margin-bottom: 20px;
  overflow: hidden;
  animation: heroFadeIn 0.55s ease-out both;
}

.hero-desktop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: stretch;
  min-height: 0;
}

.hero-desktop-grid:has(.hero-visual.has-case-photo) {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 42%);
}

.hero-copy {
  position: relative;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset-inline-end: -40px;
  top: -30%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 14%, transparent), transparent 68%);
  pointer-events: none;
}

.hero-brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.hero-kicker {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
}

.hero-desktop h1 {
  margin: 0 0 8px;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.35;
  font-weight: 800;
  max-width: 38rem;
}

.hero-copy > .muted {
  max-width: 38rem;
  margin: 0 0 10px;
  font-size: 0.84rem;
  line-height: 1.55;
}

.hero-note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--muted) 85%, transparent);
  color: var(--muted-foreground);
  font-size: 0.78rem;
  max-width: 38rem;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  backdrop-filter: blur(6px);
}

.hero-visual {
  position: relative;
  min-height: 200px;
  max-height: 220px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #0e2a35, #1a7089 45%, #3eb0cb);
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: heroShine 5s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, transparent, color-mix(in srgb, var(--card) 22%, transparent));
  pointer-events: none;
  z-index: 1;
}

.hero-visual.has-case-photo {
  background: #0c151a;
  min-height: 280px;
  max-height: 320px;
}

.hero-visual.has-case-photo::before,
.hero-visual.has-case-photo::after {
  opacity: 0.35;
}

.hero-logo-splash {
  width: 100%;
  height: 100%;
  min-height: 200px;
  max-height: 220px;
  object-fit: cover;
  object-position: center 12%;
  display: block;
  transform: scale(1);
  animation: heroZoom 14s ease-in-out infinite alternate;
}

.hero-logo-splash.is-case-photo,
.hero-logo-full.is-case-photo {
  object-fit: contain;
  object-position: center;
  animation: none;
  padding: 0;
  background: #0c151a;
}

.hero-visual.has-case-photo .hero-logo-splash {
  min-height: 280px;
  max-height: 320px;
  width: 100%;
}

.hero-visual.is-zoomable {
  cursor: zoom-in;
}

.hero-visual.is-zoomable .hero-logo-splash {
  pointer-events: none;
}

.hero-zoom-hint {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  z-index: 3;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.hero-logo-full.is-case-photo {
  cursor: zoom-in;
  width: min(260px, 100%);
  max-height: 220px;
  object-fit: contain;
}

.case-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.case-lightbox[hidden] {
  display: none;
}

.case-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.case-lightbox.open .case-lightbox-backdrop {
  opacity: 1;
}

.case-lightbox-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.case-lightbox.open .case-lightbox-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.case-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.case-lightbox-head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.case-lightbox-body {
  padding: 14px;
  display: grid;
  place-items: center;
  background: #0c151a;
  min-height: min(70vh, 640px);
}

.case-lightbox-body img {
  width: 100%;
  max-height: min(72vh, 680px);
  object-fit: contain;
  border-radius: 12px;
}

body.modal-open {
  overflow: hidden;
}

@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

@keyframes heroShine {
  0%,
  100% {
    transform: translateX(-120%);
  }
  45%,
  55% {
    transform: translateX(120%);
  }
}

/* Builder grid */
.builder-grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.picker {
  min-width: 0;
  padding: 12px 16px 20px;
}

.picker-nav-sticky {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 10;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(10px);
  padding-bottom: 12px;
  margin: -12px -16px 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.progress-panel {
  margin-bottom: 12px;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--foreground);
}

.progress-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-bar {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.progress-seg {
  height: 10px;
  min-height: 10px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 88%, var(--border));
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.progress-seg.done {
  background: color-mix(in srgb, var(--primary) 70%, var(--card));
}

.progress-seg.active {
  background: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
  transform: scaleY(1.12);
}

.progress-seg.done.active {
  background: var(--primary);
}

.progress-seg:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.cat-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  margin-inline: -4px;
  padding-inline: 4px;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex: 0 0 auto;
  min-width: 4.75rem;
  min-height: 4.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 10px;
  scroll-snap-align: center;
  touch-action: manipulation;
}

.cat-label-full {
  display: none;
}

.cat-pill.active {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--card));
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.picker-content {
  margin-top: 16px;
}

.category-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--primary);
  margin-bottom: 14px;
}

.category-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--foreground);
}

.category-head p {
  margin: 4px 0 0;
  font-size: 0.8rem;
}

.multi-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.search-row {
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  background: var(--background);
  color: var(--foreground);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.product-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: inherit;
  cursor: pointer;
  text-align: right;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-row.has-thumb {
  grid-template-columns: auto 1fr auto;
}

.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--muted);
  flex-shrink: 0;
}

.product-row:hover {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  box-shadow: var(--shadow);
}

.product-row.selected {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--card));
}

.product-row.incompatible {
  position: relative;
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  background: color-mix(in srgb, var(--danger) 6%, var(--card));
  cursor: not-allowed;
  opacity: 0.92;
}

.product-row.incompatible:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--border));
  box-shadow: none;
}

.incompatible-mark {
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 14px 14px 0;
  background: var(--danger);
}

html[dir="rtl"] .incompatible-mark {
  border-radius: 14px 0 0 14px;
}

.compat-flag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
}

.compat-flag.bad {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--border));
}

.incompatible-reason {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--danger);
}

.product-row.incompatible .pick-btn {
  background: var(--muted);
  color: var(--muted-foreground);
}

.product-row.incompatible .product-price {
  color: var(--muted-foreground);
}

.product-info strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.35;
  margin-bottom: 6px;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--primary) 12%, var(--card));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
}

.stock {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.product-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.product-price {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.pick-btn {
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-foreground);
}

.product-row.selected .pick-btn {
  background: var(--muted);
  color: var(--foreground);
}

.empty-products {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted-foreground);
}

/* Summary */
.summary-panel {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.summary-inner {
  padding: 18px;
}

.summary-kicker {
  margin: 0 0 4px;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.summary-inner h3 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.summary-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  color: inherit;
  cursor: pointer;
  text-align: right;
}

.summary-row-multi {
  align-items: flex-start;
}

.summary-row-main {
  flex: 1;
  min-width: 0;
}

.summary-row:hover {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}

.summary-cat {
  display: block;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  font-weight: 600;
}

.summary-val {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.45;
  word-break: break-word;
}

.summary-val-multi {
  display: grid;
  gap: 4px;
}

.summary-part {
  display: block;
  padding: 4px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}

.summary-part:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-change {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  padding-top: 2px;
}

.summary-issues {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.issue {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.issue.error {
  background: color-mix(in srgb, var(--danger) 10%, var(--card));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border));
}

.issue.warning {
  background: color-mix(in srgb, var(--warning) 10%, var(--card));
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 20%, var(--border));
}

.summary-hint {
  margin: 14px 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.55;
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.summary-total strong {
  font-size: 1.05rem;
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

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

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

.btn-muted {
  background: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.site-logout-btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.site-logout-btn[hidden] {
  display: none;
}

/* Dock */
.dock-bar {
  position: fixed;
  inset-inline: 12px;
  bottom: 12px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.dock-info {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dock-actions .btn {
  padding: 10px 12px;
  white-space: nowrap;
}

.dock-info span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.dock-info strong {
  display: block;
  font-size: 1rem;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spec sheet */
.spec-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 12px;
}

.spec-sheet[hidden] {
  display: none;
}

.spec-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s;
}

.spec-sheet.open .spec-sheet-backdrop {
  opacity: 1;
}

.spec-sheet-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: 85vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
}

.spec-sheet.open .spec-sheet-panel {
  transform: translateY(0);
  opacity: 1;
}

.spec-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.spec-sheet-head h2 {
  margin: 0;
  font-size: 1rem;
}

.spec-sheet-body {
  overflow: auto;
  padding: 12px 18px;
  display: grid;
  gap: 8px;
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.spec-row:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--card));
}

.spec-row:active {
  transform: scale(0.995);
}

.spec-row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.spec-cat {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  font-weight: 600;
}

.spec-val {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}

.spec-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 4.5rem;
}

.spec-price {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.spec-action {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
}

.spec-sheet-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

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

.spec-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.spec-total strong {
  color: var(--primary);
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 88px;
  max-width: 360px;
  margin-inline: auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.88rem;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 60;
}

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

@media (min-width: 640px) {
  :root {
    --header-h: 64px;
  }

  .nav-long {
    display: inline;
  }

  .hero-mobile {
    display: none;
  }

  .hero-desktop {
    display: block;
  }

  .page-shell {
    padding-bottom: 24px;
  }

  .dock-bar {
    display: none;
  }

  .toast {
    bottom: 20px;
  }
}

@media (min-width: 768px) {
  .builder-grid {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
  }

  .picker-nav-sticky {
    position: static;
    background: transparent;
    backdrop-filter: none;
    margin: 0;
    padding: 0 0 12px;
    border-bottom: 0;
  }

  .progress-panel {
    margin-bottom: 16px;
  }

  .progress-bar {
    gap: 6px;
  }

  .progress-seg {
    height: 11px;
    min-height: 11px;
  }

  .cat-nav {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    scroll-snap-type: none;
    margin-inline: 0;
    padding-inline: 0;
    padding-bottom: 0;
  }

  .cat-pill {
    flex: unset;
    min-width: 0;
    width: auto;
    min-height: 44px;
    flex-direction: row;
    border-radius: 999px;
    font-size: 0.68rem;
    padding: 6px 4px;
    box-shadow: none;
  }

  .cat-label-short {
    display: none;
  }

  .cat-label-full {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cat-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cat-pill.active {
    box-shadow: none;
  }
}

@media (min-width: 1024px) {
  .builder-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .cat-pill {
    font-size: 0.72rem;
  }
}

@media (max-width: 767px) {
  .summary-panel {
    display: none;
  }

  .page-shell {
    width: min(var(--max), calc(100% - 16px));
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  .header-inner {
    gap: 8px;
  }

  .brand-sub {
    display: none;
  }

  .nav-pill {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .dock-bar {
    inset-inline: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 10px 12px;
  }

  .hero-mobile-inner {
    padding: 16px 12px;
  }

  .site-gate {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .picker {
    padding: 12px 12px 20px;
  }

  .picker-nav-sticky {
    margin: -12px -12px 0;
    padding: 12px 12px;
  }

  .cat-pill {
    min-width: 4.25rem;
    min-height: 4rem;
    font-size: 0.6rem;
  }

  .progress-label {
    font-size: 0.72rem;
  }

  .progress-count {
    font-size: 0.68rem;
  }

  .progress-bar {
    gap: 4px;
  }

  .progress-seg {
    height: 9px;
    min-height: 9px;
  }
}

@media (max-width: 639px) {
  .nav-long {
    display: none;
  }

  .nav-short {
    display: inline;
  }
}

/* Print preview & document */
.print-preview {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--background) 92%, #000 8%);
  backdrop-filter: blur(10px);
}

.print-preview[hidden] {
  display: none !important;
}

body.print-open {
  overflow: hidden;
}

.print-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

.print-preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.print-document {
  max-width: 920px;
  margin: 0 auto;
}

.print-card {
  background: #fff;
  color: #0f172a;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  padding: clamp(18px, 4vw, 32px);
}

.print-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid #0f766e;
  margin-bottom: 18px;
}

.print-branding {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.print-logo {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.print-kicker {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f766e;
  letter-spacing: 0.02em;
}

.print-header h1 {
  margin: 0;
  font-size: clamp(1.15rem, 3.5vw, 1.55rem);
  line-height: 1.25;
  color: #0f172a;
}

.print-subtitle {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: #64748b;
}

.print-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: #334155;
  text-align: end;
}

.print-intro {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1px solid #ccfbf1;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #334155;
}

.print-table-wrap {
  overflow-x: auto;
  margin-bottom: 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.print-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.print-table th,
.print-table td {
  padding: 10px 12px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid #e2e8f0;
}

.print-table th {
  background: #f8fafc;
  color: #0f766e;
  font-weight: 700;
  white-space: nowrap;
}

.print-table tbody tr:last-child td {
  border-bottom: none;
}

.print-table tr.is-empty td {
  color: #94a3b8;
  font-style: italic;
}

.print-table td:nth-child(1) {
  width: 36px;
  color: #64748b;
}

.print-table td:nth-child(4) {
  min-width: 180px;
  line-height: 1.55;
  color: #475569;
}

.print-price {
  white-space: nowrap;
  font-weight: 700;
  color: #0f766e;
}

.print-total-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  color: #fff;
  margin-bottom: 18px;
}

.print-total-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.print-total-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  opacity: 0.88;
}

.print-total-value {
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  letter-spacing: 0.01em;
}

.print-footer {
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.65;
  color: #64748b;
}

.print-footer p {
  margin: 0 0 8px;
}

.print-contact {
  font-weight: 600;
  color: #0f766e;
}

@media (max-width: 720px) {
  .print-preview-scroll {
    padding: 10px;
  }

  .print-card {
    border-radius: 14px;
    padding: 16px;
  }

  .print-meta {
    width: 100%;
    text-align: start;
  }

  .print-table {
    min-width: 0;
    font-size: 0.8rem;
  }

  .dock-actions .btn {
    padding: 10px 10px;
    font-size: 0.82rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm 12mm;
  }

  body.print-open > *:not(#print-preview) {
    display: none !important;
  }

  body.print-open {
    overflow: visible !important;
    background: #fff !important;
  }

  #print-preview {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: #fff !important;
    backdrop-filter: none !important;
  }

  #print-preview[hidden] {
    display: none !important;
  }

  .print-preview-toolbar {
    display: none !important;
  }

  .print-preview-scroll {
    overflow: visible !important;
    padding: 0 !important;
  }

  .print-document {
    max-width: none !important;
    margin: 0 !important;
  }

  .print-card {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .print-table {
    min-width: 0 !important;
    font-size: 9pt;
  }

  .print-table th,
  .print-table td {
    padding: 6px 8px;
  }

  .print-intro,
  .print-total-box {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-total-box {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-header {
    border-bottom-color: #0f766e !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

@media (max-width: 480px) {
  .product-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .product-side {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
}

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