/* ChequeSewa - a ledger you can trust.
   Tokens: paper white, ink navy, security-print green, mono numerals. */

:root {
  --paper: #F7F6F1;
  --ink: #1C2733;
  --panel: #FFFFFF;
  --line: #E3E0D6;
  --green: #1F6E54;
  --green-deep: #14523E;
  --green-wash: #EEF4F0;
  --amber: #A65B0B;
  --red: #A33327;
  --muted: #6B7480;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--sans);
}
a { color: var(--green-deep); }
h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
code { font-family: var(--mono); background: var(--green-wash); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; }
.hint { color: var(--muted); font-size: 13px; }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.lede { max-width: 70ch; color: var(--muted); margin: 0 0 20px; }
.empty { color: var(--muted); padding: 18px 0; }

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 232px; flex: none; background: var(--ink); color: #E9EDF2;
  display: flex; flex-direction: column; padding: 20px 14px; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-family: var(--mono); font-weight: 700; font-size: 19px; color: #fff; text-decoration: none; letter-spacing: 0.01em; }
.brand span { color: #7FC7AC; }
.brand-lg { font-size: 26px; color: var(--ink); }
.brand-lg span { color: var(--green); }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  color: #C6CEd8; text-decoration: none; padding: 8px 10px; border-radius: 7px; font-size: 14px;
}
.side nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.side nav .nav-cta { color: #9FE0C4; font-weight: 600; }
.nav-group { margin-top: 14px; padding: 6px 10px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: #7C8794; }
.side-user { display: flex; align-items: center; gap: 9px; border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; }
.side-user img { width: 32px; height: 32px; border-radius: 50%; }
.side-user-meta { flex: 1; min-width: 0; }
.side-user-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta span { font-size: 11px; color: #97A1AD; }
.linklike { background: none; border: 0; color: #9FE0C4; cursor: pointer; font-size: 12px; padding: 0; text-decoration: underline; }
.main { flex: 1; padding: 26px 30px 60px; min-width: 0; }

/* ---- headers, flash ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.flash-error { background: #FBEFED; border-color: #E5B9B2; color: var(--red); }
.flash-success { background: var(--green-wash); border-color: #BCD8CB; color: var(--green-deep); }

/* ---- tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.tile-num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.tile-sub { font-size: 13px; color: var(--muted); }
.tile-warn { border-color: #E2C39B; background: #FCF6EE; }

/* ---- panels, tables ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.panel-head a { font-size: 13px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.table th.num { text-align: right; }
.table td { padding: 9px 10px; border-bottom: 1px solid #EFEDE5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.rowlink { cursor: pointer; }
.rowlink:hover td { background: #FBFAF6; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline-block; margin-left: 6px; }
.meta-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.meta-table th { text-align: left; width: 130px; color: var(--muted); font-weight: 500; padding: 7px 10px 7px 0; vertical-align: top; }
.meta-table td { padding: 7px 0; }

/* ---- status pills: rubber-stamp outlines ---- */
.pill {
  display: inline-block; padding: 1px 9px; border: 1.5px solid; border-radius: 5px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  background: transparent;
}
.pill-lg { font-size: 13px; padding: 3px 12px; transform: rotate(-2deg); }
.pill-draft { color: var(--muted); border-color: #B9BFC7; }
.pill-printed { color: #3D5A80; border-color: #9DB4CC; }
.pill-issued { color: var(--green-deep); border-color: #8FBCA9; }
.pill-cashed { color: var(--green-deep); border-color: var(--green-deep); background: var(--green-wash); }
.pill-bounced { color: var(--amber); border-color: #D8A265; }
.pill-stopped { color: var(--amber); border-color: var(--amber); }
.pill-cancelled { color: var(--red); border-color: #CE9088; }
.pill-stale { color: var(--amber); border-color: #D8A265; background: #FCF6EE; }

/* ---- buttons, forms ---- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 8px 15px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: #CFCBBD; background: #FBFAF6; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-danger { color: var(--red); border-color: #DDB4AE; }
.btn-danger:hover { background: #FBEFED; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 10px; }

.stack { display: flex; flex-direction: column; gap: 13px; }
.stack label, .cal-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
input:not([type]), select, textarea {
  font: 14px/1.4 var(--sans); padding: 8px 10px; border: 1px solid #D8D4C8; border-radius: 7px;
  background: #FFFEFB; color: var(--ink); width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9CC8B6; outline-offset: 0; border-color: var(--green); }
input.mono, textarea.mono { font-family: var(--mono); }
.amount-input { font-size: 17px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.check-lab, .radio-lab { flex-direction: column; }
.check-lab input, .radio-lab > input[type=radio] { width: auto; margin-right: 6px; }
.check-lab { flex-direction: row !important; align-items: center; font-weight: 500 !important; }
.datefield { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px 8px; margin: 0; }
.datefield legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 6px; }
.hint-row { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.hint-row .linklike { color: var(--green-deep); }
.form-actions { display: flex; gap: 14px; align-items: center; }
.filterbar { display: flex; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; }
.filterbar select, .filterbar input { width: auto; min-width: 150px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input:not([type]) { width: auto; flex: 1; min-width: 160px; }
.pager { display: flex; align-items: center; gap: 14px; padding-top: 14px; }
.pager-info { color: var(--muted); font-size: 13px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 9px; max-width: 62ch; }

/* ---- layout columns ---- */
.cols { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.grow { flex: 1 1 480px; min-width: 0; }
.narrow { flex: 0 1 340px; }
.preview-col { flex: 0 1 460px; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 0; min-width: 320px; }
.cols-form { align-items: flex-start; }

/* ---- the cheque preview: the app's identity ---- */
.cheque {
  position: relative; width: 100%; aspect-ratio: 190.5 / 88.9;
  background:
    linear-gradient(135deg, rgba(31,110,84,0.045), rgba(31,110,84,0.0) 45%),
    repeating-linear-gradient(0deg, rgba(31,110,84,0.028) 0 1px, transparent 1px 7px),
    #FEFEFB;
  border: 1px solid #CFCBBD; border-radius: 6px;
  box-shadow: 0 1px 3px rgba(28,39,51,0.10), 0 8px 22px rgba(28,39,51,0.06);
  overflow: hidden;
}
.micr-band {
  position: absolute; left: 0; right: 0; bottom: 0; height: 21.43%;
  background: repeating-linear-gradient(45deg, rgba(163,51,39,0.05) 0 6px, transparent 6px 12px);
  border-top: 1px dashed rgba(163,51,39,0.4);
  display: flex; align-items: center; justify-content: center;
}
.micr-band span { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(163,51,39,0.55); }
.pv-field {
  position: absolute; display: flex; align-items: center; overflow: hidden;
  font-family: Helvetica, Arial, sans-serif; color: #101820; white-space: nowrap;
  line-height: 1;
}
.pv-field.center { justify-content: center; }
.pv-field.right { justify-content: flex-end; }
.pv-cell { position: absolute; display: flex; align-items: center; justify-content: center; font-family: Helvetica, Arial, sans-serif; color: #101820; }
.preprint { position: absolute; color: rgba(31,110,84,0.55); font-size: 10px; pointer-events: none; }
.preprint.rule { border-bottom: 1px solid rgba(31,110,84,0.35); }
.preprint.box { border: 1px solid rgba(31,110,84,0.4); border-radius: 2px; }
.pv-acline { position: absolute; height: 0; border-top: 1.2px solid #101820; }
.preview-meta { font-size: 12.5px; color: var(--muted); margin: 8px 2px 18px; }

/* ---- designer ---- */
.designer-stage-wrap { container-type: inline-size; }
.designer-stage { background-size: 100% 100%; background-repeat: no-repeat; cursor: default; }
.dz-box {
  position: absolute; border: 1.5px solid rgba(31,110,84,0.9); background: rgba(31,110,84,0.08);
  cursor: move; border-radius: 2px;
}
.dz-box.sel { border-color: #A65B0B; background: rgba(166,91,11,0.10); z-index: 5; }
.dz-box.hidden-field { opacity: 0.35; border-style: dashed; }
.dz-label {
  position: absolute; top: -15px; left: -1px; font-size: 9px; font-weight: 700;
  color: #fff; background: rgba(31,110,84,0.9); padding: 0 5px; border-radius: 2px; white-space: nowrap;
}
.dz-box.sel .dz-label { background: #A65B0B; }
.dz-h {
  position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px;
  background: #fff; border: 1.5px solid rgba(31,110,84,0.9); cursor: nwse-resize; border-radius: 2px;
}
.props-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.props-grid label { font-size: 12px; }

/* ---- cards ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 15px 16px; }
.card-title { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.card-sub { color: var(--muted); font-size: 13px; margin: 3px 0 12px; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.card-actions form { display: inline; }

/* ---- audit trail ---- */
.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.trail li { padding-left: 14px; border-left: 2px solid var(--line); }
.trail-time { color: var(--muted); font-size: 12px; margin-right: 8px; }

/* ---- auth ---- */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 34px 32px; box-shadow: 0 10px 34px rgba(28,39,51,0.08);
}
.auth-tag { color: var(--muted); font-size: 14px; margin: 6px 0 22px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; text-transform: uppercase; letter-spacing: 0.1em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { font-size: 12.5px; color: var(--muted); margin-top: 20px; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { position: static; width: 100%; height: auto; flex-direction: column; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 18px 16px 50px; }
  .preview-col { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .pill-lg { animation: stamp 160ms ease-out; }
  @keyframes stamp { from { transform: rotate(-2deg) scale(1.12); opacity: 0.4; } to { transform: rotate(-2deg) scale(1); opacity: 1; } }
}

/* ---- public landing page ---- */
.landing-body { background: var(--paper); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px clamp(16px, 5vw, 56px); border-bottom: 1px solid var(--line); background: #FFFEFB; position: sticky; top: 0; z-index: 10; }
.topbar .brand { color: var(--ink); font-size: 21px; text-decoration: none; }
.topbar .brand span { color: var(--green); }
.brand img { height: 30px; display: block; }
.brand-lg img { height: 42px; display: inline-block; }
.topnav { display: flex; align-items: center; gap: 20px; }
.topnav a { text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; }
.topnav a.btn { color: #fff; }
.landing { max-width: 1060px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 40px; }
.landing h2 { font-size: 22px; color: var(--ink); text-transform: none; letter-spacing: -0.01em; margin: 0 0 18px; }
.hero { text-align: center; padding: 56px 0 30px; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); letter-spacing: -0.02em; margin: 0 0 8px; }
.hero-slogan { font-size: clamp(16px, 2.4vw, 20px); color: var(--green-deep); font-weight: 600; margin: 0 0 12px; }
.hero-sub { max-width: 62ch; margin: 0 auto 24px; color: var(--muted); font-size: 15.5px; }
.btn-big { font-size: 16px; padding: 12px 26px; }
.hero-leaf { max-width: 680px; margin: 40px auto 0; position: relative; }
.hero-leaf .cheque { transform: rotate(-1.2deg); }
.hl { position: absolute; font-family: Helvetica, Arial, sans-serif; color: #101820; white-space: nowrap; }
.hl-payee { left: 14%; top: 21%; font-size: clamp(8px, 1.7vw, 13px); }
.hl-words { left: 16%; top: 36%; font-size: clamp(7px, 1.5vw, 11.5px); }
.hl-words2 { left: 6%; top: 47%; font-size: clamp(7px, 1.5vw, 11.5px); }
.hl-fig { left: 72%; top: 42%; font-weight: 700; font-size: clamp(8px, 1.7vw, 13px); }
.hl-date { left: 70%; top: 8%; font-weight: 700; letter-spacing: 0.55em; font-size: clamp(8px, 1.7vw, 13px); }
.hl-cross { left: 7%; top: 8%; font-weight: 700; font-size: clamp(6px, 1.2vw, 9px); border-top: 1.4px solid #101820; border-bottom: 1.4px solid #101820; padding: 2px 6px; }
.features, .how, .contact { padding: 34px 0; border-top: 1px solid var(--line); }
.features .card-sub { margin-bottom: 0; }
.how-steps { counter-reset: n; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.how-steps li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 16px 16px 54px; position: relative; font-size: 14.5px; color: var(--muted); }
.how-steps li strong { color: var(--ink); display: block; margin-bottom: 3px; }
.how-steps li::before { counter-increment: n; content: counter(n); position: absolute; left: 15px; top: 16px; width: 27px; height: 27px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.contact-grid { display: flex; gap: 40px; flex-wrap: wrap; }
.contact-grid > div { display: flex; flex-direction: column; gap: 3px; font-size: 14.5px; }
.c-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.landing-foot { border-top: 1px solid var(--line); padding: 18px clamp(16px, 5vw, 56px); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; background: #FFFEFB; }

/* ---- settings page ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.brand-preview { display: flex; align-items: center; gap: 14px; background: var(--green-wash); border: 1px solid #BCD8CB; border-radius: 8px; padding: 8px 12px; }
.brand-preview img { max-height: 40px; max-width: 160px; }
.brand-preview .icon-preview { max-height: 26px; }
.testmail { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---- active nav item + preview notices ---- */
.side nav a.active { background: rgba(255,255,255,0.12); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.side nav .nav-cta.active { color: #C9F3E1; }
.preview-note { position: absolute; inset: 0 0 22% 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); font-size: 13.5px; }
