@font-face {
  font-family: "BalooWord";
  src: url("vendor/fonts/baloo2-word.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f2547;
  --muted: #8494ab;
  --bg: #f2f5fa;
  --card: #ffffff;
  --line: #dbe4f0;
  --danger: #dc2626;
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-icon { width: 44px; height: 44px; border-radius: 11px; }
.wordmark {
  font-family: "BalooWord", -apple-system, sans-serif;
  font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink);
  letter-spacing: 0.2px;
}
.wordmark-ku { color: var(--blue); }
.tagline { font-size: 9.5px; letter-spacing: 0.5px; color: var(--muted); margin-top: 3px; font-weight: 600; line-height: 1.28; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: flex; background: #e8eef7; border-radius: 999px; padding: 2px; }
.lang-btn { border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.lang-btn.lang-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 37, 71, 0.18); }
.version-badge { font-size: 12px; font-weight: 600; color: var(--blue); background: #e3ecfd; padding: 5px 10px; border-radius: 999px; }

.container { max-width: 560px; margin: 0 auto; padding: 18px 16px 28px; }

.btn {
  border: 0; border-radius: 14px; padding: 13px 18px;
  font-size: 15.5px; font-weight: 600; text-align: center;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-primary:disabled { background: #b9cdf3; cursor: default; }
.btn-secondary { background: #e8eef7; color: var(--ink); }
.btn-small { padding: 8px 13px; font-size: 13.5px; border-radius: 10px; }
.btn-danger { color: var(--danger); }

.group-label { font-size: 13px; font-weight: 700; letter-spacing: 0.4px; color: var(--muted); margin: 16px 2px 8px; text-transform: uppercase; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 14.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip-active { border-color: var(--blue); background: #e3ecfd; color: var(--blue-dark); }

.field { display: block; margin-top: 10px; }
.field > span { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.txt {
  width: 100%; font: inherit; font-size: 15.5px; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 13px; outline: none;
}
.txt:focus { border-color: var(--blue); }
textarea.txt { resize: vertical; min-height: 44px; }
.txt-mini { width: auto; padding: 8px 10px; font-size: 14.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.item-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 12px; margin-top: 10px;
}
.item-grid { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; margin-top: 8px; align-items: end; }
.item-amount { font-size: 14.5px; font-weight: 700; text-align: right; white-space: nowrap; padding-bottom: 10px; }
.item-del { margin-top: 8px; }

.totals-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px; margin-top: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.total-row { display: flex; justify-content: space-between; font-size: 15px; font-weight: 600; }
.total-row.grand { border-top: 1.5px solid var(--line); padding-top: 10px; font-size: 17px; font-weight: 800; color: var(--blue-dark); }
.total-input-row { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; }
.total-input-row > span:first-child { width: 76px; flex: none; }
.total-input-row > span:last-child { margin-left: auto; white-space: nowrap; }
.total-input-row input[type="number"] { width: 76px; }
.tax-pct { display: inline-flex; align-items: center; gap: 5px; }

.tool-row { display: flex; gap: 8px; margin-top: 12px; }
.tool-row .btn { flex: 1; }
.action-col { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

.history-card {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 13px 14px; margin-top: 10px;
}
.history-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history-num { font-size: 15.5px; font-weight: 700; }
.history-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.history-total { font-size: 15px; font-weight: 800; color: var(--blue-dark); }
.status-pill { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status-pill.unpaid { background: #fde8e8; color: var(--danger); }
.status-pill.paid { background: #e2f5e9; color: #15803d; }
.history-actions { display: flex; gap: 7px; margin-top: 10px; }
.history-actions .btn { flex: 1; }
.empty-note { font-size: 14px; color: var(--muted); margin-top: 8px; }

.logo-preview { max-width: 180px; max-height: 90px; margin-top: 12px; border-radius: 10px; background: #fff; border: 1.5px solid var(--line); padding: 6px; }

.dev-footer { margin-top: 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dev-by { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.dev-credit { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 700; text-decoration: none; }
.dev-credit svg { color: var(--blue); flex: none; }
.about-toggle { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted); cursor: pointer; }
.about-p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; color: var(--muted); text-align: left; }

.dialog {
  border: 0; border-radius: 20px; padding: 22px;
  width: min(92vw, 340px); margin: auto;
  background: var(--card); color: var(--ink);
}
.dialog::backdrop { background: rgba(10, 22, 40, 0.5); }
.dialog-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }

.busy {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 4px solid #c9d9f6; border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy-label { font-size: 14.5px; font-weight: 600; color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 70; max-width: 88vw;
  background: #10233f; color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 11px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.35);
  text-align: center;
}
