/* =========================================================================
   Zeiterfassung – Premium UI
   Ruhige Ivory/Anthrazit-Palette, feine Serif-Display-Typografie,
   Haarlinien, grosszuegiger Weissraum.
   ========================================================================= */

:root {
  /* Dark-Brand nach productionbundle.ch: fast schwarz + Neon-Violett, Archivo */
  --paper:      #0A0A0A;   /* fast schwarz */
  --paper-2:    #101013;   /* Felder, Hover, Flächen */
  --card:       #151519;   /* Karten */
  --ink:        #FAFAF8;   /* warmweisser Text */
  --ink-2:      #B7B3AC;   /* sekundär */
  --muted:      #7C776E;   /* gedämpft */
  --line:       #24232A;   /* Haarlinie */
  --line-2:     #34323C;
  --accent:     #B45CFF;   /* Neon-Violett (rgb 180,92,255) */
  --accent-ink: #D9B8FF;   /* helleres Violett für Text/Badges */
  --accent-soft:#1E1630;   /* dunkler Violett-Tint */
  --ok:         #64E39A;
  --ok-soft:    #122A1E;
  --warn:       #F0B46A;
  --warn-soft:  #2A2011;
  --danger:     #FF8A80;
  --danger-soft:#2E1616;
  --shadow:     0 1px 2px rgba(0,0,0,.45), 0 20px 55px -22px rgba(0,0,0,.75);
  --radius:     6px;
  --radius-sm:  5px;
  --sans: "Archivo", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Archivo", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.022em; }
a { color: var(--accent-ink); }
button { font-family: inherit; }

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------- Layout -------------------------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 28px; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 82%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 6px;
  border: 1px solid var(--line-2);
  display: grid; place-items: center;
  background: var(--card);
  font-family: var(--serif); font-weight: 800; font-size: 22px; color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(180,92,255,.14), 0 0 22px -6px rgba(180,92,255,.4);
}
.brand .title { font-family: var(--serif); font-size: 20px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; text-shadow: 0 0 20px rgba(180, 92, 255, .35); }
.brand .sub { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.userchip { display: flex; align-items: center; gap: 14px; }
.userchip .who { text-align: right; }
.userchip .who .nm { font-weight: 600; font-size: 14px; }
.userchip .who .rl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--serif); font-size: 18px;
}

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 6px; }
.tab {
  background: none; border: none; cursor: pointer;
  padding: 16px 18px; font-size: 14px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 40px 0 96px; }

/* ------------------------------- Cards --------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 28px 30px; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px;
}
.section-head h2 { font-family: var(--serif); font-size: 30px; font-weight: 800; text-transform: uppercase; letter-spacing: -0.005em; }
.vio { color: var(--accent); text-shadow: 0 0 20px rgba(180,92,255,.5); }
.section-head .lead { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px;
}
.kpi .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 16px; color: var(--muted); font-family: var(--sans); }
.kpi .foot { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.kpi.accent { background: var(--accent-soft); border-color: #3A2A55; box-shadow: inset 0 0 0 1px rgba(180,92,255,.08); }
.kpi.accent .value { color: #EBDCFF; }

/* --------------------------- Month navigator --------------------------- */
.monthnav { display: flex; align-items: center; gap: 14px; }
.monthnav .mlabel { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; min-width: 190px; text-align: center; }

