/*
 * Panel Dawmac — wygląd 2026
 * Nakładany na zbudowaną aplikację (te same id i klasy co w src/), bez zmian w logice.
 * Czerwień marki #d10404, nagłówki Barlow Condensed jak na dawmac.pl, interfejs Geist.
 */

:root {
  --bg: #09090a;
  --surface: rgba(255, 255, 255, .032);
  --surface-2: rgba(255, 255, 255, .055);
  --surface-solid: #141416;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --line-3: rgba(255, 255, 255, .2);
  --text: #f5f5f6;
  --text-2: #a8a8b0;
  --text-3: #6e6e77;
  --red: #d10404;
  --red-hi: #ff2b2b;
  --red-soft: #ff6b6b;
  --red-tint: rgba(209, 4, 4, .12);
  --ok: #34d399;
  --warn: #fbbf24;
  --r-lg: 20px;
  --r-md: 12px;
  --r-sm: 9px;
  --f-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --edge: max(20px, calc((100vw - 1520px) / 2 + 32px));

  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  color-scheme: dark;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(209, 4, 4, .17), transparent 62%),
    radial-gradient(800px 520px at 108% 4%, rgba(209, 4, 4, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* delikatna siatka w tle, wygaszana ku dołowi */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 30% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 30% 0%, #000 20%, transparent 75%);
}

::selection { background: rgba(209, 4, 4, .55); color: #fff; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent; }

a { color: var(--text); text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 600; }

hr { display: none; }

/* ─────────────────────────  Kontrolki  ───────────────────────── */

input, select, textarea {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 11px 14px;
  font: 400 14px/1.4 var(--f-ui);
  color: var(--text);
  background-color: rgba(255, 255, 255, .035);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--line-3);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(255, 70, 70, .75);
  background-color: rgba(255, 255, 255, .05);
  box-shadow: 0 0 0 4px rgba(209, 4, 4, .18);
}

input:disabled, select:disabled, textarea:disabled { opacity: .45; cursor: not-allowed; }

textarea { resize: vertical; min-height: 88px; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  cursor: pointer;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

select option { background: #161618; color: var(--text); }

/* pole na zdjęcia jako strefa upuszczania — natywny input przyjmuje przeciągnięte pliki */
input[type="file"] {
  min-height: 92px;
  padding: 26px 64px 26px 22px;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  background-color: rgba(255, 255, 255, .02);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6e77' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M12 3v12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 22px center;
  background-size: 24px;
  border: 1.5px dashed rgba(255, 255, 255, .15);
  border-radius: 16px;
}

input[type="file"]:hover {
  border-color: rgba(255, 70, 70, .55);
  background-color: rgba(209, 4, 4, .05);
}

input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 9px 16px;
  font: 600 13px/1 var(--f-ui);
  color: #0b0b0c;
  background: #f5f5f6;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease;
}

input[type="file"]::file-selector-button:hover { background: #fff; }

input[type="radio"] { accent-color: var(--red); }

/* ─────────────────────────  Przyciski  ───────────────────────── */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  font: 600 14px/1.1 var(--f-ui);
  letter-spacing: 0;
  text-transform: none;
  color: #fff;
  background: linear-gradient(180deg, #ec1b1b 0%, #c40303 100%);
  border: 1px solid rgba(255, 110, 110, .35);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 26px -12px rgba(225, 6, 0, .85);
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease, transform .1s ease, background-color .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 14px 32px -12px rgba(255, 30, 30, .95);
}

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

button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--red-hi);
  outline-offset: 3px;
}

/* przyciski drugorzędne */
#root > button,
.forged-order__btns button,
.forged-edit-image button,
.gallery-edit-project-image-wrapper button,
#forged-edit-wheel-images > button,
#gallery-edit-project > button:first-of-type {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

#root > button:hover:not(:disabled),
.forged-order__btns button:hover:not(:disabled),
.forged-edit-image button:hover:not(:disabled),
.gallery-edit-project-image-wrapper button:hover:not(:disabled),
#forged-edit-wheel-images > button:hover:not(:disabled),
#gallery-edit-project > button:first-of-type:hover:not(:disabled) {
  filter: none;
  background: rgba(255, 255, 255, .1);
  border-color: var(--line-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

/* przyciski usuwania */
.forged-order__btns button:last-child,
.forged-edit-image > button:last-child,
.gallery-edit-project-image-wrapper > button:first-child,
#forged-edit-controlls > button:last-child,
#gallery-edit-project > button:last-of-type {
  color: var(--red-soft);
  background: rgba(209, 4, 4, .09);
  border: 1px solid rgba(255, 80, 80, .24);
  box-shadow: none;
}

.forged-order__btns button:last-child:hover:not(:disabled),
.forged-edit-image > button:last-child:hover:not(:disabled),
.gallery-edit-project-image-wrapper > button:first-child:hover:not(:disabled),
#forged-edit-controlls > button:last-child:hover:not(:disabled),
#gallery-edit-project > button:last-of-type:hover:not(:disabled) {
  filter: none;
  color: #fff;
  background: rgba(209, 4, 4, .75);
  border-color: rgba(255, 90, 90, .6);
  box-shadow: 0 10px 24px -12px rgba(225, 6, 0, .9);
}

/* linki tekstowe */
button.wheel-picker-link {
  min-height: 0;
  padding: 2px 0;
  justify-content: flex-start;
  align-self: flex-start;
  font: 500 13px/1.4 var(--f-ui);
  color: var(--text-3);
  background: none;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .2);
  text-underline-offset: 4px;
}

