/* Mochikabu Mitarbeiterportal – Design System
   Modern CSS: @layer, oklch(), light-dark(), color-mix(), :has(), container queries,
   native nesting, View Transitions. Keine Build-Pipeline, keine externen Ressourcen. */

@layer reset, tokens, base, layout, components, pages, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: none; text-size-adjust: none; }
  body { min-height: 100dvh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
  img, svg, canvas { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; }
  p, h1, h2, h3 { overflow-wrap: break-word; }
  h1, h2, h3 { text-wrap: balance; }
  p { text-wrap: pretty; }
  fieldset { border: 0; padding: 0; min-width: 0; }
}

@layer tokens {
  :root {
    color-scheme: light dark;
    --hue: 252;
    --brand: oklch(0.52 0.16 var(--hue));
    --brand-strong: oklch(0.42 0.15 var(--hue));
    --brand-soft: light-dark(oklch(0.95 0.03 var(--hue)), oklch(0.3 0.06 var(--hue)));
    --ink: oklch(0.24 0.06 255);

    --bg: light-dark(oklch(0.975 0.006 250), oklch(0.16 0.02 255));
    --surface: light-dark(oklch(1 0 0), oklch(0.21 0.022 255));
    --surface-2: light-dark(oklch(0.965 0.008 250), oklch(0.25 0.024 255));
    --surface-3: light-dark(oklch(0.93 0.012 250), oklch(0.3 0.026 255));
    --text: light-dark(oklch(0.22 0.03 255), oklch(0.95 0.01 250));
    --muted: light-dark(oklch(0.5 0.025 255), oklch(0.72 0.02 250));
    --border: light-dark(oklch(0.9 0.012 250), oklch(0.33 0.025 255));
    --border-strong: light-dark(oklch(0.83 0.015 250), oklch(0.42 0.03 255));

    --green: oklch(0.62 0.15 155);
    --amber: oklch(0.75 0.15 75);
    --red: oklch(0.6 0.2 25);
    --violet: oklch(0.58 0.2 300);
    --teal: oklch(0.65 0.12 195);

    --c-urlaub: oklch(0.62 0.16 250);
    --c-krank: oklch(0.64 0.19 25);
    --c-kind_krank: oklch(0.7 0.16 45);
    --c-sonder: oklch(0.6 0.18 300);
    --c-schulung: oklch(0.66 0.12 190);
    --c-unbezahlt: oklch(0.6 0.03 255);
    --c-auszahlung: oklch(0.7 0.14 140);
    --c-abwesend: oklch(0.62 0.04 255);
    --c-holiday: light-dark(oklch(0.93 0.05 80), oklch(0.36 0.06 80));

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --shadow-sm: 0 1px 2px oklch(0.2 0.03 255 / 0.06), 0 1px 1px oklch(0.2 0.03 255 / 0.04);
    --shadow: 0 1px 2px oklch(0.2 0.03 255 / 0.05), 0 8px 24px -6px oklch(0.2 0.05 255 / 0.12);
    --shadow-lg: 0 2px 4px oklch(0.2 0.03 255 / 0.05), 0 24px 60px -12px oklch(0.2 0.06 255 / 0.25);
    --ring: 0 0 0 3px color-mix(in oklab, var(--brand) 35%, transparent);

    --font: "Inter var", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --gutter: clamp(16px, 4vw, 40px);
  }

  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }
}

@layer base {
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, ::before, ::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
  @view-transition { navigation: auto; }

  body {
    font-family: var(--font);
    font-feature-settings: "cv11", "ss01", "tnum";
    font-size: 15px;
    color: var(--text);
    background:
      radial-gradient(1200px 600px at 100% -10%, color-mix(in oklab, var(--brand) 12%, transparent), transparent 60%),
      radial-gradient(900px 500px at -10% 0%, color-mix(in oklab, var(--violet) 8%, transparent), transparent 60%),
      var(--bg);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
  }

  a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  :focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
  ::selection { background: color-mix(in oklab, var(--brand) 30%, transparent); }
  h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); letter-spacing: -0.025em; line-height: 1.15; font-weight: 700; }
  h2 { font-size: 1.1rem; letter-spacing: -0.01em; font-weight: 650; }
  code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 6px; }
  small, .small { font-size: 0.82rem; }
  .muted { color: var(--muted); }
  .eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
  [hidden] { display: none !important; }
}

