/* Reusable UI components: cards, badges, price breakdown, panels, buttons. */

/* ---------- card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(26, 58, 82, 0.05);
  margin-bottom: 20px;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-head h2, .card-head h3 { font-size: 13.5px; font-weight: 700; margin: 0; }
.card fieldset { border: none; border-radius: 0; margin: 0; padding: 2px 18px 18px; }
.card fieldset + fieldset, .card form fieldset:first-of-type { border-top: 1px solid var(--line); padding-top: 18px; }

.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 100px;
}
.pill-quota {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: #c2410c;
}
.pill-quota.pill-danger { background: var(--red-soft); border-color: #f3c3c3; color: #a5321f; }

/* ---------- buttons ---------- */
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(255, 90, 31, 0.25); }
.btn-primary:hover { filter: brightness(1.05); color: #fff; }
.btn-add { background: var(--green); box-shadow: 0 4px 12px rgba(31, 157, 85, 0.25); }
.btn-add:hover { background: var(--green-dark); filter: none; }
.btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--charcoal);
}
.btn-ghost:hover { border-color: #c9d3dc; filter: none; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f3c3c3; font-weight: 600; }
.btn-danger:hover { background: var(--red-soft); filter: none; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; margin-top: 1.25rem; }

/* ---------- svg / DXF preview panel ---------- */
.svg-preview {
  position: relative;
  display: flex;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 8px;
  margin: 18px;
}
.svg-preview svg { max-width: 100%; height: auto; max-height: 320px; }

/* ---------- price breakdown table ---------- */
table.price-breakdown { width: 100%; }
.price-breakdown tr { border-bottom: 1px dashed var(--line); }
.price-breakdown td {
  padding: 9px 4px;
  border-bottom: none;
  font-size: 0.85rem;
  color: var(--muted);
}
.price-breakdown td:last-child {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}
.price-breakdown tr:last-child { border-bottom: none; }
.price-breakdown tr.total td {
  background: var(--steel);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 16px;
}
.price-breakdown tr.total td:first-child { border-radius: 7px 0 0 7px; }
.price-breakdown tr.total td:last-child { border-radius: 0 7px 7px 0; color: #fff; }

/* ---------- quote summary strip ---------- */
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 18px;
  background: #fbfcfd;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.sums { display: flex; gap: 32px; flex-wrap: wrap; }
.sum-item { font-size: 12px; color: var(--muted); }
.sum-item b {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--charcoal);
  font-weight: 600;
  margin-top: 2px;
}
.sum-item.grand b { color: var(--accent); font-size: 17px; }

/* ---------- quote items table ---------- */
.quote-items td:first-child { font-weight: 600; color: var(--charcoal); }

/* ---------- login ---------- */
.login-shell { min-height: calc(100vh - 58px); display: grid; place-items: center; }
.login-card {
  width: 380px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 24px 60px -12px rgba(26, 58, 82, 0.15);
}
.login-card .logo { justify-content: center; margin-bottom: 22px; }
.login-card h2 { text-align: center; }
.login-card fieldset { border: none; padding: 0; margin: 0; }
.login-card input { max-width: none; }
.login-card button[type="submit"] { margin-top: 1.1rem; }

/* ---------- login modal ---------- */
dialog.login-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 420px;
  width: 92vw;
  border-radius: var(--radius-lg);
}
dialog.login-modal::backdrop { background: rgba(18, 43, 62, 0.55); }
dialog.login-modal .login-card { width: auto; position: relative; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.modal-close:hover { color: var(--charcoal); border-color: #c9d3dc; filter: none; }

/* ---------- upload card (index) ---------- */
.upload-shell { display: grid; place-items: center; padding: 24px 0; }
.upload-card { width: 480px; max-width: 100%; }
.upload-card input { max-width: none; }
.upload-card button[type="submit"] { margin-top: 1rem; }

/* ---------- DXF upload progress bar (index.html + result.html, see app.js) ---------- */
.upload-progress { margin-top: 1rem; }
.upload-progress-track {
  height: 6px;
  border-radius: 100px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.2s ease;
}
#upload-progress-label, #upload-queue-label { margin-top: 0.5rem; margin-bottom: 0; }

.card-section { padding: 0 18px 18px; }

/* ---------- cutting-speed unit switcher ---------- */
.speed-field { display: flex; gap: 0.4rem; max-width: 22rem; margin-top: 0.3rem; }
.speed-field .speed-display { flex: 1 1 auto; margin-top: 0; max-width: none; }
.speed-field .speed-unit { flex: 0 0 6rem; margin-top: 0; max-width: none; }

/* ---------- ceník material panel: compact side-by-side speed/propal fields ----------
   Table columns are narrow, so — unlike the free-standing speed-field above — every
   input here drops the 22rem block-width default and sizes to its actual content. */
#material-panel .speed-field,
#material-panel .pierce-field { max-width: none; flex-wrap: wrap; margin-top: 0.3rem; }
#material-panel .speed-display { flex: 0 0 auto; width: 4.5rem; margin-top: 0; }
#material-panel .speed-unit { flex: 0 0 auto; width: auto; margin-top: 0; }
#material-panel .pierce-field { display: flex; align-items: center; gap: 0.4rem; }
#material-panel .pierce-cost-field,
#material-panel .pierce-duration-field { display: flex; align-items: center; gap: 0.3rem; margin-top: 0; }
#material-panel .pierce-cost-field input,
#material-panel .pierce-duration-field input {
  width: 4.5rem;
  flex: 0 0 auto;
  margin-top: 0;
  max-width: none;
}
#material-panel .pierce-mode-select {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
  max-width: none;
}

/* ---------- generic top links row ---------- */
.crumbs { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 1rem; font-size: 0.88rem; }
.crumbs a, .crumbs .link-button { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover, .crumbs .link-button:hover { color: var(--accent); }

/* ---------- dashboard: quick-link wayfinder cards ---------- */
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.quick-link:hover { box-shadow: 0 6px 18px rgba(26, 58, 82, 0.08); transform: translateY(-1px); }
.quick-link-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--steel);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.quick-link-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick-link-body strong { font-size: 13.5px; color: var(--charcoal); }
.quick-link-body span { font-size: 12px; color: var(--muted); }
.quick-link .tag { margin-left: auto; flex-shrink: 0; }

.card-hint { padding: 0 18px 18px; margin: 0; }

/* ---------- dashboard: tips & tricks ---------- */
.tip-list { list-style: none; margin: 0; padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.tip-list li { display: flex; flex-direction: column; gap: 2px; }
.tip-list strong { font-size: 13px; color: var(--charcoal); }
.tip-list span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

@media (max-width: 760px) {
  .quick-links { grid-template-columns: 1fr; }
}

/* ---------- changelog ---------- */
.changelog-list { max-width: 720px; }
.changelog-entry.is-latest { border-left: 3px solid var(--accent); }
.changelog-highlights { list-style: disc; margin: 0; padding: 0 18px 18px 34px; display: flex; flex-direction: column; gap: 8px; }
.changelog-highlights li { font-size: 13.5px; color: var(--charcoal); line-height: 1.5; }
