@font-face {
  font-family: K2D;
  src: url("./fonts/K2D-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: K2D;
  src: url("./fonts/K2D-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  font: 1rem/1.55 K2D, Tahoma, sans-serif;
  color: #1d2c2a;
  background: #f3f7f5;
  --ink: #162b27;
  --muted: #52706a;
  --brand: #143d34;
  --accent: #176650;
  --paper: #fff;
  --line: #dbe6e0;
  --mint: #e9f5ef;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 18rem; }
h1, h2, p, ul, dl { margin: 0; }
h1, h2, strong { font-weight: 700; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: .175rem solid #267962; outline-offset: .19rem; }
.muted { color: var(--muted); }
.error { color: #9a2929; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; font-size: 1.2rem; letter-spacing: -.025em; line-height: 1.2; }
.brand-mark { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border-radius: .65rem; background: #a7e3c4; color: #103e31; font-size: 1.32rem; }
.brand-sub { display: block; font-size: .8rem; font-weight: 400; color: #ccdfd6; letter-spacing: 0; margin-top: .2rem; }

.primary, .outline {
  padding: .62rem 1.16rem;
  border-radius: .58rem;
  border: 1px solid transparent;
  min-height: 2.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover:enabled { background: #10503d; }
.outline { border-color: #6b9485; background: transparent; color: #fff; }
.outline:hover { background: #285246; }
input {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: .56rem .75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aabeb5;
  border-radius: .55rem;
}
label { display: block; color: var(--ink); font-weight: 700; margin-bottom: .34rem; }

.sign-in {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(calc(100% - 2rem), 58rem);
  margin: clamp(2rem, 13vh, 8rem) auto 2rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 1.1rem 3.8rem #143d3414;
}
.sign-in-intro {
  display: grid;
  align-content: space-between;
  min-height: 27rem;
  gap: 2.5rem;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  color: #f5fbf7;
  background: radial-gradient(ellipse at 100% 100%, #296857 0%, transparent 65%), #143d34;
}
.eyebrow { color: #c1ebd4; font-weight: 700; margin-bottom: .45rem; }
.sign-in h1 { font-size: clamp(2.5rem, 6vw, 4.15rem); line-height: 1.08; letter-spacing: -.04em; }
.intro-copy { max-width: 20rem; margin-top: .9rem; color: #d2e7dc; }
.sign-in-panel { display: grid; align-content: center; padding: clamp(1.5rem, 4vw, 3.25rem); }
.sign-in h2 { font-size: 1.85rem; line-height: 1.25; margin-bottom: .4rem; }
.sign-in label { margin-top: 1rem; }
.sign-in button { width: 100%; margin-top: 1.25rem; }
.sign-in .error { margin-top: .7rem; }

.topbar { background: var(--brand); color: #fff; }
.topbar-inner, .workspace { width: min(calc(100% - 3rem), 87rem); margin-inline: auto; }
.topbar-inner { min-height: 4.7rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.workspace { padding-block: 2.2rem 3.5rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: clamp(1.95rem, 5vw, 3rem); line-height: 1.15; letter-spacing: -.035em; margin-bottom: .4rem; }
.card { border: 1px solid var(--line); border-radius: .9rem; background: var(--paper); }
.filter-card { padding: 1.05rem 1.2rem; }
.filter-card form { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem .9rem; }
.filter-card .field { min-width: 8.5rem; }
.status { margin: .8rem 0; }
.status:empty { display: none; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin-block: 1rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1.05rem; color: var(--muted); }
.stat strong { color: var(--ink); font-size: clamp(1.15rem, 2.3vw, 1.72rem); line-height: 1.25; overflow-wrap: anywhere; }
.stat-money { background: var(--mint); border-color: #bbdccc; }
.stat-money strong { color: #134c3b; }

.report-grid { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.people { padding: .9rem; }
.people h2, .report h2 { font-size: 1.25rem; line-height: 1.3; }
.people h2 { display: flex; align-items: center; gap: .4rem; padding: .28rem .35rem .75rem; }
.pill { background: var(--mint); color: #215c49; border-radius: 1rem; min-width: 1.6rem; text-align: center; font-size: .85rem; padding-inline: .3rem; }
.people ul { list-style: none; padding: 0; display: grid; gap: .32rem; }
.people button {
  width: 100%;
  display: grid;
  align-content: center;
  text-align: left;
  gap: .06rem;
  padding: .58rem .72rem;
  border-radius: .55rem;
  border: 1px solid transparent;
  background: #f2f6f4;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.people button[aria-pressed="true"] { background: var(--mint); border-color: #8fc6ae; box-shadow: inset .2rem 0 #278167; }
.people button:hover { border-color: #8fc6ae; }
.people button strong { font-size: .9rem; color: #235443; }
.report { min-width: 0; }
.report-head { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; justify-content: space-between; padding: 1rem 1.15rem; }
.report-head h2 { margin: .22rem 0; overflow-wrap: anywhere; }
.employee-total { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; color: #31584e; }
.employee-total strong { color: #154e3a; }
.table-scroll { overflow-x: auto; border-radius: 0 0 .9rem .9rem; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.report table { min-width: 42rem; }
th, td { padding: .68rem .68rem; text-align: left; border-top: 1px solid var(--line); }
thead { background: #edf4f0; color: #29483e; }
thead th { font-size: .875rem; }
th:last-child, td:last-child { text-align: right; }
tfoot { background: #f6faf8; font-weight: 700; }

.print-sheet { display: none; }

@media (max-width: 48rem) {
  .topbar-inner, .workspace { width: calc(100% - 1.6rem); }
  .workspace { padding-top: 1.4rem; }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .people ul { grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr)); }
}

@media (max-width: 34rem) {
  .sign-in { grid-template-columns: 1fr; margin-top: 1rem; }
  .sign-in-intro { min-height: auto; gap: 1.4rem; }
  .sign-in-intro br { display: none; }
  .sign-in-intro h1 { max-width: 15rem; }
  .sign-in-intro h1 br::after { content: " "; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .stat { padding: .65rem .7rem; }
  .stat-money { grid-column: 1 / -1; }
  .filter-card { padding: .8rem; }
  .filter-card form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .filter-card .field { min-width: 0; }
  .filter-card button { grid-column: 1 / -1; }
  .report-head { padding: .85rem; }
}

#voucher-dialog {
  width: min(38rem, calc(100% - 1.5rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  box-shadow: 0 1.25rem 4rem #142b2750;
}
#voucher-dialog::backdrop { background: #17382cc0; }
.voucher-form { display: grid; gap: .8rem; padding: clamp(1rem, 3vw, 1.5rem); }
.voucher-dialog-head h2 { font-size: 1.45rem; }
.voucher-dialog-head p { overflow-wrap: anywhere; }
.voucher-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem .8rem; }
.voucher-form > label { margin-bottom: 0; }
.voucher-form textarea {
  font: inherit;
  width: 100%;
  padding: .5rem .75rem;
  color: var(--ink);
  border: 1px solid #aabeb5;
  border-radius: .55rem;
  resize: vertical;
}
.voucher-form details { border: 1px solid var(--line); border-radius: .6rem; padding: .58rem .75rem; }
.voucher-form summary { cursor: pointer; font-weight: 700; }
.issuer-fields { padding-top: .7rem; }
.full-field { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: .55rem; width: fit-content; }
.checkbox-label input { width: 1rem; min-height: auto; height: 1rem; accent-color: var(--accent); }
.voucher-totals {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem;
  padding: .7rem .8rem; border-radius: .6rem; background: var(--mint);
}
.voucher-totals strong { color: var(--brand); margin-left: .25rem; }
.voucher-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .6rem; }
.secondary {
  border: 1px solid #aabeb5; background: #fff; color: var(--ink);
  border-radius: .58rem; padding: .62rem 1.16rem; min-height: 2.75rem; font-weight: 700;
}
.secondary:hover { background: #f3f7f5; }
@media (max-width: 30rem) {
  .voucher-fields { grid-template-columns: minmax(0, 1fr); }
  .voucher-actions button { flex: 1; }
}

@page { size: A4 landscape; margin: 13mm 16mm; }
@media print {
  :root { background: #fff; color: #171717; font-size: 10.5pt; }
  body { min-width: 0; }
  #dashboard, #auth-view, #voucher-dialog { display: none !important; }
  .print-sheet.ready { display: block; }
  .payment-voucher { break-inside: avoid; }
  .voucher-issuer { text-align: center; width: 86%; margin: 2mm auto 4mm; overflow-wrap: anywhere; }
  .voucher-issuer h2 { font-size: 14pt; }
  .voucher-issuer p:empty { display: none; }
  .voucher-heading { display: flex; align-items: end; justify-content: space-between; gap: 8mm; margin-bottom: 3mm; }
  .voucher-name { color: #233e61; }
  .voucher-name h1 { font-size: 19pt; line-height: 1.15; margin: 0; }
  .voucher-name p { font-size: 9pt; margin-top: 1mm; text-decoration: underline; }
  .voucher-metadata { width: 61mm; }
  .voucher-metadata div, .voucher-recipient div { display: grid; grid-template-columns: 17mm minmax(0, 1fr); align-items: end; gap: 2mm; }
  .voucher-metadata dd, .voucher-recipient dd {
    margin: 0; min-height: 5.5mm; padding: 0 .7mm .35mm; border-bottom: .22mm solid #777;
    overflow-wrap: anywhere;
  }
  .voucher-recipient { margin-bottom: 4mm; }
  .voucher-recipient div { grid-template-columns: 23mm minmax(0, 1fr); }
  .voucher-line-items { table-layout: fixed; }
  .voucher-date-col { width: 17%; }
  .voucher-reference-col { width: 18%; }
  .voucher-amount-col { width: 18%; }
  .print-sheet th, .print-sheet td { border: .25mm solid #8c8c8c; padding: 1.1mm 2mm; font-size: 10pt; line-height: 1.35; }
  .print-sheet thead { display: table-header-group; color: #171717; background: #fff; }
  .voucher-line-items thead { border-bottom: .4mm solid #575757; }
  .voucher-line-items thead th { text-align: center; }
  .voucher-line-items td { overflow-wrap: anywhere; }
  .voucher-line-items td:first-child, .voucher-line-items td:nth-child(2) { vertical-align: top; }
  .voucher-line-items td:last-child { font-variant-numeric: tabular-nums; }
  .voucher-hours { font-size: 9pt; margin-top: 1mm; }
  .voucher-empty-row { height: 6.5mm; }
  .voucher-line-items tfoot { display: table-row-group; background: #fff; }
  .voucher-note p { font-weight: 400; overflow-wrap: anywhere; }
  .print-rate { float: right; }
  .voucher-net { border-top: .35mm solid #575757; }
  .voucher-words th, .voucher-line-items .voucher-words td { text-align: left; }
  .voucher-words td { font-weight: 400; }
  .voucher-signatures {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 11mm;
    text-align: center; margin: 14mm 4mm 0; break-inside: avoid;
  }
  .voucher-signatures span { border-top: .25mm solid #555; padding-top: 1.2mm; }
  .voucher-appendix { break-before: page; }
  .voucher-appendix .paper-header td { border: 0; text-align: left; padding: 0 0 4mm; }
  .paper-header h2 { font-size: 15pt; margin-bottom: 1mm; }
  .paper-header p:empty { display: none; }
  .paper-ending { display: table-row-group; break-inside: avoid; background: #fff; }
  .print-sheet tr { break-inside: avoid; }
}
