/* Tool components – the converter is styled as a cheque so the page shows what it produces */

/* ---------- form controls ---------- */
label, .lbl { display: block; font-weight: 650; font-size: .92rem; margin-bottom: .3rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--sheet);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: .65rem .8rem; min-height: 44px;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
.field { margin-bottom: 1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: .4rem 0 1rem; }
.checks label { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--brand); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: .55rem 1rem; font-weight: 650; cursor: pointer; font-size: .95rem; }
.seg input:checked + span { background: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

.btn { font: inherit; font-weight: 700; font-size: .95rem; padding: .6rem 1.1rem; min-height: 44px; border-radius: var(--radius); border: 1.5px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; }
.btn:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand-ink); }
.btn.ghost:hover { background: var(--brand-wash); color: var(--brand-ink); }
.btn.danger { border-color: var(--stamp); color: var(--stamp); background: transparent; }
.btn.danger:hover { background: var(--stamp); color: #fff; }
.btn.sm { min-height: 36px; padding: .3rem .8rem; font-size: .88rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; align-items: center; font-size: .9rem; color: var(--ink-2); }
.chips button { font: inherit; font-family: var(--font-num); font-size: .85rem; border: 1px dashed var(--ink-2); background: transparent; color: var(--ink); padding: .25rem .65rem; border-radius: 99px; cursor: pointer; }
.chips button:hover { background: var(--brand-wash); border-style: solid; }

/* ---------- the cheque converter ---------- */
.cheque {
  position: relative; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 10px;
  padding: clamp(1rem, 3vw, 1.8rem); box-shadow: 6px 6px 0 var(--brand-wash), 6px 6px 0 1.5px var(--line);
  background-image: repeating-linear-gradient(90deg, transparent 0 7px, rgba(11,110,95,.045) 7px 8px);
  margin-bottom: 8px; margin-right: 8px;
}
.cheque-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.cheque-top h2 { font-size: 1.05rem; margin: 0; font-weight: 800; }
.cheque-top p { margin: 0; font-size: .85rem; color: var(--ink-2); }
.cheque-sys { flex: none; }
.amount-line { display: flex; align-items: stretch; gap: .8rem; flex-wrap: wrap; }
.amount-box { flex: 1 1 240px; display: flex; align-items: center; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); padding: 0 .5rem 0 .8rem; min-height: 64px; }
.amount-box .sym { font-family: var(--font-num); font-size: 1.5rem; font-weight: 600; color: var(--brand); padding-right: .5rem; }
.amount-box input { border: 0; background: transparent; font-family: var(--font-num); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 600; padding: .4rem 0; min-height: 56px; letter-spacing: -.02em; flex: 1; min-width: 0; outline: none !important; }
.amount-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.amount-box .icon-btn { border: 0; width: 38px; height: 38px; }
.pay-line { margin-top: 1.3rem; }
.pay-line .lbl { font-size: .78rem; color: var(--ink-2); font-weight: 600; margin: 0; }
.words-out { position: relative; font-family: var(--font-words); font-size: clamp(1.45rem, 3.4vw, 2.1rem); line-height: 1.3; min-height: 3.6rem; padding: .25rem 5.5rem .45rem 0; border-bottom: 2px solid var(--ink); overflow-wrap: anywhere; font-weight: 500; }
.words-out.empty { color: var(--ink-2); font-style: italic; font-size: 1.2rem; }
.words-out.err { color: var(--stamp); font-size: 1.1rem; font-family: var(--font-ui); }
.stamp { position: absolute; right: 0; top: .1rem; border: 2px solid var(--stamp); color: var(--stamp); font-family: var(--font-ui); font-weight: 800; letter-spacing: .08em; font-size: .8rem; padding: .1rem .5rem; transform: rotate(-7deg); opacity: .0; border-radius: 3px; }
.words-out.has-only .stamp { opacity: .85; }
.fmt-line { overflow-wrap: anywhere; margin-top: .6rem; font-family: var(--font-num); font-size: .95rem; color: var(--ink-2); min-height: 1.5em; }
.opts { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px dashed var(--line); }
.opts summary { cursor: pointer; font-weight: 700; margin-bottom: 1rem; }
.opts .row { margin-bottom: .6rem; }
.hide { display: none !important; }

/* ---------- result panels ---------- */
.panel { background: var(--sheet); border: 1.5px solid var(--line); border-radius: 10px; padding: clamp(1rem, 3vw, 1.6rem); }
.panel + .panel { margin-top: 1.2rem; }
.panel h2, .panel h3 { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 1rem 0; }
.stat { background: var(--sheet); padding: .9rem 1rem; }
.stat small { display: block; color: var(--ink-2); font-size: .82rem; font-weight: 600; }
.stat b { font-family: var(--font-num); font-size: 1.25rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat.big { background: var(--brand-wash); }
.said { font-family: var(--font-words); font-size: 1.3rem; line-height: 1.35; margin: .4rem 0 .8rem; overflow-wrap: anywhere; }
.said.err, .err { color: var(--stamp); }
.note { font-size: .88rem; color: var(--ink-2); }
.bar-split { height: 14px; border-radius: 99px; overflow: hidden; display: flex; background: var(--line); margin: .8rem 0 .4rem; }
.bar-split i { display: block; height: 100%; }
.bar-split .p { background: var(--brand); }
.bar-split .i { background: var(--stamp); }
.legend { display: flex; gap: 1.2rem; font-size: .88rem; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; background: var(--brand); }
.legend span.i::before { background: var(--stamp); }
.tool-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }

