/* ═══════════════════════════════════════════════════════════════════
   QR-Rechnung Generator v7.0 — imifactory.ch Standard v3.0
   ═══════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f8fafc;
  margin: 0;
  color: #333;
  line-height: 1.6;
}

/* ─── Header (FROZEN imifactory) ─────────────────────────────────── */
header {
  background: linear-gradient(90deg, #05263d 0%, #0b3c5d 100%);
  padding: 15px 25px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.sitename {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sitename img { height: 32px; width: auto; }

.breadcrumb {
  margin-top: 8px;
  font-size: 12px;
  color: #cbd5e1;
}
.breadcrumb a { color: #fff; text-decoration: none; }
.breadcrumb a:hover { color: #00bfae; }

/* ─── Container ──────────────────────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 30px auto;
  padding: 0 20px;
}

.back-link {
  display: inline-block;
  margin-bottom: 15px;
  text-decoration: none;
  color: #0b3c5d;
  font-size: 14px;
  font-weight: 700;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.back-link:hover { color: #00897b; }

/* ─── Intro-Box ───────────────────────────────────────────────────── */
.imi-intro {
  background: linear-gradient(90deg, #e7f3fd, #f4faff);
  border-left: 5px solid #0b3c5d;
  padding: 24px 28px;
  border-radius: 4px;
  margin-bottom: 22px;
}
.imi-intro h2 { margin: 0 0 10px; color: #0b3c5d; font-size: 20px; }
.imi-intro p  { font-size: 15px; color: #444; margin: 0; }

/* ─── Content-Box ────────────────────────────────────────────────── */
.content-box {
  background: #fff;
  border: 1px solid #d1dce6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
  margin-bottom: 22px;
}

.box-header {
  background: #0b3c5d;
  color: #fff;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.box-body { padding: 24px 28px; }

/* ─── Formularelemente ───────────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #5a7080;
  margin-bottom: 4px;
  margin-top: 14px;
}
label:first-child { margin-top: 0; }
.req { color: #ef5350; font-weight: 700; }
.hint-inline {
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 6px;
  text-transform: none;
}

input[type=text],
input[type=date],
input[type=number],
input[type=file],
input[type=email],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1dce6;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: #333;
  margin-bottom: 2px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #0b3c5d;
  box-shadow: 0 0 0 2px rgba(11,60,93,.1);
}

input:invalid:not(:placeholder-shown) { border-color: #ef5350; }
input[readonly] { background: #f8fafc; color: #666; }

.info-text {
  font-size: 13px;
  color: #5a7080;
  margin: 0 0 14px;
  font-style: italic;
}

/* ─── Grid Layouts ───────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ─── Positionstabelle ───────────────────────────────────────────── */
.pos-head, .pos-row {
  display: grid;
  grid-template-columns: 3fr 0.8fr 1.2fr 0.8fr 1.2fr 0.5fr;
  gap: 8px;
  align-items: center;
}

.pos-head {
  background: #0b3c5d;
  color: #fff;
  padding: 10px 12px;
  border-radius: 6px 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pos-row {
  padding: 8px 12px;
  border-bottom: 1px solid #eef3f8;
}
.pos-row:last-child { border-bottom: none; }
.pos-row:nth-child(even) { background: #f8fafc; }

.pos-row input { margin: 0; padding: 6px 8px; font-size: 13px; }
.pos-row select { margin: 0; padding: 6px 8px; font-size: 13px; }

.pos-total-cell {
  font-weight: 700;
  color: #0b3c5d;
  font-size: 13px;
  text-align: right;
}

.pos-del-btn {
  background: #fee;
  color: #c62828;
  border: 1px solid #fcc;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  font-weight: 700;
}
.pos-del-btn:hover { background: #c62828; color: #fff; }

/* ─── Totals ─────────────────────────────────────────────────────── */
.totals-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eef3f8;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  color: #444;
}

.total-row {
  font-weight: 700;
  font-size: 16px;
  color: #0b3c5d;
  border-top: 2px solid #0b3c5d;
  margin-top: 6px;
  padding-top: 10px;
}

/* ─── MwSt-Hinweis bei 0% ────────────────────────────────────────── */
.vat-hint {
  margin-top: 14px;
  padding: 12px 16px;
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  font-size: 13px;
  color: #78350f;
}
.vat-hint em { font-weight: 600; font-style: normal; }

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s;
  font-family: inherit;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: #0b3c5d; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1565a0; }

.btn-accent { background: #00bfae; color: #fff; }
.btn-accent:hover:not(:disabled) { background: #00897b; }

.btn-outline {
  background: #fff;
  color: #0b3c5d;
  border: 2px solid #0b3c5d;
}
.btn-outline:hover:not(:disabled) { background: #0b3c5d; color: #fff; }

.btn-large { font-size: 16px; padding: 14px 28px; }
.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Farbauswahl im Aktionsbereich – zentriert, abgesetzt über den Buttons */
.action-theme {
  max-width: 360px;
  margin: 0 auto 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #eef3f8;
  text-align: center;
}
.action-theme select { margin-top: 2px; }

/* ─── Hinweise / Validierung ─────────────────────────────────────── */
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  min-height: 16px;
}
.hint-ok   { color: #15803d; }
.hint-err  { color: #dc2626; }
.hint-warn { color: #b45309; }
.hint-info { color: #475569; font-weight: 400; }

/* ─── Payload-Counter ────────────────────────────────────────────── */
.payload-counter {
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.payload-ok   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.payload-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.payload-err  { background: #fff3f3; color: #dc2626; border: 1px solid #fca5a5; }

/* ─── Fehlerbox ──────────────────────────────────────────────────── */
.error-box {
  background: #fff3f3;
  border-left: 5px solid #dc2626;
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  color: #991b1b;
  font-size: 14px;
}
.error-box strong { display: block; margin-bottom: 8px; font-size: 15px; }
.error-box ul { margin: 0; padding-left: 22px; }
.error-box li { margin: 3px 0; }

/* ─── Datenschutz-Box ────────────────────────────────────────────── */
.privacy .box-header { background: #475569; }
.privacy p { font-size: 13px; margin: 6px 0; }

/* ─── Footer ─────────────────────────────────────────────────────── */
footer {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 40px;
  padding-bottom: 30px;
}
footer a { color: #0b3c5d; text-decoration: none; margin: 0 10px; }
footer a:hover { color: #00897b; }

/* ─── Utility ────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .container { padding: 0 12px; }
  .box-body { padding: 16px 18px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .totals-grid { grid-template-columns: 1fr; }

  /* Mobile Positionstabelle */
  .pos-head { display: none; }
  .pos-row {
    grid-template-columns: 1fr;
    padding: 14px;
    background: #f8fafc !important;
    border: 1px solid #eef3f8;
    border-radius: 8px;
    margin-bottom: 12px;
  }
  .pos-row > * { margin: 4px 0; }
  .pos-row input::before { content: attr(placeholder); display: block; font-size: 11px; }

  .btn-large { width: 100%; justify-content: center; }
  .actions { flex-direction: column; }
}