button.wheel-picker-link:hover:not(:disabled) {
  filter: none;
  color: var(--text);
  box-shadow: none;
  text-decoration-color: var(--red-hi);
}

/* ─────────────────────────  Etykiety i komunikaty  ───────────────────────── */

.dm-label,
.wheel-picker-title,
#gallery-edit-project label {
  font: 600 11px/1.2 var(--f-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.gallery-add-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  animation: dm-pojaw .25s ease both;
}

.gallery-add-msg::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--red-hi);
  box-shadow: 0 0 0 4px rgba(255, 43, 43, .16);
}

@keyframes dm-pojaw { from { opacity: 0; transform: translateY(-4px); } }
@keyframes dm-kolo { to { transform: rotate(360deg); } }

/* ─────────────────────────  Sprawdzanie sesji i logowanie  ───────────────────────── */

#root > p:only-child {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 100vh;
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

#root > p:only-child::before {
  content: "";
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .1);
  border-top-color: var(--red-hi);
  animation: dm-kolo .8s linear infinite;
}

#root:has(> form) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 32px 16px;
}

#root > h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 600 11px/1 var(--f-ui);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

#root > h1::before {
  content: "DM";
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding-top: 1px;
  font: 700 17px/1 var(--f-display);
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(140deg, #ff3131 0%, #b30000 100%);
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 8px 22px -8px rgba(225, 6, 0, .9);
}

#root > h1::after {
  content: "Dawmac";
  order: -1;
  padding-right: 12px;
  font: 700 23px/1 var(--f-display);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #fff;
  border-right: 1px solid var(--line-2);
}

#root > h1::before { order: -2; }

#root > form {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 30px 28px 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  border: 1px solid var(--line-2);
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 40px 80px -30px rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

#root > form::before {
  content: "Zaloguj się";
  margin-bottom: 8px;
  font: 700 34px/1 var(--f-display);
  text-transform: uppercase;
  letter-spacing: .01em;
  color: #fff;
}

#root > form button[type="submit"] { width: 100%; margin-top: 6px; }

#root > form > p {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #ff9a9a !important;
  background: rgba(209, 4, 4, .1);
  border: 1px solid rgba(255, 80, 80, .25);
  border-radius: 10px;
}

/* ─────────────────────────  Szkielet po zalogowaniu  ───────────────────────── */

#root:has(#forged) {
  max-width: 1520px;
  margin: 0 auto;
  padding: 92px 32px 96px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

/* górny pasek */
body:has(#forged)::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: 64px;
  background:
    linear-gradient(90deg, transparent 5%, rgba(255, 43, 43, .55) 50%, transparent 95%) bottom / 100% 1px no-repeat,
    rgba(9, 9, 10, .72);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  backdrop-filter: saturate(150%) blur(18px);
  border-bottom: 1px solid var(--line);
}

#root:has(#forged) > h1 {
  position: fixed;
  z-index: 41;
  top: 0;
  left: var(--edge);
  height: 64px;
}

#root:has(#forged) > button {
  position: fixed;
  z-index: 41;
  top: 12px;
  right: var(--edge);
  min-height: 40px;
  padding: 9px 14px 9px 12px;
  font-size: 13px;
  border-radius: 11px;
}

#root:has(#forged) > button::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E") center / contain no-repeat;
}

#forged, #forged-tools { display: contents; }

/* nagłówki sekcji: Galeria / Forged */
#root > h2,
#forged > h2 {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 18px 2px 16px;
  border-bottom: 1px solid var(--line);
}

#forged > h2 { margin-top: 36px; }

#root > h2::before,
#forged > h2::before {
  font: 700 clamp(38px, 4.2vw, 60px)/.86 var(--f-display);
  letter-spacing: .005em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 30%, #8d8d95 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#root > h2::before { content: "Galeria realizacji"; }
#forged > h2::before { content: "Dawmac Forged"; }

#root > h2 > a,
#forged > h2 > a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 4px;
  padding: 7px 12px 7px 11px;
  font: 500 13px/1 var(--f-ui);
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

#root > h2 > a::before,
#forged > h2 > a::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .18);
}

#root > h2 > a::after,
#forged > h2 > a::after {
  content: "↗";
  font-size: 14px;
  color: var(--text-3);
  transition: transform .15s ease, color .15s ease;
}

#root > h2 > a:hover,
#forged > h2 > a:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: rgba(255, 70, 70, .5);
}

#root > h2 > a:hover::after,
#forged > h2 > a:hover::after { color: var(--red-hi); transform: translate(2px, -2px); }

/* ─────────────────────────  Karty  ───────────────────────── */

#gallery-add-wheel,
#gallery-fix-list,
#gallery-edit-project,
#forged-add-wheel,
#forged-edit-wheel {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 22px 24px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .042) 0%, rgba(255, 255, 255, .018) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 30px 60px -40px rgba(0, 0, 0, .9);
}

/* tytuł karty: kafel z ikoną + nazwa + podpis */
#gallery-add-wheel > h2,
#gallery-fix-list > h2,
#gallery-edit-project > h2,
#forged-add-wheel > h2,
#forged-edit-wheel > h2 {
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 0 0 18px;
  font: 600 25px/1 var(--f-display);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  border-bottom: 1px solid var(--line);
}

#gallery-add-wheel > h2::before,
#gallery-fix-list > h2::before,
#gallery-edit-project > h2::before,
#forged-add-wheel > h2::before,
#forged-edit-wheel > h2::before {
  content: "";
  grid-row: span 2;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 80, 80, .28);
  background-color: rgba(209, 4, 4, .12);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px -12px rgba(225, 6, 0, .6);
}

