/* ============================================================
   AssetPrep Project Manager — Stylesheet
   Brand: Yellow #F5C518, Dark #2C2C2A
   ============================================================ */

:root {
  --ap-yellow:      #F5C518;
  --ap-yellow-dark: #D4A800;
  --ap-yellow-bg:   rgba(245,197,24,0.12);
  --ap-dark:        #2C2C2A;
  --ap-mid:         #5F5E5A;
  --ap-light:       #F7F6F2;
  --ap-border:      #E3E2DC;
  --ap-green:       #1D9E75;
  --ap-green-bg:    rgba(29,158,117,0.1);
  --ap-radius:      8px;
  --ap-radius-lg:   12px;
  --ap-shadow:      0 1px 4px rgba(0,0,0,0.08);
}

/* ── PORTAL HOME ──────────────────────────────────────────── */
.ap-portal-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 16px;
}
.ap-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 12px;
}
.ap-portal-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.ap-portal-logo-text {
  display: flex;
  flex-direction: column;
}
.ap-logo-main {
  font-size: 26px;
  font-weight: 700;
  color: var(--ap-dark);
  letter-spacing: 1px;
  line-height: 1;
}
.ap-logo-main span { color: var(--ap-yellow-dark); }
.ap-logo-sub {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ap-mid);
  margin-top: 2px;
}
.ap-portal-welcome {
  font-size: 14px;
  color: var(--ap-mid);
}
.ap-portal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ap-module-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--ap-yellow);
  color: var(--ap-dark);
  border-radius: var(--ap-radius);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: background 0.15s, transform 0.1s;
}
.ap-module-btn:hover {
  background: var(--ap-yellow-dark);
  color: var(--ap-dark);
  transform: translateY(-1px);
  text-decoration: none;
}
.ap-module-btn .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ap-dark);
}
.ap-module-btn--active {
  background: var(--ap-dark);
  color: var(--ap-yellow);
}
.ap-module-btn--active .dashicons { color: var(--ap-yellow); }
.ap-module-btn--active:hover { background: #3e3d3a; color: var(--ap-yellow); }

/* ── SHARED PM LAYOUT ─────────────────────────────────────── */
.ap-pm-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.ap-pm-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ap-pm-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--ap-dark);
  margin: 0;
  flex: 1;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.ap-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--ap-yellow);
  color: var(--ap-dark);
  border: none;
  border-radius: var(--ap-radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.ap-btn-primary:hover { background: var(--ap-yellow-dark); }
.ap-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--ap-mid);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.ap-btn-ghost:hover { background: var(--ap-light); }

/* ── STAT CARDS ───────────────────────────────────────────── */
.ap-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.ap-stat-card {
  background: var(--ap-light);
  border-radius: var(--ap-radius);
  padding: 14px 16px;
}
.ap-stat-label { font-size: 12px; color: var(--ap-mid); margin-bottom: 4px; }
.ap-stat-val { font-size: 26px; font-weight: 600; color: var(--ap-dark); }
.ap-val-yellow { color: var(--ap-yellow-dark); }
.ap-val-green  { color: var(--ap-green); }

/* ── FILTER BAR ───────────────────────────────────────────── */
.ap-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ap-filter-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--ap-mid);
  text-decoration: none;
  border: 1px solid var(--ap-border);
  background: #fff;
  transition: all 0.15s;
}
.ap-filter-tab:hover, .ap-filter-tab:focus { background: var(--ap-light); text-decoration: none; }
.ap-filter-tab.active {
  background: var(--ap-yellow);
  color: var(--ap-dark);
  border-color: var(--ap-yellow);
  font-weight: 600;
  text-decoration: none;
}

/* ── PROJECT LIST ─────────────────────────────────────────── */
.ap-project-list { display: flex; flex-direction: column; gap: 8px; }
.ap-project-card {
  background: #fff;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ap-project-card:hover {
  border-color: var(--ap-yellow);
  box-shadow: var(--ap-shadow);
}
.ap-proj-info { flex: 1; min-width: 160px; }
.ap-proj-name {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--ap-dark);
  text-decoration: none;
}
.ap-proj-name:hover { color: var(--ap-yellow-dark); text-decoration: none; }
.ap-proj-client { font-size: 12px; color: var(--ap-mid); }
.ap-proj-actions { display: flex; gap: 6px; }
.ap-proj-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--ap-border);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ap-light);
  color: var(--ap-mid);
  text-decoration: none;
  transition: all 0.15s;
}
.ap-proj-icon-btn:hover {
  border-color: var(--ap-yellow);
  color: var(--ap-dark);
  background: var(--ap-yellow-bg);
}
.ap-proj-icon-btn .dashicons { font-size: 14px; width: 14px; height: 14px; }
.ap-proj-meta { display: flex; align-items: center; gap: 12px; }
.ap-member-stack { display: flex; }
.ap-member-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ap-yellow);
  color: var(--ap-dark);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  margin-right: -6px;
}
.ap-member-chip:nth-child(2) { background: #B5D4F4; color: #185FA5; }
.ap-member-chip:nth-child(3) { background: #9FE1CB; color: #0F6E56; }
.ap-member-more { background: var(--ap-border); color: var(--ap-mid); }
.ap-progress-wrap { min-width: 100px; }
.ap-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ap-mid);
  margin-bottom: 4px;
}
.ap-progress-bar {
  height: 4px;
  background: var(--ap-border);
  border-radius: 2px;
  overflow: hidden;
}
.ap-progress-fill { height: 100%; background: var(--ap-yellow); border-radius: 2px; transition: width 0.3s; }
.ap-fill-green { background: var(--ap-green); }
.ap-progress-bar--lg { height: 8px; }
.ap-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ap-status-active    { background: var(--ap-yellow); }
.ap-status-completed { background: var(--ap-green); }
.ap-status-on-hold   { background: var(--ap-mid); }
.ap-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--ap-border);
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
.ap-star-btn:hover, .ap-star-btn.on { color: var(--ap-yellow); }

