/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;
  --white: #FFFFFF;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --success: #059669;
  --success-light: #F0FDF4;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --transition: 150ms ease;
  --sidebar-width: 220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === Login Screen === */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--slate-800);
  color: var(--white);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--slate-800);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--slate-400);
  margin-bottom: 32px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 6px;
}

.login-field .input {
  width: 100%;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}

.login-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

.btn-logout {
  margin-left: 12px;
  color: var(--slate-400);
}

.btn-logout:hover {
  color: var(--slate-600);
}

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--slate-100);
}

.logo {
  width: 32px;
  height: 32px;
  background: var(--slate-800);
  color: var(--white);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.logo-text {
  font-weight: 600;
  font-size: 16px;
  color: var(--slate-800);
}

.sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--slate-500);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-item:hover {
  background: var(--slate-50);
  color: var(--slate-700);
}

.nav-item.active {
  background: var(--slate-100);
  color: var(--slate-900);
}

.nav-item svg {
  flex-shrink: 0;
}

/* === Main Content === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--slate-900);
}

.revenue-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.revenue-label {
  font-size: 11px;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.revenue-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
}

/* === Views === */
.view {
  display: none;
  padding: 24px 32px;
  flex: 1;
}

.view.active {
  display: block;
}

/* === Overview Header === */
.overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* === Overview (Gantt) === */
.overview-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Table layout: fixed left + scrollable right */
.ov-table {
  display: flex;
}

.ov-fixed {
  width: 180px;
  min-width: 180px;
  border-right: 1px solid var(--slate-200);
  z-index: 2;
  background: var(--white);
}

.ov-fixed-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--slate-100);
}

.ov-fixed-header {
  height: 52px;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-500);
}

.ov-fixed-capacity {
  height: 36px;
}

.ov-fixed-project {
  height: 44px;
}

.ov-fixed-project:last-child {
  border-bottom: none;
}

.ov-weeks {
  flex: 1;
  min-width: 0;
}

.ov-row {
  display: flex;
}

.ov-cell-flex {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--slate-100);
}

/* KW Headers */
.ov-row-header .ov-cell-flex {
  height: 52px;
}

.ov-kw-header {
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-400);
  padding: 6px 2px;
}

.ov-kw-header.current {
  background: var(--slate-800);
  color: var(--white);
  border-radius: 6px;
}

.ov-month {
  font-size: 9px;
  opacity: 0.6;
}

.ov-kw-header.current .ov-month {
  opacity: 0.8;
}

/* Capacity */
.ov-row-capacity .ov-cell-flex {
  height: 36px;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
}

.capacity-bar {
  width: 100%;
  height: 4px;
  background: var(--slate-200);
  border-radius: 2px;
  overflow: hidden;
}

.capacity-bar-fill {
  height: 100%;
  background: var(--slate-400);
  border-radius: 2px;
  transition: width var(--transition);
}

.capacity-bar-fill.overbooked {
  background: var(--danger);
}

.capacity-text {
  font-size: 10px;
  color: var(--slate-400);
}

.capacity-text.overbooked {
  color: var(--danger);
  font-weight: 600;
}

/* Project rows */
.ov-row-project .ov-cell-flex {
  height: 44px;
  padding: 0 1px;
}

.ov-row-project:last-child .ov-cell-flex {
  border-bottom: none;
}

.project-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-label-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.project-label-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-label-client {
  font-size: 11px;
  color: var(--slate-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-bar {
  height: 24px;
  border-radius: 4px;
  width: 100%;
  opacity: 0.2;
}

.overview-bar.bar-start {
  border-radius: 4px 0 0 4px;
  margin-left: 2px;
}

.overview-bar.bar-middle {
  border-radius: 0;
}

.overview-bar.bar-end {
  border-radius: 0 4px 4px 0;
  margin-right: 2px;
}

.overview-bar.bar-single {
  border-radius: 4px;
  margin: 0 2px;
}

.overview-empty {
  padding: 48px;
  text-align: center;
  color: var(--slate-400);
}

/* === Weekplan === */
.weekplan-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.kw-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 16px;
  color: var(--slate-800);
}

.kw-selector input {
  width: 56px;
  text-align: center;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 6px 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-800);
  background: var(--white);
}

.kw-selector input:focus {
  outline: none;
  border-color: var(--slate-400);
}