#gallery-add-wheel > h2::after,
#gallery-fix-list > h2::after,
#gallery-edit-project > h2::after,
#forged-add-wheel > h2::after,
#forged-edit-wheel > h2::after {
  margin-top: 5px;
  font: 400 13px/1.3 var(--f-ui);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}

#gallery-add-wheel > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 5h6'/%3E%3Cpath d='M19 2v6'/%3E%3Cpath d='M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5'/%3E%3Cpath d='m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3C/svg%3E");
}
#gallery-add-wheel > h2::after { content: "Auto, felga i zdjęcia — trafią na karty produktów w sklepie"; }

#gallery-fix-list > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 17 2 2 4-4'/%3E%3Cpath d='m3 7 2 2 4-4'/%3E%3Cpath d='M13 6h8'/%3E%3Cpath d='M13 12h8'/%3E%3Cpath d='M13 18h8'/%3E%3C/svg%3E");
}
#gallery-fix-list > h2::after { content: "Wpisy z galerii, które nie pasują do żadnego produktu"; }

#gallery-edit-project > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.4 3.6a2.1 2.1 0 1 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E");
}
#gallery-edit-project > h2::after { content: "Auto, felga i zdjęcia realizacji"; }

#forged-add-wheel > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M12 2.5v7M12 14.5v7M2.5 12h7M14.5 12h7M5.3 5.3l5 5M13.7 13.7l5 5M18.7 5.3l-5 5M10.3 13.7l-5 5'/%3E%3C/svg%3E");
}
#forged-add-wheel > h2::after { content: "Nowy model — nazwa podpowiada się sama"; }

#forged-edit-wheel > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7h-9'/%3E%3Cpath d='M14 17H5'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3Ccircle cx='7' cy='7' r='3'/%3E%3C/svg%3E");
}
#forged-edit-wheel > h2::after { content: "Nazwa, opis i kolejność zdjęć"; }

/* ─────────────────────────  Galeria: dodaj auto  ───────────────────────── */

#gallery-add-wheel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#gallery-add-wheel > * { grid-column: 1 / -1; }
#gallery-add-wheel > #car_brand { grid-column: 1; }
#gallery-add-wheel > #car_model { grid-column: 2; }
#gallery-add-wheel > h2 { margin-bottom: 6px; }
#gallery-add-wheel > button { margin-top: 4px; }

.wheel-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.wheel-picker > * { grid-column: 1 / -1; }
.wheel-picker > .wheel-picker-select { grid-column: auto; }
.wheel-picker-title { padding: 2px 2px 0; }

.wheel-picker-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.wheel-picker-hint.ok,
.wheel-picker-hint.warn {
  display: flex;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
}

.wheel-picker-hint.ok { color: #a7f3d0; background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .2); }
.wheel-picker-hint.warn { color: #fde68a; background: rgba(251, 191, 36, .07); border: 1px solid rgba(251, 191, 36, .2); }

.wheel-picker-hint.ok::before { content: "✓"; font-weight: 700; color: var(--ok); }
.wheel-picker-hint.warn::before { content: "!"; font-weight: 700; color: var(--warn); }

/* ─────────────────────────  Galeria: do poprawy  ───────────────────────── */

.fix-podsumowanie {
  margin: 0 0 14px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text-2);
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

#gallery-fix-list > .gallery-add-msg { margin-bottom: 12px; }

.fix-lista {
  list-style: none;
  margin: 0 -8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fix-poz {
  border: 1px solid transparent;
  border-radius: 14px;
  transition: background .15s ease, border-color .15s ease;
}

.fix-poz + .fix-poz:not(.otwarta)::before {
  content: "";
  display: block;
  height: 1px;
  margin: -2px 12px 0;
  background: var(--line);
}

.fix-poz.otwarta + .fix-poz::before { display: none; }

.fix-poz.otwarta {
  margin: 6px 0;
  background: rgba(255, 255, 255, .035);
  border-color: var(--line-2);
}

button.fix-naglowek {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  padding: 9px 12px;
  font: 400 14px/1.3 var(--f-ui);
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 13px;
  box-shadow: none;
}

button.fix-naglowek:hover:not(:disabled) {
  filter: none;
  background: rgba(255, 255, 255, .04);
  box-shadow: none;
}

.fix-poz.otwarta button.fix-naglowek { background: none; }

button.fix-naglowek::after {
  content: "";
  width: 16px;
  height: 16px;
  opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .2s ease, opacity .15s ease;
}

.fix-poz.otwarta button.fix-naglowek::after { transform: rotate(180deg); opacity: .9; }

.fix-licznik {
  justify-self: stretch;
  padding: 6px 0;
  font: 600 15px/1 var(--f-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #ff8a8a;
  background: rgba(209, 4, 4, .13);
  border: 1px solid rgba(255, 80, 80, .2);
  border-radius: 9px;
}

.fix-nazwa {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.fix-rodzaj {
  padding: 4px 10px;
  font: 500 12px/1.2 var(--f-ui);
  white-space: nowrap;
  color: var(--text-2);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line-2);
  border-radius: 999px;
}

.fix-rodzaj.fix-brand { color: #fca5a5; background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .25); }
.fix-rodzaj.fix-model { color: #fcd34d; background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .22); }

.fix-tresc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 14px 16px 82px;
}

.fix-tresc > button:not(.wheel-picker-link) { align-self: flex-start; }

.fix-podpowiedzi { display: flex; flex-direction: column; gap: 8px; }

button.fix-sug {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 0;
  padding: 11px 110px 11px 14px;
  text-align: left;
  color: var(--text);
  background: rgba(52, 211, 153, .06);
  border: 1px solid rgba(52, 211, 153, .22);
  border-radius: var(--r-md);
  box-shadow: none;
}

button.fix-sug::after {
  content: "Popraw →";
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font: 600 12.5px/1 var(--f-ui);
  color: var(--ok);
  opacity: .75;
  transition: opacity .15s ease, transform .15s ease;
}

button.fix-sug:hover:not(:disabled) {
  filter: none;
  background: rgba(52, 211, 153, .11);
  border-color: rgba(52, 211, 153, .45);
  box-shadow: none;
}

button.fix-sug:hover:not(:disabled)::after { opacity: 1; transform: translate(3px, -50%); }

button.fix-sug.ryzyko { background: rgba(251, 191, 36, .05); border-color: rgba(251, 191, 36, .22); }
button.fix-sug.ryzyko::after { color: var(--warn); }
button.fix-sug.ryzyko:hover:not(:disabled) { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .45); }

.fix-sug strong { font-weight: 600; font-size: 14px; }
.fix-sug span { font-size: 12.5px; color: var(--text-3); }
.fix-sug.ryzyko span { color: var(--warn); }

.fix-odrzuc {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-2);
}

#gallery-fix-list > button.wheel-picker-link {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  justify-content: center;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
}

#gallery-fix-list > button.wheel-picker-link:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line-3);
}

/* ─────────────────────────  Galeria: edycja  ───────────────────────── */

#gallery-edit-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 10px;
  row-gap: 0;
  align-items: center;
}

