:root {
  --sidebar-width: 272px;
  --sidebar-pad: 18px;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #142033;
  --muted: #66758c;
  --line: #dbe3ee;
  --brand: #e31d2b;
  --brand-2: #0b4d91;
  --accent: #e31d2b;
  --blue: #0b4d91;
  --red-soft: #fff0f1;
  --good: #168653;
  --warn: #b56a00;
  --danger: #b42318;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(20, 38, 70, .08);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
a, .product-card { transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(227, 29, 43, .94), rgba(150, 12, 24, .88)),
    #fff;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(320px, 560px);
  gap: 28px;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

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

.auth-card, .auth-panel { padding: 34px; }
.auth-panel {
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .28);
  backdrop-filter: blur(12px);
}
.auth-panel h2 { margin: 0 0 16px; font-size: 34px; line-height: 1.08; }
.auth-panel li { margin: 0 0 12px; line-height: 1.45; }

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}
.logo .logo-b2b {
  color: var(--blue);
  font-size: 22px;
  letter-spacing: .03em;
}
.logo .logo-mobil {
  color: var(--brand);
  font-size: 25px;
  letter-spacing: .02em;
}
.auth-logo { margin-bottom: 24px; }

.auth-card h1, .panel h1, .empty-state h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.1;
}
.auth-card p, .empty-state p, .panel p { color: var(--muted); line-height: 1.55; }

.form-stack, .form-grid, .checkout-form { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid button { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 7px;
  color: #344258;
  font-size: 13px;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c9d4e4;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; }

.primary-btn, .secondary-btn, .product-foot button, .row-form button, .top-search button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid var(--brand);
  text-decoration: none;
  font-weight: 850;
}
.primary-btn, .product-foot button, .top-search button {
  color: #fff;
  background: var(--brand);
}
.primary-btn:hover, .product-foot button:hover, .top-search button:hover {
  background: #c91422;
  border-color: #c91422;
}
.secondary-btn {
  color: var(--brand);
  background: #fff;
}
.auth-switch { display: inline-block; margin-top: 18px; color: var(--brand); font-weight: 800; }

.app-body {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 76px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  z-index: 120;
  grid-row: 1 / -1;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px var(--sidebar-pad);
  background: #fff;
  border-right: 1px solid var(--line);
}
.app-sidebar .logo { margin: 8px 12px 34px; }
.app-sidebar nav { display: grid; gap: 6px; }
.nav-flyout-item { position: static; }
.nav-flyout-item::after {
  content: "";
  position: fixed;
  top: 76px;
  bottom: 0;
  left: calc(var(--sidebar-width) - var(--sidebar-pad));
  z-index: 109;
  display: none;
  width: var(--sidebar-pad);
}
.nav-flyout-item:hover::after,
.nav-flyout-item:focus-within::after {
  display: block;
}
.app-sidebar nav a, .logout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: #32435d;
  text-decoration: none;
  font-weight: 800;
}
.app-sidebar nav a span, .logout span { min-width: 0; }
.app-sidebar nav > a:hover,
.app-sidebar nav > a.active,
.nav-flyout-item:hover > a,
.nav-flyout-item:focus-within > a {
  color: var(--brand);
  background: var(--red-soft);
}
.nav-flyout-item > a.active {
  color: #32435d;
  background: transparent;
}
.nav-arrow {
  margin-left: auto;
  color: currentColor;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}
.side-flyout {
  position: fixed;
  top: 76px;
  bottom: 0;
  left: var(--sidebar-width);
  z-index: 110;
  width: min(760px, calc(100vw - var(--sidebar-width)));
  padding: 28px 34px;
  overflow: auto;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-10px);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 24px 0 60px rgba(20, 38, 70, .16);
  backdrop-filter: blur(10px);
  transition: opacity .16s ease, transform .16s ease;
}
.nav-flyout-item:hover .side-flyout,
.nav-flyout-item:focus-within .side-flyout {
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
}
.flyout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.flyout-head strong {
  color: var(--ink);
  font-size: 26px;
}
.flyout-head a {
  min-height: auto !important;
  padding: 0 !important;
  color: var(--brand) !important;
  background: transparent !important;
}
.flyout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
}
.flyout-grid h3,
.brand-flyout-list h3 {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}
.flyout-grid a,
.brand-flyout-list a {
  display: block !important;
  min-height: auto !important;
  padding: 10px 8px !important;
  border-radius: 8px !important;
  color: #32435d !important;
  background: transparent !important;
  font-weight: 700 !important;
}
.flyout-grid a:hover,
.brand-flyout-list a:hover {
  color: var(--brand) !important;
  background: var(--red-soft) !important;
}
.brand-flyout-list {
  columns: 3 180px;
  column-gap: 32px;
}
.brand-flyout-list a {
  break-inside: avoid;
}
.app-sidebar em {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--brand);
  font-style: normal;
  text-align: center;
  line-height: 24px;
  font-size: 12px;
}
.logout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 24px;
  color: var(--danger);
  background: #fff4f2;
}

.app-topbar {
  grid-column: 2;
  position: sticky;
  top: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 24px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.top-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.top-search button { gap: 8px; }
.mini-cart {
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--red-soft);
  text-decoration: none;
  font-weight: 900;
  white-space: nowrap;
}
.account {
  min-width: 170px;
  font-weight: 900;
  text-align: right;
}
.account span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-main {
  grid-column: 2;
  padding: 24px;
  min-width: 0;
}
.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #ffd1b8;
  border-radius: 8px;
  color: #7a310f;
  background: #fff3ec;
}

