:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface2: #eef2f7;
  --border: #d8dee8;
  --text: #1a2332;
  --muted: #5c6b7f;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); }

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem;
}
.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
header h1 { margin: 0 0 0.2rem; font-size: 1.3rem; font-weight: 700; }
header p { margin: 0; color: var(--muted); font-size: 0.86rem; }

.domain-switch { display: flex; gap: 0.4rem; }
.domain-btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.domain-btn:hover { border-color: var(--accent); }
.domain-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.domain-btn .sub { display: block; font-size: 0.68rem; font-weight: 400; opacity: 0.85; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0.2rem 0;
  font-variant-numeric: tabular-nums;
}
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--red); }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }

.compare {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.compare-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.compare h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.breadcrumb { font-size: 0.82rem; color: var(--muted); }

.tile-section { margin-bottom: 0.85rem; }
.tile-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.55rem;
}
.tile {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--surface2);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
.tile-name { font-size: 0.78rem; font-weight: 700; margin-bottom: 0.15rem; }
.tile-amt { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.1rem; }
.tile.sch { border-left: 4px solid var(--red); }
.tile.akt { border-left: 4px solid var(--green); }
.tile.akt-ford { border-left: 4px solid var(--purple); }
.tile.akt-ums { border-left: 4px solid var(--amber); }

.compare-bars { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.4rem 0;
  font-size: 0.84rem;
}
.bar-label { width: 130px; flex-shrink: 0; font-weight: 500; }
.bar-track {
  flex: 1;
  height: 20px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.bar-fill.sch { background: var(--red); opacity: 0.8; }
.bar-fill.real { background: var(--green); }
.bar-fill.fc { background: #86efac; opacity: 0.7; }
.bar-amt { width: 110px; text-align: right; font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.netto-line {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.toolbar-spacer { flex: 1; }
.toolbar input, .toolbar select, .toolbar button {
  font: inherit;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
}
.toolbar button { cursor: pointer; background: var(--surface2); }
.toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.toolbar label.inline { display: flex; align-items: center; gap: 0.4rem; font-size: 0.84rem; }

.view { display: none; }
.view.active { display: block; }
.detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.detail-head h3 { margin: 0; font-size: 1.05rem; }
.btn-back {
  font: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.btn-back:hover { border-color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th, td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  position: sticky;
  top: 0;
}
tr.off { opacity: 0.5; }
tr:hover { background: rgba(37, 99, 235, 0.04); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.empty { text-align: center; padding: 2rem; color: var(--muted); }
.hint { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.75rem; }

.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.2rem;
}
.tag-dup { background: var(--green-soft); color: var(--green); }
.tag-rec { background: var(--surface2); color: var(--muted); }
.tag-over { background: var(--amber-soft); color: var(--amber); }
.tag-paid { background: var(--green-soft); color: var(--green); }
.tag-soon { background: var(--accent-soft); color: var(--accent); }
.tag-later { background: var(--surface2); color: var(--muted); }
.tag-none { background: var(--red-soft); color: var(--red); }

.urg, .own {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.u-krit { background: var(--red-soft); color: var(--red); }
.u-hoch { background: var(--amber-soft); color: var(--amber); }
.u-mitt { background: var(--accent-soft); color: var(--accent); }
.o-ug { background: var(--green-soft); color: var(--green); }
.o-priv { background: var(--amber-soft); color: var(--amber); }
.o-unk { background: var(--surface2); color: var(--muted); }

.status-select {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.35rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  max-width: 150px;
}
.status-select.paid { border-color: var(--green); background: var(--green-soft); }
.status-select.soon { border-color: var(--accent); }
.status-select.none { border-color: var(--red); background: var(--red-soft); }

.settings {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}
.settings h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.settings label { display: block; margin: 0.5rem 0 0.2rem; color: var(--muted); font-size: 0.82rem; }
.settings input[type="text"] { width: 100%; max-width: 520px; padding: 0.4rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }

footer { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 640px) {
  .bar-label { width: 90px; font-size: 0.75rem; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
}