#gallery-edit-project > h2 { grid-column: 1 / -1; }
#gallery-edit-project > select { grid-row: 2; grid-column: 1; }
#gallery-edit-project > button:first-of-type { grid-row: 2; grid-column: 2; }
#gallery-edit-project > button:last-of-type { grid-row: 2; grid-column: 3; }

#gallery-edit-project > .gallery-add-msg {
  grid-row: 3;
  grid-column: 1 / -1;
  margin-top: 14px;
}

#gallery-edit-project > div {
  grid-row: 4;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

#gallery-edit-project > div > h3 {
  grid-row: 1;
  grid-column: 1 / 3;
  align-self: center;
  font: 600 20px/1 var(--f-display);
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-2);
}

#gallery-edit-project > div > p {
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  margin: 0 0 8px;
  padding: 5px 10px;
  font: 500 12.5px/1 var(--f-mono);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
}

#gallery-edit-project > div > label { grid-row: 2; padding-left: 2px; }
#gallery-edit-project > div > input { grid-row: 3; }
#gallery-edit-project > div > label:nth-of-type(1),
#gallery-edit-project > div > input:nth-of-type(1) { grid-column: 1; }
#gallery-edit-project > div > label:nth-of-type(2),
#gallery-edit-project > div > input:nth-of-type(2) { grid-column: 2; }
#gallery-edit-project > div > label:nth-of-type(3),
#gallery-edit-project > div > input:nth-of-type(3) { grid-column: 3; }
#gallery-edit-project > div > br { display: none; }

.gallery-edit-project-images {
  grid-row: 4;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.gallery-edit-project-images:empty { display: none; }

/* kafel zdjęcia: przyciski wychodzą na wierzch po najechaniu */
.gallery-edit-project-image-wrapper,
.forged-edit-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #0e0e10;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  isolation: isolate;
  transition: border-color .15s ease, box-shadow .2s ease, transform .2s ease;
}

.gallery-edit-project-image-wrapper::after,
.forged-edit-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, transparent 34%, transparent 58%, rgba(0, 0, 0, .7) 100%);
  opacity: 0;
  transition: opacity .2s ease;
}

.gallery-edit-project-image-wrapper:hover,
.forged-edit-image:hover {
  border-color: var(--line-3);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .9);
}

.gallery-edit-project-image-wrapper:hover::after,
.forged-edit-image:hover::after { opacity: 1; }

