/* Własne style ponad Pico CSS. Kolory i typografia: zmienne Pico (--pico-*). */

.brand {
  font-weight: 700;
}

/* Na wąskich ekranach (telefon na hali) menu zawija się zamiast wychodzić poza ekran */
header nav,
header nav ul {
  flex-wrap: wrap;
}

.soon {
  color: var(--pico-muted-color);
  cursor: default;
}

.ok {
  color: var(--pico-ins-color);
}

footer.container {
  padding-block: 2rem;
  color: var(--pico-muted-color);
}

/* Tytuł strony mniejszy niż domyślny w Pico: nazwa aplikacji jest już w nagłówku */
main h1 {
  --pico-font-size: 1.75rem;
}

/* --- Edytor kształtu --- */

.bad {
  color: var(--pico-del-color);
}

.muted {
  color: var(--pico-muted-color);
}

.check {
  display: block;
  min-height: 1.2em;
  margin-top: -0.6rem;
  margin-bottom: 0.4rem;
  color: var(--pico-muted-color);
}

.check.bad {
  color: var(--pico-del-color);
}

.shape-table input {
  margin-bottom: 0.5rem;
  min-width: 6rem;
}

.shape-table th[scope="row"] {
  font-weight: 700;
  width: 1%;
}

.shape-table .cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shape-table .side-name {
  min-width: 1.8rem;
  color: var(--pico-muted-color);
  font-size: 0.85em;
}

.actions,
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.actions button,
.examples button,
details button {
  width: auto;
  margin-bottom: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.9em;
}

details {
  margin-block: 1rem;
}

.diagonal {
  margin-bottom: 0.25rem;
}

@media (max-width: 575px) {
  .shape-table input {
    min-width: 3.5rem;
  }

  .shape-table th,
  .shape-table td {
    padding-inline: 0.3rem;
  }
}

/* --- Podgląd kształtu (SVG) i układ edytora --- */

@media (min-width: 992px) {
  .editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--pico-spacing);
    align-items: start;
  }

  .editor-layout > article {
    position: sticky;
    top: 1rem;
    margin-top: 0;
  }
}

.shape-preview {
  display: block;
  width: 100%;
  max-height: 60vh;
}

.shape-preview .outline {
  fill: var(--pico-primary-background);
  fill-opacity: 0.08;
  stroke: var(--pico-primary);
  stroke-width: 2;
  stroke-linejoin: round;
}

.shape-preview .diagonal-line {
  stroke: var(--pico-muted-color);
  stroke-width: 1;
  stroke-dasharray: 6 4;
}

/* Kolor etykiet ustalony na poziomie rysunku: Pico zmienia --pico-color w elementach
   z role="button" (biały tekst przycisku), więc etykieta nie może go czytać u siebie. */
.shape-preview {
  --label-color: var(--pico-color);
}

.shape-preview text {
  fill: var(--label-color);
  text-anchor: middle;
  dominant-baseline: central;
}

/* Etykiety wymiarów mają role="button" (obsługa klawiatury), a Pico nadaje takim elementom
   styl przycisku, w tym własny rozmiar czcionki. Przywracamy rozmiar z rysunku. */
.shape-preview .dim {
  font-size: 1em;
}

.shape-preview .ang {
  fill: var(--pico-muted-color);
  font-size: 0.85em;
}

.shape-preview .vtx {
  font-weight: 700;
}

.shape-preview .computed {
  fill: var(--pico-muted-color);
  font-style: italic;
}

.shape-preview .bad {
  fill: var(--pico-del-color);
  font-weight: 700;
}

.legend {
  color: var(--pico-muted-color);
  margin-bottom: 0.5rem;
}

/* --- Szkic myszą --- */

.sketch {
  display: block;
  width: 100%;
  aspect-ratio: 48 / 30;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-background-color);
  cursor: crosshair;
  touch-action: none; /* palec na tablecie rysuje zamiast przewijać */
  user-select: none;
}

.sketch .grid-line {
  fill: none;
  stroke: var(--pico-muted-color);
  stroke-opacity: 0.25;
  stroke-width: 0.04;
}

.sketch .grid-line.major {
  stroke-opacity: 0.45;
  stroke-width: 0.07;
}

.sketch .sketch-path,
.sketch .sketch-shape,
.sketch .sketch-rubber {
  fill: none;
  stroke: var(--pico-primary);
  stroke-width: 0.12;
  stroke-linejoin: round;
}

.sketch .sketch-shape {
  fill: var(--pico-primary-background);
  fill-opacity: 0.1;
}

.sketch .sketch-rubber {
  stroke-dasharray: 0.3 0.2;
}

.sketch circle {
  fill: var(--pico-primary);
}

.sketch circle.start {
  fill: var(--pico-background-color);
  stroke: var(--pico-primary);
  stroke-width: 0.12;
}

.sketch .sketch-len {
  font-size: 1px;
  text-anchor: middle;
  fill: var(--pico-color);
}

.sketch-actions .cell-size {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.sketch-actions .cell-size input {
  width: 5rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
}

.notice {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--pico-primary);
  background: var(--pico-card-sectioning-background-color);
}

.shape-preview [data-focus] {
  cursor: pointer;
}

/* --- Import z rysunku: obrysy znalezione w pliku --- */

