:root {
  --page-w: 210mm;
  --page-h: 297mm;
  --m: 12mm;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e0e0e0;
  --ui: #f5f5f5;
  --accent: #000;
  --serif: "Montserrat", system-ui, sans-serif;
  --sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    sans-serif;
  --mono: "Source Code Pro", ui-monospace, monospace;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--sans);
  background: #fafafa;
  color: var(--ink);
}
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 520px 1fr 320px;
  gap: 20px;
  padding: 16px;
  align-items: start;
}
.panel {
  background: var(--ui);
  border: 1px solid #ddd;
  border-radius: 0px;
  padding: 14px;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  overflow: hidden;
}
.panelBody {
  flex: 1;
  overflow: auto;
  padding-right: 6px;
}
.panelFooter {
  border-top: 0px solid #ddd;
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--ui);
}
.grid {
  display: grid;
  margin-left: 10px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0px solid #ddd;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 14px;
  font-weight: 400;
}
.field input,
.field textarea,
.field select {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 0px;
  border: 1px solid #ccc;
  background: #fff;
}
.field textarea {
  resize: vertical;
  min-height: 70px;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.hint {
  font-size: 12px;
  color: #555;
  margin: 6px 0 10px;
}
.btn {
  border: 1px solid #ccc;
  background: #fff;
  padding: 10px 12px;
  border-radius: 0px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.danger {
  color: #a0243a;
  border-color: #e3c7cd;
}
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.tabBtn {
  flex: 1;
  padding: 8px;
  font-weight: 700;
  border: 1px solid #ccc;
  border-radius: 0px;
  background: #fff;
  cursor: pointer;
}
.tabBtn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tabContent {
  display: none;
}
.tabContent.active {
  display: block;
}
.previewWrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  height: calc(100vh - 32px);
  overflow: hidden;
  padding: 8px;
}
.previewScaler {
  display: flex;
  justify-content: center;
}

.page {
  width: var(--page-w);
  min-height: var(--page-h);
  background: #fff;
  color: #111;
  padding: var(--m);
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 13px;
}
.inv-title {
  font-family: var(--serif);
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin: 2mm 0 6mm;
}
.topGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 0px solid var(--line);
  min-height: 78mm;
}
.box {
  padding: 8mm;
  font-family: var(--serif);
}
.box.left {
  border-right: 1px solid var(--line);
}
.cap {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 4mm;
}
.partyName {
  font-size: 18px;
  font-weight: 700;
}
.addr,
.meta,
.contact {
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-line;
}
.contactCap {
  margin-top: 10mm;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}
.contact a {
  color: #000;
  text-decoration: underline;
}
.mid {
  display: grid;
  grid-template-columns: 1fr 70mm;
  gap: 6mm;
  margin-top: 10mm;
}
.qr {
  border: 0px solid var(--line);
  width: 30mm;
  height: 30mm;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-left: auto;
}
.qr img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: auto;
}
.qr .lbl {
  display: none;
}
.dates {
  font-family: inherit;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
}
.dates .val {
  display: block;
  margin-top: 2mm;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}
