/* allas.lk: quiet Material-style shell, with one loud idea: every report is a receipt. */

:root {
  --bg: #ffffff;
  --surface: #f3f4f6;
  --paper: #ffffff;
  --ink: #1f2328;
  --muted: #5f6368;
  --line: #dfe1e5;
  --accent: #0b57d0;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --paid: #b3261e;
  --paid-soft: #fce8e6;
  --refused: #146c2e;
  --refused-soft: #e6f4ea;
  --honest: #7a5900;
  --honest-soft: #fdf3d6;
  --shadow: 0 1px 2px rgba(60, 64, 67, .18), 0 1px 3px 1px rgba(60, 64, 67, .08);
  --radius: 12px;
  --font: Roboto, "Google Sans Text", "Noto Sans Sinhala", "Iskoola Pota", "Sinhala Sangam MN", "Noto Sans Tamil", "Latha", "Tamil Sangam MN", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Noto Sans Sinhala", "Iskoola Pota", "Noto Sans Tamil", "Latha", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416; --surface: #1d1f22; --paper: #24272b; --ink: #e8eaed; --muted: #a8adb4; --line: #3a3d42;
    --accent: #a8c7fa; --accent-ink: #062e6f; --accent-soft: #1f2d45;
    --paid: #f2b8b5; --paid-soft: #3d2120; --refused: #8fd6a3; --refused-soft: #1a3324; --honest: #f0c96b; --honest-soft: #3a2f12;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131416; --surface: #1d1f22; --paper: #24272b; --ink: #e8eaed; --muted: #a8adb4; --line: #3a3d42;
  --accent: #a8c7fa; --accent-ink: #062e6f; --accent-soft: #1f2d45;
  --paid: #f2b8b5; --paid-soft: #3d2120; --refused: #8fd6a3; --refused-soft: #1a3324; --honest: #f0c96b; --honest-soft: #3a2f12;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font); display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:lang(si) body { font-family: "Noto Sans Sinhala", var(--font); line-height: 1.7; }
:lang(ta) body { font-family: "Noto Sans Tamil", var(--font); line-height: 1.7; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.9rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
main { flex: 1; padding: 28px 0 128px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 1.3rem; letter-spacing: -0.03em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .tld { color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 20px; font-size: .95rem; white-space: nowrap; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); font-weight: 600; }
.spacer { flex: 1; }
.langs { display: flex; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.langs button { border: 0; background: none; color: var(--muted); padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.icon-btn { border: 0; background: none; color: var(--muted); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }
@media (max-width: 820px) {
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 12px 14px; margin: 0; }
  .nav.open { display: flex; }
  .menu-btn { display: grid; }
}
@media (max-width: 420px) { .brand .tld { display: none; } .langs button { padding: 6px 8px; } }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 22px;
  border-radius: 22px; border: 1px solid var(--line); background: var(--bg); color: var(--accent);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  display: inline-flex; min-height: 56px; padding: 14px 22px; font-size: 1.05rem; border-radius: 999px;
  background: #0b57d0; border-color: #0b57d0; color: #fff;
  box-shadow: 0 10px 24px rgba(11, 87, 208, .42);
}
.fab:hover { background: #0842a0; filter: none; }
body[data-page="report"] .fab, body[data-page="admin"] .fab { display: none; }

label { display: block; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 20px; }
.hint { color: var(--muted); font-size: .875rem; margin-top: 6px; }
input[type=text], input[type=email], input[type=number], input[type=month], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--accent); }

/* segmented choice used for type, sector, fee relation */
.choices { display: grid; gap: 10px; }
.choices.cols-3 { grid-template-columns: repeat(3, 1fr); }
.choices.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) { .choices.cols-3, .choices.cols-2 { grid-template-columns: 1fr; } }
.one-form .choices { grid-template-columns: 1fr; }
.one-form .choices.pair { grid-template-columns: 1fr 1fr; }
.one-form > fieldset { margin-bottom: 18px; }
.one-form .choice span { min-height: 56px; display: flex; flex-direction: column; justify-content: center; font-size: 1.05rem; }
@media (max-width: 560px) {
  .choices.pair, .one-form .choices.pair { grid-template-columns: 1fr 1fr; }
  .choices.pair .choice span { min-height: 48px; padding: 10px 8px; }
}
.lkr-row { display: flex; align-items: center; gap: 10px; }
.when-row { display: grid; grid-template-columns: 1.4fr .75fr; gap: 10px; }
.when-row select { min-height: 48px; font-size: 1.05rem; }
.lkr-row .prefix { font-weight: 700; font-size: 1.15rem; color: var(--muted); }
.amount-lg { font-size: 2rem; font-weight: 750; min-height: 72px; letter-spacing: -0.03em; }
.amount-field label { font-size: 1.05rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: block; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; font-weight: 500; height: 100%; }
.choice span small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice.paid input:checked + span { border-color: var(--paid); background: var(--paid-soft); box-shadow: inset 0 0 0 1px var(--paid); }
.choice.refused input:checked + span { border-color: var(--refused); background: var(--refused-soft); box-shadow: inset 0 0 0 1px var(--refused); }
.choice.honest input:checked + span { border-color: var(--honest); background: var(--honest-soft); box-shadow: inset 0 0 0 1px var(--honest); }
.choice.bribe input:checked + span { border-color: var(--paid); background: var(--paid-soft); box-shadow: inset 0 0 0 1px var(--paid); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: .82rem; color: var(--muted); background: var(--bg); line-height: 1.4;
}
button.chip { cursor: pointer; font: inherit; font-size: .85rem; padding: 6px 12px; }
button.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.chip.trust { color: var(--accent); border-color: currentColor; }
.chip.trust.filled { background: var(--accent); color: var(--accent-ink); }
.chip.sample { border-style: dashed; }

