/* =========================================================================
   MyTimeBoard – Design-Tokens & Komponenten
   Aus DESIGN.md (§3). Ein Akzent, ruhig, werkzeughaft. Light + Dark.
   Fonts lokal (DSGVO) – kein Google-CDN. Inter optional via @font-face.
   ========================================================================= */

/* Inter lokal (DSGVO – kein Google/CDN zur Laufzeit). woff2 unter /assets/fonts.
   Fallback bleibt der System-Sans-Stack, falls Dateien fehlen. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: local('Inter'), url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: local('Inter Medium'), url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: local('Inter SemiBold'), url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: local('Inter Bold'), url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  /* Farben – Light */
  --bg:            #F7F8FA;
  --surface:       #FFFFFF;
  --surface-2:     #FBFBFC;
  --text:          #16181D;
  --text-secondary:#6B7280;
  --text-muted:    #9AA1AD;
  --border:        #ECEEF1;
  --border-strong: #E4E6EA;
  --accent:        #3B5BDB;
  --accent-hover:  #324FC4;
  --accent-weak:   #EEF1FD;
  --success:       #16A34A;
  --success-weak:  #E9F7EF;
  --danger:        #E5484D;
  --danger-weak:   #FDECEC;
  --warn:          #B45309;

  /* Typo */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Form & Raum */
  --radius-sm: 6px;
  --radius:    9px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow:    0 4px 14px rgba(16,24,40,.08);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
  --ring:      0 0 0 3px rgba(59,91,219,.18);

  --sidebar-w: 228px;
}

:root[data-theme="dark"] {
  --bg:            #0E1014;
  --surface:       #171A21;
  --surface-2:     #1C2027;
  --text:          #ECEEF2;
  --text-secondary:#9AA1AD;
  --text-muted:    #6B7280;
  --border:        #262B33;
  --border-strong: #323843;
  --accent:        #5B79F0;
  --accent-hover:  #6E89F5;
  --accent-weak:   #1C2340;
  --success:       #2FB76A;
  --success-weak:  #14271C;
  --danger:        #F26269;
  --danger-weak:   #2A1719;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 14px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
input, button, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::placeholder { color: var(--text-muted); }
a { color: inherit; text-decoration: none; }
.tnum { font-variant-numeric: tabular-nums; }

/* Scrollbar */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid var(--bg); }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; width: 100%; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 16px 12px;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { flex: 1; overflow-y: auto; padding: 24px; }
.content-narrow { max-width: 1100px; margin: 0 auto; }

/* Brand */
.brand { display: flex; align-items: center; gap: 9px; padding: 8px 10px 18px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-mark span { width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; position: relative; }
.brand-mark span::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 1.5px; height: 4px; background: #fff;
  transform-origin: bottom; transform: translate(-50%,-100%) rotate(40deg);
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }

/* Nav */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-weak); color: var(--accent); }
.nav-item svg { flex: none; }
.nav-sep { height: 1px; background: var(--border); margin: 14px 4px; }
.nav-spacer { flex: 1; }
.nav-cta {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: #fff; background: var(--accent);
}
.nav-cta:hover { background: var(--accent-hover); }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent);
  padding: 2px 6px; border-radius: 5px;
}

/* User chip */
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px; border-top: 1px solid var(--border); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; }
.user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta { font-size: 11px; color: var(--text-muted); }

/* ---------- Timer-Bar ---------- */
.timerbar {
  flex: none; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 24px; display: flex; align-items: center; gap: 14px; z-index: 30;
}
.timerbar input.desc { flex: 1; min-width: 0; border: none; outline: none; font-size: 15px; font-weight: 500; background: transparent; padding: 8px 4px; }
.timer-clock { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.timer-amount { font-size: 13px; color: var(--text-secondary); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: mtb-pulse 1.6s infinite; }
@keyframes mtb-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--text-muted); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / Panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { color: var(--text-secondary); font-size: 13px; }

/* ---------- Chips & Badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; background: var(--bg); color: var(--text-secondary); }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; }
.badge-manual { background: var(--accent-weak); color: var(--accent); }
.badge-edited { background: var(--warn); color: #fff; background: #FEF3C7; color: var(--warn); }
.badge-invoiced { background: var(--bg); color: var(--text-muted); }
.badge-running { background: var(--accent-weak); color: var(--accent); }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }
.textarea { resize: vertical; min-height: 72px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Toggle */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.toggle .thumb { position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track + .thumb { transform: translateX(16px); }

/* ---------- Modal / Overlay ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .15s; }
.overlay.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; transform: translateY(8px); transition: transform .15s; }
.overlay.open .modal { transform: none; }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 0; }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px 16px; font-size: 13px; min-width: 260px;
  animation: mtb-slide .2s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes mtb-slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Empty States ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty svg { margin-bottom: 12px; opacity: .5; }

/* ---------- Utilities ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-top: 0; margin-bottom: 16px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 17px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.right { text-align: right; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.hidden { display: none !important; }
.accent { color: var(--accent); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

@media (max-width: 920px) {
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 90; transition: left .2s; }
  .sidebar.open { left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Fokus-Ansicht ---------- */
.focus-capture {
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); padding: 22px; margin-bottom: 22px; transition: border-color .15s, background .15s;
}
.focus-capture.drag-over { border-color: var(--accent); background: var(--accent-weak); }
.focus-capture.empty-zone { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px; min-height: 96px; }
.focus-capture .running-clock { font-size: 38px; font-weight: 700; letter-spacing: -.02em; }
.focus-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.focus-col h3 { font-size: 13px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.task-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 12px 13px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  display: flex; gap: 10px; align-items: flex-start; cursor: grab;
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card.dragging { opacity: .5; }
.task-times { font-variant-numeric: tabular-nums; font-size: 12px; line-height: 1.35; flex: none; }
.task-times .tracked { font-weight: 700; }
.task-times .est { color: var(--text-muted); }
.task-main { min-width: 0; flex: 1; }
.task-title { font-weight: 600; font-size: 13.5px; }
.task-actions { display: flex; gap: 4px; flex: none; }
.task-fav.active { color: #F59E0B; }
.done-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.done-row .title { text-decoration: line-through; color: var(--text-muted); flex: 1; }

/* ---------- Board ---------- */
.board-wrap { overflow-x: auto; }
.board-grid { display: grid; min-width: 720px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.board-head { display: contents; }
.board-col-head { padding: 10px; text-align: center; font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.board-col-head:first-child { border-left: none; }
.board-col-head.today { color: var(--accent); background: var(--accent-weak); }
.board-day { border-left: 1px solid var(--border); min-height: 420px; padding: 8px; }
.board-day:first-child { border-left: none; }
.board-block { border-radius: var(--radius-sm); padding: 7px 9px; margin-bottom: 6px; color: #fff; font-size: 12px; box-shadow: var(--shadow-sm); }
.board-block .b-dur { font-variant-numeric: tabular-nums; opacity: .9; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; }
.auth-pitch { text-align: center; color: var(--text-secondary); font-size: 13.5px; margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-secondary); }
.auth-foot a { color: var(--accent); font-weight: 600; }

/* Progress bar */
.progress { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Stepper */
.stepper { display: flex; gap: 8px; margin-bottom: 20px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.step .num { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.step.active { color: var(--accent); }
.step.active .num { background: var(--accent); border-color: var(--accent); color: #fff; }
