:root {
  --ink: #16202a;
  --muted: #637083;
  --line: #d9e0e7;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --brand: #0b6b6f;
  --brand-2: #b65c37;
  --ok: #1d7a4c;
  --warn: #a96308;
  --bad: #b42318;
  --focus: #2c7be5;
  --shadow: 0 12px 30px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #14232e;
  color: #f8fbfd;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

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

.sidebar-topbar .brand-lockup {
  margin-bottom: 0;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: #f8fbfd;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 34% 35%, rgba(255,255,255,.95) 0 16%, transparent 17%),
    radial-gradient(circle at 58% 56%, rgba(255,255,255,.35) 0 25%, transparent 26%),
    linear-gradient(135deg, #35a6a2, #f09b64);
}

.brand-lockup strong {
  display: block;
  font-size: 15px;
}

.brand-lockup span {
  color: #b8c6d1;
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  min-height: 40px;
  border-radius: 8px;
  background: transparent;
  color: #d8e3ea;
  text-align: left;
  padding: 0 12px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255,255,255,0.11);
  color: #fff;
}

.sidebar-footer {
  margin-top: 22px;
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 16px;
  display: grid;
  gap: 8px;
}

.main {
  padding: 22px;
  min-width: 0;
}

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

.topbar h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

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

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.order-line-row {
  display: grid;
  gap: 14px;
}

.order-line-row + .order-line-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.card {
  overflow: hidden;
}

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

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metric {
  padding: 16px;
  min-height: 110px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 10px;
}

.metric small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
}

.button:hover {
  background: #0a5f63;
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button.secondary {
  background: #e8eef2;
  color: var(--ink);
}

.button.secondary:hover {
  background: #dde6ec;
}

.button.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}

.button.ghost:hover {
  background: var(--soft);
  border-color: var(--brand);
}

.button.warn {
  background: var(--brand-2);
}

.button.bad {
  background: var(--bad);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.15);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f0f4f7;
  color: #334250;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8eef2;
  color: #334250;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: #dcf4e8;
  color: var(--ok);
}

.badge.warn {
  background: #fff1da;
  color: var(--warn);
}

.badge.bad {
  background: #ffe3df;
  color: var(--bad);
}

.catalog-card {
  display: grid;
  grid-template-rows: 150px auto;
}

.product-art {
  min-height: 150px;
  background-size: cover;
  background-position: center;
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,.92) 0 28%, rgba(255,255,255,.18) 29% 39%, transparent 40%),
    radial-gradient(circle at 44% 47%, rgba(16,120,128,.35), transparent 20%),
    linear-gradient(135deg, #dfeef0, #f8dccd);
  border-bottom: 1px solid var(--line);
}

.product-art.alt {
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,.94) 0 28%, rgba(255,255,255,.24) 29% 39%, transparent 40%),
    radial-gradient(circle at 58% 44%, rgba(176,82,50,.34), transparent 23%),
    linear-gradient(135deg, #e5eaf2, #d6f0e9);
}

.thumb-mini,
.image-preview,
.gallery-thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 54%, rgba(255,255,255,.92) 0 28%, rgba(255,255,255,.18) 29% 39%, transparent 40%),
    linear-gradient(135deg, #dfeef0, #f8dccd);
  background-size: cover;
  background-position: center;
}

.thumb-mini {
  width: 64px;
  height: 48px;
}

.image-preview {
  width: 100%;
  min-height: 180px;
  margin-top: 8px;
}

.gallery-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.gallery-thumb {
  width: 86px;
  height: 66px;
}

.catalog-body {
  padding: 14px;
}

.catalog-body h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.catalog-body p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  min-height: 38px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
  gap: 14px;
  align-items: start;
}

.line-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.line-item + .line-item {
  margin-top: 10px;
}

.variant-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.totals {
  display: grid;
  gap: 8px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.totals strong {
  font-size: 18px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
  background: var(--soft);
}

.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 44px 40px;
  color: white;
  display: flex;
  flex-direction: column;
}

