:root {
  /* Marke / Akzent - angelehnt an den mit dem Kunden abgestimmten Entwurf
     (helle Fläche, violetter Akzent, dezenter skiCHECK-Rot-Touch im Logo/Avatar). */
  --accent: #5750e8;
  --accent-2: #6f8cfa;
  --accent-ink: #4038c9;
  --accent-soft: #edebfe;
  --accent-soft-border: #d9d5fb;
  --brand-red: #c23b2e;

  --bg: #f5f5fb;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --border: #e4e3f0;
  --border-soft: #edecf6;

  --ink: #1c1b2e;
  --ink-soft: #6e6e88;
  --ink-faint: #9997ad;

  --success: #1e9e6c;
  --success-soft: #e5f6ee;
  --warning: #b8860b;
  --warning-soft: #fdf3e0;
  --danger: #d64545;
  --danger-soft: #fbe9e8;

  /* Rückwärtskompatible Aliase (ältere Farbnamen, die an einigen Stellen
     noch direkt verwendet werden). */
  --blue: var(--accent);
  --blue-dark: var(--accent-ink);
  --blue-light: var(--accent-soft);
  --navy: var(--ink);
  --red: var(--danger);
  --green: var(--success);
  --amber: var(--warning);
  --gray-50: var(--bg);
  --gray-100: var(--border-soft);
  --gray-200: var(--border);
  --gray-400: var(--ink-faint);
  --gray-600: var(--ink-soft);
  --gray-800: var(--ink);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28,27,46,0.04), 0 8px 20px -12px rgba(28,27,46,0.10);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

