/* PPM Schedule — professional UI */
.ppm-shell {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ppm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  justify-content: space-between;
}

/* ── Week overview card ── */
.ppm-week-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: linear-gradient(165deg, #111827 0%, #0b1220 55%, #0f172a 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.ppm-week-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid #1e293b;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
}

.ppm-week-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.45rem;
}

.ppm-week-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f1f5f9;
}

.ppm-week-sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.45;
  max-width: 36rem;
}

.ppm-week-summary {
  text-align: right;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid #334155;
  min-width: 7.5rem;
}

.ppm-week-summary strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
  color: #e2e8f0;
}

.ppm-week-summary span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: #94a3b8;
}

.ppm-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 1rem 1.15rem 1.15rem;
}

/* ── Day pills ── */
.ppm-day-pill {
  position: relative;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 14px;
  padding: 0.75rem 0.45rem 0.65rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ppm-day-pill:hover {
  border-color: #60a5fa;
  background: #172554;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.ppm-day-pill.active {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  box-shadow: 0 0 0 1px #3b82f6 inset, 0 8px 24px rgba(37, 99, 235, 0.2);
}

.ppm-day-status {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #475569;
}

.ppm-day-pill.pending .ppm-day-status { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.ppm-day-pill.progress .ppm-day-status { background: #3b82f6; box-shadow: 0 0 6px rgba(59, 130, 246, 0.5); }
.ppm-day-pill.complete .ppm-day-status { background: #22c55e; box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.ppm-day-pill.idle .ppm-day-status { background: #64748b; }

.ppm-day-pill .d-label {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.ppm-day-pill .d-date {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.2rem 0 0.15rem;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.ppm-day-pill .d-meta {
  display: block;
  font-size: 0.7rem;
  color: #cbd5e1;
}

.ppm-day-bar {
  display: block;
  height: 3px;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: #1e293b;
  overflow: hidden;
}

.ppm-day-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  transition: width 0.3s ease;
}

/* ── Modal ── */
body.ppm-modal-open {
  overflow: hidden;
}

.ppm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: ppm-fade-in 0.2s ease;
}

@keyframes ppm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ppm-slide-up {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ppm-modal {
  width: min(940px, 100%);
  max-height: min(92vh, 900px);
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 18px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ppm-slide-up 0.25s ease;
}

.ppm-modal-head {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 1.1rem 1.25rem 1.35rem;
  border-bottom: 1px solid #1e293b;
  background: linear-gradient(135deg, #111827 0%, #0f172a 50%, #0b1220 100%);
}

.ppm-modal-head-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}

.ppm-modal-date-badge {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.ppm-modal-head h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.ppm-modal-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.ppm-modal-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #1e293b;
}

.ppm-modal-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #22c55e);
  border-radius: 0 2px 2px 0;
  transition: width 0.35s ease;
}

.ppm-modal-close {
  border: none;
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.ppm-modal-close:hover {
  background: #334155;
  color: #fff;
}

.ppm-modal-body {
  padding: 1.15rem 1.25rem;
  overflow-y: auto;
  flex: 1;
  background: #0b1220;
}

.ppm-modal-foot {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: flex-end;
  background: #0f172a;
}

.ppm-modal-kpis {
  margin-bottom: 1.15rem;
}

/* ── KPIs ── */
.ppm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0.65rem;
}

.ppm-kpi {
  position: relative;
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  overflow: hidden;
}

.ppm-kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #334155;
}

.ppm-kpi.ok::before { background: #22c55e; }
.ppm-kpi.defect::before { background: #f59e0b; }
.ppm-kpi.urgent::before { background: #ef4444; }
.ppm-kpi.pending::before { background: #3b82f6; }

.ppm-kpi strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.ppm-kpi span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.ppm-kpi.ok strong { color: #4ade80; }
.ppm-kpi.defect strong { color: #fbbf24; }
.ppm-kpi.urgent strong { color: #f87171; }
.ppm-kpi.pending strong { color: #93c5fd; }

/* ── Team cards ── */
.ppm-team-card {
  --team-accent: #3b82f6;
  border: 1px solid #1e293b;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.ppm-team-card:last-child {
  margin-bottom: 0;
}

.ppm-team-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #111827;
  border-bottom: 1px solid #1e293b;
  border-left: 4px solid var(--team-accent);
}

.ppm-team-head-main {
  flex: 1;
  min-width: 10rem;
}

.ppm-team-head h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
}

.ppm-team-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ppm-team-tasks {
  background: #0b1220;
}

.ppm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.ppm-badge.total { background: #1e293b; color: #e2e8f0; }
.ppm-badge.done { background: #14532d33; color: #86efac; border-color: #166534; }
.ppm-badge.ok { background: #14532d44; color: #4ade80; border-color: #15803d; }
.ppm-badge.defect { background: #713f1233; color: #fcd34d; border-color: #b45309; }
.ppm-badge.urgent { background: #7f1d1d33; color: #fca5a5; border-color: #b91c1c; }

.ppm-progress {
  height: 5px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.ppm-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--team-accent, #2563eb), #22c55e);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ── Tasks ── */
.ppm-task {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #1e293b;
  transition: background 0.15s;
}

.ppm-task:last-child {
  border-bottom: none;
}

.ppm-task:hover {
  background: rgba(30, 41, 59, 0.25);
}

.ppm-task.done {
  background: rgba(20, 83, 45, 0.08);
}

.ppm-task-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.ppm-task-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #f1f5f9;
  line-height: 1.35;
}

.ppm-task-meta {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.ppm-freq {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(30, 58, 95, 0.6);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Segmented OK / Defect / Urgent */
.ppm-obs-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: stretch;
  margin-top: 0.65rem;
  padding: 3px;
  border-radius: 10px;
  background: #020617;
  border: 1px solid #334155;
}

.ppm-obs-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  border-radius: 7px;
  padding: 0.4rem 0.95rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ppm-obs-btn:hover:not(.active) {
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.5);
}

.ppm-obs-btn.active.ok {
  background: #166534;
  color: #ecfdf5;
  box-shadow: 0 1px 4px rgba(34, 197, 94, 0.3);
}

.ppm-obs-btn.active.defect {
  background: #b45309;
  color: #fffbeb;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.3);
}

.ppm-obs-btn.active.urgent {
  background: #b91c1c;
  color: #fef2f2;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

.ppm-save-btn {
  font-weight: 600;
}

.ppm-note {
  width: 100%;
  min-height: 2.5rem;
  margin-top: 0.6rem;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  padding: 0.6rem 0.75rem;
  resize: vertical;
  font-size: 0.85rem;
  line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ppm-note:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.ppm-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #1e293b;
}

.ppm-photo-input {
  font-size: 0.78rem;
  color: #94a3b8;
  cursor: pointer;
}

.ppm-photo-thumb {
  max-width: 120px;
  max-height: 80px;
  border-radius: 8px;
  border: 1px solid #334155;
  object-fit: cover;
}

.ppm-saved {
  font-size: 0.72rem;
  color: #86efac;
  font-weight: 500;
}

/* ── Unassigned fold ── */
.ppm-unassigned-fold {
  margin-top: 1rem;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  background: rgba(15, 23, 42, 0.5);
}

.ppm-unassigned-fold summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: #cbd5e1;
  padding: 0.25rem 0;
  list-style: none;
}

.ppm-unassigned-fold summary::-webkit-details-marker {
  display: none;
}

.ppm-unassigned-fold summary::before {
  content: "▸ ";
  color: #64748b;
}

.ppm-unassigned-fold[open] summary::before {
  content: "▾ ";
}

.ppm-unassigned-fold[open] summary {
  margin-bottom: 0.65rem;
}

.ppm-task-unassigned {
  background: rgba(15, 23, 42, 0.4);
}

.ppm-plan-label {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.55rem;
  font-size: 0.76rem;
  color: #94a3b8;
}

.ppm-plan-select {
  border: 1px solid #334155;
  background: #020617;
  color: inherit;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
}

/* ── Misc ── */
.ppm-loading,
.ppm-error {
  padding: 2rem 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}

.ppm-error strong {
  display: block;
  color: #fca5a5;
  margin-bottom: 0.35rem;
}

.ppm-empty {
  padding: 1.5rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}

.ppm-empty-inline {
  padding: 0.85rem 1rem;
  text-align: left;
  border: 1px dashed #334155;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  font-size: 0.88rem;
  color: #94a3b8;
}

.ppm-lock {
  border: 1px dashed #334155;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.5);
  text-align: center;
  padding: 1.25rem;
}

.ppm-lock strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
  color: #e2e8f0;
}

.ppm-notice {
  padding: 0.75rem 1rem;
  border: 1px solid #b45309;
  border-radius: 12px;
  background: rgba(120, 53, 15, 0.25);
  color: #fcd34d;
  font-size: 0.86rem;
  margin-bottom: 1rem;
}

.ppm-add-extra {
  border: 1px dashed #334155 !important;
  border-radius: 12px !important;
  background: rgba(15, 23, 42, 0.45) !important;
}

.ppm-add-extra h4 {
  font-size: 0.92rem;
  color: #e2e8f0;
}

.ppm-readonly-note {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.85rem;
}

.ppm-task-extra {
  border-left: 3px solid #f59e0b;
}

.ppm-import-card {
  border: 1px dashed #334155;
  border-radius: 14px;
  padding: 1rem;
  background: #0b1220;
}

.ppm-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .ppm-week-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ppm-week-card-head {
    flex-direction: column;
  }

  .ppm-week-summary {
    text-align: left;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .ppm-week-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ppm-modal {
    border-radius: 14px 14px 0 0;
    max-height: 94vh;
    align-self: flex-end;
  }

  .ppm-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .ppm-obs-row {
    width: 100%;
    justify-content: stretch;
  }

  .ppm-obs-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.35rem;
  }
}
