/* ═══ STUDIOHAUS PORTAL — Project management (Board, Job panel, Setup) ═══
   Monochrome like the rest of core.css. The only colour is the office chip,
   muted, taken from client_offices.color. Flags use the status warning tone. */

.pm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pm-title-h { margin: 0; font-size: 1.2rem; font-weight: var(--fw-semi); color: var(--text); }
.pm-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-head-sub { justify-content: flex-end; margin-bottom: 12px; }
.pm-note { font-size: var(--fs-sm); color: var(--text-45); margin: 0 0 12px; }
.pm-muted { color: var(--text-45); font-size: var(--fs-sm); }
.pm-filter-bar { flex-wrap: wrap; }

/* Office chip: muted tint of the office colour */
.pm-office-chip {
  --pm-oc: #8a8a8a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 100px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text);
  white-space: nowrap;
  background: color-mix(in srgb, var(--pm-oc) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--pm-oc) 38%, transparent);
}
.pm-office-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pm-oc); flex-shrink: 0; }

.pm-svc-chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 1px 4px 1px 0;
  border-radius: 100px;
  font-size: var(--fs-xs);
  color: var(--text-60);
  border: 1px solid var(--border-hover);
  white-space: nowrap;
}

.pm-flags { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.pm-flag {
  font-size: 10px;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--status-warning);
  background: rgba(var(--status-warning-rgb), 0.1);
  border: 1px solid rgba(var(--status-warning-rgb), 0.25);
  white-space: nowrap;
}

/* Board groups */
.pm-group { margin-bottom: 18px; }
.pm-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
}
.pm-group-caret { width: 14px; color: var(--text-45); font-size: var(--fs-md); }
.pm-group-name { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--text-60); }
.pm-group-count { font-size: var(--fs-xs); color: var(--text-45); }
.pm-group-total { margin-left: auto; font-size: var(--fs-sm); color: var(--text-60); font-variant-numeric: tabular-nums; }
.pm-empty-row { padding: 12px 4px; font-size: var(--fs-sm); color: var(--text-45); }

.pm-table-wrap { overflow-x: auto; }
.pm-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.pm-table th {
  text-align: left;
  font-size: 10px;
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-45);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.pm-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.pm-row { cursor: pointer; transition: background 0.15s; }
.pm-row:hover { background: var(--bg-card-hover); }
.pm-c-title { min-width: 220px; }
.pm-c-office { width: 120px; }
.pm-c-svc { min-width: 150px; }
.pm-c-status { width: 130px; }
.pm-c-date { width: 100px; white-space: nowrap; color: var(--text-60); }
.pm-c-people { width: 140px; color: var(--text-60); }
.pm-c-rate { width: 90px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pm-table th.pm-c-rate { text-align: right; }
.pm-job-name { font-weight: var(--fw-medium); color: var(--text); }
.pm-job-sub { font-size: var(--fs-xs); color: var(--text-45); margin-top: 2px; }
.pm-rate-src {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
  color: var(--text-45);
  border: 1px solid var(--border-hover);
  border-radius: 3px;
  padding: 0 3px;
  vertical-align: 1px;
}
.pm-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Status select: a pill that is a native select */
.pm-status-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border-hover);
  color: var(--text);
  border-radius: 100px;
  padding: 3px 12px;
  font-family: var(--font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  cursor: pointer;
  max-width: 130px;
}
.pm-status-select:focus { border-color: var(--focus); outline: none; }
.pm-status-lg { font-size: var(--fs-sm); padding: 5px 14px; max-width: none; }

/* Shoot status pill (read only), same tones as the select. Monochrome
   and muted: tone says how far along, not good or bad. config.js
   pmStatusPill / PM_TONE. */
.pm-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-hover);
  background: var(--bg-input);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.5;
  white-space: nowrap;
}
.pm-pill-lg { font-size: var(--fs-sm); padding: 4px 14px; }
.pm-tone-early { color: var(--text-60); }
.pm-tone-work { color: var(--text); }
.pm-tone-billing { color: var(--text-60); border-style: dashed; }
.pm-tone-done { color: var(--text-45); border-color: var(--border); background: transparent; }
.pm-tone-off { color: var(--text-45); border-color: var(--border); background: transparent; text-decoration: line-through; }

/* Kanban (Work Management): pipeline columns, drag to move */
.pm-kanban { overflow-x: auto; }
.pm-kanban .kanban-column { min-width: 220px; }
.pm-kanban-item { cursor: grab; }
.pm-kanban-item.is-dragging { opacity: 0.4; }
.pm-kanban-office { margin: -4px 0 8px; padding: 0 2px; }
.pm-kanban-col.pm-drop-over { outline: 1px dashed var(--border-hover); outline-offset: -2px; background: var(--bg-card-hover); }

