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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #F0F0F0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #1A1A1A;
}

button { font-family: inherit; cursor: pointer; }

/* ============================================================
   NAVBAR
============================================================ */
#nav {
  background: #fff;
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  border-bottom: 1px solid #E0E0E0;
  box-shadow: 0 1px 8px rgba(0,0,0,.03);
  flex-shrink: 0;
  z-index: 200;
  position: relative;
}

.logo {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 800;
  color: #2B3454;
  letter-spacing: 1.5px;
  flex-shrink: 0;
  text-decoration: none;
}

.sep { width: 1px; height: 24px; background: #E0E0E0; flex-shrink: 0; }

.nav-title { font-size: 13px; font-weight: 600; color: #333; line-height: 1.1; }
.nav-sub   { font-size: 10px; color: #999; margin-top: 2px; }

/* Shared nav links */
.back-link, .nav-settings-link {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid #E0E0E0;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.back-link:hover, .nav-settings-link:hover {
  background: #F4F4F4;
  color: #2B3454;
}

/* Navbar layout groups */
.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Week navigation buttons */
.nav-btn {
  background: #F2F2F2;
  border: 1px solid #D8D8D8;
  border-radius: 7px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  color: #444;
  transition: background .12s;
}
.nav-btn:hover { background: #E4E4E4; }

.nav-today {
  background: #EF7E56;
  color: #fff;
  border-color: #EF7E56;
  font-size: 10px;
  padding: 4px 10px;
}
.nav-today:hover { opacity: .85; }

.window-label {
  font-size: 11px;
  font-weight: 700;
  color: #2B3454;
  white-space: nowrap;
  min-width: 150px;
  text-align: center;
  letter-spacing: .2px;
}

/* Sync controls */
.sync-btn {
  background: #2B3454;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: opacity .15s;
}
.sync-btn:hover   { opacity: .85; }
.sync-btn:disabled { opacity: .45; cursor: default; }

.sync-status { font-size: 10px; font-weight: 600; }

/* Legend dots */
.leg  { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #777; }
.ldot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ============================================================
   UTILISATION PANEL
============================================================ */
#util-wrap {
  background: #fff;
  border-bottom: 1px solid #E0E0E0;
  flex-shrink: 0;
}

#util-hdr {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  background: #FAFAFA;
  border-bottom: 1px solid #E8E8E8;
}

#util-hdr > span {
  font-size: 9px;
  font-weight: 600;
  color: #888;
  letter-spacing: .8px;
  text-transform: uppercase;
}

#util-toggle {
  background: none;
  border: 1px solid #DDD;
  border-radius: 5px;
  padding: 1px 8px;
  font-size: 9px;
  color: #888;
  font-weight: 600;
}

#util-body   { overflow: hidden; transition: height .2s ease; }
#util-inner  { display: flex; overflow: hidden; }

#util-corner {
  width: 340px;
  flex-shrink: 0;
  background: #FAFAFA;
  border-right: 1px solid #E0E0E0;
  padding: 0 10px;
}

#util-timeline { position: relative; overflow: hidden; flex: 1; }

.util-person-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
}
.util-pdot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.util-pname { font-size: 10px; font-weight: 600; color: #555; white-space: nowrap; text-decoration: none; cursor: pointer; }
.util-pname:hover { color: #2B3454; text-decoration: underline; }

/* Empty-state in util */
.util-empty {
  font-size: 9px;
  color: #BBB;
  padding: 10px 8px;
  font-style: italic;
}

/* ============================================================
   GANTT WRAPPER (scrolls both axes)
============================================================ */
#gantt-wrap {
  flex: 1;
  overflow: auto;
  background: #F0F0F0;
}

/* ============================================================
   GANTT HEADER (sticky top)
============================================================ */
#gantt-hdr {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 2px solid #E0E0E0;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

#gantt-corner {
  width: 340px;
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 55;
  background: #fff;
  border-right: 1px solid #E0E0E0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
}

#gantt-corner > button {
  background: #F0F0F0;
  border: 1px solid #D8D8D8;
  border-radius: 6px;
  color: #555;
  font-size: 10px;
  padding: 2px 7px;
  font-weight: 700;
}

