/* ==========================================================================
   Sorus B2B — visual refresh layer
   Loaded AFTER style.css. Keeps the existing palette (primary #0d6efd,
   charcoal dark theme, soft-grey light theme) and only refines typography,
   depth, spacing and motion. Remove the <link> to refresh.css to revert.
   ========================================================================== */

:root {
  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;

  --primary-soft: rgba(13, 110, 253, 0.14);
  --primary-softer: rgba(13, 110, 253, 0.08);
  --primary-glow: 0 6px 20px rgba(13, 110, 253, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --border-color: rgba(255, 255, 255, 0.08);
  --card-bg: linear-gradient(180deg, rgba(52, 52, 52, 0.72), rgba(38, 38, 38, 0.72));
  --card-border: 1px solid rgba(255, 255, 255, 0.07);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.45);

  --bg-gradient:
    radial-gradient(1200px 600px at 85% -10%, rgba(13, 110, 253, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(13, 110, 253, 0.06), transparent 60%),
    radial-gradient(circle, rgba(52, 52, 52, 1) 0%, rgba(26, 26, 26, 1) 100%);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html.light-theme {
  --border-color: rgba(15, 23, 42, 0.08);
  --card-bg: #ffffff;
  --card-border: 1px solid rgba(15, 23, 42, 0.07);
  --card-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(15, 23, 42, 0.06);
  --card-shadow-hover: 0 2px 6px rgba(15, 23, 42, 0.06), 0 18px 38px rgba(13, 60, 160, 0.13);

  --bg-gradient:
    radial-gradient(1200px 600px at 85% -10%, rgba(13, 110, 253, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(13, 110, 253, 0.04), transparent 60%),
    radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(244, 247, 246, 1) 100%);
}

/* ── Typography ─────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.price,
.cart-item-total,
.summary-line span:last-child,
#checkout-summary td {
  font-variant-numeric: tabular-nums;
}

::selection {
  background: rgba(13, 110, 253, 0.28);
}

/* ── Buttons & inputs ───────────────────────────────────────────────────── */
button {
  border-radius: var(--radius-sm);
}
button.primary {
  background: linear-gradient(180deg, #2b7fff 0%, var(--primary-color) 100%);
  border-color: transparent;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s ease, background 0.2s ease;
}
button.primary:hover {
  background: linear-gradient(180deg, #1f74f5 0%, var(--primary-hover) 100%);
  border-color: transparent;
  box-shadow: var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
button.primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
button.primary:disabled {
  transform: none;
  box-shadow: none;
}

input,
textarea,
select {
  border-radius: var(--radius-sm);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.main-header {
  background: rgba(24, 25, 27, 0.72);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02), 0 6px 24px rgba(0, 0, 0, 0.22);
}
html.light-theme .main-header {
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

.main-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: none;
}
.main-header h1.header-link a {
  background: linear-gradient(90deg, var(--text-color) 0%, var(--text-color) 55%, var(--primary-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.main-header h1.header-link a:hover {
  -webkit-text-fill-color: var(--primary-color);
}

#sidebar-toggle {
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, transform 0.2s var(--ease-out);
}
#sidebar-toggle:hover {
  transform: scale(1.05);
}

.cart-icon-btn,
.user-icon-btn {
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s var(--ease-out), color 0.2s ease;
}
.cart-icon-btn:hover,
.user-icon-btn:hover {
  transform: translateY(-1px);
}
.cart-badge {
  box-shadow: 0 0 0 2px var(--bg-color), 0 2px 6px rgba(0, 0, 0, 0.3);
  font-variant-numeric: tabular-nums;
}

/* Normal cart and AWD cart — same height, same baseline, same badge position */
.header-controls .cart-icon-btn {
  box-sizing: border-box;
  height: 40px;
  min-width: 40px;
  padding: 0 0.5rem;
  align-self: center;
}
.header-controls .awd-cart-btn {
  padding: 0 0.75rem 0 0.65rem;
  border-radius: 10px;
}
.header-controls .cart-icon-btn .cart-badge {
  top: -3px;
  right: -5px;
  line-height: 1.2;
}

.user-dropdown {
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
html.light-theme .user-dropdown {
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

/* Search — pill with icon */
.search-form input[type="search"],
html.light-theme .search-form input[type="search"] {
  border-radius: 999px;
  padding: 0.55rem 1.1rem 0.55rem 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 1rem center;
  background-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.search-form input[type="search"] {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
html.light-theme .search-form input[type="search"] {
  background-color: #f1f4f8;
  border-color: transparent;
}
.search-form input[type="search"]:focus,
html.light-theme .search-form input[type="search"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
}
html.light-theme .search-form input[type="search"]:focus {
  background-color: #fff;
}
.search-dropdown {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}
html.light-theme .search-dropdown {
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  background: linear-gradient(180deg, #23272b 0%, #1d2024 100%);
  padding: 1.1rem 0.85rem 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
html.light-theme #sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.03);
}

.sidebar-logo {
  border-bottom: none;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.5rem 1.1rem;
  position: relative;
}
.sidebar-logo::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
html.light-theme .sidebar-logo::after {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.12), transparent);
}
.sidebar-logo img {
  transition: filter 0.3s ease, transform 0.4s var(--ease-out);
}
.sidebar-logo:hover img {
  transform: scale(1.04);
}

#sidebar h2 {
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  opacity: 0.55;
  padding: 0.6rem 0.8rem 0.5rem;
}

#category-list {
  font-family: var(--font-sans);
}

.sidebar-cat-item {
  margin-bottom: 2px;
}

.sidebar-main-link {
  position: relative;
  padding: 0.62rem 0.8rem 0.62rem 0.95rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sidebar-text);
  transition: background 0.2s ease, color 0.2s ease, padding 0.25s var(--ease-out);
}
.sidebar-main-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #4d94ff, var(--primary-color));
  transform: translateY(-50%);
  transition: height 0.25s var(--ease-out);
}
.sidebar-main-link:hover {
  background: var(--primary-softer);
  color: var(--sidebar-text);
  padding-left: 1.1rem;
}
.sidebar-main-link:hover::before {
  height: 40%;
}
.sidebar-main-link.active,
html.light-theme .sidebar-main-link.active {
  background: linear-gradient(90deg, var(--primary-soft), rgba(13, 110, 253, 0.03));
  color: var(--primary-color);
  font-weight: 600;
}
.sidebar-main-link.active::before {
  height: 62%;
}
html.light-theme .sidebar-main-link:hover {
  background: rgba(13, 110, 253, 0.06);
}

.sidebar-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.55;
  transition: transform 0.25s var(--ease-out), background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.sidebar-main-link:hover .sidebar-arrow,
.sidebar-main-link.active .sidebar-arrow {
  opacity: 1;
  transform: translateX(2px);
  background: var(--primary-soft);
  color: var(--primary-color);
}

/* Sub panel */
.sidebar-back-btn {
  border-bottom: none;
  border-radius: 999px;
  width: auto;
  padding: 0.4rem 0.9rem 0.4rem 0.65rem;
  margin: 0 0 0.6rem 0.2rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
}
html.light-theme .sidebar-back-btn {
  background: rgba(15, 23, 42, 0.05);
}
.sidebar-back-btn:hover {
  background: var(--primary-soft);
}

.sidebar-sub-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--sidebar-text);
  opacity: 1;
  padding: 0.25rem 0.8rem 0.65rem;
  line-height: 1.3;
}

#category-list .sidebar-sub-link {
  position: relative;
  display: block;
  margin: 1px 0;
  padding: 0.5rem 0.8rem 0.5rem 1.6rem;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  letter-spacing: 0;
  color: var(--sidebar-text-muted);
  transform: none;
  transition: background 0.2s ease, color 0.2s ease, padding 0.25s var(--ease-out);
}
#category-list .sidebar-sub-link::before {
  content: "";
  position: absolute;
  left: 0.8rem;
  top: 50%;
  bottom: auto;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.4;
  transform: translateY(-50%);
  transition: opacity 0.2s ease, transform 0.25s var(--ease-out), background 0.2s ease;
}
#category-list .sidebar-sub-link:hover {
  background: var(--primary-softer);
  color: var(--sidebar-text);
  padding-left: 1.8rem;
  transform: none;
}
#category-list .sidebar-sub-link:hover::before {
  width: 5px;
  opacity: 1;
  background: var(--primary-color);
  transform: translateY(-50%) scale(1.3);
}
#category-list .sidebar-sub-link.active {
  background: var(--primary-soft);
  color: var(--primary-color);
  font-weight: 600;
}
#category-list .sidebar-sub-link.active::before {
  opacity: 1;
  background: var(--primary-color);
}
/* "Sve iz kategorije" — first link, slightly emphasised */
#category-list .sidebar-sub-item:first-child .sidebar-sub-link {
  color: var(--sidebar-text);
  font-weight: 600;
}