/* Job panel (shoot page) */
.pm-job-head-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.pm-field { margin-bottom: 14px; }
.pm-grid .pm-field { margin-bottom: 0; }
.pm-rate-row { display: flex; align-items: center; gap: 8px; }
.pm-rate-row .form-input { max-width: 140px; }
.pm-rate-tag { font-size: var(--fs-xs); color: var(--text-45); white-space: nowrap; }
.pm-in-num { max-width: 120px; padding: 0.5rem 0.6rem !important; font-variant-numeric: tabular-nums; }
.pm-in-cur { max-width: 96px; padding: 0.5rem 0.6rem !important; }
.pm-brief { min-height: 96px; resize: vertical; line-height: 1.5; }

.pm-svc-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-svc-toggle {
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-hover);
  background: transparent;
  color: var(--text-60);
  font-family: var(--font);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.pm-svc-toggle:hover { color: var(--text); border-color: var(--text-45); }
.pm-svc-toggle.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }

.pm-sub-head {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-45);
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.pm-money { margin-bottom: 6px; }
.pm-assign-table td { padding: 6px 8px; }
.pm-paid { color: var(--status-positive); }
.pm-x {
  background: none;
  border: none;
  color: var(--text-45);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.pm-x:hover { color: var(--status-negative); }
.pm-add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pm-add-row .form-input, .pm-add-row .form-select { width: auto; min-width: 140px; flex: 0 1 200px; padding: 0.5rem 0.7rem; }
.pm-add-row .pm-in-num { flex: 0 1 120px; min-width: 100px; }

.pm-hist { display: flex; flex-direction: column; gap: 2px; }
.pm-hist-row { display: flex; gap: 12px; align-items: baseline; font-size: var(--fs-sm); padding: 4px 0; border-bottom: 1px solid var(--border); }
.pm-hist-move { color: var(--text); min-width: 170px; }
.pm-hist-reason { color: var(--text-45); flex: 1; }
.pm-hist-time { color: var(--text-45); font-size: var(--fs-xs); white-space: nowrap; }

/* Setup tables */
.pm-setup-table .form-input, .pm-setup-table .form-select { padding: 0.45rem 0.6rem; font-size: var(--fs-sm); }
.pm-setup-table td { padding: 6px 8px; }
.pm-color { width: 34px; height: 30px; padding: 0; border: 1px solid var(--border-hover); border-radius: 6px; background: none; cursor: pointer; }
.pm-color-cell { display: inline-flex; align-items: center; gap: 8px; }
.pm-svc-boxes { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pm-svc-box { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--text-60); white-space: nowrap; cursor: pointer; }
.pm-add-rule .pm-svc-boxes { flex: 1 1 100%; order: 3; }

/* Calendar office filter */
.pm-cal-office { margin-left: auto; }

@media (max-width: 768px) {
  .pm-c-people, .pm-c-date:nth-of-type(5) { display: none; }
  .pm-hist-move { min-width: 0; }

  /* Board filters: the search and a Filters button; the rest is in the sheet */
  .pm-filter-bar { flex-wrap: nowrap; padding: 0; background: none; border: none; animation: none; }
  .pm-filter-bar .wm-search { flex: 1 1 auto; min-width: 0; }
  .pm-filter-bar .wm-search-input { width: 100%; min-height: 40px; font-size: 16px; }
  .m-sheet.is-open .wm-filter-group { flex-direction: column; align-items: stretch; gap: 6px; }
  .m-sheet.is-open .wm-filter-clear { align-self: flex-start; min-height: 40px; }

  /* Board: each shoot is a card. Address on top (wraps), client and editor,
     flags, office, services, then status, shoot date and amount */
  .pm-table-wrap { overflow: visible; }
  .pm-table, .pm-table tbody { display: block; }
  .pm-table thead { display: none; }
  .pm-table tr.pm-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "title  title  title"
      "office office office"
      "svc    svc    svc"
      "status date   rate";
    align-items: center;
    gap: 8px 10px;
    padding: 14px;
    margin-top: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .pm-table tr.pm-row td { display: block; padding: 0; border: none; width: auto; min-width: 0; }
  .pm-table tr.pm-row td:empty { display: none; }
  .pm-table td.pm-c-title { grid-area: title; }
  .pm-table td.pm-c-office { grid-area: office; }
  .pm-table td.pm-c-svc { grid-area: svc; }
  .pm-table td.pm-c-status { grid-area: status; }
  .pm-table td.pm-c-date { grid-area: date; font-size: var(--fs-xs); }
  .pm-table td.pm-c-rate { grid-area: rate; font-weight: var(--fw-medium); }
  .pm-table tr.pm-row td.pm-c-people,
  .pm-table tr.pm-row td.pm-c-date:nth-of-type(5) { display: none; }
  .pm-job-name { font-size: var(--fs-md); line-height: 1.35; overflow-wrap: anywhere; }
  .pm-svc-chip { margin: 2px 4px 2px 0; }
  .pm-table .pm-status-select { min-height: 32px; font-size: var(--fs-sm); max-width: 160px; }
  .pm-group-head { padding: 10px 4px; }
}
.pm-in-address { min-width: 220px; }
.pm-bill-to { min-width: 260px; resize: vertical; line-height: 1.4; }
.pm-bill-office td { border-top: none; }
