/* Baki Khata — ToolNest mobile-first styles.
   System font stack only. Print shows the statement sheet only. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", "Nirmala UI", sans-serif;
  background: #f4f7f5;
  color: #17211d;
  line-height: 1.5;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 14px 32px;
}

header.site {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand .tool { font-weight: 600; color: #0b6b57; }
.spacer { flex: 1; }

.lang-toggle {
  display: flex;
  border: 1px solid #b9ccc4;
  border-radius: 8px;
  overflow: hidden;
}

.lang-toggle button {
  border: 0;
  background: #fff;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
}

.lang-toggle button[aria-pressed="true"] {
  background: #0b6b57;
  color: #fff;
}

h1 { font-size: 1.45rem; line-height: 1.3; margin: 14px 0 8px; }
h2 { font-size: 1.2rem; margin: 4px 0 6px; }
h3 { font-size: 1.05rem; margin: 16px 0 6px; }
p { overflow-wrap: anywhere; }

.hint { color: #3c4a44; font-size: 0.92rem; margin: 4px 0 8px; }
.counts { color: #3c4a44; font-size: 0.95rem; margin: 6px 0; overflow-wrap: anywhere; }

.banner {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 10px 0;
  overflow-wrap: anywhere;
}

.banner.warn { background: #fdf3e3; border: 1px solid #e8c98a; }
.banner.info { background: #eef4f1; border: 1px solid #b9ccc4; }

.confirm-bar {
  background: #fdf3e3;
  border: 1px solid #e8c98a;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
}

.card {
  background: #fff;
  border: 1px solid #d8e2dd;
  border-radius: 12px;
  padding: 16px;
  margin: 14px 0;
}

.danger-zone { border-color: #e3b3ad; }

label, .field-label { display: block; font-weight: 600; margin: 10px 0 4px; }

input[type="text"], input[type="search"], input[type="date"], textarea, select {
  width: 100%;
  padding: 11px 12px;
  min-height: 44px;
  border: 1px solid #b9ccc4;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: inherit;
}

textarea { resize: vertical; overflow-wrap: anywhere; white-space: pre-wrap; }
textarea[readonly] { background: #f4f7f5; }

input:focus-visible, textarea:focus-visible, button:focus-visible,
a:focus-visible, summary:focus-visible, select:focus-visible {
  outline: 3px solid #f2a93b;
  outline-offset: 1px;
}

.field { margin: 4px 0; }

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid #0b6b57;
  border-radius: 8px;
  background: #fff;
  color: #0b6b57;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn.primary { background: #0b6b57; color: #fff; }
.btn.danger { border-color: #a33b32; color: #a33b32; }
.btn.small-btn { min-height: 44px; padding: 7px 12px; }
.btn.big-btn { min-height: 52px; padding: 12px 20px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.app-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.nav-btn, .filter-btn, .kind-btn {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid #b9ccc4;
  border-radius: 999px;
  background: #fff;
  color: #17211d;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn[aria-pressed="true"], .filter-btn[aria-pressed="true"],
.kind-btn[aria-pressed="true"] {
  background: #0b6b57;
  border-color: #0b6b57;
  color: #fff;
}

.backup-indicator { color: #3c4a44; font-size: 0.9rem; }

.totals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.total-box {
  background: #eef4f1;
  border: 1px solid #d8e2dd;
  border-radius: 10px;
  padding: 10px;
  min-width: 0;
}

.total-box span { display: block; color: #3c4a44; font-size: 0.88rem; }
.total-box strong { display: block; font-size: 1.08rem; overflow-wrap: anywhere; }

.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row input { flex: 1; min-width: 0; }
.filter-row, .kind-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.customer-list, .entries-list { display: grid; gap: 8px; margin: 10px 0; }

.customer-row, .entry-row, .collection-row {
  width: 100%;
  min-height: 56px;
  padding: 12px;
  border: 1px solid #d8e2dd;
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.customer-row, .collection-row { cursor: pointer; }
.customer-main { min-width: 0; }
.customer-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.customer-sub, .entry-sub { display: block; color: #3c4a44; font-size: 0.9rem; overflow-wrap: anywhere; }
.customer-balance { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.collection-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

.entry-row { align-items: flex-start; }
.entry-main { min-width: 0; flex: 1; }
.entry-amount { font-weight: 700; overflow-wrap: anywhere; }
.entry-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.detail-balance { font-size: 1.45rem; font-weight: 800; margin: 8px 0; overflow-wrap: anywhere; }

.form-errors {
  background: #fdecea;
  border: 1px solid #e3b3ad;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}

.form-errors ul { margin: 4px 0; padding-left: 20px; }
.empty-state { background: #eef4f1; border-radius: 8px; padding: 12px; margin: 10px 0; }

details {
  border: 1px solid #d8e2dd;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
}

summary { font-weight: 600; cursor: pointer; min-height: 44px; display: flex; align-items: center; }

footer { color: #3c4a44; font-size: 0.92rem; margin-top: 18px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.table-wrap { overflow-x: auto; margin: 10px 0; }

.statement-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.statement-table th, .statement-table td {
  border-bottom: 1px solid #d8e2dd;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.statement-table th { background: #eef4f1; }
.statement-totals { margin-top: 10px; }
.statement-totals p { margin: 4px 0; }

.print-only { display: none; }

.statement-sheet {
  background: #fff;
  color: #000;
  font-size: 12pt;
  line-height: 1.5;
}

.statement-sheet h2, .statement-sheet h3 { color: #000; }

@media (max-width: 560px) {
  h1 { font-size: 1.25rem; }
  .card { padding: 13px; }
  .totals-grid { grid-template-columns: 1fr; }
  .range-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .search-row { flex-direction: column; }
  .customer-row, .entry-row, .collection-row { flex-direction: column; align-items: stretch; }
  .customer-balance { text-align: left; }
  .entry-actions { justify-content: flex-start; }
}

@page {
  size: A4;
  margin: 15mm;
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; margin: 0; }
  #print-area { display: block !important; }
  .statement-sheet { font-size: 11pt; }
  .statement-table th, .statement-table td { border-bottom: 1px solid #999; }
  .table-wrap { overflow: visible; }
}