/* ---------- counter / deposit slip ---------- */
.denoms { display: grid; gap: .5rem; margin: 1rem 0; }
.denom { display: grid; grid-template-columns: 90px 20px 1fr 1fr 34px; gap: .5rem; align-items: center; }
.denom .d { font-family: var(--font-num); font-weight: 700; text-align: right; background: var(--brand-wash); border-radius: 4px; padding: .5rem .6rem; }
.denom .x { text-align: center; color: var(--ink-2); }
.denom .sub { font-family: var(--font-num); text-align: right; font-weight: 600; }
.denom input { text-align: center; font-family: var(--font-num); }
.denom .rm { border: 0; background: none; color: var(--stamp); font-size: 1.2rem; cursor: pointer; }
.slip-total { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--ink); color: var(--paper); padding: 1rem 1.2rem; border-radius: var(--radius); font-family: var(--font-num); font-size: 1.1rem; }
.slip-total b { font-size: 1.5rem; }

/* ---------- cheque preview (cheque-writing page) ---------- */
.chq { background: linear-gradient(135deg, #e8f4f1, #f6fbfa 45%, #e5f1f6); color: #0f2b3d; border: 1.5px solid #0f2b3d; border-radius: 8px; padding: 1.3rem 1.5rem 1.1rem; position: relative; font-family: var(--font-ui); max-width: 760px; box-shadow: 0 10px 30px rgba(15,43,61,.12); overflow: hidden; }
.chq::before { content: ""; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 85% 120%, transparent 0 9px, rgba(11,110,95,.07) 9px 10px); pointer-events: none; }
.chq > * { position: relative; }
.chq-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; font-size: .85rem; }
.chq-bank { font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; }
.chq-date { text-align: right; }
.chq-date span { font-family: var(--font-num); font-weight: 600; display: block; border-bottom: 1.5px solid #0f2b3d; padding: 0 .4rem; min-width: 130px; }
.chq-row { display: flex; align-items: flex-end; gap: .6rem; margin-top: 1rem; }
.chq-row .k { font-size: .75rem; font-weight: 700; white-space: nowrap; padding-bottom: .15rem; }
.chq-row .v { flex: 1; border-bottom: 1.5px solid #0f2b3d; min-height: 1.9rem; font-family: var(--font-words); font-size: 1.2rem; padding: 0 .3rem; overflow-wrap: anywhere; }
.chq-words { min-height: 3.4rem; line-height: 1.35; }
.chq-amt { border: 2px solid #0f2b3d; font-family: var(--font-num); font-weight: 700; padding: .3rem .8rem; min-width: 150px; text-align: right; background: rgba(255,255,255,.6); font-size: 1.15rem; }
.chq-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 1.1rem; gap: 1rem; }
.chq-memo { flex: 1; max-width: 300px; }
.chq-sign { width: 220px; border-top: 1.5px solid #0f2b3d; text-align: center; font-size: .75rem; padding-top: .2rem; }
.chq-micr { margin-top: .8rem; font-family: var(--font-num); letter-spacing: .25em; font-size: .85rem; opacity: .7; }

/* history list */
.hist { list-style: none; padding: 0; margin: 1rem 0; max-width: none; border-top: 1px solid var(--ink); }
.hist li { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .9rem .2rem; border-bottom: 1px solid var(--line); margin: 0; }
.hist .in { font-family: var(--font-num); font-weight: 700; }
.hist .out { font-family: var(--font-words); font-size: 1.1rem; grid-column: 1; overflow-wrap: anywhere; }
.hist .meta { font-size: .8rem; color: var(--ink-2); }
.hist .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: .4rem; align-items: flex-start; }
.tag { display: inline-block; background: var(--brand-wash); color: var(--brand-ink); font-size: .74rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; margin-right: .4rem; }
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--ink-2); border: 1.5px dashed var(--line); border-radius: 10px; }

@media (max-width: 700px) {
  .cheque { padding: .9rem; margin-right: 5px; box-shadow: 4px 4px 0 var(--brand-wash), 4px 4px 0 1.5px var(--line); }
  .cheque-top { margin-bottom: .8rem; gap: .6rem; }
  .cheque-top p { display: none; }
  .amount-box { min-height: 56px; flex-basis: 100%; }
  .amount-box input { min-height: 48px; }
  .pay-line { margin-top: .9rem; }
  .words-out { min-height: 2.8rem; font-size: 1.35rem; }
  .btn-row .btn { flex: 1 1 calc(50% - .5rem); justify-content: center; }
  .chips { gap: .4rem; }
  .chq { padding: 1rem; }
  .chq-row { flex-wrap: wrap; }
  .chq-amt { width: 100%; text-align: left; }
  .chq-head { flex-direction: column; }
  .chq-date { text-align: left; }
  .panel { padding: .9rem; }
  .stat b { font-size: 1.1rem; }
}
@media (max-width: 820px) {
  .tool-split { grid-template-columns: 1fr; }
  .words-out { padding-right: 0; }
  .stamp { position: static; display: table; margin-top: .8rem; }
  .denom { grid-template-columns: 70px 14px 1fr 1fr 28px; gap: .3rem; }
  .chq-foot { flex-direction: column; align-items: stretch; }
  .chq-sign { width: 100%; }
}