/* ── Shop controls / page title ─────────────────────────────────────────── */
.shop-controls {
  margin-top: 1.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-color);
}
#current-category-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.sort-controls select {
  border-radius: 999px;
  padding: 0.45em 2.2em 0.45em 0.95em;
}

/* ── Category overview (main page) ──────────────────────────────────────── */
#category-overview {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.35rem;
  padding-bottom: 2rem;
}

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

.category-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: sorus-rise 0.55s var(--ease-out) both;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out), border-color 0.3s ease;
}
.category-card:nth-child(2)  { animation-delay: 0.04s; }
.category-card:nth-child(3)  { animation-delay: 0.08s; }
.category-card:nth-child(4)  { animation-delay: 0.12s; }
.category-card:nth-child(5)  { animation-delay: 0.16s; }
.category-card:nth-child(6)  { animation-delay: 0.20s; }
.category-card:nth-child(7)  { animation-delay: 0.24s; }
.category-card:nth-child(8)  { animation-delay: 0.28s; }
.category-card:nth-child(n+9) { animation-delay: 0.32s; }

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.45);
}
html.light-theme .category-card:hover {
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 16px 34px rgba(15, 23, 42, 0.12);
}

/* Light sheen that glides across the photo on hover */
.category-card-slideshow::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, 0.65) 48%,
    rgba(200, 225, 255, 0.35) 52%,
    transparent 70%
  );
  transform: translateX(-130%);
}
.category-card:hover .category-card-slideshow::before {
  transform: translateX(130%);
  transition: transform 1s var(--ease-out);
}

