* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f0f0f0;
  color: #1a1a1a;
  padding: 1rem;
}
@media (prefers-color-scheme: dark) { body { background: #111; color: #f0f0f0; } }

h1 { font-size: 20px; font-weight: 500; }

.wrap { max-width: 680px; margin: 0 auto; }

.card {
  background: white;
  border-radius: 12px;
  border: 0.5px solid rgba(0,0,0,0.1);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}
@media (prefers-color-scheme: dark) { .card { background: #1c1c1c; border-color: rgba(255,255,255,0.08); } }

.sub { font-size: 12px; color: #888; margin-bottom: 2px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }

.btn-add {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; padding: 7px 14px;
  border-radius: 8px; border: 1px solid #ccc;
  background: white; cursor: pointer; text-decoration: none; color: #1a1a1a;
}
@media (prefers-color-scheme: dark) { .btn-add { background: #222; border-color: #444; color: #f0f0f0; } }

.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }
.kachel-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.mini { background: #f5f5f5; border-radius: 8px; padding: 0.6rem 0.7rem; }
@media (prefers-color-scheme: dark) { .mini { background: #2a2a2a; } }
.mini-label { font-size: 10px; color: #888; margin-bottom: 2px; }
.mini-val { font-size: 18px; font-weight: 500; line-height: 1.2; }
.mini-sub { font-size: 10px; color: #888; margin-top: 3px; line-height: 1.3; }

.bahn-label { font-size: 11px; color: #888; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.dot-red  { display: inline-block; width: 12px; height: 2.5px; background: #C0392B; border-radius: 2px; }
.dot-gray { display: inline-block; width: 12px; height: 2.5px; background: #888;    border-radius: 2px; }

.selector { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.sel-group      { flex-shrink: 0; min-width: 110px; }
.sel-group-dist { flex: 1; min-width: 120px; }
.sel-title { font-size: 11px; color: #888; margin-bottom: 7px; text-transform: uppercase; letter-spacing: .04em; }
.sel-stile { display: flex; flex-direction: column; gap: 5px; }
.sel-dists { display: flex; flex-wrap: wrap; gap: 5px; }

.divider { width: 0.5px; background: rgba(0,0,0,0.1); align-self: stretch; }
@media (prefers-color-scheme: dark) { .divider { background: rgba(255,255,255,0.08); } }

.fbtn {
  font-size: 13px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid #ddd; background: white; color: #555;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  min-height: 34px; text-align: left;
}
@media (prefers-color-scheme: dark) { .fbtn { background: #1c1c1c; border-color: #444; color: #aaa; } }
.fbtn.active { background: #e8f0fe; color: #1a56db; border-color: transparent; font-weight: 500; }
@media (prefers-color-scheme: dark) { .fbtn.active { background: #1e3a6e; color: #93c5fd; } }
.fbtn:disabled { opacity: 0.25; cursor: default; }

.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.chart-title { font-size: 14px; font-weight: 500; }
.chart-sub { font-size: 11px; color: #888; margin-bottom: 10px; }
.legend { display: flex; gap: 12px; font-size: 11px; color: #888; }
.legend span { display: flex; align-items: center; gap: 4px; }
.leg-line { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; padding: 5px 0; font-weight: 500; color: #888; font-size: 11px; }
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; }
td { padding: 7px 0; color: #1a1a1a; border-bottom: 0.5px solid rgba(0,0,0,0.07); }
@media (prefers-color-scheme: dark) { td { color: #f0f0f0; border-color: rgba(255,255,255,0.06); } }
tr:last-child td { border-bottom: none; }
.pb-star    { color: #2e7d32; }
.pb-neutral { color: #888; }

.pb-table th, .pb-table td { font-size: 11px; }
.pb-table td.dist-col  { font-size: 12px; font-weight: 500; width: 70px; }
.pb-table td.time-col  { text-align: right; font-size: 13px; font-weight: 500; width: 65px; }
.pb-table td.meta-col  { font-size: 10px; color: #888; padding-left: 4px; }
.pb-table td.border-left { border-left: 0.5px solid rgba(0,0,0,0.1); }
@media (prefers-color-scheme: dark) { .pb-table td.border-left { border-left-color: rgba(255,255,255,0.08); } }
.pb-section { font-size: 11px; font-weight: 500; color: #888; text-transform: uppercase; letter-spacing: .05em; padding: 10px 0 4px; }

.nowrap { white-space: nowrap; }

@media (max-width: 480px) {
  .kacheln { grid-template-columns: 1fr; }
}

/* ── Add form ── */

body.page-add { background: #f5f5f5; padding: 1.5rem; }
body.page-add h1 { margin-bottom: 1.5rem; }
body.page-add .card { border: none; max-width: 480px; padding: 1.25rem; }

.field { margin-bottom: 1rem; }

label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; }

input, select {
  width: 100%; padding: 10px 12px;
  border: 1px solid #ddd; border-radius: 8px;
  font-size: 15px; background: white; -webkit-appearance: none;
}
input:focus, select:focus { outline: none; border-color: #888; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

button[type=submit] {
  width: 100%; padding: 12px;
  background: #C0392B; color: white;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 500; cursor: pointer; margin-top: 0.5rem;
}
button[type=submit]:active { opacity: 0.85; }

.success { background: #e8f5e9; color: #2e7d32; padding: 12px; border-radius: 8px; margin-bottom: 1rem; font-size: 14px; }
.error   { background: #ffebee; color: #c62828; padding: 12px; border-radius: 8px; margin-bottom: 1rem; font-size: 14px; }
.back { display: block; text-align: center; margin-top: 1rem; font-size: 14px; color: #888; text-decoration: none; }
.hint { font-size: 11px; color: #999; margin-top: 4px; }