.gallery-edit-project-image,
.forged-edit-image img {
  display: block;
  width: 100% !important;
  height: 100%;
  object-fit: cover;
  border: 0 !important;
  border-radius: 0 !important;
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

.gallery-edit-project-image-wrapper:hover .gallery-edit-project-image,
.forged-edit-image:hover img { transform: scale(1.05); }

.gallery-edit-project-image-wrapper > button,
.forged-edit-image > button {
  position: absolute;
  z-index: 2;
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: 10px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

.gallery-edit-project-image-wrapper:hover > button,
.gallery-edit-project-image-wrapper:focus-within > button,
.forged-edit-image:hover > button,
.forged-edit-image:focus-within > button {
  opacity: 1;
  transform: none;
}

/* usuń — prawy górny róg; ustaw jako główne — dół */
.gallery-edit-project-image-wrapper > button:first-child,
.forged-edit-image > button:last-child {
  top: 8px;
  right: 8px;
  background: rgba(20, 0, 0, .55);
}

.gallery-edit-project-image-wrapper > button:last-child,
.forged-edit-image > button:not(:last-child) {
  left: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(20, 20, 22, .6);
  border-color: rgba(255, 255, 255, .18);
}

.forged-edit-image--main,
.gallery-edit-project-image-wrapper--main {
  border-color: rgba(255, 60, 60, .7);
  box-shadow: 0 0 0 3px rgba(209, 4, 4, .22);
}

.forged-edit-image--main:hover,
.gallery-edit-project-image-wrapper--main:hover { border-color: rgba(255, 60, 60, .9); }

.forged-edit-image__badge {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 5px 9px;
  font: 600 11px/1 var(--f-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(140deg, #ff3131, #b30000);
  border-radius: 999px;
  box-shadow: 0 6px 16px -6px rgba(225, 6, 0, .9);
}

/* ekrany dotykowe nie mają najechania — przyciski widoczne zawsze */
@media (hover: none) {
  .gallery-edit-project-image-wrapper > button,
  .forged-edit-image > button { opacity: 1; transform: none; }
  .gallery-edit-project-image-wrapper::after,
  .forged-edit-image::after { opacity: 1; }
}

/* ─────────────────────────  Forged: dodaj felgę  ───────────────────────── */

#forged-add-wheel-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#forged-add-wheel { container-type: inline-size; }

.forged-series {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.forged-series label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 500;
  color: var(--text-3);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: color .15s ease, background .2s ease, border-color .2s ease;
}

.forged-series label:hover { color: var(--text); }

.forged-series input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  pointer-events: none;
}

.forged-series label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  transition: background .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.forged-series label:has(input:checked) {
  color: #fff;
  background: rgba(255, 255, 255, .09);
  border-color: var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 16px -10px rgba(0, 0, 0, .8);
}

.forged-series label:has(input:checked)::before {
  opacity: 1;
  background: var(--red-hi);
  box-shadow: 0 0 0 3px rgba(255, 43, 43, .22);
}

.forged-series label:has(input:focus-visible) { outline: 2px solid var(--red-hi); outline-offset: 2px; }

/* cztery serie w jednym rzędzie, gdy karta jest dość szeroka; węższa — dwa na dwa */
@container (min-width: 640px) {
  .forged-series { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

#forged-add-wheel-form input[name="wheel_name"] {
  font: 500 16px/1.2 var(--f-mono);
  letter-spacing: .02em;
}

#forged-add-wheel-form > button[type="submit"] { width: 100%; margin-top: 2px; }

.forged-order {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.forged-order__hint { margin: 0; font-size: 13px; color: var(--text-3); }

.forged-order__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forged-order__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  animation: dm-pojaw .2s ease both;
}

.forged-order__item--main {
  background: rgba(209, 4, 4, .07);
  border-color: rgba(255, 60, 60, .45);
}

.forged-order__item img {
  flex: none;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 9px;
}

.forged-order__nr {
  flex: none;
  min-width: 30px;
  padding: 4px 8px;
  font: 600 12px/1 var(--f-mono);
  text-align: center;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 7px;
}

.forged-order__item--main .forged-order__nr {
  font-family: var(--f-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: #fff;
  background: linear-gradient(140deg, #ff3131, #b30000);
}

.forged-order__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-2);
}

.forged-order__btns { display: flex; gap: 4px; flex: none; margin-left: auto; }

.forged-order__btns button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 9px;
}

.forged-order__btns .forged-order__arrow {
  width: 32px;
  padding: 0;
  font-size: 10px;
}

/* ─────────────────────────  Forged: edycja  ───────────────────────── */

#forged-edit-wheel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#forged-edit-wheel > h2 { margin-bottom: 6px; }

#forged-edit-wheel-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

#forged-edit-wheel-info > span {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font: 500 13px/1 var(--f-mono);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}

#forged-edit-wheel-info > input[type="text"] { font: 500 16px/1.2 var(--f-mono); }

#forged-edit-wheel-info > textarea,
#forged-edit-wheel-images { grid-column: 1 / -1; }

#forged-edit-wheel-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 6px 0 0;
}

#forged-edit-wheel-images .forged-edit-image {
  display: block;
  padding: 0;
  aspect-ratio: 1;
}

#forged-edit-wheel-images > input[type="file"] { grid-column: 1 / -1; }

#forged-edit-wheel-images > button {
  grid-column: 1 / -1;
  justify-self: start;
}

#forged-edit-wheel-images > button::before { content: "+"; font-size: 17px; font-weight: 500; }

#forged-edit-controlls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ─────────────────────────  Nakładka „Ładowanie…”  ───────────────────────── */

#root [style*="z-index: 1000"] {
  flex-direction: column;
  gap: 18px;
  font: 500 12px/1 var(--f-ui) !important;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-2) !important;
  background: rgba(6, 6, 8, .72) !important;
  -webkit-backdrop-filter: blur(5px) saturate(120%);
  backdrop-filter: blur(5px) saturate(120%);
  z-index: 1000 !important;
  animation: dm-pojaw .2s ease both;
}

#root [style*="z-index: 1000"]::before {
  content: "";
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .1);
  border-top-color: var(--red-hi);
  box-shadow: 0 0 40px -6px rgba(255, 43, 43, .6);
  animation: dm-kolo .75s linear infinite;
}

/* ─────────────────────────  Układ bento  ───────────────────────── */

#gallery-add-wheel,
#forged-add-wheel { grid-column: 1 / span 5; }

#gallery-fix-list,
#forged-edit-wheel { grid-column: 6 / -1; }

#gallery-edit-project { grid-column: 1 / -1; }

/* lista „Do poprawy” przyjmuje wysokość formularza obok i przewija się w środku */
@media (min-width: 900px) {
  #gallery-fix-list {
    align-self: stretch;
    contain: size;
    min-height: 560px;
    display: flex;
    flex-direction: column;
  }

  #gallery-fix-list > h2,
  #gallery-fix-list > p,
  #gallery-fix-list > button { flex: none; }

  #gallery-fix-list .fix-lista {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 8px;
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(180deg, #000 calc(100% - 28px), transparent);
  }
}