.import-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.import-candidates button {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 11rem;
  padding: 0.4rem;
}

.import-candidates svg {
  width: 100%;
  height: 4rem;
}

.import-candidates polygon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

/* --- Wycieraczka: profile na podglądzie i lista cięć --- */

.shape-preview .outline.with-mat {
  fill: none;
}

.shape-preview .mat {
  fill: none;
  stroke: var(--pico-muted-color);
  stroke-width: 1;
  stroke-dasharray: 5 3;
}

.shape-preview .profile {
  fill: var(--pico-primary-background);
  fill-opacity: 0.18;
  stroke: var(--pico-primary);
  stroke-width: 0.6;
}

/* Wkłady mieszane: pierwszy wkład z cennika w kolorze profili, kolejne wyróżnione
   (klasy insert-c1 … insert-c5 wg kolejności w cenniku, web/mat.py insert_css) */
.shape-preview .profile.insert-c1,
.insert-swatch.insert-c1 {
  fill: #c98a1a;
  background: #c98a1a;
}

.shape-preview .profile.insert-c2,
.insert-swatch.insert-c2 {
  fill: #2f9e5b;
  background: #2f9e5b;
}

.shape-preview .profile.insert-c3,
.insert-swatch.insert-c3 {
  fill: #8a5cc2;
  background: #8a5cc2;
}

.shape-preview .profile.insert-c4,
.insert-swatch.insert-c4 {
  fill: #c4473a;
  background: #c4473a;
}

.shape-preview .profile.insert-c5,
.insert-swatch.insert-c5 {
  fill: #1f8fa3;
  background: #1f8fa3;
}

.shape-preview .profile.insert-c1,
.shape-preview .profile.insert-c2,
.shape-preview .profile.insert-c3,
.shape-preview .profile.insert-c4,
.shape-preview .profile.insert-c5 {
  fill-opacity: 0.35;
}

.insert-swatch {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.1em;
  border: 1px solid var(--pico-primary);
  background: var(--pico-primary-background);
  opacity: 0.6;
}

.shape-preview .profile-no {
  fill: var(--pico-primary);
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--pico-background-color);
  stroke-width: 6;
  pointer-events: none;
}

.shape-preview .walk-arrow {
  stroke: var(--pico-del-color);
  stroke-width: 2.5;
}

.shape-preview .arrow-head {
  fill: var(--pico-del-color);
}

.mat-settings {
  margin-top: 1rem;
}

.mat-settings label {
  margin-bottom: 0.5rem;
}

.cut-table td,
.cut-table th {
  white-space: nowrap;
}

.variants tr.current td {
  font-weight: 700;
}

.piece-icon {
  width: 4rem;
  height: 1rem;
  vertical-align: middle;
}

.piece-icon polygon {
  fill: var(--pico-primary-background);
  fill-opacity: 0.25;
  stroke: var(--pico-primary);
  stroke-width: 1.5;
}

/* --- Projekty --- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filters input[type="search"] {
  flex: 1 1 16rem;
  margin: 0;
}

.filters select,
.filters button,
.filters [role="button"] {
  width: auto;
  margin: 0;
}

.status {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.85em;
  background: var(--pico-card-sectioning-background-color);
  border: 1px solid var(--pico-muted-border-color);
}

.status-zamowiony,
.status-w_produkcji {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

.status-wydany {
  border-color: var(--pico-ins-color);
  color: var(--pico-ins-color);
}

.status-anulowany {
  color: var(--pico-muted-color);
  text-decoration: line-through;
}

.save-bar input {
  font-weight: 600;
}

button.small {
  padding: 0.15rem 0.5rem;
  margin: 0;
  width: auto;
}

.files {
  list-style: none;
  padding: 0;
}

.files li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.files form {
  margin: 0;
}

.notes {
  white-space: pre-line;
}

.status-form select {
  margin: 0;
}

/* --- Logowanie --- */

.login {
  max-width: 24rem;
  margin: 3rem auto;
}

.logout {
  margin: 0;
}

/* --- Rama z kątownika --- */

.shape-preview .frame-band {
  fill: var(--pico-muted-color);
  fill-opacity: 0.25;
  stroke: var(--pico-muted-color);
  stroke-width: 0.6;
}

.frame-title {
  margin-top: 1.5rem;
  font-size: 1.05rem;
}

/* --- Rozkrój belek --- */

.bars {
  list-style: none;
  padding: 0;
}

.bars li {
  margin-bottom: 1rem;
}

.bar-head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.bar {
  display: flex;
  height: 1.6rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.3rem;
  overflow: hidden;
  margin: 0.25rem 0;
}

.bar-part {
  flex-grow: 0;
  flex-shrink: 0;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-right: 2px solid var(--pico-background-color);
  font-size: 0.75rem;
  line-height: 1.6rem;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.bar-waste {
  flex-grow: 0;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    45deg,
    var(--pico-muted-border-color) 0 4px,
    transparent 4px 8px
  );
}

.bar-list {
  display: block;
  line-height: 1.4;
}

/* --- Cennik --- */

.pricing-table input[type="text"] {
  margin-bottom: 0;
  min-width: 6rem;
}

.pricing-table input.narrow,
.pricing-add input.narrow {
  max-width: 7rem;
}

.pricing-table tr.muted td,
.pricing-table tr.muted th {
  opacity: 0.6;
}