table { font-variant-numeric: tabular-nums; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Shell: Sidebar + Inhalt ---------- */
.shell {
  display: grid;
  grid-template-columns: 76px 1fr;
  min-height: 100vh;
  align-items: start;
}
.shell-guest { grid-template-columns: 1fr; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.1rem 0 1rem;
  gap: 0.35rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.3rem;
  flex-shrink: 0;
  background: var(--ink);
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.sidebar-logo:hover { opacity: 0.9; }

.nav-icons { display: flex; flex-direction: column; gap: 0.3rem; width: 100%; align-items: center; }
.nav-item {
  width: 54px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  color: var(--ink-faint);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item span { font-family: "Sora", sans-serif; font-size: 0.56rem; font-weight: 600; letter-spacing: 0.01em; text-align: center; line-height: 1.15; }
.nav-item:hover { background: var(--surface-2); color: var(--ink-soft); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 3px;
  background: var(--accent);
}
.sidebar-spacer { flex: 1; }
.sidebar-foot { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: "Sora", sans-serif;
  font-weight: 700; font-size: 0.72rem; color: var(--ink-soft);
}

.main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topstrip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
}
.topstrip-company { font-family: "Sora", sans-serif; font-weight: 700; font-size: 0.92rem; color: var(--ink-soft); }
.topstrip-right { display: flex; align-items: center; gap: 0.9rem; margin-left: auto; }

.brand { display: inline-flex; align-items: center; white-space: nowrap; gap: 0.3rem; }
.brand:hover { text-decoration: none; opacity: 0.9; }
.brand-mark { display: inline-flex; align-items: center; background: var(--ink); border-radius: 8px; padding: 5px 9px; }
.brand-logo { height: 22px; width: auto; display: block; }
.chevron { color: var(--brand-red); font-weight: 800; font-size: 1.1rem; letter-spacing: -2px; opacity: 0.9; }

.lang-switch { color: var(--ink-soft); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; font-size: 0.8rem; font-weight: 600; }
.lang-switch:hover { background: var(--surface-2); text-decoration: none; }

.link-button {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
}
.link-button:hover { color: var(--ink); text-decoration: underline; }

.container {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.6rem 3rem;
}

/* ---------- Typografie ---------- */
h1, h2, h3 { font-family: "Sora", sans-serif; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.2rem 0 1rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 0.8rem; }
h3 { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.6rem; color: var(--ink-soft); }
p.subtitle { color: var(--ink-soft); margin-top: -0.6rem; }

/* ---------- Karten / Panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem;
  margin-bottom: 1.2rem;
}

.flash { padding: 0.8rem 1.05rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 600; font-size: 0.92rem; }
.flash-info { background: var(--accent-soft); color: var(--accent-ink); }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: 0.86rem; margin: 0.9rem 0 0.35rem; color: var(--ink); }
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; }
.hint { color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.25rem; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; min-height: 4.5em; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 1.1rem 0; padding: 0.2rem 1rem 1rem; }
legend { font-family: "Sora", sans-serif; font-weight: 700; padding: 0 0.4rem; color: var(--accent-ink); font-size: 0.92rem; }

.radio-row { display: flex; gap: 1.2rem; margin: 0.4rem 0; flex-wrap: wrap; }
.radio-row label { margin: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 0.4rem; }

.phone-input { display: flex; align-items: stretch; flex-wrap: wrap; }
.phone-input .phone-prefix {
  display: flex; align-items: center;
  padding: 0.6rem 0.6rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
}
.phone-input select {
  flex: 0 0 auto;
  max-width: 40%;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
}
.phone-input input[type=tel] {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  flex: 1 1 200px;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: white;
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: "Sora", sans-serif;
  cursor: pointer;
  margin-top: 1.1rem;
  box-shadow: 0 6px 16px -8px rgba(87,80,232,0.55);
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); box-shadow: none; }
.btn.secondary:hover { border-color: var(--ink-faint); filter: none; }
.btn.danger { background: var(--danger); box-shadow: 0 6px 16px -8px rgba(214,69,69,0.55); }
.btn.danger:hover { background: #b93a3a; }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.85rem; margin-top: 0; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border-soft); font-size: 0.9rem; }
th { color: var(--ink-faint); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }

.weekday-schedule th, .weekday-schedule td { padding: 0.4rem 0.5rem; }
.weekday-schedule td:first-child { white-space: nowrap; }
.weekday-schedule td label { margin: 0; font-weight: 500; }
.weekday-schedule input[type=number] { max-width: 5rem; }
.weekday-schedule input[type=time] { max-width: 9rem; }

.checkbox-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  margin: 0.4rem 0;
  background: white;
}
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  margin: 0.4rem 0;
  color: var(--ink);
}
.checkbox-list label input[type=checkbox] { width: auto; }
.checkbox-list .select-all-row { border-bottom: 1px solid var(--border-soft); padding-bottom: 0.4rem; margin-bottom: 0.2rem; font-weight: 700; }

/* ---------- Badges / Status ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.18rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-open { background: var(--warning-soft); color: var(--warning); }
.badge-approved, .badge-signed { background: var(--success-soft); color: var(--success); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-missing { background: var(--danger-soft); color: var(--danger); }
.badge-done { background: var(--success-soft); color: var(--success); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.grid-7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0 0.6rem; }
@media (max-width: 720px) { .grid-7 { grid-template-columns: repeat(4, 1fr); gap: 0.4rem 0.6rem; } }
@media (max-width: 420px) { .grid-7 { grid-template-columns: repeat(2, 1fr); } }

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 1.1rem; flex: 1; min-width: 150px;
}
.stat .num { font-family: "Sora", sans-serif; font-size: 1.6rem; font-weight: 700; color: var(--accent-ink); letter-spacing: -0.01em; }
.stat .label { color: var(--ink-soft); font-size: 0.83rem; font-weight: 500; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 0.45rem 0; border-bottom: 1px solid var(--border-soft); }
.list-plain li:last-child { border-bottom: none; }

.login-wrap { max-width: 400px; margin: 3rem auto; }
.login-logo { text-align: center; margin: 0.2rem 0 1.1rem; }
.login-logo img { height: 56px; width: auto; }

#sig-pad {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  touch-action: none;
  background: var(--surface);
  width: 100%;
  height: 200px;
  display: block;
}

.actions-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.helper-box { background: var(--accent-soft); border: 1px solid var(--accent-soft-border); border-radius: var(--radius); padding: 0.8rem 1rem; font-size: 0.9rem; color: var(--accent-ink); margin-bottom: 1rem; }

footer.app-footer { text-align: center; color: var(--ink-faint); font-size: 0.8rem; padding: 2rem 0 1rem; }

/* ---------- Mobil: Sidebar wird zur oberen Icon-Leiste ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 0.35rem;
    overflow-x: auto;
  }
  .sidebar-logo { margin-bottom: 0; width: 34px; height: 34px; flex-shrink: 0; }
  .nav-icons { flex-direction: row; width: auto; gap: 0.1rem; flex-shrink: 0; }
  .nav-item { width: 46px; height: 46px; flex-shrink: 0; min-width: 0; padding: 0 2px; }
  .nav-item svg { width: 17px; height: 17px; }
  .nav-item span { font-size: 0.48rem; overflow-wrap: anywhere; width: 100%; }
  .nav-item.active::before { left: 50%; top: auto; bottom: -4px; transform: translateX(-50%); width: 18px; height: 3px; }
  .sidebar-spacer { display: none; }
  .sidebar-foot { flex-direction: row; flex-shrink: 0; margin-left: 0.2rem; }
  .avatar { width: 30px; height: 30px; font-size: 0.66rem; }
  .container { padding: 1.1rem 1rem 3rem; }
  .topstrip { padding: 0.6rem 1rem; }
}
