/*
 * Project Plan Task Editor
 * ------------------------
 * Uses the dashboard's shared:
 *
 *   .modal
 *   .form-grid
 *   .field
 *   .field.full
 *   .modal-actions
 *
 * Only Task-specific behavior/layout belongs here.
 */

.pte-modal{
  position:fixed;
  inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  box-sizing:border-box;
}

.pte-modal.hidden{
  display:none;
}

.pte-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.48);
}

.pte-dialog{
  position:relative;
  z-index:1;
}

/* Header follows normal modal proportions */
.pte-dialog-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  margin-bottom:16px;
}

.pte-dialog-header h2{
  margin:0;
  font-size:20px;
  line-height:1.2;
}

.pte-dialog-header p,
.pte-eyebrow{
  display:none;
}

.pte-close{
  border:0;
  background:transparent;
  color:#60717e;
  font-size:22px;
  line-height:1;
  cursor:pointer;
}

/*
 * The shared .form-grid provides:
 * display:grid;
 * grid-template-columns:1fr 1fr;
 * gap:12px;
 */
.pte-deliverable-grid{
  margin:0;
}

/*
 * Task labels are wrapped slightly differently from the older forms.
 * Match the shared .field label appearance exactly.
 */
.pte-field > span{
  font-size:12px;
  font-weight:700;
  color:#465466;
}

/*
 * Inputs/selects/textareas now inherit the shared .field controls.
 * Keep only sizing that is unique to textarea/progress composition.
 */
.pte-field textarea{
  min-height:82px;
}

.pte-progress-field{
  display:flex;
  align-items:center;
  gap:8px;
}

.pte-progress-field input{
  flex:1;
  min-width:0;
}

.pte-progress-field > span{
  font-size:14px;
}

/* Optional organization section */
.pte-advanced{
  margin-top:14px;
  padding-top:12px;
  border-top:1px solid var(--line);
}

.pte-advanced summary{
  font-size:12px;
  font-weight:700;
  color:#465466;
  cursor:pointer;
}

.pte-advanced[open] summary{
  margin-bottom:12px;
}

.pte-org-grid{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

/*
 * Keep Task footer consistent with standard modal-actions.
 * Shared CSS owns the main spacing/alignment.
 */
.pte-actions{
  border-top:1px solid var(--line);
  padding-top:14px;
}

/* Detail page Edit Task control */
.pte-detail-actions,
.pte-stable-edit-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  margin:0 0 10px;
}

@media(max-width:700px){

  .pte-modal{
    align-items:flex-end;
    padding:0;
    padding-bottom:env(safe-area-inset-bottom);
  }

  /*
   * Let the application's mobile .modal and .form-grid rules
   * control the actual sheet dimensions and one-column layout.
   */
  .pte-org-grid{
    grid-template-columns:1fr;
  }
}

/* ==========================================================
   v0.14.88 — Prevent Task editor grid overflow
   ========================================================== */

/* Grid columns must be allowed to shrink inside the modal */
.pte-dialog .form-grid,
.pte-deliverable-grid{
  width:100%;
  min-width:0;
  box-sizing:border-box;
  grid-template-columns:
    minmax(0,1fr)
    minmax(0,1fr);
}

/* A grid child with a long select value must not widen its column */
.pte-field,
.pte-dialog .field{
  min-width:0;
  max-width:100%;
}

/* Keep every form control contained by its grid cell */
.pte-field input,
.pte-field select,
.pte-field textarea,
.pte-dialog .field input,
.pte-dialog .field select,
.pte-dialog .field textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
}

/* Progress input is a flex child, so explicitly allow shrinking */
.pte-progress-field{
  width:100%;
  min-width:0;
}

.pte-progress-field input{
  width:auto;
  min-width:0;
}

/* The dialog itself should never scroll horizontally */
.pte-dialog{
  overflow-x:hidden;
}

/* Organization can still use 3 columns when expanded */
.pte-org-grid{
  grid-template-columns:
    repeat(3,minmax(0,1fr));
}

@media(max-width:700px){
  .pte-dialog .form-grid,
  .pte-deliverable-grid,
  .pte-org-grid{
    grid-template-columns:1fr;
  }
}


/* Project Task validation */

.pte-invalid{
  border-color:#c2410c !important;
  box-shadow:0 0 0 2px rgba(194,65,12,.10);
}