.category-card-slideshow {
  height: 200px;
  background:
    radial-gradient(120% 90% at 50% 40%, #ffffff 55%, #f1f4f8 100%);
}
/* soft fade at the bottom of the image into the card */
.category-card-slideshow::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 36px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.06));
  pointer-events: none;
}
.cat-slide-img {
  padding: 1.1rem;
  transform: scale(1);
  transition: opacity 1.2s ease, transform 0.8s var(--ease-out);
}
.category-card:hover .cat-slide-img.active {
  transform: scale(1.06);
}

.category-card-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem 1rem 1.2rem;
  text-align: left;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  border-top: 1px solid var(--border-color);
}
.category-card-name::after {
  content: "→";
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--primary-softer);
  transition: background 0.25s ease, color 0.25s ease, transform 0.35s var(--ease-out);
}
.category-card:hover .category-card-name::after {
  background: var(--primary-color);
  color: #fff;
  transform: translateX(3px);
  box-shadow: var(--primary-glow);
}

/* ── Article cards ──────────────────────────────────────────────────────── */
#article-grid {
  gap: 1.35rem;
  padding-bottom: 2rem;
}

.article-card {
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: sorus-rise 0.45s var(--ease-out) both;
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s ease;
}
.article-card:hover,
html.light-theme .article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(13, 110, 253, 0.28);
}

.article-card img {
  transition: transform 0.6s var(--ease-out), background-color 0.3s ease;
}
.article-card:hover img:not(.sorus-logo-fallback) {
  transform: scale(1.04);
}
.article-link {
  overflow: hidden;
}

