:root {
  --ms-blue-900: #001b44;
  --ms-blue-800: #003366;
  --ms-blue-700: #00467f;
  --ms-blue-600: #0b5ea8;
  --ms-orange: #f28b00;
  --ms-green: #1f9d55;
  --ms-gray-50: #f5f7fa;
  --ms-gray-100: #eef1f6;
  --ms-gray-200: #d9dee7;
  --ms-gray-600: #5b6575;
  --ms-gray-800: #1f2933;
  --ms-danger: #c62828;
  --ms-warn: #ed6c02;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ms-gray-800);
  background: var(--ms-gray-50);
}

a { color: var(--ms-blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.top-nav {
  background: #fff;
  border-bottom: 1px solid var(--ms-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.top-nav .brand {
  font-weight: 700;
  color: var(--ms-blue-700);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.top-nav nav { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.top-nav nav a { color: #333; font-size: 0.92rem; font-weight: 500; }
.top-nav .orders-menu { position: relative; }
.top-nav .orders-menu:hover .orders-dropdown,
.top-nav .orders-menu:focus-within .orders-dropdown { display: block; }
.orders-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border-top: 3px solid var(--ms-orange);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 220px;
  z-index: 20;
  padding: 0.4rem 0;
}
.orders-dropdown a {
  display: block;
  padding: 0.55rem 1rem;
  color: #222;
  font-size: 0.9rem;
}
.orders-dropdown a:hover { background: var(--ms-gray-100); text-decoration: none; }

.header-bar {
  background: var(--ms-blue-700);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.header-bar .search-wrap {
  flex: 1;
  display: flex;
  min-width: 220px;
  background: #fff;
  border-radius: 2px;
  overflow: hidden;
}
.header-bar .search-wrap input {
  flex: 1;
  border: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
}
.header-bar .search-wrap button {
  border: 0;
  background: var(--ms-gray-100);
  padding: 0 1rem;
  cursor: pointer;
}
.account-chip { font-size: 0.85rem; line-height: 1.25; }
.cart-btn {
  background: var(--ms-orange);
  color: #fff !important;
  border: 0;
  padding: 0.65rem 1rem;
  font-weight: 700;
  border-radius: 2px;
  text-decoration: none !important;
  white-space: nowrap;
}

.layout { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: calc(100vh - 120px); }
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .offers-rail { order: 2; }
}

.offers-rail {
  background: var(--ms-blue-900);
  color: #fff;
  padding: 1rem;
}
.offers-rail .badge-limited {
  display: inline-block;
  background: #f6c945;
  color: #222;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}
.offer-card {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
}
.offer-card .offer-thumb {
  display: block;
  margin: 0 0 0.55rem;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0,0,0,.15);
}
.offer-card .offer-thumb img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}
.offer-card .sku { font-size: 0.75rem; opacity: .85; }
.offer-card .name { font-size: 0.85rem; font-weight: 600; margin: 0.35rem 0; }
.offer-card .price { font-size: 1.25rem; font-weight: 700; color: #7dcea0; }
.btn-add {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--ms-green);
  color: #fff !important;
  border: 0;
  padding: 0.55rem;
  margin-top: 0.5rem;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none !important;
}

.main-panel { padding: 1.25rem; }
.hero-strip {
  background: linear-gradient(135deg, var(--ms-blue-900), var(--ms-blue-700));
  color: #fff;
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.stat-boxes { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stat-box {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  min-width: 140px;
}
.stat-box .label { font-size: 0.78rem; opacity: .85; }
.stat-box .value { font-size: 1.35rem; font-weight: 700; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.25rem 0 0.75rem;
  color: var(--ms-blue-900);
}

.product-row {
  display: grid;
  grid-template-columns: 90px 1fr 160px 180px;
  gap: 1rem;
  background: #fff;
  border: 1px solid var(--ms-gray-200);
  border-radius: 4px;
  padding: 0.9rem;
  margin-bottom: 0.65rem;
  align-items: center;
}
@media (max-width: 900px) {
  .product-row { grid-template-columns: 70px 1fr; }
}
.thumb {
  width: 80px;
  height: 80px;
  background: var(--ms-gray-100);
  border: 1px solid var(--ms-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ms-gray-600);
  font-size: 0.7rem;
  text-align: center;
  overflow: hidden;
  text-decoration: none;
}
.thumb.has-img { padding: 0; }
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-media {
  background: #fff;
  border: 1px solid var(--ms-gray-200);
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.badge-rx {
  display: inline-block;
  margin-left: .35rem;
  padding: .1rem .4rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  background: var(--ms-danger);
  border-radius: 2px;
  vertical-align: middle;
}
.specs-table th {
  width: 40%;
  text-transform: none;
  letter-spacing: 0;
  font-size: .85rem;
  background: var(--ms-gray-50);
}
.wh-cta-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}
.wh-cta-primary {
  width: auto !important;
  padding: .7rem 1.25rem !important;
  font-size: 1rem;
  background: var(--ms-orange) !important;
}
.meta { font-size: 0.8rem; color: var(--ms-gray-600); }
.title-link { font-weight: 700; font-size: 1rem; color: var(--ms-blue-600); }
.stock { font-weight: 700; font-size: 0.9rem; }
.stock.in_stock, .stock.low { color: var(--ms-green); }
.stock.out { color: var(--ms-danger); }
.stock.low { color: var(--ms-warn); }
.price-block { font-weight: 700; font-size: 1.05rem; }
.uom { font-size: 0.8rem; color: var(--ms-gray-600); }

.cart-bar {
  position: sticky;
  bottom: 0;
  background: var(--ms-blue-900);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  gap: 1rem;
}
.cart-bar .finish {
  background: var(--ms-green);
  color: #fff !important;
  padding: 0.7rem 1.2rem;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none !important;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--ms-blue-900), var(--ms-blue-700) 55%, #0a3d6e);
  padding: 1rem;
}
.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.auth-card h1 { margin: 0 0 0.25rem; color: var(--ms-blue-800); font-size: 1.5rem; }
.auth-card p { margin: 0 0 1.25rem; color: var(--ms-gray-600); font-size: 0.9rem; }
.form-group { margin-bottom: 0.9rem; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; font-weight: 600; }
.form-group input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--ms-gray-200);
  border-radius: 4px;
  font-size: 0.95rem;
}
.btn-primary {
  width: 100%;
  background: var(--ms-orange);
  color: #fff;
  border: 0;
  padding: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: #fdecea; color: #b71c1c; }
.alert-success { background: #e8f5e9; color: #1b5e20; }
.demo-box {
  margin-top: 1rem;
  background: var(--ms-gray-50);
  border: 1px dashed var(--ms-gray-200);
  padding: 0.75rem;
  font-size: 0.78rem;
  color: var(--ms-gray-600);
}
.demo-box code { display: block; }

.panel-card {
  background: #fff;
  border: 1px solid var(--ms-gray-200);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.stat-tile {
  background: var(--ms-gray-50);
  border: 1px solid var(--ms-gray-200);
  border-radius: 6px;
  padding: 0.9rem;
}
.stat-tile .n { font-size: 1.5rem; font-weight: 700; color: var(--ms-blue-800); }
.stat-tile .l { font-size: 0.8rem; color: var(--ms-gray-600); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #fff;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--ms-gray-200);
  padding: 0.55rem 0.65rem;
  text-align: left;
}
table.data th { background: var(--ms-gray-100); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; }

.lang-switch a {
  color: inherit;
  margin-left: 0.35rem;
  opacity: .85;
  font-size: 0.8rem;
}
.lang-switch a.active { font-weight: 700; opacity: 1; text-decoration: underline; }

.product-detail {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 1.25rem;
}
@media (max-width: 960px) {
  .product-detail { grid-template-columns: 1fr; }
}
.buy-box {
  border: 1px solid var(--ms-gray-200);
  background: #fff;
  padding: 1rem;
  border-radius: 4px;
  height: fit-content;
}
.buy-box .big-price { font-size: 1.75rem; font-weight: 700; }
.flash-banner {
  background: #e3f2fd;
  border-bottom: 1px solid #bbdefb;
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  color: #0d47a1;
}

#cart-toast {
  position: fixed;
  right: 1rem;
  bottom: 4.5rem;
  background: var(--ms-blue-900);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 50;
  font-size: 0.85rem;
}
#cart-toast.show { opacity: 1; }

.wh-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--ms-gray-200);
  color: #222;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.wh-badge.hot { background: var(--ms-orange); color: #fff; }

.live-pick {
  background: #fff8e8;
  border: 1px solid #ffe0a3;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 45, 0.45);
  z-index: 90;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 1.25rem;
}
.tour-overlay.show { display: flex; }
.tour-card {
  background: #fff;
  border-radius: 8px;
  max-width: 420px;
  width: 100%;
  padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  border-top: 4px solid var(--ms-orange);
}
.tour-step { font-size: 0.75rem; color: var(--ms-gray-600); margin-bottom: 0.35rem; }
.tour-title { margin: 0 0 0.4rem; color: var(--ms-blue-900); font-size: 1.1rem; }
.tour-text { margin: 0 0 1rem; color: #445; font-size: 0.92rem; line-height: 1.45; }
.tour-actions { display: flex; justify-content: space-between; gap: 0.5rem; }
.tour-skip {
  background: transparent;
  border: 0;
  color: var(--ms-gray-600);
  cursor: pointer;
  font-weight: 600;
}
.tour-next {
  background: var(--ms-blue-700);
  color: #fff;
  border: 0;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}
.tour-highlight {
  position: relative;
  z-index: 91;
  box-shadow: 0 0 0 3px #f28b00, 0 0 0 8px rgba(242, 139, 0, 0.25) !important;
  border-radius: 4px;
}

.cred-ok { color: var(--ms-green); font-weight: 700; }
.cred-bad { color: var(--ms-danger); font-weight: 700; }
.cred-warn { color: var(--ms-warn); font-weight: 700; }

.chart-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}
.chart-box {
  background: #fff;
  border: 1px solid var(--ms-gray-200);
  border-radius: 6px;
  padding: 1rem;
  min-height: 280px;
}