@media (max-width: 1179px) {
  #gallery-add-wheel,
  #forged-add-wheel,
  #gallery-fix-list,
  #forged-edit-wheel { grid-column: span 6; }
  .fix-tresc { padding-left: 14px; }
}

@media (max-width: 899px) {
  #root:has(#forged) {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 84px 16px 64px;
  }

  #root > h2,
  #forged > h2,
  #gallery-add-wheel,
  #gallery-fix-list,
  #gallery-edit-project,
  #forged-add-wheel,
  #forged-edit-wheel { grid-column: 1 / -1; }
  #forged > h2 { margin-top: 20px; }

  #gallery-fix-list .fix-lista {
    max-height: 64vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #root > h2,
  #forged > h2 { padding-top: 8px; }
}

@media (max-width: 640px) {
  :root { --edge: 16px; }

  #root:has(#forged) > button { padding: 0; width: 40px; font-size: 0; gap: 0; }

  #root > h1::after { font-size: 21px; }

  #gallery-add-wheel,
  #gallery-fix-list,
  #gallery-edit-project,
  #forged-add-wheel,
  #forged-edit-wheel { padding: 18px 16px 18px; border-radius: 18px; }

  #gallery-add-wheel > h2::after,
  #gallery-fix-list > h2::after,
  #gallery-edit-project > h2::after,
  #forged-add-wheel > h2::after,
  #forged-edit-wheel > h2::after { font-size: 12.5px; }

  #gallery-add-wheel,
  .wheel-picker { grid-template-columns: minmax(0, 1fr); }
  #gallery-add-wheel > #car_brand,
  #gallery-add-wheel > #car_model { grid-column: 1; }

  .fix-lista { margin: 0 -6px; }
  button.fix-naglowek { grid-template-columns: 46px minmax(0, 1fr) 16px; gap: 10px; padding: 9px 8px; }
  .fix-rodzaj { grid-row: 2; grid-column: 2; justify-self: start; }
  button.fix-naglowek::after { grid-row: 1; grid-column: 3; }
  .fix-tresc { padding: 4px 10px 14px; }
  button.fix-sug { padding-right: 14px; }
  button.fix-sug::after { position: static; transform: none; margin-top: 4px; }
  button.fix-sug:hover:not(:disabled)::after { transform: none; }

  #gallery-edit-project { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  #gallery-edit-project > select { grid-column: 1 / -1; }
  #gallery-edit-project > button:first-of-type { grid-row: 3; grid-column: 1; }
  #gallery-edit-project > button:last-of-type { grid-row: 3; grid-column: 2; }
  #gallery-edit-project > .gallery-add-msg { grid-row: 4; margin-top: 2px; }
  #gallery-edit-project > div { grid-row: 5; grid-template-columns: minmax(0, 1fr); margin-top: 6px; }
  #gallery-edit-project > div > * { grid-column: 1 !important; grid-row: auto !important; }
  #gallery-edit-project > div > p { justify-self: start; }
  #gallery-edit-project > div > label { margin-top: 6px; }
  .gallery-edit-project-images { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  .gallery-edit-project-image-wrapper > button,
  .forged-edit-image > button {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11.5px;
    white-space: nowrap;
    border-radius: 8px;
  }

  .gallery-edit-project-image-wrapper > button:last-child,
  .forged-edit-image > button:not(:last-child) { left: 6px; right: 6px; bottom: 6px; }

  .gallery-edit-project-image-wrapper > button:first-child,
  .forged-edit-image > button:last-child { top: 6px; right: 6px; }

  .forged-order__name { display: none; }
  .forged-order__item { gap: 8px; flex-wrap: wrap; }
  .forged-order__btns { justify-content: flex-end; }
  .forged-order__btns button { padding: 6px 8px; }
  #forged-edit-wheel-images { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  #forged-edit-controlls { flex-direction: column-reverse; }
  #forged-edit-controlls > button { width: 100%; }

  input[type="file"] { padding: 22px 52px 22px 16px; background-position: right 16px center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ─────────────────────────  Filmiki z realizacji + dostęp przez API  ─────────────────────────
 * Doklejane przez build.py na koniec panel.css. Karty wyglądają jak „Dodaj felgę” i „Edycja felgi”.
 */

#forged-videos,
#forged-api-keys {
  grid-column: 1 / -1;
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 22px 24px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .042) 0%, rgba(255, 255, 255, .018) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 30px 60px -40px rgba(0, 0, 0, .9);
}

#forged-videos > h2,
#forged-api-keys > h2 {
  display: grid;
  grid-template-columns: 42px 1fr;
  column-gap: 14px;
  align-items: center;
  margin: 0 0 18px;
  padding: 0 0 18px;
  font: 600 25px/1 var(--f-display);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  border-bottom: 1px solid var(--line);
}

#forged-videos > h2::before,
#forged-api-keys > h2::before {
  content: "";
  grid-row: span 2;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 80, 80, .28);
  background-color: rgba(209, 4, 4, .12);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px -12px rgba(225, 6, 0, .6);
}

#forged-videos > h2::after,
#forged-api-keys > h2::after {
  margin-top: 5px;
  font: 400 13px/1.3 var(--f-ui);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}

#forged-videos > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='19' height='14' rx='3'/%3E%3Cpath d='m10 9.2 5 2.8-5 2.8z'/%3E%3C/svg%3E");
}
#forged-videos > h2::after { content: "Linki do YouTube. Widoczne filmiki są w zakładce Filmiki na forged.dawmacpolska.pl"; }

