@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;
}

.photo-preview { width: 86px; height: 114px; object-fit: cover; margin-top: 12px; border-radius: 10px; border: 1.5px solid var(--line); }
.tpl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.tpl-active { border-color: var(--blue); background: #eef4fe; }
.tpl-mock {
  position: relative; display: block; width: 100%; height: 118px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px;
  overflow: hidden;
}
.mock-line { display: block; height: 5px; border-radius: 3px; background: #d7e0ee; margin-bottom: 6px; }
.mock-name { height: 8px; background: #9db8dd; width: 62%; }
.mock-blue { background: var(--blue); width: 42%; height: 4px; }
.mock-short { width: 55%; }
.mock-half { width: 58%; }
.mock-photo {
  position: absolute; top: 10px; right: 10px; width: 26px; height: 35px;
  border-radius: 3px; background: #b9cdf3; border: 1px solid #9db8dd;
}
.tpl-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }

.tpl-note { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--muted); }

.seg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-btn {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.seg-active { border-color: var(--blue); background: #eef4fe; color: var(--blue-dark); }
.price-row { align-items: center; justify-content: space-between; }
.price-status { font-size: 12.5px; color: var(--muted); }
.status-text { font-weight: 700; }
.status-due { color: #15803d; }
#maal-block .totals, #fitrah-block .totals { margin-top: 4px; }
.tpl-card { min-height: 64px; justify-content: center; }

.totals {
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px;
  padding: 8px 18px; margin-top: 2px;
}
.total-row {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}
.total-row:last-child { border-bottom: none; }
.total-row > span:first-child { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.total-row > span:last-child { font-size: 16px; font-weight: 700; color: var(--ink); text-align: right; }
.total-grand { padding: 14px 0 12px; }
.total-grand > span:first-child { color: var(--ink); font-size: 15px; font-weight: 700; }
.total-grand > span:last-child { font-size: 22px; font-weight: 800; color: var(--blue-dark); letter-spacing: -0.2px; }
.status-text {
  background: #edf1f7; border-radius: 999px; padding: 4px 12px;
  font-size: 13px !important; font-weight: 700; white-space: nowrap;
}
.status-due { background: #dcf5e5; color: #15803d !important; }
.txt { font-variant-numeric: tabular-nums; }

.label-row { display: flex; align-items: center; gap: 8px; }
.help-btn {
  width: 21px; height: 21px; border-radius: 50%; border: 1.5px solid var(--blue);
  background: var(--card); color: var(--blue); font-size: 12.5px; font-weight: 800;
  line-height: 1; cursor: pointer; padding: 0; margin-top: 2px;
}

.disclaimer {
  margin: 12px 2px 0; font-size: 12.5px; line-height: 1.6; color: var(--muted);
}

.calc-note {
  text-align: right; padding: 0 0 10px; margin-top: -4px;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}

.hero-card { background: linear-gradient(135deg, #1d4ed8, #2563eb); border-radius: 20px; padding: 22px 20px; color: #fff; box-shadow: 0 14px 34px rgba(37, 99, 235, 0.32); margin-bottom: 6px; }
.hero-name { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.hero-date { font-size: 15px; opacity: 0.88; margin-top: 3px; }
.hero-count { font-size: 34px; font-weight: 800; margin-top: 12px; font-variant-numeric: tabular-nums; }
.hero-run { font-size: 14px; font-weight: 700; opacity: 0.92; margin-top: 4px; }
.plan-summary { font-size: 15px; font-weight: 700; color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 13px 15px; margin: 16px 0 14px; line-height: 1.45; }
.plan-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05); }
.plan-head { display: flex; justify-content: space-between; align-items: center; }
.plan-len { font-size: 18px; font-weight: 800; color: #0f172a; }
.plan-cost { font-size: 12.5px; font-weight: 800; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 3px 10px; }
.plan-range { font-size: 14px; font-weight: 700; color: #2563eb; margin-top: 3px; }
.plan-take { font-size: 13.5px; color: #64748b; margin-top: 3px; }
.hrow { display: flex; align-items: center; gap: 13px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; }
.hrow.past { opacity: 0.45; }
.hdate { width: 46px; flex: none; text-align: center; background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 5px 0 4px; }
.hday { display: block; font-size: 19px; font-weight: 800; color: #dc2626; line-height: 1.05; }
.hmon { display: block; font-size: 11px; font-weight: 700; color: #b91c1c; text-transform: uppercase; }
.hmain { flex: 1; min-width: 0; }
.hname { font-size: 15px; font-weight: 700; color: #0f172a; }
.hdow { font-size: 12.5px; color: #64748b; }
.hpill { flex: none; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 9px; }
.hpill.libur { color: #b91c1c; background: #fee2e2; }
.hpill.cuti { color: #1d4ed8; background: #dbeafe; }
.seg-btn.on { background: #2563eb; border-color: #1d4ed8; color: #ffffff; font-weight: 800; box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35); }
.lang-btn.on { background: #2563eb; color: #ffffff; font-weight: 800; box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4); }
.hero-card { position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; right: -46px; top: -46px; width: 170px; height: 170px; border-radius: 50%; border: 26px solid rgba(255, 255, 255, 0.14); }
.plan-card { cursor: pointer; transition: transform 0.08s ease, box-shadow 0.15s ease; }
.plan-card:active { transform: scale(0.985); }
.plan-strip { display: flex; gap: 3px; margin-top: 10px; flex-wrap: wrap; }
.pdot { width: 15px; height: 15px; border-radius: 4.5px; background: #dbeafe; border: 1px solid #bfdbfe; }
.pdot.leave { background: #fbbf24; border-color: #f59e0b; }
.pdot.work { background: #f1f5f9; border-color: #e2e8f0; }
.plan-more { font-size: 12.5px; font-weight: 700; color: #2563eb; margin-top: 8px; }
.drow { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed #e2e8f0; }
.drow:last-child { border-bottom: none; }
.ddate { width: 118px; flex: none; font-size: 13.5px; font-weight: 700; color: #0f172a; }
.dwhat { flex: 1; font-size: 13px; color: #64748b; }
.dchip { flex: none; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2.5px 9px; }
.dchip.leave { color: #92400e; background: #fef3c7; }
.dchip.libur { color: #b91c1c; background: #fee2e2; }
.dchip.cuti { color: #1d4ed8; background: #dbeafe; }
.dchip.weekend { color: #475569; background: #f1f5f9; }
.plan-card.past { background: #f8fafc; border: 1.5px dashed #cbd5e1; box-shadow: none; }
.plan-card.past .plan-len { color: #475569; }
.plan-card.past .plan-range { color: #64748b; }
.plan-card.past .plan-cost { color: #64748b; background: #e2e8f0; }
.plan-card.past .plan-strip { opacity: 0.55; }
.plan-past-pill { font-size: 11px; font-weight: 800; color: #64748b; background: #e2e8f0; border-radius: 999px; padding: 2.5px 9px; margin-left: 8px; vertical-align: 3px; }
.dialog { max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#plan-dialog-days { max-height: 54dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 6px -4px 4px; padding: 0 4px; }
.drow { flex-wrap: wrap; row-gap: 2px; }
.dwhat { flex-basis: 100%; order: 3; }
.dchip { margin-left: auto; }
.dev-credit { display: inline-flex; align-items: center; gap: 4px; }
@keyframes credit-bounce {
  0%, 100% { transform: translateY(0); }
  18% { transform: translateY(-5px); }
  34% { transform: translateY(0); }
  46% { transform: translateY(-2.5px); }
  58% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .dev-credit { animation: none; } }

.dev-by { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 13px 18px; }
.beetle-walker { position: absolute; left: 4%; top: 88%; width: 15px; height: 15px; color: #2563eb; pointer-events: none; animation: beetle-walk 11s linear infinite; }
.beetle-walker svg { display: block; }
@keyframes beetle-walk {
  0% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-180deg); }
  7% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-270deg); }
  38% { left: 96%; top: 88%; transform: translate(-50%, -50%) rotate(-270deg); }
  47% { left: 96%; top: 12%; transform: translate(-50%, -50%) rotate(-360deg); }
  78% { left: 4%; top: 12%; transform: translate(-50%, -50%) rotate(-450deg); }
  87% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-540deg); }
  100% { left: 4%; top: 88%; transform: translate(-50%, -50%) rotate(-540deg); }
}
@media (prefers-reduced-motion: reduce) { .beetle-walker { animation: none; display: none; } }
