:root {
  --bg: #050509;
  --card: #11121a;
  --card-soft: #181926;
  --accent: #2de2e6;
  --accent-soft: rgba(45, 226, 230, .16);
  --text: #f5f5f7;
  --muted: #9a9cab;
  --border: #292a3b;
  --danger: #ff4b6a;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 18px 45px rgba(0,0,0,.55);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #171829 0, var(--bg) 58%);
}
button, input, select { font: inherit; }
.app { width: min(1380px, 100%); margin: 0 auto; }
.hero { margin-bottom: 18px; }
.hero-banner { position: relative; width: 100%; height: clamp(78px, 8vw, 108px); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #02050a; box-shadow: var(--shadow); }
.hero-banner .app-logo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.hero-title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; pointer-events: none; text-shadow: 0 3px 14px #000; }
.hero-title span { color: #ff5b18; font-weight: 950; font-size: clamp(1rem, 2.2vw, 1.6rem); letter-spacing: .02em; }
.hero-title strong { color: #eafcff; font-size: clamp(1.05rem, 2.5vw, 1.8rem); letter-spacing: .08em; }
.hero-banner .btn { position: absolute; right: 7px; bottom: 6px; width: auto; min-width: 0; min-height: 24px; margin: 0; padding: 2px 7px; 
font-size: .6rem; line-height: 1; box-shadow: 0 4px 10px rgba(0,0,0,.38); }
.app-logo { object-fit: contain; }
h1 { margin: 0; font-size: clamp(1.55rem, 4vw, 2.2rem); }
.hero p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: minmax(330px, 430px) minmax(0, 1fr); gap: 20px; }
.card { background: radial-gradient(circle at top left, #1b1c2a 0, var(--card) 60%); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: .8rem; }
input, select { width: 100%; min-height: 44px; padding: 10px 11px; color: var(--text); background: #0b0c13; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid { display: grid; gap: 10px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.canvas-settings { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #0b0c13; overflow: hidden; }
.canvas-settings summary { padding: 13px 14px; cursor: pointer; font-weight: 800; color: #dddfee; list-style-position: inside; }
.canvas-settings[open] summary { border-bottom: 1px solid var(--border); }
.canvas-settings .canvas-options { padding: 2px 12px 13px; }
.usage-guide { margin: 16px 0 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: #141522; overflow: hidden; }
.usage-guide summary { padding: 14px 16px; cursor: pointer; color: #f1f2f8; font-weight: 900; }
.usage-guide[open] summary { border-bottom: 1px solid var(--border); }
.usage-guide-content { padding: 4px 18px 16px; color: #d7d8e8; }
.usage-guide-content ol { margin: 8px 0 0; padding-left: 22px; }
.usage-guide-content li { margin: 9px 0; padding-left: 4px; line-height: 1.5; }
.usage-guide-content strong { color: #fff; }
.section-title { margin: 20px 0 8px; font-size: .82rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #dddfee; }
.section-title.no-margin { margin: 0; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.hint { color: var(--muted); font-size: .72rem; }
.info-box, .instructions-box { margin: 16px 0; padding: 14px; background: #141522; border-left: 4px solid var(--accent); border-radius: var(--radius-md); color: #d7d8e8; }
.info-box p, .instructions-box p { margin: 7px 0 0; line-height: 1.45; color: var(--muted); }
.btn { width: 100%; min-height: 46px; margin-top: 10px; padding: 11px 16px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 800; color: #001416; background: linear-gradient(200deg, var(--accent), #1aa7ab); box-shadow: 0 10px 25px rgba(45,226,230,.24); }
.btn:active { transform: translateY(1px); }
.btn-secondary { color: var(--text); background: #232536; box-shadow: none; border: 1px solid var(--border); }
.btn-danger { color: #fff; background: var(--danger); box-shadow: none; }
.hidden { display: none !important; }
.poz-list { max-height: 440px; overflow-y: auto; margin-top: 10px; padding-right: 4px; scroll-behavior: smooth; }
.poz { margin-bottom: 9px; padding: 12px; background: var(--card-soft); border: 1px solid var(--border); border-radius: var(--radius-md); }
.poz:first-child { border-color: rgba(45,226,230,.65); }
.history-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.history-controls .btn:disabled { opacity: .38; cursor: not-allowed; }
.canvas-center-btn { width: 100%; margin-top: 8px; min-height: 46px; }
.project-summary { margin-top: 14px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.summary-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-soft); }
.summary-item span { display: block; color: var(--muted); font-size: .76rem; }
.summary-item strong { display: block; margin-top: 3px; }
.pipe-cut-only { margin-top: 16px; }
.poz-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: .76rem; font-weight: 800; }
.remove-btn { border: 0; background: transparent; color: var(--danger); cursor: pointer; }
.poz-row { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 7px; }
.poz-row input, .poz-row select { min-width: 0; min-height: 40px; padding: 8px; }
.hidden-input { opacity: .12; pointer-events: none; }
.drawing-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.drawing-toolbar > div { width: auto; }
.drawing-toolbar-left { display: flex; align-items: center; gap: 12px; }
.drawing-toolbar p { margin: 0 0 10px; color: var(--muted); font-size: .78rem; text-align: right; }
.drawing-toolbar-actions { display: flex; width: auto !important; align-items: center; justify-content: flex-end; gap: 10px; }
.drawing-toolbar-actions p { margin: 0; }
.canvas-fullscreen-btn, .canvas-fullscreen-exit { min-height: 34px; padding: 7px 12px; border: 1px solid rgba(45,226,230,.72); border-radius: 999px; color: #fff; background: linear-gradient(135deg, rgba(28,165,180,.9), rgba(23,94,124,.95)); cursor: pointer; font-weight: 850; white-space: nowrap; box-shadow: 0 5px 16px rgba(22,194,210,.2); }
.canvas-center-toolbar-btn { margin: 0; }
.canvas-fullscreen-exit { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 5; background: rgba(25,31,42,.92); }
.drawing-card.canvas-fullscreen { position: fixed !important; inset: 0 !important; z-index: 9999 !important; display: flex; flex-direction: column; width: 100vw; height: 100dvh; max-width: none; margin: 0 !important; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important; border: 0 !important; border-radius: 0 !important; background: #080910; overflow: hidden !important; }
.drawing-card.canvas-fullscreen > *:not(#c):not(#canvasFullscreenExitBtn) { display: none !important; }
.drawing-card.canvas-fullscreen #c { flex: 1 1 auto; width: 100%; height: 100% !important; min-height: 0; margin: 0; border-radius: 10px; }
body.canvas-fullscreen-open { overflow: hidden !important; }
.canvas-delete-btn { min-height: 34px; padding: 7px 12px; border: 1px solid rgba(255,75,106,.65); border-radius: 999px; color: #fff; background: rgba(255,75,106,.16); cursor: pointer; font-weight: 800; white-space: nowrap; }
.canvas-settings-below { margin-top: 10px; }
.canvas-delete-wide { display: block; width: 100%; margin-top: 8px; min-height: 42px; background: rgba(255,75,106,.22); }
#c { display: block; width: 100%; height: clamp(390px, 58vh, 680px); margin-top: 12px; background: #05060b; border: 1px solid var(--border); border-radius: var(--radius-lg); touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: contain; }
.spec-list { margin-top: 14px; overflow-x: auto; }
.spec-title { margin: 10px 0; font-size: 1rem; font-weight: 800; }
.spec-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.spec-table th, .spec-table td { padding: 7px; border: 1px solid #414252; }
.spec-table th { background: #141522; }
.total-box { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 14px; padding: 13px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-md); }
.total-box strong { font-size: 1.2rem; color: var(--accent); }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button-grid.single { grid-template-columns: 1fr; }
footer { padding: 14px 0 8px; text-align: center; color: var(--muted); font-size: .8rem; }
footer a { color: var(--accent); font-weight: 800; text-decoration: none; }
footer a:hover { text-decoration: underline; }
.accuracy-disclaimer { margin: 22px auto 0; padding: 13px 15px; color: var(--muted); background: rgba(255, 190, 70, .07); border: 1px solid rgba(255, 190, 70, .3); border-radius: var(--radius-md); font-size: .78rem; line-height: 1.55; text-align: left; }
.accuracy-disclaimer strong { color: var(--text); }
@media (max-width: 920px) { .grid { grid-template-columns: 1fr; } .controls-card { order: 1; } .drawing-card { order: 2; } }
@media (max-width: 620px) {
  body { padding: 9px; }
  .hero-banner { height: 72px; border-radius: 12px; }
  .hero-title { justify-content: flex-start; padding-left: 12px; gap: 6px; }
  .hero-title span { font-size: .82rem; }
  .hero-title strong { font-size: .92rem; }
  .hero-banner .btn { right: 4px; bottom: 4px; min-height: 19px; padding: 1px 5px; font-size: .48rem; border-radius: 8px; }
  .card { padding: 13px; }
  .form-grid.two, .button-grid { grid-template-columns: 1fr; }
  .poz-row { grid-template-columns: 1fr 1fr; }
  .poz-row select { grid-column: 1 / -1; }
  .drawing-toolbar { align-items: stretch; flex-direction: column; gap: 2px; }
  .drawing-toolbar-left { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
  .drawing-toolbar > div { width: 100%; }
  .drawing-toolbar p { text-align: left; }
  .drawing-toolbar-actions { width: 100% !important; align-items: stretch; flex-direction: column; }
  .canvas-fullscreen-btn { width: 100%; min-height: 40px; }
  .canvas-center-toolbar-btn { width: auto; }
  .project-summary { grid-template-columns: 1fr; }
  .canvas-delete-btn { width: 100%; }
  #c { height: 430px; }
}
@media print {
  body * { visibility: hidden !important; }
  .drawing-card, .drawing-card * { visibility: visible !important; }
  .drawing-card { position: absolute; inset: 0; box-shadow: none; border: 0; }
  .drawing-toolbar, .button-grid, .instructions-box { display: none !important; }
}

/* Završna, jedinstvena pravila za canvas i specifikaciju */
html, body { max-width: 100%; overflow-x: hidden; }
.drawing-card { min-width: 0; overflow: hidden; }
#c {
  width: 100%;
  max-width: 100%;
  height: clamp(360px, 55vh, 620px);
  background: #fff;
  border-color: #4b4c5c;
  touch-action: none;
  overscroll-behavior: contain;
}

/* Konačni popis reznih mjera — nije tablica i ne može se stisnuti u stupac */
.cut-list {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  margin-top: 8px;
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #777;
  border-radius: 8px;
  overflow: hidden;
}
.cut-row {
  display: grid !important;
  grid-template-columns: minmax(0, 45%) minmax(0, 55%) !important;
  width: 100% !important;
  min-width: 0 !important;
  background: #fff !important;
  color: #111 !important;
  border-bottom: 1px solid #bbb;
}
.cut-row:last-child { border-bottom: 0; }
.cut-row > span,
.cut-row > strong {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 10px 12px;
  background: #fff !important;
  color: #111 !important;
  font-size: 14px;
  line-height: 1.25;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}
.cut-row > :last-child {
  text-align: right;
  border-left: 1px solid #bbb;
}
.cut-head > span {
  font-size: 12px;
  font-weight: 800;
  background: #f1f1f1 !important;
}
.cut-total > strong {
  font-weight: 900;
  border-top: 2px solid #111;
}

@media (max-width: 420px) {
  .cut-row > span,
  .cut-row > strong {
    padding: 9px 8px;
    font-size: 13px;
  }
  .cut-head > span { font-size: 11px; }
}

@media print {
  .cut-list {
    display: block !important;
    background: #fff !important;
    color: #000 !important;
    border: .25mm solid #000;
    border-radius: 0;
    overflow: visible;
  }
  .cut-row {
    display: grid !important;
    grid-template-columns: 45% 55% !important;
    break-inside: avoid;
    background: #fff !important;
    color: #000 !important;
    border-bottom: .25mm solid #000;
  }
  .cut-row > span,
  .cut-row > strong {
    padding: 2mm 2.5mm;
    background: #fff !important;
    color: #000 !important;
    font-size: 9pt;
    writing-mode: horizontal-tb !important;
    white-space: nowrap !important;
  }
  .cut-row > :last-child { border-left: .25mm solid #000; }
  .cut-head > span { background: #fff !important; }
}

#list,
.spec-list,
.spec-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#list { overflow: hidden; }
.spec-title {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: .95rem;
  font-weight: 800;
}
.spec-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.spec-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
  color: #111;
  font-size: 12px;
}
.spec-table th,
.spec-table td {
  padding: 7px 6px;
  background: #fff;
  color: #111;
  border: 1px solid #777;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
}
.spec-table th {
  font-weight: 800;
  text-align: left;
}
.spec-table th:nth-child(1),
.spec-table td:nth-child(1) { width: 8%; }
.spec-table th:nth-child(2),
.spec-table td:nth-child(2) { width: 16%; }
.spec-table th:nth-child(3),
.spec-table td:nth-child(3) { width: 12%; }
.spec-table th:nth-child(4),
.spec-table td:nth-child(4) { width: 25%; }
.spec-table th:nth-child(5),
.spec-table td:nth-child(5) { width: 25%; }
.spec-table th:nth-child(6),
.spec-table td:nth-child(6) { width: 14%; }
.spec-table .num {
  text-align: right;
  white-space: nowrap;
}
.spec-table .cut-value { font-weight: 900; }
.spec-table .spec-total td {
  font-weight: 900;
  border-top: 2px solid #111;
}
.spec-table .spec-total td:first-child { text-align: right; }

@media (max-width: 920px) {
  .controls-card { order: 1 !important; }
  .drawing-card { order: 2 !important; margin-top: 0; }
}

@media (max-width: 700px) {
  input, select, .poz-row input, .poz-row select { font-size: 16px; }
  .poz-list { max-height: none; overflow-y: visible; }
  #c { margin-top: 14px; height: 390px; }
  .drawing-card {
    padding-left: 10px;
    padding-right: 10px;
  }
  .spec-scroll { overflow: visible; }
  .spec-table,
  .spec-table thead,
  .spec-table tbody,
  .spec-table tr,
  .spec-table th,
  .spec-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .spec-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .spec-table tbody {
    display: grid;
    gap: 10px;
  }
  .spec-table tr {
    background: #fff;
    border: 1px solid #777;
    border-radius: 10px;
    overflow: hidden;
  }
  .spec-table td {
    display: grid;
    grid-template-columns: minmax(112px, 42%) minmax(0, 58%);
    align-items: start;
    gap: 8px;
    width: 100% !important;
    min-width: 100% !important;
    padding: 7px 9px;
    border: 0;
    border-bottom: 1px solid #ddd;
    text-align: left !important;
    font-size: 13px;
    overflow-wrap: normal;
    word-break: normal;
  }
  .spec-table td:nth-child(1),
  .spec-table td:nth-child(2),
  .spec-table td:nth-child(3),
  .spec-table td:nth-child(4),
  .spec-table td:nth-child(5),
  .spec-table td:nth-child(6) {
    width: 100% !important;
    min-width: 100% !important;
  }
  .spec-table td:last-child { border-bottom: 0; }
  .spec-table td::before {
    content: attr(data-label);
    font-weight: 800;
    color: #333;
  }
  .spec-table .num,
  .spec-table .cut-value { white-space: normal; }
  .spec-table .cut-value {
    font-size: 15px;
    font-weight: 900;
  }
  .spec-table .spec-total {
    border: 2px solid #111;
  }
  .spec-table .spec-total td[colspan] {
    display: block;
    width: 100% !important;
    min-width: 100% !important;
    font-weight: 900;
    text-align: center !important;
  }
  .spec-table .spec-total td[colspan]::before { content: none; }
}

/* Jednostavan popis reznih pozicija: uvijek samo dvije čitljive kolone */
.spec-table.simple-spec-table {
  display: table !important;
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  background: #fff !important;
}
.simple-spec-table thead {
  position: static !important;
  display: table-header-group !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
}
.simple-spec-table tbody {
  display: table-row-group !important;
}
.simple-spec-table tr {
  display: table-row !important;
  width: auto !important;
  background: #fff !important;
  border: 0 !important;
  border-radius: 0 !important;
}
.simple-spec-table th,
.simple-spec-table td,
.simple-spec-table td:nth-child(1),
.simple-spec-table td:nth-child(2) {
  display: table-cell !important;
  min-width: 0 !important;
  padding: 10px 12px !important;
  background: #fff !important;
  color: #111 !important;
  border: 1px solid #777 !important;
  vertical-align: middle;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}
.simple-spec-table th:first-child,
.simple-spec-table td:first-child {
  width: 45% !important;
  text-align: left !important;
}
.simple-spec-table th:last-child,
.simple-spec-table td:last-child {
  width: 55% !important;
  text-align: right !important;
}
.simple-spec-table td::before {
  content: none !important;
}
.simple-spec-table .spec-total td {
  font-weight: 900;
  border-top: 2px solid #111 !important;
}

/* Slika preko pune širine headera */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  width: 100vw;
  min-height: clamp(210px, 28vw, 360px);
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-bottom: 20px;
  padding: clamp(24px, 5vw, 68px)
           max(20px, calc((100vw - 1380px) / 2 + 20px));
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(2, 3, 8, .88) 0%, rgba(2, 3, 8, .48) 52%, rgba(2, 3, 8, .22) 100%),
    linear-gradient(0deg, rgba(2, 3, 8, .84) 0%, transparent 70%);
}
.hero .app-logo {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero > div {
  width: min(720px, 100%);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1;
  text-shadow: 0 3px 18px rgba(0, 0, 0, .85);
}
.hero p {
  max-width: 680px;
  margin-top: 10px;
  color: #f0f1f6;
  font-size: clamp(.9rem, 1.6vw, 1.15rem);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .9);
}
.hero .btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 190px;
  margin: 0 0 2px auto;
}

@media (max-width: 620px) {
  .hero {
    display: flex;
    min-height: 240px;
    padding: 18px 14px;
  }
  .hero h1 { font-size: clamp(2rem, 11vw, 3.3rem); }
  .hero p { margin-bottom: 0; }
  .hero .btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    padding: 9px 14px;
  }
}

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body {
    padding: 0;
    background: #fff;
    color: #000;
  }
  body * { visibility: hidden !important; }
  .drawing-card,
  .drawing-card * { visibility: visible !important; }
  .drawing-card {
    position: static;
    width: 100%;
    padding: 0;
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .drawing-toolbar,
  .button-grid,
  .instructions-box,
  .total-box { display: none !important; }
  #c {
    width: 100% !important;
    height: auto !important;
    max-height: 125mm;
    border: 1px solid #000;
    border-radius: 0;
  }
  #list,
  .spec-list,
  .spec-scroll {
    overflow: visible !important;
  }
  .spec-title {
    color: #000;
    font-size: 11pt;
  }
  .spec-table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    font-size: 8pt;
  }
  .spec-table thead { display: table-header-group !important; }
  .spec-table tbody { display: table-row-group !important; }
  .spec-table tr {
    display: table-row !important;
    break-inside: avoid;
    border: 0;
    border-radius: 0;
  }
  .spec-table th,
  .spec-table td {
    display: table-cell !important;
    width: auto;
    padding: 2mm 1.2mm;
    border: .25mm solid #000;
    font-size: 8pt;
  }
  .spec-table td::before { content: none !important; }
  .spec-table th:nth-child(1),
  .spec-table td:nth-child(1) { width: 8%; }
  .spec-table th:nth-child(2),
  .spec-table td:nth-child(2) { width: 16%; }
  .spec-table th:nth-child(3),
  .spec-table td:nth-child(3) { width: 12%; }
  .spec-table th:nth-child(4),
  .spec-table td:nth-child(4) { width: 25%; }
  .spec-table th:nth-child(5),
  .spec-table td:nth-child(5) { width: 25%; }
  .spec-table th:nth-child(6),
  .spec-table td:nth-child(6) { width: 14%; }
  .spec-table.simple-spec-table th:first-child,
  .spec-table.simple-spec-table td:first-child {
    width: 45% !important;
    background: #fff !important;
    color: #000 !important;
  }
  .spec-table.simple-spec-table th:last-child,
  .spec-table.simple-spec-table td:last-child {
    width: 55% !important;
    background: #fff !important;
    color: #000 !important;
  }
}

/* V7: čitljiv header bez dodatnog teksta preko slike */
.hero {
  min-height: clamp(260px, 31vw, 440px);
  padding: 0;
  background: #02070d;
}
.hero::before { display: none; }
.hero > div { display: none; }
.hero .app-logo {
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transform: translate(-50%, -50%);
}
.hero .btn {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: max(14px, calc((100vw - 1380px) / 2 + 20px));
  margin: 0;
}

/* Veća i jasnija slova reznih mjera */
.cut-row > span,
.cut-row > strong {
  padding: 12px 14px;
  font-size: 16px;
}
.cut-head > span {
  font-size: 13px;
  letter-spacing: .02em;
}
.cut-row > strong:last-child {
  color: #006f75 !important;
  font-size: 17px;
}

@media (max-width: 620px) {
  .hero {
    min-height: 250px;
    padding: 0;
  }
  .hero .app-logo {
    width: 190%;
    height: auto;
    object-fit: contain;
  }
  .hero .btn {
    top: 10px;
    right: 10px;
  }
  .cut-row > span,
  .cut-row > strong {
    padding: 11px 9px;
    font-size: 15px;
  }
  .cut-head > span { font-size: 12px; }
  .cut-row > strong:last-child { font-size: 16px; }
}

.flange-note {
  margin-top: 8px;
  padding: 8px 10px;
  color: #dffcff;
  background: rgba(45, 226, 230, .08);
  border: 1px solid rgba(45, 226, 230, .28);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.35;
}

/* ============================================================
   ZAVRŠNA VELIČINA HEADERA I TIPKE INSTALIRAJ
   Ova pravila moraju ostati na samom kraju datoteke.
   ============================================================ */

.hero.hero-banner {
  position: relative !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  height: auto !important;
  min-height: 70px !important;
  aspect-ratio: 1714 / 200 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.hero.hero-banner .app-logo {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: contain !important;
  object-position: center !important;
  transform: none !important;
}

.hero.hero-banner .btn {
  position: absolute !important;
  top: auto !important;
  right: 8px !important;
  bottom: 9px !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 9px 18px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  border: 1px solid rgba(180, 255, 255, .9) !important;
  border-radius: 999px !important;
  color: #001416 !important;
  background: linear-gradient(180deg, #7ffaff 0%, #2de2e6 46%, #12aab3 100%) !important;
  text-shadow: 0 1px 0 rgba(255,255,255,.55) !important;
  box-shadow:
    inset 0 2px 1px rgba(255,255,255,.72),
    inset 0 -3px 5px rgba(0,70,82,.42),
    0 4px 0 #087883,
    0 8px 18px rgba(45,226,230,.55),
    0 0 20px rgba(60,235,255,.5) !important;
  animation: installLuxuryPulse 1.75s ease-in-out infinite !important;
}

@keyframes installLuxuryPulse {
  0%, 100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
    box-shadow: inset 0 2px 1px rgba(255,255,255,.72), inset 0 -3px 5px rgba(0,70,82,.42), 0 4px 0 #087883, 0 8px 18px rgba(45,226,230,.48), 0 0 14px rgba(60,235,255,.4);
  }
  50% {
    transform: translateY(-1px) scale(1.055);
    filter: brightness(1.12);
    box-shadow: inset 0 2px 1px rgba(255,255,255,.85), inset 0 -3px 5px rgba(0,70,82,.36), 0 5px 0 #087883, 0 11px 27px rgba(45,226,230,.72), 0 0 30px rgba(60,235,255,.78);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero.hero-banner .btn { animation: none !important; }
}

@media (max-width: 620px) {
  .hero.hero-banner {
    height: 70px !important;
    min-height: 70px !important;
    aspect-ratio: auto !important;
  }

  .hero.hero-banner .btn {
    top: auto !important;
    right: 6px !important;
    bottom: 8px !important;
    min-height: 40px !important;
    padding: 8px 15px !important;
    font-size: 13px !important;
  }
}

/* DARK / LIGHT TEMA + UREĐIVANJE MJERE KOLJENA */
[data-theme="light"] {
  --bg: #eef2f6; --card: #fff; --card-soft: #f5f7fa;
  --accent: #008e96; --accent-soft: rgba(0,142,150,.12);
  --text: #171923; --muted: #626775; --border: #cfd5df;
  --danger: #c92f4b; --shadow: 0 14px 36px rgba(25,35,50,.14);
}
[data-theme="light"] body { background: radial-gradient(circle at top, #fff 0, var(--bg) 62%); }
[data-theme="light"] .card { background: linear-gradient(145deg, #fff, #f7f9fc); }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] .canvas-settings { background: #fff; }
[data-theme="light"] .canvas-settings summary, [data-theme="light"] .usage-guide summary,
[data-theme="light"] .section-title { color: #252936; }
[data-theme="light"] .usage-guide, [data-theme="light"] .info-box,
[data-theme="light"] .instructions-box { background: #f4f7fa; color: #252936; }
[data-theme="light"] .usage-guide-content { color: #424856; }
[data-theme="light"] .usage-guide-content strong { color: #171923; }
[data-theme="light"] .btn-secondary {
  color: #12343a !important;
  background: #f5fbfc !important;
  border: 2px solid #008e96 !important;
  box-shadow: 0 6px 16px rgba(0, 142, 150, .14) !important;
}
[data-theme="light"] .hero.hero-banner #installAppBtn {
  color: #12343a !important;
  background: #f5fbfc !important;
  border: 2px solid #008e96 !important;
}
.theme-control-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 0 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: 0 7px 18px rgba(0,0,0,.18); }
.top-controls-right { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.language-switcher { display: inline-flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: #252936; }
.language-btn { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 8px; border: 2px solid #d7dce5; border-radius: 999px; color: #111; background: #f7f9fc; cursor: pointer; font-family: inherit; font-size: 12px; line-height: 1; font-weight: 950; letter-spacing: .06em; filter: none; opacity: 1; box-shadow: 0 3px 8px rgba(0,0,0,.34); transition: transform .16s ease, box-shadow .16s ease; }
.language-btn:hover { opacity: 1; transform: translateY(-1px); }
.language-btn.active { opacity: 1; filter: saturate(1.12); border-color: #2de2e6; background: #fff; box-shadow: 0 0 0 3px rgba(45,226,230,.3), 0 4px 13px rgba(0,0,0,.35); }
[data-theme="light"] .language-switcher { border-color: #aab4c2; background: #e4e9ef; }
@media (max-width: 620px) {
  .top-controls-right { gap: 5px; }
  .language-switcher { gap: 2px; padding: 3px; }
  .language-btn { min-width: 34px; height: 30px; padding: 0 6px; font-size: 10px; }
  .theme-toggle { min-width: 118px !important; padding: 7px 9px !important; font-size: 11px !important; }
}
.version-badge { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: var(--card-soft); font-size: 11px; font-weight: 900; }
.theme-toggle { position: static; display: inline-flex; align-items: center; justify-content: center; min-width: 145px; min-height: 40px; padding: 8px 14px; border: 2px solid var(--accent); border-radius: 999px; color: var(--text); background: var(--accent-soft); cursor: pointer; font-size: 13px; font-weight: 900; box-shadow: 0 5px 14px rgba(0,0,0,.2); }
.community-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: -4px 0 14px; }
.community-btn { min-height: 44px; padding: 9px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 900; }
.share-btn { color: #001416; background: linear-gradient(180deg, var(--accent), #20b9c0); border: 1px solid var(--accent); box-shadow: 0 7px 16px rgba(45,226,230,.2); }
.report-btn { color: var(--text); background: var(--card); border: 2px solid var(--border); }
[data-theme="light"] .report-btn { color: #12343a; background: #fff; border-color: #008e96; }
.share-confirm { position: fixed; z-index: 9999; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 28px); padding: 11px 16px; border-radius: 999px; color: #001416; background: #55e7eb; box-shadow: 0 12px 35px rgba(0,0,0,.35); font-weight: 900; }
.elbow-edit { display: grid; grid-template-columns: minmax(0,1fr) minmax(135px,.75fr) auto; align-items: end; gap: 9px; margin-top: 9px; padding: 10px; border: 1px solid rgba(45,226,230,.42); border-radius: 10px; background: var(--accent-soft); }
.elbow-edit > div { display: grid; gap: 4px; }
.elbow-edit span { color: var(--muted); font-size: .72rem; }
.elbow-edit label { margin: 0; }
.elbow-edit input { min-height: 38px; margin-top: 4px; }
.reset-measure-btn { min-height: 38px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--card); cursor: pointer; font-size: .72rem; font-weight: 800; }
@media (max-width:620px) {
  .theme-control-bar { margin-top: -7px; }
  .theme-toggle { min-width: 150px; min-height: 42px; padding: 8px 14px; font-size: 13px; }
  .community-actions { grid-template-columns: 1fr; gap: 8px; }
  .community-btn { min-height: 46px; }
  .elbow-edit { grid-template-columns: 1fr; }
}
