/* KiraInvoice Maker, CardKira's colours: deep green #0b3d2e and orange #ff7a45. 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 {
  --brand: #0b3d2e; --brand-2: #135c45; --accent: #ff7a45; --ink: #1e2a3a; --muted: #5d6878; --line: #dfe4ea;
  --bg: #f5f8f7; --card: #ffffff; --soft: #e4f6ee; --danger: #b4232a; --danger-soft: #fde8e8; --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; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/20px var(--font); }
h2 { font-size: 18px; line-height: 24px; font-weight: 600; margin: 0 0 14px; }
a { color: var(--brand-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mk-skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
.mk-skip:focus { left: 8px; }
.mk-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.mk-top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 24px; background: var(--brand); color: #fff; }
.mk-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.mk-brand img { width: 34px; height: 34px; border-radius: 9px; }
.mk-brand-name { display: block; font-size: 18px; font-weight: 700; line-height: 20px; }
.mk-brand-by { display: block; font-size: 12px; opacity: .8; line-height: 14px; }
.mk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.mk-btn:hover { background: #f0f3f2; }
.mk-btn:disabled { opacity: .6; cursor: wait; }
.mk-primary { background: var(--accent); border-color: var(--accent); color: #2a1206; font-weight: 600; }
.mk-primary:hover { background: #ff8f61; }
.mk-top .mk-quiet { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.mk-top .mk-quiet:hover { background: rgba(255, 255, 255, .12); }
.mk-small { min-height: 34px; padding: 6px 12px; }

.mk-notice { max-width: 1320px; margin: 16px auto 0; padding: 12px 16px; background: var(--soft); border: 1px solid #bfe6d3; border-radius: 10px; }
.mk-status { display: block; margin-top: 6px; color: var(--brand-2); font-weight: 500; }
.mk-status:empty { display: none; }
.mk-errors { max-width: 1320px; margin: 12px auto 0; padding: 12px 16px; background: var(--danger-soft); border: 1px solid #f3b9b9; border-radius: 10px; color: var(--danger); }
.mk-errors ul { margin: 6px 0 0; padding-left: 20px; }
.mk-errors a { color: var(--danger); }

.mk-main { max-width: 1320px; margin: 16px auto 40px; padding: 0 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.mk-notice, .mk-errors { margin-left: auto; margin-right: auto; }
@media (max-width: 1360px) { .mk-main, .mk-notice, .mk-errors { margin-left: 20px; margin-right: 20px; } }
.mk-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.mk-field { margin-bottom: 12px; min-width: 0; }
.mk-field label, .mk-amt-label { display: block; font-weight: 500; margin-bottom: 4px; }
.mk-req { color: var(--danger); }
.mk-field input, .mk-field select, .mk-field textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #c9d1da; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.mk-field textarea { resize: vertical; }
.mk-field input:focus, .mk-field select:focus, .mk-field textarea:focus { border-color: var(--brand-2); outline: 3px solid rgba(19, 92, 69, .2); outline-offset: 0; }
[aria-invalid='true'] { border-color: var(--danger) !important; }
.mk-err { color: var(--danger); font-size: 12px; margin: 4px 0 0; }
.mk-help { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.mk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.mk-logo { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.mk-logo-box { width: 132px; height: 72px; border: 1px dashed #b8c2cc; border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: #fafbfc; flex: none; }
.mk-logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mk-logo-ph { color: var(--muted); font-size: 12px; }
.mk-logo-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mk-logo-btns .mk-help { flex-basis: 100%; margin: 0; }
.mk-file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.mk-taxlabel { max-width: 220px; }
.mk-line { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, .7fr) minmax(0, 1fr) minmax(0, .7fr) minmax(0, 1fr) 32px; gap: 8px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.mk-line .mk-field { margin: 0; }
.mk-amt output { display: block; min-height: 40px; padding: 10px 0 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.mk-remove { margin-top: 26px; width: 32px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.mk-remove:hover { background: var(--danger-soft); color: var(--danger); }
.mk-discount { margin-top: 16px; }

/* The preview: a sheet of paper that follows what is typed. */
.mk-preview-wrap { position: sticky; top: 76px; }
.mk-preview-h { margin-bottom: 8px; }
.mk-paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 24px rgba(11, 61, 46, .08); padding: 36px 36px 24px; min-height: 600px; overflow-wrap: anywhere; }
.mk-p-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.mk-p-logo { max-width: 180px; max-height: 90px; object-fit: contain; }
.mk-p-title { text-align: right; }
.mk-p-inv { font-size: 24px; line-height: 30px; font-weight: 700; color: var(--brand); letter-spacing: .04em; margin-bottom: 6px; }
.mk-p-title dl { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; justify-content: end; }
.mk-p-title dt { color: var(--muted); } .mk-p-title dd { margin: 0; font-weight: 600; }
.mk-p-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.mk-p-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; margin-bottom: 2px; }
.mk-p-name { font-weight: 600; font-size: 15px; }
.mk-p-pre { white-space: pre-wrap; }
.mk-p-table-wrap { overflow-x: auto; }
.mk-p-table { width: 100%; border-collapse: collapse; }
.mk-p-table th { background: var(--brand); color: #fff; text-align: left; font-weight: 600; padding: 8px; }
.mk-p-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mk-p-table .num { text-align: right; white-space: nowrap; }
.mk-p-empty { color: var(--muted); text-align: center; }
.mk-p-totals { margin: 14px 0 0 auto; max-width: 320px; font-variant-numeric: tabular-nums; }
.mk-p-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; }
.mk-p-totals > div > span:first-child { color: var(--muted); }
.mk-p-total { border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 8px !important; font-size: 16px; font-weight: 700; }
.mk-p-total > span:first-child { color: var(--ink) !important; }
.mk-p-block { margin-top: 18px; }
.mk-p-bt { font-weight: 600; margin-bottom: 2px; }
.mk-p-foot { margin-top: 28px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.mk-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 20px 28px; }

@media (max-width: 980px) {
  .mk-main { grid-template-columns: 1fr; }
  .mk-preview-wrap { position: static; }
}
@media (max-width: 640px) {
  .mk-top { padding: 10px 14px; }
  .mk-actions { width: 100%; }
  .mk-actions .mk-btn { flex: 1 1 auto; padding: 8px 10px; }
  .mk-main, .mk-notice, .mk-errors { margin-left: 12px; margin-right: 12px; }
  .mk-card { padding: 16px; }
  .mk-two { grid-template-columns: 1fr; }
  .mk-top { position: static; }
  .mk-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mk-line .mk-desc { grid-column: 1 / -1; }
  .mk-line .mk-amt { grid-column: 1 / 3; grid-row: 3; }
  .mk-line .mk-remove { grid-column: 3; grid-row: 3; justify-self: end; margin-top: 0; }
  .mk-amt output { text-align: left; padding-top: 0; min-height: 0; }
  .mk-paper { padding: 20px 16px; min-height: 0; }
  .mk-p-head, .mk-p-parties { grid-template-columns: 1fr; flex-direction: column; }
  .mk-p-parties { display: grid; }
  .mk-p-title { text-align: left; }
  .mk-p-title dl { justify-content: start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Print: only the invoice. */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .mk-top, .mk-notice, .mk-errors, .mk-form, .mk-preview-h, .mk-foot, .mk-skip { display: none !important; }
  .mk-main { display: block; margin: 0; }
  .mk-preview-wrap { position: static; }
  .mk-paper { border: 0; box-shadow: none; padding: 0; min-height: 0; }
  .mk-p-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .mk-p-table tr { break-inside: avoid; }
}