#forged-api-keys > h2::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c5c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7.5' cy='15.5' r='4.5'/%3E%3Cpath d='m10.7 12.3 9.8-9.8'/%3E%3Cpath d='m16 7 3 3'/%3E%3Cpath d='m18.5 4.5 2 2'/%3E%3C/svg%3E");
}
#forged-api-keys > h2::after { content: "Klucze do dodawania filmików z innych programów"; }

/* ── układ: formularz po lewej, lista po prawej ── */

.dmv-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 24px;
  align-items: start;
}

.dmv-add,
.dmv-edit {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.dmv-add > button[type="submit"] { width: 100%; margin-top: 2px; }

.dmv-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.dmv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dmv-link { font: 500 14px/1.3 var(--f-mono); }

.dmv-muted { color: var(--text-3); }

.dmv-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-3);
}
.dmv-hint--warn { color: var(--warn); }

/* ── podgląd filmu po wklejeniu linku ── */

.dmv-preview {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  animation: dm-pojaw .25s ease both;
}
.dmv-preview--vertical { grid-template-columns: 72px minmax(0, 1fr); }

.dmv-preview__img {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}
.dmv-preview--vertical .dmv-preview__img { aspect-ratio: 9 / 16; }
.dmv-preview__img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dmv-preview__txt {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 13px;
}
.dmv-preview__txt strong { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--text); }

/* ── plakietki ── */

.dmv-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.dmv-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font: 600 10.5px/1.3 var(--f-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
}
.dmv-badge--red { color: #fff; background: rgba(209, 4, 4, .28); border-color: rgba(255, 80, 80, .45); }
.dmv-badge--warn { color: var(--warn); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .35); }
.dmv-badge--off { color: var(--text-3); background: transparent; border-style: dashed; }

/* ── przełączniki ── */

.dmv-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 4px 2px;
}

.dmv-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

