/* Portal styling: small, hand-written, no framework and no build step. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2024;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #1f5f8b;
  --error: #b3261e;
  --ok: #1f7a44;
  --warn: #96650a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --surface: #1e2126;
    --text: #e8eaed;
    --muted: #9aa2ad;
    --line: #2c3037;
    --accent: #6fb3e0;
    --error: #f2b8b5;
    --ok: #7bd6a0;
    --warn: #e5c07b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Header ------------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 1rem; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.topbar .who span { color: var(--muted); font-size: 0.9rem; }

a { color: var(--accent); }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

/* Layout ------------------------------------------------------------------ */

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1 { font-size: 1.6rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card.narrow { max-width: 24rem; }

.muted { color: var(--muted); }
.error { color: var(--error); }

/* Content ----------------------------------------------------------------- */

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

.details { display: grid; grid-template-columns: minmax(9rem, auto) 1fr; gap: 0.4rem 1rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

/* Wide content must scroll inside its own box, never the page. */
.scroll-x { overflow-x: auto; }

/* Forms ------------------------------------------------------------------- */

label { display: block; margin: 0.75rem 0 0.25rem; font-size: 0.9rem; color: var(--muted); }

input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

button[type="submit"] {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.messages li {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 0.5rem;
}

/* Figures (headline numbers) ---------------------------------------------- */

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.figure {
  flex: 1 1 9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.figure__label { color: var(--muted); font-size: 0.8rem; }
.figure__value { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.figure--due { border-left-color: var(--error); }
.figure--credit { border-left-color: var(--ok); }

/* Tables and tags --------------------------------------------------------- */

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.small { font-size: 0.82rem; }

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.tag--ok { color: var(--ok); border-color: var(--ok); }
.tag--due { color: var(--error); border-color: var(--error); }
.tag--part { color: var(--warn); border-color: var(--warn); }

/* Inline form rows ---------------------------------------------------------- */

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.row .grow { flex: 1 1 14rem; }
.row button[type="submit"] { margin-top: 0; }

form.inline { display: inline; }
td form { display: inline; margin: 0; }

input[type="file"], input[type="date"], textarea {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* Panel --------------------------------------------------------------------- */

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
}
.subnav .strong { font-weight: 600; }
.figures.compact .figure { padding: 0.55rem 0.75rem; }
.figures.compact .figure__value { font-size: 1.05rem; }

.checkline { display: flex; align-items: center; gap: 0.5rem; margin: 0.9rem 0 0.2rem; }
.checkline label { margin: 0; color: var(--text); }
.checkline input[type="checkbox"] { width: auto; }
