/* ===========================================================
   Forenings-regnskab — designsystem
   Stemning: en rigtig regnskabsbog. Se DESIGN.md.
   =========================================================== */

:root {
  --paper: #f6f1e6;
  --paper-raised: #fffdf8;
  --ink: #221f1a;
  --ink-soft: #524b3e;
  --forest: #2b4636;
  --forest-dark: #1c3025;
  --forest-tint: #e4ebe4;
  --terracotta: #b5502d;
  --terracotta-dark: #8f3d21;
  --terracotta-tint: #f4e2da;
  --brass: #c0973e;
  --brass-tint: #f2e6c9;
  --line: #d8cfba;
  --line-strong: #b7ab8d;
  --danger: #a3312a;
  --danger-tint: #f4dcd9;
  --ok: #2f6a45;
  --ok-tint: #dde9de;

  --wash-brass: rgba(192, 151, 62, 0.34);
  --wash-forest: rgba(43, 70, 54, 0.32);
  --wash-terracotta: rgba(181, 66, 40, 0.30);

  --font-display: "Fraunces", "Noto Serif Ethiopic", Georgia, serif;
  --font-body: "Source Sans 3", "Noto Sans Ethiopic", "Segoe UI", sans-serif;
  --font-text: "Source Sans 3", "Noto Sans Ethiopic", "Segoe UI", sans-serif;

  --radius: 3px;
  --shadow-sm: 0 1px 2px rgba(34, 31, 26, 0.08);
  --shadow-md: 0 4px 16px rgba(34, 31, 26, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 35px,
      rgba(183, 171, 141, 0.3) 35px,
      rgba(183, 171, 141, 0.3) 36px
    ),
    radial-gradient(85% 55% at 6% -4%, var(--wash-forest), transparent 68%),
    radial-gradient(70% 46% at 52% 36%, var(--wash-brass), transparent 66%),
    radial-gradient(90% 58% at 96% 102%, var(--wash-terracotta), transparent 66%),
    var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--forest-dark);
  letter-spacing: -0.01em;
  margin: 0 0 0.4em 0;
}

h1 { font-size: 2.15rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em 0; color: var(--ink-soft); }

a { color: var(--terracotta-dark); }

/* ---------- layout scaffolding ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--forest);
  color: var(--paper);
  padding: 0.85rem 1.5rem;
  box-shadow: var(--shadow-md);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand .seal {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--brass);
  flex: none;
}

.flag-icon {
  flex: none;
  display: block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.topbar .flag-icon {
  width: 24px;
  height: 12px;
}

nav.mainnav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

nav.mainnav a {
  color: var(--paper);
  text-decoration: none;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  opacity: 0.82;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

nav.mainnav a:hover,
nav.mainnav a:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

nav.mainnav a.active {
  background: var(--brass);
  color: var(--forest-dark);
  opacity: 1;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--paper);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: background-color 0.15s ease;
}
.btn-logout:hover { background: rgba(255,255,255,0.15); }

.hamburger {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font-size: 1.1rem;
  cursor: pointer;
}

main.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--line-strong);
}

.page-head .eyebrow {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--terracotta-dark);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

/* ---------- cards / panels ---------- */

.panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fade-in 0.4s ease forwards;
}

.panel + .panel { animation-delay: 0.05s; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ---------- stat tiles (dashboard) ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-tile {
  background: var(--forest);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.stat-tile::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 110px;
  height: 110px;
  border: 18px solid rgba(192, 151, 62, 0.18);
  border-radius: 50%;
}

.stat-tile .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
  margin-bottom: 0.4rem;
}

.stat-tile .value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
}

.stat-tile.accent { background: var(--terracotta); }
.stat-tile.accent::after { border-color: rgba(255,255,255,0.18); }

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.shortcut-card {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--terracotta);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shortcut-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.shortcut-card h3 { margin-bottom: 0.3rem; color: var(--forest-dark); }
.shortcut-card p { margin: 0; font-size: 0.9rem; }

/* ---------- forms ---------- */

.field {
  margin-bottom: 1.1rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--forest-dark);
  margin-bottom: 0.35rem;
}

.field .hint {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  width: 100%;
  font-family: var(--font-text);
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; min-height: 4.5rem; }

input[readonly] {
  background: var(--paper);
  color: var(--ink-soft);
  cursor: default;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 1px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 1.25rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--forest);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--forest-dark); }

.btn-accent {
  background: var(--terracotta);
  color: #fff;
}
.btn-accent:hover { background: var(--terracotta-dark); }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--forest-tint); border-color: var(--forest); }

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-tint); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 560px;
}

thead th {
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--forest-dark);
  background: var(--forest-tint);
  padding: 0.7rem 0.8rem;
  border-bottom: 2px solid var(--line-strong);
  white-space: nowrap;
}

tbody td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--brass-tint); }

tfoot td {
  padding: 0.8rem;
  font-weight: 700;
  border-top: 2px solid var(--line-strong);
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--forest-dark);
}

.col-num { text-align: right; font-variant-numeric: tabular-nums; }

/* collection ledger table specifics */
.ledger-table input[type="text"],
.ledger-table input[type="number"] {
  padding: 0.45rem 0.5rem;
  font-size: 0.92rem;
}
.ledger-table td.row-nr {
  font-family: var(--font-display);
  color: var(--terracotta-dark);
  font-weight: 600;
  text-align: center;
  width: 2.5rem;
}
.ledger-table td.amount-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- badges / stamps ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1.5px solid transparent;
}