/* globalny styl inputów w panelu daje width:100% i min-height:44px — tu go zdejmujemy */
.dmv-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.dmv-switch__ui {
  flex: none;
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--line-2);
  transition: background .15s ease, border-color .15s ease;
}
.dmv-switch__ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d4d4d8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  transition: transform .18s ease, background .15s ease;
}
.dmv-switch input:checked + .dmv-switch__ui {
  background: linear-gradient(180deg, #ec1b1b 0%, #c40303 100%);
  border-color: rgba(255, 110, 110, .5);
}
.dmv-switch input:checked + .dmv-switch__ui::after { transform: translateX(16px); background: #fff; }
.dmv-switch input:focus-visible + .dmv-switch__ui { outline: 2px solid var(--red-hi); outline-offset: 3px; }
.dmv-switch:hover { color: var(--text); }

/* ── lista filmików ── */

.dmv-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.dmv-list__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.dmv-list__count {
  font-size: 13.5px;
  color: var(--text-2);
  margin-right: auto;
}
.dmv-list__count strong { font: 600 22px/1 var(--f-display); color: #fff; margin-right: 2px; }

.dmv-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line-2);
  border-radius: 11px;
}
.dmv-seg button {
  min-height: 32px;
  padding: 6px 12px;
  font: 500 13px/1 var(--f-ui);
  color: var(--text-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}
.dmv-seg button:hover:not(:disabled) { filter: none; color: var(--text); box-shadow: none; }
.dmv-seg button.is-on { color: #fff; background: rgba(255, 255, 255, .1); }

.dmv-search { width: min(260px, 100%); min-height: 38px; padding: 8px 12px; font-size: 13.5px; }

.dmv-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dmv-item {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  grid-template-areas: "thumb meta" "thumb actions";
  column-gap: 16px;
  row-gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .15s ease, background .15s ease, opacity .15s ease;
}
.dmv-item:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .035); }
.dmv-item--off .dmv-thumb, .dmv-item--off .dmv-meta__title { opacity: .55; }
.dmv-item--busy { opacity: .6; pointer-events: none; }

.dmv-thumb {
  grid-area: thumb;
  position: relative;
  align-self: start;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 9px;
  background: #000;
}
.dmv-thumb__img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.dmv-thumb--vertical .dmv-thumb__img { object-fit: contain; }
.dmv-thumb__bg {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  object-fit: cover;
  filter: blur(14px) brightness(.45);
}
.dmv-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(9, 9, 10, .72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M9 7.5v9l7.5-4.5z'/%3E%3C/svg%3E") center / 18px no-repeat;
  border: 1px solid rgba(255, 255, 255, .25);
  opacity: 0;
  transition: opacity .15s ease;
}
.dmv-thumb:hover::after { opacity: 1; }

.dmv-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.dmv-meta__title { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.dmv-meta__sub { font: 500 12.5px/1.35 var(--f-mono); color: var(--text-2); }
.dmv-meta__when { font-size: 12px; text-transform: none; letter-spacing: 0; }

.dmv-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dmv-btn,
a.dmv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  font: 500 13px/1 var(--f-ui);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  cursor: pointer;
}
.dmv-btn:hover:not(:disabled) {
  filter: none;
  background: rgba(255, 255, 255, .1);
  border-color: var(--line-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
a.dmv-btn--link { color: var(--text-2); }
a.dmv-btn--link:hover { color: #fff; border-color: rgba(255, 70, 70, .5); }
.dmv-btn--del { color: var(--red-soft); background: rgba(209, 4, 4, .09); border-color: rgba(255, 80, 80, .24); box-shadow: none; }
.dmv-btn--del:hover:not(:disabled) {
  color: #fff;
  background: rgba(209, 4, 4, .75);
  border-color: rgba(255, 90, 90, .6);
  box-shadow: 0 10px 24px -12px rgba(225, 6, 0, .9);
}

.dmv-edit {
  grid-column: 1 / -1;
  padding: 14px;
  margin-top: 2px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  animation: dm-pojaw .2s ease both;
}
.dmv-edit__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dmv-edit__btns > button[type="submit"] { flex: 1 1 180px; }
.dmv-edit__btns > .dmv-btn { min-height: 44px; padding: 11px 18px; font-size: 14px; }

.dmv-empty {
  margin: 0;
  padding: 26px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-3);
  border: 1.5px dashed rgba(255, 255, 255, .1);
  border-radius: var(--r-md);
}

/* ── dostęp przez API ── */

.dmk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dmk-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.dmk-intro { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }

.dmk-new { display: flex; gap: 10px; }
.dmk-new > input { flex: 1 1 auto; }
.dmk-new > button { flex: none; }

.dmk-fresh {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(52, 211, 153, .06);
  border: 1px solid rgba(52, 211, 153, .35);
  border-radius: var(--r-md);
  animation: dm-pojaw .25s ease both;
}
.dmk-fresh code {
  display: block;
  padding: 10px 12px;
  font: 500 13.5px/1.4 var(--f-mono);
  color: #fff;
  word-break: break-all;
  background: rgba(0, 0, 0, .35);
  border-radius: 8px;
  user-select: all;
}
.dmk-fresh__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.dmk-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }

.dmk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.dmk-item--off { opacity: .55; }
.dmk-item__txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12.5px; }
.dmk-item__txt strong { font-size: 14px; font-weight: 600; color: var(--text); }
.dmk-item__txt code, .dmk-docs code { font: 500 12px/1.3 var(--f-mono); color: var(--text-2); }

.dmk-code {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font: 500 12.5px/1.6 var(--f-mono);
  color: #e4e4e7;
  background: rgba(0, 0, 0, .4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  white-space: pre;
}

.dmk-docs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
}

@media (max-width: 1179px) {
  .dmv-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 899px) {
  .dmv-grid, .dmk-grid { grid-template-columns: minmax(0, 1fr); }
  .dmv-list { padding-top: 18px; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  #forged-videos,
  #forged-api-keys { padding: 18px 16px 18px; border-radius: 18px; }
  #forged-videos > h2::after,
  #forged-api-keys > h2::after { font-size: 12.5px; }
  .dmv-row { grid-template-columns: minmax(0, 1fr); }
  .dmv-item {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-areas: "thumb meta" "actions actions";
    column-gap: 12px;
  }
  .dmv-search { width: 100%; }
  .dmk-new { flex-direction: column; }
}

/* ─────────────────────────  Galeria: edycja — wyszukiwarka i auto (12.10)  ───────────────────────── */

#gallery-edit-project > .gallery-edit-search {
  grid-row: 2;
  grid-column: 1 / -1;
  margin-bottom: 10px;
  padding-left: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 16px;
}

#gallery-edit-project > .gallery-edit-search::-webkit-search-cancel-button { cursor: pointer; }

#gallery-edit-project > select { grid-row: 3; }
#gallery-edit-project > button:first-of-type { grid-row: 3; }
#gallery-edit-project > button:last-of-type { grid-row: 3; }
#gallery-edit-project > .gallery-add-msg { grid-row: 4; }
#gallery-edit-project > div { grid-row: 5; }

/* auto nad felgą: marka i model w pierwszych dwóch kolumnach */
.gallery-edit-car { display: contents; }
#gallery-edit-project .gallery-edit-car > label { grid-row: 2; padding-left: 2px; }
#gallery-edit-project .gallery-edit-car > select { grid-row: 3; }
#gallery-edit-project .gallery-edit-car > :nth-child(-n+2) { grid-column: 1; }
#gallery-edit-project .gallery-edit-car > :nth-child(n+3) { grid-column: 2; }
#gallery-edit-project > div > label { grid-row: 4; margin-top: 8px; }
#gallery-edit-project > div > input { grid-row: 5; }
#gallery-edit-project .gallery-edit-project-images { grid-row: 6; }

@media (max-width: 640px) {
  #gallery-edit-project > .gallery-edit-search { margin-bottom: 0; }
  #gallery-edit-project > button:first-of-type,
  #gallery-edit-project > button:last-of-type { grid-row: 4; }
  #gallery-edit-project > .gallery-add-msg { grid-row: 5; }
  #gallery-edit-project > div { grid-row: 6; }
  #gallery-edit-project .gallery-edit-car > * { grid-column: 1 !important; grid-row: auto !important; }
  #gallery-edit-project .gallery-edit-car > label,
  #gallery-edit-project > div > label { margin-top: 6px; }
}

/* ─────────────  Dodawanie marki/modelu auta i modelu felgi z formularza  ───────────── */

.dm-inline-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#gallery-add-wheel > .dm-inline-add--brand { grid-column: 1; }
#gallery-add-wheel > .dm-inline-add--model { grid-column: 2; }
.wheel-picker > .dm-inline-add { grid-column: 1 / -1; }

.dm-inline-add > input { flex: 1 1 170px; min-width: 0; }
.dm-inline-add > .wheel-picker-hint { flex: 1 1 100%; }

.dm-inline-add--open {
  padding: 10px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.wheel-picker > .dm-inline-add--open { background: rgba(255, 255, 255, .03); }

.dm-inline-add__open:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  #gallery-add-wheel > .dm-inline-add--brand,
  #gallery-add-wheel > .dm-inline-add--model { grid-column: 1; }
}
