/* Colours are tokens; dark mode swaps them. Same palette as the audit itself. */
:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #0e2a47;
  --muted: #5b6b7c;
  --line: #ddd7c8;
  --teal: #1a8fa8;
  --teal-soft: #d6eef3;
  --orange: #c2521c;
  --gold: #c99a2e;
  --navy: #0e2a47;
  --track: #e9e4d8;
  --danger: #b3261e;
  --btn-ink: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1d31;
    --card: #10283f;
    --ink: #eef3f7;
    --muted: #9db0c2;
    --line: #26425c;
    --teal: #46b6cc;
    --teal-soft: #14424f;
    --orange: #e8804a;
    --gold: #e0b04e;
    --navy: #7f9db8;
    --track: #1b3a54;
    --danger: #ff8a80;
    --btn-ink: #06202e;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Kannada', sans-serif;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}
.sub {
  color: var(--muted);
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.loading {
  text-align: center;
  color: var(--muted);
  margin-top: 30vh;
}

/* buttons and inputs */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  min-height: 44px;
  cursor: pointer;
}
.btn.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--btn-ink);
}
.btn:hover {
  filter: brightness(1.05);
}
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
input[type='text'],
input[type='password'],
input[type='search'] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.error {
  color: var(--danger);
  font-weight: 600;
  margin: 0.5rem 0;
}

/* sign in */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login-card {
  width: min(100%, 380px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  display: grid;
  gap: 0.35rem;
}
.login-card h1 {
  font-size: 1.35rem;
}
.login-card label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}
.login-card .btn {
  margin-top: 1rem;
}

/* the dashboard */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
}
.top h1 {
  font-size: 1.4rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.banner {
  background: var(--card);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.tile,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.tile b {
  display: block;
  font-size: 1.7rem;
  line-height: 1.15;
  margin-top: 0.15rem;
}
.tile span {
  color: var(--muted);
  font-size: 0.85rem;
}
h2 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.75rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 0.75rem;
}
.card h3 {
  font-size: 1rem;
}

/* bar graphs */
.bars {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.bars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.75rem;
  align-items: center;
  font-size: 0.9rem;
}
.bars .track {
  grid-column: 1 / -1;
  order: 3;
  height: 12px;
  background: var(--track);
  border-radius: 6px;
  overflow: hidden;
}
.bars .fill {
  display: block;
  height: 100%;
  min-width: 0;
  background: var(--teal);
  border-radius: 6px;
}
.bars .val {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* where the money goes */
.stack {
  display: flex;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--track);
  margin: 0.75rem 0;
}
.stack i {
  display: block;
  height: 100%;
}
.legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.4rem 1rem;
  font-size: 0.9rem;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.legend .sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}
.legend b {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.c0 {
  background: var(--teal);
}
.c1 {
  background: var(--orange);
}
.c2 {
  background: var(--navy);
}
.c3 {
  background: var(--gold);
}

/* audits over time */
.cols {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 110px;
  margin-top: 0.75rem;
}
.cols span {
  flex: 1;
  min-height: 2px;
  background: var(--teal);
  border-radius: 3px 3px 0 0;
}
.cols span.zero {
  background: var(--track);
}
.axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.3rem;
}

/* the submissions */
.find {
  max-width: 420px;
  margin-bottom: 0.75rem;
}
.subs {
  display: grid;
  gap: 0.5rem;
}
.sub-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.sub-item summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 1rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
}
.sub-item summary::-webkit-details-marker {
  display: none;
}
.sub-item .who {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.sub-item .when,
.sub-item .meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.sub-item .amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.sub-item .meta {
  text-align: right;
}
.sub-item[open] summary {
  border-bottom: 1px solid var(--line);
}
.sub-item dl {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
  gap: 0.4rem 1rem;
  font-size: 0.9rem;
}
.sub-item dt {
  color: var(--muted);
}
.sub-item dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.more {
  margin-top: 0.75rem;
}
.empty {
  color: var(--muted);
  padding: 1.5rem 0;
}
.foot {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 2rem 0 1rem;
}

@media (max-width: 560px) {
  .sub-item dl {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
  .sub-item dd {
    margin-bottom: 0.5rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .bars .fill,
  .stack i,
  .cols span {
    transition: width 500ms ease, height 500ms ease;
  }
}

/* the team page (admin only) */
.team {
  margin-bottom: 1rem;
}
.team h3.add {
  margin-top: 1.25rem;
}
.members {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.members li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.members .who {
  font-weight: 700;
  min-width: 6ch;
}
.members .when {
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: auto;
}
.btn.small {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}
.btn.danger {
  color: var(--danger);
  border-color: var(--danger);
}
.team-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.6rem;
}
.team-form label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
.note {
  margin: 0.75rem 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.note:empty {
  display: none;
}
.note.bad {
  color: var(--danger);
}