/* ------------------------------ Table ---------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.table td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tr.row-hover:hover { background: var(--paper-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.daycell .dow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.daycell .dnum { font-family: var(--serif); font-size: 19px; }
.tasks-cell { color: var(--ink-2); font-size: 13.5px; max-width: 320px; }
.weekend td { background: color-mix(in srgb, var(--paper) 60%, transparent); }

/* ------------------------------ Badges --------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; letter-spacing: .04em; font-weight: 600;
  padding: 4px 10px; border-radius: 4px; border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.draft { color: var(--ink-2); background: var(--paper-2); border-color: var(--line-2); }
.badge.submitted { color: var(--accent-ink); background: var(--accent-soft); border-color: #3A2A55; }
.badge.approved { color: var(--ok); background: var(--ok-soft); border-color: #1E3A2A; }
.badge.rejected { color: var(--danger); background: var(--danger-soft); border-color: #3A1E1E; }

.flag {
  display: block; font-size: 12px; color: var(--warn);
  background: var(--warn-soft); border: 1px solid #3A2E18;
  padding: 7px 10px; border-radius: 4px; margin-top: 8px;
}

/* ------------------------------ Buttons -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  padding: 10px 18px; border-radius: 6px; font-size: 14px; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease, color .15s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #0A0A0A; border-color: var(--ink); }
.btn.primary:hover { background: #fff; border-color: #fff; }
.btn.gold { background: #7C3AED; color: #fff; border-color: #7C3AED; box-shadow: 0 0 22px -6px rgba(180,92,255,.65); }
.btn.gold:hover { background: #6D28D9; border-color: #6D28D9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: 10px; }
.btn.ghost:hover { color: var(--ink); background: var(--paper-2); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: #E6CBC6; background: var(--danger-soft); }
.btn.danger:hover { background: #ecd4cf; }
.btn.ok { color: #07160E; background: var(--ok); border-color: var(--ok); font-weight: 600; }
.btn.ok:hover { background: #4fce86; border-color: #4fce86; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 38px; height: 38px; padding: 0; border-radius: 6px; }

.row { display: flex; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.gap-sm { gap: 8px; }

/* ------------------------------ Forms ---------------------------------- */
label.field { display: block; margin-bottom: 16px; }
label.field .lbl { display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 7px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 11px 13px; transition: border-color .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: #1A1A20;
  box-shadow: 0 0 0 3px rgba(180,92,255,.18);
}
/* Autofill (Chrome): dunkler Hintergrund + heller Text statt invertiert */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #15151A inset;
  caret-color: var(--ink);
  transition: background-color 9999s ease-in-out 0s;
}
textarea { resize: vertical; min-height: 72px; }
/* Native Datum/Zeit-Felder an den Stil angleichen (Bronze-Akzent) */
input { accent-color: var(--accent); }
input[type="date"], input[type="time"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .4; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: .85; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ------------------------------ Modal ---------------------------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.72);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px; z-index: 80;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 540px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 30px 32px; max-height: 90vh; overflow: auto;
  animation: pop .18s cubic-bezier(.2,.7,.3,1);
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { font-family: var(--serif); font-size: 26px; margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ------------------------- Auth (Login/Setup) -------------------------- */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-aside {
  background:
    radial-gradient(120% 90% at 15% 8%, rgba(180,92,255,.18), transparent 55%),
    #070708;
  color: #FAFAF8;
  border-right: 1px solid var(--line);
  padding: 64px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
/* Original-Schriftzug wie productionbundle.ch: PRODUCTION weiss gefüllt,
   BUNDLE als weisse Outline mit violettem Neon-Glow */
.auth-aside .mark-lg { font-family: var(--serif); font-size: 42px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; text-transform: uppercase; color: #FAFAF8; }
.auth-aside .mark-lg .vio {
  color: transparent;
  -webkit-text-stroke: 1.4px #FAFAF8;
  text-shadow: 0 0 16px rgba(180,92,255,.9), 0 0 38px rgba(139,44,255,.6);
}
.auth-aside h1 { font-family: var(--serif); font-size: 52px; line-height: 1.0; font-weight: 800; letter-spacing: -0.02em; margin-top: 8px; }
.auth-aside .tag { color: #C9C2B4; font-size: 15px; max-width: 420px; margin-top: 22px; line-height: 1.6; }
.auth-aside .legal { font-size: 12.5px; color: #938C7F; border-top: 1px solid #332F28; padding-top: 20px; }
.auth-main { display: grid; place-items: center; padding: 48px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--serif); font-size: 30px; font-weight: 800; text-transform: uppercase; letter-spacing: -0.01em; margin-bottom: 6px; }
.auth-aside .brandsub { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; }

/* ------------------------------ Misc ----------------------------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 24px; color: var(--ink-2); margin-bottom: 6px; }
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--ink); color: var(--paper-2); padding: 13px 20px; border-radius: 7px;
  box-shadow: var(--shadow); font-size: 14px; animation: pop .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.divider { height: 1px; background: var(--line); margin: 26px 0; }
.appfoot { border-top: 1px solid var(--line); padding: 22px 0 40px; margin-top: 40px; }
.appfoot .wrap { font-size: 12px; letter-spacing: .04em; color: var(--muted); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.hint { font-size: 12.5px; color: var(--muted); }
.spin { width: 34px; height: 34px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.center-screen { min-height: 100vh; display: grid; place-items: center; }

/* ------------------------------ Report --------------------------------- */
.report { background: #fff; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 22px; }
.report-head .r-title { font-family: var(--serif); font-size: 32px; font-weight: 800; text-transform: uppercase; letter-spacing: -0.005em; }
.report-meta { font-size: 13px; color: var(--ink-2); }
.report-meta b { color: var(--ink); }
.sign-row { display: flex; gap: 60px; margin-top: 54px; }
.sign-row .sign { flex: 1; border-top: 1px solid var(--ink); padding-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------------------------- Responsive ------------------------------- */
@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wrap { padding: 0 16px; }
  .hide-sm { display: none; }
  .tasks-cell { max-width: 160px; }
}

/* ------------------------- iPhone / Smartphone ------------------------- */
@media (max-width: 680px) {
  body { overflow-x: hidden; }

  /* Header kompakt */
  .topbar .wrap { height: auto; min-height: 58px; padding-top: 9px; padding-bottom: 9px; gap: 8px; }
  .brand { gap: 10px; }
  .brand .mark { width: 34px; height: 34px; font-size: 20px; }
  .brand .title { font-size: 16px; letter-spacing: .01em; }
  .brand .sub { display: none; }
  .userchip { gap: 8px; }
  .userchip .who { display: none; }
  #pwBtn { display: none; }

  /* Tabs horizontal scrollbar */
  nav.tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 14px 12px; }

  main { padding: 22px 0 56px; }
  .section-head { flex-wrap: wrap; row-gap: 12px; }
  .section-head h2 { font-size: 25px; }
  .monthnav { margin-left: auto; }
  .monthnav .mlabel { min-width: 0; font-size: 17px; }

  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .kpi { padding: 15px 15px; }
  .kpi .value { font-size: 25px; }

  .spread { flex-wrap: wrap; row-gap: 10px; }
  .card.pad { padding: 20px 16px; }

  /* Tabellen als gestapelte Karten */
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: none; }
  table.stack td { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 6px 16px; border: none; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; text-align: left; white-space: nowrap; }
  table.stack td.daycell { justify-content: flex-start; padding-top: 12px; font-weight: 600; }
  table.stack td.daycell::before { content: none; }
  table.stack td.daycell .dow { display: inline; color: var(--accent-ink); margin-right: 8px; }
  table.stack td.daycell .dnum { display: inline; font-size: 16px; }
  table.stack td.tasks-cell { max-width: none; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td .row { justify-content: flex-end; }

  /* Breite Tabellen (Rapport, Team) horizontal scrollen */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 600px; }

  /* Login mobil: kompakte Marke oben */
  .auth-main { padding: 28px 20px; }
  .auth-card .mobile-brand { display: block; }

  /* Dialog mobil */
  .overlay { padding: 12px; }
  .modal { padding: 24px 18px; max-height: 92vh; }
  .modal h3 { font-size: 23px; }
}
.mobile-brand { display: none; font-family: var(--serif); font-weight: 800; font-size: 20px; letter-spacing: .02em; text-transform: uppercase; margin-bottom: 26px; }

/* ------------------------------ Print ---------------------------------- */
@media print {
  @page { margin: 16mm; }
  /* Dark-UI am Bildschirm, aber Rapport druckt immer hell und lesbar */
  body { background: #fff !important; color: #111 !important; font-size: 12px; }
  .no-print { display: none !important; }
  .card, .report { box-shadow: none !important; border: none !important; background: #fff !important; }
  .report, .report * { color: #111 !important; text-shadow: none !important; }
  .report .muted, .report .hint { color: #555 !important; }
  .report .kpi { border: 1px solid #ddd !important; background: #fff !important; }
  .report .kpi.accent { background: #f4eefb !important; }
  .report .table th, .report .table td { border-color: #ddd !important; }
  .report .report-head { border-bottom-color: #111 !important; }
  .report .sign { border-top-color: #111 !important; }
  .badge { color: #111 !important; background: #fff !important; border: 1px solid #bbb !important; }
  .table th, .table td { padding: 8px 8px; }
}