.payRow {
  margin-top: 14mm;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8mm;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4mm;
}
.payRow .val {
  display: block;
  margin-top: 2mm;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sectionTitle {
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  margin: 10mm 0 4mm;
}
table.items {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--serif);
  font-size: 13px;
}
table.items th {
  background: #f0f0f0;
  color: var(--muted);
  font-weight: 400;
  padding: 3mm 2mm;
}
table.items tbody td {
  border-bottom: 1px solid var(--line);
  padding: 5mm 2mm;
}
.num {
  text-align: right;
  white-space: nowrap;
}
.total {
  margin-top: 8mm;
  text-align: right;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
}
.infoPanel {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 18px;
  position: sticky;
  top: 16px;
  height: fit-content;
  font-size: 14px;
  line-height: 1.5;
}
.infoPanel h3 {
  margin-top: 0;
  font-size: 16px;
}
.infoPanel ul {
  padding-left: 18px;
  margin: 8px 0 0 0;
}
@media (max-width: 1200px) {
  .app {
    grid-template-columns: 520px 1fr;
  }
  .infoPanel {
    display: none;
  }
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .previewWrap {
    display: none;
  }
  .infoPanel {
    display: none;
  }
  .panel {
    height: auto;
    position: static;
  }
}
@media (max-width: 520px) {
  .panel,
  .panelBody {
    overflow-x: hidden;
  }
  .grid {
    grid-template-columns: 1fr !important;
  }
  .field input,
  .field textarea,
  .field select {
    width: 100%;
    max-width: 100%;
  }
  .panel {
    padding: 12px;
  }
  .tabBtn {
    padding: 10px 8px;
  }
  .panelFooter {
    justify-content: stretch;
  }
  .panelFooter .btn {
    width: 100%;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .row > div {
    width: 100%;
  }
  .row .btn.danger {
    width: 100%;
  }
  #add_item {
    width: 100%;
  }
}
.printFooter {
  text-align: center;
  font-size: 10px;
  color: #999;
  letter-spacing: 0.3px;
  font-family: inherit;
  margin-top: 4mm;
}
.printFooter a {
  color: #000;
  text-decoration: none;
}
.printFooter a:visited {
  color: #000;
}
@page {
  size: A4;
  margin: 0 !important;
}
@media print {
  html,
  body {
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .panel,
  .infoPanel,
  .btn,
  .hint,
  .tabs,
  h2,
  .no-print {
    display: none !important;
  }
  .app,
  .previewWrap,
  #previewScaler,
  .previewScaler {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
  }
  .page {
    display: flex !important;
    flex-direction: column !important;
    min-height: 297mm !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 10mm 15mm 15mm 15mm !important;
    position: relative !important;
    display: block !important;
    box-shadow: none !important;
  }
  table.items {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  thead {
    display: table-header-group !important;
  }
  tfoot {
    display: table-row-group !important;
  }
  tfoot,
  tfoot tr,
  tfoot td,
  tfoot .total {
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}
  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  th, td {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  table.items tbody td {
    border-bottom: 1px solid #1a1a1a !important;
  }
  .total {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 10mm !important;
    display: block !important;
  }
    .printFooter {
    display: block !important;
  margin-top: auto !important; 
  text-align: center;
  font-size: 10px !important;
  color: #666 !important;
  border-top: 1px solid #f0f0f0;
  padding-top: 5px;
  background: #fff !important;
  }
  tfoot td {
    padding: 0 !important;
    border: none !important;
  }
  .ph.is-empty::before {
    content: "" !important;
    display: none !important;
  }
  .ph:not(.is-empty) {
    color: inherit !important;
  }
  .itemsPlaceholderRow {
    display: none !important;
  }

}
.printFooter {
  display: none;
}

.info {
  display: flex !important;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 20px;
  margin-bottom: 10mm;
}
.details {
  flex: 1;
}
.qr img {
  width: 100%;
  height: auto;
}
.qr.is-hidden {
  display: none !important;
}
.ph {
  position: relative;
}
.ph.is-empty::before {
  content: attr(data-ph);
  color: rgba(26, 26, 26, 0.22);
  white-space: pre-wrap;
}
.ph.is-empty {
  color: transparent;
}
.ph.inline.is-empty::before {
  display: inline;
}
.itemsPlaceholderRow td {
  color: rgba(26, 26, 26, 0.22);
}
hr {
  border: 0;
  height: 1px;
  background-color: #ccc;
  margin: 20px 0;
}
a {
  color: #000;
  text-decoration: none;
}
a:visited {
  color: #000;
}
.vatSwitch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 14px 2px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vatSwitch input {
  width: 16px;
  height: 16px;
}
.is-hidden {
  display: none !important;
}
.is-error {
  outline: 2px solid #c0352b;
  outline-offset: 2px;
}
.podbod {
  margin-top: -10px;
  font-size: 0.8em;
  font-style: italic;
  color: #666;
  list-style-type: none;
}
#invoice_vat.vat-reverse table.items thead th:nth-child(4),
#invoice_vat.vat-reverse table.items tbody td:nth-child(4),
#invoice_vat.vat-reverse table.items thead th:nth-child(6),
#invoice_vat.vat-reverse table.items tbody td:nth-child(6) {
  display: none;
}
.panelTabs {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ui);
  padding-bottom: 0px;
  margin-bottom: 0px;
  border-bottom: 0px solid #ddd;
}
.panelBody {
  padding-top: 0;
}
@media print {
  :root { --footer-h: 8mm; }

  .page {
    padding-bottom: calc(15mm + var(--footer-h)) !important;
  }
  .printFooter {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: var(--footer-h) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10px !important;
    color: #666 !important;
    background: #fff !important;
    border-top: 1px solid #f0f0f0 !important;
    z-index: 9999 !important;
  }
}
textarea {
  resize: none !important;      
  height: 6em !important;      
  line-height: 1.1em !important;
  overflow-y: auto;             
}
.file {
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.file-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.file-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 1px solid #ccc;
}
.file-btn:hover {
  cursor: pointer;
}
.file-name {
  flex: 1 1 auto;
  font-size: 14px;
  color: #555;
}
.field.float {
  position: relative;
}
.field.float input,
.field.float textarea,
.field.float select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
}
.field.float label {
  position: absolute;
  left: 12px;
  top: 10px;
  pointer-events: none;
}
.field.float input:focus ~ label,
.field.float input:not(:placeholder-shown) ~ label,
.field.float textarea:focus ~ label,
.field.float textarea:not(:placeholder-shown) ~ label,
.field.float select:focus ~ label,
.field.float select:valid ~ label {
  opacity: 0;
  visibility: hidden;
}
.field.labelBelow label {
  display: flex;
  align-items: center;
  margin-top: 2px;
  font-size: 0.8em;
  color: #777;
  font-style: italic;
  height: 1.2em;
}
.histSelect {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: block; 
  width: auto !important;
  padding: 4px 12px !important; 
  border: 1px solid #ccc !important;
  background: #f5f5f5 !important;
  color: #555;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  margin-top: -10px !important;    
  border-radius: 0 !important;   
  position: relative;
  z-index: 2;
}
.histSelect:hover {
  background: #eee !important;
}
.histSelect:focus {
  outline: none;
  border-color: var(--accent) !important;
}
.field.float input,
.field.float select:not(.histSelect) {
  height: 42px !important;
  line-height: 1.2 !important;
  border-radius: 0 !important; 
  box-sizing: border-box;
}
.field.float select:not(.histSelect) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 10px 30px 10px 12px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' 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 12px center;
  background-size: 12px;
  background-color: #fff !important;
}
#kofi{
  width:100%;
  text-align:center;
}
#kofi_widget{
  width:100%;
  display:flex;
  justify-content:center;
  margin-top: -10px;
}
#kofi_widget .kofi-button{
  margin:0 auto;
}
.kf {
  font-size: 0.9em;
  color: rgba(0, 0, 0, 0.5);
}



