@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

:root {
  --bg:       #0f0f0f;
  --surface:  #1a1a1a;
  --surface2: #222;
  --surface3: #2a2a2a;
  --border:   #2a2a2a;
  --text:     #e8e8e8;
  --muted:    #666;
  --accent:   #c8f55a;
  --blue:     #60a5fa;
  --green:    #06d6a0;
  --red:      #ff4d4d;
  --yellow:   #ffd166;
  --orange:   #ff8c42;
  --purple:   #a78bfa;
  --pink:     #f472b6;
  --money:    #4ade80;
  --sb-width: 220px;
}

/* ── LIGHT MODE ──────────────────────────────────── */
[data-theme="light"] {
  --bg:      #f0f0f0;
  --surface:  #ffffff;
  --surface2: #f5f5f5;
  --surface3: #ebebeb;
  --border:   #d8d8d8;
  --text:     #1a1a1a;
  --muted:    #777;
  --green:    #16a34a;
  --yellow:   #d97706;
  --red:      #dc2626;
  --blue:     #2563eb;
  --orange:   #ea580c;
  --purple:   #7c3aed;
  --pink:     #db2777;
  --money:    #16a34a;
}
/* Nav */
[data-theme="light"] .nav-item         { color: #555; }
[data-theme="light"] .nav-item:hover   { color: #1a1a1a; }
[data-theme="light"] .nav-item.active  { color: #4a7a00; background: rgba(74,122,0,.08); border-left-color: #4a7a00; }
[data-theme="light"] .sb-brand         { color: #4a7a00; }
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }
/* Badges – dunklere Farben + fett für Lesbarkeit */
[data-theme="light"] .badge            { font-weight: 600; }
[data-theme="light"] .badge-green      { background: rgba(22,163,74,.12);  color: #16a34a; }
[data-theme="light"] .badge-red        { background: rgba(220,38,38,.1);   color: #dc2626; }
[data-theme="light"] .badge-yellow     { background: rgba(217,119,6,.12);  color: #d97706; }
[data-theme="light"] .badge-blue       { background: rgba(37,99,235,.1);   color: #2563eb; }
[data-theme="light"] .badge-muted      { color: #555; }
/* Projekte Status-Selects */
[data-theme="light"] .pz-sel-offen     { background-color: rgba(220,38,38,.1);  color: #dc2626; }
[data-theme="light"] .pz-sel-arbeit    { background-color: rgba(217,119,6,.12); color: #d97706; }
[data-theme="light"] .pz-sel-erledigt  { background-color: rgba(22,163,74,.12); color: #16a34a; }
/* Projekte Projekt-Status-Badges */
[data-theme="light"] .b-offen          { background: rgba(220,38,38,.1);   color: #dc2626; }
[data-theme="light"] .b-arbeit         { background: rgba(217,119,6,.12);  color: #d97706; }
[data-theme="light"] .b-erledigt       { background: rgba(22,163,74,.12);  color: #16a34a; }
[data-theme="light"] .b-overdue        { background: rgba(234,88,12,.12);  color: #ea580c; }
[data-theme="light"] .b-delegiert      { background: rgba(37,99,235,.1);   color: #2563eb; }
/* Projekte Stat-Zahlen */
[data-theme="light"] .c-red            { color: #dc2626; }
[data-theme="light"] .c-yel            { color: #d97706; }
[data-theme="light"] .c-grn            { color: #16a34a; }
[data-theme="light"] .c-ora            { color: #ea580c; }
[data-theme="light"] .c-blu            { color: #2563eb; }
[data-theme="light"] .c-pur            { color: #9333ea; }
/* Active-Deleg Button */
[data-theme="light"] .active-deleg     { color: #2563eb !important; border-color: rgba(37,99,235,.4) !important; }

/* ── THEME TOGGLE ────────────────────────────────── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 3px 7px;
  line-height: 1;
  transition: border-color .15s;
}
.theme-toggle:hover { border-color: var(--accent); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  width: var(--sb-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow: hidden;
}

.sb-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.sb-brand {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.sb-ws {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13px;
  color: #bbb;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: 2px solid transparent;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  color: var(--accent);
  background: rgba(200,245,90,.06);
  border-left-color: var(--accent);
}

.nav-item span:first-child { font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: #ffd166;
  color: #1a1a1a;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}
.nav-section-dot {
  font-size: 9px;
  color: #ffd166;
  margin-left: 4px;
  line-height: 1;
}

.nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #aaa;
  padding: 14px 16px 4px;
  cursor: pointer;
  user-select: none;
}
.nav-section:hover { color: #ccc; }
[data-theme="light"] .nav-section { color: #666; }
[data-theme="light"] .nav-section:hover { color: #444; }
.nav-arrow { font-size: 9px; transition: transform .2s; }
.nav-section.collapsed .nav-arrow { transform: rotate(-90deg); }

.sb-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-user { font-size: 12px; color: var(--muted); }

.btn-logout {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.btn-logout:hover { color: var(--red); }

/* ── MAIN ────────────────────────────────────────── */
.main {
  margin-left: var(--sb-width);
  flex: 1;
  padding: 32px;
  max-width: 1440px;
  min-width: 0;
}

/* ── PAGE HEADER ─────────────────────────────────── */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 22px;
  font-weight: 600;
}

/* ── STATS GRID ──────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
}

.stat-card.accent { border-top: 2px solid var(--accent); }
.stat-card.blue   { border-top: 2px solid var(--blue); }
.stat-card.green  { border-top: 2px solid var(--green); }
.stat-card.orange { border-top: 2px solid var(--orange); }
.stat-card.purple { border-top: 2px solid var(--purple); }
.stat-card.pink   { border-top: 2px solid var(--pink); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.blue   .stat-value { color: var(--blue); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.purple .stat-value { color: var(--purple); }
.stat-card.pink   .stat-value { color: var(--pink); }

/* ── TABLE ───────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.table-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: 220px;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

td { padding: 12px 16px; vertical-align: middle; }

.td-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.td-actions .btn { flex-shrink: 0; }

/* ── BADGES ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green  { background: rgba(6,214,160,.15);  color: var(--green); }
.badge-red    { background: rgba(255,77,77,.15);   color: var(--red); }
.badge-yellow { background: rgba(255,209,102,.15); color: var(--yellow); }
.badge-muted  { background: var(--surface3);       color: var(--muted); }
.badge-blue   { background: rgba(96,165,250,.15);  color: var(--blue); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s;
}

.btn-primary {
  background: var(--accent);
  color: #0f0f0f;
  border-color: var(--accent);
}
.btn-primary:hover { background: #b8e040; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #444; }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: transparent;
}
.btn-danger:hover { background: rgba(255,77,77,.1); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ── FORM ────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

input[type=text], input[type=email], input[type=date],
input[type=number], input[type=tel], input[type=password],
textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── LOGIN PAGE ──────────────────────────────────── */
.login-wrap {
  flex: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  font-size: 32px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.login-error {
  background: rgba(255,77,77,.12);
  border: 1px solid rgba(255,77,77,.3);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
}

/* ── ALERTS ──────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}
.alert-success { background: rgba(6,214,160,.1); color: var(--green); }
.alert-error   { background: rgba(255,77,77,.1); color: var(--red); }

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── PFERDE STATUS ───────────────────────────────── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }

/* ── HAMBURGER ───────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  padding: 8px 10px;
  cursor: pointer;
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}
.sb-overlay.open { display: block; }

/* ── KALENDER ────────────────────────────────────── */
.cal-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cal-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.cal-filter-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 12px;
  user-select: none; transition: opacity .15s;
}
.cal-filter-item:has(input:not(:checked)) { opacity: .45; }
.cal-filter-item input[type=checkbox] { display: none; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.cal-dayname {
  background: var(--surface2);
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cal-day {
  background: var(--surface);
  min-height: 90px;
  padding: 6px 5px;
  overflow: hidden;
}
.cal-day.other-month { background: var(--surface2); opacity: .4; }
.cal-day.today .cal-daynum {
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-daynum { font-size: 12px; font-weight: 600; margin-bottom: 3px; color: var(--text); }
.cal-drop-hover { background: rgba(74,122,0,.10) !important; outline: 2px dashed var(--accent); outline-offset: -2px; }
.cal-event[draggable="true"] { cursor: grab; }
.cal-del-btn { color: inherit; opacity: 0; flex-shrink: 0; font-size: 13px; font-weight: 700; line-height: 1; text-decoration: none; border-radius: 2px; padding: 0 1px; transition: opacity .15s, background .15s; }
.cal-event:hover .cal-del-btn { opacity: 1; }
.cal-del-btn:hover { background: rgba(0,0,0,.25); opacity: 1; }
.cal-event {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  line-height: 1.5;
}
.ev-blue   { background: rgba(37,99,235,.18);  color: #60a5fa; }
.ev-green  { background: rgba(22,163,74,.16);  color: #06d6a0; }
.ev-red    { background: rgba(220,38,38,.18);  color: #ff4d4d; }
.ev-yellow { background: rgba(217,119,6,.18);  color: #ffd166; }
.ev-purple { background: rgba(147,51,234,.18); color: #c084fc; }
.ev-orange { background: rgba(234,88,12,.18);  color: #ff8c42; }
.ev-muted  { background: var(--surface3);      color: var(--muted); text-decoration: line-through; }
.ev-pink   { background: rgba(244,114,182,.28); color: #ff79c6; }
[data-theme="light"] .ev-blue   { background: rgba(37,99,235,.12); color: #2563eb; }
[data-theme="light"] .ev-green  { background: rgba(22,163,74,.12); color: #16a34a; }
[data-theme="light"] .ev-red    { background: rgba(220,38,38,.12); color: #dc2626; }
[data-theme="light"] .ev-yellow { background: rgba(217,119,6,.12); color: #d97706; }
[data-theme="light"] .ev-purple { background: rgba(147,51,234,.12);color: #9333ea; }
[data-theme="light"] .ev-orange { background: rgba(234,88,12,.12); color: #ea580c; }
[data-theme="light"] .ev-muted  { background: var(--surface3); color: var(--muted); }
[data-theme="light"] .ev-pink   { background: rgba(219,39,119,.12); color: #db2777; }

/* ── DROP ZONE ───────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover { border-color: #555; }
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(200,245,90,.07);
}
.drop-zone.has-file {
  border-color: var(--accent);
  color: var(--text);
}
.drop-zone label { color: var(--accent); cursor: pointer; }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .sb-header { padding-top: 14px; padding-left: 56px; }
  .main { margin-left: 0; padding: 16px; padding-top: 56px; }
  .form-row { grid-template-columns: 1fr; }
  .cal-day { min-height: 64px; padding: 4px 3px; }
  .cal-event { font-size: 9px; padding: 1px 3px; }
  .cal-dayname { font-size: 10px; padding: 6px 2px; }
}

/* ── FLATPICKR DARK/LIGHT THEME ──────────────────── */
.flatpickr-calendar { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday { background: var(--surface); color: var(--text); }
.flatpickr-current-month, .flatpickr-current-month .numInputWrapper { color: var(--text); }
.flatpickr-current-month input.cur-year, .flatpickr-current-month .flatpickr-monthDropdown-months { color: var(--text); background: var(--surface); }
.flatpickr-day { color: var(--text); border-radius: 6px; }
.flatpickr-day:hover { background: var(--surface3); border-color: var(--surface3); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--accent); border-color: var(--accent); color: #111; }
.flatpickr-day.today { border-color: var(--accent); }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--muted); }
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: var(--text); }
.numInput { color: var(--text); background: var(--surface); }
