/* PMS Goal Templates — admin */

.pms-page {
  --pms-primary: #3a57e8;
  --pms-purple: #6a3ef6;
  --pms-green: #61c797;
  --pms-ink: #16192a;
  --pms-muted: #7b8496;
  --pms-border: #e7ebf3;
  --pms-soft: #f5f7fb;
  --pms-card: #ffffff;
}

.pms-page .page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pms-page .page-header h3 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-page .page-header p {
  margin: 0;
  color: var(--pms-muted);
  font-size: 14px;
}

.pms-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.pms-dept-panel,
.pms-templates-panel {
  background: var(--pms-card);
  border: 1px solid var(--pms-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(24, 39, 75, 0.05);
}

.pms-dept-panel {
  position: sticky;
  top: 90px;
  overflow: hidden;
}

.pms-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pms-border);
}

.pms-panel-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-panel-head span {
  font-size: 12px;
  color: var(--pms-muted);
}

.pms-dept-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.pms-dept-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pms-dept-item:hover {
  background: var(--pms-soft);
}

.pms-dept-item.is-active {
  background: linear-gradient(135deg, #eef1ff, #f5f2ff);
  box-shadow: inset 0 0 0 1px #d5dbff;
}

.pms-dept-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pms-dept-meta {
  min-width: 0;
  flex: 1;
}

.pms-dept-name {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--pms-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pms-dept-count {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--pms-muted);
}

.pms-templates-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pms-border);
  flex-wrap: wrap;
}

.pms-templates-toolbar h4 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-templates-toolbar p {
  margin: 0;
  font-size: 13px;
  color: var(--pms-muted);
}

.pms-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pms-search {
  min-width: 220px;
}

.pms-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--pms-primary), var(--pms-purple));
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(58, 87, 232, 0.25);
}

.pms-btn-primary:hover {
  filter: brightness(1.03);
}

.pms-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--pms-border);
  border-radius: 9px;
  background: #fff;
  color: #4a5468;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pms-btn-ghost:hover {
  background: var(--pms-soft);
  border-color: #cfd7ea;
}

.pms-template-list {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 360px;
}

.pms-template-card {
  border: 1px solid var(--pms-border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.pms-template-card:hover {
  border-color: #cfd7ea;
  box-shadow: 0 10px 24px rgba(24, 39, 75, 0.06);
}

.pms-template-card.is-open {
  border-color: #c5ceff;
  box-shadow: 0 12px 28px rgba(58, 87, 232, 0.08);
}

.pms-template-card__top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
}

.pms-template-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef1ff, #f3efff);
  color: var(--pms-primary);
  font-size: 18px;
  flex-shrink: 0;
}

.pms-template-card__main {
  min-width: 0;
  flex: 1;
}

.pms-template-card__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pms-template-card__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pms-badge--active {
  background: #e6f8f0;
  color: #2f9e72;
}

.pms-badge--draft {
  background: #fff4e8;
  color: #c56a12;
}

.pms-template-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
}

.pms-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--pms-muted);
}

.pms-meta-item strong {
  color: #3c4453;
  font-weight: 650;
}

.pms-weight-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef1ff;
  color: var(--pms-primary);
  font-size: 12px;
  font-weight: 700;
}

.pms-template-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pms-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--pms-border);
  background: #fff;
  color: #5b6577;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pms-icon-btn:hover {
  background: var(--pms-soft);
  color: var(--pms-primary);
}

.pms-icon-btn--danger:hover {
  color: #dc3545;
  background: #fff5f5;
}

.pms-template-card__body {
  border-top: 1px solid var(--pms-border);
  background: #fbfcfe;
  padding: 14px 18px 18px;
}

.pms-goal {
  border: 1px solid var(--pms-border);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
}

.pms-goal:last-child {
  margin-bottom: 0;
}

.pms-goal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.pms-goal__index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pms-primary), var(--pms-purple));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
}

.pms-goal__title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--pms-ink);
}

.pms-goal__desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--pms-muted);
  line-height: 1.45;
}

.pms-subgoals {
  border-top: 1px dashed #e4e8f0;
  padding: 10px 14px 12px 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pms-subgoal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--pms-soft);
}

.pms-subgoal__title {
  font-size: 13px;
  color: #3c4453;
  font-weight: 550;
}

.pms-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--pms-muted);
}

.pms-empty__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef1ff, #f3efff);
  color: var(--pms-primary);
  font-size: 26px;
}

.pms-empty h5 {
  margin: 0 0 6px;
  color: var(--pms-ink);
  font-weight: 700;
}

.pms-empty p {
  margin: 0 0 16px;
  font-size: 13.5px;
}

/* Form modal */
.pms-modal .ant-modal-content {
  border-radius: 16px;
  overflow: hidden;
}

.pms-modal .ant-modal-header {
  border-bottom: 1px solid var(--pms-border);
  padding: 0px;
}

.pms-modal .ant-modal-title {
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-modal .ant-modal-body {
  /* padding: 18px 22px 8px; */
  max-height: min(70vh, 680px);
  overflow-y: auto;
}

.pms-modal .ant-modal-footer {
  border-top: 1px solid var(--pms-border);
  /* padding: 14px 22px; */
}

.pms-form-section {
  margin-bottom: 18px;
}

.pms-form-section__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #4a5468;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pms-goal-editor {
  border: 1px solid var(--pms-border);
  border-radius: 12px;
  padding: 14px;
  background: #fbfcfe;
  margin-bottom: 12px;
}

.pms-goal-editor__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.pms-goal-editor__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--pms-ink);
}

.pms-subgoal-editor {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #d9e0ef;
}

.pms-weight-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--pms-muted);
}

.pms-weight-hint.is-ok {
  color: #2f9e72;
}

.pms-weight-hint.is-bad {
  color: #dc3545;
}

.pms-coming-soon {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  background: #fff;
  border: 1px dashed #dfe4ee;
  border-radius: 16px;
  color: var(--pms-muted);
  padding: 40px 20px;
}

.pms-coming-soon h4 {
  margin: 12px 0 6px;
  color: var(--pms-ink);
}

/* Create / Edit template page */
.pms-editor-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pms-editor-card {
  background: #fff;
  border: 1px solid var(--pms-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(24, 39, 75, 0.05);
  padding: 18px;
}

.pms-details-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pms-details-summary__main {
  min-width: 0;
  flex: 1;
}

.pms-editor-goals {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pms-subgoals__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pms-subgoals__title {
  font-size: 12.5px;
  font-weight: 700;
  color: #4a5468;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pms-subgoal__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.pms-subgoal__label {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eee8ff;
  color: #6a3ef6;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 991.98px) {
  .pms-layout {
    grid-template-columns: 1fr;
  }

  .pms-dept-panel {
    position: static;
  }

  .pms-dept-list {
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 12px;
  }

  .pms-dept-item {
    min-width: 180px;
    flex-direction: column;
    align-items: flex-start;
  }

  .pms-subgoals {
    padding-left: 14px;
  }
}