@layer layout {
  .page {
    width: min(1180px, 100% - 2 * var(--gutter));
    margin-inline: auto;
    padding-block: clamp(20px, 4vw, 44px) 56px;
    display: grid;
    gap: 24px;
    align-content: start;
    flex: 1;
    &.page--narrow { width: min(640px, 100% - 2 * var(--gutter)); }
    &.page--wide { width: min(1400px, 100% - 2 * var(--gutter)); }
  }

  .topbar {
    position: sticky; top: 0; z-index: 40;
    background: color-mix(in oklab, var(--surface) 75%, transparent);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--border);
    view-transition-name: topbar;
  }
  .topbar__inner {
    width: min(1400px, 100% - 2 * var(--gutter)); margin-inline: auto;
    display: flex; align-items: center; gap: 20px; min-height: 64px;
  }
  .topbar__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

  .mainnav {
    display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
    a {
      display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
      padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: 0.92rem;
      transition: background 0.2s, color 0.2s;
      &:hover { color: var(--text); background: var(--surface-2); }
      &[aria-current="page"] { color: var(--text); background: var(--surface-3); }
    }
  }
  @media (width < 900px) {
    .topbar__inner { flex-wrap: wrap; gap: 8px 12px; padding-block: 10px; }
    .mainnav { order: 3; width: 100%; margin-inline: -4px; }
    .usermenu__name { display: none; }
  }

  .footer {
    width: min(1400px, 100% - 2 * var(--gutter)); margin-inline: auto;
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
    padding: 20px 0 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem;
  }
}

