/* Kira Invoice Generator, the website. (The Android app's screens are in apps/invoice-generator-android/web.)
   Figtree for text; Noto Sans steps in for signs Figtree lacks (₦, ₵). */
@font-face { font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900; src: url('../fonts/figtree-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900; src: url('../fonts/figtree-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20A5, U+20A7-20AB, U+20AD-20B4, U+20B6-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Kira Noto'; font-style: normal; font-display: swap; font-weight: 400; src: url('fonts/NotoSans-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Kira Noto'; font-style: normal; font-display: swap; font-weight: 600; src: url('fonts/NotoSans-SemiBold.ttf') format('truetype'); }

:root {
  --theme: #0b3d2e; --brand: #0b3d2e; --main: #0f6b4f; --main-2: #0b5840; --ink: #1b2622; --muted: #5b6b64; --line: #dde5e1; --tint: #f4f8f6;
  --danger: #b4232a; --focus: #0b5ed7;
  --font: 'Figtree', 'Kira Noto', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 84px; }
body { margin: 0; background: #fff; color: var(--ink); font: 16px/1.4 var(--font); }
h1, h2, p { margin: 0; }
h1:focus, h2:focus, #gw-paper:focus { outline: none; }
a { color: var(--main); }
svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.gw-hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gw-skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 10px 16px; z-index: 30; }
.gw-skip:focus { left: 8px; }

.gw-top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 70px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.gw-top nav { display: flex; gap: 12px; }
.gw-brand { display: flex; gap: 12px; align-items: center; color: var(--ink); text-decoration: none; }
.gw-brand img { border-radius: 10px; }
.gw-brand b { display: block; font-size: 19px; line-height: 22px; font-weight: 600; }
.gw-brand span span { display: block; font-size: 13px; color: var(--muted); }
.gw-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px; border: 1px solid #8d9a94; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; }
.gw-btn:hover { background: var(--tint); }
.gw-btn:disabled { opacity: .6; cursor: wait; }
.gw-dark { background: #14261f; border-color: #14261f; color: #fff; }
.gw-dark:hover { background: #26413a; }
.gw-primary { background: var(--main); border-color: var(--main); color: #fff; }
.gw-primary:hover { background: var(--main-2); }
.gw-red { background: var(--danger); border-color: var(--danger); color: #fff; }
.gw-red:hover { background: #931b21; }
.gw-textbtn { min-height: 44px; padding: 0; border: 0; background: none; color: var(--main); font: inherit; font-weight: 500; cursor: pointer; }
.gw-danger { color: var(--danger); }

.gw-hero { padding: 56px 20px 52px; text-align: center; background: var(--tint); }
.gw-hero h1 { font-size: 44px; line-height: 1.15; font-weight: 400; letter-spacing: -.01em; }
.gw-hero h1 span { color: var(--main); }
.gw-hero p { max-width: 560px; margin: 16px auto 0; color: var(--muted); }

.gw-main { display: grid; grid-template-columns: minmax(0, 720px) 300px; gap: 40px; justify-content: center; align-items: start; padding: 48px 24px 64px; }
.gw-bar { display: none; }
.gw-sheet { border: 1px solid #cfd8d4; border-radius: 12px; padding: 40px 36px 28px; background: #fff; font-size: 15px; }
.gw-head { display: flex; justify-content: space-between; gap: 20px; }
.gw-logo { display: flex; gap: 20px; align-items: flex-start; }
.gw-logo b { display: block; font-weight: 500; }
.gw-logo small { display: block; max-width: 130px; color: var(--muted); font-size: 12px; line-height: 16px; }
.gw-upload { position: relative; flex: none; width: 130px; height: 86px; display: grid; place-items: center; overflow: hidden; border: 1px dashed #b9cbc3; border-radius: 4px; background: var(--tint); color: var(--main); font-weight: 500; cursor: pointer; }
.gw-upload:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.gw-upload img { display: block; max-width: 128px; max-height: 84px; object-fit: contain; }
.gw-title { font-size: 46px; line-height: 1.2; font-weight: 400; letter-spacing: .01em; }

/* Boxes on the paper look like text until they are pointed at */
.gw-sheet input:not([type=file]), .gw-sheet textarea, .gw-sheet select { display: block; width: 100%; min-width: 0; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--ink); font: inherit; line-height: 20px; }
.gw-sheet textarea { resize: none; overflow: hidden; }
.gw-sheet ::placeholder { color: #6b7a73; opacity: 1; }
.gw-sheet input:not([type=file]):hover, .gw-sheet textarea:hover, .gw-sheet select:hover { border-color: #b9c6c0; }
.gw-sheet input:not([type=file]):focus, .gw-sheet textarea:focus, .gw-sheet select:focus { border-color: var(--main); background: #fff; outline: 2px solid rgba(15, 107, 79, .25); outline-offset: 0; }
.gw-sheet [aria-invalid=true] { border-color: var(--danger) !important; background: #fdf1f1 !important; }
.gw-party { max-width: 330px; margin-left: -7px; }
.gw-err + .gw-party { margin-top: 26px; }
.gw-party > input:first-of-type { font-weight: 600; }
.gw-town { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 2px; }
.gw-billto { padding: 4px 7px; font-weight: 600; }
.gw-mid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 40px 0 28px; }
.gw-meta { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 8px; align-content: start; align-items: center; }
.gw-meta label { font-weight: 500; }
.gw-date { position: relative; display: block; }
.gw-date-text { position: absolute; left: 7px; top: 0; bottom: 0; display: flex; align-items: center; pointer-events: none; }
.gw-sheet .gw-date input { -webkit-appearance: none; appearance: none; text-align: left; min-height: 30px; }
.gw-sheet .gw-date input:not(:focus) { color: transparent; }
.gw-date input:not(:focus)::-webkit-datetime-edit { opacity: 0; }
.gw-date input::-webkit-calendar-picker-indicator { cursor: pointer; }
.gw-date input:focus + .gw-date-text { display: none; }
@media (pointer: coarse) { .gw-sheet .gw-date input:focus { color: transparent; } .gw-date input:focus + .gw-date-text { display: flex; } }
@supports (not selector(::-webkit-calendar-picker-indicator)) and (not (-webkit-touch-callout: none)) { .gw-date-text { display: none !important; } .gw-sheet .gw-date input:not(:focus) { color: inherit; } }
/* iPhone: the same, in its own way (it has no calendar button to look for) */
@supports (-webkit-touch-callout: none) { .gw-date input::-webkit-date-and-time-value { opacity: 0; } .gw-date input:focus + .gw-date-text { display: flex; } }

.gw-table { margin: 0 -4px; }
.gw-tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 58px 104px 96px 124px 28px; gap: 4px; align-items: start; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.gw-tr i { display: none; }
.num { text-align: right; }
.gw-sheet .gw-tr .num input { text-align: right; }
.gw-tr output { display: block; padding: 5px 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gw-tr .t output { padding-top: 0; color: var(--muted); font-size: 13px; }
.gw-th { align-items: center; padding: 10px 4px; background: var(--theme); color: #fff; font-weight: 600; border: 0; }
.gw-th > span { padding: 0 6px; }
.gw-th > span:nth-child(4) { padding: 0; }
.gw-sheet .gw-th input { color: #fff; font-weight: 600; padding: 2px 6px; }
.gw-sheet .gw-th input::placeholder { color: #fff; }
.gw-sheet .gw-th input:focus { color: var(--ink); }
.gw-del { width: 28px; height: 30px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); font: 20px/1 var(--font); cursor: pointer; }
.gw-del:hover, .gw-del:focus-visible { color: var(--danger); background: #fdecec; }
body[data-template=spreadsheet] .gw-th { background: color-mix(in srgb, var(--theme) 12%, #fff); color: var(--theme); }
body[data-template=spreadsheet] .gw-sheet .gw-th input, body[data-template=spreadsheet] .gw-sheet .gw-th input::placeholder { color: var(--theme); }
body[data-template=spreadsheet] .gw-table { border: 1px solid #aab2bc; border-bottom: 0; }
body[data-template=spreadsheet] .gw-tr { gap: 0; padding: 0; border-bottom: 1px solid #aab2bc; align-items: stretch; }
body[data-template=spreadsheet] .gw-tr > :not(:last-child) { padding: 6px; border-right: 1px solid #aab2bc; }
body[data-template=compact] .gw-sheet { font-size: 14px; }
body[data-template=compact] .gw-tr { padding: 1px 4px; }
body[data-template=compact] .gw-th { background: none; color: var(--theme); border-bottom: 2px solid var(--theme); padding: 6px 4px; }
body[data-template=compact] .gw-sheet .gw-th input, body[data-template=compact] .gw-sheet .gw-th input::placeholder { color: var(--theme); }
.gw-under { display: grid; grid-template-columns: 1fr minmax(0, 350px); gap: 16px; margin: 8px 0 20px; }
.gw-add { align-self: start; display: inline-flex; gap: 10px; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--main); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.gw-add span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--main); color: #fff; line-height: 1; }
.gw-totals { font-variant-numeric: tabular-nums; }
.gw-totals > div:not(#t-taxes), #t-taxes > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 4px 32px 4px 12px; }
.gw-totals output { font-weight: 500; text-align: right; white-space: nowrap; }
.gw-totals .gw-discount > span { display: flex; margin-right: auto; }
.gw-totals .gw-discount input { width: 70px; text-align: right; border-color: var(--line); }
.gw-totals .gw-discount select { width: 84px; border-color: var(--line); margin-left: 4px; }
.gw-total { background: var(--tint); }
.gw-total > span { margin-right: auto; }
.gw-total label { font-weight: 500; }
.gw-sheet .gw-total select { width: auto; border-color: #c9a96a; background: #fff7e6; }
.gw-total output { font-weight: 700; font-size: 17px; }
.gw-notelabel { display: block; margin-top: 18px; font-weight: 600; }
.gw-sheet .gw-notelabel + textarea { margin-left: -7px; width: calc(100% + 14px); }
.gw-crafted { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); }
.gw-crafted p { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; justify-content: center; margin: 6px 0; }
.gw-crafted b { color: var(--ink); }
.gw-crafted img[src$=svg] { border-radius: 6px; }
.gw-err { color: var(--danger); font-size: 14px; margin-top: 8px; }
.gw-errors { margin-bottom: 22px; padding: 12px 16px; border: 1px solid #f3b9b9; border-radius: 8px; background: #fdecec; color: var(--danger); }
.gw-errors ul { margin: 6px 0 0; padding-left: 20px; }
.gw-errlink { border: 0; background: none; padding: 3px 0; color: var(--danger); font: inherit; text-align: left; text-decoration: underline; cursor: pointer; }

.gw-side { align-self: stretch; }
.gw-stick { position: sticky; top: 94px; }
.gw-side h2 { font-size: 21px; font-weight: 600; padding-bottom: 14px; border-bottom: 1px solid #c8d2cd; }
.gw-side fieldset { position: relative; margin: 0; padding: 0; border: 0; min-width: 0; }
.gw-side .gw-theme { display: flex; align-items: center; padding: 14px 0; border-bottom: 1px solid #c8d2cd; }
.gw-theme legend { float: left; padding: 0; margin-right: 22px; }
.gw-theme > div { display: flex; gap: 4px; }
.gw-theme label, .gw-templates label { position: relative; }
.gw-theme label { display: grid; place-items: center; width: 36px; height: 36px; cursor: pointer; border-radius: 50%; }
.gw-dot { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 13px; line-height: 1; }
input:checked + .gw-dot::after { content: '✓'; }
.gw-theme label:focus-within, .gw-templates label:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.gw-templates > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 22px 0 20px; }
.gw-templates label { display: grid; justify-items: center; gap: 6px; padding: 4px; border-radius: 8px; font-size: 13px; text-align: center; cursor: pointer; }
.gw-pic { position: relative; display: block; width: 78px; height: 96px; border: 1px solid #c8d2cd; border-radius: 4px; background: var(--tint); }
.gw-pic i { position: absolute; left: 9px; top: 9px; width: 14px; height: 14px; border: 1.5px solid #a9b9b1; border-radius: 50%; }
.gw-pic b { position: absolute; right: 9px; top: 13px; width: 22px; height: 5px; background: #a9b9b1; border-radius: 2px; }
.gw-pic s { position: absolute; left: 9px; right: 9px; top: 42px; height: 9px; background: #a9b9b1; }
.gw-pic u { position: absolute; left: 9px; right: 9px; top: 51px; height: 32px; border: 1px solid #a9b9b1; border-top: 0; }
.p-standard u { border-width: 0 0 1px; background: linear-gradient(#a9b9b1, #a9b9b1) 0 15px / 100% 1px no-repeat; }
.p-spreadsheet s { background: #dfe7e3; border: 1px solid #a9b9b1; }
.p-spreadsheet u { background: linear-gradient(#a9b9b1, #a9b9b1) 50% 0 / 1px 100% no-repeat, linear-gradient(#a9b9b1, #a9b9b1) 0 15px / 100% 1px no-repeat; }
.p-compact s { top: 46px; height: 2px; }
.p-compact u { top: 48px; border: 0; background: repeating-linear-gradient(#0000 0 6px, #a9b9b1 6px 7px); }
input:checked + .gw-pic { border-color: var(--main); background: #fff; box-shadow: 0 0 0 1px var(--main); }
input:checked + .gw-pic s { background: var(--theme); border-color: var(--theme); }
input:checked + .gw-pic.p-spreadsheet s { background: color-mix(in srgb, var(--theme) 25%, #fff); }
input:checked + .gw-pic + span { color: var(--main); font-weight: 600; }
.gw-format { display: block; font-size: 14px; color: var(--muted); }
.gw-format select { display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
.gw-status { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; padding: 12px 14px; border-radius: 6px; background: var(--tint); font-size: 14px; }
.gw-status span { flex: 1; }
.gw-info { position: relative; flex: none; width: 20px; height: 20px; padding: 0; border: 1px solid var(--muted); border-radius: 50%; background: none; color: var(--muted); font: italic 600 12px/1 Georgia, serif; cursor: pointer; }
.gw-info::after { content: ''; position: absolute; inset: -12px; }
.gw-info[aria-expanded=true], .gw-info:hover { background: var(--main); border-color: var(--main); color: #fff; }
.gw-tip { margin: -8px 0 16px; padding: 10px 12px; border-radius: 6px; background: var(--brand); color: #fff; font-size: 14px; }
.gw-acts { display: flex; gap: 8px; padding-top: 18px; border-top: 1px solid #c8d2cd; }
.gw-acts .gw-primary { flex: 1; }
.gw-links { display: flex; justify-content: space-between; margin-top: 8px; }
.gw-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 28px; padding: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.gw-foot a { color: var(--muted); padding: 6px 0; }

.gw-dialog { width: min(460px, calc(100% - 40px)); max-height: 90vh; margin: auto; padding: 0 24px 24px; border: 0; border-radius: 16px; overflow: hidden auto; color: var(--ink); animation: gw-in .22s cubic-bezier(.2, .8, .3, 1); }
.gw-dialog.out { animation: gw-out .22s ease-in forwards; }
.gw-dialog::backdrop { background: rgba(6, 26, 19, .5); }
@keyframes gw-in { from { transform: translateY(-100vh); } }
@keyframes gw-out { to { transform: translateY(-100vh); } }
.gw-dhead { position: sticky; top: 0; display: flex; align-items: center; min-height: 64px; padding-right: 44px; background: #fff; }
.gw-dhead h2 { font-size: 20px; font-weight: 600; }
.gw-x { position: absolute; right: -12px; top: 10px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.gw-x svg { width: 32px; height: 32px; padding: 6px; border-radius: 50%; background: #e6eeea; }
#d-text p { margin: 0 0 14px; }
.gw-dbtns { display: flex; gap: 12px; }
.gw-dbtns .gw-btn { flex: 1; }
.gw-print { display: none; }

@media (max-width: 1080px) {
  .gw-main { grid-template-columns: minmax(0, 720px); padding-top: 20px; gap: 20px; }
  .gw-bar { display: flex; gap: 8px; position: sticky; top: 70px; z-index: 8; padding: 10px 0; background: #fff; }
  .gw-bar .gw-primary { flex: 1; }
  .gw-stick { position: static; }
}
@media (max-width: 640px) {
  .gw-wide-only { display: none; }
  .gw-top { padding: 8px 16px; min-height: 60px; }
  .gw-brand b { font-size: 16px; line-height: 19px; }
  .gw-bar { top: 60px; }
  .gw-btn { padding: 8px 14px; }
  .gw-hero { padding: 32px 20px; }
  .gw-hero h1 { font-size: 31px; }
  .gw-main { padding: 12px 16px 40px; }
  .gw-sheet { padding: 22px 18px; }
  .gw-sheet input, .gw-sheet textarea, .gw-sheet select { font-size: 16px !important; min-height: 38px; }
  .gw-head { flex-direction: column-reverse; }
  .gw-title { font-size: 34px; }
  .gw-party { max-width: none; }
  .gw-mid { grid-template-columns: minmax(0, 1fr); margin: 24px 0; }
  .gw-th > span:not(:first-child):not(:nth-child(4)) { display: none; }
  .gw-sheet .gw-th { grid-template-columns: 1fr 100px; }
  .gw-sheet .gw-tr:not(.gw-th) { grid-template-columns: 1fr 1.5fr 1fr; padding: 10px 44px 10px 4px; gap: 6px; }
  body .gw-sheet .gw-tr:not(.gw-th) > * { border: 0; padding: 0; text-align: left; }
  .gw-sheet .gw-tr .num input { text-align: left; border-color: var(--line); }
  .gw-th > span:nth-child(4) input { text-align: right !important; border-color: transparent !important; }
  .gw-tr .d { grid-column: 1 / -1; }
  .gw-tr .a { grid-column: 1 / -1; font-weight: 600; }
  .gw-tr i { display: block; padding: 0 2px; color: var(--muted); font-size: 12px; font-style: normal; }
  .gw-del { position: absolute; right: 0; top: 8px; width: 44px; height: 44px; text-align: center !important; }
  .gw-under { grid-template-columns: minmax(0, 1fr); }
  .gw-totals > div:not(#t-taxes), #t-taxes > div { padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, ::backdrop { animation: none !important; transition: none !important; } }

/* Print: only the invoice. */
@media print {
  @page { size: A4; margin: 14mm; }
  body > :not(.gw-print) { display: none !important; }
  .gw-print { display: block; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
  .gw-print * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-head, .p-parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
  .p-parties > div { flex: 1; }
  .p-head img { max-width: 180px; max-height: 90px; }
  .p-right { text-align: right; }
  .p-inv { font-size: 26px; line-height: 34px; font-weight: 700; color: var(--theme); }
  .p-label { font-size: 12px; font-weight: 600; color: var(--muted); }
  .p-name { font-weight: 600; }
  .p-pre { white-space: pre-wrap; }
  .gw-print table { width: 100%; border-collapse: collapse; }
  .gw-print th { padding: 8px; background: var(--theme); color: #fff; text-align: left; }
  .gw-print td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
  .gw-print .num { text-align: right; white-space: nowrap; }
  .gw-print tr { break-inside: avoid; }
  body[data-template=spreadsheet] .gw-print :is(th, td) { border: 1px solid #aab2bc; }
  body[data-template=spreadsheet] .gw-print th { background: color-mix(in srgb, var(--theme) 12%, #fff); color: var(--theme); }
  body[data-template=compact] .gw-print table { font-size: 12px; }
  body[data-template=compact] .gw-print :is(th, td) { padding: 3px 8px; }
  body[data-template=compact] .gw-print th { background: none; color: var(--theme); border-bottom: 2px solid var(--theme); }
  .p-totals { margin: 14px 0 0 auto; max-width: 320px; break-inside: avoid; }
  .p-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
  .p-total { border-top: 2px solid var(--ink); font-size: 16px; font-weight: 700; }
  .p-block { margin-top: 18px; }
  .p-foot { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
}
