:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2a6df4;
  --accent-ink: #ffffff;
  --ok: #f0f7f0;
  --notice: #fff7e6;
  --error: #fdecec;
  --error-ink: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar .user { color: var(--muted); }
.topbar a { color: var(--accent); text-decoration: none; }

main { padding: 1.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 0 auto;
  max-width: 1100px;
}
.card.narrow { max-width: 440px; }
.card.wide { max-width: 1200px; }

h1 { margin: 0 0 0.6rem; font-size: 1.4rem; }
h2 { margin: 1.4rem 0 0.5rem; font-size: 1.05rem; }

.muted { color: var(--muted); font-size: 0.9rem; }
.crumbs { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.8rem; }
.crumbs a { color: var(--accent); text-decoration: none; }

label { display: block; margin: 0.7rem 0; font-size: 0.9rem; color: var(--muted); }
input, select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
}
.row { display: flex; gap: 1rem; }
.row label { flex: 1; }

button {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
}
button.primary, .card.narrow button[type="submit"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

.actions { display: flex; gap: 0.8rem; margin: 1.2rem 0 0.5rem; }

.form-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.form-list li { margin: 0.5rem 0; }
.form-list a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: var(--ink);
}
.form-list a:hover { border-color: var(--accent); }
.form-name { font-weight: 600; }
.badge {
  font-size: 0.75rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 0.1rem 0.5rem;
}

.error { background: var(--error); color: var(--error-ink); padding: 0.6rem 0.8rem; border-radius: 8px; }
.notice { background: var(--notice); padding: 0.6rem 0.8rem; border-radius: 8px; }

.upload-bar {
  display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center;
  margin: 1rem 0; padding: 0.7rem 0.9rem;
  border: 1px dashed var(--line); border-radius: 8px; background: #fafbfc;
}
.upload-bar label.inline { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.upload-bar select { width: auto; margin: 0; }
.upload-bar input[type="file"] { width: auto; }
.upload-bar button { width: auto; }

.summary { background: var(--ok); border-radius: 8px; padding: 0.8rem 1rem; margin: 1rem 0; }
.summary table { width: 100%; border-collapse: collapse; }
.summary th, .summary td { padding: 0.35rem 0.5rem; text-align: right; font-size: 0.9rem; }
.summary th:first-child, .summary tr th:first-child { text-align: left; }

table.hist { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table.hist th, table.hist td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.9rem; }
table.hist thead th { color: var(--muted); font-weight: 600; }
table.hist .fname { font-family: monospace; font-size: 0.82rem; word-break: break-all; }
table.hist .num { text-align: right; white-space: nowrap; }
a.dl { color: var(--accent); text-decoration: none; white-space: nowrap; }
.topbar nav a { color: var(--accent); }

.vm-section { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.vm-q { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.vm-label { font-size: 0.95rem; }
select.jn { width: auto; margin: 0; min-width: 90px; }
.vm-felder { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 0.6rem; }
.vm-felder label.inline { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; font-size: 0.85rem; }
.vm-details { margin-top: 0.6rem; }
.vm-details summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.vm-details .grid-scroll { margin-top: 0.6rem; }

.grid-scroll { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; min-width: 600px; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 0.25rem; }
table.grid thead th { background: #fafbfc; font-size: 0.8rem; color: var(--muted); }
table.grid th.pos { text-align: left; font-weight: 500; font-size: 0.85rem; min-width: 230px; }
table.grid input { border: none; text-align: right; padding: 0.35rem 0.4rem; margin: 0; }
table.grid input:focus { outline: 2px solid var(--accent); border-radius: 4px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