.article-card-content {
  padding: 1rem 1.1rem 1.1rem;
  border-top: 1px solid var(--border-color);
}
.article-card-content h3 {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}
.article-card-content .article-sifra {
  font-size: 0.74rem;
  opacity: 0.75;
  letter-spacing: 0.01em;
}

.article-card-footer {
  padding-top: 0.75rem;
  margin-top: auto;
}

.price.normal {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.price.discounted {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.qty-stepper-btn,
.add-to-cart-controls .quantity-input-grid {
  border-radius: var(--radius-sm);
}
.qty-stepper-btn {
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s var(--ease-out);
}
.qty-stepper-btn:active {
  transform: scale(0.92);
}
.add-to-cart-controls .add-to-cart-btn {
  border-radius: var(--radius-sm);
  padding: 0 0.85em;
}

.article-admin-edit-btn {
  border-radius: 999px;
  padding: 2px 9px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.marketplace-out-of-stock {
  border-radius: 999px;
}

/* ── Cart modal & dialogs ───────────────────────────────────────────────── */
.cart-content,
.awd-cart-content,
.awd-warning-content,
#confirmation-modal-content {
  border-radius: var(--radius-lg);
}
.cart-item {
  border-radius: var(--radius-md);
}
.cart-item img {
  border-radius: var(--radius-sm);
}
.cart-summary #checkout-btn {
  border-radius: var(--radius-md);
}

/* ── Article detail page ────────────────────────────────────────────────── */
#article-detail-container {
  border-radius: var(--radius-lg);
}
#article-detail-image {
  border-radius: var(--radius-md);
  overflow: hidden;
}
#article-detail-info h1 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.article-purchase-box {
  border-radius: var(--radius-md);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar-thumb {
  border-radius: 999px;
}

