:root {
  --brand: #0052CC;
  --brand-hover: #0747A6;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #172b4d;
  --muted: #5e6c84;
  --grid: #dfe1e6;
  --success: #00875a;
  --warning: #ff991f;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(9,30,66,.08);
  --shadow-hover: 0 4px 8px rgba(9,30,66,.12);
}
* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
h1, h2 { margin: 0 0 .5rem 0; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; font-weight: 600; color: var(--muted); }

/* Topbar – Jira-like */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; background: var(--card); border-bottom: 1px solid var(--grid); min-height: 56px; }
.topbar-modern .topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-modern .topbar-right { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 700; font-size: 1.25rem; color: var(--brand); text-decoration: none; }
.logo:hover { color: var(--brand-hover); }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab { padding: 12px 14px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.user-info { font-size: .875rem; color: var(--muted); }
.btn { display: inline-block; padding: 6px 12px; border-radius: var(--radius); font-size: .875rem; text-decoration: none; cursor: pointer; }
.btn-ghost { color: var(--brand); background: transparent; border: none; }
.btn-ghost:hover { background: var(--bg); }

/* Main – Tabellenbereich 90 % der Seitenbreite für bessere Lesbarkeit */
.main-content { width: 90%; max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Filters (legacy) */
.filters label { margin-right: .5rem; }
select { padding: .4rem .6rem; border: 1px solid var(--grid); border-radius: var(--radius); background: var(--card); font-size: .9rem; }

/* KPI Grid */
.kpi-grid { display: grid; gap: 16px; padding: 0 0 24px 0; grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--grid); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); transition: box-shadow .15s; }
.kpi:hover { box-shadow: var(--shadow-hover); }
.kpi-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: .35rem; }
.kpi-value { font-size: 1.75rem; font-weight: 600; color: var(--text); }
.kpi-sub .kpi-subgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: .5rem; }
.kpi-sub .kpi-subgrid div { background: var(--bg); border-radius: var(--radius); padding: 10px; text-align: center; }
.kpi-sub .kpi-subgrid span { display: block; color: var(--muted); font-size: .7rem; margin-bottom: .2rem; }
.kpi-sub .kpi-subgrid b { font-size: 1.15rem; }

/* Charts */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 0 24px 0; }
.charts .large { grid-column: 1 / -1; }
.chart-item { background: var(--card); border: 1px solid var(--grid); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-item h2 { margin-bottom: 12px; }

/* Tables */
.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 0 24px 0; }
.table-box { background: var(--card); border: 1px solid var(--grid); border-radius: var(--radius); padding: 16px; overflow: auto; max-height: 55vh; box-shadow: var(--shadow); }
.table-box.full-width { grid-column: 1 / -1; }
.table-meta { margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
.table-meta label { margin-right: 8px; }
.table-meta select { margin-right: 12px; }

table { border-collapse: collapse; margin-top: 8px; width: 100%; font-size: .9rem; }
th, td { border-top: 1px solid var(--grid); padding: 10px 12px; vertical-align: top; text-align: left; }
thead th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .02em; }
tbody tr:hover { background: #fafbfc; }
tbody tr:nth-child(odd) { background: #fafbfc; }
tbody tr:nth-child(odd):hover { background: #f0f2f5; }

/* Tabellen: 90 % Breite, pro-Spalten-Filter, Sortierung, Spaltenbreite */
.data-table-wrapper { display: flex; flex-direction: column; gap: 8px; min-height: 0; width: 100%; }
.data-table-wrapper table.data-table { margin-top: 0; width: 100%; }
thead tr.table-col-filters th { padding: 4px 8px; vertical-align: middle; background: var(--bg); }
.table-col-filter {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  font-size: .8rem;
  background: var(--card);
}
.table-col-filter::placeholder { color: var(--muted); }
.table-col-filter:focus { outline: none; border-color: var(--brand); }
thead th.sortable { cursor: pointer; user-select: none; padding-right: 20px; }
thead th.sortable:hover { color: var(--brand); }
thead th.sort-asc::after { content: ' \2191'; font-size: .7rem; color: var(--brand); }
thead th.sort-desc::after { content: ' \2193'; font-size: .7rem; color: var(--brand); }
thead th .col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}
thead th .col-resize-handle:hover,
thead th .col-resize-handle:active { background: var(--brand); opacity: 0.3; }

/* Page sections */
.page-section { margin-bottom: 28px; }
.page-section h2 { margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--grid); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin: 0 0 12px 0; font-size: 1rem; }
.table-scroll-container { overflow: auto; max-height: 55vh; min-height: 0; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state p { margin: 0 0 8px 0; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: 1fr; }
  .tables { grid-template-columns: 1fr; }
  .nav-tabs { flex-wrap: wrap; }
}