.badge-ok { background: var(--ok-tint); color: var(--ok); border-color: var(--ok); }
.badge-off { background: var(--danger-tint); color: var(--danger); border-color: var(--danger); }
.badge-info { background: var(--brass-tint); color: #7a5c1e; border-color: var(--brass); }

.seal-stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--brass);
  color: var(--brass);
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  transform: rotate(-3deg);
}

.seal-stamp .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
}

/* ---------- misc ---------- */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
}

.empty-state h3 { color: var(--ink-soft); }

.error-banner {
  background: var(--danger-tint);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  display: none;
}

.error-banner.visible { display: block; }

.filters-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.filters-row .field { margin-bottom: 0; min-width: 160px; }

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  flex-wrap: wrap;
}

.history-item:hover { background: var(--brass-tint); }

.history-item .type-flag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius);
}

.type-flag.betaling { background: var(--forest-tint); color: var(--forest-dark); }
.type-flag.indsamling { background: var(--terracotta-tint); color: var(--terracotta-dark); }

.history-item .meta { flex: 1; min-width: 200px; }
.history-item .amount { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--forest-dark); }

.tigrinya-field {
  font-family: "Noto Sans Ethiopic", var(--font-text);
}

/* ---------- read-only document meta (indsamling.html stamoplysninger) ---------- */

.page-head .doc-subtitle {
  display: block;
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}

.doc-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.1rem 1.75rem;
}

.doc-meta .meta-item .meta-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta-dark);
  margin-bottom: 0.3rem;
}

.doc-meta .meta-item .meta-value {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- economy breakdown (okonomi.html) ---------- */

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.breakdown-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 5px solid var(--forest);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.breakdown-card.indsamling { border-left-color: var(--terracotta); }

.breakdown-card h3 { margin-bottom: 0.75rem; }

.breakdown-list { margin: 0; }
.breakdown-list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.breakdown-list > div:last-child { border-bottom: none; }
.breakdown-list dt { color: var(--ink-soft); font-size: 0.88rem; margin: 0; }
.breakdown-list dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--forest-dark);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* overskud/underskud colour-coding, reused wherever a net result figure
   is shown outside .net-summary (resultatopgørelse row, breakdown netto) */
#resOverskud.positive,
.breakdown-list dd.positive { color: var(--ok); }
#resOverskud.negative,
.breakdown-list dd.negative { color: var(--danger); }

/* ---------- month bar chart (okonomi.html) ---------- */

.chart-legend {
  display: flex;
  gap: 1.1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.chart-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.35rem;
}
.swatch-income { background: var(--forest); }
.swatch-expense { background: var(--terracotta); }

.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  overflow-x: auto;
  padding-top: 1rem;
}

.month-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 46px;
  flex: 1;
}

.bar-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 150px;
  width: 100%;
  border-bottom: 2px solid var(--line-strong);
}

.bar {
  width: 40%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
}
.bar-income { background: var(--forest); }
.bar-expense { background: var(--terracotta); }

.month-label {
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: lowercase;
  white-space: nowrap;
}

/* ---------- kontingent period grid (medlem.html) ---------- */

.kontingent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.75rem;
}

.kontingent-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.8rem 0.5rem;
  border-radius: var(--radius);
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-soft);
}

.kontingent-cell .period-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kontingent-cell .period-mark {
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.kontingent-cell.paid {
  border-style: solid;
  border-color: var(--brass);
  background: var(--brass-tint);
  color: #7a5c1e;
  transform: rotate(-1.5deg);
}

.kontingent-cell.paid .period-mark {
  color: var(--brass);
  font-weight: 700;
}

/* ---------- net result summary (indsamling.html) ---------- */

.net-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.net-summary .net-item {
  flex: 1 1 190px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.net-summary .net-item .label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.net-summary .net-item .value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.net-summary .net-item .value.positive { color: var(--ok); }
.net-summary .net-item .value.negative { color: var(--danger); }

/* the result tile (overskud/underskud) is the visual destination of the row —
   it gets a colour-matched tint + border once its sign is known, on top of
   the value text itself being green/red */
.net-summary .net-item.positive {
  background: var(--ok-tint);
  border-color: var(--ok);
}
.net-summary .net-item.negative {
  background: var(--danger-tint);
  border-color: var(--danger);
}

/* ---------- login page ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-top: 6px solid var(--forest);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.25rem 2rem;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.login-brand .seal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2.5px solid var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--brass);
}

.login-brand h1 { font-size: 1.4rem; margin-bottom: 0; }
.login-brand span { color: var(--ink-soft); font-size: 0.88rem; }
.login-brand .flag-icon { width: 44px; height: 22px; }

/* ---------- responsive ---------- */

@media (max-width: 780px) {
  nav.mainnav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--forest-dark);
    flex-direction: column;
    padding: 0.5rem;
    display: none;
    box-shadow: var(--shadow-md);
  }
  nav.mainnav.open { display: flex; }
  .hamburger { display: inline-flex; }
  main.container { padding: 1.25rem 1rem 3rem; }
  .page-head { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 1.6rem; }
}
