/* ============================================================
   PR308 Closeout Checklist — Styles
   All classes scoped to .pr308-* prefix
   ============================================================ */

/* ── Root ───────────────────────────────────────────────────── */
.pr308-root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  background: #f7f8fc;
  padding: 20px 24px;
  min-height: 300px;
  box-sizing: border-box;
  position: relative;
}

/* ── Header ─────────────────────────────────────────────────── */
.pr308-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.pr308-header-left {
  flex: 1 1 auto;
  min-width: 0;
}

.pr308-header-right {
  flex: 0 0 auto;
}

.pr308-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.pr308-lily-subtitle {
  font-size: 13px;
  color: #6b52b5;
  margin: 0 0 4px 0;
  font-style: italic;
}

.pr308-project-sub {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

/* ── Progress bar ───────────────────────────────────────────── */
.pr308-progress-section {
  margin-bottom: 12px;
}

.pr308-progress-bar {
  height: 10px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.pr308-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #fb923c);
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 0;
}

.pr308-progress-label {
  font-size: 12px;
  color: #6b7280;
}

/* ── Stat pills ─────────────────────────────────────────────── */
.pr308-stat-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pr308-stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.pr308-stat-pill-warning {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.pr308-stat-pill-danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.pr308-stat-pill-ok {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ── Lily bar container ──────────────────────────────────────── */
.pr308-lily-bar-container {
  margin-bottom: 12px;
}

/* ── Category sections ──────────────────────────────────────── */
.pr308-category {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.pr308-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f9fafb;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.15s;
}

.pr308-category-header:hover {
  background: #f3f4f6;
}

.pr308-category-name {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.pr308-category-progress {
  font-size: 12px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.pr308-category-chevron {
  font-size: 10px;
  color: #9ca3af;
  transition: transform 0.2s;
}

.pr308-category-body {
  padding: 8px 0;
}

/* ── Add item button ────────────────────────────────────────── */
.pr308-add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #f97316;
  background: #fff7ed;
  border: 1px dashed #fed7aa;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pr308-add-item-btn:hover {
  background: #ffedd5;
  border-color: #f97316;
}

/* ── Add item form ──────────────────────────────────────────── */
.pr308-add-item-form {
  margin: 0 16px 12px 16px;
  padding: 14px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.pr308-add-item-form-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr308-add-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ── Item rows ──────────────────────────────────────────────── */
.pr308-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}

.pr308-item-row:last-child {
  border-bottom: none;
}

.pr308-item-row:hover {
  background: #fafafa;
}

.pr308-item-complete {
  opacity: 0.6;
}

.pr308-item-complete .pr308-item-title {
  text-decoration: line-through;
  color: #6b7280;
}

.pr308-item-overdue .pr308-item-date {
  color: #dc2626;
  font-weight: 600;
}

.pr308-item-required .pr308-item-title {
  font-weight: 600;
}

.pr308-item-check-col {
  flex: 0 0 20px;
  padding-top: 2px;
}

.pr308-item-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #f97316;
}

.pr308-item-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pr308-item-main {
  flex: 1;
  min-width: 0;
}

.pr308-item-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.pr308-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
}

.pr308-item-desc {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.4;
}

.pr308-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-left: auto;
}

.pr308-item-date {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.pr308-date-overdue {
  color: #dc2626;
  font-weight: 600;
}

.pr308-date-soon {
  color: #d97706;
  font-weight: 500;
}

.pr308-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* ── Required pill ──────────────────────────────────────────── */
.pr308-required-pill {
  display: inline-flex;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  white-space: nowrap;
}

/* ── Status badges ──────────────────────────────────────────── */
.pr308-badge {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
}

.pr308-badge-pending {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.pr308-badge-in_progress {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.pr308-badge-complete {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.pr308-badge-waived {
  background: #faf5ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
}

.pr308-badge-blocked {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ── Role chip ──────────────────────────────────────────────── */
.pr308-role-chip {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: #f0f4ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  white-space: nowrap;
}

/* ── Linked record chip ─────────────────────────────────────── */
.pr308-linked-chip {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: #1e3a5f;
  color: #e0eaff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  text-decoration: none;
}

.pr308-linked-chip:hover {
  background: #1e40af;
}

/* ── Notes icon ─────────────────────────────────────────────── */
.pr308-notes-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border-radius: 50%;
  cursor: help;
}

/* ── Action buttons ─────────────────────────────────────────── */
.pr308-action-btn {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  transition: background 0.12s, border-color 0.12s;
}

.pr308-action-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.pr308-action-waive {
  border-color: #c4b5fd;
  color: #6b21a8;
  background: #faf5ff;
}

.pr308-action-waive:hover {
  background: #f3e8ff;
}

.pr308-action-block {
  border-color: #fca5a5;
  color: #991b1b;
  background: #fef2f2;
}

.pr308-action-block:hover {
  background: #fee2e2;
}

/* ── Two-tap confirm pending ────────────────────────────────── */
.pr308-confirm-pending {
  border: 2px solid #f97316 !important;
  box-shadow: 0 0 0 2px rgba(249,115,22,0.2);
}

/* ── Generate closeout package button ──────────────────────── */
.pr308-generate-btn {
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 4px rgba(249,115,22,0.3);
  white-space: nowrap;
}

.pr308-generate-btn:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 8px rgba(249,115,22,0.35);
}

.pr308-generate-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

/* ── Generic buttons ────────────────────────────────────────── */
.pr308-btn-primary {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.pr308-btn-primary:hover {
  background: #ea580c;
}

.pr308-btn-secondary {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.pr308-btn-secondary:hover {
  background: #f3f4f6;
}

.pr308-btn-danger {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.pr308-btn-danger:hover {
  background: #b91c1c;
}

.pr308-btn-download {
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  background: #1e40af;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}

.pr308-btn-download:hover {
  background: #1d4ed8;
}

.pr308-btn-lily {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.pr308-btn-lily:hover {
  background: #6d28d9;
}

/* ── Closeout package panel ─────────────────────────────────── */
.pr308-package-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 1000;
  overflow-y: auto;
  padding: 24px;
  box-sizing: border-box;
  animation: pr308-slide-in 0.25s ease;
}

@keyframes pr308-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

.pr308-package-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pr308-package-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

.pr308-package-desc {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.pr308-package-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pr308-package-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
}

.pr308-package-item::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #f97316;
  border-radius: 50%;
  flex: 0 0 6px;
}

.pr308-package-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr308-package-download {
  margin-top: 4px;
}

/* ── Lily draft bar ─────────────────────────────────────────── */
.pr308-lily-draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
}

.pr308-lily-draft-label {
  font-size: 13px;
  font-weight: 500;
  color: #5b21b6;
}

.pr308-lily-draft-output {
  margin-top: 12px;
  padding: 12px;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ── Edit panel ─────────────────────────────────────────────── */
.pr308-edit-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 1001;
  overflow-y: auto;
  padding: 24px;
  box-sizing: border-box;
  animation: pr308-slide-in 0.22s ease;
}

.pr308-edit-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pr308-edit-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}

.pr308-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.pr308-edit-waive-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: 6px;
}

/* ── Form inputs ────────────────────────────────────────────── */
.pr308-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}

.pr308-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  background: #fff;
  color: #111827;
}

.pr308-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249,115,22,0.15);
}

