/* HRpilot – Design-System. Eigenständig, kein CDN, keine Webfonts.
   Ruhige Enterprise-Optik: Navy als Marke, ein Blau für Interaktion, alles andere neutral. */
:root {
  --brand: #1e3a5f;
  --brand-hover: #173052;
  --action: #2b5ea7;
  --action-hover: #244f8c;
  --action-soft: #e8effa;

  --ink: #111827;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e5e7eb;
  --line-2: #d1d5db;

  --ok: #15803d;      --ok-soft: #e7f6ec;
  --warn: #b45309;    --warn-soft: #fdf2e1;
  --danger: #b91c1c;  --danger-soft: #fdecec;
  --info: #1d4ed8;    --info-soft: #e6eefc;

  --r: 8px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .06);
  --sidebar: 248px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.005em; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.micro { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 4px; color: var(--ink-2); }
.ico { flex: 0 0 auto; vertical-align: -3px; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 22px 16px; }
.brand img { height: 26px; display: block; }
.company {
  margin: 0 12px 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.company .ico { color: var(--ink-3); }
.company select { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 600; width: 100%; color: var(--ink); cursor: pointer; }
.company select:focus { outline: none; }
.company .name { font-weight: 600; }
nav.menu { padding: 8px 12px; flex: 1; overflow-y: auto; }
nav.menu .group { padding: 16px 10px 6px; }
nav.menu a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; font-size: 13.5px; line-height: 1.3;
}
nav.menu a .ico { color: var(--ink-4); }
nav.menu a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
nav.menu a.active { background: var(--action-soft); color: var(--action); }
nav.menu a.active .ico { color: var(--action); }
.userbox { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600;
  display: grid; place-items: center; flex: 0 0 auto; letter-spacing: .02em;
}
.userbox .meta { min-width: 0; flex: 1; font-size: 12.5px; line-height: 1.3; }
.userbox .meta .name { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .meta .role { color: var(--ink-3); }
.userbox a.out { color: var(--ink-4); display: inline-flex; padding: 4px; border-radius: 4px; }
.userbox a.out:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }

.content { flex: 1; min-width: 0; }
main { padding: 32px 40px 48px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-head .crumb { font-size: 13px; margin-bottom: 6px; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); }
.page-head .crumb:hover { color: var(--action); text-decoration: none; }
.section { margin-top: 28px; }
.section > .micro { margin-bottom: 10px; display: block; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth .panel { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 32px 32px 28px; box-shadow: var(--shadow); }
.auth .brand { padding: 0 0 22px; }
.auth .brand img { height: 28px; margin: 0 auto; }
.auth h2 { font-size: 18px; margin-bottom: 4px; }
.auth .lead { color: var(--ink-3); margin-bottom: 18px; }
.auth .foot { margin-top: 18px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* ---------- Flächen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card.flush .card-body { padding: 20px 22px; }
.grid { display: grid; gap: 16px; }
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Tool-Kacheln */
.tile {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; color: inherit; box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s; min-height: 168px;
}
a.tile:hover { text-decoration: none; border-color: var(--line-2); box-shadow: 0 2px 8px rgba(17,24,39,.08); }
.tile .tile-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--action-soft); color: var(--action);
  display: grid; place-items: center; margin-bottom: 14px;
}
.tile.locked .tile-icon { background: var(--surface-2); color: var(--ink-4); }
.tile h3 { margin: 0 0 4px; font-size: 15px; }
.tile .desc { color: var(--ink-3); font-size: 13px; flex: 1; line-height: 1.45; }
.tile .foot { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Status */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); flex: 0 0 auto; }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--warn); }
.status.danger::before { background: var(--danger); }
.status.info::before { background: var(--info); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 2px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; }
.tag.info { background: var(--info-soft); border-color: transparent; color: var(--info); }

/* ---------- Formulare ---------- */
form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font: inherit; font-size: 14px;
  background: var(--surface); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px var(--action-soft); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--ink-3); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
select.inline { width: auto; padding: 5px 28px 5px 8px; font-size: 13px; }
.help { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check input { width: auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid transparent; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; line-height: 1.3;
  background: var(--action); color: #fff; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--action-hover); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line-2); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn .ico { margin-left: -2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
tbody tr:hover td { background: #fbfcfd; }
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td.dim { color: var(--ink-3); }
td.date { white-space: nowrap; color: var(--ink-3); font-variant-numeric: tabular-nums; }
td .primary { font-weight: 500; color: var(--ink); }

/* Dropzone */
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--r); background: var(--surface);
  padding: 34px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--action); background: var(--action-soft); }
.drop .ico { color: var(--ink-4); }
.drop.over .ico { color: var(--action); }
.drop b { display: block; margin: 8px 0 2px; font-size: 14px; }
.drop span { color: var(--ink-3); font-size: 12.5px; }

/* ---------- Meldungen ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 20px; border: 1px solid; font-size: 13.5px; background: var(--info-soft); border-color: #c7d7f5; color: #1e3a8a; }
.flash.ok { background: var(--ok-soft); border-color: #bfe3cb; color: #14532d; }
.flash.warn { background: var(--warn-soft); border-color: #f3d9a4; color: #7c2d12; }
.flash.error { background: var(--danger-soft); border-color: #f2c2c2; color: #7f1d1d; }
.flash .ico { margin-top: 1px; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 16px; font-size: 13.5px; }
.notice { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--ink-3); }

/* Log-Liste */
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log .t { color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  nav.menu { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px; }
  nav.menu .group { display: none; }
  .userbox { border-top: 0; padding-top: 0; }
  main { padding: 20px 16px 40px; }
  .page-head { flex-direction: column; }
}