@layer components {
  .icon { width: 20px; height: 20px; flex: none; }
  .icon--xs { width: 14px; height: 14px; }
  .icon--sm { width: 16px; height: 16px; }
  .icon--xl { width: 44px; height: 44px; stroke-width: 1.4; }

  .brand {
    display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
    .brand__text { display: grid; line-height: 1.15; font-size: 0.95rem; span { color: var(--muted); font-size: 0.78rem; } }
  }
  .brand__mark {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
    background: linear-gradient(135deg, oklch(0.62 0.17 250), oklch(0.32 0.1 255));
    color: white; font-weight: 800; letter-spacing: -0.04em; font-size: 1.05rem;
    box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.25), 0 6px 16px -4px color-mix(in oklab, var(--brand) 60%, transparent);
    &.brand__mark--lg { width: 56px; height: 56px; border-radius: 17px; font-size: 1.6rem; }
  }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 0.92rem;
    text-decoration: none; white-space: nowrap; border: 1px solid transparent;
    transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s, border-color 0.2s;
    &:active { transform: scale(0.98); }
    &:disabled { opacity: 0.55; pointer-events: none; }
  }
  .btn--primary {
    color: white; background: linear-gradient(180deg, oklch(0.58 0.17 var(--hue)), var(--brand));
    box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.2), 0 1px 2px oklch(0.3 0.1 255 / 0.3), 0 6px 16px -6px color-mix(in oklab, var(--brand) 70%, transparent);
    &:hover { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); }
  }
  .btn--ghost {
    color: var(--text); background: var(--surface); border-color: var(--border);
    &:hover { background: var(--surface-2); border-color: var(--border-strong); }
  }
  .btn--danger-ghost { color: var(--red); &:hover { background: color-mix(in oklab, var(--red) 10%, transparent); } }
  .btn--sm { height: 34px; padding: 0 12px; font-size: 0.85rem; border-radius: 10px; }
  .btn--lg { height: 48px; font-size: 1rem; border-radius: 14px; }

  .iconbtn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--muted); flex: none;
    transition: background 0.2s, color 0.2s;
    &:hover { background: var(--surface-2); color: var(--text); }
  }
  [data-theme-toggle] {
    .icon--light { display: none; }
    @media (prefers-color-scheme: dark) { .icon--light { display: block; } .icon--dark { display: none; } }
  }
  :root[data-theme="dark"] [data-theme-toggle] { .icon--light { display: block; } .icon--dark { display: none; } }
  :root[data-theme="light"] [data-theme-toggle] { .icon--light { display: none; } .icon--dark { display: block; } }

  .avatar {
    --avatar: var(--brand);
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, color-mix(in oklab, var(--avatar) 80%, white), var(--avatar));
    color: white; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; flex: none;
    &.avatar--sm { width: 26px; height: 26px; font-size: 0.66rem; }
  }

  .usermenu {
    position: relative;
    summary {
      list-style: none; display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
      &::-webkit-details-marker { display: none; }
      &:hover { background: var(--surface-2); }
    }
    .usermenu__panel {
      position: absolute; right: 0; top: calc(100% + 8px); width: 250px; padding: 6px;
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
      animation: pop 0.18s var(--ease);
      a, button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 0.9rem; text-align: left; }
      a:hover, button:hover { background: var(--surface-2); }
      .icon { width: 17px; height: 17px; color: var(--muted); }
    }
    .usermenu__head { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; span { color: var(--muted); font-size: 0.8rem; } }
  }
  @keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

  .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-sm);
    .card__title { margin-bottom: 16px; }
  }

  .alert {
    padding: 12px 14px; border-radius: 12px; font-size: 0.9rem; border: 1px solid;
    &.alert--error { color: light-dark(oklch(0.45 0.17 25), oklch(0.82 0.1 25)); background: color-mix(in oklab, var(--red) 9%, var(--surface)); border-color: color-mix(in oklab, var(--red) 30%, transparent); }
    &.alert--success { color: light-dark(oklch(0.42 0.12 155), oklch(0.85 0.1 155)); background: color-mix(in oklab, var(--green) 10%, var(--surface)); border-color: color-mix(in oklab, var(--green) 30%, transparent); }
  }

  .toast {
    position: fixed; z-index: 100; left: 50%; bottom: 24px; translate: -50% 0;
    padding: 12px 18px; border-radius: 14px; font-weight: 550; font-size: 0.92rem; max-width: calc(100% - 32px);
    background: var(--ink); color: white; box-shadow: var(--shadow-lg);
    animation: toast-in 0.35s var(--ease);
    &.toast--error { background: oklch(0.45 0.17 25); }
    &.is-leaving { animation: toast-out 0.3s var(--ease) forwards; }
  }
  @keyframes toast-in { from { opacity: 0; translate: -50% 16px; } }
  @keyframes toast-out { to { opacity: 0; translate: -50% 16px; } }

  .field {
    display: grid; gap: 6px;
    > span, legend { font-size: 0.85rem; font-weight: 600; color: var(--text); small { color: var(--muted); font-weight: 450; } }
    input, select, textarea {
      width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
      background: var(--surface); border: 1px solid var(--border-strong); transition: border-color 0.2s, box-shadow 0.2s;
      &:hover { border-color: color-mix(in oklab, var(--brand) 40%, var(--border-strong)); }
      &:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
    }
    textarea { resize: vertical; min-height: 64px; }
  }
  .field__password { position: relative; input { padding-right: 48px; } }
  .field__reveal { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); &:hover { background: var(--surface-2); } }

  .form { display: grid; gap: 16px; }
  .form__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
  .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
  .spacer { flex: 1; }

  .strength { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: -8px;
    span { display: block; height: 100%; width: 0; background: var(--red); transition: width 0.3s var(--ease), background 0.3s; } }

  .chip {
    display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
    background: color-mix(in oklab, var(--tile, var(--brand)) 13%, var(--surface)); color: color-mix(in oklab, var(--tile, var(--brand)) 80%, var(--text));
    &.chip--ghost { background: var(--surface-2); color: var(--muted); }
    &.chip--warn { background: color-mix(in oklab, var(--amber) 22%, var(--surface)); color: light-dark(oklch(0.45 0.1 70), oklch(0.85 0.12 80)); }
  }
  .badge {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 0.74rem; font-weight: 650; background: var(--surface-2); color: var(--muted);
    &.badge--admin { background: color-mix(in oklab, var(--violet) 14%, var(--surface)); color: var(--violet); }
    &.badge--warn { background: color-mix(in oklab, var(--amber) 22%, var(--surface)); color: light-dark(oklch(0.45 0.1 70), oklch(0.85 0.12 80)); }
    &.badge--ok { background: color-mix(in oklab, var(--green) 14%, var(--surface)); color: light-dark(oklch(0.45 0.12 155), oklch(0.8 0.12 155)); }
    &.badge--bad { background: color-mix(in oklab, var(--red) 14%, var(--surface)); color: var(--red); }
  }

  .crumbs { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); a { color: inherit; text-decoration: none; &:hover { color: var(--text); } } }

  .pagehead {
    display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px;
    .muted { margin-top: 6px; }
  }
  .pagehead__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

  .segmented {
    display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%;
    a, button {
      display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.88rem; white-space: nowrap;
      &:hover { color: var(--text); }
      &[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
    }
    &.segmented--scroll { overflow-x: auto; scrollbar-width: none; justify-self: start; }
  }

  .tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
    button {
      display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; color: var(--muted); font-weight: 600; font-size: 0.92rem; border-bottom: 2px solid transparent; white-space: nowrap;
      &:hover { color: var(--text); }
      &[aria-selected="true"] { color: var(--text); border-color: var(--brand); }
    }
  }

  .empty {
    display: grid; justify-items: center; gap: 12px; text-align: center; padding: 56px 20px; color: var(--muted);
    background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
    h1 { color: var(--text); font-size: 1.4rem; }
    &.empty--inline { padding: 24px; }
  }

  .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
  @keyframes spin { to { rotate: 1turn; } }

  .table {
    width: 100%; border-collapse: collapse; font-size: 0.9rem;
    th { text-align: left; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
    td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
    tr:last-child td { border-bottom: 0; }
    tbody tr { transition: background 0.15s; &:hover { background: var(--surface-2); } }
    &.table--compact td { padding: 8px 12px; font-size: 0.84rem; }
    .table__actions { text-align: right; white-space: nowrap; }
  }
  .tablewrap { overflow-x: auto; margin-inline: -8px; padding-inline: 8px; }
  .person { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }

  .dialog {
    width: min(560px, 100% - 24px); max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
    &::backdrop { background: oklch(0.2 0.03 255 / 0.45); backdrop-filter: blur(4px); }
    &[open] { animation: dialog-in 0.28s var(--ease); }
  }
  @keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
  .dialog__form { display: grid; gap: 16px; padding: 24px; }
  .dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; h2 { font-size: 1.25rem; } }
  .dialog__foot { display: flex; align-items: center; gap: 10px; padding-top: 8px; }
  @media (width < 560px) {
    .dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
    .dialog[open] { animation: sheet-in 0.3s var(--ease); }
  }
  @keyframes sheet-in { from { transform: translateY(40%); opacity: 0; } }

  .switch {
    display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; font-size: 0.92rem; justify-self: start;
    input { position: absolute; opacity: 0; pointer-events: none; }
    .switch__track {
      width: 40px; height: 24px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background 0.2s;
      &::after { content: ""; position: absolute; inset: 3px auto 3px 3px; width: 18px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: translate 0.25s var(--ease); }
    }
    input:checked + .switch__track { background: var(--brand); &::after { translate: 16px 0; } }
    input:focus-visible + .switch__track { box-shadow: var(--ring); }
    &:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
  }

  .search {
    display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); flex: 1 1 280px; max-width: 460px; color: var(--muted);
    input { border: 0; background: none; outline: none; width: 100%; height: 100%; color: var(--text); }
    &:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
  }
  .pills { display: flex; gap: 6px; flex-wrap: wrap; }
  .pill {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 0.86rem; font-weight: 600; color: var(--muted);
    span { font-size: 0.75rem; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); }
    &:hover { color: var(--text); border-color: var(--border-strong); }
    &[aria-pressed="true"] { color: white; background: var(--ink); border-color: var(--ink); span { background: oklch(1 0 0 / 0.18); } }
  }
  :root:is([data-theme="dark"]) .pill[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); } }
  .toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
}

