:root{
  --line: rgba(0,0,0,.35);
  --line2: rgba(0,0,0,.18);
}

.month-topbar{
  display:flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.month-title{
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
}
.month-nav{ display:flex; gap: 8px; flex-wrap: wrap; }

.month-calendar{ background:#fff; }

.month-head{
  display:grid;
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: none;
}
.month-head > div{
  padding: 8px 6px;
  font-weight: 800;
  font-size: 22px;
  text-align:center;
  border-right: 1px solid var(--line);
}
.month-head > div:last-child{ border-right: 0; }
.h-kw{ font-size: 14px !important; }
.h-sat{ color:#0d6efd; }
.h-sun{ color:#dc3545; }

.month-grid{
  display:grid;
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-top: none;
}

.kw-col{
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items: center;
  justify-content: center;
}
.kw-box{
  font-weight: 800;
  font-size: 14px;
}

.day-cell{
  height: 150px;
  box-sizing: border-box;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  position: relative;
}
.day-cell:nth-child(8n){ border-right: 0; }

.day-cell.is-outside{ background:#f3f3f3; color:#6c757d; }
.day-cell.is-today{ outline: 2px solid rgba(13,110,253,.35); outline-offset: -2px; }

.day-top{
  display:flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.day-num{
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 24px;
  font-weight: 800;
}
.day-cell.is-outside .day-num{ background:#e9ecef; color:#6c757d; }

.day-right{
  display:flex;
  gap: 6px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.day-body{
  margin-top: 8px;
  display:flex;
  flex-direction: column;
  gap: 6px;
}

.event-row{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  background: #f8f9fb;
  cursor: pointer;
}
.event-row.is-done{ opacity:.68; }
.event-one-line{
  min-width:0;
  display:flex;
  gap:6px;
  align-items:center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-time{ font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.event-sep{ color: rgba(0,0,0,.35); }
.event-address-one{ overflow:hidden; text-overflow: ellipsis; font-size: 12px; }
.event-row-actions{ display:flex; gap: 6px; flex: 0 0 auto; }
.event-row-actions .btn{ line-height: 1; }

.modal-wrap{ white-space: pre-wrap; overflow-wrap:anywhere; word-break: break-word; }

@media (max-width: 992px){
  .month-title{ font-size: 28px; }
  .month-head{ display:none; }
  .month-grid{ grid-template-columns: 1fr; }
  .kw-col{ display:none; }
  .day-cell{ border-right: 0; }
  .day-num{ width: 36px; height: 36px; font-size: 18px; }
}


/* One-line safety: never let long address break the grid */
.day-body, .event-row, .event-one-line { min-width: 0; }
.event-row { overflow: hidden; }
.event-one-line { flex: 1 1 auto; max-width: 100%; }
.event-address-one { flex: 1 1 auto; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Mark deliverable days (Spedition: lieferfähig) */
.day-cell.is-available:not(.is-outside):not(.is-sun) { background: rgba(25,135,84,.08); }


.day-left{ display:flex; flex-direction: column; gap: 4px; }
.day-dow{ font-size: 12px; font-weight: 700; color: rgba(0,0,0,.65); line-height: 1; display:none; }

.day-right{ flex-wrap: nowrap; }
.day-right .badge{ max-width: 110px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }

.day-body-scroll{
  max-height: calc(100% - 58px);
  overflow: hidden;
}
.day-cell:hover .day-body-scroll{
  overflow: auto;
}


@media (max-width: 992px){
  .month-grid{
    display:flex;
    flex-direction: column;
    border: none;
  }
  .kw-col{ display:none !important; }

  .day-cell{
    height: auto !important;
    border: 1px solid var(--line2);
    margin-bottom: 10px;
    border-radius: 12px;
    padding: 10px;
  }
  .day-num{
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  .day-dow{ display:block; }
  .day-body-scroll{ max-height: none; overflow: visible; }
  .day-right{ flex-wrap: wrap; }
}


/* Desktop width lock: prevent content from expanding columns */
.month-calendar{ width: 100%; }
.month-head > div, .kw-col, .day-cell{ min-width: 0; }
.day-cell{ overflow: hidden; }
.day-right{ min-width: 0; }
.event-row{ max-width: 100%; }
.event-one-line{ min-width: 0; }