.hero-new {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 520px);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 28px;
  padding: 34px;
  border-radius: var(--radius);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(227, 29, 43, .98), rgba(150, 12, 24, .94));
  box-shadow: var(--shadow);
}
.eyebrow {
  margin: 0 0 12px;
  color: #ffe1e4;
  font-weight: 900;
  text-transform: uppercase;
}
.hero-new h1 {
  max-width: 680px;
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}
.hero-new p { max-width: 620px; color: #ffe8ea; line-height: 1.55; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.hero-stats article {
  padding: 22px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.11);
}
.hero-stats b { display: block; font-size: 34px; }
.hero-stats span { color: #ffe1e4; }

.section, .panel, .empty-state { margin-bottom: 24px; }
.section, .panel, .empty-state, .catalog-shell > section {
  position: relative;
  z-index: 1;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.section-title h1, .section-title h2 { margin: 0; }
.section-title a { color: var(--brand); font-weight: 850; text-decoration: none; }

.product-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.product-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 38, 70, .05);
  cursor: pointer;
}
.product-card:hover {
  z-index: 2;
  border-color: #b9cbe2;
  box-shadow: 0 14px 30px rgba(20, 38, 70, .1);
  transform: translateY(-2px);
}
.product-media {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  background: #f7f9fc;
}
.product-media img {
  max-width: 90%;
  max-height: 132px;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.no-photo {
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-size: 42px;
  font-weight: 950;
}
.product-body { padding: 12px; }
.meta, .sku {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
}
.product-card h3 {
  height: 58px;
  margin: 0 0 10px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.38;
}
.product-foot {
  display: grid;
  gap: 10px;
}
.product-foot strong {
  display: block;
  font-size: 20px;
  white-space: nowrap;
}
.price-stack small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.product-foot span {
  color: var(--good);
  font-size: 13px;
  font-weight: 800;
}
.product-foot form {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
}
.product-foot input { min-height: 40px; padding: 8px; }
.product-foot button.cart-icon-btn {
  padding: 0;
  min-height: 40px;
  border-radius: 8px;
}
.product-foot button.cart-icon-btn .ui-icon { width: 22px; height: 22px; }
.product-foot button:hover, .primary-btn:hover, .top-search button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(16, 76, 143, .18); }
.product-foot button.is-added { background: var(--good); border-color: var(--good); }

.catalog-shell {
  position: relative;
  z-index: 1;
  display: block;
}
.filters {
  z-index: 30;
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100dvh - 122px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.filters::-webkit-scrollbar { width: 8px; }
.filters::-webkit-scrollbar-thumb { background: #c8d5e6; border-radius: 999px; }
.filters h2, .filters h3 { margin: 0 0 12px; }
.filters h3 { margin-top: 18px; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.filters a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: #344258;
  text-decoration: none;
}
.filters a:hover, .filters a.active {
  color: var(--brand);
  background: var(--red-soft);
}

.product-modal[hidden] { display: none; }
.product-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}
.product-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 22, 38, .48);
  backdrop-filter: blur(4px);
}
.product-modal__dialog {
  position: relative;
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 24px;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 22, 38, .24);
}
.product-modal__media {
  min-height: 320px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f7f9fc;
}
.product-modal__media img {
  max-width: 92%;
  max-height: 300px;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.product-modal__content h2 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.2;
}
.modal-price {
  display: grid;
  gap: 5px;
  margin: 24px 0;
}
.modal-price strong { font-size: 34px; }
.modal-price span { color: var(--good); font-weight: 900; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

.panel {
  padding: 22px;
}
.panel.wide { width: 100%; }
.profile-grid, .admin-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.admin-layout .wide { grid-column: 1 / -1; }
.empty-state {
  max-width: 760px;
  padding: 34px;
}
.empty-state.compact { max-width: none; padding: 18px; box-shadow: none; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
th, td {
  padding: 13px 12px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
}
td small { display: block; color: var(--muted); margin-top: 4px; }
.table-link { color: var(--brand); font-weight: 900; text-decoration: none; }
.qty { max-width: 92px; }
.checkout-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 18px 0;
  font-size: 22px;
}
.checkout-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.status-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #eaf4ff;
  font-weight: 850;
}
.row-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
}
.row-form.access-form {
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 1fr) auto;
}
.row-form button {
  min-height: 38px;
  color: #fff;
  background: var(--brand);
}

@media (max-width: 1280px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-new { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .app-body {
    display: block;
  }
  .app-sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }
  .app-sidebar nav {
    grid-template-columns: repeat(3, 1fr);
  }
  .side-flyout {
    left: 16px;
    right: 16px;
    top: 118px;
    bottom: 16px;
    width: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(20, 38, 70, .22);
  }
  .flyout-grid { grid-template-columns: 1fr; gap: 18px; }
  .brand-flyout-list { columns: 2 160px; }
  .logout {
    position: static;
    margin-top: 8px;
  }
  .app-topbar {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  .account { text-align: left; }
  .catalog-shell, .profile-grid, .admin-layout, .auth-layout {
    grid-template-columns: 1fr;
  }
  .filters { position: static; max-height: 360px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-modal__dialog { grid-template-columns: 1fr; max-height: 90dvh; overflow: auto; }
}

@media (max-width: 620px) {
  .auth-layout, .app-main { padding: 14px; }
  .auth-card, .auth-panel, .hero-new, .panel { padding: 18px; }
  .logo .logo-b2b { font-size: 18px; }
  .logo .logo-mobil { font-size: 21px; }
  .app-sidebar nav { grid-template-columns: 1fr 1fr; }
  .hero-stats, .product-grid, .form-grid { grid-template-columns: 1fr; }
  .top-search { grid-template-columns: 1fr; }
  .product-media { height: 190px; }
  .section-title { align-items: flex-start; flex-direction: column; }
}