@layer pages {
  /* ---------- Login ---------- */
  body.is-bare { background: var(--bg); }
  .auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100dvh; }
  .auth__art {
    position: relative; overflow: hidden; color: white; padding: clamp(32px, 6vw, 72px); display: grid; align-content: end;
    background:
      radial-gradient(800px 500px at 20% 10%, oklch(0.55 0.2 260 / 0.55), transparent 60%),
      radial-gradient(700px 600px at 90% 90%, oklch(0.55 0.2 300 / 0.35), transparent 60%),
      linear-gradient(160deg, oklch(0.28 0.08 255), oklch(0.17 0.05 260));
  }
  .auth__glow {
    position: absolute; inset: 0; opacity: 0.35;
    background-image: linear-gradient(oklch(1 0 0 / 0.07) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / 0.07) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, black, transparent 75%);
  }
  .auth__copy { position: relative; display: grid; gap: 24px; max-width: 460px;
    h2 { font-size: clamp(2rem, 1.4rem + 2vw, 3rem); line-height: 1.05; letter-spacing: -0.035em; font-weight: 750; }
  }
  .auth__features { list-style: none; padding: 0; display: grid; gap: 12px; color: oklch(1 0 0 / 0.82);
    li { display: flex; gap: 12px; align-items: center; }
    .icon { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: oklch(1 0 0 / 0.1); border: 1px solid oklch(1 0 0 / 0.14); }
  }
  .auth__panel { display: grid; place-items: center; padding: clamp(24px, 5vw, 64px); }
  .auth__form { width: min(400px, 100%); display: grid; gap: 18px;
    h1 { margin-top: 6px; }
    .muted { margin-top: 8px; }
    .small { display: flex; align-items: center; gap: 6px; justify-content: center; }
  }
  @media (width < 880px) {
    .auth { grid-template-columns: 1fr; }
    .auth__art { min-height: 200px; padding-block: 32px; .auth__features, h2 { display: none; } }
  }

  /* ---------- Startseite ---------- */
  .hero { padding-block: 12px 4px; display: grid; gap: 8px; }
  .tiles {
    display: grid; gap: clamp(14px, 2vw, 22px);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  }
  .tile {
    --tile: var(--brand);
    position: relative; isolation: isolate; overflow: hidden; container-type: inline-size;
    display: grid; grid-template-rows: auto 1fr auto; gap: 20px; min-height: clamp(260px, 32vw, 340px);
    padding: clamp(22px, 3vw, 32px); border-radius: var(--radius-xl); text-decoration: none; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
    &::before {
      content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.9; transition: opacity 0.35s;
      background:
        radial-gradient(420px 260px at 100% 0%, color-mix(in oklab, var(--tile) 22%, transparent), transparent 70%),
        radial-gradient(300px 200px at 0% 100%, color-mix(in oklab, var(--tile) 9%, transparent), transparent 70%);
    }
    &:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in oklab, var(--tile) 45%, var(--border)); }
    &:hover::before { opacity: 1; }
    &:hover .tile__arrow { background: var(--tile); color: white; translate: 4px 0; }
    &:active { transform: translateY(-1px) scale(0.99); }
    &.tile--payroll { --tile: oklch(0.6 0.16 250); }
    &.tile--absence { --tile: oklch(0.64 0.15 165); }
    &.tile--security { --tile: oklch(0.58 0.2 295); }
  }
  .tile__icon {
    display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; color: white;
    background: linear-gradient(135deg, color-mix(in oklab, var(--tile) 75%, white), var(--tile) 60%, color-mix(in oklab, var(--tile) 70%, black));
    box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.3), 0 12px 24px -8px color-mix(in oklab, var(--tile) 70%, transparent);
    .icon { width: 30px; height: 30px; }
  }
  .tile__body { display: grid; gap: 8px; align-content: start; }
  .tile__title { font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.65rem); font-weight: 720; letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance; }
  .tile__text { color: var(--muted); font-size: 0.95rem; max-width: 36ch; }
  .tile__meta { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 56px; }
  .tile__arrow {
    position: absolute; right: clamp(22px, 3vw, 32px); bottom: clamp(22px, 3vw, 32px);
    display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
    background: var(--surface-2); color: var(--text); transition: background 0.3s, color 0.3s, translate 0.3s var(--ease);
  }
  @container (width < 300px) { .tile__icon { width: 52px; height: 52px; } }

  /* ---------- Lohnunterlagen ---------- */
  .docgroups { display: grid; gap: 28px; }
  .docgroup__title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 1.05rem;
    span { font-size: 0.75rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; font-weight: 600; } }
  .doclist { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
  .doc {
    display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease);
    &:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
    &:has(.doc__main:focus-visible) { box-shadow: var(--ring); }
  }
  .doc__main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 6px; text-decoration: none; color: var(--text); border-radius: 10px;
    &:focus-visible { box-shadow: none; } }
  .doc__icon {
    --k: var(--c-urlaub);
    display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none;
    background: color-mix(in oklab, var(--k) 14%, var(--surface)); color: var(--k);
    &.doc__icon--lstb { --k: var(--violet); }
    &.doc__icon--dawe { --k: var(--teal); }
    &.doc__icon--dokument { --k: var(--muted); }
  }
  .doc__text { display: grid; min-width: 0; strong { font-weight: 650; } span { color: var(--muted); font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }

  /* ---------- PDF-Viewer ---------- */
  .viewer { display: grid; grid-template-rows: auto 1fr; height: 100dvh; background: light-dark(oklch(0.93 0.01 250), oklch(0.13 0.015 255)); }
  .viewer__bar {
    display: flex; align-items: center; gap: 12px; padding: 10px clamp(10px, 2vw, 20px); flex-wrap: wrap;
    background: color-mix(in oklab, var(--surface) 88%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); z-index: 2;
  }
  .viewer__left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 240px; }
  .viewer__title { display: grid; min-width: 0; line-height: 1.25; strong { font-size: 0.98rem; } span { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
  .viewer__center { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
  .viewer__right { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; justify-content: flex-end; flex-wrap: wrap; }
  .viewer__pages { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; color: var(--muted); padding-inline: 4px;
    input { width: 44px; height: 30px; text-align: center; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); -moz-appearance: textfield; &::-webkit-inner-spin-button { display: none; } } }
  .viewer__sep { width: 1px; height: 22px; background: var(--border-strong); margin-inline: 6px; }
  .viewer__zoom { min-width: 62px; height: 32px; border-radius: 8px; font-weight: 600; font-size: 0.85rem; &:hover { background: var(--surface); } }
  .viewer__stage { overflow: auto; position: relative; outline: none; overscroll-behavior: contain; }
  .viewer__pagesWrap { display: grid; justify-content: center; gap: 20px; padding: clamp(12px, 3vw, 32px); }
  .viewer__page { position: relative; background: white; border-radius: 4px; box-shadow: 0 1px 3px oklch(0 0 0 / 0.12), 0 12px 40px -8px oklch(0 0 0 / 0.25); overflow: hidden;
    canvas { width: 100%; height: 100%; }
    canvas + .textLayer { z-index: 1; }
  }
  /* Textebene nach pdf.js web/pdf_viewer.css (gekürzt), ermöglicht Markieren & Kopieren */
  .textLayer {
    color-scheme: only light; position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1;
    letter-spacing: normal; word-spacing: normal; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText;
    --min-font-size: 1;
    --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
    --min-font-size-inv: calc(1 / var(--min-font-size));
    :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; user-select: text; }
    > :not(.markedContent), .markedContent span:not(.markedContent) {
      z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height));
      --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv));
    }
    .markedContent { display: contents; }
    ::selection { background: color-mix(in srgb, AccentColor, transparent 50%); color: transparent; }
    br::selection { background: transparent; }
    .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
    &.selecting .endOfContent { top: 0; }
  }
  .viewer__loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-weight: 550; }
  @media (width < 760px) { .viewer__center { order: 3; width: 100%; justify-content: center; } .viewer__right .btn--ghost { display: none; } }
  @media print { .viewer__bar { display: none; } .viewer { height: auto; background: none; } .viewer__stage { overflow: visible; } .viewer__pagesWrap { padding: 0; gap: 0; } .viewer__page { box-shadow: none; break-after: page; } }

  /* ---------- Abwesenheiten ---------- */
  .yearnav { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
    select { appearance: none; border: 0; background: none; font-weight: 700; font-size: 1rem; padding: 4px 8px; text-align: center; cursor: pointer; } }

  .stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
  .stat {
    position: relative; padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); display: grid; gap: 4px;
    .stat__label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
    .stat__value { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; small { font-size: 0.9rem; color: var(--muted); font-weight: 600; letter-spacing: 0; } }
    .stat__hint { color: var(--muted); font-size: 0.78rem; }
    &.stat--hero { grid-column: span 2; background: linear-gradient(145deg, oklch(0.5 0.15 252), oklch(0.32 0.1 258)); color: white; border: 0;
      .stat__label, .stat__hint, small { color: oklch(1 0 0 / 0.75) !important; }
      @media (width < 560px) { grid-column: auto; } }
    button.stat__edit { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; }
  }
  .meter { height: 8px; border-radius: 99px; background: oklch(1 0 0 / 0.18); overflow: hidden; display: flex; margin-top: 10px;
    span { height: 100%; } .m-taken { background: white; } .m-planned { background: oklch(1 0 0 / 0.55); } .m-pending { background: repeating-linear-gradient(-45deg, oklch(1 0 0 / 0.5) 0 4px, transparent 4px 8px); } }

  .teamstats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .personcard { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); display: grid; gap: 12px;
    header { display: flex; align-items: center; gap: 10px; strong { flex: 1; } }
    dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
    dt { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
    dd { margin: 0; font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
    .neg { color: var(--red); }
    .note { font-size: 0.78rem; color: var(--muted); }
  }

  .panel { min-height: 200px; animation: fade 0.25s var(--ease); }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } }

  .months { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
  .month { padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
    &.is-current { border-color: color-mix(in oklab, var(--brand) 50%, var(--border)); box-shadow: 0 0 0 1px color-mix(in oklab, var(--brand) 30%, transparent); }
    h3 { font-size: 0.95rem; margin-bottom: 10px; display: flex; justify-content: space-between; span { color: var(--muted); font-weight: 500; font-size: 0.8rem; } }
  }
  .month__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .month__dow { font-size: 0.68rem; text-align: center; color: var(--muted); font-weight: 600; padding-bottom: 2px; }
  .day {
    position: relative; aspect-ratio: 1; display: grid; place-items: center; font-size: 0.78rem; border-radius: 8px; font-variant-numeric: tabular-nums;
    &.is-weekend { color: color-mix(in oklab, var(--muted) 70%, transparent); }
    &.is-holiday { background: var(--c-holiday); color: light-dark(oklch(0.45 0.1 70), oklch(0.88 0.08 80)); font-weight: 650; }
    &.is-today { box-shadow: inset 0 0 0 2px var(--brand); font-weight: 750; }
    &.has-abs { color: white; font-weight: 650; background: var(--abs); cursor: pointer; }
    &.has-abs.is-pending { background: repeating-linear-gradient(-45deg, var(--abs) 0 4px, color-mix(in oklab, var(--abs) 60%, white) 4px 8px); }
    &.has-abs.is-half { background: linear-gradient(135deg, var(--abs) 50%, color-mix(in oklab, var(--abs) 30%, var(--surface)) 50%); }
    &.has-type::before { content: ""; position: absolute; bottom: 3px; left: 50%; translate: -50% 0; width: 6px; height: 6px; border-radius: 50%; background: var(--type); box-shadow: 0 0 0 1.5px white; }
    &.is-multi::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: white; box-shadow: 0 0 0 1px var(--abs); }
    &.is-clickable:not(.has-abs):hover { background: var(--surface-2); cursor: pointer; }
  }

  .timeline { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .timeline__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); position: sticky; left: 0;
    h3 { font-size: 1rem; } }
  .timeline__grid { display: grid; grid-template-columns: 170px repeat(var(--days), minmax(28px, 1fr)); min-width: max-content; }
  .tl-cell { height: 46px; border-bottom: 1px solid var(--border); border-left: 1px solid color-mix(in oklab, var(--border) 60%, transparent); display: grid; place-items: center; font-size: 0.74rem; position: relative;
    &.is-weekend { background: var(--surface-2); }
    &.is-holiday { background: var(--c-holiday); }
    &.is-today { box-shadow: inset 2px 0 0 var(--brand), inset -2px 0 0 var(--brand); }
  }
  .tl-headcell { height: 52px; display: grid; place-content: center; text-align: center; line-height: 1.1; color: var(--muted); font-size: 0.72rem; border-left: 1px solid color-mix(in oklab, var(--border) 60%, transparent); border-bottom: 1px solid var(--border);
    strong { color: var(--text); font-size: 0.86rem; }
    &.is-weekend { background: var(--surface-2); } &.is-holiday { background: var(--c-holiday); } &.is-today strong { color: var(--brand); } }
  .tl-name { position: sticky; left: 0; z-index: 1; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 0 14px; font-weight: 600; font-size: 0.88rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
  .tl-bar { position: absolute; inset: 8px 1px; border-radius: 7px; background: var(--abs); cursor: pointer; transition: filter 0.15s;
    &.is-pending { background: repeating-linear-gradient(-45deg, var(--abs) 0 5px, color-mix(in oklab, var(--abs) 55%, white) 5px 10px); }
    &.is-start { left: 4px; } &.is-end { right: 4px; }
    &:hover { filter: brightness(1.1); }
    &.has-type::after { content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 7px; height: 7px; border-radius: 50%; background: var(--type); box-shadow: 0 0 0 1.5px white; } }

  .abslist { display: grid; gap: 10px; }
  .absrow {
    display: grid; grid-template-columns: 6px auto 1fr auto auto; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
    &:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
    .absrow__bar { width: 6px; align-self: stretch; border-radius: 6px; background: var(--abs); }
    .absrow__date { display: grid; text-align: center; min-width: 58px; line-height: 1.1; strong { font-size: 1.3rem; font-weight: 750; } span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; font-weight: 650; } }
    .absrow__main { display: grid; gap: 2px; min-width: 0; strong { font-weight: 650; } span { color: var(--muted); font-size: 0.85rem; } }
    .absrow__days { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .absrow__actions { display: flex; gap: 4px; }
  }
  @media (width < 640px) { .absrow { grid-template-columns: 6px 1fr auto; .absrow__date { display: none; } .absrow__actions { grid-column: 2 / -1; } } }

  .typegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .typeopt {
    position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-strong); cursor: pointer; font-size: 0.88rem; font-weight: 600;
    input { position: absolute; opacity: 0; }
    i { width: 12px; height: 12px; border-radius: 4px; background: var(--abs); flex: none; }
    &:hover { border-color: var(--abs); }
    &:has(input:checked) { border-color: var(--abs); background: color-mix(in oklab, var(--abs) 12%, var(--surface)); box-shadow: 0 0 0 1px var(--abs); }
    &:has(input:focus-visible) { box-shadow: var(--ring); }
  }
  .daycount { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--brand-soft);
    strong { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; color: var(--brand); } small { margin-left: auto; color: var(--muted); text-align: right; } }

  .legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; color: var(--muted);
    span { display: inline-flex; align-items: center; gap: 6px; } i { width: 12px; height: 12px; border-radius: 4px; background: var(--abs); }
    .legend__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-krank); box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 2.5px var(--border-strong); } }

  .popover { position: fixed; z-index: 60; width: 270px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 0.88rem; display: grid; gap: 8px; animation: pop 0.15s var(--ease);
    header { display: flex; gap: 8px; align-items: center; } .pop__actions { display: flex; gap: 6px; justify-content: flex-end; } }

  .reveal { display: grid; gap: 8px; }
  .reveal__code { font-size: 1.25rem; padding: 10px 14px; justify-self: start; background: var(--surface); cursor: copy; letter-spacing: 0.04em; }
}

@layer utilities {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