.auth-visual-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-visual-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(190deg, rgba(8,28,31,.28) 0%, rgba(8,28,31,.32) 40%, rgba(6,24,27,.82) 100%),
    linear-gradient(100deg, rgba(6,38,42,.55) 0%, transparent 48%);
}

.auth-visual-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  gap: 28px;
  animation: auth-rise .6s cubic-bezier(.16,1,.3,1) both;
}

.auth-eyebrow {
  display: inline-flex;
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 11.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.92);
  margin-bottom: 16px;
}

.auth-visual h1 {
  font-size: clamp(32px, 3.4vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  max-width: 500px;
  font-weight: 700;
}

.auth-visual h1 em {
  font-style: normal;
  color: #8fead9;
}

.auth-visual p {
  max-width: 420px;
  color: rgba(255,255,255,.82);
  font-size: 15.5px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.auth-feature-card {
  display: grid;
  gap: 11px;
  padding: 18px 20px;
  border-radius: 16px;
  background: rgba(12, 40, 44, 0.5);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: 440px;
}

.auth-feature-card-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: rgba(255,255,255,.92);
}

.auth-feature-card-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fead9;
  flex-shrink: 0;
}

.auth-panel {
  padding: 42px;
  align-self: center;
}

.auth-panel-inner {
  max-width: 460px;
  margin: 0 auto;
  animation: auth-rise .6s cubic-bezier(.16,1,.3,1) .08s both;
}

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

@media (prefers-reduced-motion: reduce) {
  .auth-visual-content,
  .auth-panel-inner {
    animation: none;
  }
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: white;
  margin-bottom: 18px;
}

.tabs button {
  min-height: 40px;
  padding: 0 16px;
  background: white;
  color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}

.tabs button:hover {
  background: var(--soft);
  color: var(--ink);
}

.tabs button.active,
.tabs button.active:hover {
  background: var(--brand);
  color: white;
}

.notice {
  border-left: 4px solid var(--brand);
  background: #e8f5f5;
  padding: 10px 12px;
  border-radius: 8px;
  color: #214f54;
  margin: 12px 0;
}

.notice.bad {
  border-left-color: var(--bad);
  background: #ffe3df;
  color: #7a2318;
}

.vertex-inline {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfd;
}

.vertex-inline summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand);
  list-style: none;
}

.vertex-inline summary::-webkit-details-marker {
  display: none;
}

.vertex-inline summary::before {
  content: "\25B8  ";
}

.vertex-inline[open] summary::before {
  content: "\25BE  ";
}

.vertex-inline[open] summary {
  margin-bottom: 4px;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

.timeline-item {
  border-left: 3px solid var(--brand);
  padding-left: 10px;
}

.timeline-item strong {
  display: block;
}

.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .shell,
  .auth-page,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .hamburger {
    display: flex;
  }

  .sidebar-collapsible {
    display: none;
  }

  .sidebar-collapsible.open {
    display: block;
  }

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

  .grid.two,
  .grid.three,
  .grid.four {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-visual {
    min-height: 360px;
  }

  /* Once .split collapses to one column, the order summary would otherwise
     land at the very bottom of a long scroll, far from the product dropdown
     and line items it belongs with. Pinning it near the bottom of the
     viewport keeps totals/submit reachable without competing for space with
     the dropdown/config form while scrolling. */
  .cart-summary {
    position: sticky;
    bottom: 12px;
    box-shadow: 0 10px 28px rgba(22, 32, 42, 0.18);
  }
}

@media (max-width: 620px) {
  .main,
  .auth-panel,
  .auth-visual {
    padding: 18px;
  }

  .auth-visual {
    min-height: 300px;
  }

  .auth-feature-card {
    display: none;
  }

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

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

@media print {
  body {
    background: white;
  }
  .no-print {
    display: none !important;
  }
}