/* ── PROJECT DETAIL ───────────────────────────────────────── */
.ap-detail-topbar { margin-bottom: 16px; }
.ap-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ap-mid);
  text-decoration: none;
  margin-bottom: 8px;
}
.ap-back-link:hover { color: var(--ap-dark); }
.ap-detail-meta-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.ap-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.ap-badge-active    { background: var(--ap-yellow-bg); color: var(--ap-yellow-dark); }
.ap-badge-completed { background: var(--ap-green-bg);  color: var(--ap-green); }
.ap-badge-on-hold   { background: var(--ap-light);     color: var(--ap-mid); }
.ap-badge-neutral   { background: var(--ap-light);     color: var(--ap-mid); }
.ap-detail-dates { margin-top: 8px; font-size: 13px; color: var(--ap-mid); display: flex; gap: 16px; }
.ap-progress-banner {
  background: var(--ap-light);
  border-radius: var(--ap-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.ap-progress-banner-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ap-mid);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ── TABS ─────────────────────────────────────────────────── */
.ap-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--ap-border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ap-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ap-mid);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.ap-tab:hover { color: var(--ap-dark); text-decoration: none; }
.ap-tab.active { color: var(--ap-dark); border-bottom-color: var(--ap-yellow); font-weight: 600; }
.ap-tab .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* ── TASK PANEL ───────────────────────────────────────────── */
.ap-task-panel { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); }
.ap-task-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ap-border);
}
.ap-task-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ap-task-count {
  background: var(--ap-yellow);
  color: var(--ap-dark);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.ap-add-list-btn { font-size: 12px; }
.ap-tasklist-group { border-bottom: 1px solid var(--ap-border); }
.ap-tasklist-group:last-child { border-bottom: none; }
.ap-tasklist-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--ap-light);
  cursor: pointer;
}
.ap-collapse-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--ap-mid);
  padding: 0;
  line-height: 1;
  transition: transform 0.2s;
}
.ap-collapse-btn.collapsed { transform: rotate(180deg); }
.ap-tasklist-name { font-size: 13px; font-weight: 700; color: var(--ap-yellow-dark); text-transform: uppercase; letter-spacing: 0.4px; }
.ap-tasklist-sub  { font-size: 12px; color: var(--ap-mid); }
.ap-tasklist-count { margin-left: auto; font-size: 12px; color: var(--ap-mid); }
.ap-mini-progress { display: flex; align-items: center; }
.ap-task-list-body { padding: 8px 0; }
.ap-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  transition: background 0.1s;
}
.ap-task-row:hover { background: var(--ap-light); }
.ap-task-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--ap-border);
  background: #fff;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  transition: background 0.15s, border-color 0.15s;
}
.ap-task-check.done { background: var(--ap-green); border-color: var(--ap-green); }
.ap-task-name { font-size: 13px; color: var(--ap-dark); flex: 1; }
.ap-task-name.done { text-decoration: line-through; color: var(--ap-mid); }
.ap-task-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ap-tag-contract  { background: #E6F1FB; color: #185FA5; }
.ap-tag-variation { background: #FAEEDA; color: #854F0B; }
.ap-tag-rework    { background: #FCEBEB; color: #A32D2D; }
.ap-task-hours, .ap-task-due { font-size: 11px; color: var(--ap-mid); }
.ap-task-assignee {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ap-yellow);
  color: var(--ap-dark);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ap-add-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  color: var(--ap-mid);
  cursor: text;
}
.ap-add-task-row .dashicons { font-size: 16px; width: 16px; height: 16px; }
.ap-add-task-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--ap-dark);
  outline: none;
  padding: 4px 0;
}
.ap-add-task-input:focus + .ap-add-task-confirm { display: inline-flex !important; }

/* ── PLACEHOLDER PANELS ───────────────────────────────────── */
.ap-panel-placeholder {
  text-align: center;
  padding: 60px 20px;
  color: var(--ap-mid);
}
.ap-panel-placeholder .dashicons { font-size: 40px; width: 40px; height: 40px; color: var(--ap-yellow); display: block; margin: 0 auto 12px; }
.ap-coming-soon { font-size: 12px; color: var(--ap-border); margin-top: 8px; }

/* ── MODAL ────────────────────────────────────────────────── */
.ap-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,44,42,0.5);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}
/* Google Places Autocomplete dropdown — must sit above .ap-modal-overlay */
.pac-container { z-index: 100001 !important; }
.ap-modal {
  background: #fff;
  border-radius: var(--ap-radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.ap-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ap-border);
}
.ap-modal-header h2 { font-size: 16px; font-weight: 700; color: var(--ap-dark); margin: 0; }
.ap-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--ap-mid);
  line-height: 1;
  padding: 0;
}
.ap-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.ap-field-group label { display: block; font-size: 13px; font-weight: 600; color: var(--ap-dark); margin-bottom: 5px; }
.ap-field-group input, .ap-field-group select, .ap-field-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  font-size: 14px;
  color: var(--ap-dark);
  outline: none;
  transition: border-color 0.15s;
}
.ap-field-group input:focus, .ap-field-group select:focus { border-color: var(--ap-yellow); }
.ap-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--ap-border);
}