/* ── Respect reduced-motion preferences ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .category-card,
  .article-card {
    animation: none;
  }
  .category-card-slideshow::before {
    display: none;
  }
  .category-card,
  .article-card,
  .cat-slide-img,
  .article-card img,
  .sidebar-main-link,
  .sidebar-sub-link {
    transition: none !important;
  }
}

/* ── Responsive (re-applied because this file loads after style.css) ────── */
@media (min-width: 769px) and (max-width: 1024px) {
  #category-overview {
    grid-template-columns: repeat(2, 1fr);
  }
  #article-grid {
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  /* Header: "Sorus B2B" and the carts never shrink; the ☰ toggle is compact */
  .main-header {
    padding: 0 0.6rem;
  }
  .main-header h1 {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 1.08rem;
    margin: 0 0.35rem 0 0.15rem;
  }
  #sidebar-toggle {
    flex-shrink: 0;
    padding: 0.3rem 0.45rem;
    font-size: 1.1rem;
    line-height: 1;
  }
  .mobile-search-btn {
    flex-shrink: 0;
  }
  .header-controls {
    flex-shrink: 0;
    gap: 0.35rem;
  }
  .header-controls .cart-icon-btn,
  .header-controls .user-icon-btn {
    height: 36px;
    min-width: 36px;
    padding: 0 0.4rem;
  }
  .header-controls .awd-cart-btn {
    padding: 0 0.5rem 0 0.45rem;
  }
  /* "Administracija" keeps its text on phones, just a bit more compact */
  /* app.js sets display:inline-block inline, so centre via line-height = height */
  .header-btn {
    box-sizing: border-box;
    text-align: center;
    height: 32px;
    line-height: 30px; /* 32px minus the 1px top + bottom border */
    padding: 0 0.6rem;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  #current-category-title {
    font-size: 1.2rem;
  }
  .shop-controls {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
  }

  #category-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .category-card {
    border-radius: var(--radius-md);
  }
  .category-card:hover {
    transform: none;
  }
  .category-card-slideshow {
    height: 130px;
  }
  .cat-slide-img {
    padding: 0.6rem;
  }
  .category-card-name {
    padding: 0.65rem 0.75rem;
    font-size: 0.85rem;
  }
  .category-card-name::after {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  #article-grid {
    gap: 0.6rem;
  }
  .article-card {
    border-radius: var(--radius-md);
  }
  .article-card:hover {
    transform: none;
  }
  .article-card-content {
    padding: 0.55rem 0.6rem 0.65rem;
  }
  .article-card-content h3 {
    font-size: 0.88rem;
  }
  .price.normal,
  .price.discounted {
    font-size: 1.05rem;
  }

  /* ── Carts on phones: full-screen sheet, list scrolls, totals + button always visible ── */
  #cart-modal,
  .awd-cart-modal {
    align-items: stretch;
  }
  .cart-content,
  .awd-cart-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;      /* fallback */
    height: 100dvh;     /* real visible height (excludes the browser's address bar) */
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .cart-header {
    padding: 0.75rem 0.9rem;
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    flex-shrink: 0;
  }
  .cart-header h2 {
    font-size: 1.15rem;
  }
  .cart-header-actions {
    gap: 0.4rem;
  }
  .cart-clear-btn {
    height: 36px;
    padding: 0 0.8rem;
    font-size: 0.8rem;
  }
  #cart-close-btn,
  #awd-cart-close-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 400;
    background: none;
    border: none;
    color: var(--text-muted);
  }

  #cart-items-container,
  #awd-cart-items-container {
    padding: 0.75rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Cart row: image | name on top, quantity + total underneath */
  .cart-item {
    grid-template-columns: 56px 1fr auto;
    grid-template-areas:
      "img info  info"
      "img qty   total";
    gap: 0.4rem 0.75rem;
    padding: 0.7rem;
    margin-bottom: 0.6rem;
  }
  .cart-item:hover,
  html.light-theme .cart-item:hover {
    transform: none;
    box-shadow: none;
  }
  .cart-item img {
    grid-area: img;
    width: 56px;
    height: 56px;
    align-self: start;
  }
  .cart-item-info {
    grid-area: info;
    min-width: 0;
  }
  .cart-item-info h4 {
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .cart-item-info .price,
  .cart-item-info .price-discount-note {
    font-size: 0.78rem;
  }
  .cart-item-quantity {
    grid-area: qty;
    gap: 0.35rem;
  }
  .cart-item-quantity button {
    width: 36px;
    height: 36px;
    line-height: 36px;
  }
  .cart-item-quantity button:hover {
    transform: none;
  }
  .cart-item-quantity span {
    min-width: 26px;
  }
  .cart-item-total {
    grid-area: total;
    min-width: 0;
    align-self: center;
    font-size: 1rem;
  }

  .cart-summary {
    flex-shrink: 0;
    padding: 0.85rem 0.9rem;
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
  }
  html.light-theme .cart-summary {
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  }
  .summary-line {
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
  }
  .summary-line.total {
    font-size: 1.1rem;
    margin-top: 0.4rem;
    padding-top: 0.5rem;
  }
  .summary-line.total span:last-child {
    font-size: 1.2rem;
  }
  .cart-summary #checkout-btn,
  .cart-summary #awd-checkout-btn {
    margin-top: 0.75rem !important;
    min-height: 48px;
    font-size: 1rem;
  }

  /* AWD minimum-order warning dialog */
  .awd-warning-content {
    width: calc(100% - 2rem);
    padding: 1.25rem;
  }
  .awd-warning-content h3 {
    font-size: 1.05rem;
  }
  .awd-warning-actions button {
    width: 100%;
    min-height: 44px;
  }
}

/* Small phones: AWD cart drops its text label (orange icon + badge still mark it) */
@media (max-width: 420px) {
  .header-controls .awd-cart-label {
    display: none;
  }
  .header-controls .awd-cart-btn {
    padding: 0 0.4rem;
    color: rgb(255, 140, 0);
  }
  #sidebar-toggle {
    padding: 0.3rem 0.35rem;
    font-size: 1rem;
  }
  .header-controls {
    gap: 0.25rem;
  }
}

@media (max-width: 380px) {
  #category-overview {
    grid-template-columns: 1fr;
  }
}
