* {
  box-sizing: border-box;
}

:root {
  --primary: #2d7d6c;
  --primary-dark: #205a4d;
  --accent: #f5e000;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* --- Topbar / Profilmenü (identisch zur Zeiterfassung) --- */

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
}

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
}

.topbar .company {
  /* Eigene Zeile unter Logo/Profil-Button, damit es auch auf schmalen
     Bildschirmen (Handy) nicht mit dem Profil-Button kollidiert. */
  margin: 8px 0 0;
  text-align: center;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.profile-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 8px;
  z-index: 20;
}

.profile-menu-name {
  margin: 4px 8px 8px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.profile-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.profile-menu-item:hover {
  background: var(--bg);
}

/* --- Layout --- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

#auth-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

/* Karten selbst auf 420px begrenzt (nicht der äußere Container) — exakt wie bei
   der Zeiterfassung, sonst verengt ein doppeltes Padding die Karte unnötig. */
#login-card,
#password-gate,
#mfa-setup-card,
#mfa-challenge-card {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.card h2 {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  font-size: 0.95rem;
}

input[type='text'],
input[type='password'],
select {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.password-toggle:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.mfa-secret {
  font-family: monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
  word-break: break-all;
  margin: 8px 0;
}

.mfa-qr {
  display: block;
  margin: 12px auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* --- Report-Navigation --- */

.report-nav {
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
}

.report-nav button {
  display: inline-block;
  padding: 10px 14px;
  color: var(--muted);
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

.report-nav button:hover {
  color: var(--text);
}

.report-nav button.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar label {
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
}

.toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  width: auto;
}

.summary-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.stat {
  flex: 1;
  min-width: 160px;
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 16px;
}

.stat .label {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 220px;
  padding: 8px 0 0;
  overflow-x: auto;
}

.chart-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 22px;
}

.chart-bar {
  width: 18px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.chart-bar.provisional {
  opacity: 0.4;
}

.chart-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 4px;
  height: 40px;
}

.legend-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pct-bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pct-bar-track {
  flex: 1;
  min-width: 60px;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.pct-bar-fill {
  height: 100%;
  background: var(--primary);
}

.rank-cell {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