/* ── TEAM TAB ─────────────────────────────────────────────── */
.ap-team-panel { display: flex; flex-direction: column; gap: 16px; }
.ap-team-section { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); overflow: hidden; }
.ap-team-section-header { display: flex; align-items: center; gap: 8px; padding: 14px 20px; background: var(--ap-light); font-size: 14px; font-weight: 600; color: var(--ap-dark); border-bottom: 1px solid var(--ap-border); }
.ap-team-section-header .dashicons { color: var(--ap-yellow-dark); font-size: 18px; width:18px;height:18px; }
.ap-team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 12px; padding: 16px 20px; }
.ap-team-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--ap-light); border-radius: var(--ap-radius); position: relative; }
.ap-team-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--ap-yellow); color: var(--ap-dark); font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ap-team-avatar--site   { background: #B5D4F4; color: #185FA5; }
.ap-team-avatar--client { background: #9FE1CB; color: #0F6E56; }
.ap-team-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ap-team-info strong { font-size: 13px; color: var(--ap-dark); }
.ap-team-role { font-size: 11px; color: var(--ap-mid); }
.ap-team-contact { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ap-mid); text-decoration: none; }
.ap-team-contact:hover { color: var(--ap-yellow-dark); }
.ap-team-contact .dashicons { font-size: 14px; width:14px;height:14px; }
.ap-team-empty { padding: 12px 20px; font-size: 13px; color: #aaa; }
.ap-delete-contact-btn { position: absolute; top: 6px; right: 6px; background: none; border: none; color: #ddd; cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 0.15s; }
.ap-team-card:hover .ap-delete-contact-btn { opacity: 1; }
.ap-delete-contact-btn:hover { color: #e05252; }

/* ── 60/40 SPLIT PREVIEW ──────────────────────────────────── */
.ap-split-preview { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--ap-mid); flex-wrap: wrap; }
.ap-split-preview span strong { color: var(--ap-dark); }
.ap-split-bars { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.ap-split-bar-row { display: flex; align-items: center; gap: 6px; }
.ap-split-label { font-size: 10px; color: var(--ap-mid); width: 52px; flex-shrink: 0; }
.ap-split-num { font-size: 10px; color: var(--ap-mid); white-space: nowrap; }

/* ── WORK TYPE BADGE ──────────────────────────────────────── */
.ap-wd-type-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.ap-wd-type-install   { background: #E6F1FB; color: #185FA5; }
.ap-wd-type-dismantle { background: #FAEEDA; color: #854F0B; }

/* ── OVERRUN CARD ─────────────────────────────────────────── */
.ap-report-card--overrun { background: rgba(224,82,82,0.08); border: 1px solid rgba(224,82,82,0.25); }
.ap-report-card--overrun .ap-report-card-val { color: #e05252; }

/* ── GANTT PROJECT BAR ────────────────────────────────────── */
.ap-gantt-row--project { background: rgba(44,44,42,0.03); }
.ap-gantt-bar--project .ap-gantt-bar-label { color: var(--ap-yellow); }

/* ── FILES TAB ────────────────────────────────────────────── */
.ap-files-panel { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); }
.ap-file-category { border-bottom: 1px solid var(--ap-border); }
.ap-file-category:last-child { border-bottom: none; }
.ap-file-category-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; background: var(--ap-light);
  font-size: 13px; font-weight: 600; color: var(--ap-dark);
}
.ap-file-category-header .dashicons { color: var(--ap-yellow-dark); font-size: 16px; width:16px;height:16px; }
.ap-file-count { margin-left: auto; background: var(--ap-border); color: var(--ap-mid); padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 400; }
.ap-file-empty { padding: 10px 20px; font-size: 13px; color: #aaa; }
.ap-file-list { padding: 4px 0; }
.ap-file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; transition: background 0.1s;
}
.ap-file-row:hover { background: var(--ap-light); }
.ap-file-icon { font-size: 20px; width:20px; height:20px; color: var(--ap-mid); flex-shrink: 0; }
.ap-file-info { flex: 1; min-width: 0; }
.ap-file-name { font-size: 13px; font-weight: 500; color: var(--ap-dark); text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-file-name:hover { color: var(--ap-yellow-dark); }
.ap-file-meta { font-size: 11px; color: var(--ap-mid); }
.ap-file-download { color: var(--ap-mid); text-decoration: none; }
.ap-file-download:hover { color: var(--ap-yellow-dark); }
.ap-file-download .dashicons { font-size: 18px; width:18px; height:18px; }
.ap-delete-file-btn { background: none; border: none; color: #ccc; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; opacity: 0; transition: opacity 0.15s; }
.ap-file-row:hover .ap-delete-file-btn { opacity: 1; }
.ap-delete-file-btn:hover { background: #e05252; color: #fff; }

/* ── GANTT ZOOM ───────────────────────────────────────────── */
.ap-gantt-zoom { display: flex; gap: 4px; }
.ap-gantt-zoom-btn {
  padding: 5px 12px;
  border-radius: var(--ap-radius);
  border: 1px solid var(--ap-border);
  background: var(--ap-light);
  font-size: 12px;
  color: var(--ap-mid);
  cursor: pointer;
  transition: all 0.15s;
}
.ap-gantt-zoom-btn:hover { background: var(--ap-yellow-bg); border-color: var(--ap-yellow); color: var(--ap-dark); }
.ap-gantt-zoom-btn.active { background: var(--ap-yellow); border-color: var(--ap-yellow); color: var(--ap-dark); font-weight: 600; }

/* ── OVERLAP ALERT ────────────────────────────────────────── */
.ap-overlap-alert {
  margin: 0 20px 16px;
  background: rgba(245,166,35,0.1);
  border: 1px solid rgba(245,166,35,0.4);
  border-radius: var(--ap-radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ap-dark);
}
.ap-overlap-alert .dashicons { color: #F5A623; font-size: 18px; width:18px; height:18px; vertical-align: middle; margin-right: 4px; }
.ap-overlap-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.ap-overlap-item { font-size: 12px; color: var(--ap-mid); padding-left: 22px; }

/* ── GANTT TAB ────────────────────────────────────────────── */
.ap-gantt-panel { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); }
.ap-gantt-wrap { padding: 16px 0; overflow-x: auto; }
.ap-gantt-table { min-width: 600px; }
.ap-gantt-header, .ap-gantt-row { display: flex; align-items: center; border-bottom: 1px solid var(--ap-border); }
.ap-gantt-header { background: var(--ap-light); font-size: 11px; color: var(--ap-mid); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.ap-gantt-label-col { width: 200px; flex-shrink: 0; padding: 10px 16px; font-size: 13px; }
.ap-gantt-bar-col { flex: 1; position: relative; height: 40px; }
.ap-gantt-header .ap-gantt-bar-col { height: 28px; }
.ap-gantt-month-label { position: absolute; top: 6px; font-size: 11px; color: var(--ap-mid); white-space: nowrap; }
.ap-gantt-bar {
  position: absolute; top: 8px; height: 24px;
  border-radius: 4px; display: flex; align-items: center;
  padding: 0 8px; min-width: 4px; cursor: default;
  transition: filter 0.15s;
}
.ap-gantt-bar:hover { filter: brightness(0.9); }
.ap-gantt-bar-label { font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.ap-gantt-milestone { position: absolute; top: 8px; font-size: 16px; color: #333; transform: translateX(-50%); cursor: default; }
.ap-gantt-no-dates { font-size: 12px; color: #ccc; padding: 0 12px; }
.ap-gantt-wp { font-weight: 600; color: var(--ap-yellow-dark); margin-right: 6px; }
.ap-gantt-desc { font-size: 12px; color: var(--ap-mid); }
.ap-gantt-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--ap-border); }
.ap-gantt-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ap-mid); }
.ap-gantt-legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* ── DISCUSSIONS TAB ──────────────────────────────────────── */
.ap-discuss-panel { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); display: flex; flex-direction: column; }
.ap-discuss-thread { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; max-height: 500px; overflow-y: auto; }
.ap-discuss-msg { display: flex; gap: 10px; align-items: flex-start; }
.ap-discuss-mine { flex-direction: row-reverse; }
.ap-discuss-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ap-yellow); color: var(--ap-dark); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ap-discuss-avatar--mine { background: var(--ap-dark); color: var(--ap-yellow); }
.ap-discuss-bubble { flex: 1; max-width: 75%; }
.ap-discuss-mine .ap-discuss-bubble { align-items: flex-end; }
.ap-discuss-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.ap-discuss-mine .ap-discuss-meta { flex-direction: row-reverse; }
.ap-discuss-meta strong { font-size: 13px; color: var(--ap-dark); }
.ap-discuss-meta span { font-size: 11px; color: var(--ap-mid); }
.ap-discuss-text { background: var(--ap-light); border-radius: var(--ap-radius); padding: 10px 14px; font-size: 13px; color: var(--ap-dark); line-height: 1.5; display: inline-block; max-width: 100%; }
.ap-discuss-mine .ap-discuss-text { background: var(--ap-yellow-bg); border: 1px solid rgba(245,197,24,0.3); }
.ap-delete-comment-btn { background: none; border: none; color: #ddd; cursor: pointer; font-size: 12px; padding: 4px; opacity: 0; transition: opacity 0.15s; align-self: center; }
.ap-discuss-msg:hover .ap-delete-comment-btn { opacity: 1; }
.ap-delete-comment-btn:hover { color: #e05252; }
.ap-discuss-compose { display: flex; gap: 10px; align-items: flex-end; padding: 14px 20px; border-top: 1px solid var(--ap-border); background: var(--ap-light); border-radius: 0 0 var(--ap-radius-lg) var(--ap-radius-lg); }
.ap-discuss-input-wrap { flex: 1; display: flex; gap: 8px; align-items: flex-end; }
.ap-discuss-input-wrap textarea { flex: 1; border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 8px 12px; font-size: 13px; resize: none; outline: none; font-family: inherit; }
.ap-discuss-input-wrap textarea:focus { border-color: var(--ap-yellow); }
.ap-discuss-input-wrap .ap-btn-primary { white-space: nowrap; }

/* ── GAUGE ────────────────────────────────────────────────── */
.ap-gauge-wrap { position: relative; max-width: 220px; margin: 0 auto; }
.ap-gauge-centre { position: absolute; bottom: 10%; left: 50%; transform: translateX(-50%); text-align: center; }
.ap-gauge-pct { font-size: 28px; font-weight: 700; color: var(--ap-dark); line-height: 1; }
.ap-gauge-label { font-size: 12px; color: var(--ap-mid); }
.ap-gauge-sub { font-size: 11px; color: var(--ap-mid); margin-top: 2px; }
.ap-gauge-stats { display: flex; justify-content: space-around; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ap-border); }
.ap-gauge-stat { text-align: center; }
.ap-gauge-stat-label { display: block; font-size: 11px; color: var(--ap-mid); margin-bottom: 2px; }
.ap-gauge-stat-val { font-size: 14px; font-weight: 600; color: var(--ap-dark); }

/* ── HEATMAP ──────────────────────────────────────────────── */
.ap-heatmap-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.ap-heat-cell { width: 72px; height: 64px; border-radius: var(--ap-radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: default; transition: transform 0.15s; }
.ap-heat-cell:hover { transform: scale(1.05); }
.ap-heat-wp  { font-size: 12px; font-weight: 700; color: #fff; }
.ap-heat-val { font-size: 11px; color: rgba(255,255,255,0.85); }
.ap-heat-red        { background: #e05252; }
.ap-heat-orange     { background: #F5A623; }
.ap-heat-green      { background: #4db88a; }
.ap-heat-green-dark { background: #1D9E75; }
.ap-heatmap-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; border-top: 1px solid var(--ap-border); padding-top: 10px; }
.ap-heat-legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ap-mid); }
.ap-heat-dot { width: 10px; height: 10px; border-radius: 2px; }

/* ── REPORTS PANEL ────────────────────────────────────────── */
.ap-reports-panel { display: flex; flex-direction: column; gap: 20px; }
.ap-report-summary { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; }
.ap-report-card { background: var(--ap-light); border-radius: var(--ap-radius); padding: 14px 16px; }
.ap-report-card--warning { background: rgba(224,82,82,0.08); border: 1px solid rgba(224,82,82,0.2); }
.ap-report-card--ok { background: var(--ap-green-bg); border: 1px solid rgba(29,158,117,0.2); }
.ap-report-card-label { font-size: 11px; color: var(--ap-mid); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.ap-report-card-val { font-size: 22px; font-weight: 600; color: var(--ap-dark); }
.ap-report-section { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); padding: 16px 20px; }
.ap-report-section-title { font-size: 14px; font-weight: 600; color: var(--ap-dark); margin-bottom: 14px; }
.ap-chart-wrap { position: relative; }

.ap-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ap-chart-section { min-width: 0; }
@media (max-width: 700px) { .ap-charts-row { grid-template-columns: 1fr; } }

/* ── HOURS TABLE ──────────────────────────────────────────── */
.ap-hours-table-wrap { overflow-x: auto; }
.ap-hours-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ap-hours-table th { text-align: left; padding: 8px 12px; background: var(--ap-light); color: var(--ap-mid); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--ap-border); white-space: nowrap; }
.ap-hours-table td { padding: 10px 12px; border-bottom: 1px solid var(--ap-border); vertical-align: middle; }
.ap-hours-table tr:last-child td { border-bottom: none; }
.ap-hours-table tr.ap-row--over { background: rgba(224,82,82,0.04); }
.ap-hours-table tr.ap-row--over:hover { background: rgba(224,82,82,0.08); }
.ap-hours-table tbody tr:hover { background: var(--ap-light); }
.ap-hours-table tfoot td { background: var(--ap-light); border-top: 2px solid var(--ap-border); }
.ap-td-wp { font-weight: 600; color: var(--ap-yellow-dark); white-space: nowrap; }
.ap-td-desc { max-width: 200px; }
.ap-td-num { text-align: right; white-space: nowrap; }
.ap-td-progress { min-width: 120px; }
.ap-table-progress-wrap { display: flex; align-items: center; gap: 8px; }
.ap-table-progress-wrap .ap-progress-bar { flex: 1; }
.ap-table-progress-wrap span { font-size: 11px; color: var(--ap-mid); white-space: nowrap; }
.ap-variance--over { color: #e05252; font-weight: 600; }
.ap-variance--under { color: var(--ap-green); font-weight: 600; }
.ap-totals-row td { font-size: 13px; }

@media (max-width: 600px) {
  .ap-report-summary { grid-template-columns: repeat(2,1fr); }
  .ap-report-summary .ap-report-card:last-child { grid-column: 1/-1; }
}

/* ── STATUS PILLS ─────────────────────────────────────────── */
.ap-status-pill { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.ap-status-grey   { background: var(--ap-light); color: var(--ap-mid); }
.ap-status-yellow { background: var(--ap-yellow-bg); color: var(--ap-yellow-dark); }
.ap-status-blue   { background: #E6F1FB; color: #185FA5; }
.ap-status-orange { background: #FAEEDA; color: #854F0B; }
.ap-status-green  { background: var(--ap-green-bg); color: var(--ap-green); }

/* ── TRANSPORT SECTION IN TASK MODAL ─────────────────────── */
.ap-transport-section { border: 1px solid var(--ap-border); border-radius: var(--ap-radius); margin-top: 8px; overflow: visible; }
.ap-transport-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--ap-light);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-dark);
  user-select: none;
}
.ap-transport-section-header:hover { background: var(--ap-yellow-bg); }
.ap-transport-section-header .dashicons { color: var(--ap-yellow-dark); font-size: 16px; width: 16px; height: 16px; }
.ap-transport-count { font-weight: 400; color: var(--ap-mid); font-size: 12px; }
.ap-transport-toggle-icon { margin-left: auto; font-size: 18px; color: var(--ap-mid); }
#ap-task-transport-body { padding: 12px 16px; background: #fff; border-top: 1px solid var(--ap-border); }
.ap-transport-wp-ref { font-size: 11px; background: #E6F1FB; color: #185FA5; padding: 2px 8px; border-radius: 10px; }
.ap-transport-standalone-badge { font-size: 11px; background: var(--ap-light); color: var(--ap-mid); padding: 2px 8px; border-radius: 10px; border: 1px solid var(--ap-border); }

/* ── TRANSPORT PANEL ──────────────────────────────────────── */
.ap-transport-panel { background: #fff; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-lg); }
.ap-transport-list { padding: 12px 20px; display: flex; flex-direction: column; gap: 10px; }
.ap-transport-entry { background: var(--ap-light); border-radius: var(--ap-radius); padding: 12px 16px; }
.ap-transport-entry-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ap-transport-type-badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.ap-transport-type--delivery { background: #E6F1FB; color: #185FA5; }
.ap-transport-type--backload { background: #FAEEDA; color: #854F0B; }
.ap-transport-type--transfer { background: var(--ap-yellow-bg); color: var(--ap-yellow-dark); }
.ap-transport-date { font-size: 13px; font-weight: 600; color: var(--ap-dark); }
.ap-transport-booking { font-size: 12px; color: var(--ap-mid); background: #fff; border: 1px solid var(--ap-border); padding: 2px 8px; border-radius: 10px; }
.ap-transport-detail { font-size: 13px; color: var(--ap-dark); margin-bottom: 4px; }
.ap-transport-notes { color: var(--ap-mid); font-style: italic; }
.ap-delete-transport-btn { margin-left: auto; background: none; border: none; color: #ccc; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.ap-delete-transport-btn:hover { background: #e05252; color: #fff; }

/* ── BREADCRUMB ───────────────────────────────────────────── */
.ap-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ap-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ap-mid);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--ap-radius);
  background: var(--ap-light);
  border: 1px solid var(--ap-border);
  transition: all 0.15s;
}
.ap-breadcrumb-item:hover {
  background: var(--ap-yellow-bg);
  border-color: var(--ap-yellow);
  color: var(--ap-dark);
  text-decoration: none;
}
.ap-breadcrumb-item .dashicons { font-size: 14px; width: 14px; height: 14px; }
.ap-breadcrumb-sep { color: var(--ap-border); font-size: 16px; }
.ap-breadcrumb-current { font-size: 13px; color: var(--ap-dark); font-weight: 600; }

/* ── TASK MODAL ───────────────────────────────────────────── */
.ap-task-modal {
  max-width: 680px;
  width: 95vw;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.ap-task-modal-body {
  overflow-y: scroll;
  flex: 1;
  padding-bottom: 16px;
  min-height: 0;
}
.ap-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ap-field-sm { flex: 1; min-width: 120px; }
.ap-field-lg { flex: 2; min-width: 200px; }
.ap-field-hint { font-size: 11px; color: var(--ap-mid); font-weight: 400; }
.ap-field-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius);
  font-size: 14px;
  color: var(--ap-dark);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.ap-field-group textarea:focus { border-color: var(--ap-yellow); }

/* ── IMAGE UPLOAD ─────────────────────────────────────────── */
.ap-image-upload-area {
  position: relative;
  border: 2px dashed var(--ap-border);
  border-radius: var(--ap-radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--ap-light);
}
.ap-image-upload-area:hover {
  border-color: var(--ap-yellow);
  background: var(--ap-yellow-bg);
}
.ap-image-upload-area .dashicons {
  font-size: 32px;
  width: 32px;
  height: 32px;
  color: var(--ap-mid);
  display: block;
  margin: 0 auto 8px;
}
.ap-image-upload-area--progress { border-color: #9FE1CB; background: rgba(29,158,117,0.04); }
.ap-image-upload-area--progress:hover { border-color: var(--ap-green); background: rgba(29,158,117,0.08); }
.ap-image-upload-area--progress .dashicons { color: var(--ap-green); }
.ap-image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.ap-img-thumb { position: relative; }
.ap-img-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--ap-radius);
  border: 1px solid var(--ap-border);
}
.ap-img-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── ADD WORK PACKAGE BUTTON ──────────────────────────────── */
.ap-add-task-row {
  padding: 10px 20px 14px;
}
.ap-open-task-modal-btn {
  font-size: 13px;
  padding: 7px 14px;
}

/* ── MOBILE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ap-task-modal { width: 100vw; max-height: 100vh; border-radius: 0; margin: 0; }
  .ap-task-modal-overlay .ap-modal { border-radius: 0; }
  .ap-form-row { flex-direction: column; }
  .ap-breadcrumb-current { display: none; }
  /* Shift modal stacks on mobile */
  .ap-shift-two-col { grid-template-columns: 1fr !important; }
}
/* Shift modal — checked-row highlight */
.ap-shift-crew-row:hover { background: #fafaf7; }
.ap-shift-crew-row:has(input:checked) { background: #f0fff4; }

/* ── TASK DETAIL INFO STRIP ───────────────────────────────── */
.ap-detail-info-strip {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--ap-light);
  border-radius: var(--ap-radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.ap-detail-info-item { display: flex; flex-direction: column; gap: 3px; }
.ap-detail-info-label { font-size: 11px; color: var(--ap-mid); text-transform: uppercase; letter-spacing: 0.5px; }
.ap-detail-info-item strong { font-size: 14px; color: var(--ap-dark); }
.ap-detail-desc {
  font-size: 15px;
  font-weight: 600;
  color: var(--ap-dark);
  padding: 4px 0 8px;
}
.ap-detail-notes {
  font-size: 13px;
  color: var(--ap-mid);
  padding: 0 0 12px;
  border-bottom: 1px solid var(--ap-border);
  margin-bottom: 12px;
}

/* ── CREW CHECKBOX ────────────────────────────────────────── */
.ap-crew-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--ap-yellow);
  cursor: pointer;
  flex-shrink: 0;
}
.ap-crew-hours:disabled { opacity: 0.3; background: var(--ap-light); }
.ap-crew-row { cursor: pointer; }
.ap-crew-name { cursor: pointer; }

/* ── TASK ROW (clickable) ─────────────────────────────────── */
.ap-task-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ap-task-hours-bar { height: 3px; background: var(--ap-border); border-radius: 2px; overflow: hidden; width: 120px; }
.ap-task-hours-fill { height: 100%; background: var(--ap-yellow); border-radius: 2px; }
.ap-task-hours-label { font-size: 11px; color: var(--ap-mid); }
.ap-task-view-btn { font-size: 12px; color: var(--ap-yellow-dark); font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
.ap-task-row:hover .ap-task-view-btn { opacity: 1; }
.ap-task-row { cursor: pointer; }

/* ── HOURS SUMMARY ────────────────────────────────────────── */
.ap-hours-summary { background: var(--ap-light); border-radius: var(--ap-radius); padding: 14px 16px; margin-bottom: 16px; }
.ap-hours-summary-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }

/* ── SECTION HEADER ───────────────────────────────────────── */
.ap-section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 8px; border-bottom: 1px solid var(--ap-border); margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--ap-dark); }
.ap-btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── WORK DAY ENTRIES ─────────────────────────────────────── */
.ap-workday-entry { background: var(--ap-light); border-radius: var(--ap-radius); padding: 10px 14px; margin-bottom: 8px; }
.ap-wd-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ap-wd-date { font-size: 13px; font-weight: 600; color: var(--ap-dark); }
.ap-wd-day-total { font-size: 13px; font-weight: 600; color: var(--ap-yellow-dark); }
.ap-wd-crew { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-wd-crew-item { font-size: 12px; background: #fff; border: 1px solid var(--ap-border); border-radius: 20px; padding: 2px 10px; color: var(--ap-dark); }

/* ── ADD WORKDAY FORM ─────────────────────────────────────── */
.ap-workday-form { background: var(--ap-light); border-radius: var(--ap-radius); padding: 14px; margin-top: 8px; border: 1px solid var(--ap-border); }
.ap-crew-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--ap-border); }
.ap-crew-row:last-child { border-bottom: none; }
.ap-crew-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ap-yellow); color: var(--ap-dark); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ap-crew-name { flex: 1; font-size: 13px; color: var(--ap-dark); }
.ap-crew-hours { width: 70px; padding: 5px 8px; border: 1px solid var(--ap-border); border-radius: var(--ap-radius); font-size: 13px; text-align: center; }
.ap-crew-hours:focus { border-color: var(--ap-yellow); outline: none; }
.ap-workday-form-footer { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ap-border); }
.ap-wd-total { flex: 1; font-size: 13px; color: var(--ap-mid); }

/* ── DELETE BUTTONS ───────────────────────────────────────── */
.ap-delete-task-btn, .ap-delete-list-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.ap-task-row:hover .ap-delete-task-btn,
.ap-tasklist-group-header:hover .ap-delete-list-btn { opacity: 1; }
.ap-delete-task-btn:hover { color: #fff; background: #e05252; }
.ap-delete-list-btn:hover { color: #fff; background: #e05252; }
.ap-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: transparent;
  color: #e05252;
  border: 1px solid #e05252;
  border-radius: var(--ap-radius);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.ap-btn-danger:hover { background: #e05252; color: #fff; }

/* ── MISC ─────────────────────────────────────────────────── */
.ap-empty { font-size: 14px; color: var(--ap-mid); text-align: center; padding: 30px 0; }
.ap-login-notice { padding: 20px; background: var(--ap-light); border-radius: var(--ap-radius); color: var(--ap-mid); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .ap-portal-grid { grid-template-columns: repeat(2, 1fr); }
  .ap-stat-row { grid-template-columns: 1fr 1fr; }
  .ap-proj-actions { display: none; }
  .ap-project-card { flex-wrap: wrap; }
}

/* ── DASHBOARD ──────────────────────────────────────────────────── */
.ap-dashboard-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; }
.ap-dashboard-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:24px; }
.ap-dash-card { background:#fff; border:1px solid #eee; border-radius:10px; padding:16px; }
.ap-dash-card-label { font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:#888; margin-bottom:6px; }
.ap-dash-card-val { font-size:24px; font-weight:700; color:var(--ap-dark); }

.ap-dashboard-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.ap-dash-panel { background:#fff; border:1px solid #eee; border-radius:10px; padding:16px; }
.ap-dash-panel--wide { grid-column:1/-1; }
.ap-dash-panel-header { display:flex; align-items:center; gap:8px; font-weight:600; font-size:13px; color:var(--ap-dark); margin-bottom:14px; }
.ap-dash-list { display:flex; flex-direction:column; gap:8px; }
.ap-dash-list-item { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; background:#f9f9f9; border-radius:6px; gap:8px; }
.ap-dash-list-item--overdue { background:#fff5f5; border-left:3px solid #e74c3c; }
.ap-dash-list-main { flex:1; min-width:0; }
.ap-dash-list-meta { white-space:nowrap; flex-shrink:0; }

/* WP count badge on project list */
.ap-proj-wp-count { font-size:11px; color:#888; display:flex; align-items:center; gap:3px; }

@media (max-width:768px) {
  .ap-dashboard-grid { grid-template-columns:1fr; }
  .ap-dash-panel--wide { grid-column:1; }
  .ap-dashboard-cards { grid-template-columns:repeat(2,1fr); }
}

/* ── TWO COLUMN PORTAL LAYOUT ────────────────────────────────── */
.ap-portal-layout { display:grid; grid-template-columns:1.4fr 1fr; gap:20px; align-items:start; }
.ap-portal-projects { min-width:0; }
.ap-portal-dashboard { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.ap-dash-empty { padding:16px 0; font-size:12px; color:#aaa; text-align:center; }

/* Lookahead table */
.ap-lookahead-table { width:100%; border-collapse:collapse; font-size:12px; }
.ap-lookahead-table th { background:#f5f5f5; padding:8px; text-align:center; border-bottom:2px solid #eee; font-size:11px; font-weight:600; }
.ap-lookahead-table td { border-bottom:1px solid #f0f0f0; vertical-align:middle; }
.ap-lookahead-table tbody tr:hover { background:#fafafa; }
.ap-lookahead-totals td { background:#f9f9f9; font-weight:600; }

@media (max-width:900px) {
  .ap-portal-layout { grid-template-columns:1fr; }
  .ap-portal-dashboard { grid-template-columns:1fr; }
}

/* ── PORTAL SECTION HEADERS ──────────────────────────────────── */
.ap-portal-section-header {
  display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:700; text-transform:uppercase;
  letter-spacing:.5px; color:var(--ap-dark);
  padding:10px 0 8px;
  border-bottom:2px solid var(--ap-yellow);
  margin-bottom:12px;
}

/* ── PORTAL LAYOUT v5 ────────────────────────────────────────── */
.ap-portal-layout {
  display: grid;
  grid-template-columns: 55% 1fr;
  gap: 0;
  align-items: start;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.ap-portal-projects {
  border-right: 2px solid #f0f0f0;
  padding: 0;
}

.ap-portal-projects .ap-filter-tabs {
  padding: 12px 16px 0;
  border-bottom: 1px solid #f0f0f0;
}

.ap-portal-projects .ap-project-list {
  padding: 8px 0;
  max-height: 70vh;
  overflow-y: auto;
}

.ap-portal-projects .ap-project-card {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #f5f5f5;
  margin: 0;
}

.ap-portal-projects .ap-project-card:last-child {
  border-bottom: none;
}

.ap-portal-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fafafa;
  max-height: 70vh;
  overflow-y: auto;
}

.ap-portal-dashboard .ap-dash-panel {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #efefef;
  background: #fff;
  margin: 0;
  padding: 14px 16px;
}

.ap-portal-dashboard .ap-dash-panel:nth-child(odd) {
  background: #fafafa;
}

.ap-portal-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #fff;
  background: var(--ap-dark);
  padding: 10px 16px;
}

.ap-portal-section-header .dashicons {
  color: var(--ap-yellow);
}

/* Tighten dashboard panels inside the column */
.ap-portal-dashboard .ap-dash-panel-header {
  font-size: 12px;
  margin-bottom: 10px;
}

.ap-portal-dashboard .ap-dash-list-item {
  padding: 6px 8px;
}

.ap-portal-dashboard .ap-dash-empty {
  padding: 10px 0;
  font-size: 11px;
}

@media (max-width: 900px) {
  .ap-portal-layout {
    grid-template-columns: 1fr;
  }
  .ap-portal-projects {
    border-right: none;
    border-bottom: 2px solid #f0f0f0;
  }
  .ap-portal-projects .ap-project-list,
  .ap-portal-dashboard {
    max-height: none;
  }
}

/* ── PORTAL HOME v5 ──────────────────────────────────────────── */
.ap-summary-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.ap-sum-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px 16px;
}
.ap-sum-card--alert { border-color: #fca5a5; background: #fff5f5; }
.ap-sum-card--warn  { border-color: #fcd34d; background: #fffbeb; }
.ap-sum-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.ap-sum-val   { font-size: 22px; font-weight: 700; color: var(--ap-dark); }
.ap-val-red   { color: #e74c3c !important; }
.ap-val-orange{ color: #e67e22 !important; }
.ap-sum-bar   { height: 3px; background: #f0f0f0; border-radius: 2px; margin-top: 6px; }
.ap-sum-bar-fill { height: 100%; background: var(--ap-yellow); border-radius: 2px; }

/* Two column layout */
.ap-portal-layout {
  display: grid;
  grid-template-columns: 60% 1fr;
  gap: 16px;
  align-items: start;
}
.ap-portal-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--ap-dark);
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--ap-yellow);
  margin-bottom: 12px;
}

/* Clean project cards */
.ap-project-card--clean {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  transition: background .15s;
}
.ap-project-card--clean:hover { background: #fafafa; }
.ap-proj-card-main { flex: 1; min-width: 0; }
.ap-proj-job { color: var(--ap-yellow-dark); font-weight: 700; }
.ap-proj-card-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: #888; }
.ap-proj-site { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-proj-wps  { color: #aaa; }
.ap-proj-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; min-width: 180px; }
.ap-proj-card-dates { display: flex; gap: 8px; align-items: center; font-size: 11px; }
.ap-proj-end-date { color: #888; }
.ap-proj-days-left { font-weight: 600; }
.ap-proj-card-bars { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.ap-proj-bar-row { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.ap-proj-bar-label { color: #aaa; width: 40px; text-align: right; flex-shrink: 0; }
.ap-proj-bar-pct { color: #888; width: 28px; text-align: right; flex-shrink: 0; }
.ap-proj-card-actions { display: flex; align-items: center; gap: 4px; }

/* Alert panels */
.ap-portal-dashboard { display: flex; flex-direction: column; gap: 12px; }
.ap-alert-panel {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
}
.ap-alert-panel--red    { border-color: #fca5a5; }
.ap-alert-panel--yellow { border-color: #fcd34d; }
.ap-alert-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ap-dark);
  margin-bottom: 10px;
}
.ap-alert-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.ap-badge-red    { background: #fee2e2; color: #e74c3c; }
.ap-badge-yellow { background: #fef3c7; color: #d97706; }
.ap-alert-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid #f5f5f5;
  flex-wrap: wrap;
}
.ap-alert-item:last-child { border-bottom: none; }
.ap-alert-date { margin-left: auto; font-size: 11px; color: #888; white-space: nowrap; }
.ap-alert-ok { font-size: 12px; color: #1D9E75; margin: 0; }

@media (max-width: 900px) {
  .ap-summary-cards   { grid-template-columns: repeat(2,1fr); }
  .ap-portal-layout   { grid-template-columns: 1fr; }
}

/* ── AVAILABILITY TICK LIST ──────────────────────────────────── */
.ap-avail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-bottom: 1px solid #f5f5f5;
  gap: 8px;
}
.ap-avail-row:last-of-type { border-bottom: none; }
.ap-avail-left  { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ap-avail-right { flex-shrink: 0; }
.ap-avail-name  { font-size: 12px; color: var(--ap-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-avail-avatar--off { background: #ccc !important; opacity: .6; }

/* Toggle switch */
.ap-avail-toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.ap-avail-toggle input { opacity: 0; width: 0; height: 0; }
.ap-avail-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc; border-radius: 22px;
  transition: .2s;
}
.ap-avail-slider:before {
  position: absolute; content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  transition: .2s;
}
.ap-avail-toggle input:checked + .ap-avail-slider { background: #1D9E75; }
.ap-avail-toggle input:checked + .ap-avail-slider:before { transform: translateX(16px); }

/* ── PLANNING CALENDAR ───────────────────────────────────────── */
.ap-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: #e8e8e8;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
}
.ap-cal-header {
  background: var(--ap-dark);
  color: #fff;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 0;
}
.ap-cal-cell {
  background: #fff;
  min-height: 110px;
  padding: 6px;
  position: relative;
  vertical-align: top;
}
.ap-cal-empty   { background: #fafafa; }
.ap-cal-weekend { background: #f9f9f9; }
.ap-cal-today   { background: #fffde7 !important; outline: 2px solid var(--ap-yellow); outline-offset: -2px; }
.ap-cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: #888;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ap-cal-today .ap-cal-day-num { color: var(--ap-dark); }
.ap-cal-crew-badge {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 1px 5px;
}
.ap-cal-events  { display: flex; flex-direction: column; gap: 2px; }
.ap-cal-event {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  padding: 2px 5px;
  border-radius: 3px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.ap-cal-event--project  { opacity: .9; }
.ap-cal-event--milestone {
  background: transparent !important;
  color: var(--ap-dark);
  font-size: 10px;
  padding: 1px 2px;
}
.ap-cal-event:hover { opacity: 1; filter: brightness(1.1); }

/* ── WEEK VIEW ───────────────────────────────────────────────── */
.ap-cal-week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
  background: #e8e8e8;
  gap: 1px;
}
.ap-week-time-col {
  background: #f9f9f9;
  font-size: 10px;
  color: #aaa;
  text-align: right;
  padding: 6px 6px 0 0;
  min-height: 44px;
}
.ap-week-day-header {
  background: #fff;
  text-align: center;
  padding: 10px 4px 8px;
  font-size: 12px;
  min-height: 70px;
}
.ap-week-allday {
  background: #fff;
  padding: 4px;
  min-height: 36px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ap-week-hour-cell {
  background: #fff;
  min-height: 36px;
  border-top: 1px solid #f5f5f5;
}
.ap-week-active { background: #f0fff8 !important; }
.ap-week-hour-cell.ap-cal-weekend { background: #fafafa !important; }

/* ── AT RISK / VARIANCE HEATMAP ──────────────────────────────── */
.ap-risk-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: default;
}
.ap-td-risk { text-align: center; white-space: nowrap; }

/* ── FINANCIALS TAB — WIDER LAYOUT ───────────────────────────── */
.ap-financials-wrap {
  max-width: 100%;
  width: 100%;
}
/* Override the default tab content max-width for financials */
.ap-tab-content--financials {
  max-width: 100% !important;
  padding: 0 !important;
}

/* ── FINANCIALS WIDE OVERRIDE ────────────────────────────────── */
.ap-pm-wrap.ap-financials-wide {
  max-width: 100% !important;
}

/* ── HIRE SCHEDULE WIDTH FIX ─────────────────────────────────── */
.ap-pm-wrap.ap-financials-wide,
.ap-pm-wrap.ap-hire-wide {
  max-width: 100% !important;
}

/* ── FULL WIDTH FOR WIDE TABS ────────────────────────────────── */
/* Override Elementor and theme containers */
.ap-pm-wrap.ap-financials-wide {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}
/* Force parent containers to not restrict width */
.ap-pm-wrap.ap-financials-wide .ap-hours-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.ap-pm-wrap.ap-financials-wide table {
  min-width: 900px;
}

/* ── PMHP Action Dropdowns (Planning, Admin) ─────────────────────── */
.ap-pm-dd {
  position: relative;
  display: inline-block;
  list-style: none;
}
.ap-pm-dd > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.ap-pm-dd > summary::-webkit-details-marker { display: none; }
.ap-pm-dd > summary::marker { display: none; content: ''; }
.ap-btn-dd .dashicons-arrow-down-alt2 { opacity: 0.6; margin-left: 2px; }
.ap-pm-dd[open] > summary .dashicons-arrow-down-alt2 { transform: rotate(180deg); }
.ap-pm-dd-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid #d6d4cd;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  min-width: 180px;
  padding: 6px 0;
  z-index: 100;
}
.ap-pm-dd-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: #2C2C2A;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s;
}
.ap-pm-dd-menu a:hover { background: #f7f6f2; }
.ap-pm-dd-menu .dashicons { font-size: 16px; width: 16px; height: 16px; }
/* Click-outside-to-close via the form-pattern: details auto-closes on outside click in modern browsers,
   but we add a backup via JS in the page if needed. For now, label-based close works. */
