:root {
  --ptv-red: #ff4249;
  --ptv-red-dark: #e02a31;
  --ink: #000000;
  --ink-soft: #1e212e;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e6e7eb;
  --text-primary: #14161f;
  --text-secondary: #6b6f7b;
  --text-muted: #9297a3;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
}

/* ---------- Shell / Sidebar ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo { height: 30px; width: auto; display: block; }
.brand-name {
  font-weight: 500;
  font-size: 12.5px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.01em;
}

.nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.nav a i { font-size: 17px; width: 18px; }

.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav a.active {
  background: rgba(255,66,73,0.14);
  color: #fff;
  border-left: 3px solid var(--ptv-red);
}

.nav-divider {
  margin: 14px 12px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ptv-red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; color: #fff; }
.user-role { font-size: 11.5px; color: rgba(255,255,255,0.5); }

.logout-link {
  display: flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.6); text-decoration: none; font-size: 12.5px;
}
.logout-link:hover { color: #fff; }

.content { flex: 1; padding: 32px 40px; max-width: 1200px; }

/* ---------- Typography ---------- */

h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 28px 0 12px; }
.page-sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 24px; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.card-wide { max-width: 900px; }

.card + .card { margin-top: 16px; }

/* ---------- Tables ---------- */

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td { padding: 11px 14px; text-align: left; font-size: 13px; }

th {
  background: #fafafb;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

td { border-bottom: 1px solid var(--border); color: var(--text-primary); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 100px; font-size: 11.5px; font-weight: 600;
}
.badge-1 { background: #e6f1fb; color: #185fa5; }
.badge-2 { background: #faeeda; color: #854f0b; }
.badge-3 { background: #fce8e8; color: var(--ptv-red-dark); }

/* ---------- Buttons ---------- */

.button, button {
  background: var(--ptv-red);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.button:hover, button:hover { background: var(--ptv-red-dark); }

.button-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.button-secondary:hover { background: #fafafb; color: var(--text-primary); }

.link-button {
  background: none; border: none; color: var(--ptv-red-dark);
  text-decoration: none; cursor: pointer; font-size: 12.5px;
  font-weight: 600; padding: 0;
}
.link-button:hover { text-decoration: underline; background:none; }

/* ---------- Forms ---------- */

.entry-form, .rates-form {
  display: flex; flex-direction: column; max-width: 480px; gap: 4px;
}
.entry-form label, .rates-form label {
  font-size: 12.5px; margin-top: 10px; font-weight: 600; color: var(--text-secondary);
}
.entry-form input, .entry-form select, .entry-form textarea,
.rates-form input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: #fff;
}
.entry-form input:focus, .entry-form select:focus, .entry-form textarea:focus,
.rates-form input:focus {
  outline: none; border-color: var(--ptv-red); box-shadow: 0 0 0 3px rgba(255,66,73,0.12);
}
.entry-form textarea { min-height: 64px; resize: vertical; }
.entry-form .checkbox-row { flex-direction: row; align-items: center; gap: 8px; margin-top: 12px; font-weight: 400; }

.filter-row { margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.filter-row select, .filter-row input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13.5px;
}

table input[type="number"], table input[type="text"] {
  padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; width: 100px; background: #fff;
}
table input[type="number"]:focus, table input[type="text"]:focus {
  outline: none; border-color: var(--ptv-red); box-shadow: 0 0 0 3px rgba(255,66,73,0.12);
}

.rates-form table { margin: 12px 0 18px; }
.rates-form table input { width: 90px; }
.rates-form table td { background: #fff; }

.toggle-row { display: flex; align-items: center; gap: 10px; }

/* ---------- Login page ---------- */

.login-page {
  background: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  width: 100%;
  max-width: 360px;
  padding: 36px 32px;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { height: 34px; margin-bottom: 22px; }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 22px; }
.login-card form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-card label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-top: 10px; }
.login-card input {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--ptv-red); box-shadow: 0 0 0 3px rgba(255,66,73,0.12); }
.login-card button { margin-top: 18px; justify-content: center; }
.error { color: var(--ptv-red-dark); font-size: 13px; background: #fce8e8; padding: 8px 12px; border-radius: 8px; }

.ms-signin-button {
  width: 100%;
  justify-content: center;
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border);
  margin-bottom: 4px;
}
.ms-signin-button:hover { background: #fafbfc; }

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin: 16px 0;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.login-divider span { padding: 0 10px; }

/* ---------- Flash / Toast ---------- */

.toast-success {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eaf3de;
  color: #3b6d11;
  border: 1px solid #c0dd97;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  animation: fadeOutToast 0.4s ease 3.2s forwards;
}
@keyframes fadeOutToast {
  to { opacity: 0; height: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; overflow: hidden; }
}

/* ---------- Monats-Navigation ---------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ink);
  border-radius: 10px;
  padding: 10px 20px;
  margin-bottom: 18px;
  max-width: 320px;
}
.month-nav-label {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  min-width: 140px;
  text-align: center;
}
.month-nav-arrow {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
}
.month-nav-arrow:hover { color: #fff; background: rgba(255,255,255,0.08); }
.month-nav-arrow i { font-size: 18px; }

/* Kompakte Pfeil-Buttons neben dem Monats-Feld in hellen Filterzeilen */
.month-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  background: #fff;
}
.month-step:hover { background: #fafbfc; color: var(--text-primary); border-color: #d5d7dc; }
.month-step i { font-size: 16px; }

/* ---------- Sperr-Hinweis ---------- */

.lock-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fdf3e6;
  color: #8a5a1f;
  border: 1px solid #f3ddb8;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Stat cards (Dashboard) ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.stat-value.accent { color: var(--ptv-red-dark); }