.pte-validation-toast{
  position:fixed;
  top:22px;
  right:22px;
  z-index:10000;
  max-width:420px;
  padding:12px 16px;
  border:1px solid rgba(194,65,12,.25);
  border-radius:10px;
  background:#fff7ed;
  color:#9a3412;
  font-size:13px;
  font-weight:700;
  box-shadow:0 10px 28px rgba(0,0,0,.14);
  opacity:0;
  transform:translateY(-8px);
  pointer-events:none;
  transition:
    opacity .18s ease,
    transform .18s ease;
}

.pte-validation-toast.show{
  opacity:1;
  transform:translateY(0);
}



/* Validation message inside Task modal */
#projectTaskEditorModal .pte-validation-toast{
  position:static;
  width:auto;
  max-width:none;
  margin:10px 0 8px auto;
  padding:9px 12px;
  border:1px solid rgba(194,65,12,.25);
  border-radius:8px;
  background:#fff7ed;
  color:#9a3412;
  font-size:12px;
  font-weight:700;
  text-align:right;
  box-shadow:none;
  opacity:0;
  transform:none;
  pointer-events:none;
}

#projectTaskEditorModal .pte-validation-toast.show{
  opacity:1;
  transform:none;
}


/* Keep validation message compact instead of full-width */
#projectTaskEditorModal .pte-validation-toast{
  display:inline-flex;
  width:max-content;
  max-width:100%;
  align-self:flex-end;
  margin-left:auto;
}

/* Right-align compact validation message above Save */
#projectTaskEditorModal .pte-validation-toast{
  display:block;
  width:fit-content;
  max-width:100%;
  margin:10px 0 8px auto;
}

/* Task scheduling modes */
.pte-schedule-extra[hidden], .pte-schedule-extra [hidden], #pteTargetDateField[hidden] {display:none!important;}
.pte-schedule-extra {border:1px solid #d5e3eb;border-radius:8px;padding:12px;margin:8px 0;background:#f5f9fc;}
.pte-schedule-extra .field {margin-bottom:10px;}
.pte-schedule-extra label {display:block;}
.pte-schedule-extra input,.pte-schedule-extra textarea {width:100%;}
.pte-schedule-extra small {display:block;margin:4px 0 8px;color:#627585;}
.pte-schedule-inline {display:grid;grid-template-columns:1fr 1fr;gap:12px;}
@media(max-width:640px){.pte-schedule-inline{grid-template-columns:1fr}}
.pw-warning-review-needed {background:#fff2d8!important;color:#815100!important;border-color:#e8bd65!important;}


/* AHT predecessor selector full-width v1
   Keep existing checkboxes, paths, and selection behavior unchanged. */
#projectTaskEditorModal .pte-deliverable-grid > .pte-field:has(> #ptePredecessor) {
  grid-column: 1 / -1;
  min-width: 0;
}
#projectTaskEditorModal #ptePredecessor {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
}
#projectTaskEditorModal #ptePredecessor .pte-predecessor-option span {
  white-space: normal;
  overflow-wrap: break-word;
}

/* Do not silently classify historical placeholders as committed due dates. */
.pte-legacy-schedule-note{
  display:block;padding:10px 12px;color:#795108;background:#fff7e4;
  border:1px solid #e8cc92;border-radius:7px;font-size:11px;line-height:1.5;
}
.pte-legacy-schedule-note[hidden]{display:none!important;}

/* AHT Sequential Date Review v1 — review one confirmed classification at a time */
.pte-date-review-queue-banner{
  display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center;
  margin:0 0 16px;padding:10px 13px;border:1px solid #b8d8ec;
  background:#eef7fc;color:#17425e;border-radius:8px;font-size:12px;
}
.pte-date-review-queue-banner strong{font-weight:800}
.pte-date-review-queue-banner span{font-weight:700}
.pte-date-review-queue-banner small{flex-basis:100%;font-size:11px;color:#536978}
.pte-date-review-queue-banner[hidden],#pteSaveAndNextReview[hidden]{display:none!important}
#pteSaveAndNextReview{border:1px solid #0079b3;color:#005e8b;background:#e8f5fc;font-weight:750;}
#pteSaveAndNextReview:hover,#pteSaveAndNextReview:focus-visible{
  background:#d4edf9;outline:2px solid #8fd1f7;outline-offset:1px;
}

/* AHT Date Review Skip v1 — explicit no-save path through historical dates */
#pteSkipDateReview{border:1px solid #b4c3cd;background:#fff;color:#425664;font-weight:750}
#pteSkipDateReview:hover,#pteSkipDateReview:focus-visible{background:#edf4f8;outline:2px solid #8fd1f7;outline-offset:1px}
#pteSkipDateReview[hidden]{display:none!important}