.pr308-select {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  box-sizing: border-box;
  background: #fff;
  color: #111827;
  outline: none;
  cursor: pointer;
}

.pr308-select:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249,115,22,0.15);
}

.pr308-textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  box-sizing: border-box;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.12s;
  background: #fff;
  color: #111827;
  font-family: inherit;
}

.pr308-textarea:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249,115,22,0.15);
}

/* ── Toast ──────────────────────────────────────────────────── */
.pr308-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #f9fafb;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  pointer-events: none;
  animation: pr308-toast-in 0.2s ease;
  white-space: nowrap;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}

@keyframes pr308-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

/* ── Responsive < 768px ─────────────────────────────────────── */
@media (max-width: 767px) {
  .pr308-root {
    padding: 12px;
  }

  .pr308-header {
    flex-direction: column;
    gap: 10px;
  }

  .pr308-header-right {
    width: 100%;
  }

  .pr308-generate-btn {
    width: 100%;
  }

  .pr308-item-row {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .pr308-item-meta {
    flex-wrap: wrap;
    margin-left: 0;
    margin-top: 4px;
  }

  .pr308-item-actions {
    flex-wrap: wrap;
    margin-top: 4px;
    gap: 4px;
  }

  .pr308-package-panel,
  .pr308-edit-panel {
    width: 100vw;
    top: auto;
    bottom: 0;
    height: 90vh;
    border-radius: 12px 12px 0 0;
    animation: pr308-slide-up 0.25s ease;
  }

  @keyframes pr308-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
  }

  .pr308-category-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .pr308-stat-pills {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pr308-stat-pill {
    flex: 1 1 auto;
    justify-content: center;
  }

  .pr308-action-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .pr308-toast {
    font-size: 12px;
    padding: 9px 16px;
  }
}