.notice { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; font-size: .92rem; }
.notice.warn { background: var(--honest-soft); }
.notice.error { background: var(--paid-soft); color: var(--paid); }
.notice.ok { background: var(--refused-soft); }

/* ---------- the receipt ---------- */
.receipt {
  --edge: 10px;
  position: relative; background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: .9rem; line-height: 1.5;
  padding: 18px 18px calc(18px + var(--edge));
  border: 1px solid var(--line); border-bottom: 0;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--edge) * 2) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(var(--edge) * 2) 100%;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.06));
}
.receipt + .receipt { margin-top: 0; }
.receipt .r-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.receipt .stamp {
  font-family: var(--font); font-weight: 700; font-size: .8rem; letter-spacing: .02em;
  border: 2px solid currentColor; border-radius: 6px; padding: 2px 8px; transform: rotate(-2deg); display: inline-block;
}
.receipt.paid .stamp { color: var(--paid); }
.receipt.refused .stamp { color: var(--refused); }
.receipt.honest .stamp { color: var(--honest); }
.receipt .amount { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0; }
.receipt.refused .amount { color: var(--refused); }
.receipt.honest .amount { color: var(--honest); }
.receipt .row { display: flex; justify-content: space-between; gap: 12px; }
.receipt .row span:last-child { text-align: right; }
.receipt .dots { border-top: 1px dashed var(--line); margin: 10px 0; }
.receipt .fee { color: var(--muted); }
.receipt .fee strong { color: var(--paid); font-weight: 600; }
.receipt .story { font-family: var(--font); font-size: .97rem; line-height: 1.6; margin: 6px 0 8px; white-space: pre-line; }
.receipt .tr-note { font-family: var(--font); font-size: .8rem; color: var(--muted); }
.receipt .tr-note button { border: 0; background: none; color: var(--accent); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.receipt .foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 8px; }
.receipt .meta { font-family: var(--font); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.receipt a.cover { position: absolute; inset: 0; z-index: 1; }
.receipt .meta button, .receipt .meta a:not(.cover) { position: relative; z-index: 2; }
.receipt .meta .btn.same { margin-left: auto; }
.receipt .meta .btn.same .n { margin-left: 6px; font-variant-numeric: tabular-nums; }
a.receipt-link { text-decoration: none; color: inherit; display: block; }

.feed { display: grid; gap: 22px; }
@media (min-width: 760px) { .feed.two { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- home ---------- */
.hero {
  display: grid; gap: 32px; align-items: center; padding: 22px 18px 32px; border-radius: 28px;
  background:
    radial-gradient(520px 200px at 0% 0%, #d2e3fc 0%, transparent 70%),
    radial-gradient(420px 180px at 100% 0%, #fce8e6 0%, transparent 68%),
    radial-gradient(380px 160px at 70% 120%, #e6f4ea 0%, transparent 70%);
}
@media (min-width: 860px) { .hero { grid-template-columns: 1.15fr .85fr; gap: 56px; padding: 32px 0 56px; } }
.hero h1 { max-width: 14ch; }
.hero .lede { font-size: 1.12rem; color: var(--muted); max-width: 46ch; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero .slip { max-width: 360px; width: 100%; justify-self: center; transform: rotate(1.2deg); }
.hero .slip .receipt { box-shadow: none; }
.slip-title { text-align: center; font-weight: 600; letter-spacing: .08em; }
.section { padding: 36px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.three { display: grid; gap: 24px; }
@media (min-width: 760px) { .three { grid-template-columns: repeat(3, 1fr); } }
.three h3 { margin-bottom: .3em; }

.how-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 10px; }
.how-ico svg { width: 22px; height: 22px; }
.how-1 { background: #E8F0FE; }
.how-2 { background: #FCE8E6; }
.how-3 { background: #E6F4EA; }
:root[data-theme="dark"] .how-1, :root:not([data-theme="light"]) .how-1 { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .how-1 { background: #1f2d45; }
  :root:not([data-theme="light"]) .how-2 { background: #3d2120; }
  :root:not([data-theme="light"]) .how-3 { background: #1a3324; }
}
:root[data-theme="dark"] .how-1 { background: #1f2d45; }
:root[data-theme="dark"] .how-2 { background: #3d2120; }
:root[data-theme="dark"] .how-3 { background: #1a3324; }
:root[data-theme="dark"] .hero, :root:not([data-theme="light"]) .hero { }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero {
    background:
      radial-gradient(520px 200px at 0% 0%, #1c3a6e 0%, transparent 70%),
      radial-gradient(420px 180px at 100% 0%, #4a2422 0%, transparent 68%),
      radial-gradient(380px 160px at 70% 120%, #1a3324 0%, transparent 70%);
  }
}
:root[data-theme="dark"] .hero {
  background:
    radial-gradient(520px 200px at 0% 0%, #1c3a6e 0%, transparent 70%),
    radial-gradient(420px 180px at 100% 0%, #4a2422 0%, transparent 68%),
    radial-gradient(380px 160px at 70% 120%, #1a3324 0%, transparent 70%);
}

.three p { color: var(--muted); margin: 0; }
.disclaimer { border-left: 3px solid var(--honest); padding: 4px 0 4px 14px; color: var(--muted); font-size: .93rem; max-width: 70ch; }

/* ---------- browse ---------- */
.filters { display: grid; gap: 10px; margin-bottom: 22px; }
.filters .row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.result-line { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty p { max-width: 40ch; margin: 0 auto 16px; }

/* ---------- report form ---------- */
.steps { display: flex; gap: 6px; margin: 0 0 24px; padding: 0; list-style: none; }
.steps li { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps li.on { background: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 1.25rem; font-weight: 650; margin-bottom: 16px; padding: 0; }
.form-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }
.counter { text-align: right; }
.pii-warn { color: var(--paid); font-size: .875rem; margin-top: 6px; }
.done { text-align: center; }
.done .receipt { max-width: 340px; margin: 24px auto; text-align: left; }
.code { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; letter-spacing: .06em; text-align: center; }

/* ---------- report detail ---------- */
.detail .receipt { font-size: .97rem; }
.detail .receipt .amount { font-size: 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.btn.voted { background: var(--accent-soft); border-color: var(--accent); }
.share { margin: 18px 0 8px; }
.share h2 { margin: 0 0 8px; font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-ico {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  display: inline-grid; place-items: center; text-decoration: none; cursor: pointer;
}
.share-ico:hover { background: var(--surface); color: var(--ink); }
.share-ico svg { width: 18px; height: 18px; }
details.flag summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
details.flag .chips { margin-top: 10px; }

/* ---------- insights ---------- */
.stat-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 28px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 1.7rem; letter-spacing: -0.02em; font-weight: 650; }
.stat span { color: var(--muted); font-size: .9rem; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .92rem; }
.bar .track { height: 12px; background: var(--surface); border-radius: 6px; overflow: hidden; display: flex; }
.bar .track i { display: block; height: 100%; }
.bar .track i.paid { background: var(--paid); }
.bar .track i.refused { background: var(--refused); }
.bar .track i.honest { background: var(--honest); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.trend svg { width: 100%; height: auto; display: block; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ---------- prose pages ---------- */
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.q-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; background: var(--bg); }
.q-grid { display: grid; gap: 14px; }
@media (min-width: 900px) { .q-grid { grid-template-columns: 1fr 1fr; } }
.q-item pre { white-space: pre-wrap; font: inherit; background: var(--surface); padding: 10px; border-radius: 8px; margin: 0; min-height: 60px; }
.q-item mark { background: var(--paid-soft); color: var(--paid); }
.q-item textarea { min-height: 90px; }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .9rem; }
footer.site .cols { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer.site a { color: var(--muted); }
footer.site .joke { margin-top: 14px; font-style: italic; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 8px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .hero .slip { transform: none; } }
.sr:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: var(--bg); padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow); }
