:root {
  --bg: #fbfaf5;
  --fg: #1c1b19;
  --muted: #6b675f;
  --line: #d9d5ca;
  --link: #1f4db5;
  --red: #a3311b;
  --bar: #1c1b19;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --fg: #dedbd3;
    --muted: #96918a;
    --line: #34332f;
    --link: #8fb1f0;
    --red: #e0805f;
    --bar: #cfcbc2;
  }
}

* { box-sizing: border-box; }

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.2rem 5rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.55 Gelasio, Georgia, serif;
}

[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

a, .linkish { color: var(--link); }
a:visited { color: var(--link); }

.linkish {
  background: none; border: 0; padding: 0;
  font: inherit; text-decoration: underline; cursor: pointer;
}

.muted { color: var(--muted); }
.err { color: var(--red); margin: .4rem 0 0; }
.err:empty { display: none; }

.num, td, .facts, .bar { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- kopf */

.top {
  display: flex; align-items: center; gap: 1rem;
  border-bottom: 1px solid var(--fg);
  padding-bottom: .4rem;
  margin-bottom: 1.8rem;
}
h1 { flex: 1; margin: 0; font-size: 1.5rem; font-weight: 600; }

/* -------------------------------------------------------------- design-wahl */

.era { position: relative; }
.era summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-size: .85rem;
  padding: .15rem .55rem;
  border: 1px solid var(--fg);
  border-radius: 2px;
  white-space: nowrap;
}
.era summary::-webkit-details-marker { display: none; }
.era summary::after { content: " ▾"; }
.era[open] summary::after { content: " ▴"; }
.era__menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20;
  display: flex; flex-direction: column;
  min-width: 12rem;
  padding: .25rem 0;
  background: var(--bg);
  border: 1px solid var(--fg);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
}
.era .era__opt {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .35rem .8rem;
  background: none; border: 0; border-radius: 0;
  color: var(--fg);
  font: inherit; font-size: .92rem; text-align: left;
  cursor: pointer;
}
.era .era__opt small { color: var(--muted); }
.era .era__opt:hover { background: var(--line); }
.era .era__opt[aria-pressed="true"] { font-weight: 700; }
.era .era__opt[aria-pressed="true"]::before { content: "✓ "; }
.era .era__opt[aria-pressed="false"]::before { content: "✓ "; visibility: hidden; }

.foot { margin-top: 3rem; font-size: .8rem; color: var(--muted); text-align: center; }.top nav { display: flex; gap: 1rem; font-size: .95rem; }

h2 {
  margin: 2.8rem 0 .8rem;
  font-size: 1.05rem; font-weight: 600;
}

/* -------------------------------------------------------------- formulare */

input, select, textarea, button {
  font: inherit;
  font-size: .95rem;
  color: var(--fg);
}
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 2px;
  padding: .25rem .35rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; }
button:not(.linkish) {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 2px;
  padding: .28rem .9rem;
  cursor: pointer;
}
button:not(.linkish):hover { background: var(--link); border-color: var(--link); }
button[disabled] { opacity: .5; }

.gate { display: flex; flex-wrap: wrap; gap: .5rem; }

.inline { margin: .6rem 0; display: flex; gap: .5rem; align-items: center; }
.inline input { width: 6rem; }

.ride-form {
  display: flex; flex-wrap: wrap;
  gap: .7rem 1rem;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
}
.ride-form label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .15rem; }
.ride-form input[type="date"] { min-width: 9.5rem; }
.ride-form .wide { flex: 1 1 100%; }
.ride-form .wide input, .ride-form textarea { width: 100%; }
textarea { resize: vertical; }
.form-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin: .2rem 0 0; width: 100%; }
.ride-form .err { width: 100%; }
.editing #entry-title::after { content: " (bearbeiten)"; font-weight: 400; color: var(--red); }

/* -------------------------------------------------------------- übersicht */

.summary p { margin: 0 0 .5rem; }
#year-line { font-size: 1.25rem; }

.bar {
  position: relative;
  height: 10px;
  margin: .7rem 0 .6rem !important;
  border: 1px solid var(--fg);
}
.bar span { display: block; height: 100%; width: 0; background: var(--bar); transition: width .6s ease-out; }
.bar i {
  position: absolute; top: -5px; bottom: -5px; left: 0;
  border-left: 2px solid var(--red);
}

.facts { color: var(--muted); }
.facts b { color: var(--fg); font-weight: 600; }

/* -------------------------------------------------------------- tabellen */

table { border-collapse: collapse; width: 100%; }
td, th { padding: .32rem .5rem .32rem 0; text-align: left; vertical-align: top; }
th { font-weight: 400; font-size: .85rem; color: var(--muted); border-bottom: 1px solid var(--fg); }
.r { text-align: right; }

.weeks td { padding: .12rem .6rem .12rem 0; font-size: .9rem; white-space: nowrap; }
.weeks td:first-child { width: 3.6rem; color: var(--muted); }
.weeks td:nth-child(2) { width: 100%; }
.weeks td:last-child { width: 3.5rem; text-align: right; }
.weeks .w { display: block; height: .7rem; margin-top: .35rem; background: var(--bar); min-width: 1px; }
.weeks tr.now td { color: var(--red); }
.weeks tr.now .w { background: var(--red); }
.weeks caption { caption-side: bottom; text-align: left; padding-top: .6rem; color: var(--muted); font-size: .92rem; }

.log-head { display: flex; justify-content: space-between; align-items: baseline; }
.log-head select { font-size: .85rem; padding: .1rem .2rem; }

.scroll { overflow-x: auto; }
.log { font-size: .95rem; }
.log td { border-bottom: 1px solid var(--line); }
.log tr.month td {
  padding-top: 1.4rem;
  border-bottom: 1px solid var(--fg);
  font-weight: 600;
}
.log tr.month td span { font-weight: 400; color: var(--muted); }
.log .date { white-space: nowrap; color: var(--muted); }
.log .what small { color: var(--muted); }
.log .note { display: block; font-style: italic; color: var(--muted); margin-top: .1rem; }
.log .tools { white-space: nowrap; text-align: right; font-size: .85rem; }
.log .tools button + button { margin-left: .5rem; }
.log td.empty { color: var(--muted); border: 0; padding-top: .8rem; }

@media (max-width: 560px) {
  body { font-size: 1rem; padding-top: 1.5rem; }
  .log .opt { display: none; }
}