.weekplan-grid-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.weekplan-grid {
  display: grid;
  grid-template-columns: 100px repeat(5, 1fr);
  grid-template-rows: auto;
}

.weekplan-cell {
  padding: 12px;
  border-bottom: 1px solid var(--slate-100);
  border-right: 1px solid var(--slate-100);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weekplan-cell:last-child {
  border-right: none;
}

.weekplan-cell.time-label {
  background: var(--slate-50);
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-500);
  justify-content: flex-start;
  padding-left: 16px;
}

.weekplan-cell.day-header {
  background: var(--slate-50);
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  padding: 14px 12px;
  border-bottom: 2px solid var(--slate-200);
}

.weekplan-cell.corner {
  background: var(--slate-50);
  border-bottom: 2px solid var(--slate-200);
}

.weekplan-slot {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.weekplan-slot .slot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.weekplan-slot .slot-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weekplan-cell.empty-slot {
  background: var(--white);
}

.weekplan-overbooked {
  background: var(--danger-light);
  border: 1px dashed var(--danger);
  color: var(--danger);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  text-align: center;
}

/* Weekplan Summary */
.weekplan-summary {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.weekplan-summary h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--slate-100);
}

.summary-card .summary-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.summary-card .summary-info {
  flex: 1;
  min-width: 0;
}

.summary-card .summary-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card .summary-detail {
  font-size: 11px;
  color: var(--slate-400);
}

.summary-card .summary-hours {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  white-space: nowrap;
}

.weekplan-capacity-bar {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.weekplan-capacity-bar .cap-bar {
  flex: 1;
  height: 8px;
  background: var(--slate-100);
  border-radius: 4px;
  overflow: hidden;
}

.weekplan-capacity-bar .cap-fill {
  height: 100%;
  background: var(--slate-400);
  border-radius: 4px;
  transition: width 300ms ease;
}

.weekplan-capacity-bar .cap-fill.overbooked {
  background: var(--danger);
}

.weekplan-capacity-bar .cap-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  white-space: nowrap;
}

.weekplan-capacity-bar .cap-text.overbooked {
  color: var(--danger);
}

.weekplan-empty {
  text-align: center;
  padding: 48px;
  color: var(--slate-400);
}

/* === Projects Table === */
.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.projects-filters {
  display: flex;
  gap: 8px;
}

.projects-table-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.projects-table {
  width: 100%;
  border-collapse: collapse;
}

.projects-table thead th {
  background: var(--slate-50);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
}

.projects-table tbody tr {
  border-bottom: 1px solid var(--slate-100);
  transition: background var(--transition);
}

.projects-table tbody tr:hover {
  background: var(--slate-50);
}

.projects-table tbody tr:last-child {
  border-bottom: none;
}

.projects-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--slate-700);
  white-space: nowrap;
}

.projects-table .color-cell {
  width: 36px;
  padding-right: 0;
}

.table-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.table-project-name {
  font-weight: 500;
  color: var(--slate-900);
}

.table-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.table-status.status-offen {
  background: var(--slate-100);
  color: var(--slate-600);
}

.table-status.status-bestaetigt {
  background: #ECFDF5;
  color: #065F46;
}

.table-status.status-abgeschlossen {
  background: var(--slate-100);
  color: var(--slate-400);
}

.table-status.status-storniert {
  background: var(--danger-light);
  color: var(--danger);
}

.table-actions {
  display: flex;
  gap: 4px;
}

.projects-empty {
  text-align: center;
  padding: 48px;
  color: var(--slate-400);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--slate-800);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--slate-900);
}

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
}

.btn-secondary:hover {
  background: var(--slate-200);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #B91C1C;
}

.btn-icon {
  padding: 6px;
  background: var(--slate-100);
  color: var(--slate-600);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--slate-200);
  color: var(--slate-800);
}

.btn-ghost {
  background: none;
  color: var(--slate-500);
  padding: 4px 8px;
}

.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

/* === Inputs === */
.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--slate-800);
  background: var(--white);
  transition: border-color var(--transition);
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--slate-400);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 520px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-small {
  width: 400px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--slate-900);
}

.delete-message {
  color: var(--slate-600);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

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

/* === Form === */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 4px;
}

.color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--slate-800);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--slate-800);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .view {
    padding: 16px;
  }

  .header {
    padding: 16px;
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}