.corner-lbl {
  color: #AAA;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* KW row */
.kw-row  { display: flex; height: 22px; border-bottom: 1px solid #E8E8E8; background: #F7F7F7; }
.kw-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: none;
  font-size: 10px;
  font-weight: 700;
  color: #EF7E56;
  letter-spacing: .5px;
  flex-shrink: 0;
}

/* Day row */
.day-row  { display: flex; height: 30px; background: #fff; }
.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #EBEBEB;
  font-size: 9px;
  color: #BBBBBB;
  flex-shrink: 0;
  line-height: 1.2;
}
.day-cell b   { font-size: 10px; font-weight: 700; color: #999; }
.day-cell.tod { background: #EF7E56; color: #fff; }
.day-cell.tod b { color: #fff; }

/* ============================================================
   TODAY LINE
============================================================ */
.today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(239,126,86,.65);
  z-index: 5;
  pointer-events: none;
}

/* ============================================================
   LEFT STICKY COLUMN
============================================================ */
.lc {
  flex-shrink: 0;
  width: 340px;
  position: sticky;
  left: 0;
  z-index: 6;
  border-right: 1px solid #E0E0E0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* ============================================================
   TIMELINE CELL
============================================================ */
.tc {
  flex-shrink: 0;
  position: relative;
  overflow: visible;
}

/* ============================================================
   PROJECT GROUP
============================================================ */
.proj-grp { margin-bottom: 0; }

/* Project header row */
.prow {
  display: flex;
  border-bottom: 1.5px solid #D8D8D8;
}

.proj-lc { background: #E8E8E8; }

.plc {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 8px;
  width: 100%;
}

.togbtn {
  background: none;
  border: none;
  color: #999;
  font-size: 11px;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
}

.pname {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #1A1A1A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pbadge {
  font-size: 9px;
  color: #999;
  background: #DDD;
  padding: 1px 7px;
  border-radius: 8px;
  flex-shrink: 0;
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================================
   TASK ROW (Vorgänge)
============================================================ */
.task-row { display: flex; border-bottom: 1px solid #EDEDED; }

.task-lc  { background: #fff; }

.tklc {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px 0 8px;
  width: 100%;
  overflow: hidden;
}

.tk-arrow { display: none; }

.tkname {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 11px;
  font-weight: 500;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tkname-bars {
  cursor: pointer;
  border-bottom: 1px dashed #AAAAAA;
}
.tkname-bars:hover { color: #2B3454; border-bottom-color: #2B3454; }

/* No bars → name links directly to CAS */
.tkname-cas { cursor: pointer; }
.tkname-cas:hover { color: #EF7E56; }

.billing-tag {
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 3px;
  opacity: .55;
}
.billing-e { color: #15803D; }
.billing-p { color: #6B7280; }

/* ============================================================
   BAR JUMP POPOVER
============================================================ */
.bar-popover {
  position: fixed;
  z-index: 800;
  width: 290px;
  background: #fff;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.13);
  overflow: hidden;
}

.bp-header {
  display: flex;
  align-items: center;
  padding: 9px 12px 9px 14px;
  border-bottom: 1px solid #F0F0F0;
  background: #F8F9FB;
}

.bp-title {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  color: #2B3454;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bp-cas {
  font-size: 12px; font-weight: 700; color: #AAAAAA;
  text-decoration: none; padding: 1px 4px; border-radius: 4px;
  flex-shrink: 0; transition: color .12s;
}
.bp-cas:hover { color: #2B3454; background: #EEEEEE; }

.bp-close {
  background: none;
  border: none;
  color: #BBB;
  font-size: 13px;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}
.bp-close:hover { color: #F06B6B; }

.bp-list {
  max-height: 260px;
  overflow-y: auto;
}

.bp-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  cursor: pointer;
  border-bottom: 1px solid #F5F5F5;
  transition: background .1s;
}
.bp-row:last-child { border-bottom: none; }
.bp-row:hover { background: #F0F4FF; }

.bp-inview {
  background: #F8FFF8;
}
.bp-inview:hover { background: #E8F5E8; }

.bp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bp-person {
  font-size: 10px;
  font-weight: 600;
  color: #333;
  min-width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.bp-dates {
  font-size: 10px;
  color: #777;
  white-space: nowrap;
  flex-shrink: 0;
}

.bp-hours {
  font-size: 10px;
  font-weight: 700;
  color: #2B3454;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

/* ============================================================
   EMPTY STATE
============================================================ */
.gantt-empty {
  padding: 60px 40px;
  text-align: center;
  color: #BBB;
  font-size: 12px;
}

.gantt-empty strong {
  display: block;
  font-size: 14px;
  color: #999;
  margin-bottom: 6px;
}

/* ============================================================
   FILTER BAR
============================================================ */
#filter-bar {
  background: #fff;
  border-bottom: 1px solid #E0E0E0;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-label {
  font-size: 9px;
  font-weight: 700;
  color: #AAA;
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
  margin-right: 2px;
}

.filter-sep {
  width: 1px;
  height: 20px;
  background: #E8E8E8;
  flex-shrink: 0;
}

.filter-btn {
  background: #F5F5F5;
  border: 1px solid #E0E0E0;
  border-radius: 20px;
  padding: 3px 11px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}

.filter-btn:hover  { background: #EAEAEA; }

.filter-btn.active {
  background: #2B3454;
  border-color: #2B3454;
  color: #fff;
}

.filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   HOLIDAY OVERLAY (util panel)
============================================================ */
.util-holiday {
  border-radius: 2px;
  background: repeating-linear-gradient(
    45deg,
    #C8C8C8 0,
    #C8C8C8 3px,
    #E5E7EB 3px,
    #E5E7EB 8px
  );
  opacity: .8;
}

/* ============================================================
   LOGGED HOURS BADGE
============================================================ */
.logged-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid;
}

.logged-ok   { color: #6B7280; border-color: #D1D5DB; background: #F9FAFB; }
.logged-warn { color: #B45309; border-color: #FCD34D; background: #FFFBEB; }
.logged-over { color: #DC2626; border-color: #FCA5A5; background: #FFF5F5; }

.logged-forecast-ok   { color: #15803D; border-color: #86EFAC; background: #F0FFF4; }
.logged-forecast-over { color: #DC2626; border-color: #FCA5A5; background: #FFF5F5; }

/* ============================================================
   PLANNING BARS
============================================================ */
.plan-bar {
  position: absolute;
  /* top and height set inline per lane */
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  cursor: grab;
  overflow: hidden;
  box-shadow: 0 1px 5px rgba(0,0,0,.13);
  user-select: none;
  z-index: 3;
  transition: filter .1s, box-shadow .1s;
}
.plan-bar:hover    { filter: brightness(1.08); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.plan-bar.dragging { cursor: grabbing; opacity: .85; box-shadow: 0 4px 16px rgba(0,0,0,.22); z-index: 10; }

/* Person name row (shown when bar spans ≥ 2 days) */
.plan-bar-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  line-height: 1.2;
}

/* Day cells row */
.plan-bar-cells {
  display: flex;
  flex: 1;
  min-height: 0;
  border-top: 1px solid transparent;
}
.plan-bar.light-bg .plan-bar-cells { border-top-color: rgba(0,0,0,.1); }
.plan-bar.dark-bg  .plan-bar-cells { border-top-color: rgba(255,255,255,.18); }

/* Individual day cell */
.plan-bar-cell {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  border-right: 1px solid transparent;
  min-width: 0;
  overflow: hidden;
}
.plan-bar.light-bg .plan-bar-cell:not(:last-child) { border-right-color: rgba(0,0,0,.1); }
.plan-bar.dark-bg  .plan-bar-cell:not(:last-child) { border-right-color: rgba(255,255,255,.18); }

/* Holiday day inside a planning bar — diagonal stripe overlay */
.plan-bar-cell.plan-bar-cell-hol {
  position: relative;
}
.plan-bar-cell.plan-bar-cell-hol::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,.18) 0,
    rgba(0,0,0,.18) 3px,
    transparent 3px,
    transparent 8px
  );
  pointer-events: none;
}

/* ============================================================
   BUDGET BADGE + ADD BUTTON
============================================================ */
.budget-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid;
  transition: opacity .12s;
}
.budget-badge:hover { opacity: .75; }

.budget-ok    { color: #3DC993; border-color: #3DC99340; background: #3DC99312; }
.budget-warn  { color: #F0A040; border-color: #F0A04040; background: #F0A04012; }
.budget-full  { color: #3DC993; border-color: #3DC99340; background: #3DC99312; }
.budget-empty { color: #BBBBBB; border-color: #DDDDDD;   background: #F8F8F8;  }
.budget-over  { color: #DC2626; border-color: #FCA5A5;   background: #FFF5F5;  }

.add-bar-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #CCC;
  background: none;
  color: #AAA;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: border-color .12s, color .12s, background .12s;
}
.add-bar-btn:hover {
  border-color: #EF7E56;
  color: #EF7E56;
  background: #FFF5F2;
}

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

.modal-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  width: 390px;
  max-width: 95vw;
  overflow: hidden;
}

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #F0F0F0;
}

.modal-title { font-size: 13px; font-weight: 700; color: #2B3454; }

.modal-close {
  background: none; border: none; color: #BBB; font-size: 17px;
  line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.modal-close:hover { color: #555; background: #F0F0F0; }

.modal-body { padding: 16px 18px; }

.modal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #555;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F5F5F5;
}

.modal-meta-badge {
  font-size: 10px;
  font-weight: 700;
  background: #EF7E5614;
  color: #EF7E56;
  border: 1px solid #EF7E5630;
  border-radius: 10px;
  padding: 2px 9px;
}

.modal-fields { display: flex; flex-direction: column; gap: 13px; }

.modal-field > label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 5px;
}

.modal-input, .modal-select {
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #1A1A1A;
  outline: none;
  width: 100%;
}
.modal-input:focus, .modal-select:focus { border-color: #EF7E56; }

.modal-preview {
  font-size: 11px;
  font-weight: 600;
  color: #3DC993;
  min-height: 18px;
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #F5F5F5;
}

.modal-btn-ok {
  background: #2B3454; color: #fff; border: none;
  border-radius: 8px; padding: 8px 18px;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700; cursor: pointer;
}
.modal-btn-ok:hover { opacity: .85; }

.modal-btn-cancel {
  background: #F5F5F5; color: #555; border: 1px solid #E0E0E0;
  border-radius: 8px; padding: 8px 14px;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; cursor: pointer;
}
.modal-btn-cancel:hover { background: #EAEAEA; }

.asap-btn {
  background: #2B3454;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: .2px;
}
.asap-btn:hover { opacity: .85; }

.modal-btn-delete {
  background: none; color: #F06B6B; border: 1px solid #F06B6B30;
  border-radius: 8px; padding: 8px 14px;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; cursor: pointer;
}
.modal-btn-delete:hover { background: #FFF0F0; }

/* ============================================================
   CREATE MODAL TABS (Bar / Milestone)
============================================================ */
.create-tab {
  flex: 1;
  padding: 7px 0;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  background: #F8F8F8;
  border: none;
  cursor: pointer;
  transition: background .1s, color .1s;
}
.create-tab.active { background: #2B3454; color: #fff; }
.create-tab:hover:not(.active) { background: #EEEEEE; }

/* ============================================================
   PLACEHOLDER BAR
============================================================ */
.bar-placeholder { background: transparent !important; border: 1.5px dashed #9CA3AF !important; }
.bar-placeholder .plan-bar-name { color: #555 !important; text-shadow: none !important; }

/* ============================================================
   MILESTONE MARKER
============================================================ */
.ms-marker {
  position: absolute;
  transform: translateX(-50%) translateY(-50%);
  z-index: 20;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ms-diamond {
  width: 13px;
  height: 13px;
  background: #EF7E56;
  border: 2px solid #C05A33;
  transform: rotate(45deg);
  transition: transform .12s;
  flex-shrink: 0;
}

.ms-marker:hover .ms-diamond { transform: rotate(45deg) scale(1.25); }


.ms-label {
  font-size: 9px;
  font-weight: 700;
  color: #C05A33;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  margin-top: 3px;
  letter-spacing: .2px;
  pointer-events: none;
  line-height: 1.3;
  text-shadow: 0 0 4px #fff, 0 0 4px #fff, 0 0 4px #fff;
}
.ms-marker.dragging { cursor: grabbing; opacity: .75; }
.ms-marker.dragging .ms-tip { opacity: 0; }

/* ============================================================
   LOADING OVERLAY
============================================================ */
#loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  font-size: 13px;
  font-weight: 600;
  color: #2B3454;
  letter-spacing: .5px;
}

#hol-person {
  margin-top: 0px;
}