/* Sahakar — co-operative society ledger UI */
:root {
  --brand: #14463b;
  --accent: #b7862b;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --ink: #1c2421;
  --muted: #5d6b66;
  --rule: #dfe5e1;
  --rule-strong: #b9c4bf;
  --dr: #9b2c2c;
  --cr: #1f6b45;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --bad-bg: #fbe9e7;
  --ok-bg: #e5f2ea;
  --info-bg: #e6eef7;
  --radius: 6px;
  --font: "Hind Vadodara", "Hind", "Noto Sans Gujarati", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; max-width: 75ch; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dr { color: var(--dr); }
.cr { color: var(--cr); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 1.2rem 0; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #fff; padding: 0 0 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .org { padding: 1.1rem 1.2rem; display: flex; gap: .7rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.14); }
.side .org img { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: contain; }
.side .org .mark { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.side .org strong { display: block; font-size: .95rem; line-height: 1.25; }
.side .org span { font-size: .78rem; opacity: .75; }
.side nav { padding: .6rem 0; }
.side .grp { font-size: .78rem; opacity: .6; padding: .9rem 1.2rem .25rem; }
.side nav a { display: block; color: rgba(255,255,255,.9); text-decoration: none; padding: .38rem 1.2rem; border-left: 3px solid transparent; font-size: .95rem; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: rgba(255,255,255,.12); border-left-color: var(--accent); color: #fff; font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.6rem; background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.top .grow { flex: 1; }
.top form.gs { display: flex; gap: .4rem; flex: 1; max-width: 420px; }
.top form.gs input { flex: 1; }
.top .who { font-size: .9rem; text-align: right; line-height: 1.2; }
.top .who span { display: block; color: var(--muted); font-size: .8rem; }
.menu-btn { display: none; background: none; border: 1px solid var(--rule); border-radius: var(--radius); padding: .35rem .6rem; font-size: 1.1rem; }
.content { padding: 1.4rem 1.6rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.banner { padding: .65rem 1.6rem; font-size: .93rem; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #f0dcae; }
.banner.bad { background: var(--bad-bg); color: var(--dr); border-color: #f1c9c4; }
.banner.info { background: var(--info-bg); color: #1d4a7a; border-color: #c9d9ec; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.panel-head h2, .panel-head h3 { margin: 0; }
.grid { display: grid; gap: 1.2rem; align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Summary strip: figures separated by rules, like a register header */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 1.2rem; }
.strip > div { padding: .9rem 1.1rem; border-right: 1px solid var(--rule); }
.strip > div:last-child { border-right: 0; }
.strip .v { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip .l { color: var(--muted); font-size: .85rem; }
.strip a { text-decoration: none; color: inherit; display: block; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* ---------- Ledger tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .93rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: .5rem .6rem; border-bottom: 2px solid var(--rule-strong); white-space: nowrap; }
table.t td { padding: .45rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.t tbody tr:hover td { background: #f6f9f7; }
table.t tfoot td { font-weight: 600; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); }
table.t td.num, table.t th.num { text-align: right; }
table.t .sub td { background: #f3f6f4; font-weight: 600; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea { font: inherit; color: var(--ink); width: 100%; padding: .5rem .6rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: #fff; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.f { margin-bottom: .9rem; }
.fg { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.fg .wide { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--dr); }
.check { display: flex; gap: .5rem; align-items: center; color: var(--ink); font-size: .95rem; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-weight: 600; }
.inline { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline > * { width: auto; }
.inline .f { margin: 0; }
.amount-big { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .93rem; padding: .48rem .95rem; border-radius: var(--radius); border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.warn { background: var(--accent); border-color: var(--accent); }
.btn.danger { background: var(--dr); border-color: var(--dr); }
.btn.sm { padding: .25rem .6rem; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--cr); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--dr); }
.b-info { background: var(--info-bg); color: #1d4a7a; }
.b-muted { background: #eef0ef; color: var(--muted); }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--cr); border-color: #bfdfcb; }
.flash.err { background: var(--bad-bg); color: var(--dr); border-color: #f1c9c4; }
.flash.info { background: var(--info-bg); color: #1d4a7a; border-color: #c9d9ec; }

.tabs { display: flex; gap: .2rem; border-bottom: 2px solid var(--rule); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.pager { display: flex; gap: .3rem; align-items: center; margin-top: .8rem; flex-wrap: wrap; }
.pager a, .pager span.cur { padding: .2rem .6rem; border: 1px solid var(--rule); border-radius: 4px; text-decoration: none; }
.pager span.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .muted { margin-left: .6rem; font-size: .85rem; }

.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.months div { border: 1px solid var(--rule); border-radius: 4px; padding: .35rem .5rem; font-size: .84rem; }
.months .paid { background: var(--ok-bg); border-color: #bfdfcb; }
.months .due { background: var(--bad-bg); border-color: #f1c9c4; }
.months .part { background: var(--warn-bg); border-color: #f0dcae; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; background: var(--brand); opacity: .85; border-radius: 3px 3px 0 0; position: relative; min-height: 2px; }
.bars .b span { position: absolute; bottom: -1.4rem; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.bars-wrap { padding-bottom: 1.6rem; }

/* ---------- Auth ---------- */
body.bare { background: var(--paper); min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--rule); border-top: 5px solid var(--brand); border-radius: var(--radius); padding: 1.8rem; }
.auth-card .org { text-align: center; margin-bottom: 1.2rem; }
.auth-card .org img { max-height: 64px; }
.auth-card .org h1 { font-size: 1.25rem; margin: .5rem 0 .2rem; }

/* ---------- Public website ---------- */
.site-top { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-top .in, .site-nav .in, .site-main, .site-foot .in { max-width: 1120px; margin: 0 auto; padding: 0 1.2rem; }
.site-top .in { display: flex; align-items: center; gap: 1rem; padding-top: .9rem; padding-bottom: .9rem; }
.site-top img { height: 56px; }
.site-top .name { flex: 1; }
.site-top .name strong { display: block; font-size: 1.3rem; color: var(--brand); line-height: 1.2; }
.site-top .name span { color: var(--muted); font-size: .9rem; }
.site-nav { background: var(--brand); }
.site-nav .in { display: flex; gap: .2rem; flex-wrap: wrap; }
.site-nav a { color: #fff; text-decoration: none; padding: .65rem .85rem; font-size: .95rem; }
.site-nav a:hover, .site-nav a.on { background: rgba(255,255,255,.12); }
.site-main { padding-top: 2rem; padding-bottom: 3rem; }
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; padding: 1rem 0 2rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
.hero h1 { font-size: 2.3rem; color: var(--brand); margin-bottom: .4em; }
.hero p { font-size: 1.1rem; color: var(--muted); }
.ratecard { border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); }
.ratecard h3 { margin: 0; padding: .7rem 1rem; background: var(--brand); color: #fff; border-radius: var(--radius) var(--radius) 0 0; font-size: 1rem; }
.ratecard table { width: 100%; border-collapse: collapse; }
.ratecard td { padding: .5rem 1rem; border-bottom: 1px solid var(--rule); }
.ratecard td.num { font-weight: 700; color: var(--brand); font-size: 1.1rem; }
.ratecard tr:last-child td { border-bottom: 0; }
.notice-list { list-style: none; padding: 0; margin: 0; }
.notice-list li { padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.notice-list li .d { color: var(--muted); font-size: .85rem; }
.site-foot { background: #18201d; color: #c6d0cb; padding: 2rem 0; font-size: .92rem; }
.site-foot .in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.site-foot a { color: #fff; }
.site-foot h3 { color: #fff; }
.person { padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.person strong { display: block; }

/* ---------- Printable documents ---------- */
.doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 2rem 2.4rem; border: 1px solid var(--rule); }
.doc-head { display: flex; gap: 1rem; align-items: center; border-bottom: 3px double var(--ink); padding-bottom: .8rem; margin-bottom: 1rem; }
.doc-head img { height: 64px; }
.doc-head .t { flex: 1; text-align: center; }
.doc-head .t strong { font-size: 1.35rem; display: block; }
.doc-title { text-align: center; font-size: 1.15rem; font-weight: 700; margin: .4rem 0 1rem; letter-spacing: .02em; }
.sign-row { display: flex; justify-content: space-between; margin-top: 3.5rem; }
.sign-row div { border-top: 1px solid var(--ink); padding-top: .3rem; min-width: 170px; text-align: center; font-size: .9rem; }
.cert { border: 6px double var(--brand); padding: 2.2rem; text-align: center; }
.cert p { max-width: none; font-size: 1.08rem; line-height: 1.9; }
.print-only { display: none; }

@media print {
  .side, .top, .banner, .no-print, .page-head .actions, .site-top, .site-nav, .site-foot, .pager, .flash { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .panel, .doc { border: 0; padding: 0; }
  .print-only { display: block; }
  table.t tbody tr:hover td { background: none; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -260px; width: 248px; z-index: 20; transition: left .2s; }
  body.nav-open .side { left: 0; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-btn { display: inline-block; }
  .top { padding: .6rem 1rem; }
  .top .who { display: none; }
  .content { padding: 1rem; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
  .site-foot .in { grid-template-columns: 1fr; }
  .doc { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.auth-card .org .mark { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; }

.strip.big .v { font-size: 1.6rem; }
.strip.big { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); border-left: 4px solid var(--brand); }

/* public site: footer stays at the bottom; notices as cards */
body.site { min-height: 100vh; display: flex; flex-direction: column; }
body.site .site-main { flex: 1 0 auto; width: 100%; }
.notice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .notice-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .notice-cards { grid-template-columns: 1fr; } }
.ncard { background: #fff; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.ncard-img { display: block; background: #f1f4f2; border-bottom: 1px solid var(--rule); }
.ncard-img img { display: block; width: 100%; max-height: 380px; object-fit: contain; }
.ncard-body { padding: .9rem 1rem 1.1rem; }
.ncard-body .d { color: var(--muted); font-size: .82rem; }
.ncard-body h3 { margin: .2rem 0 .5rem; font-size: 1.08rem; }
.ncard-body p { margin: 0 0 .7rem; white-space: normal; overflow-wrap: anywhere; }
.ncard-body h3 a { color: inherit; text-decoration: none; }
.ncard-body h3 a:hover { text-decoration: underline; }
.ncard-more { font-size: .9rem; font-weight: 600; }
.ndetail { max-width: 820px; background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 1.4rem 1.6rem; }
.ndetail .d { color: var(--muted); font-size: .88rem; }
.ndetail h1 { margin: .3rem 0 1rem; }
.ndetail-img { display: block; width: 100%; max-height: 640px; object-fit: contain; background: #f1f4f2; border-radius: 8px; margin-bottom: 1rem; }
.ndetail-body { line-height: 1.7; margin-bottom: 1rem; overflow-wrap: anywhere; }
@media (max-width: 560px) { .ndetail { padding: 1rem; } }