.mobilePreviewBar {
  display: none;
}

.mobilePreviewTopbar,
.mobilePreviewBottombar,
.mobilePreviewKofi {
  display: none;
}

.infoPanelMobile {
  display: none;
}

@media (max-width: 900px) {
  .app {
    display: block !important;
    padding-top: 0 !important;
  }

  .panel,
  .panelBody {
    overflow: visible !important;
  }

  .mobileStickyBar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--ui);
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
  }

  .mobilePreviewBar {
    display: flex !important;
    width: 100% !important;
    background: #fff !important;
    border-bottom: 1px solid #ddd !important;
    margin: 0 0 20px 0 !important;
  }

  .mobilePreviewBtn {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    font-weight: 600 !important;
    text-align: center !important;
    border-radius: 0 !important;
    background: var(--accent) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
  }

  .mobilePreviewBar,
  .panelTabs {
    position: static !important;
  }

  .infoPanel {
    display: none !important;
  }

  .infoPanelMobile {
    display: block !important;
    position: static !important;
    margin-top: 16px !important;
  }

  .previewWrap.is-mobile-visible {
    display: block !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000 !important;
    z-index: 9999;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 !important;
    padding-bottom: 160px !important;
  }

  .previewWrap.is-mobile-visible .mobilePreviewTopbar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 10000;
    background: #fff;
    padding: 10px;
    border-bottom: 1px solid #ccc;
  }

  #mobile_preview_back {
    width: 100% !important;
    flex: 1 1 auto !important;
    background: #000 !important;
    color: white !important;
  }

  #previewScaler {
    display: block !important;
    width: 100% !important;
    padding: 20px 0;
    transform-origin: top center;
  }

  .previewWrap.is-mobile-visible .page {
    margin: 0 auto !important;
    zoom: 0.45;
  }


@media (max-width: 900px) {
  .previewWrap.is-mobile-visible #previewScaler {
    transform: none !important;
  }

  .previewWrap.is-mobile-visible .page {
    transform: none !important;
  }
}






  .previewWrap.is-mobile-visible .mobilePreviewBottombar {
    display: flex !important;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    z-index: 10000;
    background: #fff;
    padding: 10px;
    border-top: 1px solid #ccc;
  }

  #mobile_preview_export {
    width: 100% !important;
    background: #000 !important;
    color: white !important;
  }

  .previewWrap.is-mobile-visible .mobilePreviewKofi {
    display: block !important;
    position: fixed;
    left: 0;
    bottom: 58px;
    width: 100%;
    z-index: 9999;
    background: #fff;
    padding: 12px 10px;
    border-top: 1px solid #ccc;
  }

  .previewWrap.is-mobile-visible .mobilePreviewKofi p {
    margin: 0 0 8px 0;
    text-align: center;
  }

  .previewWrap.is-mobile-visible .mobilePreviewKofiWidget {
    display: flex;
    justify-content: center;
  }
}

#kofi a {
  text-decoration: underline;
}

#kofi a:hover {
  color: grey;
}

.skills #kofi_widget {
  all: unset;
  display: block;
  width: 100%;
  text-align: center;
}


.breadcrumb {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: #aaa;
  margin: 0 0.4rem;
}

.breadcrumb-item a {
  text-decoration: none;
  color: inherit;
}

.breadcrumb-item.active {
  font-weight: 600;
  color: #111;
}